Index: branches/RC/themes/default2009/platform/template_manager/inc/codepress/languages/html.js =================================================================== diff -u -N --- branches/RC/themes/default2009/platform/template_manager/inc/codepress/languages/html.js (revision 0) +++ branches/RC/themes/default2009/platform/template_manager/inc/codepress/languages/html.js (revision 11427) @@ -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 : '\n\t$0\n' }, + { 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 : '
\n\t$0\n
' }, + { input : 'form', output : '
\n\t\n
' }, + { input : 'meta', output : '' }, + { input : 'p', output : '

$0

' }, + { input : 'script', output : '' }, + { input : 'scriptsrc', output : '' }, + { input : 'span', output : '$0' }, + { input : 'table', output : '\n\t\n\t\n
' }, + { 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/themes/default2009/platform/inc/script.js =================================================================== diff -u -N -r11337 -r11427 --- branches/RC/themes/default2009/platform/inc/script.js (.../script.js) (revision 11337) +++ branches/RC/themes/default2009/platform/inc/script.js (.../script.js) (revision 11427) @@ -28,6 +28,19 @@ } } +function addEvent(el, evname, func, traditional) { + if (traditional) { + eval('el.on'+evname+'='+func); + return; + } + + if (document.all) { + el.attachEvent("on" + evname, func); + } else { + el.addEventListener(evname, func, true); + } +}; + // ItemCategories class function ItemCategories($table_id, $field_id, $primary_category, $phrases) { this.CategoryTable = document.getElementById($table_id); @@ -51,11 +64,11 @@ var $category_name = this.CategorySelector.options[this.CategorySelector.selectedIndex].innerHTML.trim(); if ((this.SearchCategory($category_id) !== false) || ($category_id == this.PrimaryCategory) || ($category_id == 0)) { - // don't add same category twice & don't allow to add item's primary category + // don't add same category twice & don't allow to add item's primary category alert(this.Phrases[1]); return ; } - + if ((this.MoreCategories.length + 2) > $max_categories) { // don't add more category - $max_categories limit @@ -114,4 +127,8 @@ ItemCategories.prototype.updateMoreCategoriesField = function() { this.MoreCategoriesField.value = this.MoreCategories.length ? '|' + this.MoreCategories.join('|') + '|' : ''; -} \ No newline at end of file +} + +function jq(myid) { + return '#'+myid.replace(/:/g,"\\:").replace(/\./g,"\\."); +} Index: branches/RC/themes/default2009/platform/inc/jquery/interface/iautoscroller.js =================================================================== diff -u -N --- branches/RC/themes/default2009/platform/inc/jquery/interface/iautoscroller.js (revision 0) +++ branches/RC/themes/default2009/platform/inc/jquery/interface/iautoscroller.js (revision 11427) @@ -0,0 +1,112 @@ +/** + * Interface Elements for jQuery + * Autoscroller + * + * http://interface.eyecon.ro + * + * Copyright (c) 2006 Stefan Petre + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * + */ + +/** + * Utility object that helps to make custom autoscrollers. + * + * @example + * $('div.dragMe').Draggable( + * { + * onStart : function() + * { + * $.iAutoscroller.start(this, document.getElementsByTagName('body')); + * }, + * onStop : function() + * { + * $.iAutoscroller.stop(); + * } + * } + * ); + * + * @description Utility object that helps to make custom autoscrollers + * @type jQuery + * @cat Plugins/Interface + * @author Stefan Petre + */ + +jQuery.iAutoscroller = { + timer: null, + elToScroll: null, + elsToScroll: null, + step: 10, + /** + * This is called to start autoscrolling + * @param DOMElement el the element used as reference + * @param Array els collection of elements to scroll + * @param Integer step the pixels scroll on each step + * @param Integer interval miliseconds between each step + */ + start: function(el, els, step, interval) + { + jQuery.iAutoscroller.elToScroll = el; + jQuery.iAutoscroller.elsToScroll = els; + jQuery.iAutoscroller.step = parseInt(step)||10; + jQuery.iAutoscroller.timer = window.setInterval(jQuery.iAutoscroller.doScroll, parseInt(interval)||40); + }, + + //private function + doScroll : function() + { + for (i=0;i 0 + && + jQuery.iAutoscroller.elsToScroll[i].parentData.y + jQuery.iAutoscroller.elsToScroll[i].parentData.t > elementData.y) { + jQuery.iAutoscroller.elsToScroll[i].scrollTop -= jQuery.iAutoscroller.step; + } else if (jQuery.iAutoscroller.elsToScroll[i].parentData.t <= jQuery.iAutoscroller.elsToScroll[i].parentData.h && jQuery.iAutoscroller.elsToScroll[i].parentData.t + jQuery.iAutoscroller.elsToScroll[i].parentData.hb < elementData.y + elementData.hb) { + jQuery.iAutoscroller.elsToScroll[i].scrollTop += jQuery.iAutoscroller.step; + } + if (jQuery.iAutoscroller.elsToScroll[i].parentData.l > 0 && jQuery.iAutoscroller.elsToScroll[i].parentData.x + jQuery.iAutoscroller.elsToScroll[i].parentData.l > elementData.x) { + jQuery.iAutoscroller.elsToScroll[i].scrollLeft -= jQuery.iAutoscroller.step; + } else if (jQuery.iAutoscroller.elsToScroll[i].parentData.l <= jQuery.iAutoscroller.elsToScroll[i].parentData.wh && jQuery.iAutoscroller.elsToScroll[i].parentData.l + jQuery.iAutoscroller.elsToScroll[i].parentData.wb < elementData.x + elementData.wb) { + jQuery.iAutoscroller.elsToScroll[i].scrollLeft += jQuery.iAutoscroller.step; + } + } + }, + /** + * This is called to stop autoscrolling + */ + stop: function() + { + window.clearInterval(jQuery.iAutoscroller.timer); + jQuery.iAutoscroller.elToScroll = null; + jQuery.iAutoscroller.elsToScroll = null; + for (i in jQuery.iAutoscroller.elsToScroll) { + jQuery.iAutoscroller.elsToScroll[i].parentData = null; + } + } +}; \ No newline at end of file Index: branches/RC/themes/default2009/platform/designs/content_boxes.tpl =================================================================== diff -u -N -r11337 -r11427 --- branches/RC/themes/default2009/platform/designs/content_boxes.tpl (.../content_boxes.tpl) (revision 11337) +++ branches/RC/themes/default2009/platform/designs/content_boxes.tpl (.../content_boxes.tpl) (revision 11427) @@ -1,13 +1,17 @@ - img/s.gif" width="1" height="20" alt=""/>
- +
+ + + -
+ img/s.gif" width="1" height="20" alt=""/>
+
img/s.gif" width="13" height="1" alt=""/>
- + +
img/s.gif" width="13" height="1" alt=""/>
@@ -30,14 +34,18 @@ - img/s.gif" width="1" height="20" alt=""/>
- +
+ + + - Index: branches/RC/themes/default2009/platform/designs/default_design.tpl =================================================================== diff -u -N -r11337 -r11427 --- branches/RC/themes/default2009/platform/designs/default_design.tpl (.../default_design.tpl) (revision 11337) +++ branches/RC/themes/default2009/platform/designs/default_design.tpl (.../default_design.tpl) (revision 11427) @@ -6,17 +6,17 @@ - <inp2:m_GetConfig name="Site_Name"/> :: <inp2:m_RenderElement name="page_title"/> + <inp2:m_GetConfig name="Site_Name"/> :: <inp2:m_RenderElement name="page_title" no_editing="1"/> + +
- -
+ img/s.gif" width="1" height="20" alt=""/>
+
img/s.gif" width="13" height="1" alt=""/>
- + +
img/s.gif" width="13" height="1" alt=""/>
@@ -60,12 +68,12 @@ - +
- + + + + + + + + + + +
img/s.gif" width="13" height="1" alt=""/>
+ @@ -82,10 +90,10 @@ img/menu_active_border.gif" width="1" height="37" alt=""/>
img/menu_active_border.gif" width="1" height="37" alt=""/>
@@ -95,10 +103,10 @@ img/s.gif" width="1" height="37" alt=""/>
img/s.gif" width="1" height="37" alt=""/>
Index: branches/RC/themes/default2009/platform/template_manager/inc/codepress/engines/gecko.js =================================================================== diff -u -N --- branches/RC/themes/default2009/platform/template_manager/inc/codepress/engines/gecko.js (revision 0) +++ branches/RC/themes/default2009/platform/template_manager/inc/codepress/engines/gecko.js (revision 11427) @@ -0,0 +1,313 @@ +/* + * CodePress - Real Time Syntax Highlighting Editor written in JavaScript - http://codepress.org/ + * + * Copyright (C) 2007 Fernando M.A.d.S. + * + * Developers: + * Fernando M.A.d.S. + * Michael Hurni + * Contributors: + * Martin D. Kirk + * + * This program is free software; you can redistribute it and/or modify it under the terms of the + * GNU Lesser General Public License as published by the Free Software Foundation. + * + * Read the full licence: http://www.opensource.org/licenses/lgpl-license.php + */ + +CodePress = { + scrolling : false, + autocomplete : true, + + // set initial vars and start sh + initialize : function() { + if(typeof(editor)=='undefined' && !arguments[0]) return; + body = document.getElementsByTagName('body')[0]; + body.innerHTML = body.innerHTML.replace(/\n/g,""); + chars = '|32|46|62|8|'; // charcodes that trigger syntax highlighting + cc = '\u2009'; // carret char + editor = document.getElementsByTagName('pre')[0]; + document.designMode = 'on'; + document.addEventListener('keypress', this.keyHandler, true); + window.addEventListener('scroll', function() { if(!CodePress.scrolling) CodePress.syntaxHighlight('scroll') }, false); + completeChars = this.getCompleteChars(); + completeEndingChars = this.getCompleteEndingChars(); + }, + + // treat key bindings + keyHandler : function(evt) { + keyCode = evt.keyCode; + charCode = evt.charCode; + fromChar = String.fromCharCode(charCode); + + if((evt.ctrlKey || evt.metaKey) && evt.shiftKey && charCode!=90) { // shortcuts = ctrl||appleKey+shift+key!=z(undo) + CodePress.shortcuts(charCode?charCode:keyCode); + } + else if( (completeEndingChars.indexOf('|'+fromChar+'|')!= -1 || completeChars.indexOf('|'+fromChar+'|')!=-1) && CodePress.autocomplete) { // auto complete + if(!CodePress.completeEnding(fromChar)) + CodePress.complete(fromChar); + } + else if(chars.indexOf('|'+charCode+'|')!=-1||keyCode==13) { // syntax highlighting + top.setTimeout(function(){CodePress.syntaxHighlight('generic');},100); + } + else if(keyCode==9 || evt.tabKey) { // snippets activation (tab) + CodePress.snippets(evt); + } + else if(keyCode==46||keyCode==8) { // save to history when delete or backspace pressed + CodePress.actions.history[CodePress.actions.next()] = editor.innerHTML; + } + else if((charCode==122||charCode==121||charCode==90) && evt.ctrlKey) { // undo and redo + (charCode==121||evt.shiftKey) ? CodePress.actions.redo() : CodePress.actions.undo(); + evt.preventDefault(); + } + else if(charCode==118 && evt.ctrlKey) { // handle paste + top.setTimeout(function(){CodePress.syntaxHighlight('generic');},100); + } + else if(charCode==99 && evt.ctrlKey) { // handle cut + //alert(window.getSelection().getRangeAt(0).toString().replace(/\t/g,'FFF')); + } + + }, + + // put cursor back to its original position after every parsing + findString : function() { + if(self.find(cc)) + window.getSelection().getRangeAt(0).deleteContents(); + }, + + // split big files, highlighting parts of it + split : function(code,flag) { + if(flag=='scroll') { + this.scrolling = true; + return code; + } + else { + this.scrolling = false; + mid = code.indexOf(cc); + if(mid-2000<0) {ini=0;end=4000;} + else if(mid+2000>code.length) {ini=code.length-4000;end=code.length;} + else {ini=mid-2000;end=mid+2000;} + code = code.substring(ini,end); + return code; + } + }, + + getEditor : function() { + if(!document.getElementsByTagName('pre')[0]) { + body = document.getElementsByTagName('body')[0]; + if(!body.innerHTML) return body; + if(body.innerHTML=="
") body.innerHTML = "
 
"; + 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(/
/g,'\n'); + o = o.replace(/<.*?>/g,''); + x = z = this.split(o,flag); + x = x.replace(/\n/g,'
'); + + if(arguments[1]&&arguments[2]) x = x.replace(arguments[1],arguments[2]); + + for(i=0;i/g,'>'); + if(content.indexOf('$0')<0) content += cc; + else content = content.replace(/\$0/,cc); + content = content.replace(/\n/g,'
'); + var pattern = new RegExp(trigger+cc,'gi'); + evt.preventDefault(); // prevent the tab key from being added + this.syntaxHighlight('snippets',pattern,content); + } + } + + /* Modified to insert tab on FF + * @author Asad Khan + */ + if (noInsertion == 1) { + var range = window.getSelection().getRangeAt(0); + + // for the single line + range.setEnd(range.startContainer, range.startOffset); + + var ele = document.createTextNode('\t'); + range.insertNode(ele); + range.setStartAfter(ele); + + evt.preventDefault(); + } + }, + + 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/g,'\n'); + 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; + if (code == '') + document.getElementsByTagName('body')[0].innerHTML = ''; + }, + + // undo and redo methods + actions : { + pos : -1, // actual history position + history : [], // history vector + + undo : function() { + editor = CodePress.getEditor(); + if(editor.innerHTML.indexOf(cc)==-1){ + if(editor.innerHTML != " ") + window.getSelection().getRangeAt(0).insertNode(document.createTextNode(cc)); + this.history[this.pos] = editor.innerHTML; + } + this.pos --; + if(typeof(this.history[this.pos])=='undefined') this.pos ++; + editor.innerHTML = this.history[this.pos]; + if(editor.innerHTML.indexOf(cc)>-1) editor.innerHTML+=cc; + CodePress.findString(); + }, + + redo : function() { + // editor = CodePress.getEditor(); + 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.addEventListener('load', function() { CodePress.initialize('new'); }, true); \ No newline at end of file Index: branches/RC/themes/default2009/platform/template_manager/html_head.tpl =================================================================== diff -u -N --- branches/RC/themes/default2009/platform/template_manager/html_head.tpl (revision 0) +++ branches/RC/themes/default2009/platform/template_manager/html_head.tpl (revision 11427) @@ -0,0 +1,160 @@ + + + + + + + + + + + + + + + + + +
+ + +   + + + + + + + +   + + +
+ + + + + + +
+ + + + \ No newline at end of file Index: branches/RC/themes/default2009/platform/inc/jquery/interface/isortables.js =================================================================== diff -u -N --- branches/RC/themes/default2009/platform/inc/jquery/interface/isortables.js (revision 0) +++ branches/RC/themes/default2009/platform/inc/jquery/interface/isortables.js (revision 11427) @@ -0,0 +1,393 @@ +/** + * Interface Elements for jQuery + * Sortables + * + * http://interface.eyecon.ro + * + * Copyright (c) 2006 Stefan Petre + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * + */ + +/** + * Allows you to resort elements within a container by dragging and dropping. Requires + * the Draggables and Droppables plugins. The container and each item inside the container + * must have an ID. Sortables are especially useful for lists. + * + * @see Plugins/Interface/Draggable + * @see Plugins/Interface/Droppable + * @author Stefan Petre + * @name Sortable + * @cat Plugins/Interface + * @param Hash options A hash of options + * @option String accept The class name for items inside the container (mandatory) + * @option String activeclass The class for the container when one of its items has started to move + * @option String hoverclass The class for the container when an acceptable item is inside it + * @option String helperclass The helper is used to point to the place where the item will be + * moved. This is the class for the helper. + * @option Float opacity Opacity (between 0 and 1) of the item while being dragged + * @option Boolean ghosting When true, the sortable is ghosted when dragged + * @option String tolerance Either 'pointer', 'intersect', or 'fit'. See Droppable for more details + * @option Boolean fit When true, sortable must be inside the container in order to drop + * @option Integer fx Duration for the effect applied to the sortable + * @option Function onchange Callback that gets called when the sortable list changed. It takes + * an array of serialized elements + * @option Boolean floats True if the sorted elements are floated + * @option String containment Use 'parent' to constrain the drag to the container + * @option String axis Use 'horizontally' or 'vertically' to constrain dragging to an axis + * @option String handle The jQuery selector that indicates the draggable handle + * @option DOMElement handle The node that indicates the draggable handle + * @option Function onHover Callback that is called when an acceptable item is dragged over the + * container. Gets the hovering DOMElement as a parameter + * @option Function onOut Callback that is called when an acceptable item leaves the container. + * Gets the leaving DOMElement as a parameter + * @option Object cursorAt The mouse cursor will be moved to the offset on the dragged item + * indicated by the object, which takes "top", "bottom", "left", and + * "right" keys + * @option Function onStart Callback function triggered when the dragging starts + * @option Function onStop Callback function triggered when the dragging stops + * @example $('ul').Sortable( + * { + * accept : 'sortableitem', + * activeclass : 'sortableactive', + * hoverclass : 'sortablehover', + * helperclass : 'sorthelper', + * opacity: 0.5, + * fit : false + * } + * ) + */ + +jQuery.iSort = { + changed : [], + collected : {}, + helper : false, + inFrontOf: null, + + start : function () + { + if (jQuery.iDrag.dragged == null) { + return; + } + var shs, margins,c, cs; + + jQuery.iSort.helper.get(0).className = jQuery.iDrag.dragged.dragCfg.hpc; + shs = jQuery.iSort.helper.get(0).style; + shs.display = 'block'; + jQuery.iSort.helper.oC = jQuery.extend( + jQuery.iUtil.getPosition(jQuery.iSort.helper.get(0)), + jQuery.iUtil.getSize(jQuery.iSort.helper.get(0)) + ); + + shs.width = jQuery.iDrag.dragged.dragCfg.oC.wb + 'px'; + shs.height = jQuery.iDrag.dragged.dragCfg.oC.hb + 'px'; + //shs.cssFloat = jQuery.iDrag.dragged.dragCfg.oF; + margins = jQuery.iUtil.getMargins(jQuery.iDrag.dragged); + shs.marginTop = margins.t; + shs.marginRight = margins.r; + shs.marginBottom = margins.b; + shs.marginLeft = margins.l; + if (jQuery.iDrag.dragged.dragCfg.ghosting == true) { + c = jQuery.iDrag.dragged.cloneNode(true); + cs = c.style; + cs.marginTop = '0px'; + cs.marginRight = '0px'; + cs.marginBottom = '0px'; + cs.marginLeft = '0px'; + cs.display = 'block'; + jQuery.iSort.helper.empty().append(c); + } + jQuery(jQuery.iDrag.dragged).after(jQuery.iSort.helper.get(0)); + jQuery.iDrag.dragged.style.display = 'none'; + }, + + check : function (e) + { + if (!e.dragCfg.so && jQuery.iDrop.overzone.sortable) { + if (e.dragCfg.onStop) + e.dragCfg.onStop.apply(dragged); + jQuery(e).css('position', e.dragCfg.initialPosition || e.dragCfg.oP); + jQuery(e).DraggableDestroy(); + jQuery(jQuery.iDrop.overzone).SortableAddItem(e); + } + jQuery.iSort.helper.removeClass(e.dragCfg.hpc).html(' '); + jQuery.iSort.inFrontOf = null; + var shs = jQuery.iSort.helper.get(0).style; + shs.display = 'none'; + jQuery.iSort.helper.after(e); + if (e.dragCfg.fx > 0) { + jQuery(e).fadeIn(e.dragCfg.fx); + } + jQuery('body').append(jQuery.iSort.helper.get(0)); + var ts = []; + var fnc = false; + for(var i=0; i 0) { + fnc(ts); + } + }, + + checkhover : function(e,o) + { + if (!jQuery.iDrag.dragged) + return; + var cur = false; + var i = 0; + if ( e.dropCfg.el.size() > 0) { + for (i = e.dropCfg.el.size(); i >0; i--) { + if (e.dropCfg.el.get(i-1) != jQuery.iDrag.dragged) { + if (!e.sortCfg.floats) { + if ( + (e.dropCfg.el.get(i-1).pos.y + e.dropCfg.el.get(i-1).pos.hb/2) > jQuery.iDrag.dragged.dragCfg.ny + ) { + cur = e.dropCfg.el.get(i-1); + } else { + break; + } + } else { + if ( + (e.dropCfg.el.get(i-1).pos.x + e.dropCfg.el.get(i-1).pos.wb/2) > jQuery.iDrag.dragged.dragCfg.nx && + (e.dropCfg.el.get(i-1).pos.y + e.dropCfg.el.get(i-1).pos.hb/2) > jQuery.iDrag.dragged.dragCfg.ny + ) { + cur = e.dropCfg.el.get(i-1); + } + } + } + } + } + //helpos = jQuery.iUtil.getPos(jQuery.iSort.helper.get(0)); + if (cur && jQuery.iSort.inFrontOf != cur) { + jQuery.iSort.inFrontOf = cur; + jQuery(cur).before(jQuery.iSort.helper.get(0)); + } else if(!cur && (jQuery.iSort.inFrontOf != null || jQuery.iSort.helper.get(0).parentNode != e) ) { + jQuery.iSort.inFrontOf = null; + jQuery(e).append(jQuery.iSort.helper.get(0)); + } + jQuery.iSort.helper.get(0).style.display = 'block'; + }, + + measure : function (e) + { + if (jQuery.iDrag.dragged == null) { + return; + } + e.dropCfg.el.each ( + function () + { + this.pos = jQuery.extend( + jQuery.iUtil.getSizeLite(this), + jQuery.iUtil.getPositionLite(this) + ); + } + ); + }, + + serialize : function(s) + { + var i; + var h = ''; + var o = {}; + if (s) { + if (jQuery.iSort.collected[s] ) { + o[s] = []; + jQuery('#' + s + ' .' + jQuery.iSort.collected[s]).each( + function () + { + if (h.length > 0) { + h += '&'; + } + h += s + '[]=' + jQuery.attr(this,'id'); + o[s][o[s].length] = jQuery.attr(this,'id'); + } + ); + } else { + for ( a in s) { + if (jQuery.iSort.collected[s[a]] ) { + o[s[a]] = []; + jQuery('#' + s[a] + ' .' + jQuery.iSort.collected[s[a]]).each( + function () + { + if (h.length > 0) { + h += '&'; + } + h += s[a] + '[]=' + jQuery.attr(this,'id'); + o[s[a]][o[s[a]].length] = jQuery.attr(this,'id'); + } + ); + } + } + } + } else { + for ( i in jQuery.iSort.collected){ + o[i] = []; + jQuery('#' + i + ' .' + jQuery.iSort.collected[i]).each( + function () + { + if (h.length > 0) { + h += '&'; + } + h += i + '[]=' + jQuery.attr(this,'id'); + o[i][o[i].length] = jQuery.attr(this,'id'); + } + ); + } + } + return {hash:h, o:o}; + }, + + addItem : function (e) + { + if ( !e.childNodes ) { + return; + } + return this.each( + function () + { + if(!this.sortCfg || !jQuery(e).is('.' + this.sortCfg.accept)) + jQuery(e).addClass(this.sortCfg.accept); + jQuery(e).Draggable(this.sortCfg.dragCfg); + } + ); + }, + + destroy: function() + { + return this.each( + function() + { + jQuery('.' + this.sortCfg.accept).DraggableDestroy(); + jQuery(this).DroppableDestroy(); + this.sortCfg = null; + this.isSortable = null; + } + ); + }, + + build : function (o) + { + if (o.accept && jQuery.iUtil && jQuery.iDrag && jQuery.iDrop) { + if (!jQuery.iSort.helper) { + jQuery('body',document).append('
 
'); + jQuery.iSort.helper = jQuery('#sortHelper'); + jQuery.iSort.helper.get(0).style.display = 'none'; + } + this.Droppable( + { + accept : o.accept, + activeclass : o.activeclass ? o.activeclass : false, + hoverclass : o.hoverclass ? o.hoverclass : false, + helperclass : o.helperclass ? o.helperclass : false, + /*onDrop: function (drag, fx) + { + jQuery.iSort.helper.after(drag); + if (fx > 0) { + jQuery(drag).fadeIn(fx); + } + },*/ + onHover: o.onHover||o.onhover, + onOut: o.onOut||o.onout, + sortable : true, + onChange : o.onChange||o.onchange, + fx : o.fx ? o.fx : false, + ghosting : o.ghosting ? true : false, + tolerance: o.tolerance ? o.tolerance : 'intersect' + } + ); + + return this.each( + function() + { + var dragCfg = { + revert : o.revert? true : false, + zindex : 3000, + opacity : o.opacity ? parseFloat(o.opacity) : false, + hpc : o.helperclass ? o.helperclass : false, + fx : o.fx ? o.fx : false, + so : true, + ghosting : o.ghosting ? true : false, + handle: o.handle ? o.handle : null, + containment: o.containment ? o.containment : null, + onStart : o.onStart && o.onStart.constructor == Function ? o.onStart : false, + onDrag : o.onDrag && o.onDrag.constructor == Function ? o.onDrag : false, + onStop : o.onStop && o.onStop.constructor == Function ? o.onStop : false, + axis : /vertically|horizontally/.test(o.axis) ? o.axis : false, + snapDistance : o.snapDistance ? parseInt(o.snapDistance)||0 : false, + cursorAt: o.cursorAt ? o.cursorAt : false + }; + + jQuery('.' + o.accept, this).Draggable(dragCfg); + this.isSortable = true; + this.sortCfg = { + accept : o.accept, + revert : o.revert? true : false, + zindex : 3000, + opacity : o.opacity ? parseFloat(o.opacity) : false, + hpc : o.helperclass ? o.helperclass : false, + fx : o.fx ? o.fx : false, + so : true, + ghosting : o.ghosting ? true : false, + handle: o.handle ? o.handle : null, + containment: o.containment ? o.containment : null, + floats: o.floats ? true : false, + dragCfg : dragCfg + } + } + ); + } + } +}; + +jQuery.fn.extend( + { + Sortable : jQuery.iSort.build, + /** + * A new item can be added to a sortable by adding it to the DOM and then adding it via + * SortableAddItem. + * + * @name SortableAddItem + * @param DOMElement elem A DOM Element to add to the sortable list + * @example $('#sortable1').append('
  • new item
  • ') + * .SortableAddItem($("#new_item")[0]) + * @type jQuery + * @cat Plugins/Interface + */ + SortableAddItem : jQuery.iSort.addItem, + /** + * Destroy a sortable + * + * @name SortableDestroy + * @example $('#sortable1').SortableDestroy(); + * @type jQuery + * @cat Plugins/Interface + */ + SortableDestroy: jQuery.iSort.destroy + } +); + +/** + * This function returns the hash and an object (can be used as arguments for $.post) for every + * sortable in the page or specific sortables. The hash is based on the 'id' attributes of + * container and items. + * + * @params String sortable The id of the sortable to serialize + * @name $.SortSerialize + * @type String + * @cat Plugins/Interface + */ + +jQuery.SortSerialize = jQuery.iSort.serialize; \ No newline at end of file Index: branches/RC/themes/default2009/platform/inc/jquery/interface/iutil.js =================================================================== diff -u -N --- branches/RC/themes/default2009/platform/inc/jquery/interface/iutil.js (revision 0) +++ branches/RC/themes/default2009/platform/inc/jquery/interface/iutil.js (revision 11427) @@ -0,0 +1,245 @@ +/** + * Interface Elements for jQuery + * utility function + * + * http://interface.eyecon.ro + * + * Copyright (c) 2006 Stefan Petre + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * + */ + +jQuery.iUtil = { + getPosition : function(e) + { + var x = 0; + var y = 0; + var es = e.style; + var restoreStyles = false; + if (jQuery(e).css('display') == 'none') { + var oldVisibility = es.visibility; + var oldPosition = es.position; + restoreStyles = true; + es.visibility = 'hidden'; + es.display = 'block'; + es.position = 'absolute'; + } + var el = e; + while (el){ + x += el.offsetLeft + (el.currentStyle && !jQuery.browser.opera ?parseInt(el.currentStyle.borderLeftWidth)||0:0); + y += el.offsetTop + (el.currentStyle && !jQuery.browser.opera ?parseInt(el.currentStyle.borderTopWidth)||0:0); + el = el.offsetParent; + } + el = e; + while (el && el.tagName && el.tagName.toLowerCase() != 'body') + { + x -= el.scrollLeft||0; + y -= el.scrollTop||0; + el = el.parentNode; + } + if (restoreStyles == true) { + es.display = 'none'; + es.position = oldPosition; + es.visibility = oldVisibility; + } + return {x:x, y:y}; + }, + getPositionLite : function(el) + { + var x = 0, y = 0; + while(el) { + x += el.offsetLeft || 0; + y += el.offsetTop || 0; + el = el.offsetParent; + } + return {x:x, y:y}; + }, + getSize : function(e) + { + var w = jQuery.css(e,'width'); + var h = jQuery.css(e,'height'); + var wb = 0; + var hb = 0; + var es = e.style; + if (jQuery(e).css('display') != 'none') { + wb = e.offsetWidth; + hb = e.offsetHeight; + } else { + var oldVisibility = es.visibility; + var oldPosition = es.position; + es.visibility = 'hidden'; + es.display = 'block'; + es.position = 'absolute'; + wb = e.offsetWidth; + hb = e.offsetHeight; + es.display = 'none'; + es.position = oldPosition; + es.visibility = oldVisibility; + } + return {w:w, h:h, wb:wb, hb:hb}; + }, + getSizeLite : function(el) + { + return { + wb:el.offsetWidth||0, + hb:el.offsetHeight||0 + }; + }, + getClient : function(e) + { + var h, w, de; + if (e) { + w = e.clientWidth; + h = e.clientHeight; + } else { + de = document.documentElement; + w = window.innerWidth || self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth; + h = window.innerHeight || self.innerHeight || (de&&de.clientHeight) || document.body.clientHeight; + } + return {w:w,h:h}; + }, + getScroll : function (e) + { + var t=0, l=0, w=0, h=0, iw=0, ih=0; + if (e && e.nodeName.toLowerCase() != 'body') { + t = e.scrollTop; + l = e.scrollLeft; + w = e.scrollWidth; + h = e.scrollHeight; + iw = 0; + ih = 0; + } else { + if (document.documentElement) { + t = document.documentElement.scrollTop; + l = document.documentElement.scrollLeft; + w = document.documentElement.scrollWidth; + h = document.documentElement.scrollHeight; + } else if (document.body) { + t = document.body.scrollTop; + l = document.body.scrollLeft; + w = document.body.scrollWidth; + h = document.body.scrollHeight; + } + iw = self.innerWidth||document.documentElement.clientWidth||document.body.clientWidth||0; + ih = self.innerHeight||document.documentElement.clientHeight||document.body.clientHeight||0; + } + return { t: t, l: l, w: w, h: h, iw: iw, ih: ih }; + }, + getMargins : function(e, toInteger) + { + var el = jQuery(e); + var t = el.css('marginTop') || ''; + var r = el.css('marginRight') || ''; + var b = el.css('marginBottom') || ''; + var l = el.css('marginLeft') || ''; + if (toInteger) + return { + t: parseInt(t)||0, + r: parseInt(r)||0, + b: parseInt(b)||0, + l: parseInt(l) + }; + else + return {t: t, r: r, b: b, l: l}; + }, + getPadding : function(e, toInteger) + { + var el = jQuery(e); + var t = el.css('paddingTop') || ''; + var r = el.css('paddingRight') || ''; + var b = el.css('paddingBottom') || ''; + var l = el.css('paddingLeft') || ''; + if (toInteger) + return { + t: parseInt(t)||0, + r: parseInt(r)||0, + b: parseInt(b)||0, + l: parseInt(l) + }; + else + return {t: t, r: r, b: b, l: l}; + }, + getBorder : function(e, toInteger) + { + var el = jQuery(e); + var t = el.css('borderTopWidth') || ''; + var r = el.css('borderRightWidth') || ''; + var b = el.css('borderBottomWidth') || ''; + var l = el.css('borderLeftWidth') || ''; + if (toInteger) + return { + t: parseInt(t)||0, + r: parseInt(r)||0, + b: parseInt(b)||0, + l: parseInt(l)||0 + }; + else + return {t: t, r: r, b: b, l: l}; + }, + getPointer : function(event) + { + var x = event.pageX || (event.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft)) || 0; + var y = event.pageY || (event.clientY + (document.documentElement.scrollTop || document.body.scrollTop)) || 0; + return {x:x, y:y}; + }, + traverseDOM : function(nodeEl, func) + { + func(nodeEl); + nodeEl = nodeEl.firstChild; + while(nodeEl){ + jQuery.iUtil.traverseDOM(nodeEl, func); + nodeEl = nodeEl.nextSibling; + } + }, + purgeEvents : function(nodeEl) + { + jQuery.iUtil.traverseDOM( + nodeEl, + function(el) + { + for(var attr in el){ + if(typeof el[attr] === 'function') { + el[attr] = null; + } + } + } + ); + }, + centerEl : function(el, axis) + { + var clientScroll = jQuery.iUtil.getScroll(); + var windowSize = jQuery.iUtil.getSize(el); + if (!axis || axis == 'vertically') + jQuery(el).css( + { + top: clientScroll.t + ((Math.max(clientScroll.h,clientScroll.ih) - clientScroll.t - windowSize.hb)/2) + 'px' + } + ); + if (!axis || axis == 'horizontally') + jQuery(el).css( + { + left: clientScroll.l + ((Math.max(clientScroll.w,clientScroll.iw) - clientScroll.l - windowSize.wb)/2) + 'px' + } + ); + }, + fixPNG : function (el, emptyGIF) { + var images = jQuery('img[@src*="png"]', el||document), png; + images.each( function() { + png = this.src; + this.src = emptyGIF; + this.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + png + "')"; + }); + } +}; + +// Helper function to support older browsers! +[].indexOf || (Array.prototype.indexOf = function(v, n){ + n = (n == null) ? 0 : n; + var m = this.length; + for (var i=n; i
    - +
    - @@ -71,19 +75,14 @@
    @@ -38,19 +38,23 @@
    - +
    + +
    + img/s.gif" width="3" height="1" alt=""/>
    - +
    + +

    -
    - - - - \ No newline at end of file Index: branches/RC/themes/default2009/platform/template_manager/inc/codepress/codepress.css =================================================================== diff -u -N --- branches/RC/themes/default2009/platform/template_manager/inc/codepress/codepress.css (revision 0) +++ branches/RC/themes/default2009/platform/template_manager/inc/codepress/codepress.css (revision 11427) @@ -0,0 +1,21 @@ +body { + margin-top:13px; + _margin-top:14px; + background:white; + margin-left:32px; + font-family:monospace; + font-size:13px; + white-space:pre; + background-image:url("images/line-numbers.png"); + background-repeat:repeat-y; + background-position:0 3px; + line-height:16px; + height:100%; +} +pre {margin:0;} +html>body{background-position:0 2px;} +P {margin:0;padding:0;border:0;outline:0;display:block;white-space:pre;} +b, i, s, u, a, em, tt, ins, big, cite, strong, var, dfn {text-decoration:none;font-weight:normal;font-style:normal;font-size:13px;} + +body.hide-line-numbers {background:white;margin-left:16px;} +body.show-line-numbers {background-image:url("images/line-numbers.png");margin-left:32px;} \ No newline at end of file Index: branches/RC/themes/default2009/platform/inc/jquery/interface/idrag.js =================================================================== diff -u -N --- branches/RC/themes/default2009/platform/inc/jquery/interface/idrag.js (revision 0) +++ branches/RC/themes/default2009/platform/inc/jquery/interface/idrag.js (revision 11427) @@ -0,0 +1,591 @@ +/** + * Interface Elements for jQuery + * Draggable + * + * http://interface.eyecon.ro + * + * Copyright (c) 2006 Stefan Petre + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + */ + +/** + * Create a draggable element with a number of advanced options including callback, Google Maps type draggables, + * reversion, ghosting, and grid dragging. + * + * @name Draggable + * @descr Creates draggable elements that can be moved across the page. + * @param Hash hash A hash of parameters. All parameters are optional. + * @option String handle (optional) The jQuery selector matching the handle that starts the draggable + * @option DOMElement handle (optional) The DOM Element of the handle that starts the draggable + * @option Boolean revert (optional) When true, on stop-drag the element returns to initial position + * @option Boolean ghosting (optional) When true, a copy of the element is moved + * @option Integer zIndex (optional) zIndex depth for the element while it is being dragged + * @option Float opacity (optional) A number between 0 and 1 that indicates the opacity of the element while being dragged + * @option Integer grid (optional) (optional) A number of pixels indicating the grid that the element should snap to + * @option Array grid (optional) A number of x-pixels and y-pixels indicating the grid that the element should snap to + * @option Integer fx (optional) Duration for the effect (like ghosting or revert) applied to the draggable + * @option String containment (optional) Define the zone where the draggable can be moved. 'parent' moves it inside parent + * element, while 'document' prevents it from leaving the document and forcing additional + * scrolling + * @option Array containment An 4-element array (left, top, width, height) indicating the containment of the element + * @option String axis (optional) Set an axis: vertical (with 'vertically') or horizontal (with 'horizontally') + * @option Function onStart (optional) Callback function triggered when the dragging starts + * @option Function onStop (optional) Callback function triggered when the dragging stops + * @option Function onChange (optional) Callback function triggered when the dragging stop *and* the element was moved at least + * one pixel + * @option Function onDrag (optional) Callback function triggered while the element is dragged. Receives two parameters: x and y + * coordinates. You can return an object with new coordinates {x: x, y: y} so this way you can + * interact with the dragging process (for instance, build your containment) + * @option Boolean insideParent Forces the element to remain inside its parent when being dragged (like Google Maps) + * @option Integer snapDistance (optional) The element is not moved unless it is dragged more than snapDistance. You can prevent + * accidental dragging and keep regular clicking enabled (for links or form elements, + * for instance) + * @option Object cursorAt (optional) The dragged element is moved to the cursor position with the offset specified. Accepts value + * for top, left, right and bottom offset. Basically, this forces the cursor to a particular + * position during the entire drag operation. + * @option Boolean autoSize (optional) When true, the drag helper is resized to its content, instead of the dragged element's sizes + * @option String frameClass (optional) When is set the cloned element is hidden so only a frame is dragged + * @type jQuery + * @cat Plugins/Interface + * @author Stefan Petre + */ + +jQuery.iDrag = { + helper : null, + dragged: null, + destroy : function() + { + return this.each( + function () + { + if (this.isDraggable) { + this.dragCfg.dhe.unbind('mousedown', jQuery.iDrag.draginit); + this.dragCfg = null; + this.isDraggable = false; + if(jQuery.browser.msie) { + this.unselectable = "off"; + } else { + this.style.MozUserSelect = ''; + this.style.KhtmlUserSelect = ''; + this.style.userSelect = ''; + } + } + } + ); + }, + draginit : function (e) + { +// alert('initing drag operation'); + if (jQuery.iDrag.dragged != null) { + jQuery.iDrag.dragstop(e); + return false; + } + var elm = this.dragElem; + jQuery(document) + .bind('mousemove', jQuery.iDrag.dragmove) + .bind('mouseup', jQuery.iDrag.dragstop); + elm.dragCfg.pointer = jQuery.iUtil.getPointer(e); + elm.dragCfg.currentPointer = elm.dragCfg.pointer; + elm.dragCfg.init = false; + elm.dragCfg.fromHandler = this != this.dragElem; + jQuery.iDrag.dragged = elm; + if (elm.dragCfg.si && this != this.dragElem) { + parentPos = jQuery.iUtil.getPosition(elm.parentNode); + sliderSize = jQuery.iUtil.getSize(elm); + sliderPos = { + x : parseInt(jQuery.css(elm,'left')) || 0, + y : parseInt(jQuery.css(elm,'top')) || 0 + }; + dx = elm.dragCfg.currentPointer.x - parentPos.x - sliderSize.wb/2 - sliderPos.x; + dy = elm.dragCfg.currentPointer.y - parentPos.y - sliderSize.hb/2 - sliderPos.y; + jQuery.iSlider.dragmoveBy(elm, [dx, dy]); + } + return jQuery.selectKeyHelper||false; + }, + + dragstart : function(e) + { + var elm = jQuery.iDrag.dragged; + elm.dragCfg.init = true; + + var dEs = elm.style; + + elm.dragCfg.oD = jQuery.css(elm,'display'); + elm.dragCfg.oP = jQuery.css(elm,'position'); + if (!elm.dragCfg.initialPosition) + elm.dragCfg.initialPosition = elm.dragCfg.oP; + + elm.dragCfg.oR = { + x : parseInt(jQuery.css(elm,'left')) || 0, + y : parseInt(jQuery.css(elm,'top')) || 0 + }; + elm.dragCfg.diffX = 0; + elm.dragCfg.diffY = 0; + if (jQuery.browser.msie) { + var oldBorder = jQuery.iUtil.getBorder(elm, true); + elm.dragCfg.diffX = oldBorder.l||0; + elm.dragCfg.diffY = oldBorder.t||0; + } + + elm.dragCfg.oC = jQuery.extend( + jQuery.iUtil.getPosition(elm), + jQuery.iUtil.getSize(elm) + ); + if (elm.dragCfg.oP != 'relative' && elm.dragCfg.oP != 'absolute') { + dEs.position = 'relative'; + } + + jQuery.iDrag.helper.empty(); + var clonedEl = elm.cloneNode(true); + + jQuery(clonedEl).css( + { + display: 'block', + left: '0px', + top: '0px' + } + ); + clonedEl.style.marginTop = '0'; + clonedEl.style.marginRight = '0'; + clonedEl.style.marginBottom = '0'; + clonedEl.style.marginLeft = '0'; + jQuery.iDrag.helper.append(clonedEl); + + var dhs = jQuery.iDrag.helper.get(0).style; + + if (elm.dragCfg.autoSize) { + dhs.width = 'auto'; + dhs.height = 'auto'; + } else { + dhs.height = elm.dragCfg.oC.hb + 'px'; + dhs.width = elm.dragCfg.oC.wb + 'px'; + } + + dhs.display = 'block'; + dhs.marginTop = '0px'; + dhs.marginRight = '0px'; + dhs.marginBottom = '0px'; + dhs.marginLeft = '0px'; + + //remeasure the clone to check if the size was changed by user's functions + jQuery.extend( + elm.dragCfg.oC, + jQuery.iUtil.getSize(clonedEl) + ); + + if (elm.dragCfg.cursorAt) { + if (elm.dragCfg.cursorAt.left) { + elm.dragCfg.oR.x += elm.dragCfg.pointer.x - elm.dragCfg.oC.x - elm.dragCfg.cursorAt.left; + elm.dragCfg.oC.x = elm.dragCfg.pointer.x - elm.dragCfg.cursorAt.left; + } + if (elm.dragCfg.cursorAt.top) { + elm.dragCfg.oR.y += elm.dragCfg.pointer.y - elm.dragCfg.oC.y - elm.dragCfg.cursorAt.top; + elm.dragCfg.oC.y = elm.dragCfg.pointer.y - elm.dragCfg.cursorAt.top; + } + if (elm.dragCfg.cursorAt.right) { + elm.dragCfg.oR.x += elm.dragCfg.pointer.x - elm.dragCfg.oC.x -elm.dragCfg.oC.hb + elm.dragCfg.cursorAt.right; + elm.dragCfg.oC.x = elm.dragCfg.pointer.x - elm.dragCfg.oC.wb + elm.dragCfg.cursorAt.right; + } + if (elm.dragCfg.cursorAt.bottom) { + elm.dragCfg.oR.y += elm.dragCfg.pointer.y - elm.dragCfg.oC.y - elm.dragCfg.oC.hb + elm.dragCfg.cursorAt.bottom; + elm.dragCfg.oC.y = elm.dragCfg.pointer.y - elm.dragCfg.oC.hb + elm.dragCfg.cursorAt.bottom; + } + } + elm.dragCfg.nx = elm.dragCfg.oR.x; + elm.dragCfg.ny = elm.dragCfg.oR.y; + + if (elm.dragCfg.insideParent || elm.dragCfg.containment == 'parent') { + parentBorders = jQuery.iUtil.getBorder(elm.parentNode, true); + elm.dragCfg.oC.x = elm.offsetLeft + (jQuery.browser.msie ? 0 : jQuery.browser.opera ? -parentBorders.l : parentBorders.l); + elm.dragCfg.oC.y = elm.offsetTop + (jQuery.browser.msie ? 0 : jQuery.browser.opera ? -parentBorders.t : parentBorders.t); + jQuery(elm.parentNode).append(jQuery.iDrag.helper.get(0)); + } + if (elm.dragCfg.containment) { + jQuery.iDrag.getContainment(elm); + elm.dragCfg.onDragModifier.containment = jQuery.iDrag.fitToContainer; + } + + if (elm.dragCfg.si) { + jQuery.iSlider.modifyContainer(elm); + } + + dhs.left = elm.dragCfg.oC.x - elm.dragCfg.diffX + 'px'; + dhs.top = elm.dragCfg.oC.y - elm.dragCfg.diffY + 'px'; + //resize the helper to fit the clone + dhs.width = elm.dragCfg.oC.wb + 'px'; + dhs.height = elm.dragCfg.oC.hb + 'px'; + + jQuery.iDrag.dragged.dragCfg.prot = false; + + if (elm.dragCfg.gx) { + elm.dragCfg.onDragModifier.grid = jQuery.iDrag.snapToGrid; + } + if (elm.dragCfg.zIndex != false) { + jQuery.iDrag.helper.css('zIndex', elm.dragCfg.zIndex); + } + if (elm.dragCfg.opacity) { + jQuery.iDrag.helper.css('opacity', elm.dragCfg.opacity); + if (window.ActiveXObject) { + jQuery.iDrag.helper.css('filter', 'alpha(opacity=' + elm.dragCfg.opacity * 100 + ')'); + } + } + + if(elm.dragCfg.frameClass) { + jQuery.iDrag.helper.addClass(elm.dragCfg.frameClass); + jQuery.iDrag.helper.get(0).firstChild.style.display = 'none'; + } + if (elm.dragCfg.onStart) + elm.dragCfg.onStart.apply(elm, [clonedEl, elm.dragCfg.oR.x, elm.dragCfg.oR.y]); + if (jQuery.iDrop && jQuery.iDrop.count > 0 ){ + jQuery.iDrop.highlight(elm); + } + if (elm.dragCfg.ghosting == false) { + dEs.display = 'none'; + } + return false; + }, + + getContainment : function(elm) + { + if (elm.dragCfg.containment.constructor == String) { + if (elm.dragCfg.containment == 'parent') { + elm.dragCfg.cont = jQuery.extend( + {x:0,y:0}, + jQuery.iUtil.getSize(elm.parentNode) + ); + var contBorders = jQuery.iUtil.getBorder(elm.parentNode, true); + elm.dragCfg.cont.w = elm.dragCfg.cont.wb - contBorders.l - contBorders.r; + elm.dragCfg.cont.h = elm.dragCfg.cont.hb - contBorders.t - contBorders.b; + } else if (elm.dragCfg.containment == 'document') { + var clnt = jQuery.iUtil.getClient(); + elm.dragCfg.cont = { + x : 0, + y : 0, + w : clnt.w, + h : clnt.h + }; + } + } else if (elm.dragCfg.containment.constructor == Array) { + elm.dragCfg.cont = { + x : parseInt(elm.dragCfg.containment[0])||0, + y : parseInt(elm.dragCfg.containment[1])||0, + w : parseInt(elm.dragCfg.containment[2])||0, + h : parseInt(elm.dragCfg.containment[3])||0 + }; + } + elm.dragCfg.cont.dx = elm.dragCfg.cont.x - elm.dragCfg.oC.x; + elm.dragCfg.cont.dy = elm.dragCfg.cont.y - elm.dragCfg.oC.y; + }, + + hidehelper : function(dragged) + { + if (dragged.dragCfg.insideParent || dragged.dragCfg.containment == 'parent') { + jQuery('body', document).append(jQuery.iDrag.helper.get(0)); + } + jQuery.iDrag.helper.empty().hide().css('opacity', 1); + if (window.ActiveXObject) { + jQuery.iDrag.helper.css('filter', 'alpha(opacity=100)'); + } + }, + + dragstop : function(e) + { + + jQuery(document) + .unbind('mousemove', jQuery.iDrag.dragmove) + .unbind('mouseup', jQuery.iDrag.dragstop); + + if (jQuery.iDrag.dragged == null) { + return; + } + var dragged = jQuery.iDrag.dragged; + + jQuery.iDrag.dragged = null; + + if (dragged.dragCfg.init == false) { + return false; + } + if (dragged.dragCfg.so == true) { + jQuery(dragged).css('position', dragged.dragCfg.oP); + } + var dEs = dragged.style; + + if (dragged.si) { + jQuery.iDrag.helper.css('cursor', 'move'); + } + if(dragged.dragCfg.frameClass) { + jQuery.iDrag.helper.removeClass(dragged.dragCfg.frameClass); + } + + if (dragged.dragCfg.revert == false) { + if (dragged.dragCfg.fx > 0) { + if (!dragged.dragCfg.axis || dragged.dragCfg.axis == 'horizontally') { + var x = new jQuery.fx(dragged,{duration:dragged.dragCfg.fx}, 'left'); + x.custom(dragged.dragCfg.oR.x,dragged.dragCfg.nRx); + } + if (!dragged.dragCfg.axis || dragged.dragCfg.axis == 'vertically') { + var y = new jQuery.fx(dragged,{duration:dragged.dragCfg.fx}, 'top'); + y.custom(dragged.dragCfg.oR.y,dragged.dragCfg.nRy); + } + } else { + if (!dragged.dragCfg.axis || dragged.dragCfg.axis == 'horizontally') + dragged.style.left = dragged.dragCfg.nRx + 'px'; + if (!dragged.dragCfg.axis || dragged.dragCfg.axis == 'vertically') + dragged.style.top = dragged.dragCfg.nRy + 'px'; + } + jQuery.iDrag.hidehelper(dragged); + if (dragged.dragCfg.ghosting == false) { + jQuery(dragged).css('display', dragged.dragCfg.oD); + } + } else if (dragged.dragCfg.fx > 0) { + dragged.dragCfg.prot = true; + var dh = false; + if(jQuery.iDrop && jQuery.iSort && dragged.dragCfg.so) { + dh = jQuery.iUtil.getPosition(jQuery.iSort.helper.get(0)); + } + jQuery.iDrag.helper.animate( + { + left : dh ? dh.x : dragged.dragCfg.oC.x, + top : dh ? dh.y : dragged.dragCfg.oC.y + }, + dragged.dragCfg.fx, + function() + { + dragged.dragCfg.prot = false; + if (dragged.dragCfg.ghosting == false) { + dragged.style.display = dragged.dragCfg.oD; + } + jQuery.iDrag.hidehelper(dragged); + } + ); + } else { + jQuery.iDrag.hidehelper(dragged); + if (dragged.dragCfg.ghosting == false) { + jQuery(dragged).css('display', dragged.dragCfg.oD); + } + } + + if (jQuery.iDrop && jQuery.iDrop.count > 0 ){ + jQuery.iDrop.checkdrop(dragged); + } + if (jQuery.iSort && dragged.dragCfg.so) { + jQuery.iSort.check(dragged); + } + if (dragged.dragCfg.onChange && (dragged.dragCfg.nRx != dragged.dragCfg.oR.x || dragged.dragCfg.nRy != dragged.dragCfg.oR.y)){ + dragged.dragCfg.onChange.apply(dragged, dragged.dragCfg.lastSi||[0,0,dragged.dragCfg.nRx,dragged.dragCfg.nRy]); + } + if (dragged.dragCfg.onStop) + dragged.dragCfg.onStop.apply(dragged); + return false; + }, + + snapToGrid : function(x, y, dx, dy) + { + if (dx != 0) + dx = parseInt((dx + (this.dragCfg.gx * dx/Math.abs(dx))/2)/this.dragCfg.gx) * this.dragCfg.gx; + if (dy != 0) + dy = parseInt((dy + (this.dragCfg.gy * dy/Math.abs(dy))/2)/this.dragCfg.gy) * this.dragCfg.gy; + return { + dx : dx, + dy : dy, + x: 0, + y: 0 + }; + }, + + fitToContainer : function(x, y, dx, dy) + { + dx = Math.min( + Math.max(dx,this.dragCfg.cont.dx), + this.dragCfg.cont.w + this.dragCfg.cont.dx - this.dragCfg.oC.wb + ); + dy = Math.min( + Math.max(dy,this.dragCfg.cont.dy), + this.dragCfg.cont.h + this.dragCfg.cont.dy - this.dragCfg.oC.hb + ); + + return { + dx : dx, + dy : dy, + x: 0, + y: 0 + } + }, + + dragmove : function(e) + { + if (jQuery.iDrag.dragged == null || jQuery.iDrag.dragged.dragCfg.prot == true) { + return; + } + + var dragged = jQuery.iDrag.dragged; + + dragged.dragCfg.currentPointer = jQuery.iUtil.getPointer(e); + if (dragged.dragCfg.init == false) { + distance = Math.sqrt(Math.pow(dragged.dragCfg.pointer.x - dragged.dragCfg.currentPointer.x, 2) + Math.pow(dragged.dragCfg.pointer.y - dragged.dragCfg.currentPointer.y, 2)); + if (distance < dragged.dragCfg.snapDistance){ + return; + } else { + jQuery.iDrag.dragstart(e); + } + } + + var dx = dragged.dragCfg.currentPointer.x - dragged.dragCfg.pointer.x; + var dy = dragged.dragCfg.currentPointer.y - dragged.dragCfg.pointer.y; + + for (var i in dragged.dragCfg.onDragModifier) { + var newCoords = dragged.dragCfg.onDragModifier[i].apply(dragged, [dragged.dragCfg.oR.x + dx, dragged.dragCfg.oR.y + dy, dx, dy]); + if (newCoords && newCoords.constructor == Object) { + dx = i != 'user' ? newCoords.dx : (newCoords.x - dragged.dragCfg.oR.x); + dy = i != 'user' ? newCoords.dy : (newCoords.y - dragged.dragCfg.oR.y); + } + } + + dragged.dragCfg.nx = dragged.dragCfg.oC.x + dx - dragged.dragCfg.diffX; + dragged.dragCfg.ny = dragged.dragCfg.oC.y + dy - dragged.dragCfg.diffY; + + if (dragged.dragCfg.si && (dragged.dragCfg.onSlide || dragged.dragCfg.onChange)) { + jQuery.iSlider.onSlide(dragged, dragged.dragCfg.nx, dragged.dragCfg.ny); + } + + if(dragged.dragCfg.onDrag) + dragged.dragCfg.onDrag.apply(dragged, [dragged.dragCfg.oR.x + dx, dragged.dragCfg.oR.y + dy]); + + if (!dragged.dragCfg.axis || dragged.dragCfg.axis == 'horizontally') { + dragged.dragCfg.nRx = dragged.dragCfg.oR.x + dx; + jQuery.iDrag.helper.get(0).style.left = dragged.dragCfg.nx + 'px'; + } + if (!dragged.dragCfg.axis || dragged.dragCfg.axis == 'vertically') { + dragged.dragCfg.nRy = dragged.dragCfg.oR.y + dy; + jQuery.iDrag.helper.get(0).style.top = dragged.dragCfg.ny + 'px'; + } + + if (jQuery.iDrop && jQuery.iDrop.count > 0 ){ + jQuery.iDrop.checkhover(dragged); + } + return false; + }, + + build : function(o) + { + if (!jQuery.iDrag.helper) { + jQuery('body',document).append('
    '); + jQuery.iDrag.helper = jQuery('#dragHelper'); + var el = jQuery.iDrag.helper.get(0); + var els = el.style; + els.position = 'absolute'; + els.display = 'none'; + els.cursor = 'move'; + els.listStyle = 'none'; + els.overflow = 'hidden'; + if (window.ActiveXObject) { + el.unselectable = "on"; + } else { + els.mozUserSelect = 'none'; + els.userSelect = 'none'; + els.KhtmlUserSelect = 'none'; + } + } + if (!o) { + o = {}; + } + return this.each( + function() + { + if (this.isDraggable || !jQuery.iUtil) + return; + if (window.ActiveXObject) { + this.onselectstart = function(){return false;}; + this.ondragstart = function(){return false;}; + } + var el = this; + var dhe = o.handle ? jQuery(this).find(o.handle) : jQuery(this); + if(jQuery.browser.msie) { + dhe.each( + function() + { + this.unselectable = "on"; + } + ); + } else { + dhe.css('-moz-user-select', 'none'); + dhe.css('user-select', 'none'); + dhe.css('-khtml-user-select', 'none'); + } + this.dragCfg = { + dhe: dhe, + revert : o.revert ? true : false, + ghosting : o.ghosting ? true : false, + so : o.so ? o.so : false, + si : o.si ? o.si : false, + insideParent : o.insideParent ? o.insideParent : false, + zIndex : o.zIndex ? parseInt(o.zIndex)||0 : false, + opacity : o.opacity ? parseFloat(o.opacity) : false, + fx : parseInt(o.fx)||null, + hpc : o.hpc ? o.hpc : false, + onDragModifier : {}, + pointer : {}, + onStart : o.onStart && o.onStart.constructor == Function ? o.onStart : false, + onStop : o.onStop && o.onStop.constructor == Function ? o.onStop : false, + onChange : o.onChange && o.onChange.constructor == Function ? o.onChange : false, + axis : /vertically|horizontally/.test(o.axis) ? o.axis : false, + snapDistance : o.snapDistance ? parseInt(o.snapDistance)||0 : 0, + cursorAt: o.cursorAt ? o.cursorAt : false, + autoSize : o.autoSize ? true : false, + frameClass : o.frameClass || false + + }; + if (o.onDragModifier && o.onDragModifier.constructor == Function) + this.dragCfg.onDragModifier.user = o.onDragModifier; + if (o.onDrag && o.onDrag.constructor == Function) + this.dragCfg.onDrag = o.onDrag; + if (o.containment && ((o.containment.constructor == String && (o.containment == 'parent' || o.containment == 'document')) || (o.containment.constructor == Array && o.containment.length == 4) )) { + this.dragCfg.containment = o.containment; + } + if(o.fractions) { + this.dragCfg.fractions = o.fractions; + } + if(o.grid){ + if(typeof o.grid == 'number'){ + this.dragCfg.gx = parseInt(o.grid)||1; + this.dragCfg.gy = parseInt(o.grid)||1; + } else if (o.grid.length == 2) { + this.dragCfg.gx = parseInt(o.grid[0])||1; + this.dragCfg.gy = parseInt(o.grid[1])||1; + } + } + if (o.onSlide && o.onSlide.constructor == Function) { + this.dragCfg.onSlide = o.onSlide; + } + + this.isDraggable = true; + dhe.each( + function(){ + this.dragElem = el; + } + ); + +// alert('binding mouse down'); + dhe.bind('mousedown', jQuery.iDrag.draginit); + } + ) + } +}; + +/** + * Destroy an existing draggable on a collection of elements + * + * @name DraggableDestroy + * @descr Destroy a draggable + * @type jQuery + * @cat Plugins/Interface + * @example $('#drag2').DraggableDestroy(); + */ + +jQuery.fn.extend( + { + DraggableDestroy : jQuery.iDrag.destroy, + Draggable : jQuery.iDrag.build + } +); \ No newline at end of file Index: branches/RC/themes/default2009/platform/template_manager/inc/codepress/engines/opera.js =================================================================== diff -u -N --- branches/RC/themes/default2009/platform/template_manager/inc/codepress/engines/opera.js (revision 0) +++ branches/RC/themes/default2009/platform/template_manager/inc/codepress/engines/opera.js (revision 11427) @@ -0,0 +1,260 @@ +/* + * CodePress - Real Time Syntax Highlighting Editor written in JavaScript - http://codepress.org/ + * + * Copyright (C) 2007 Fernando M.A.d.S. + * + * Contributors : + * + * Michael Hurni + * + * This program is free software; you can redistribute it and/or modify it under the terms of the + * GNU Lesser General Public License as published by the Free Software Foundation. + * + * Read the full licence: http://www.opensource.org/licenses/lgpl-license.php + */ + + +CodePress = { + scrolling : false, + autocomplete : true, + + // set initial vars and start sh + initialize : function() { + if(typeof(editor)=='undefined' && !arguments[0]) return; + chars = '|32|46|62|'; // charcodes that trigger syntax highlighting + cc = '\u2009'; // control char + editor = document.getElementsByTagName('body')[0]; + document.designMode = 'on'; + document.addEventListener('keyup', this.keyHandler, true); + window.addEventListener('scroll', function() { if(!CodePress.scrolling) CodePress.syntaxHighlight('scroll') }, false); + completeChars = this.getCompleteChars(); +// CodePress.syntaxHighlight('init'); + }, + + // treat key bindings + keyHandler : function(evt) { + keyCode = evt.keyCode; + charCode = evt.charCode; + + if((evt.ctrlKey || evt.metaKey) && evt.shiftKey && charCode!=90) { // shortcuts = ctrl||appleKey+shift+key!=z(undo) + CodePress.shortcuts(charCode?charCode:keyCode); + } + else if(completeChars.indexOf('|'+String.fromCharCode(charCode)+'|')!=-1 && CodePress.autocomplete) { // auto complete + CodePress.complete(String.fromCharCode(charCode)); + } + else if(chars.indexOf('|'+charCode+'|')!=-1||keyCode==13) { // syntax highlighting + CodePress.syntaxHighlight('generic'); + } + else if(keyCode==9 || evt.tabKey) { // snippets activation (tab) + CodePress.snippets(evt); + } + else if(keyCode==46||keyCode==8) { // save to history when delete or backspace pressed + CodePress.actions.history[CodePress.actions.next()] = editor.innerHTML; + } + else if((charCode==122||charCode==121||charCode==90) && evt.ctrlKey) { // undo and redo + (charCode==121||evt.shiftKey) ? CodePress.actions.redo() : CodePress.actions.undo(); + evt.preventDefault(); + } + else if(keyCode==86 && evt.ctrlKey) { // paste + // TODO: pasted text should be parsed and highlighted + } + }, + + // put cursor back to its original position after every parsing + findString : function() { + var sel = window.getSelection(); + var range = window.document.createRange(); + var span = window.document.getElementsByTagName('span')[0]; + + range.selectNode(span); + sel.removeAllRanges(); + sel.addRange(range); + span.parentNode.removeChild(span); + //if(self.find(cc)) + //window.getSelection().getRangeAt(0).deleteContents(); + }, + + // split big files, highlighting parts of it + split : function(code,flag) { + if(flag=='scroll') { + this.scrolling = true; + return code; + } + else { + this.scrolling = false; + mid = code.indexOf(''); + if(mid-2000<0) {ini=0;end=4000;} + else if(mid+2000>code.length) {ini=code.length-4000;end=code.length;} + else {ini=mid-2000;end=mid+2000;} + code = code.substring(ini,end); + return code; + } + }, + + // syntax highlighting parser + syntaxHighlight : function(flag) { + //if(document.designMode=='off') document.designMode='on' + if(flag!='init') { + var span = document.createElement('span'); + window.getSelection().getRangeAt(0).insertNode(span); + } + + o = editor.innerHTML; +// o = o.replace(/
    /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/g,'>'); + if(content.indexOf('$0')<0) content += cc; + else content = content.replace(/\$0/,cc); + content = content.replace(/\n/g,'
    '); + 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/g,'\n'); + 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){ + window.getSelection().getRangeAt(0).insertNode(document.createTextNode(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.addEventListener('load', function() { CodePress.initialize('new'); }, true); Index: branches/RC/themes/default2009/platform/template_manager/inc/codepress/codepress.html =================================================================== diff -u -N --- branches/RC/themes/default2009/platform/template_manager/inc/codepress/codepress.html (revision 0) +++ branches/RC/themes/default2009/platform/template_manager/inc/codepress/codepress.html (revision 11427) @@ -0,0 +1,35 @@ + + + + CodePress - Real Time Syntax Highlighting Editor written in JavaScript + + + + + + + + + Index: branches/RC/themes/default2009/platform/template_manager/inc/codepress/engines/msie.js =================================================================== diff -u -N --- branches/RC/themes/default2009/platform/template_manager/inc/codepress/engines/msie.js (revision 0) +++ branches/RC/themes/default2009/platform/template_manager/inc/codepress/engines/msie.js (revision 11427) @@ -0,0 +1,304 @@ +/* + * CodePress - Real Time Syntax Highlighting Editor written in JavaScript - http://codepress.org/ + * + * Copyright (C) 2007 Fernando M.A.d.S. + * + * Developers: + * Fernando M.A.d.S. + * Michael Hurni + * Contributors: + * Martin D. Kirk + * + * This program is free software; you can redistribute it and/or modify it under the terms of the + * GNU Lesser General Public License as published by the Free Software Foundation. + * + * Read the full licence: http://www.opensource.org/licenses/lgpl-license.php + */ + +CodePress = { + scrolling : false, + autocomplete : true, + + // set initial vars and start sh + initialize : function() { + if(typeof(editor)=='undefined' && !arguments[0]) return; + chars = '|32|46|62|'; // charcodes that trigger syntax highlighting + cc = '\u2009'; // carret char + editor = document.getElementsByTagName('pre')[0]; + editor.contentEditable = 'true'; + document.getElementsByTagName('body')[0].onfocus = function() {editor.focus();} + document.attachEvent('onkeydown', this.metaHandler); + document.attachEvent('onkeypress', this.keyHandler); + window.attachEvent('onscroll', function() { if(!CodePress.scrolling) setTimeout(function(){CodePress.syntaxHighlight('scroll')},1)}); + completeChars = this.getCompleteChars(); + completeEndingChars = this.getCompleteEndingChars(); + setTimeout(function() { window.scroll(0,0) },50); // scroll IE to top + }, + + // treat key bindings + keyHandler : function(evt) { + charCode = evt.keyCode; + fromChar = String.fromCharCode(charCode); + + if( (completeEndingChars.indexOf('|'+fromChar+'|')!= -1 || completeChars.indexOf('|'+fromChar+'|')!=-1 )&& CodePress.autocomplete) { // auto complete + if(!CodePress.completeEnding(fromChar)) + CodePress.complete(fromChar); + } + else if(chars.indexOf('|'+charCode+'|')!=-1||charCode==13) { // syntax highlighting + CodePress.syntaxHighlight('generic'); + } + }, + + metaHandler : function(evt) { + keyCode = evt.keyCode; + + if(keyCode==9 || evt.tabKey) { + CodePress.snippets(); + } + else if((keyCode==122||keyCode==121||keyCode==90) && evt.ctrlKey) { // undo and redo + (keyCode==121||evt.shiftKey) ? CodePress.actions.redo() : CodePress.actions.undo(); + evt.returnValue = false; + } + else if(keyCode==34||keyCode==33) { // handle page up/down for IE + self.scrollBy(0, (keyCode==34) ? 200 : -200); + evt.returnValue = false; + } + else if(keyCode==46||keyCode==8) { // save to history when delete or backspace pressed + CodePress.actions.history[CodePress.actions.next()] = editor.innerHTML; + } + else if((evt.ctrlKey || evt.metaKey) && evt.shiftKey && keyCode!=90) { // shortcuts = ctrl||appleKey+shift+key!=z(undo) + CodePress.shortcuts(keyCode); + evt.returnValue = false; + } + else if(keyCode==86 && evt.ctrlKey) { // handle paste + window.clipboardData.setData('Text',window.clipboardData.getData('Text').replace(/\t/g,'\u2008')); + top.setTimeout(function(){CodePress.syntaxHighlight('paste');},10); + } + else if(keyCode==67 && evt.ctrlKey) { // handle cut + // window.clipboardData.setData('Text',x[0]); + // code = window.clipboardData.getData('Text'); + } + }, + + // put cursor back to its original position after every parsing + + + findString : function() { + range = self.document.body.createTextRange(); + if(range.findText(cc)){ + range.select(); + range.text = ''; + } + }, + + // split big files, highlighting parts of it + split : function(code,flag) { + if(flag=='scroll') { + this.scrolling = true; + return code; + } + else { + this.scrolling = false; + mid = code.indexOf(cc); + if(mid-2000<0) {ini=0;end=4000;} + else if(mid+2000>code.length) {ini=code.length-4000;end=code.length;} + else {ini=mid-2000;end=mid+2000;} + code = code.substring(ini,end); + return code.substring(code.indexOf('

    '),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,'\r\n'); + o = o.replace(/\u2008/g,'\t'); + } + o = o.replace(/

    /g,'\n'); + o = o.replace(/<\/P>/g,'\r'); + o = o.replace(/<.*?>/g,''); + o = o.replace(/ /g,''); + o = '

    '+o+'

    '; + o = o.replace(/\n\r/g,'

    '); + o = o.replace(/\n/g,'

    '); + o = o.replace(/\r/g,'<\/P>'); + o = o.replace(/

    (

    )+/,'

    '); + o = o.replace(/<\/P>(<\/P>)+/,'

    '); + o = o.replace(/

    <\/P>/g,'


    '); + x = z = this.split(o,flag); + + if(arguments[1]&&arguments[2]) x = x.replace(arguments[1],arguments[2]); + + for(i=0;i/g,'>'); + if(content.indexOf('$0')<0) content += cc; + else content = content.replace(/\$0/,cc); + content = content.replace(/\n/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/g,'\n'); + code = code.replace(/<\/p>/gi,'\r'); + code = code.replace(/

    /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/elements/menu.tpl =================================================================== diff -u -N -r11337 -r11427 --- branches/RC/themes/default2009/platform/elements/menu.tpl (.../menu.tpl) (revision 11337) +++ branches/RC/themes/default2009/platform/elements/menu.tpl (.../menu.tpl) (revision 11427) @@ -45,12 +45,14 @@ - window.onload = function() { - var menu_mgr = NlsMenuUtil.createFromXMLString(''); + addLoadEvent( + function() { + var menu_mgr = NlsMenuUtil.createFromXMLString(''); -// menu_mgr.renderMenus(); - menu_mgr.renderMenubar('xmlMenuDiv'); - }; +// menu_mgr.renderMenus(); + menu_mgr.renderMenubar('xmlMenuDiv'); + } + );