Index: branches/RC/core/units/categories/categories_tag_processor.php
===================================================================
diff -u -r11649 -r11661
--- branches/RC/core/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 11649)
+++ branches/RC/core/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 11661)
@@ -1351,8 +1351,17 @@
$ret .= '' . "\n";
$ret .= '' . "\n";
$ret .= '' . "\n";
+ $ret .= '' . "\n";
$ret .= '
\ No newline at end of file
Index: branches/RC/core/units/email_messages/email_messages_config.php
===================================================================
diff -u -r11623 -r11661
--- branches/RC/core/units/email_messages/email_messages_config.php (.../email_messages_config.php) (revision 11623)
+++ branches/RC/core/units/email_messages/email_messages_config.php (.../email_messages_config.php) (revision 11661)
@@ -114,7 +114,7 @@
'Subject' => Array( 'title'=>'la_col_Subject', 'filter_block' => 'grid_like_filter'),
'Description' => Array( 'title'=>'la_col_Description', 'data_block' => 'label_grid_checkbox_td', 'filter_block' => 'grid_like_filter'),
'Type' => Array( 'title'=>'la_col_Type', 'filter_block' => 'grid_options_filter'),
- 'LanguageId' => Array( 'title'=>'la_col_PackName', 'filter_block' => 'grid_options_filter'),
+ 'LanguageId' => Array( 'title'=>'la_col_Language', 'filter_block' => 'grid_options_filter'),
),
),
Index: branches/RC/core/units/general/helpers/template_helper.php
===================================================================
diff -u -r11495 -r11661
--- branches/RC/core/units/general/helpers/template_helper.php (.../template_helper.php) (revision 11495)
+++ branches/RC/core/units/general/helpers/template_helper.php (.../template_helper.php) (revision 11661)
@@ -37,41 +37,67 @@
*/
var $_sourceTemplate = '';
- function TemplateHelper()
+ var $_initMade = false;
+
+ /**
+ * Performs init ot helper
+ *
+ * @param kDBItem $object
+ */
+ function InitHelper(&$object)
{
- parent::kHelper();
+ if ($this->_initMade) {
+ return ;
+ }
+ define('DBG_IGNORE_FATAL_ERRORS', 1);
+
// 1. get block information
$block_info = $this->Application->GetVar('block');
list ($this->_blockName, $this->_functionName) = explode(':', $block_info);
- $this->_parseTemplate();
+ $this->_parseTemplate($object);
if (array_key_exists($this->_functionName, $this->Application->Parser->ElementLocations)) {
$this->_blockLocation = $this->Application->Parser->ElementLocations[$this->_functionName];
}
+
+ $this->_initMade = true;
}
function _getSourceTemplate()
{
// get source template
$t = $this->Application->GetVar('source');
-
- $cms_handler =& $this->Application->recallObject('st_EventHandler');
- /* @var $cms_handler StructureEventHandler */
- if (!$this->Application->TemplatesCache->TemplateExists($t) && !$this->Application->IsAdmin()) {
+ if (!$this->Application->TemplatesCache->TemplateExists($t)) {
+ $cms_handler =& $this->Application->recallObject('st_EventHandler');
+ /* @var $cms_handler StructureEventHandler */
+
$t = $cms_handler->GetDesignTemplate($t);
}
$this->_sourceTemplate = $t;
}
+ function _getThemeName()
+ {
+ $theme_id = (int)$this->Application->GetVar('theme_id');
+
+ $sql = 'SELECT Name
+ FROM ' . $this->Application->getUnitOption('theme', 'TableName') . '
+ WHERE ' . $this->Application->getUnitOption('theme', 'IDField') . ' = ' . $theme_id;
+ return $this->Conn->GetOne($sql);
+ }
+
/**
* Render source template to get parse errors OR it's element locations
*
+ * @param kDBItem $object
+ * @param string $append
+ * @return bool
*/
- function _parseTemplate($append = '')
+ function _parseTemplate(&$object, $append = '')
{
// 1. set internal error handler to catch all parsing errors
$error_handlers = $this->Application->errorHandlers;
@@ -80,10 +106,12 @@
);
// 2. parse template
- $this->Application->InitParser(); // we have no parser when saving block content
+ $this->Application->InitParser( $this->_getThemeName() ); // we have no parser when saving block content
+
$this->_getSourceTemplate();
- $this->Application->Parser->Run($this->_sourceTemplate . $append);
+ // design templates have leading "/" in the beginning
+ $this->Application->Parser->Run(ltrim($this->_sourceTemplate, '/') . $append);
// 3. restore original error handler
$this->Application->errorHandlers = $error_handlers;
@@ -94,15 +122,15 @@
$filename = $this->_getTemplateFile(false, $append . '.tpl');
if (!unlink($filename)) {
$error_file = $this->_getTemplateFile(true, $append . '.tpl');
- $this->Application->SetVar('Failed to delete temporary template "' . $error_file . '"');
+ $object->SetError('FileContents', 'template_delete_failed', '+Failed to delete temporary template "' . $error_file . '"');
return false;
}
}
else {
// 3.2. restore backup
if (!rename($this->_getTemplateFile(false, '.tpl.bak'), $this->_getTemplateFile(false))) {
$error_file = $this->_getTemplateFile(true);
- $this->Application->SetVar('Failed to restore template "' . $error_file . '" from backup.');
+ $object->SetError('FileContents', 'template_restore_failed', '+Failed to restore template "' . $error_file . '" from backup.');
return false;
}
}
@@ -146,12 +174,6 @@
break;
case 'content':
- $function_body = $this->Application->GetVar('function_body');
- if ($function_body !== false) {
- // error happened -> use unsaved template content
- return unhtmlentities( $function_body );
- }
-
$template_body = file_get_contents( $this->_getTemplateFile() );
$length = $this->_blockLocation['end_pos'] - $this->_blockLocation['start_pos'];
@@ -191,26 +213,25 @@
/**
* Saves new version of block to template, where it's located
*
- * @param kEvent $event
+ * @param kDBItem $object
*/
- function saveBlock(&$event)
+ function saveBlock(&$object)
{
$main_template = $this->_isMainTemplate();
$filename = $this->_getTemplateFile(false);
// 1. get new template content
- $new_template_body = $this->_getNewTemplateContent($filename, $lines_before);
+ $new_template_body = $this->_getNewTemplateContent($object, $filename, $lines_before);
if (is_bool($new_template_body) && ($new_template_body === true)) {
// when nothing changed -> stop processing
- echo '0';
return true;
}
// 2. backup original template
if (!$main_template && !copy($filename, $filename . '.bak')) {
// backup failed
$error_file = $this->_getTemplateFile(true, '.tpl.bak');
- $this->Application->SetVar('error_msg', 'Failed to create backup template "' . $error_file . '" backup.');
+ $object->SetError('FileContents', 'template_backup_failed', '+Failed to create backup template "' . $error_file . '" backup.');
return false;
}
@@ -220,14 +241,14 @@
if (!$fp) {
// backup template create failed OR existing template save
$error_file = $this->_getTemplateFile(true, $main_template ? '.tmp.tpl' : '.tpl');
- $this->Application->SetVar('error_msg', 'Failed to save template "' . $error_file . '" changes.');
+ $object->SetError('FileContents', 'template_changes_save_failed', '+Failed to save template "' . $error_file . '" changes.');
return false;
}
fwrite($fp, $new_template_body);
fclose($fp);
// 3. parse template to check for errors
- $this->_parseTemplate($main_template ? '.tmp' : '');
+ $this->_parseTemplate($object, $main_template ? '.tmp' : '');
if ($this->_parseErrors) {
$error_msg = Array ();
@@ -240,7 +261,7 @@
$error_msg[] = $error_data['msg'] . ' at line ' . ($error_data['line'] - $lines_before);
}
- $this->Application->SetVar('error_msg', 'Template syntax errors:
' . implode('
', $error_msg));
+ $object->SetError('FileContents', 'template_syntax_error', '+Template syntax errors:
' . implode('
', $error_msg));
return false;
}
@@ -249,7 +270,7 @@
if (!rename($this->_getTemplateFile(false, '.tmp.tpl'), $filename)) {
// failed to save new content to original template
$error_file = $this->_getTemplateFile(true);
- $this->Application->SetVar('error_msg', 'Failed to save template "' . $error_file . '".');
+ $object->SetError('FileContents', 'template_save_failed', '+Failed to save template "' . $error_file . '".');
return false;
}
}
@@ -258,23 +279,20 @@
unlink( $this->_getTemplateFile(false, '.tpl.bak') );
}
- define('DBG_SKIP_REPORTING', 1);
- $this->Application->Redirect($this->Application->GetVar('source'));
- echo 1; // were changes
-
return true;
}
/**
* Returns new template content of "true", when nothing is changed
*
+ * @param kDBItem $object
* @param string $filename
* @param int $lines_before
* @return mixed
*/
- function _getNewTemplateContent($filename, &$lines_before)
+ function _getNewTemplateContent(&$object, $filename, &$lines_before)
{
- $new_content = unhtmlentities( $this->Application->GetVar('function_body') );
+ $new_content = $object->GetDBField('FileContents');
$template_body = file_get_contents($filename);
$lines_before = substr_count(substr($template_body, 0, $this->_blockLocation['start_pos']), "\n");
@@ -288,11 +306,16 @@
function _saveError($errno, $errstr, $errfile, $errline, $errcontext)
{
- if (defined('E_STRICT') && ($errno == E_STRICT)) {
- // always ignore strict errors here (specially when not in debug mode)
+ if ($errno != E_USER_ERROR) {
+ // ignore all minor errors, except fatals from parser
return true;
}
+ /*if (defined('E_STRICT') && ($errno == E_STRICT)) {
+ // always ignore strict errors here (specially when not in debug mode)
+ return true;
+ }*/
+
$this->_parseErrors[] = Array ('msg' => $errstr, 'file' => $errfile, 'line' => $errline);
return true;
}
Index: branches/RC/core/admin_templates/themes/codepress/languages/html.css
===================================================================
diff -u
--- branches/RC/core/admin_templates/themes/codepress/languages/html.css (revision 0)
+++ branches/RC/core/admin_templates/themes/codepress/languages/html.css (revision 11661)
@@ -0,0 +1,18 @@
+/*
+ * CodePress color styles for HTML syntax highlighting
+ */
+
+b {color:#000080;} /* tags */
+ins, ins b, ins s, ins em {color:gray;} /* comments */
+s, s b {color:#7777e4;} /* attribute values */
+a {color:green;} /* links */
+u {color:#E67300;} /* forms */
+big {color:#db0000;} /* images */
+em, em b {color:#800080;} /* style */
+strong {color:#800000;} /* script */
+tt i {color:darkblue;font-weight:bold;} /* script reserved words */
+
+b.inp-tag {
+ color: #CF3E33;
+ font-style: italic;
+}
\ No newline at end of file
Index: branches/RC/core/install/english.lang
===================================================================
diff -u -r11641 -r11661
--- branches/RC/core/install/english.lang (.../english.lang) (revision 11641)
+++ branches/RC/core/install/english.lang (.../english.lang) (revision 11661)
@@ -709,6 +709,7 @@
QmFja2dyb3VuZCBJbWFnZQ==
QmFja2dyb3VuZCBQb3NpdGlvbg==
QmFja2dyb3VuZCBSZXBlYXQ=
+ RWxlbWVudCBQb3NpdGlvbg==
Qm9yZGVyIEJvdHRvbQ==
Qm9yZGVyIExlZnQ=
Qm9yZGVyIFJpZ2h0
@@ -770,6 +771,7 @@
RmllbGRzIHNlcGFyYXRlZCBieQ==
RmllbGQgVGl0bGVz
RmllbGQgVmFsdWU=
+ RmlsZSBDb250ZW50cw==
RmlsZW5hbWU=
RmlsZW5hbWUgUmVwbGFjZW1lbnRz
Rmlyc3QgTmFtZQ==
@@ -2042,6 +2044,7 @@
RWRpdGluZyBTcGVsbGluZyBEaWN0aW9uYXJ5
RWRpdGluZyBTdG9wIFdvcmQ=
RWRpdGluZyBTdHlsZQ==
+ RWRpdGluZyBUaGVtZSBGaWxl
RWRpdGluZyBUaGVzYXVydXM=
RWRpdGluZyBUcmFuc2xhdGlvbg==
RWRpdGluZyBCYXNlIFN0eWxl
Index: branches/RC/core/admin_templates/themes/codepress/languages/html.js
===================================================================
diff -u
--- branches/RC/core/admin_templates/themes/codepress/languages/html.js (revision 0)
+++ branches/RC/core/admin_templates/themes/codepress/languages/html.js (revision 11661)
@@ -0,0 +1,60 @@
+/*
+ * CodePress regular expressions for HTML syntax highlighting
+ */
+
+// HTML
+Language.syntax = [
+ { input : /(<[^!]*?>)/g, output : '$1' }, // all tags
+ { input : /(<a .*?>|<\/a>)/g, output : '$1' }, // links
+ { input : /(<img .*?>)/g, output : '$1' }, // images
+ { input : /(<\/?(button|textarea|form|input|select|option|label).*?>)/g, output : '$1' }, // forms
+ { input : /(<style.*?>)(.*?)(<\/style>)/g, output : '$1$2$3' }, // style tags
+ { input : /(<script.*?>)(.*?)(<\/script>)/g, output : '$1$2$3' }, // script tags
+ { input : /=(".*?")/g, output : '=$1' }, // atributes double quote
+ { input : /=('.*?')/g, output : '=$1' }, // atributes single quote
+ { input : /(<!--.*?-->.)/g, output : '$1' }, // comments
+ { input : /(<[\/]?)(inp2\:.*?)(\s|[\/]?>)/g, output : '$1$2$3' }, // inp2 tags
+ { input : /\b(alert|window|document|break|continue|do|for|new|this|void|case|default|else|function|return|typeof|while|if|label|switch|var|with|catch|boolean|int|try|false|throws|null|true|goto)\b/g, output : '$1' } // script reserved words
+]
+
+Language.snippets = [
+ { input : 'aref', output : '' },
+ { input : 'h1', output : '
$0
' },
+ { input : 'h2', output : '$0
' },
+ { input : 'h3', output : '$0
' },
+ { input : 'h4', output : '$0
' },
+ { input : 'h5', output : '$0
' },
+ { input : 'h6', output : '$0
' },
+ { input : 'html', output : '\n\t$0\n' },
+ { input : 'head', output : '\n\t\n\t$0\n\t\n' },
+ { input : 'img', output : '
' },
+ { input : 'input', output : '' },
+ { input : 'label', output : '' },
+ { input : 'legend', output : '' },
+ { input : 'link', output : '' },
+ { input : 'base', output : '' },
+ { input : 'body', output : '\n\t$0\n' },
+ { input : 'css', output : '' },
+ { input : 'div', output : '\n\t$0\n
' },
+ { input : 'divid', output : '\n\t\n
' },
+ { input : 'dl', output : '\n\t- \n\t\t$0\n\t
\n\t\n
' },
+ { input : 'fieldset', output : '' },
+ { input : 'form', output : '' },
+ { input : 'meta', output : '' },
+ { input : 'p', output : '$0
' },
+ { input : 'script', output : '' },
+ { input : 'scriptsrc', output : '' },
+ { input : 'span', output : '$0' },
+ { input : 'table', output : '' },
+ { input : 'style', output : '' }
+]
+
+Language.complete = [
+ { input : '\'',output : '\'$0\'' },
+ { input : '"', output : '"$0"' },
+ { input : '(', output : '\($0\)' },
+ { input : '[', output : '\[$0\]' },
+ { input : '{', output : '{\n\t$0\n}' }
+]
+
+Language.shortcuts = []
Index: branches/RC/core/admin_templates/index.tpl
===================================================================
diff -u -r11623 -r11661
--- branches/RC/core/admin_templates/index.tpl (.../index.tpl) (revision 11623)
+++ branches/RC/core/admin_templates/index.tpl (.../index.tpl) (revision 11661)
@@ -12,7 +12,6 @@
-
-->
@@ -9,9 +7,6 @@
-
-
-