scheduler.attachEvent("onTimelineCreated", function (obj){
if(obj.render == "tree") {
obj.y_unit_original = obj.y_unit;
obj.y_unit = scheduler._getArrayToDisplay(obj.y_unit_original);
scheduler.form_blocks[obj.name]={
render:function(sns) {
var _result = "
";
return _result;
},
set_value:function(node,value,ev,config){
var options = scheduler._getArrayForSelect(scheduler.matrix[config.type].y_unit_original, config.type);
node.innerHTML = '';
var temp_select = document.createElement('select');
node.appendChild(temp_select);
var select = node.getElementsByTagName('select')[0];
for(var i=0; i";
table_className = (timeline.folder_events_available)?"dhx_data_table folder_events":"dhx_data_table folder";
} else {
height = timeline.dy;
tr_className = "dhx_row_item";
td_className = "dhx_matrix_scell item";
div_expand = '';
table_className = "dhx_data_table";
}
td_content = ""+div_expand+"
"+(scheduler.templates[timeline.name+'_scale_label'](y_unit.key, y_unit.label, timeline)||y_unit.label)+"
";
res = {
height: height,
style_height: style_height,
//section 1
tr_className: tr_className,
td_className: td_className,
td_content: td_content,
//section 3
table_className: table_className
};
};
return res;
});
var section_id_before; // section id of the event before dragging (to bring it back if user drop's event on folder without folder_events_available)
scheduler.attachEvent("onBeforeEventChanged", function(event_object, native_event, is_new) {
if (scheduler._isRender("tree")) { // if mode's render == tree
var section = scheduler.getSection(event_object.section_id);
if (typeof section.children != 'undefined' && !scheduler.matrix[scheduler._mode].folder_events_available) {
if (!is_new) { //if old - move back
event_object[scheduler.matrix[scheduler._mode].y_property] = section_id_before;
}
return false;
}
}
return true;
});
scheduler.attachEvent("onBeforeDrag", function (event_id, mode, native_event_object){
var cell = scheduler._locate_cell_timeline(native_event_object);
if(cell) {
var section_id = scheduler.matrix[scheduler._mode].y_unit[cell.y].key;
if(typeof scheduler.matrix[scheduler._mode].y_unit[cell.y].children != "undefined" && !scheduler.matrix[scheduler._mode].folder_events_available) {
return false;
}
}
if(scheduler._isRender("tree")) {
ev = scheduler.getEvent(event_id);
section_id_before = section_id||ev[scheduler.matrix[scheduler._mode].y_property]; // either event id or section_id will be available
}
return true;
});
scheduler._getArrayToDisplay = function(array){ // function to flatten out hierarhical array, used for tree view
var result = [];
var fillResultArray = function(array, lvl){
var level = lvl||0;
for(var i=0; i open)
scheduler._toggleFolderDisplay(4, true) -- open section with the key 4 (doesn't matter what status was before). False - close.
scheduler._toggleFolderDisplay(4, false, true) -- close ALL sections. Key is not used in such condition.
*/
scheduler._toggleFolderDisplay = function(key, status, all_sections){ // used for tree view
var marked;
var toggleElement = function(key, array, status, all_sections) {
for (var i=0; i