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