Index: trunk/core/admin_templates/categories/categories_tabs.tpl =================================================================== diff -u -N -r5102 -r5326 --- trunk/core/admin_templates/categories/categories_tabs.tpl (.../categories_tabs.tpl) (revision 5102) +++ trunk/core/admin_templates/categories/categories_tabs.tpl (.../categories_tabs.tpl) (revision 5326) @@ -1,3 +1,16 @@ + +blocknone;"> + + + +
+ +
+ +
+
Index: trunk/kernel/units/categories/categories_event_handler.php =================================================================== diff -u -N -r5219 -r5326 --- trunk/kernel/units/categories/categories_event_handler.php (.../categories_event_handler.php) (revision 5219) +++ trunk/kernel/units/categories/categories_event_handler.php (.../categories_event_handler.php) (revision 5326) @@ -210,17 +210,6 @@ } /** - * Rebuilds category cache - * - * @param kEvent $event - */ - function OnRebuildCache(&$event) - { - $this->Application->StoreVar('PermCache_UpdateRequired', 1); - $event->SetRedirectParam('index_file', 'category/category_maint.php'); - } - - /** * Adds calculates fields for item statuses * * @param kCatDBItem $object @@ -279,7 +268,9 @@ foreach ($cached_fields as $cached_field) { if ($live_object->GetDBField($cached_field) != $temp_object->GetDBField($cached_field)) { - $this->Application->SetVar('require_cache_update', 1); + // use session instead of REQUEST because of permission editing in category can contain + // multiple submits, that changes data before OnSave event occurs + $this->Application->StoreVar('PermCache_UpdateRequired', 1); break; } } @@ -293,11 +284,12 @@ function OnSave(&$event) { parent::OnSave($event); - if ($event->status == erSUCCESS && $this->Application->GetVar('require_cache_update')) { + if ($event->status == erSUCCESS && $this->Application->RecallVar('PermCache_UpdateRequired')) { // "catalog" should be in opener stack by now $opener_stack = unserialize($this->Application->RecallVar('opener_stack')); $opener_stack[0] = str_replace('catalog', 'categories/cache_updater', $opener_stack[0]); $this->Application->StoreVar('opener_stack', serialize($opener_stack)); + $this->Application->RemoveVar('PermCache_UpdateRequired'); } } Index: trunk/core/admin_templates/categories/categories_edit_permissions.tpl =================================================================== diff -u -N -r5322 -r5326 --- trunk/core/admin_templates/categories/categories_edit_permissions.tpl (.../categories_edit_permissions.tpl) (revision 5322) +++ trunk/core/admin_templates/categories/categories_edit_permissions.tpl (.../categories_edit_permissions.tpl) (revision 5326) @@ -117,7 +117,8 @@
- + +
Index: trunk/core/admin_templates/js/catalog.js =================================================================== diff -u -N -r5322 -r5326 --- trunk/core/admin_templates/js/catalog.js (.../catalog.js) (revision 5322) +++ trunk/core/admin_templates/js/catalog.js (.../catalog.js) (revision 5326) @@ -72,17 +72,26 @@ } $params = $params.split(','); - if ($params[0].length) { - var $js_end = $text.indexOf($object.Separator); - if ($js_end != -1) { + + + var $js_end = $text.indexOf($object.Separator); + if ($js_end != -1) { + // allow to detect if output is permitted by ajax request parameters + var $request_visible = '$request_visible = ' + ($params[0].length ? 'true' : 'false') + "\n"; + if ($params[0].length) { document.getElementById($params[0]).innerHTML = $text.substring($js_end + $object.Separator.length); - eval($text.substring(0, $js_end)); + eval($request_visible + $text.substring(0, $js_end)); } else { - document.getElementById($params[0]).innerHTML = $text; + // eval JS only & set mark that js should not use HTML as usual in grids + eval($request_visible + $text.substring(0, $js_end)); } } + else if ($params[0].length) { + document.getElementById($params[0]).innerHTML = $text; + } + if (typeof($Debugger) != 'undefined') { $Debugger.Clear(); } Index: trunk/kernel/admin_templates/categories/categories_tabs.tpl =================================================================== diff -u -N -r5102 -r5326 --- trunk/kernel/admin_templates/categories/categories_tabs.tpl (.../categories_tabs.tpl) (revision 5102) +++ trunk/kernel/admin_templates/categories/categories_tabs.tpl (.../categories_tabs.tpl) (revision 5326) @@ -1,3 +1,16 @@ + +blocknone;"> + + + +
+ +
+ +
+
Index: trunk/core/units/categories/categories_event_handler.php =================================================================== diff -u -N -r5219 -r5326 --- trunk/core/units/categories/categories_event_handler.php (.../categories_event_handler.php) (revision 5219) +++ trunk/core/units/categories/categories_event_handler.php (.../categories_event_handler.php) (revision 5326) @@ -210,17 +210,6 @@ } /** - * Rebuilds category cache - * - * @param kEvent $event - */ - function OnRebuildCache(&$event) - { - $this->Application->StoreVar('PermCache_UpdateRequired', 1); - $event->SetRedirectParam('index_file', 'category/category_maint.php'); - } - - /** * Adds calculates fields for item statuses * * @param kCatDBItem $object @@ -279,7 +268,9 @@ foreach ($cached_fields as $cached_field) { if ($live_object->GetDBField($cached_field) != $temp_object->GetDBField($cached_field)) { - $this->Application->SetVar('require_cache_update', 1); + // use session instead of REQUEST because of permission editing in category can contain + // multiple submits, that changes data before OnSave event occurs + $this->Application->StoreVar('PermCache_UpdateRequired', 1); break; } } @@ -293,11 +284,12 @@ function OnSave(&$event) { parent::OnSave($event); - if ($event->status == erSUCCESS && $this->Application->GetVar('require_cache_update')) { + if ($event->status == erSUCCESS && $this->Application->RecallVar('PermCache_UpdateRequired')) { // "catalog" should be in opener stack by now $opener_stack = unserialize($this->Application->RecallVar('opener_stack')); $opener_stack[0] = str_replace('catalog', 'categories/cache_updater', $opener_stack[0]); $this->Application->StoreVar('opener_stack', serialize($opener_stack)); + $this->Application->RemoveVar('PermCache_UpdateRequired'); } } Index: trunk/kernel/admin_templates/categories/categories_edit_permissions.tpl =================================================================== diff -u -N -r5322 -r5326 --- trunk/kernel/admin_templates/categories/categories_edit_permissions.tpl (.../categories_edit_permissions.tpl) (revision 5322) +++ trunk/kernel/admin_templates/categories/categories_edit_permissions.tpl (.../categories_edit_permissions.tpl) (revision 5326) @@ -117,7 +117,8 @@
- + +
Index: trunk/kernel/admin_templates/incs/catalog.js =================================================================== diff -u -N -r5322 -r5326 --- trunk/kernel/admin_templates/incs/catalog.js (.../catalog.js) (revision 5322) +++ trunk/kernel/admin_templates/incs/catalog.js (.../catalog.js) (revision 5326) @@ -72,17 +72,26 @@ } $params = $params.split(','); - if ($params[0].length) { - var $js_end = $text.indexOf($object.Separator); - if ($js_end != -1) { + + + var $js_end = $text.indexOf($object.Separator); + if ($js_end != -1) { + // allow to detect if output is permitted by ajax request parameters + var $request_visible = '$request_visible = ' + ($params[0].length ? 'true' : 'false') + "\n"; + if ($params[0].length) { document.getElementById($params[0]).innerHTML = $text.substring($js_end + $object.Separator.length); - eval($text.substring(0, $js_end)); + eval($request_visible + $text.substring(0, $js_end)); } else { - document.getElementById($params[0]).innerHTML = $text; + // eval JS only & set mark that js should not use HTML as usual in grids + eval($request_visible + $text.substring(0, $js_end)); } } + else if ($params[0].length) { + document.getElementById($params[0]).innerHTML = $text; + } + if (typeof($Debugger) != 'undefined') { $Debugger.Clear(); } Index: trunk/admin/install/langpacks/english.lang =================================================================== diff -u -N -r5325 -r5326 --- trunk/admin/install/langpacks/english.lang (.../english.lang) (revision 5325) +++ trunk/admin/install/langpacks/english.lang (.../english.lang) (revision 5326) @@ -1341,6 +1341,7 @@ U3VtbWFyeQ== Q29uZmlndXJhdGlvbg== VG9vbHM= + VXBkYXRpbmcgQ2F0ZWdvcmllcw== VXNlcnM= U2VsZWN0IHVzZXI= VmlzaXRz Index: trunk/kernel/units/categories/categories_tag_processor.php =================================================================== diff -u -N -r5214 -r5326 --- trunk/kernel/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 5214) +++ trunk/kernel/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 5326) @@ -378,6 +378,38 @@ } return $ret; } + + function SaveWarning($params) + { + $main_prefix = getArrayValue($params, 'main_prefix'); + if ($main_prefix && $main_prefix != '$main_prefix') { + $top_prefix = $main_prefix; + } + else { + $top_prefix = $this->Application->GetTopmostPrefix($this->Prefix); + } + + $temp_tables = $this->Application->GetVar($top_prefix.'_mode') == 't'; + $modified = $this->Application->RecallVar($top_prefix.'_modified'); + + if (!$temp_tables) { + $this->Application->RemoveVar($top_prefix.'_modified'); + return 'flag remoeved'; + } + + $block_name = $this->SelectParam($params, 'render_as,name'); + if ($block_name) { + $block_params = $this->prepareTagParams($params); + $block_params['name'] = $block_name; + $block_params['edit_mode'] = $temp_tables ? 1 : 0; + $block_params['display'] = $temp_tables && $modified ? 1 : 0; + return $this->Application->ParseBlock($block_params); + } + else { + return $temp_tables && $modified ? 1 : 0; + } + return ; + } } Index: trunk/core/admin_templates/categories/permissions_tab.tpl =================================================================== diff -u -N -r5325 -r5326 --- trunk/core/admin_templates/categories/permissions_tab.tpl (.../permissions_tab.tpl) (revision 5325) +++ trunk/core/admin_templates/categories/permissions_tab.tpl (.../permissions_tab.tpl) (revision 5326) @@ -2,7 +2,13 @@
_div" prefix="" group_id="-1" class="catalog-tab">
- document.getElementById('_div').setAttribute('group_id', ); + if ($request_visible) { + document.getElementById('_div').setAttribute('group_id', ); + } + + document.getElementById('save_warning').style.display = 'block'; + $edit_mode = true; + #separator# "> Index: trunk/kernel/admin_templates/categories/permissions_tab.tpl =================================================================== diff -u -N -r5325 -r5326 --- trunk/kernel/admin_templates/categories/permissions_tab.tpl (.../permissions_tab.tpl) (revision 5325) +++ trunk/kernel/admin_templates/categories/permissions_tab.tpl (.../permissions_tab.tpl) (revision 5326) @@ -2,7 +2,13 @@
_div" prefix="" group_id="-1" class="catalog-tab">
- document.getElementById('_div').setAttribute('group_id', ); + if ($request_visible) { + document.getElementById('_div').setAttribute('group_id', ); + } + + document.getElementById('save_warning').style.display = 'block'; + $edit_mode = true; + #separator# "> Index: trunk/kernel/units/permissions/permissions_event_handler.php =================================================================== diff -u -N -r5325 -r5326 --- trunk/kernel/units/permissions/permissions_event_handler.php (.../permissions_event_handler.php) (revision 5325) +++ trunk/kernel/units/permissions/permissions_event_handler.php (.../permissions_event_handler.php) (revision 5326) @@ -154,6 +154,10 @@ if ($delete_ids || $create_sql || $update_sql) { $object->setModifiedFlag(); + + if ($event->Name == 'OnCategorySavePermissions') { + $this->Application->StoreVar('PermCache_UpdateRequired', 1); + } } } } Index: trunk/core/units/categories/categories_tag_processor.php =================================================================== diff -u -N -r5214 -r5326 --- trunk/core/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 5214) +++ trunk/core/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 5326) @@ -378,6 +378,38 @@ } return $ret; } + + function SaveWarning($params) + { + $main_prefix = getArrayValue($params, 'main_prefix'); + if ($main_prefix && $main_prefix != '$main_prefix') { + $top_prefix = $main_prefix; + } + else { + $top_prefix = $this->Application->GetTopmostPrefix($this->Prefix); + } + + $temp_tables = $this->Application->GetVar($top_prefix.'_mode') == 't'; + $modified = $this->Application->RecallVar($top_prefix.'_modified'); + + if (!$temp_tables) { + $this->Application->RemoveVar($top_prefix.'_modified'); + return 'flag remoeved'; + } + + $block_name = $this->SelectParam($params, 'render_as,name'); + if ($block_name) { + $block_params = $this->prepareTagParams($params); + $block_params['name'] = $block_name; + $block_params['edit_mode'] = $temp_tables ? 1 : 0; + $block_params['display'] = $temp_tables && $modified ? 1 : 0; + return $this->Application->ParseBlock($block_params); + } + else { + return $temp_tables && $modified ? 1 : 0; + } + return ; + } } Index: trunk/core/units/permissions/permissions_event_handler.php =================================================================== diff -u -N -r5325 -r5326 --- trunk/core/units/permissions/permissions_event_handler.php (.../permissions_event_handler.php) (revision 5325) +++ trunk/core/units/permissions/permissions_event_handler.php (.../permissions_event_handler.php) (revision 5326) @@ -154,6 +154,10 @@ if ($delete_ids || $create_sql || $update_sql) { $object->setModifiedFlag(); + + if ($event->Name == 'OnCategorySavePermissions') { + $this->Application->StoreVar('PermCache_UpdateRequired', 1); + } } } }