Index: branches/5.2.x/core/kernel/db/cat_event_handler.php =================================================================== --- branches/5.2.x/core/kernel/db/cat_event_handler.php +++ branches/5.2.x/core/kernel/db/cat_event_handler.php @@ -155,8 +155,8 @@ */ function _getMassPermissionEvents() { - return Array ( - 'OnEdit', 'OnSave', 'OnMassDelete', 'OnMassApprove', + return array( + 'OnStoreSelected', 'OnEdit', 'OnSave', 'OnMassDelete', 'OnMassApprove', 'OnMassDecline', 'OnMassMoveUp', 'OnMassMoveDown', 'OnCut', ); Index: branches/5.2.x/core/kernel/db/db_event_handler.php =================================================================== --- branches/5.2.x/core/kernel/db/db_event_handler.php +++ branches/5.2.x/core/kernel/db/db_event_handler.php @@ -1602,6 +1602,10 @@ $this->_update($event); $event->SetRedirectParam('opener', 'u'); + + if ( $event->status == kEvent::erSUCCESS ) { + $this->saveChangesToLiveTable($event->Prefix); + } } /** @@ -1639,6 +1643,26 @@ } /** + * Automatically saves data to live table after sub-item was updated in Content Mode. + * + * @param string $prefix Prefix. + * + * @return void + */ + protected function saveChangesToLiveTable($prefix) + { + $parent_prefix = $this->Application->getUnitOption($prefix, 'ParentPrefix'); + + if ( $parent_prefix === false ) { + return; + } + + if ( $this->Application->GetVar('admin') && $this->Application->IsTempMode($parent_prefix) ) { + $this->Application->HandleEvent(new kEvent($parent_prefix . ':OnSave')); + } + } + + /** * Delete's kDBItem object * * @param kEvent $event Index: branches/5.2.x/core/kernel/db/db_tag_processor.php =================================================================== --- branches/5.2.x/core/kernel/db/db_tag_processor.php +++ branches/5.2.x/core/kernel/db/db_tag_processor.php @@ -2596,8 +2596,29 @@ $button_title = $this->Application->Phrase($button_title, false, true); } + if ( !isset($params['pass']) ) { + $params['pass'] = 'm,' . $item_prefix; + } + + $edit_prefix = $item_prefix; + list($parent_prefix, $parent_id) = $this->getParentPrefixAndId($object); + + if ( $parent_prefix !== false ) { + $edit_prefix = $parent_prefix; + $params[$parent_prefix . '_id'] = $parent_id; + $params['pass'] = $parent_prefix . ',' . $params['pass']; + } + $icon_url = $this->Application->BaseURL() . 'core/admin_templates/img/top_frame/icons/' . $button_icon; - $button_onclick = '$form_name = ' . json_encode($form_name) . '; std_edit_item(' . json_encode($item_prefix) . ', ' . json_encode($template) . '); return false;'; + + if ( !isset($params['temp_mode']) || (isset($params['temp_mode']) && $params['temp_mode']) ) { + $edit_function = 'std_edit_item'; + } + else { + $edit_function = 'std_edit_temp_item'; + } + + $button_onclick = '$form_name = ' . json_encode($form_name) . '; ' . $edit_function . '(' . json_encode($edit_prefix) . ', ' . json_encode($template) . '); return false;'; $button_code = '