Index: branches/5.2.x/core/units/content/content_tp.php =================================================================== diff -u -N --- branches/5.2.x/core/units/content/content_tp.php (revision 0) +++ branches/5.2.x/core/units/content/content_tp.php (revision 15257) @@ -0,0 +1,53 @@ +getObject($params); + /* @var $object kDBItem */ + + $params['pass'] = 'm,c,content'; + $params['c_id'] = $object->GetDBField('PageId'); + $params['admin'] = 1; + + $params['temp_mode'] = 0; + $params['template'] = 'categories/edit_content'; + $params['button_icon'] = 'content_mode.png'; + $params['button_class'] = 'cms-edit-btn'; + $params['button_title'] = '+' . $this->Application->Phrase('la_btn_EditContent', false, true); + + if ( defined('DEBUG_MODE') && DEBUG_MODE ) { + $params['button_title'] .= ' - #' . $params['num']; + } + + unset($params['num']); + + return parent::AdminEditButton($params); + } +} \ No newline at end of file Index: branches/5.2.x/core/kernel/db/db_tag_processor.php =================================================================== diff -u -N -r15152 -r15257 --- branches/5.2.x/core/kernel/db/db_tag_processor.php (.../db_tag_processor.php) (revision 15152) +++ branches/5.2.x/core/kernel/db/db_tag_processor.php (.../db_tag_processor.php) (revision 15257) @@ -1,6 +1,6 @@ getObject($params); + /* @var $object kDBItem */ + + $item_prefix = isset($params['item_prefix']) ? $params['item_prefix'] : $this->Prefix; + + if ( isset($params['template']) ) { + $template = isset($params['template']); + } + else { + $admin_template_prefix = $this->Application->getUnitOption($item_prefix, 'AdminTemplatePrefix'); + $template = $this->Application->getUnitOption($item_prefix, 'AdminTemplatePath') . '/' . $admin_template_prefix . 'edit'; + + if ( !$admin_template_prefix ) { + throw new InvalidArgumentException('Automatic admin editing template detection failed because of missing "AdminTemplatePrefix" unit config option in "' . $this->Prefix . '" unit config'); + } + } + + $form_name = 'kf_' . str_replace('-', '_', $item_prefix) . '_' . $object->GetID(); + $button_icon = isset($params['button_icon']) ? $params['button_icon'] : 'content_mode.png'; + $button_class = isset($params['button_class']) ? $params['button_class'] : 'admin-edit-btn'; + $button_title = isset($params['button_title']) ? $params['button_title'] : 'la_btn_AdminEditItem'; + + if ( substr($button_title, 0, 1) == '+' ) { + $button_title = substr($button_title, 1); + } + else { + $button_title = $this->Application->Phrase($button_title, false, true); + } + + $icon_url = $this->Application->BaseURL() . 'core/admin_templates/img/top_frame/icons/' . $button_icon; + $button_code = ''; + + if ( !isset($params['pass']) ) { + $params['pass'] = 'm,' . $item_prefix; + } + + $params['m_opener'] = 'd'; + $params[$item_prefix . '_id'] = $object->GetID(); + + if ( !isset($params['temp_mode']) || (isset($params['temp_mode']) && $params['temp_mode']) ) { + $params[$item_prefix . '_mode'] = 't'; + $params[$item_prefix . '_event'] = 'OnEdit'; + } + + $params['front'] = 1; // to make opener stack work properly + $params['__URLENCODE__'] = 1; // don't use "&" + $params['__NO_REWRITE__'] = 1; // since admin link +// $params['escape'] = 1; // needed? + + unset($params['button_icon'], $params['button_class'], $params['button_title'], $params['template'], $params['item_prefix'], $params['temp_mode']); + + // link from Front-End to Admin, don't remove "index.php" + $edit_url = $this->Application->HREF($template, ADMIN_DIRECTORY, $params, 'index.php'); + $edit_form = '
'; + + if ( isset($params['forms_later']) && $params['forms_later'] ) { + $all_forms = $this->Application->GetVar('all_forms'); + $this->Application->SetVar('all_forms', $all_forms . $edit_form); + } + else { + $button_code .= $edit_form; + } + + return $button_code; + } + + /** * Calls OnNew event from template, when no other event submitted * * @param Array $params Index: branches/5.2.x/core/units/content/content_config.php =================================================================== diff -u -N -r15234 -r15257 --- branches/5.2.x/core/units/content/content_config.php (.../content_config.php) (revision 15234) +++ branches/5.2.x/core/units/content/content_config.php (.../content_config.php) (revision 15257) @@ -1,6 +1,6 @@ Array ('class' => 'kDBItem', 'file' => '', 'build_event' => 'OnItemBuild'), 'ListClass' => Array ('class' => 'kDBList', 'file' => '', 'build_event' => 'OnListBuild'), 'EventHandlerClass' => Array ('class' => 'ContentEventHandler', 'file' => 'content_eh.php', 'build_event' => 'OnBuild'), - 'TagProcessorClass' => Array ('class' => 'kDBTagProcessor', 'file' => '', 'build_event' => 'OnBuild'), + 'TagProcessorClass' => Array ('class' => 'ContentTagProcessor', 'file' => 'content_tp.php', 'build_event' => 'OnBuild'), 'AutoLoad' => true, 'QueryString' => Array ( 1 => 'id', Index: branches/5.2.x/core/units/categories/categories_tag_processor.php =================================================================== diff -u -N -r15246 -r15257 --- branches/5.2.x/core/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 15246) +++ branches/5.2.x/core/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 15257) @@ -1,6 +1,6 @@ 'm,c,content', - 'm_opener' => 'd', - 'c_id' => $page->GetID(), - 'content_id' => $content->GetID(), - 'front' => 1, - 'admin' => 1, - '__URLENCODE__' => 1, - '__NO_REWRITE__'=> 1, - 'escape' => 1, - 'index_file' => 'index.php', -// 'bgcolor' => $bg_color, -// '__FORCE_SID__' => 1 - ); + if ( EDITING_MODE == EDITING_MODE_CONTENT ) { + $button_code = $this->Application->ProcessParsedTag($content->getPrefixSpecial(), 'AdminEditButton', $params); - // link from Front-End to admin, don't remove "index.php" - $edit_url = $this->Application->HREF('categories/edit_content', ADMIN_DIRECTORY, $url_params, 'index.php'); $edit_code_before = '
-
-
- -
-
' . $this->Application->Phrase('la_btn_EditContent', false, true) . ' '.(defined('DEBUG_MODE') && DEBUG_MODE ? " - #{$num}" : '').'
-
+ ' . $button_code . '
'; - $edit_form = '
'; - $edit_form .= ''; - $edit_form .= ''; - $edit_form .= ''; - $edit_form .= ''; - $edit_form .= ''; - $edit_form .= '
'; - $edit_code_after = '
'; - - if (array_key_exists('forms_later', $params) && $params['forms_later']) { - $all_forms = $this->Application->GetVar('all_forms'); - $this->Application->SetVar('all_forms', $all_forms . $edit_form); - } - else { - $edit_code_after .= $edit_form; - } } - if ($this->Application->GetVar('_editor_preview_') == 1) { + if ( $this->Application->GetVar('_editor_preview_') == 1 ) { $data = $this->Application->RecallVar('_editor_preview_content_'); - } else { + } + else { $data = $content->GetField('Content'); } $data = $edit_code_before . $this->_transformContentBlockData($data, $params) . $edit_code_after; - if ($data != '') { + if ( $data != '' ) { $this->Application->Parser->DataExists = true; } @@ -1389,6 +1353,10 @@ $ret = '' . "\n"; + $ret .= ' '; + if ( EDITING_MODE == EDITING_MODE_DESIGN ) { $ret .= '