Index: branches/RC/core/units/categories/categories_tag_processor.php
===================================================================
diff -u -N -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 .= '
' . 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 -N
--- 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 -N -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 @@
$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 : 'script', output : '' }, + { input : 'scriptsrc', output : '' }, + { input : 'span', output : '$0' }, + { input : 'table', output : '"; - else body.innerHTML = "
"+body.innerHTML+""; - } - return document.getElementsByTagName('pre')[0]; - }, - - // syntax highlighting parser - syntaxHighlight : function(flag) { - //if(document.designMode=='off') document.designMode='on' - if(flag != 'init') { window.getSelection().getRangeAt(0).insertNode(document.createTextNode(cc));} - editor = CodePress.getEditor(); - o = editor.innerHTML; - o = o.replace(/
'),code.lastIndexOf('
')+4); - } - }, - - // syntax highlighting parser - syntaxHighlight : function(flag) { - if(flag!='init') document.selection.createRange().text = cc; - o = editor.innerHTML; - if(flag=='paste') { // fix pasted text - o = o.replace(//g,'\n'); - o = o.replace(/<\/P>/g,'\r'); - o = o.replace(/<.*?>/g,''); - o = o.replace(/ /g,''); - o = '
'; - o = o.replace(/\n\r/g,''); - o = o.replace(/\n/g,''+o+'
'); - o = o.replace(/\r/g,'<\/P>'); - o = o.replace(/
(
)+/,'
'); - o = o.replace(/<\/P>(<\/P>)+/,'
'); - o = o.replace(/<\/P>/g,'
');
- var pattern = new RegExp(trigger+cc,"gi");
- this.syntaxHighlight('snippets',pattern,content);
- }
- }
- },
-
- readOnly : function() {
- editor.contentEditable = (arguments[0]) ? 'false' : 'true';
- },
-
- complete : function(trigger) {
- var complete = Language.complete;
- for (var i=0; i /i,''); // IE first line fix
- code = code.replace(/ /gi,'\n');
- code = code.replace(/ /gi,'');
- code = code.replace(/\u2009/g,'');
- code = code.replace(/<.*?>/g,'');
- code = code.replace(/</g,'<');
- code = code.replace(/>/g,'>');
- code = code.replace(/&/gi,'&');
- return code;
- },
-
- // put code inside editor
- setCode : function() {
- var code = arguments[0];
- code = code.replace(/\u2009/gi,'');
- code = code.replace(/&/gi,'&');
- code = code.replace(//g,'>');
- editor.innerHTML = ''+code+'
';
- },
-
-
- // undo and redo methods
- actions : {
- pos : -1, // actual history position
- history : [], // history vector
-
- undo : function() {
- if(editor.innerHTML.indexOf(cc)==-1){
- document.selection.createRange().text = cc;
- this.history[this.pos] = editor.innerHTML;
- }
- this.pos--;
- if(typeof(this.history[this.pos])=='undefined') this.pos++;
- editor.innerHTML = this.history[this.pos];
- CodePress.findString();
- },
-
- redo : function() {
- this.pos++;
- if(typeof(this.history[this.pos])=='undefined') this.pos--;
- editor.innerHTML = this.history[this.pos];
- CodePress.findString();
- },
-
- next : function() { // get next vector position and clean old ones
- if(this.pos>20) this.history[this.pos-21] = undefined;
- return ++this.pos;
- }
- }
-}
-
-Language={};
-window.attachEvent('onload', function() { CodePress.initialize('new');});
\ No newline at end of file
Index: branches/RC/themes/default2009/platform/template_manager/inc/codepress/images/line-numbers.png
===================================================================
diff -u -N -r11427 -r11661
Binary files differ
Index: branches/RC/themes/default2009/platform/template_manager/inc/codepress/languages/html.css
===================================================================
diff -u -N
--- branches/RC/themes/default2009/platform/template_manager/inc/codepress/languages/html.css (revision 11427)
+++ branches/RC/themes/default2009/platform/template_manager/inc/codepress/languages/html.css (revision 0)
@@ -1,18 +0,0 @@
-/*
- * 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/themes/default2009/platform/template_manager/inc/template_manager.js
===================================================================
diff -u -N
--- branches/RC/themes/default2009/platform/template_manager/inc/template_manager.js (revision 11610)
+++ branches/RC/themes/default2009/platform/template_manager/inc/template_manager.js (revision 0)
@@ -1,139 +0,0 @@
-function TemplateManager ($edit_url) {
- this._editUrl = $edit_url;
-
- this._blocks = {};
-
- this._blockOrder = Array ();
-
- $(document).ready(
- function() {
- aTemplateManager.searchBlocks();
- }
- );
-}
-
-TemplateManager.prototype.onBtnClick = function ($e, $element) {
- var $id = $element.id.replace(/_btn$/, '');
- var $block_info = this._blocks[$id];
- var $url = this._editUrl.replace('#BLOCK#', $block_info.block_name + ':' + $block_info.function_name).replace('#EVENT#', '');
-
- this.setFullscreen();
-
- TB.show(
- {
- url: $url,
- onDataReceived: TemplateManager.prototype.onDataReceived,
- onAfterShow: function() {
- TemplateManager.prototype.initEditor.call(this);
- }
- }
- );
-
- $e.stopPropagation();
-}
-
-TemplateManager.prototype.setFullscreen = function ($restore) {
- getFrame('head').$FrameResizer.fullScreen($restore);
-}
-
-TemplateManager.prototype.saveBlock = function () {
- var $url = this._editUrl.replace('#BLOCK#', $('#block').val() ).replace('#EVENT#', 'OnSaveBlock');
-
- function_body.toggleEditor(); // disable editor (global variable from edit_template.tpl via ajax)
-
- TB.show(
- {
- url: $url,
- onDataReceived: TemplateManager.prototype.onDataReceived,
- onAfterShow: function() {
- TemplateManager.prototype.initEditor.call(this);
- },
- postParams: $('#template_editor_form').serializeArray()
- }
- );
-
-}
-
-TemplateManager.prototype.cancelEditing = function () {
- TB.remove();
- this.setFullscreen(true);
-}
-
-
-TemplateManager.prototype.onMouseOver = function ($e, $element) {
- $($element).addClass('block-edit-btn-container-over');
- $e.stopPropagation();
-}
-
-TemplateManager.prototype.onMouseOut = function ($e, $element) {
- $($element).removeClass('block-edit-btn-container-over');
- $e.stopPropagation();
-}
-
-TemplateManager.prototype.searchBlocks = function () {
- $('div').each (
- function () {
- var $id = $(this).attr('id');
-
- if (!$id || $id.match(/parser_block\[.*\].*_btn$/) || !$id.match(/parser_block\[.*\]/)) {
- // skip other divs
- return true;
- }
-
- TemplateManager.prototype.registerBlock.call(aTemplateManager, this);
- }
- );
-}
-
-TemplateManager.prototype.registerBlock = function ($element) {
- var $params = $element.getAttribute('params').split(':');
-
- this._blocks[$element.id] = {
- block_name: $params[0],
- function_name: $params[1]
- };
-
- var $btn = document.getElementById($element.id + '_btn');
-
- $($btn).bind(
- 'click',
- function(ev) {
- TemplateManager.prototype.onBtnClick.call(aTemplateManager, ev, this);
- }
- );
-
- $($element).bind(
- 'mouseover',
- function(ev) {
- TemplateManager.prototype.onMouseOver.call(aTemplateManager, ev, this);
- }
- );
-
- $($element).bind(
- 'mouseout',
- function(ev) {
- TemplateManager.prototype.onMouseOut.call(aTemplateManager, ev, this);
- }
- );
-
- this._blockOrder.push($element.id);
-}
-
-TemplateManager.prototype.onDataReceived = function ($data) {
- if ($data == '0') {
- TB.remove();
- return false;
- }
-
- return true;
-}
-
-TemplateManager.prototype.initEditor = function () {
- var $id = 'function_body';
-
- var $textarea = document.getElementById($id);
- $textarea.id += '_cp';
-
- window[$id] = new CodePress($textarea);
- $( window[$id] ).insertBefore($textarea);
-}
\ No newline at end of file
Index: branches/RC/themes/default2009/platform/template_manager/inc/codepress/engines/khtml.js
===================================================================
diff -u -N
--- branches/RC/themes/default2009/platform/template_manager/inc/codepress/engines/khtml.js (revision 11427)
+++ branches/RC/themes/default2009/platform/template_manager/inc/codepress/engines/khtml.js (revision 0)
@@ -1 +0,0 @@
\ No newline at end of file
Index: branches/RC/themes/default2009/platform/template_manager/inc/codepress/codepress.js
===================================================================
diff -u -N
--- branches/RC/themes/default2009/platform/template_manager/inc/codepress/codepress.js (revision 11427)
+++ branches/RC/themes/default2009/platform/template_manager/inc/codepress/codepress.js (revision 0)
@@ -1,138 +0,0 @@
-/*
- * CodePress - Real Time Syntax Highlighting Editor written in JavaScript - http://codepress.org/
- *
- * Copyright (C) 2006 Fernando M.A.d.S.
/g,'\r\n');
+// o = o.replace(/<(b|i|s|u|a|em|tt|ins|big|cite|strong)?>/g,'');
+ //alert(o)
+ o = o.replace(/<(?!span|\/span|br).*?>/gi,'');
+// alert(o)
+// x = o;
+ x = z = this.split(o,flag);
+ //alert(z)
+// x = x.replace(/\r\n/g,'
');
+ x = x.replace(/\t/g, ' ');
+
+
+ if(arguments[1]&&arguments[2]) x = x.replace(arguments[1],arguments[2]);
+
+ for(i=0;i
');
+ var pattern = new RegExp(trigger+cc,'gi');
+ evt.preventDefault(); // prevent the tab key from being added
+ this.syntaxHighlight('snippets',pattern,content);
+ }
+ }
+ },
+
+ readOnly : function() {
+ document.designMode = (arguments[0]) ? 'off' : 'on';
+ },
+
+ complete : function(trigger) {
+ window.getSelection().getRangeAt(0).deleteContents();
+ var complete = Language.complete;
+ for (var i=0; i