Index: branches/5.0.x/admin/system_presets/simple/settings.php
===================================================================
diff -u -r12265 -r12298
--- branches/5.0.x/admin/system_presets/simple/settings.php (.../settings.php) (revision 12265)
+++ branches/5.0.x/admin/system_presets/simple/settings.php (.../settings.php) (revision 12298)
@@ -1,8 +1,7 @@
Application->GetTopmostWid($this->Prefix);
$session_name = rtrim($this->getPrefixSpecial().'_selected_ids_'.$wid, '_');
@@ -2030,7 +2030,7 @@
}
return $ret;
- }
+ }*/
/**
* Returns import/export process percent
@@ -2159,7 +2159,7 @@
WHERE ' . $this->Application->getUnitOption('c', 'IDField') . ' = ' . $page_id;
$template = strtolower( $this->Conn->GetOne($sql) );
- $url_params = Array ('m_cat_id' => $page_id, 'no_amp' => 1, 'editing_mode' => EDITING_MODE_CMS, 'pass' => 'm');
+ $url_params = Array ('m_cat_id' => $page_id, 'no_amp' => 1, 'editing_mode' => EDITING_MODE_CONTENT, 'pass' => 'm');
$preview_url = $this->Application->HREF($template, '_FRONT_END_', $url_params, 'index.php');
$preview_url = preg_replace('/&(admin|editing_mode)=[\d]/', '', $preview_url);
}
Index: branches/5.0.x/themes/default2009/platform/elements/side_boxes/mailing_list.elm.tpl
===================================================================
diff -u -r12117 -r12298
--- branches/5.0.x/themes/default2009/platform/elements/side_boxes/mailing_list.elm.tpl (.../mailing_list.elm.tpl) (revision 12117)
+++ branches/5.0.x/themes/default2009/platform/elements/side_boxes/mailing_list.elm.tpl (.../mailing_list.elm.tpl) (revision 12298)
@@ -1,21 +1,21 @@
-
-img/s.gif" alt="" width="1" height="5" border="0" />
-
-
- " /> + |
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
- Index: branches/5.0.x/core/kernel/nparser/nparser.php =================================================================== diff -u -r12277 -r12298 --- branches/5.0.x/core/kernel/nparser/nparser.php (.../nparser.php) (revision 12277) +++ branches/5.0.x/core/kernel/nparser/nparser.php (.../nparser.php) (revision 12298) @@ -1,6 +1,6 @@ CONTENT_OF_DESIGN: ' . $prepend; + if (EDITING_MODE == EDITING_MODE_DESIGN) { + $decorate = true; - if (EDITING_MODE == EDITING_MODE_INSIDES) { - $decorate = true; + if ($is_template) { + // content inside pair RenderElement tag } - } - else { - if (strpos($block_params['name'], '__capture_') === 0) { - // capture tag (usually inside pair RenderElement) -// $prepend = 'CAPTURE: ' . $prepend; - - if (EDITING_MODE == EDITING_MODE_INSIDES) { - $decorate = true; - } - } - elseif (array_key_exists('content', $block_params)) { - // pair RenderElement (on template, were it's used) -// $prepend = 'PAIR_RENDER_ELEMENT: ' . $prepend; - - if (EDITING_MODE == EDITING_MODE_DESIGN) { - $decorate = true; - } - } else { - // non-pair RenderElement -// $prepend = 'SINGLE_RENDER_ELEMENT: ' . $prepend; - - if (EDITING_MODE == EDITING_MODE_INSIDES) { - $decorate = true; + if (strpos($block_params['name'], '__capture_') === 0) { + // capture tag (usually inside pair RenderElement) } - - if (array_key_exists('layout_view', $block_params) && $block_params['layout_view'] && (EDITING_MODE == EDITING_MODE_LAYOUT)) { - $decorate = true; + elseif (array_key_exists('content', $block_params)) { + // pair RenderElement (on template, were it's used) + $design = true; } } } @@ -584,6 +563,14 @@ $block_name = $block_params['name']; $function_name = $is_template ? $block_name : $this->Elements[$block_name]; + $block_title = ''; + if (array_key_exists($function_name, $this->Application->Parser->ElementLocations)) { + $element_location = $this->Application->Parser->ElementLocations[$function_name]; + + $block_title .= $element_location['template'] . '.tpl'; + $block_title .= ' (' . $element_location['start_pos'] . ' - ' . $element_location['end_pos'] . ')'; + } + // ensure unique id for every div (used from print lists) $container_num = 1; $container_id = 'parser_block[' . $function_name . ']'; @@ -597,14 +584,24 @@ // prepare parameter string $param_string = $block_name . ':' . $function_name; + if ($design) { + $btn_text = 'Edit design'; + $btn_class = 'cms-edit-design-btn'; + $btn_container_class = 'block-edit-design-btn-container'; + } + else { + $btn_text = 'Edit block'; + $btn_class = 'cms-edit-block-btn'; + $btn_container_class = 'block-edit-block-btn-container'; + } $block_editor = ' -
-
+
+ Edit
+ ' . $btn_text . '
%s
Index: branches/5.0.x/core/units/phrases/phrases_config.php
===================================================================
diff -u -r12117 -r12298
--- branches/5.0.x/core/units/phrases/phrases_config.php (.../phrases_config.php) (revision 12117)
+++ branches/5.0.x/core/units/phrases/phrases_config.php (.../phrases_config.php) (revision 12298)
@@ -1,6 +1,6 @@
Array ('class' => 'kDBItem', 'file' => '', 'build_event' => 'OnItemBuild'),
'ListClass' => Array ('class' => 'kDBList', 'file' => '', 'build_event' => 'OnListBuild'),
'EventHandlerClass' => Array ('class' => 'PhrasesEventHandler', 'file' => 'phrases_event_handler.php', 'build_event' => 'OnBuild'),
- 'TagProcessorClass' => Array ('class' => 'kDBTagProcessor', 'file' => '', 'build_event' => 'OnBuild'),
+ 'TagProcessorClass' => Array ('class' => 'PhraseTagProcessor', 'file' => 'phrase_tp.php', 'build_event' => 'OnBuild'),
'AutoLoad' => true,
Index: branches/5.0.x/core/kernel/constants.php
===================================================================
diff -u -r12294 -r12298
--- branches/5.0.x/core/kernel/constants.php (.../constants.php) (revision 12294)
+++ branches/5.0.x/core/kernel/constants.php (.../constants.php) (revision 12298)
@@ -1,6 +1,6 @@
CheckUserPermission($user, 'CATEGORY.MODIFY', 0, 0)) {
// user can edit cms blocks
$editing_mode = $this->GetVar('editing_mode');
- define('EDITING_MODE', $editing_mode ? $editing_mode : EDITING_MODE_CMS);
+ define('EDITING_MODE', $editing_mode ? $editing_mode : EDITING_MODE_BROWSE);
+ $this->Phrases->setPhraseEditing();
}
}
@@ -1955,9 +1956,9 @@
exit;
}
- function Phrase($label)
+ function Phrase($label, $allow_editing = true)
{
- return $this->Phrases->GetPhrase($label);
+ return $this->Phrases->GetPhrase($label, $allow_editing);
}
/**
Index: branches/5.0.x/core/admin_templates/incs/cms.css
===================================================================
diff -u -r12230 -r12298
--- branches/5.0.x/core/admin_templates/incs/cms.css (.../cms.css) (revision 12230)
+++ branches/5.0.x/core/admin_templates/incs/cms.css (.../cms.css) (revision 12298)
@@ -16,7 +16,7 @@
padding: 5px;
}
-div.cms-section-properties-btn, div.cms-edit-btn, div.cms-save-layout-btn {
+div.cms-section-properties-btn, div.cms-edit-btn, div.cms-edit-block-btn, div.cms-edit-design-btn {
padding: 2px 5px;
font-family: Arial, Verdana;
font-size: 13px;
@@ -59,25 +59,70 @@
filter: alpha(opacity=50);
}
-/* === Styles for "Save Layout" button === */
-div.cms-save-layout-btn {
- float: left;
- position: absolute;
+div.cms-edit-block-btn {
+ margin-left: -10px;
+ border: 2px solid #FF6E00;
+ background-color: #FFCC00;
+ display: none;
+}
+div.cms-edit-design-btn {
margin-left: -10px;
+ border: 2px solid #006E00;
+ background-color: #00CC00;
+ /*opacity: 0.5;
+ filter: alpha(opacity=50);*/
+ display: none;
+}
+
+/* === Styles for "Save" and "Cancel" buttons (for layout) === */
+div.cms-layout-btn-container {
+ position: absolute;
+ margin-top: -10px;
+ margin-left: -10px;
+ display: none;
+ z-index: 99;
+}
+
+div.cms-save-layout-btn, div.cms-cancel-layout-btn {
+ float: left;
+ padding: 2px 5px;
+ font-family: Arial, Verdana;
+ font-size: 13px;
+ font-weight: normal;
+ width: auto;
+ color: black;
+ cursor: pointer;
+ -moz-border-radius: 10px;
+}
+
+div.cms-save-layout-btn {
border: 2px solid #A1D0A1;
background-color: #CCFF00;
}
+div.cms-cancel-layout-btn {
+ border: 2px solid #FF0000;
+ background-color: #FF6A5D;
+}
+
+div.cms-cancel-layout-btn {
+ margin-left: 4px;
+}
+
/* === Styles for Template Editor === */
-div.block-edit-btn-container {
+div.block-edit-block-btn-container, div.block-edit-design-btn-container {
border: 1px dashed transparent;
}
-div.block-edit-btn-container-over {
+div.block-edit-block-btn-container-over {
border-color: #FF6E00;
}
+div.block-edit-design-btn-container-over {
+ border-color: #006E00;
+}
+
/* === Styles for element moving/sorting in theme === */
div.movable-area {
min-height: 200px;
@@ -86,4 +131,26 @@
.move-helper {
border: 3px dashed #666;
/*width: auto !important;*/
+}
+
+/* === Styles for phrase translation links === */
+span[name='cms-translate-phrase'] {
+ text-decoration: none;
+ border: 1px dashed transparent;
+ padding: 3px;
+
+}
+
+span[name='cms-translate-phrase']:hover {
+ border-color: #FF6E00;
+}
+
+span[name='cms-translate-phrase'] .cms-btn-text {
+ font-size: 9px;
+}
+
+span[name='cms-translate-phrase'] .cms-edit-btn {
+ display: none;
+ opacity: 1;
+ filter: alpha(opacity=0);
}
\ No newline at end of file
Index: branches/5.0.x/core/admin_templates/js/script.js
===================================================================
diff -u -r12230 -r12298
--- branches/5.0.x/core/admin_templates/js/script.js (.../script.js) (revision 12230)
+++ branches/5.0.x/core/admin_templates/js/script.js (.../script.js) (revision 12298)
@@ -538,9 +538,14 @@
);
}
-function translate_phrase($label, $template) {
+function translate_phrase($label, $template, $options) {
set_hidden_field('phrases_label', $label);
- open_popup('phrases', 'OnNew', $template);
+
+ if ($options.simple_mode !== undefined) {
+ set_hidden_field('simple_mode', $options.simple_mode ? 1 : 0);
+ }
+
+ open_popup('phrases', $options.event === undefined ? 'OnNew' : $options.event, $template);
}
function direct_edit($prefix_special, $url) {
Index: branches/5.0.x/core/units/categories/categories_tag_processor.php
===================================================================
diff -u -r12267 -r12298
--- branches/5.0.x/core/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 12267)
+++ branches/5.0.x/core/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 12298)
@@ -1,6 +1,6 @@
'm,c,content',
@@ -1169,7 +1169,7 @@
Edit '.(defined('DEBUG_MODE') && DEBUG_MODE ? " - #{$num}" : '').'
+ Edit content '.(defined('DEBUG_MODE') && DEBUG_MODE ? " - #{$num}" : '').'
';
@@ -1334,7 +1334,7 @@
$ret = '' . "\n";
$ret .= '' . "\n";
- if (EDITING_MODE == EDITING_MODE_LAYOUT) {
+ if (EDITING_MODE == EDITING_MODE_DESIGN) {
$ret .= ' ';
@@ -1362,35 +1362,39 @@
$this_url = $this->Application->HREF('', '', Array ('editing_mode' => '#EDITING_MODE#', 'no_amp' => 1));
$ret .= "var aTemplateManager = new TemplateManager('" . $edit_template_url . "', '" . $this_url . "', '" . $save_layout_url . "', " . (int)EDITING_MODE . ");\n";
- $ret .= "var \$modal_windows = " . ($this->Application->ConfigValue('UseModalWindows') ? 'true' : 'false') . ";\n";
- $ret .= "var main_title = '" . addslashes( $this->Application->ConfigValue('Site_Name') ) . "';" . "\n";
- $ret .= "var base_url = '" . $this->Application->BaseURL() . "';" . "\n";
- $ret .= 'TB.closeHtml = \' \';' . "\n"; + if (EDITING_MODE != EDITING_MODE_BROWSE) { + $ret .= "var \$modal_windows = " . ($this->Application->ConfigValue('UseModalWindows') ? 'true' : 'false') . ";\n"; + $ret .= "var main_title = '" . addslashes( $this->Application->ConfigValue('Site_Name') ) . "';" . "\n"; + $ret .= "var base_url = '" . $this->Application->BaseURL() . "';" . "\n"; + $ret .= 'TB.closeHtml = \' \';' . "\n"; - $url_params = Array('m_theme' => '', 'pass' => 'm', 'm_opener' => 'r', 'no_amp' => 1); - $browse_url = $this->Application->HREF('catalog/catalog', ADMIN_DIRECTORY, $url_params, 'index.php'); - $browse_url = preg_replace('/&(admin|editing_mode)=[\d]/', '', $browse_url); + $url_params = Array('m_theme' => '', 'pass' => 'm', 'm_opener' => 'r', 'no_amp' => 1); + $browse_url = $this->Application->HREF('catalog/catalog', ADMIN_DIRECTORY, $url_params, 'index.php'); + $browse_url = preg_replace('/&(admin|editing_mode)=[\d]/', '', $browse_url); - $ret .= ' - var topmost = window.top; + $ret .= ' + var topmost = window.top; - topmost.document.title = document.title + \' - '.$this->Application->Phrase('la_AdministrativeConsole').'\'; - t = \''.$this->Application->GetVar('t').'\'; + topmost.document.title = document.title + \' - '.$this->Application->Phrase('la_AdministrativeConsole', false).'\'; + t = \''.$this->Application->GetVar('t').'\'; - if (window.parent.frames["menu"] != undefined) { - if ( $.isFunction(window.parent.frames["menu"].SyncActive) ) { - window.parent.frames["menu"].SyncActive("' . $browse_url . '"); + if (window.parent.frames["menu"] != undefined) { + if ( $.isFunction(window.parent.frames["menu"].SyncActive) ) { + window.parent.frames["menu"].SyncActive("' . $browse_url . '"); + } } - } - '; + '; + } $ret .= '' . "\n"; - // add form, so admin scripts could work - $ret .= ''; + if (EDITING_MODE != EDITING_MODE_BROWSE) { + // add form, so admin scripts could work + $ret .= ''; + } return $ret; } @@ -1412,48 +1416,79 @@ $page =& $this->_getPage($params); - if (!$page->isLoaded()) { + if (!$page->isLoaded() || (($display_mode != 'end') && (EDITING_MODE == EDITING_MODE_BROWSE))) { // when "EditingScripts" tag is not used, make sure, that scripts are also included return $this->EditingScripts($params); } // show "EditPage" button only for pages, that exists in structure if ($display_mode != 'end') { - $url_params = Array( - 'pass' => 'm,c', - 'm_opener' => 'd', - 'c_id' => $page->GetID(), - 'c_mode' => 't', - 'c_event' => 'OnEdit', - 'front' => 1, - '__URLENCODE__' => 1, - '__NO_REWRITE__'=> 1, - 'escape' => 1, - 'index_file' => 'index.php', - ); + $edit_btn = ''; - $edit_url = $this->Application->HREF('categories/categories_edit', '/admin', $url_params); + if (EDITING_MODE == EDITING_MODE_CONTENT) { + $url_params = Array( + 'pass' => 'm,c', + 'm_opener' => 'd', + 'c_id' => $page->GetID(), + 'c_mode' => 't', + 'c_event' => 'OnEdit', + 'front' => 1, + '__URLENCODE__' => 1, + '__NO_REWRITE__'=> 1, + 'escape' => 1, + 'index_file' => 'index.php', + ); - $edit_btn = ''; + $edit_url = $this->Application->HREF('categories/categories_edit', '/admin', $url_params); - if (EDITING_MODE == EDITING_MODE_LAYOUT) { $edit_btn .= ' -
+ Save Layout
+ Section Properties
-
-
+ $edit_url = $this->Application->HREF('themes/file_edit', '/admin', $url_params);
+
+ $edit_btn .= '
+ ' . "\n";
+
+
-
+
+
+
+
+ Save changes
+
+
+
+
+ Cancel
+ Section Properties
-
+ ' . "\n";
+ }
+
if ($display_mode == 'start') {
// button with border around the page
$edit_code .= '
+
+
+ Section Template
+ ' . $edit_btn . ' ';
@@ -1480,6 +1515,26 @@
return $edit_code;
}
+ function _getThemeFileId()
+ {
+ $template = $this->Application->GetVar('t');
+
+ if (!$this->Application->TemplatesCache->TemplateExists($template) && !$this->Application->IsAdmin()) {
+ $cms_handler =& $this->Application->recallObject($this->Prefix . '_EventHandler');
+ /* @var $cms_handler CategoriesEventHandler */
+
+ $template = ltrim($cms_handler->GetDesignTemplate(), '/');
+ }
+
+ $file_path = dirname($template) == '.' ? '' : '/' . dirname($template);
+ $file_name = basename($template);
+
+ $sql = 'SELECT FileId
+ FROM ' . TABLE_PREFIX . 'ThemeFiles
+ WHERE (FilePath = ' . $this->Conn->qstr($file_path) . ') AND (FileName = ' . $this->Conn->qstr($file_name . '.tpl') . ')';
+ return $this->Conn->GetOne($sql);
+ }
+
/**
* Builds cached menu version
*
Index: branches/5.0.x/themes/default2009/platform/elements/side_boxes/search.elm.tpl
===================================================================
diff -u -r12117 -r12298
--- branches/5.0.x/themes/default2009/platform/elements/side_boxes/search.elm.tpl (.../search.elm.tpl) (revision 12117)
+++ branches/5.0.x/themes/default2009/platform/elements/side_boxes/search.elm.tpl (.../search.elm.tpl) (revision 12298)
@@ -33,7 +33,7 @@
- !" /> + |