Index: trunk/kernel/admin/include/toolbar/editcategory_relationselect.php =================================================================== diff -u -r1566 -r3069 --- trunk/kernel/admin/include/toolbar/editcategory_relationselect.php (.../editcategory_relationselect.php) (revision 1566) +++ trunk/kernel/admin/include/toolbar/editcategory_relationselect.php (.../editcategory_relationselect.php) (revision 3069) @@ -185,6 +185,145 @@ var upURL = "$upURL$selector&destform=$destform"; var Categories_Paste = false; + // K4 code for handling toolbar operations: begin + var \$TabRegistry = Array(); + + function InpGrid(tab) + { + this.TabId = tab; + } + + InpGrid.prototype.ClearSelection = function(force,called_from) + { + unselectAll(this.TabId, 1); //1 means don't upate toolbar + } + + function registerTab(\$tab_id) + { + var \$tab = document.getElementById(\$tab_id); + var \$index = \$TabRegistry.length; + + \$TabRegistry[\$index] = new Array(); + \$TabRegistry[\$index]['tab_id'] = \$tab_id; + \$TabRegistry[\$index]['prefix_special'] = \$tab.getAttribute('PrefixSpecial'); + \$TabRegistry[\$index]['edit_template'] = \$tab.getAttribute('EditURL'); + } + + function queryTabRegistry(\$search_key, \$search_value, \$return_key) + { + var \$i = 0; + while(\$i < \$TabRegistry.length) + { + if(\$TabRegistry[\$i][\$search_key] == \$search_value) + { + return \$TabRegistry[\$i][\$return_key]; + break; + } + \$i++; + } + return '<'+\$search_key+'='+\$search_value+'>'; + } + + function k4_actionHandler(action, prefix_special) + { + var k4_action = ''; + switch (action) + { + case 'edit': + k4_action = 'edit_item("'+prefix_special+'")'; + break; + case 'delete': + k4_action = 'delete_items("'+prefix_special+'")'; + break; + case 'unselect': + k4_action = 'unselect("'+prefix_special+'")'; + break; + case 'approve': + k4_action = 'approve_items("'+prefix_special+'")'; + break; + case 'decline': + k4_action = 'decine_items("'+prefix_special+'")'; + break; + + case 'copy': + k4_action = 'copy_items("'+prefix_special+'")'; + break; + case 'cut': + k4_action = 'cut_items("'+prefix_special+'")'; + break; + case 'move_up': + k4_action = 'move_up("'+prefix_special+'")'; + break; + case 'move_down': + k4_action = 'move_down("'+prefix_special+'")'; + break; + } + + if (k4_action != '') + { + \$form_prefix = queryTabRegistry('prefix_special', prefix_special, 'tab_id'); + eval(k4_action); + } + else alert(action+' not implemented'); + + } + + function approve_items(prefix_special) + { + set_hidden_field('remove_specials['+prefix_special+']',1); + submit_event(prefix_special,'OnMassApprove','') + } + + function decine_items(prefix_special) + { + set_hidden_field('remove_specials['+prefix_special+']',1); + submit_event(prefix_special,'OnMassDecline','') + } + + function edit() + { + edit_item( queryTabRegistry('tab_id', activeTab.id, 'prefix_special') ); + } + + function edit_item(prefix_special) + { + opener_action('d'); + set_hidden_field(prefix_special+'_mode', 't'); + submit_event(prefix_special, 'OnEdit', queryTabRegistry('prefix_special', prefix_special, 'edit_template'), '../../admin/index4.php'); + } + + function delete_items(prefix_special) + { + set_hidden_field('remove_specials['+prefix_special+']',1); + submit_event(prefix_special,'OnMassDelete','') + } + + function copy_items(prefix_special) + { + submit_event(prefix_special,'OnCopy','') + } + + function cut_items(prefix_special) + { + submit_event(prefix_special,'OnCut','') + } + + function move_up(prefix_special) + { + submit_event(prefix_special,'OnMassMoveUp','') + } + + function move_down(prefix_special) + { + submit_event(prefix_special,'OnMassMoveDown','') + } + + function unselect(prefix_special) + { + Grids[prefix_special].ClearSelection(null,'Inp_AdvancedView.Unselect'); + } + // K4 code for handling toolbar operations: end + function InitPage() { var main_form='popup';