diff --git a/3rdparty/css/chosen-sprite.png b/3rdparty/css/chosen-sprite.png
new file mode 100644
index 0000000000..f20db4439e
Binary files /dev/null and b/3rdparty/css/chosen-sprite.png differ
diff --git a/3rdparty/css/chosen.css b/3rdparty/css/chosen.css
new file mode 100644
index 0000000000..247d07bf02
--- /dev/null
+++ b/3rdparty/css/chosen.css
@@ -0,0 +1,340 @@
+/* @group Base */
+select.chzn-select {
+ visibility: hidden;
+ height: 28px !important;
+ min-height: 28px !important;
+}
+.chzn-container {
+ font-size: 13px;
+ position: relative;
+ display: inline-block;
+ zoom: 1;
+ *display: inline;
+}
+.chzn-container .chzn-drop {
+ background: #fff;
+ border: 1px solid #aaa;
+ border-top: 0;
+ position: absolute;
+ top: 29px;
+ left: 0;
+ -webkit-box-shadow: 0 4px 5px rgba(0,0,0,.15);
+ -moz-box-shadow : 0 4px 5px rgba(0,0,0,.15);
+ -o-box-shadow : 0 4px 5px rgba(0,0,0,.15);
+ box-shadow : 0 4px 5px rgba(0,0,0,.15);
+ z-index: 999;
+}
+/* @end */
+
+/* @group Single Chosen */
+.chzn-container-single .chzn-single {
+ background-color: #fff;
+ background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #eeeeee), color-stop(0.5, white));
+ background-image: -webkit-linear-gradient(center bottom, #eeeeee 0%, white 50%);
+ background-image: -moz-linear-gradient(center bottom, #eeeeee 0%, white 50%);
+ background-image: -o-linear-gradient(top, #eeeeee 0%,#ffffff 50%);
+ background-image: -ms-linear-gradient(top, #eeeeee 0%,#ffffff 50%);
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#eeeeee', endColorstr='#ffffff',GradientType=0 );
+ background-image: linear-gradient(top, #eeeeee 0%,#ffffff 50%);
+ -webkit-border-radius: 4px;
+ -moz-border-radius : 4px;
+ border-radius : 4px;
+ -moz-background-clip : padding;
+ -webkit-background-clip: padding-box;
+ background-clip : padding-box;
+ border: 1px solid #aaa;
+ display: block;
+ overflow: hidden;
+ white-space: nowrap;
+ position: relative;
+ height: 26px;
+ line-height: 26px;
+ padding: 0 0 0 8px;
+ color: #444;
+ text-decoration: none;
+}
+.chzn-container-single .chzn-single span {
+ margin-right: 26px;
+ display: block;
+ overflow: hidden;
+ white-space: nowrap;
+ -o-text-overflow: ellipsis;
+ -ms-text-overflow: ellipsis;
+ -moz-binding: url('/xml/ellipsis.xml#ellipsis');
+ text-overflow: ellipsis;
+}
+.chzn-container-single .chzn-single div {
+ -webkit-border-radius: 0 4px 4px 0;
+ -moz-border-radius : 0 4px 4px 0;
+ border-radius : 0 4px 4px 0;
+ -moz-background-clip : padding;
+ -webkit-background-clip: padding-box;
+ background-clip : padding-box;
+ background: #ccc;
+ background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #ccc), color-stop(0.6, #eee));
+ background-image: -webkit-linear-gradient(center bottom, #ccc 0%, #eee 60%);
+ background-image: -moz-linear-gradient(center bottom, #ccc 0%, #eee 60%);
+ background-image: -o-linear-gradient(bottom, #ccc 0%, #eee 60%);
+ background-image: -ms-linear-gradient(top, #cccccc 0%,#eeeeee 60%);
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#cccccc', endColorstr='#eeeeee',GradientType=0 );
+ background-image: linear-gradient(top, #cccccc 0%,#eeeeee 60%);
+ border-left: 1px solid #aaa;
+ position: absolute;
+ right: 0;
+ top: 0;
+ display: block;
+ height: 100%;
+ width: 18px;
+}
+.chzn-container-single .chzn-single div b {
+ background: url('chosen-sprite.png') no-repeat 0 1px;
+ display: block;
+ width: 100%;
+ height: 100%;
+}
+.chzn-container-single .chzn-search {
+ padding: 3px 4px;
+ margin: 0;
+ white-space: nowrap;
+}
+.chzn-container-single .chzn-search input {
+ background: #fff url('chosen-sprite.png') no-repeat 100% -20px;
+ background: url('chosen-sprite.png') no-repeat 100% -20px, -webkit-gradient(linear, left bottom, left top, color-stop(0.85, white), color-stop(0.99, #eeeeee));
+ background: url('chosen-sprite.png') no-repeat 100% -20px, -webkit-linear-gradient(center bottom, white 85%, #eeeeee 99%);
+ background: url('chosen-sprite.png') no-repeat 100% -20px, -moz-linear-gradient(center bottom, white 85%, #eeeeee 99%);
+ background: url('chosen-sprite.png') no-repeat 100% -20px, -o-linear-gradient(bottom, white 85%, #eeeeee 99%);
+ background: url('chosen-sprite.png') no-repeat 100% -20px, -ms-linear-gradient(top, #ffffff 85%,#eeeeee 99%);
+ background: url('chosen-sprite.png') no-repeat 100% -20px, -ms-linear-gradient(top, #ffffff 85%,#eeeeee 99%);
+ background: url('chosen-sprite.png') no-repeat 100% -20px, linear-gradient(top, #ffffff 85%,#eeeeee 99%);
+ margin: 1px 0;
+ padding: 4px 20px 4px 5px;
+ outline: 0;
+ border: 1px solid #aaa;
+ font-family: sans-serif;
+ font-size: 1em;
+}
+.chzn-container-single .chzn-drop {
+ -webkit-border-radius: 0 0 4px 4px;
+ -moz-border-radius : 0 0 4px 4px;
+ border-radius : 0 0 4px 4px;
+ -moz-background-clip : padding;
+ -webkit-background-clip: padding-box;
+ background-clip : padding-box;
+}
+/* @end */
+
+/* @group Multi Chosen */
+.chzn-container-multi .chzn-choices {
+ background-color: #fff;
+ background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0.85, white), color-stop(0.99, #eeeeee));
+ background-image: -webkit-linear-gradient(center bottom, white 85%, #eeeeee 99%);
+ background-image: -moz-linear-gradient(center bottom, white 85%, #eeeeee 99%);
+ background-image: -o-linear-gradient(bottom, white 85%, #eeeeee 99%);
+ background-image: -ms-linear-gradient(top, #ffffff 85%,#eeeeee 99%);
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#eeeeee',GradientType=0 );
+ background-image: linear-gradient(top, #ffffff 85%,#eeeeee 99%);
+ border: 1px solid #aaa;
+ margin: 0;
+ padding: 0;
+ cursor: text;
+ overflow: hidden;
+ height: auto !important;
+ height: 1%;
+ position: relative;
+}
+.chzn-container-multi .chzn-choices li {
+ float: left;
+ list-style: none;
+}
+.chzn-container-multi .chzn-choices .search-field {
+ white-space: nowrap;
+ margin: 0;
+ padding: 0;
+}
+.chzn-container-multi .chzn-choices .search-field input {
+ color: #666;
+ background: transparent !important;
+ border: 0 !important;
+ padding: 5px;
+ margin: 1px 0;
+ outline: 0;
+ -webkit-box-shadow: none;
+ -moz-box-shadow : none;
+ -o-box-shadow : none;
+ box-shadow : none;
+}
+.chzn-container-multi .chzn-choices .search-field .default {
+ color: #999;
+}
+.chzn-container-multi .chzn-choices .search-choice {
+ -webkit-border-radius: 3px;
+ -moz-border-radius : 3px;
+ border-radius : 3px;
+ -moz-background-clip : padding;
+ -webkit-background-clip: padding-box;
+ background-clip : padding-box;
+ background-color: #e4e4e4;
+ background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #e4e4e4), color-stop(0.7, #eeeeee));
+ background-image: -webkit-linear-gradient(center bottom, #e4e4e4 0%, #eeeeee 70%);
+ background-image: -moz-linear-gradient(center bottom, #e4e4e4 0%, #eeeeee 70%);
+ background-image: -o-linear-gradient(bottom, #e4e4e4 0%, #eeeeee 70%);
+ background-image: -ms-linear-gradient(top, #e4e4e4 0%,#eeeeee 70%);
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#e4e4e4', endColorstr='#eeeeee',GradientType=0 );
+ background-image: linear-gradient(top, #e4e4e4 0%,#eeeeee 70%);
+ color: #333;
+ border: 1px solid #b4b4b4;
+ line-height: 13px;
+ padding: 3px 19px 3px 6px;
+ margin: 3px 0 3px 5px;
+ position: relative;
+}
+.chzn-container-multi .chzn-choices .search-choice span {
+ cursor: default;
+}
+.chzn-container-multi .chzn-choices .search-choice-focus {
+ background: #d4d4d4;
+}
+.chzn-container-multi .chzn-choices .search-choice .search-choice-close {
+ display: block;
+ position: absolute;
+ right: 5px;
+ top: 6px;
+ width: 8px;
+ height: 9px;
+ font-size: 1px;
+ background: url(chosen-sprite.png) right top no-repeat;
+}
+.chzn-container-multi .chzn-choices .search-choice .search-choice-close:hover {
+ background-position: right -9px;
+}
+.chzn-container-multi .chzn-choices .search-choice-focus .search-choice-close {
+ background-position: right -9px;
+}
+/* @end */
+
+/* @group Results */
+.chzn-container .chzn-results {
+ margin: 0 4px 4px 0;
+ max-height: 190px;
+ padding: 0 0 0 4px;
+ position: relative;
+ overflow-x: hidden;
+ overflow-y: auto;
+}
+.chzn-container-multi .chzn-results {
+ margin: -1px 0 0;
+ padding: 0;
+}
+.chzn-container .chzn-results li {
+ line-height: 80%;
+ padding: 7px 7px 8px;
+ margin: 0;
+ list-style: none;
+}
+.chzn-container .chzn-results .active-result {
+ cursor: pointer;
+}
+.chzn-container .chzn-results .highlighted {
+ background: #3875d7;
+ color: #fff;
+}
+.chzn-container .chzn-results li em {
+ background: #feffde;
+ font-style: normal;
+}
+.chzn-container .chzn-results .highlighted em {
+ background: transparent;
+}
+.chzn-container .chzn-results .no-results {
+ background: #f4f4f4;
+}
+.chzn-container .chzn-results .group-result {
+ cursor: default;
+ color: #999;
+ font-weight: bold;
+}
+.chzn-container .chzn-results .group-option {
+ padding-left: 20px;
+}
+.chzn-container-multi .chzn-drop .result-selected {
+ display: none;
+}
+/* @end */
+
+/* @group Active */
+.chzn-container-active .chzn-single {
+ -webkit-box-shadow: 0 0 5px rgba(0,0,0,.3);
+ -moz-box-shadow : 0 0 5px rgba(0,0,0,.3);
+ -o-box-shadow : 0 0 5px rgba(0,0,0,.3);
+ box-shadow : 0 0 5px rgba(0,0,0,.3);
+ border: 1px solid #5897fb;
+}
+.chzn-container-active .chzn-single-with-drop {
+ border: 1px solid #aaa;
+ -webkit-box-shadow: 0 1px 0 #fff inset;
+ -moz-box-shadow : 0 1px 0 #fff inset;
+ -o-box-shadow : 0 1px 0 #fff inset;
+ box-shadow : 0 1px 0 #fff inset;
+ background-color: #eee;
+ background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, white), color-stop(0.5, #eeeeee));
+ background-image: -webkit-linear-gradient(center bottom, white 0%, #eeeeee 50%);
+ background-image: -moz-linear-gradient(center bottom, white 0%, #eeeeee 50%);
+ background-image: -o-linear-gradient(bottom, white 0%, #eeeeee 50%);
+ background-image: -ms-linear-gradient(top, #ffffff 0%,#eeeeee 50%);
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#eeeeee',GradientType=0 );
+ background-image: linear-gradient(top, #ffffff 0%,#eeeeee 50%);
+ -webkit-border-bottom-left-radius : 0;
+ -webkit-border-bottom-right-radius: 0;
+ -moz-border-radius-bottomleft : 0;
+ -moz-border-radius-bottomright: 0;
+ border-bottom-left-radius : 0;
+ border-bottom-right-radius: 0;
+}
+.chzn-container-active .chzn-single-with-drop div {
+ background: transparent;
+ border-left: none;
+}
+.chzn-container-active .chzn-single-with-drop div b {
+ background-position: -18px 1px;
+}
+.chzn-container-active .chzn-choices {
+ -webkit-box-shadow: 0 0 5px rgba(0,0,0,.3);
+ -moz-box-shadow : 0 0 5px rgba(0,0,0,.3);
+ -o-box-shadow : 0 0 5px rgba(0,0,0,.3);
+ box-shadow : 0 0 5px rgba(0,0,0,.3);
+ border: 1px solid #5897fb;
+}
+.chzn-container-active .chzn-choices .search-field input {
+ color: #111 !important;
+}
+/* @end */
+
+/* @group Right to Left */
+.chzn-rtl { direction:rtl;text-align: right; }
+.chzn-rtl .chzn-single { padding-left: 0; padding-right: 8px; }
+.chzn-rtl .chzn-single span { margin-left: 26px; margin-right: 0; }
+.chzn-rtl .chzn-single div {
+ left: 0; right: auto;
+ border-left: none; border-right: 1px solid #aaaaaa;
+ -webkit-border-radius: 4px 0 0 4px;
+ -moz-border-radius : 4px 0 0 4px;
+ border-radius : 4px 0 0 4px;
+}
+.chzn-rtl .chzn-choices li { float: right; }
+.chzn-rtl .chzn-choices .search-choice { padding: 3px 6px 3px 19px; margin: 3px 5px 3px 0; }
+.chzn-rtl .chzn-choices .search-choice .search-choice-close { left: 5px; right: auto; background-position: right top;}
+.chzn-rtl.chzn-container-single .chzn-results { margin-left: 4px; margin-right: 0; padding-left: 0; padding-right: 4px; }
+.chzn-rtl .chzn-results .group-option { padding-left: 0; padding-right: 20px; }
+.chzn-rtl.chzn-container-active .chzn-single-with-drop div { border-right: none; }
+.chzn-rtl .chzn-search input {
+ background: url('chosen-sprite.png') no-repeat -38px -20px, #ffffff;
+ background: url('chosen-sprite.png') no-repeat -38px -20px, -webkit-gradient(linear, left bottom, left top, color-stop(0.85, white), color-stop(0.99, #eeeeee));
+ background: url('chosen-sprite.png') no-repeat -38px -20px, -webkit-linear-gradient(center bottom, white 85%, #eeeeee 99%);
+ background: url('chosen-sprite.png') no-repeat -38px -20px, -moz-linear-gradient(center bottom, white 85%, #eeeeee 99%);
+ background: url('chosen-sprite.png') no-repeat -38px -20px, -o-linear-gradient(bottom, white 85%, #eeeeee 99%);
+ background: url('chosen-sprite.png') no-repeat -38px -20px, -ms-linear-gradient(top, #ffffff 85%,#eeeeee 99%);
+ background: url('chosen-sprite.png') no-repeat -38px -20px, -ms-linear-gradient(top, #ffffff 85%,#eeeeee 99%);
+ background: url('chosen-sprite.png') no-repeat -38px -20px, linear-gradient(top, #ffffff 85%,#eeeeee 99%);
+ padding: 4px 5px 4px 20px;
+}
+/* @end */
\ No newline at end of file
diff --git a/3rdparty/js/chosen/LICENSE.md b/3rdparty/js/chosen/LICENSE.md
new file mode 100644
index 0000000000..80109bba80
--- /dev/null
+++ b/3rdparty/js/chosen/LICENSE.md
@@ -0,0 +1,24 @@
+# Chosen, a Select Box Enhancer for jQuery and Protoype
+## by Patrick Filler for [Harvest](http://getharvest.com)
+
+Available for use under the [MIT License](http://en.wikipedia.org/wiki/MIT_License)
+
+Copyright (c) 2011 by Harvest
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
\ No newline at end of file
diff --git a/3rdparty/js/chosen/README.md b/3rdparty/js/chosen/README.md
new file mode 100644
index 0000000000..cee8ed1cc0
--- /dev/null
+++ b/3rdparty/js/chosen/README.md
@@ -0,0 +1,46 @@
+# Chosen
+
+Chosen is a library for making long, unwieldy select boxes more user friendly.
+
+- jQuery support: 1.4+
+- Prototype support: 1.7+
+
+For documentation, usage, and examples, see:
+http://harvesthq.github.com/chosen
+
+### Contributing to Chosen
+
+Contributions and pull requests are very welcome. Please follow these guidelines when submitting new code.
+
+1. Make all changes in Coffeescript files, **not** JavaScript files.
+2. For feature changes, update both jQuery *and* Prototype versions
+3. Use 'cake build' to generate Chosen's JavaScript file and minified version.
+4. Don't touch the VERSION file
+5. Submit a Pull Request using GitHub.
+
+### Using CoffeeScript & Cake
+
+First, make sure you have the proper CoffeeScript / Cake set-up in place.
+
+1. Install Coffeescript: the [CoffeeScript documentation](http://jashkenas.github.com/coffee-script/) provides easy-to-follow instructions.
+2. Install UglifyJS: npm -g install uglify-js
+3. Verify that your $NODE_PATH is properly configured using echo $NODE_PATH
+
+Once you're configured, building the JavasScript from the command line is easy:
+
+ cake build # build Chosen from source
+ cake watch # watch coffee/ for changes and build Chosen
+
+If you're interested, you can find the recipes in Cakefile.
+
+
+### Chosen Credits
+
+- Built by [Harvest](http://www.getharvest.com/)
+- Concept and development by [Patrick Filler](http://www.patrickfiller.com/)
+- Design and CSS by [Matthew Lettini](http://matthewlettini.com/)
+
+### Notable Forks
+
+- [Chosen for MooTools](https://github.com/julesjanssen/chosen), by Jules Janssen
+- [Chosen Drupal 7 Module](https://github.com/Polzme/chosen), by Pol Dell'Aiera
\ No newline at end of file
diff --git a/3rdparty/js/chosen/VERSION b/3rdparty/js/chosen/VERSION
new file mode 100644
index 0000000000..f374f6662e
--- /dev/null
+++ b/3rdparty/js/chosen/VERSION
@@ -0,0 +1 @@
+0.9.1
diff --git a/3rdparty/js/chosen/chosen.jquery.js b/3rdparty/js/chosen/chosen.jquery.js
new file mode 100644
index 0000000000..5ea409d90e
--- /dev/null
+++ b/3rdparty/js/chosen/chosen.jquery.js
@@ -0,0 +1,786 @@
+// Chosen, a Select Box Enhancer for jQuery and Protoype
+// by Patrick Filler for Harvest, http://getharvest.com
+//
+// Version 0.9
+// Full source at https://github.com/harvesthq/chosen
+// Copyright (c) 2011 Harvest http://getharvest.com
+
+// MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
+// This file is generated by `cake build`, do not edit it by hand.
+(function() {
+ /*
+ Chosen source: generate output using 'cake build'
+ Copyright (c) 2011 by Harvest
+ */ var $, Chosen, get_side_border_padding, root;
+ var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
+ root = this;
+ $ = jQuery;
+ $.fn.extend({
+ chosen: function(data, options) {
+ return $(this).each(function(input_field) {
+ if (!($(this)).hasClass("chzn-done")) {
+ return new Chosen(this, data, options);
+ }
+ });
+ }
+ });
+ Chosen = (function() {
+ function Chosen(elmn) {
+ this.set_default_values();
+ this.form_field = elmn;
+ this.form_field_jq = $(this.form_field);
+ this.is_multiple = this.form_field.multiple;
+ this.is_rtl = this.form_field_jq.hasClass("chzn-rtl");
+ this.default_text_default = this.form_field.multiple ? "Select Some Options" : "Select an Option";
+ this.set_up_html();
+ this.register_observers();
+ this.form_field_jq.addClass("chzn-done");
+ }
+ Chosen.prototype.set_default_values = function() {
+ this.click_test_action = __bind(function(evt) {
+ return this.test_active_click(evt);
+ }, this);
+ this.active_field = false;
+ this.mouse_on_container = false;
+ this.results_showing = false;
+ this.result_highlighted = null;
+ this.result_single_selected = null;
+ return this.choices = 0;
+ };
+ Chosen.prototype.set_up_html = function() {
+ var container_div, dd_top, dd_width, sf_width;
+ this.container_id = this.form_field.id.length ? this.form_field.id.replace(/(:|\.)/g, '_') : this.generate_field_id();
+ this.container_id += "_chzn";
+ this.f_width = this.form_field_jq.width();
+ this.default_text = this.form_field_jq.data('placeholder') ? this.form_field_jq.data('placeholder') : this.default_text_default;
+ container_div = $("
=0||c.html.indexOf("[")===0){e=c.html.replace(/\[|\]/g,"").split(" ");if(e.length)for(o=0,q=e.length;o "+b.html.substr(j+h.length),k=k.substr(0,j)+""+k.substr(j)):k=b.html,$(f).innerHTML!==k&&$(f).update(k),this.result_activate($(f)),b.group_array_index!=null&&$(this.results_data[b.group_array_index].dom_id).show()):($(f)===this.result_highlight&&this.result_clear_highlight(),this.result_deactivate($(f)))}}return g<1&&h.length?this.no_results(h):this.winnow_results_set_highlight()},a.prototype.winnow_results_clear=function(){var a,b,c,d,e;this.search_field.clear(),b=this.search_results.select("li"),e=[];for(c=0,d=b.length;c"+c.html.substr(k+i.length),l=l.substr(0,k)+""+l.substr(k)):l=c.html,a("#"+g).html!==l&&a("#"+g).html(l),this.result_activate(a("#"+g)),c.group_array_index!=null&&a("#"+this.results_data[c.group_array_index].dom_id).show()):(this.result_highlight&&g===this.result_highlight.attr("id")&&this.result_clear_highlight(),this.result_deactivate(a("#"+g)))}}return h<1&&i.length?this.no_results(i):this.winnow_results_set_highlight()},b.prototype.winnow_results_clear=function(){var b,c,d,e,f;this.search_field.val(""),c=this.search_results.find("li"),f=[];for(d=0,e=c.length;d
';
- $("#usertable").append( newrow );
-
- // Clear forms
- $("input[x-use='createuserfield']").val( "" );
- $("input[x-use='createusercheckbox']").attr( "checked", false );
- }
-
- function userRemoved( username ){
- $( "tr[x-uid='"+username+"']" ).remove();
- }
-
- function groupCreated( groupname ){
- var newrow = ' ';
- newrow = newrow+' ';
- newrow = newrow+' ';
- $("#grouptable").append( newrow );
-
- // Delete form content
- $("input[x-use='creategroupfield']").val( "" );
-
- // Add group option to Create User and Edit User
- var createuser = ' '+groupname+'' + groupname + ' ';
- newrow = newrow + '
';
- $("#createusergroups").append( createuser );
- var changeuser = ' '+groupname+'
';
- $("#changegroupsform").append( changeuser );
- }
-
- function groupRemoved( groupname ){
- // Delete the options
- $( "tr[x-gid='"+groupname+"']" ).remove();
- $( "span[x-gid='"+groupname+"']" ).remove();
- $( "input[x-gid='"+groupname+"']" ).remove();
-
- // remove it from user list
- $( "div[x-use='usergroupsdiv']" ).each(function(index){
- var content = $(this).text();
- var list = content.split( ", " );
- var newlist = [];
- for( var i = 0; i < list.length; i++ ){
- var temp = list[i];
- if( temp != groupname ){
- newlist.push( temp );
- }
- }
- var newstring = newlist.join( ", " );
- $(this).html( newstring )
- });
-
- }
-
- //#########################################################################
- // Editing the users properties by clicking the cell
- //#########################################################################
-
- // Password (clicking on user name)
- $("span[x-use='usernamediv']").live( "click", function(){
- if( togglepassword == "" || $(this).parent().parent().attr("x-uid") != togglepassword ){
- togglepassword = $(this).parent().parent().attr("x-uid");
- // Set the username!
- $("#changepassworduid").val(togglepassword);
- $("#changepasswordpwd").val("");
- $(this).parent().append( $('#changepassword') );
- $('#changepassword').show();
- }
- else{
- $('#changepassword').hide();
- togglepassword = "";
- }
+ );
+ $(this).parent().parent().remove();
});
-
- $("#changepasswordbutton").click( function(){
- // Serialize the data
- var post = $( "#changepasswordform" ).serialize();
- // Ajax foo
- $.post( 'ajax/changepassword.php', post, function(data){
- if( data.status == "success" ){
- togglepassword = "";
- $('#changepassword').hide();
- }
- else{
- printError( data.data.message );
- }
- });
- return false;
- });
-
- // Groups
- $("div[x-use='usergroupsdiv']").live( "click", function(){
- if( togglegroup == "" || $(this).parent().parent().attr("x-uid") != togglegroup){
- togglegroup = $(this).parent().parent().attr("x-uid");
- var groups = $(this).text();
- groups = groups.split(", ");
- $("input[x-use='togglegroup']").each( function(index){
- var check = false;
- // Group checked?
- for( var i = 0; i < groups.length; i++ ){
- if( $(this).val() == groups[i] ){
- check = true;
- }
- }
-
- // Check/uncheck
- if( check ){
- $(this).attr("checked","checked");
- }
- else{
- $(this).removeAttr("checked");
- }
- });
- $("#changegroupuid").val(togglegroup);
- $(this).empty();
- $(this).parent().append( $('#changegroups') );
- $('#changegroups').show();
- }
- else{
- var groups = [];
- $("input[x-use='togglegroup']").each( function(index){
- if( $(this).attr("checked")){
- groups.push($(this).val());
- }
- });
- if( groups.length == 0 ){
- $("#changegroups").prev().html( ' ' );
- }
- else{
- $("#changegroups").prev().html( groups.join(", "));
- }
- $('#changegroups').hide();
- togglegroup = "";
- }
- });
-
- $("span[x-use='togglegroup']").live( "click", function(){
- if( $(this).prev().attr("checked")){
- $(this).prev().removeAttr("checked")
- }
- else{
- $(this).prev().attr("checked","checked")
- }
- doToggleGroup( $(this).attr("x-gid"));
- });
-
- $("input[x-use='togglegroup']").live( "click", function(){
- doToggleGroup( $(this).attr("x-gid"));
- });
- //#########################################################################
- // Clicking on buttons
- //#########################################################################
-
-
- // Create a new user
- $( "#createuserbutton" )
- .click(function(){
- if(!$( "#createuserbutton" ).data('active')){
- $( "#createuserbutton" ).data('active',true);
+
+ $('#newuser').submit(function(event){
+ event.preventDefault();
+ var username=$('#newusername').val();
+ var password=$('#newuserpassword').val();
+ var groups=$('#newusergroups').val();
+ $.post(
+ OC.filePath('admin','ajax','createuser.php'),
+ {
+ username:username,
+ password:password,
+ groups:groups,
+ },
+ function(result){
- // Create the post data
- var post = $( "#createuserdata" ).serialize();
-
- // Ajax call
- $.post( 'ajax/createuser.php', post, function(data){
- $( "#createuserbutton" ).data('active',false);
+ }
+ );
+ var tr=$('#rightcontent tr').first().clone();
+ tr.attr('data-uid',username);
+ tr.find('td.name').text(username);
+ tr.find('td.groups').text(groups.join(', '));
+ $('#rightcontent tr').first().after(tr);
+ if(groups.indexOf($('#leftcontent li.selected').text().trim())!=-1){
+ tr.find('td.select input').attr('checked','checked');
+ }
+ });
+
+ $('#newgroup').submit(function(event){
+ event.preventDefault();
+ var name=$('#newgroupname').val();
+ $.post(
+ OC.filePath('admin','ajax','creategroup.php'),
+ {groupname:name},
+ function(result){
+
+ }
+ );
+ $('#newusergroups').append('');
+ $('select[multiple]').trigger("liszt:updated");
+ var li=$('#leftcontent li').first().next().clone();
+ li.text(name);
+ $('#leftcontent li').first().after(li);
+ });
+
+ $('#leftcontent li').live('click',function(event){
+ $('#leftcontent li').removeClass('selected');
+ $(this).addClass('selected');
+ $('#rightcontent tr td.select input').show();
+ $('#rightcontent tr td.select input').removeAttr('checked');
+ var group=$(this).text().trim();
+ var rows=$('#rightcontent tr').filter(function(i,tr){
+ return ($(tr).children('td.groups').text().split(', ').indexOf(group)>-1);
+ });
+ rows.find('td.select input').attr('checked','checked');
+ });
+ $('#rightcontent tr td.select input').live('change',function(event){
+ var group=$('#leftcontent li.selected').text().trim();
+ var user=$(this).parent().parent().children('td.name').text().trim();
+ if(group=='admin' && user==OC.currentUser){
+ event.preventDefault();
+ $(this).attr('checked','checked');
+ return false;
+ }
+ if(group){
+ $.post(
+ OC.filePath('admin','ajax','togglegroups.php'),
+ {
+ username:user,
+ group:group
+ },
+ function(result){
- // If it says "success" then we are happy
- if( data.status == "success" ){
- userCreated( data.data.username, data.data.groups );
- }
- else{
- printError( data.data.message );
- }
- });
- }
- return false;
- });
-
- $( ".removeuserbutton" ).live( 'click', function() {
- uid = $( this ).parent().parent().attr( 'x-uid' );
- $("#deleteuserusername").html(uid);
- $("#deleteusernamefield").val(uid);
- $("#removeuserform").dialog( "open" );
- return false;
- });
-
- $( "#creategroupbutton" )
- .click(function(){
- // Serialize the data
- var post = $( "#creategroupdata" ).serialize();
- // Ajax foo
- $.post( 'ajax/creategroup.php', post, function(data){
- if( data.status == "success" ){
- groupCreated( data.data.groupname );
}
- else{
- printError( data.data.message );
- }
- });
- return false;
- });
-
- $( ".removegroupbutton" ).live( 'click', function(){
- gid = $( this ).parent().parent().attr( 'x-gid' );
- $("#removegroupgroupname").html(gid);
- $("#removegroupnamefield").val(gid);
- $("#removegroupform").dialog( "open" );
- return false;
- });
-
- //#########################################################################
- // Dialogs
- //#########################################################################
-
- // Removing users
- $( "#errordialog" ).dialog({
- autoOpen: false,
- modal: true,
- buttons: {
- OK: function() {
- $( this ).dialog( "close" );
+ );
+ var groups=$(this).parent().parent().children('td.groups').text().trim().split(', ');
+ if(groups[0]=='') groups.pop();
+ var index=groups.indexOf(group);
+ if(index==-1){
+ groups.push(group);
+ }else{
+ groups.splice(index,1);
}
+ $(this).parent().parent().children('td.groups').text(groups.join(', '));
}
});
-
- // Removing users
- $( "#removeuserform" ).dialog({
- autoOpen: false,
- height: 300,
- width: 350,
- modal: true,
- buttons: {
- "Remove user": function() {
- var post = $( "#removeuserdata" ).serialize();
- $.post( 'ajax/removeuser.php', post, function(data){
- if( data.status == "success" ){
- userRemoved( uid );
- }
- else{
- printError( data.data.message );
- }
- });
- $( this ).dialog( "close" );
- },
- Cancel: function() {
- $( this ).dialog( "close" );
- }
- },
- close: function() {
- true;
- }
- });
-
-
- // Dialog for adding users
- $( "#removegroupform" ).dialog({
- autoOpen: false,
- height: 300,
- width: 350,
- modal: true,
- buttons: {
- "Remove group": function(){
- var post = $( "#removegroupdata" ).serialize();
- $.post( 'ajax/removegroup.php', post, function(data){
- if( data.status == "success" ){
- groupRemoved( gid );
- }
- else{
- printError( data.data.message );
- }
- });
- $( this ).dialog( "close" );
- },
- Cancel: function() {
- $( this ).dialog( "close" );
- }
- },
- close: function(){
- true;
- }
- });
-
-} );
-
+});
diff --git a/admin/templates/users.php b/admin/templates/users.php
index fbb0fe79f3..8e34c908fc 100644
--- a/admin/templates/users.php
+++ b/admin/templates/users.php
@@ -1,107 +1,39 @@
-
-
-
-
-
-