Index: trunk/core/admin_templates/js/catalog.js =================================================================== diff -u -r5054 -r5057 --- trunk/core/admin_templates/js/catalog.js (.../catalog.js) (revision 5054) +++ trunk/core/admin_templates/js/catalog.js (.../catalog.js) (revision 5057) @@ -6,7 +6,7 @@ this.URLMask = $url_mask; this.Separator = '#separator#'; this.ParentCategoryID = 0; - + this.TabRegistry = new Array(); this.ActivePrefix = getCookie(this.CookiePrefix + 'active_prefix'); this.PreviousPrefix = this.ActivePrefix; @@ -28,7 +28,7 @@ var $i = 1; while ($i < this.TabRegistry.length) { // run through all prefixes - var $j = 1; + var $j = 1; while ($j < this.TabRegistry.length) { if (this.TabRegistry[$i]['prefix'] == this.TabRegistry[$j]['prefix']) { $j++; @@ -45,13 +45,13 @@ Catalog.prototype.submit_kernel_form = function($tab_id) { var $prefix = this.queryTabRegistry('tab_id', $tab_id, 'prefix'); var $kf = document.getElementById($form_name); - + Request.params = Request.serializeForm($kf); Request.method = $kf.method.toUpperCase(); - + this.BusyRequest[$prefix] = false; - Request.makeRequest($kf.action, this.BusyRequest[$prefix], $tab_id + '_div', this.successCallback, this.errorCallback, $tab_id + '_div'); - + Request.makeRequest($kf.action, this.BusyRequest[$prefix], $tab_id + '_div', this.successCallback, this.errorCallback, $tab_id + '_div'); + $form_name = 'kernel_form'; // restore back to main form with current category id of catalog }; @@ -62,7 +62,7 @@ window.location.href = RegExp.$1; return false; } - + $params = $params.split(','); var $js_end = $text.indexOf($Catalog.Separator); if ($js_end != -1) { @@ -72,7 +72,7 @@ else { document.getElementById($params[0]).innerHTML = $text; } - + if (isset($Debugger)) $Debugger.Clear(); } @@ -83,42 +83,42 @@ Catalog.prototype.submit_event = function($prefix_special, $event, $t) { if (!isset($prefix_special)) $prefix_special = this.getCurrentPrefix(); var $tab_id = this.queryTabRegistry('prefix', $prefix_special, 'tab_id'); - + $form_name = $tab_id + '_form'; // set firstly, because set_hidden_field uses it if (isset($event)) set_hidden_field('events[' + $prefix_special + ']', $event); if (isset($t)) set_hidden_field('t', $t); - + this.submit_kernel_form($tab_id); } Catalog.prototype.go_to_cat = function($cat_id) { - if (!isset($cat_id)) { + if (!isset($cat_id)) { // gets current category $cat_id = get_hidden_field('m_cat_id'); } else { // sets new category to kernel_form in case if item tab // loads faster and will check if it's category is same // as parent category of categories list - + if (get_hidden_field('m_cat_id') == $cat_id) { // it's the same category, then don't reload category list return true; } set_hidden_field('m_cat_id', $cat_id); } - + // set all item tabs counters to "?" before quering catagories var $i = 1; while ($i < this.TabRegistry.length) { this.setItemCount(this.TabRegistry[$i]['prefix'], '?'); $i++; } - + // query sub categories of $cat_id var $url = this.URLMask.replace('#TEMPLATE_NAME#', 'xml/categories_list').replace('#CATEGORY_ID#', $cat_id); - + var $prefix = this.TabRegistry[0]['prefix']; var $tab_id = this.TabRegistry[0]['tab_id']; this.BusyRequest[$prefix] = false; @@ -129,19 +129,19 @@ Catalog.prototype.switchTab = function($prefix) { if (!isset($prefix)) $prefix = this.ActivePrefix; - + if (this.BusyRequest[$prefix]) { alert('prefix: ['+$prefix+']; request busy: ['+this.BusyRequest[$prefix]+']'); } - + if (this.ActivePrefix != $prefix) { // hide source tab this.PreviousPrefix = this.ActivePrefix; document.getElementById(this.PreviousPrefix + '_tab').className = 'catalog-tab-unselected'; document.getElementById(this.queryTabRegistry('prefix', this.PreviousPrefix, 'tab_id') + '_div').style.display = 'none'; this.HideDependentButtons(this.PreviousPrefix); } - + // show destination tab this.ActivePrefix = $prefix; document.getElementById(this.ActivePrefix + '_tab').className = 'catalog-tab-selected'; @@ -150,15 +150,15 @@ this.ShowDependentButtons(this.ActivePrefix); this.setViewMenu(this.ActivePrefix); setCookie(this.CookiePrefix + 'active_prefix', this.ActivePrefix); - + // this.TabRegistry.length == 1 var $cat_id = get_hidden_field('m_cat_id'); var $tab_cat_id = document.getElementById($div_id).getAttribute('category_id'); if ($cat_id != $tab_cat_id) { // query tab content only in case if not queried or category don't match var $url = this.URLMask.replace('#TEMPLATE_NAME#', this.queryTabRegistry('prefix', $prefix, 'module_path') + '/catalog_tab'); $url = $url.replace('#CATEGORY_ID#', $cat_id); - + this.BusyRequest[$prefix] = false; Request.makeRequest($url, this.BusyRequest[$prefix], $div_id, this.successCallback, this.errorCallback, $div_id); // $Debugger.ShowProps(this.BusyRequest); @@ -187,7 +187,7 @@ while ($i < this.TabRegistry.length) { if (this.TabRegistry[$i][$search_key] == $search_value) { return this.TabRegistry[$i][$return_key]; - break; + break; } $i++; } Index: trunk/kernel/admin_templates/incs/toolbar.js =================================================================== diff -u -r5044 -r5057 --- trunk/kernel/admin_templates/incs/toolbar.js (.../toolbar.js) (revision 5044) +++ trunk/kernel/admin_templates/incs/toolbar.js (.../toolbar.js) (revision 5057) @@ -1,9 +1,9 @@ -function ToolBarButton(title, alt, onclick, $hidden) +function ToolBarButton(title, alt, onclick, $hidden, prefix) { this.Title = title || ''; this.CheckTitleModule(); this.Alt = RemoveTranslationLink(alt || ''); - + if (typeof(onclick) == 'function') { this.onClick = onclick; } @@ -19,6 +19,7 @@ this.Enabled = true; this.Hidden = $hidden ? true : false; this.ToolBar = null; + this.Prefix = prefix ? prefix : ''; } ToolBarButton.prototype.CheckTitleModule = function() @@ -40,19 +41,25 @@ } ToolBarButton.prototype.GetHTML = function() { - return ''; + return ''; } ToolBarButton.prototype.GetObject = function() { var $img = document.createElement('IMG'); - $img.id = 'tool_' + this.Title; + $img.id = this.GetToolId(); $img.src = this.IconsPath() + this.ToolBar.IconPrefix + this.Title + '.gif'; $img.title = this.Alt; return $img; } +ToolBarButton.prototype.GetToolId = function() { + return this.Prefix == '' ? 'tool_' + this.Title : 'tool_['+this.Prefix+'][' + this.Title+']' +} + ToolBarButton.prototype.Init = function() { - img = document.getElementById('tool_' + this.Title); + + img = document.getElementById(this.GetToolId()); + this.imgObject = img; img.btn = this; this.SetOnMouseOver(); @@ -187,9 +194,15 @@ ToolBar.prototype.Render = function($container) { if ($container) { + html = ''; for (var i in this.Buttons) { btn = this.Buttons[i]; - $container.appendChild( btn.GetObject() ); + html += btn.GetHTML(); +// appendChild( btn.GetObject() ); + } + $container.innerHTML = html; + for (var i in this.Buttons) { + btn = this.Buttons[i]; btn.Init(); } } Index: trunk/kernel/admin_templates/incs/script.js =================================================================== diff -u -r5048 -r5057 --- trunk/kernel/admin_templates/incs/script.js (.../script.js) (revision 5048) +++ trunk/kernel/admin_templates/incs/script.js (.../script.js) (revision 5057) @@ -144,7 +144,7 @@ return; } submitted = true; - + var $form = document.getElementById($form_name); processHooks('SubmitKF', hBEFORE); if (typeof $form.onsubmit == "function") { @@ -288,15 +288,15 @@ var $kf = document.getElementById($form_name); var $prev_action = $kf.action; var $prev_opener = get_hidden_field('m_opener'); - + $kf.action = $url; set_hidden_field('m_opener', 'p'); $kf.target = 'sendmail'; set_hidden_field('idtype', 'group'); set_hidden_field('idlist', Grids[$prefix_special].GetSelected().join(',') ); openwin('','sendmail',750,400); submit_kernel_form(); - + $kf.action = $prev_action; set_hidden_field('m_opener', $prev_opener); } @@ -305,7 +305,7 @@ function PreSaveAndOpenTranslator(prefix,field,t,multi_line,$width,$height) { var $kf = document.getElementById($form_name); - + if(!isset($window_name)) var $window_name = 'select_'+t.replace(/(\/|-)/g, '_'); if(!isset($width)) $width=750; if(!isset($height)) $height=400; @@ -326,7 +326,7 @@ function PreSaveAndOpenTranslatorCV(prefix,field,t,resource_id,multi_line) { var $kf = document.getElementById($form_name); - + if(!isset($window_name)) var $window_name = 'select_'+t.replace(/(\/|-)/g, '_'); if(!isset(multi_line)) multi_line=0; openwin('',$window_name,750,400); @@ -347,7 +347,7 @@ function openTranslator(prefix,field,url,wnd) { var $kf = document.getElementById($form_name); - + set_hidden_field('trans_prefix', prefix); set_hidden_field('trans_field', field); set_hidden_field('events[trans]', 'OnLoad'); @@ -363,11 +363,11 @@ var $kf = document.getElementById($form_name); var $regex = new RegExp('(.*)\?env=' + document.getElementById('sid').value + '-(.*?):(m[^:]+)'); $regex = $regex.exec($url); - + var $t = $regex[2]; var $window_name = 'select_'+$t.replace(/(\/|-)/g, '_'); set_hidden_field('return_m', $regex[3]); - + if (!isset($window_size)) $window_size = '750x400'; $window_size = $window_size.split('x'); @@ -386,7 +386,7 @@ openwin('', $window_name, $window_size[0], $window_size[1]); $kf.action = $url; $kf.target = $window_name; - + submit_event($prefix, $event, $t); processHooks('openSelector', hAFTER); @@ -961,7 +961,7 @@ set_hidden_field('value', $var_value); submit_event('u', 'OnSetPersistantVariable', $t, $form_action); } - + /*functionremoveEvent(el, evname, func) { if (Calendar.is_ie) { el.detachEvent("on" + evname, func); @@ -1005,4 +1005,4 @@ var $new_element = document.createElement($tag_name.toUpperCase()); $dst_element.appendChild($new_element); return $new_element; - } \ No newline at end of file + } Index: trunk/kernel/admin_templates/incs/catalog.js =================================================================== diff -u -r5054 -r5057 --- trunk/kernel/admin_templates/incs/catalog.js (.../catalog.js) (revision 5054) +++ trunk/kernel/admin_templates/incs/catalog.js (.../catalog.js) (revision 5057) @@ -6,7 +6,7 @@ this.URLMask = $url_mask; this.Separator = '#separator#'; this.ParentCategoryID = 0; - + this.TabRegistry = new Array(); this.ActivePrefix = getCookie(this.CookiePrefix + 'active_prefix'); this.PreviousPrefix = this.ActivePrefix; @@ -28,7 +28,7 @@ var $i = 1; while ($i < this.TabRegistry.length) { // run through all prefixes - var $j = 1; + var $j = 1; while ($j < this.TabRegistry.length) { if (this.TabRegistry[$i]['prefix'] == this.TabRegistry[$j]['prefix']) { $j++; @@ -45,13 +45,13 @@ Catalog.prototype.submit_kernel_form = function($tab_id) { var $prefix = this.queryTabRegistry('tab_id', $tab_id, 'prefix'); var $kf = document.getElementById($form_name); - + Request.params = Request.serializeForm($kf); Request.method = $kf.method.toUpperCase(); - + this.BusyRequest[$prefix] = false; - Request.makeRequest($kf.action, this.BusyRequest[$prefix], $tab_id + '_div', this.successCallback, this.errorCallback, $tab_id + '_div'); - + Request.makeRequest($kf.action, this.BusyRequest[$prefix], $tab_id + '_div', this.successCallback, this.errorCallback, $tab_id + '_div'); + $form_name = 'kernel_form'; // restore back to main form with current category id of catalog }; @@ -62,7 +62,7 @@ window.location.href = RegExp.$1; return false; } - + $params = $params.split(','); var $js_end = $text.indexOf($Catalog.Separator); if ($js_end != -1) { @@ -72,7 +72,7 @@ else { document.getElementById($params[0]).innerHTML = $text; } - + if (isset($Debugger)) $Debugger.Clear(); } @@ -83,42 +83,42 @@ Catalog.prototype.submit_event = function($prefix_special, $event, $t) { if (!isset($prefix_special)) $prefix_special = this.getCurrentPrefix(); var $tab_id = this.queryTabRegistry('prefix', $prefix_special, 'tab_id'); - + $form_name = $tab_id + '_form'; // set firstly, because set_hidden_field uses it if (isset($event)) set_hidden_field('events[' + $prefix_special + ']', $event); if (isset($t)) set_hidden_field('t', $t); - + this.submit_kernel_form($tab_id); } Catalog.prototype.go_to_cat = function($cat_id) { - if (!isset($cat_id)) { + if (!isset($cat_id)) { // gets current category $cat_id = get_hidden_field('m_cat_id'); } else { // sets new category to kernel_form in case if item tab // loads faster and will check if it's category is same // as parent category of categories list - + if (get_hidden_field('m_cat_id') == $cat_id) { // it's the same category, then don't reload category list return true; } set_hidden_field('m_cat_id', $cat_id); } - + // set all item tabs counters to "?" before quering catagories var $i = 1; while ($i < this.TabRegistry.length) { this.setItemCount(this.TabRegistry[$i]['prefix'], '?'); $i++; } - + // query sub categories of $cat_id var $url = this.URLMask.replace('#TEMPLATE_NAME#', 'xml/categories_list').replace('#CATEGORY_ID#', $cat_id); - + var $prefix = this.TabRegistry[0]['prefix']; var $tab_id = this.TabRegistry[0]['tab_id']; this.BusyRequest[$prefix] = false; @@ -129,19 +129,19 @@ Catalog.prototype.switchTab = function($prefix) { if (!isset($prefix)) $prefix = this.ActivePrefix; - + if (this.BusyRequest[$prefix]) { alert('prefix: ['+$prefix+']; request busy: ['+this.BusyRequest[$prefix]+']'); } - + if (this.ActivePrefix != $prefix) { // hide source tab this.PreviousPrefix = this.ActivePrefix; document.getElementById(this.PreviousPrefix + '_tab').className = 'catalog-tab-unselected'; document.getElementById(this.queryTabRegistry('prefix', this.PreviousPrefix, 'tab_id') + '_div').style.display = 'none'; this.HideDependentButtons(this.PreviousPrefix); } - + // show destination tab this.ActivePrefix = $prefix; document.getElementById(this.ActivePrefix + '_tab').className = 'catalog-tab-selected'; @@ -150,15 +150,15 @@ this.ShowDependentButtons(this.ActivePrefix); this.setViewMenu(this.ActivePrefix); setCookie(this.CookiePrefix + 'active_prefix', this.ActivePrefix); - + // this.TabRegistry.length == 1 var $cat_id = get_hidden_field('m_cat_id'); var $tab_cat_id = document.getElementById($div_id).getAttribute('category_id'); if ($cat_id != $tab_cat_id) { // query tab content only in case if not queried or category don't match var $url = this.URLMask.replace('#TEMPLATE_NAME#', this.queryTabRegistry('prefix', $prefix, 'module_path') + '/catalog_tab'); $url = $url.replace('#CATEGORY_ID#', $cat_id); - + this.BusyRequest[$prefix] = false; Request.makeRequest($url, this.BusyRequest[$prefix], $div_id, this.successCallback, this.errorCallback, $div_id); // $Debugger.ShowProps(this.BusyRequest); @@ -187,7 +187,7 @@ while ($i < this.TabRegistry.length) { if (this.TabRegistry[$i][$search_key] == $search_value) { return this.TabRegistry[$i][$return_key]; - break; + break; } $i++; } Index: trunk/kernel/admin_templates/incs/grid_blocks.tpl =================================================================== diff -u -r5047 -r5057 --- trunk/kernel/admin_templates/incs/grid_blocks.tpl (.../grid_blocks.tpl) (revision 5047) +++ trunk/kernel/admin_templates/incs/grid_blocks.tpl (.../grid_blocks.tpl) (revision 5057) @@ -71,8 +71,20 @@ document.getElementById('_search_keyword').onkeydown = search_keydown; Toolbars['_search'] = new ToolBar('icon16_'); - Toolbars['_search'].AddButton( new ToolBarButton('search', '', function() { search('','', ) } ) ); - Toolbars['_search'].AddButton( new ToolBarButton('search_reset', '', function() { search_reset('','', ) } ) ); + Toolbars['_search'].AddButton( + new ToolBarButton( + 'search', + '', + function() { search('','', ) }, + null, + '') ); + Toolbars['_search'].AddButton( + new ToolBarButton( + 'search_reset', + '', + function() { search_reset('','', ) }, + null, + '') ); Toolbars['_search'].Render(document.getElementById('search_buttons[]')); @@ -229,15 +241,15 @@ $Menus[''+'_select_menu'].addMenuItem('','Grids[""].InvertSelection();'); processHooks('ViewMenu', hBEFORE, ''); - + $Menus[''+'_view_menu'] = new Menu(''); $Menus[''+'_view_menu'].addMenuItem( $Menus[''+'_filter_menu'] ); $Menus[''+'_view_menu'].addMenuItem( $Menus[''+'_sorting_menu'] ); $Menus[''+'_view_menu'].addMenuItem( $Menus[''+'_perpage_menu'] ); $Menus[''+'_view_menu'].addMenuItem( $Menus[''+'_select_menu'] ); - + processHooks('ViewMenu', hAFTER, ''); } @@ -298,18 +310,18 @@ - + - + - + _Sort1" name="_Sort1" value=""> _Sort1_Dir" name="_Sort1_Dir" value="asc"> @@ -339,11 +351,11 @@
- + %">  - + @@ -354,12 +366,12 @@ - + - + _Sort1" name="_Sort1" value=""> _Sort1_Dir" name="_Sort1_Dir" value="asc"> \ No newline at end of file