summaryrefslogtreecommitdiffstats
path: root/codebase/sources/ext/dhtmlxscheduler_multiselect.js
diff options
context:
space:
mode:
authorAlexKlimenkov <shurick.klimenkov@gmail.com>2014-06-10 20:50:30 +0300
committerAlexKlimenkov <shurick.klimenkov@gmail.com>2014-06-10 20:50:30 +0300
commitb5a0589955460a44c5428c4cb5429fcfce265d23 (patch)
tree87db58400a3e036de646fb630cbb358beeac3bc1 /codebase/sources/ext/dhtmlxscheduler_multiselect.js
parente2aaaef8540fabd0b5200a4959c269d6f1ae352e (diff)
downloadscheduler-b5a0589955460a44c5428c4cb5429fcfce265d23.zip
scheduler-b5a0589955460a44c5428c4cb5429fcfce265d23.tar.gz
scheduler-b5a0589955460a44c5428c4cb5429fcfce265d23.tar.bz2
[update] version 4.1.0
Diffstat (limited to 'codebase/sources/ext/dhtmlxscheduler_multiselect.js')
-rw-r--r--codebase/sources/ext/dhtmlxscheduler_multiselect.js69
1 files changed, 69 insertions, 0 deletions
diff --git a/codebase/sources/ext/dhtmlxscheduler_multiselect.js b/codebase/sources/ext/dhtmlxscheduler_multiselect.js
new file mode 100644
index 0000000..c797198
--- /dev/null
+++ b/codebase/sources/ext/dhtmlxscheduler_multiselect.js
@@ -0,0 +1,69 @@
+/*
+dhtmlxScheduler v.4.1.0 Stardard
+
+This software is covered by GPL license. You also can obtain Commercial or Enterprise license to use it in non-GPL project - please contact sales@dhtmlx.com. Usage without proper license is prohibited.
+
+(c) Dinamenta, UAB.
+*/
+scheduler.form_blocks["multiselect"]={
+ render:function(sns) {
+ var _result = "<div class='dhx_multi_select_"+sns.name+"' style='overflow: auto; height: "+sns.height+"px; position: relative;' >";
+ for (var i=0; i<sns.options.length; i++) {
+ _result += "<label><input type='checkbox' value='"+sns.options[i].key+"'/>"+sns.options[i].label+"</label>";
+ if(convertStringToBoolean(sns.vertical)) _result += '<br/>';
+ }
+ _result += "</div>";
+ return _result;
+ },
+ set_value:function(node,value,ev,config){
+
+ var _children = node.getElementsByTagName('input');
+ for(var i=0;i<_children.length;i++) {
+ _children[i].checked = false; //unchecking all inputs on the form
+ }
+
+ function _mark_inputs(ids) { // ids = [ 0: undefined, 1: undefined, 2: true ... ]
+ var _children = node.getElementsByTagName('input');
+ for(var i=0;i<_children.length; i++) {
+ _children[i].checked = !! ids[_children[i].value];
+ }
+ }
+
+ var _ids = [];
+ if (ev[config.map_to]) {
+ var results = (ev[config.map_to] + "").split(',');
+ for (var i = 0; i < results.length; i++) {
+ _ids[results[i]] = true;
+ }
+ _mark_inputs(_ids);
+ } else {
+ if (scheduler._new_event || !config.script_url)
+ return;
+ var divLoading = document.createElement('div');
+ divLoading.className = 'dhx_loading';
+ divLoading.style.cssText = "position: absolute; top: 40%; left: 40%;";
+ node.appendChild(divLoading);
+ dhtmlxAjax.get(config.script_url + '?dhx_crosslink_' + config.map_to + '=' + ev.id + '&uid=' + scheduler.uid(), function(loader) {
+ var _result = loader.doXPath("//data/item");
+ var _ids = [];
+ for (var i = 0; i < _result.length; i++) {
+ _ids[_result[i].getAttribute(config.map_to)] = true;
+ }
+ _mark_inputs(_ids);
+ node.removeChild(divLoading);
+ });
+ }
+ },
+ get_value:function(node,ev,config){
+ var _result = [];
+ var _children = node.getElementsByTagName("input");
+ for(var i=0;i<_children.length;i++) {
+ if(_children[i].checked)
+ _result.push(_children[i].value);
+ }
+ return _result.join(',');
+ },
+
+ focus:function(node){
+ }
+}; \ No newline at end of file