Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/Xinha.css =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/Xinha.css,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/Xinha.css 2 Feb 2007 21:04:44 -0000 1.1 @@ -0,0 +1,256 @@ +.htmlarea { background: #fff; margin:2px; } + +.htmlarea .toolbar { + cursor: default; + background: ButtonFace; + padding: 3px; + border: 1px solid; + border-color: ButtonHighlight ButtonShadow ButtonShadow ButtonHighlight; +} +.htmlarea .toolbar table { margin: 0; font-family: tahoma,verdana,sans-serif; font-size: 11px; } +.htmlarea .toolbar img { border: none; vertical-align: top; } +.htmlarea .toolbar .label { padding: 0px 3px; } + +.htmlarea .toolbar .button { + background: ButtonFace; + color: ButtonText; + border: 1px solid ButtonFace; + padding: 1px; + margin: 0px; + width: 18px; + height: 18px; +} +.htmlarea .toolbar a.button:hover { + border: 1px solid; + border-color: ButtonHighlight ButtonShadow ButtonShadow ButtonHighlight; +} +.htmlarea .toolbar a.buttonDisabled:hover { + border-color: ButtonFace; +} +.htmlarea .toolbar .buttonActive, +.htmlarea .toolbar .buttonPressed +{ + padding: 2px 0px 0px 2px; + border: 1px solid; + border-color: ButtonShadow ButtonHighlight ButtonHighlight ButtonShadow; +} +.htmlarea .toolbar .buttonPressed { + background: ButtonHighlight; +} +.htmlarea .toolbar .indicator { + padding: 0px 3px; + overflow: hidden; + width: 20px; + text-align: center; + cursor: default; + border: 1px solid ButtonShadow; +} + +.htmlarea .toolbar .buttonDisabled img { + filter: gray() alpha(opacity = 25); + -moz-opacity: 0.25; + opacity: 0.25; +} + +.htmlarea .toolbar .separator { + /*position: relative;*/ + margin: 3px; + border-left: 1px solid ButtonShadow; + border-right: 1px solid ButtonHighlight; + width: 0px; + height: 18px; + padding: 0px; +} + +.htmlarea .toolbar .space { width: 5px; } + +.htmlarea .toolbar select, .htmlarea .toolbar option { font: 11px Tahoma,Verdana,sans-serif;} + +.htmlarea .toolbar select, +.htmlarea .toolbar select:hover, +.htmlarea .toolbar select:active { + margin-top: 2px; + margin-bottom: 1px; + color: ButtonText; +} + +.htmlarea iframe.xinha_iframe, .htmlarea textarea.xinha_textarea +{ + border: none; /*1px solid;*/ +} + +.htmlarea .statusBar { + border: 1px solid; + border-color: ButtonShadow ButtonHighlight ButtonHighlight ButtonShadow; + padding: 2px 4px; + background-color: ButtonFace; + color: ButtonText; + font: 11px Tahoma,Verdana,sans-serif; +} + +.htmlarea .statusBar .statusBarTree a { + padding: 2px 5px; + color: #00f; +} + +.htmlarea .statusBar .statusBarTree a:visited { color: #00f; } +.htmlarea .statusBar .statusBarTree a:hover { + background-color: Highlight; + color: HighlightText; + padding: 1px 4px; + border: 1px solid HighlightText; +} + + +/* popup dialogs */ + +.dialog { + color: ButtonText; + background: ButtonFace; +} + +.dialog .content { padding: 2px; } + +.dialog, .dialog button, .dialog input, .dialog select, .dialog textarea, .dialog table { + font: 11px Tahoma,Verdana,sans-serif; +} + +.dialog table { border-collapse: collapse; } + +.dialog .title, .dialog h1 +{ + background: #008; + color: #ff8; + border-bottom: 1px solid #000; + padding: 1px 0px 2px 5px; + font-size: 12px; + font-weight: bold; + cursor: default; +} +.dialog h1 { margin:0px;} +.dialog .title .button { + float: right; + border: 1px solid #66a; + padding: 0px 1px 0px 2px; + margin-right: 1px; + color: #fff; + text-align: center; +} + +.dialog .title .button-hilite { border-color: #88f; background: #44c; } + +.dialog button { + width: 5em; + padding: 0px; +} + +.dialog .buttonColor { + padding: 1px; + cursor: default; + border: 1px solid; + border-color: ButtonHighlight ButtonShadow ButtonShadow ButtonHighlight; +} + +.dialog .buttonColor-hilite { + border-color: #000; +} + +.dialog .buttonColor .chooser, .dialog .buttonColor .nocolor { + height: 0.6em; + border: 1px solid; + padding: 0px 1em; + border-color: ButtonShadow ButtonHighlight ButtonHighlight ButtonShadow; +} + +.dialog .buttonColor .nocolor { padding: 0px; } +.dialog .buttonColor .nocolor-hilite { background-color: #fff; color: #f00; } + +.dialog .label { text-align: right; width: 6em; } +.dialog .value input { width: 100%; } +.dialog .buttons { text-align: right; padding: 2px 4px 0px 4px; } + +.dialog legend { font-weight: bold; } +.dialog fieldset table { margin: 2px 0px; } + +.popupwin { + padding: 0px; + margin: 0px; +} + +.popupwin .title { + background: #fff; + color: #000; + font-weight: bold; + font-size: 120%; + padding: 3px 10px; + margin-bottom: 10px; + border-bottom: 1px solid black; + letter-spacing: 2px; +} + +form { margin: 0px; border: none; } + + +/** Panels **/ +.htmlarea .panels.top +{ + border-bottom : 1px solid; + border-color: ButtonShadow; +} + +.htmlarea .panels.right +{ + border-left : 1px solid; + border-color: ButtonShadow; +} + +.htmlarea .panels.left +{ + border-right : 1px solid; + border-color: ButtonShadow; +} + +.htmlarea .panels.bottom +{ + border-top : 1px solid; + border-color: ButtonShadow; +} + +.htmlarea .panel h1 { + background: ButtonFace; + border: 1px solid; + border-color: ButtonHighlight ButtonShadow ButtonShadow ButtonHighlight; + margin: 0px; + padding: 0px; + font-size:100%; + font-weight:bold; + padding: 2px; + clear:left; + +} + +.htmlarea .panel { overflow:auto; } +.htmlarea .panels.left .panel { border-right:none; border-left:none; } +.htmlarea .panels.left h1 { border-right:none; } +.htmlarea .panels.right .panel { border-right:none; border-left:none; } +.htmlarea .panels.left h1 { border-left:none; } +.htmlarea { border: 1px solid black; } + +.loading +{ + background-color:#666; + position:absolute; + z-index:998; +} +.loading_main +{ + font-size:1.6em; + color:#ff6; + text-align:center; +} +.loading_sub +{ + font-size:1.0em; + color:#fff; + text-align:center; +} Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/XinhaCore.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/XinhaCore.js,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/XinhaCore.js 2 Feb 2007 21:04:44 -0000 1.1 @@ -0,0 +1,5758 @@ + + /*--------------------------------------:noTabs=true:tabSize=2:indentSize=2:-- + -- Xinha (is not htmlArea) - http://xinha.gogo.co.nz/ + -- + -- Use of Xinha is granted by the terms of the htmlArea License (based on + -- BSD license) please read license.txt in this package for details. + -- + -- Xinha was originally based on work by Mihai Bazon which is: + -- Copyright (c) 2003-2004 dynarch.com. + -- Copyright (c) 2002-2003 interactivetools.com, inc. + -- This copyright notice MUST stay intact for use. + -- + -- Developers - Coding Style: + -- For the sake of not committing needlessly conflicting changes, + -- + -- * New code to be indented with 2 spaces ("soft tab"). + -- * New code preferably uses BSD-Style Bracing + -- if ( foo ) + -- { + -- bar(); + -- } + -- * Don't change brace styles unless you're working on the non BSD-Style + -- area (so we don't get spurious changes in line numbering). + -- * Don't change indentation unless you're working on the badly indented + -- area (so we don't get spurious changes of large blocks of code). + -- * Jedit is the recommended editor, a comment of this format should be + -- included in the top 10 lines of the file (see the embedded edit mode) + -- + -- $HeadURL: http://svn.xinha.python-hosting.com/trunk/XinhaCore.js $ + -- $LastChangedDate: 2007-01-31 02:09:44 +1300 (Wed, 31 Jan 2007) $ + -- $LastChangedRevision: 707 $ + -- $LastChangedBy: ray $ + --------------------------------------------------------------------------*/ + +Xinha.version = +{ + 'Release' : 'Trunk', + 'Head' : '$HeadURL: http://svn.xinha.python-hosting.com/trunk/XinhaCore.js $'.replace(/^[^:]*: (.*) \$$/, '$1'), + 'Date' : '$LastChangedDate: 2007-01-31 02:09:44 +1300 (Wed, 31 Jan 2007) $'.replace(/^[^:]*: ([0-9-]*) ([0-9:]*) ([+0-9]*) \((.*)\) \$/, '$4 $2 $3'), + 'Revision' : '$LastChangedRevision: 707 $'.replace(/^[^:]*: (.*) \$$/, '$1'), + 'RevisionBy': '$LastChangedBy: ray $'.replace(/^[^:]*: (.*) \$$/, '$1') +}; + +if ( typeof _editor_url == "string" ) +{ + // Leave exactly one backslash at the end of _editor_url + _editor_url = _editor_url.replace(/\x2f*$/, '/'); +} +else +{ + alert("WARNING: _editor_url is not set! You should set this variable to the editor files path; it should preferably be an absolute path, like in '/htmlarea/', but it can be relative if you prefer. Further we will try to load the editor files correctly but we'll probably fail."); + _editor_url = ''; +} + +// make sure we have a language +if ( typeof _editor_lang == "string" ) +{ + _editor_lang = _editor_lang.toLowerCase(); +} +else +{ + _editor_lang = "en"; +} + +// skin stylesheet to load +if ( typeof _editor_skin !== "string" ) +{ + _editor_skin = ""; +} + +var __xinhas = []; + +// browser identification +Xinha.agt = navigator.userAgent.toLowerCase(); +Xinha.is_ie = ((Xinha.agt.indexOf("msie") != -1) && (Xinha.agt.indexOf("opera") == -1)); +Xinha.is_opera = (Xinha.agt.indexOf("opera") != -1); +Xinha.is_mac = (Xinha.agt.indexOf("mac") != -1); +Xinha.is_mac_ie = (Xinha.is_ie && Xinha.is_mac); +Xinha.is_win_ie = (Xinha.is_ie && !Xinha.is_mac); +Xinha.is_gecko = (navigator.product == "Gecko"); +Xinha.isRunLocally = document.URL.toLowerCase().search(/^file:/) != -1; +if ( Xinha.isRunLocally ) +{ + alert('Xinha *must* be installed on a web server. Locally opened files (those that use the "file://" protocol) cannot properly function. Xinha will try to initialize but may not be correctly loaded.'); +} + +// Creates a new Xinha object. Tries to replace the textarea with the given +// ID with it. +function Xinha(textarea, config) +{ + if ( !textarea ) + { + throw("Tried to create Xinha without textarea specified."); + } + + if ( Xinha.checkSupportedBrowser() ) + { + if ( typeof config == "undefined" ) + { + this.config = new Xinha.Config(); + } + else + { + this.config = config; + } + this._htmlArea = null; + + if ( typeof textarea != 'object' ) + { + textarea = Xinha.getElementById('textarea', textarea); + } + this._textArea = textarea; + this._textArea.spellcheck = false; + + // Before we modify anything, get the initial textarea size + this._initial_ta_size = + { + w: textarea.style.width ? textarea.style.width : ( textarea.offsetWidth ? ( textarea.offsetWidth + 'px' ) : ( textarea.cols + 'em') ), + h: textarea.style.height ? textarea.style.height : ( textarea.offsetHeight ? ( textarea.offsetHeight + 'px' ) : ( textarea.rows + 'em') ) + }; + // Create the loading message elements + if ( this.config.showLoading ) + { + // Create and show the main loading message and the sub loading message for details of loading actions + // global element + var loading_message = document.createElement("div"); + loading_message.id = "loading_" + textarea.name; + loading_message.className = "loading"; + try + { + // how can i find the real width in pixels without % or em *and* with no visual errors ? + // for instance, a textarea with a style="width:100%" and the body padding > 0 result in a horizontal scrollingbar while loading + // A few lines above seems to indicate offsetWidth is not always set + loading_message.style.width = textarea.offsetWidth + 'px'; + } + catch (ex) + { + // offsetWidth seems not set, so let's use this._initial_ta_size.w, but sometimes it may be too huge width + loading_message.style.width = this._initial_ta_size.w; + } + loading_message.style.left = Xinha.findPosX(textarea) + 'px'; + loading_message.style.top = (Xinha.findPosY(textarea) + parseInt(this._initial_ta_size.h, 10) / 2) + 'px'; + // main static message + var loading_main = document.createElement("div"); + loading_main.className = "loading_main"; + loading_main.id = "loading_main_" + textarea.name; + loading_main.appendChild(document.createTextNode(Xinha._lc("Loading in progress. Please wait !"))); + // sub dynamic message + var loading_sub = document.createElement("div"); + loading_sub.className = "loading_sub"; + loading_sub.id = "loading_sub_" + textarea.name; + loading_sub.appendChild(document.createTextNode(Xinha._lc("Constructing main object"))); + loading_message.appendChild(loading_main); + loading_message.appendChild(loading_sub); + document.body.appendChild(loading_message); + this.setLoadingMessage("Constructing object"); + } + + this._editMode = "wysiwyg"; + this.plugins = {}; + this._timerToolbar = null; + this._timerUndo = null; + this._undoQueue = [this.config.undoSteps]; + this._undoPos = -1; + this._customUndo = true; + this._mdoc = document; // cache the document, we need it in plugins + this.doctype = ''; + this.__htmlarea_id_num = __xinhas.length; + __xinhas[this.__htmlarea_id_num] = this; + + this._notifyListeners = {}; + + // Panels + var panels = + { + right: + { + on: true, + container: document.createElement('td'), + panels: [] + }, + left: + { + on: true, + container: document.createElement('td'), + panels: [] + }, + top: + { + on: true, + container: document.createElement('td'), + panels: [] + }, + bottom: + { + on: true, + container: document.createElement('td'), + panels: [] + } + }; + + for ( var i in panels ) + { + if(!panels[i].container) { continue; } // prevent iterating over wrong type + panels[i].div = panels[i].container; // legacy + panels[i].container.className = 'panels ' + i; + Xinha.freeLater(panels[i], 'container'); + Xinha.freeLater(panels[i], 'div'); + } + // finally store the variable + this._panels = panels; + + Xinha.freeLater(this, '_textArea'); + } +} + +Xinha.onload = function() { }; +Xinha.init = function() { Xinha.onload(); }; + +// cache some regexps +Xinha.RE_tagName = /(<\/|<)\s*([^ \t\n>]+)/ig; +Xinha.RE_doctype = /()\n?/i; +Xinha.RE_head = /((.|\n)*?)<\/head>/i; +Xinha.RE_body = /]*>((.|\n|\r|\t)*?)<\/body>/i; +Xinha.RE_Specials = /([\/\^$*+?.()|{}[\]])/g; +Xinha.RE_email = /[_a-zA-Z\d\-\.]{3,}@[_a-zA-Z\d\-]{2,}(\.[_a-zA-Z\d\-]{2,})+/i; +Xinha.RE_url = /(https?:\/\/)?(([a-z0-9_]+:[a-z0-9_]+@)?[a-z0-9_-]{2,}(\.[a-z0-9_-]{2,}){2,}(:[0-9]+)?(\/\S+)*)/i; + +Xinha.Config = function() +{ + var cfg = this; + this.version = Xinha.version.Revision; + + // Width and Height + // you may set these as follows + // width = 'auto' -- the width of the original textarea will be used + // width = 'toolbar' -- the width of the toolbar will be used + // width = '' -- use any css measurement, eg width = '75%' + // + // height = 'auto' -- the height of the original textarea + // height = '' -- any css measurement, eg height = '480px' + this.width = "auto"; + this.height = "auto"; + + // the next parameter specifies whether the toolbar should be included + // in the size above, or are extra to it. If false then it's recommended + // to have explicit pixel sizes above (or on your textarea and have auto above) + this.sizeIncludesBars = true; + + // the next parameter specifies whether the panels should be included + // in the size above, or are extra to it. If false then it's recommended + // to have explicit pixel sizes above (or on your textarea and have auto above) + this.sizeIncludesPanels = true; + + // each of the panels has a dimension, for the left/right it's the width + // for the top/bottom it's the height. + // + // WARNING: PANEL DIMENSIONS MUST BE SPECIFIED AS PIXEL WIDTHS + this.panel_dimensions = + { + left: '200px', // Width + right: '200px', + top: '100px', // Height + bottom: '100px' + }; + + // enable creation of a status bar? + this.statusBar = true; + + // intercept ^V and use the Xinha paste command + // If false, then passes ^V through to browser editor widget + this.htmlareaPaste = false; + + this.mozParaHandler = 'best'; // set to 'built-in', 'dirty' or 'best' + // built-in: will (may) use 'br' instead of 'p' tags + // dirty : will use p and work good enough for the majority of cases, + // best : works the best, but it's about 12kb worth of javascript + // and will probably be slower than 'dirty'. This is the "EnterParagraphs" + // plugin from "hipikat", rolled in to be part of the core code + + + // possible values + // 'DOMwalk' (the "original") + // 'TransformInnerHTML' (this used to be the GetHtml plugin) + this.getHtmlMethod = 'DOMwalk'; + + // maximum size of the undo queue + this.undoSteps = 20; + + // the time interval at which undo samples are taken + this.undoTimeout = 500; // 1/2 sec. + + // set this to true if you want to explicitly right-justify when + // setting the text direction to right-to-left + this.changeJustifyWithDirection = false; + + // if true then Xinha will retrieve the full HTML, starting with the + // tag. + this.fullPage = false; + + // style included in the iframe document + this.pageStyle = ""; + + // external stylesheets to load (REFERENCE THESE ABSOLUTELY) + this.pageStyleSheets = []; + + // specify a base href for relative links + this.baseHref = null; + + // when the editor is in different directory depth as the edited page relative image sources + // will break the display of your images + // this fixes an issue where Mozilla converts the urls of images and links that are on the same server + // to relative ones (../) when dragging them around in the editor (Ticket #448) + this.expandRelativeUrl = true; + + // we can strip the base href out of relative links to leave them relative, reason for this + // especially if you don't specify a baseHref is that mozilla at least (& IE ?) will prefix + // the baseHref to any relative links to make them absolute, which isn't what you want most the time. + this.stripBaseHref = true; + + // and we can strip the url of the editor page from named links (eg ...) + // reason for this is that mozilla at least (and IE ?) prefixes location.href to any + // that don't have a url prefixing them + this.stripSelfNamedAnchors = true; + + // sometimes high-ascii in links can cause problems for servers (basically they don't recognise them) + // so you can use this flag to ensure that all characters other than the normal ascii set (actually + // only ! through ~) are escaped in URLs to % codes + this.only7BitPrintablesInURLs = true; + + // if you are putting the HTML written in Xinha into an email you might want it to be 7-bit + // characters only. This config option (off by default) will convert all characters consuming + // more than 7bits into UNICODE decimal entity references (actually it will convert anything + // below (chr 20) except cr, lf and tab and above (~, chr 7E)) + this.sevenBitClean = false; + + // sometimes we want to be able to replace some string in the html comng in and going out + // so that in the editor we use the "internal" string, and outside and in the source view + // we use the "external" string this is useful for say making special codes for + // your absolute links, your external string might be some special code, say "{server_url}" + // an you say that the internal represenattion of that should be http://your.server/ + this.specialReplacements = {}; // { 'external_string' : 'internal_string' } + + // set to true if you want Word code to be cleaned upon Paste + this.killWordOnPaste = true; + + // enable the 'Target' field in the Make Link dialog + this.makeLinkShowsTarget = true; + + // CharSet of the iframe, default is the charset of the document + this.charSet = Xinha.is_gecko ? document.characterSet : document.charset; + + // URL-s + this.imgURL = "images/"; + this.popupURL = "popups/"; + + // remove tags (these have to be a regexp, or null if this functionality is not desired) + this.htmlRemoveTags = null; + + // Turning this on will turn all "linebreak" and "separator" items in your toolbar into soft-breaks, + // this means that if the items between that item and the next linebreak/separator can + // fit on the same line as that which came before then they will, otherwise they will + // float down to the next line. + + // If you put a linebreak and separator next to each other, only the separator will + // take effect, this allows you to have one toolbar that works for both flowToolbars = true and false + // infact the toolbar below has been designed in this way, if flowToolbars is false then it will + // create explictly two lines (plus any others made by plugins) breaking at justifyleft, however if + // flowToolbars is false and your window is narrow enough then it will create more than one line + // even neater, if you resize the window the toolbars will reflow. Niiiice. + + this.flowToolbars = true; + + // set to true if you want the loading panel to show at startup + this.showLoading = false; + + // set to false if you want to allow JavaScript in the content, otherwise "); - } - return false; -}; - -HTMLArea._pluginLoadStatus = { }; -HTMLArea.loadPlugins = function(plugins, callbackIfNotReady) -{ - // Rip the ones that are loaded and look for ones that have failed - var retVal = true; - var nuPlugins = HTMLArea.cloneObject(plugins); - while(nuPlugins.length) - { - var p = nuPlugins.pop(); - if(typeof HTMLArea._pluginLoadStatus[p] == 'undefined') - { - // Load it - HTMLArea._pluginLoadStatus[p] = 'loading'; - HTMLArea.loadPlugin(p, - function(plugin) - { - if(eval('typeof ' + plugin) != 'undefined') - { - HTMLArea._pluginLoadStatus[plugin] = 'ready'; - } - else - { - // Actually, this won't happen, because if the script fails - // it will throw an exception preventing the callback from - // running. This will leave it always in the "loading" state - // unfortunatly that means we can't fail plugins gracefully - // by just skipping them. - HTMLArea._pluginLoadStatus[plugin] = 'failed'; - } - } - ); - retVal = false; - } - else - { - switch(HTMLArea._pluginLoadStatus[p]) - { - case 'failed': - case 'ready' : - break; - - case 'loading': - default : - retVal = false; - break; - } - } - } - - if(retVal) return true; // All done, just return - - // Waiting on plugins to load, return false now and come back a bit later - // if we have to callback - if(callbackIfNotReady) - { - setTimeout(function() { if(HTMLArea.loadPlugins(plugins, callbackIfNotReady)) callbackIfNotReady(); }, 150); - } - return retVal; -}; - -// refresh plugin by calling onGenerate or onGenerateOnce method. -HTMLArea.refreshPlugin = function(plugin) { - if (plugin && typeof plugin.onGenerate == "function") - plugin.onGenerate(); - if (plugin && typeof plugin.onGenerateOnce == "function") { - plugin.onGenerateOnce(); - plugin.onGenerateOnce = null; - } -}; - -HTMLArea.loadStyle = function(style, plugin) { - var url = _editor_url || ''; - if (typeof plugin != "undefined") { - url += "plugins/" + plugin + "/"; - } - url += style; - if (/^\//.test(style)) - url = style; - var head = document.getElementsByTagName("head")[0]; - var link = document.createElement("link"); - link.rel = "stylesheet"; - link.href = url; - head.appendChild(link); - //document.write(""); -}; -HTMLArea.loadStyle(typeof _editor_css == "string" ? _editor_css : "htmlarea.css"); - -/*************************************************** - * Category: EDITOR UTILITIES - ***************************************************/ - -HTMLArea.prototype.debugTree = function() { - var ta = document.createElement("textarea"); - ta.style.width = "100%"; - ta.style.height = "20em"; - ta.value = ""; - function debug(indent, str) { - for (; --indent >= 0;) - ta.value += " "; - ta.value += str + "\n"; - } - function _dt(root, level) { - var tag = root.tagName.toLowerCase(), i; - var ns = HTMLArea.is_ie ? root.scopeName : root.prefix; - debug(level, "- " + tag + " [" + ns + "]"); - for (i = root.firstChild; i; i = i.nextSibling) - if (i.nodeType == 1) - _dt(i, level + 2); - } - _dt(this._doc.body, 0); - document.body.appendChild(ta); -}; - -HTMLArea.getInnerText = function(el) { - var txt = '', i; - for (i = el.firstChild; i; i = i.nextSibling) { - if (i.nodeType == 3) - txt += i.data; - else if (i.nodeType == 1) - txt += HTMLArea.getInnerText(i); - } - return txt; -}; - -HTMLArea.prototype._wordClean = function() { - var - editor = this, - stats = { - empty_tags : 0, - mso_class : 0, - mso_style : 0, - mso_xmlel : 0, - orig_len : this._doc.body.innerHTML.length, - T : (new Date()).getTime() - }, - stats_txt = { - empty_tags : "Empty tags removed: ", - mso_class : "MSO class names removed: ", - mso_style : "MSO inline style removed: ", - mso_xmlel : "MSO XML elements stripped: " - }; - function showStats() { - var txt = "HTMLArea word cleaner stats: \n\n"; - for (var i in stats) - if (stats_txt[i]) - txt += stats_txt[i] + stats[i] + "\n"; - txt += "\nInitial document length: " + stats.orig_len + "\n"; - txt += "Final document length: " + editor._doc.body.innerHTML.length + "\n"; - txt += "Clean-up took " + (((new Date()).getTime() - stats.T) / 1000) + " seconds"; - alert(txt); - } - function clearClass(node) { - var newc = node.className.replace(/(^|\s)mso.*?(\s|$)/ig, ' '); - if (newc != node.className) { - node.className = newc; - if (!/\S/.test(node.className)) { - node.removeAttribute("className"); - ++stats.mso_class; - } - } - } - function clearStyle(node) { - var declarations = node.style.cssText.split(/\s*;\s*/); - for (var i = declarations.length; --i >= 0;) - if (/^mso|^tab-stops/i.test(declarations[i]) || - /^margin\s*:\s*0..\s+0..\s+0../i.test(declarations[i])) { - ++stats.mso_style; - declarations.splice(i, 1); - } - node.style.cssText = declarations.join("; "); - } - if (HTMLArea.is_ie) - { - function stripTag(el) - { - el.outerHTML = HTMLArea.htmlEncode(el.innerText); - ++stats.mso_xmlel; - } - } - else - { - function stripTag(el) - { - var txt = document.createTextNode(HTMLArea.getInnerText(el)); - el.parentNode.insertBefore(txt, el); - HTMLArea.removeFromParent(el); - ++stats.mso_xmlel; - } - } - function checkEmpty(el) { - if (/^(a|span|b|strong|i|em|font)$/i.test(el.tagName) && - !el.firstChild) { - HTMLArea.removeFromParent(el); - ++stats.empty_tags; - } - } - function parseTree(root) { - var tag = root.tagName.toLowerCase(), i, next; - if ((HTMLArea.is_ie && root.scopeName != 'HTML') || (!HTMLArea.is_ie && /:/.test(tag))) { - stripTag(root); - return false; - } else { - clearClass(root); - clearStyle(root); - for (i = root.firstChild; i; i = next) { - next = i.nextSibling; - if (i.nodeType == 1 && parseTree(i)) - checkEmpty(i); - } - } - return true; - } - parseTree(this._doc.body); - // showStats(); - // this.debugTree(); - // this.setHTML(this.getHTML()); - // this.setHTML(this.getInnerHTML()); - // this.forceRedraw(); - this.updateToolbar(); -}; - -HTMLArea.prototype._clearFonts = function() { - var D = this.getInnerHTML(); - - if(confirm(HTMLArea._lc("Would you like to clear font typefaces?"))) - { - D = D.replace(/face="[^"]*"/gi, ''); - D = D.replace(/font-family:[^;}"']+;?/gi, ''); - } - - if(confirm(HTMLArea._lc("Would you like to clear font sizes?"))) - { - D = D.replace(/size="[^"]*"/gi, ''); - D = D.replace(/font-size:[^;}"']+;?/gi, ''); - } - - if(confirm(HTMLArea._lc("Would you like to clear font colours?"))) - { - D = D.replace(/color="[^"]*"/gi, ''); - D = D.replace(/([^-])color:[^;}"']+;?/gi, '$1'); - } - - D = D.replace(/(style|class)="\s*"/gi, ''); - D = D.replace(/<(font|span)\s*>/gi, ''); - this.setHTML(D); - this.updateToolbar(); -}; - -HTMLArea.prototype._splitBlock = function() -{ - this._doc.execCommand('formatblock', false, 'div'); -}; - -HTMLArea.prototype.forceRedraw = function() { - this._doc.body.style.visibility = "hidden"; - this._doc.body.style.visibility = "visible"; - // this._doc.body.innerHTML = this.getInnerHTML(); -}; - -// focuses the iframe window. returns a reference to the editor document. -HTMLArea.prototype.focusEditor = function() { - switch (this._editMode) { - // notice the try { ... } catch block to avoid some rare exceptions in FireFox - // (perhaps also in other Gecko browsers). Manual focus by user is required in - // case of an error. Somebody has an idea? - case "wysiwyg" : - try - { - // We don't want to focus the field unless at least one field has been activated. - if(HTMLArea._someEditorHasBeenActivated) - { - this.activateEditor(); // Ensure *this* editor is activated - this._iframe.contentWindow.focus(); // and focus it - } - } catch (e) {} break; - case "textmode": try { this._textArea.focus() } catch (e) {} break; - default : alert("ERROR: mode " + this._editMode + " is not defined"); - } - return this._doc; -}; - -// takes a snapshot of the current text (for undo) -HTMLArea.prototype._undoTakeSnapshot = function() { - ++this._undoPos; - if (this._undoPos >= this.config.undoSteps) { - // remove the first element - this._undoQueue.shift(); - --this._undoPos; - } - // use the fasted method (getInnerHTML); - var take = true; - var txt = this.getInnerHTML(); - if (this._undoPos > 0) - take = (this._undoQueue[this._undoPos - 1] != txt); - if (take) { - this._undoQueue[this._undoPos] = txt; - } else { - this._undoPos--; - } -}; - -HTMLArea.prototype.undo = function() { - if (this._undoPos > 0) { - var txt = this._undoQueue[--this._undoPos]; - if (txt) this.setHTML(txt); - else ++this._undoPos; - } -}; - -HTMLArea.prototype.redo = function() { - if (this._undoPos < this._undoQueue.length - 1) { - var txt = this._undoQueue[++this._undoPos]; - if (txt) this.setHTML(txt); - else --this._undoPos; - } -}; - -HTMLArea.prototype.disableToolbar = function(except) -{ - if(this._timerToolbar) clearTimeout(this._timerToolbar); - if(typeof except == 'undefined') - { - except = [ ]; - } - else if(typeof except != 'object') - { - except = [except]; - } - - for (var i in this._toolbarObjects) - { - var btn = this._toolbarObjects[i]; - if(except.contains(i)) - { - continue; - } - if (typeof(btn.state) != 'function') continue; // prevent iterating over wrong type - btn.state("enabled", false); - } -}; - -HTMLArea.prototype.enableToolbar = function() -{ - this.updateToolbar(); -}; - -if(!Array.prototype.contains) -{ - Array.prototype.contains = function(needle) - { - var haystack = this; - for(var i = 0; i < haystack.length; i++) - { - if(needle == haystack[i]) return true; - } - - return false; - }; -} - -if(!Array.prototype.indexOf) -{ - Array.prototype.indexOf = function(needle) - { - var haystack = this; - for(var i = 0; i < haystack.length; i++) - { - if(needle == haystack[i]) return i; - } - - return null; - }; -} - - -// updates enabled/disable/active state of the toolbar elements -HTMLArea.prototype.updateToolbar = function(noStatus) { - var doc = this._doc; - var text = (this._editMode == "textmode"); - var ancestors = null; - if (!text) { - ancestors = this.getAllAncestors(); - if (this.config.statusBar && !noStatus) { - this._statusBarTree.innerHTML = HTMLArea._lc("Path") + ": "; // clear - for (var i = ancestors.length; --i >= 0;) { - var el = ancestors[i]; - if (!el) { - // hell knows why we get here; this - // could be a classic example of why - // it's good to check for conditions - // that are impossible to happen ;-) - continue; - } - var a = document.createElement("a"); - a.href = "javascript:void(0)"; - a.el = el; - a.editor = this; - HTMLArea.addDom0Event(a, 'click', function() { - this.blur(); - this.editor.selectNodeContents(this.el); - this.editor.updateToolbar(true); - return false; - }); - HTMLArea.addDom0Event(a, 'contextmenu', function() { - // TODO: add context menu here - this.blur(); - var info = "Inline style:\n\n"; - info += this.el.style.cssText.split(/;\s*/).join(";\n"); - alert(info); - return false; - }); - var txt = el.tagName.toLowerCase(); - a.title = el.style.cssText; - if (el.id) { - txt += "#" + el.id; - } - if (el.className) { - txt += "." + el.className; - } - a.appendChild(document.createTextNode(txt)); - this._statusBarTree.appendChild(a); - if (i != 0) { - this._statusBarTree.appendChild(document.createTextNode(String.fromCharCode(0xbb))); - } - } - } - } - - for (var i in this._toolbarObjects) { - var btn = this._toolbarObjects[i]; - var cmd = i; - var inContext = true; - if (typeof(btn.state) != 'function') continue; // prevent iterating over wrong type - if (btn.context && !text) { - inContext = false; - var context = btn.context; - var attrs = []; - if (/(.*)\[(.*?)\]/.test(context)) { - context = RegExp.$1; - attrs = RegExp.$2.split(","); - } - context = context.toLowerCase(); - var match = (context == "*"); - for (var k = 0; k < ancestors.length; ++k) { - if (!ancestors[k]) { - // the impossible really happens. - continue; - } - if (match || (ancestors[k].tagName.toLowerCase() == context)) { - inContext = true; - for (var ka = 0; ka < attrs.length; ++ka) { - if (!eval("ancestors[k]." + attrs[ka])) { - inContext = false; - break; - } - } - if (inContext) { - break; - } - } - } - } - btn.state("enabled", (!text || btn.text) && inContext); - if (typeof cmd == "function") { - continue; - } - // look-it-up in the custom dropdown boxes - var dropdown = this.config.customSelects[cmd]; - if ((!text || btn.text) && (typeof dropdown != "undefined")) { - dropdown.refresh(this); - continue; - } - switch (cmd) - { - case "fontname": - case "fontsize": - { - if (!text) try { - var value = ("" + doc.queryCommandValue(cmd)).toLowerCase(); - if (!value) { - btn.element.selectedIndex = 0; - break; - } - - // HACK -- retrieve the config option for this - // combo box. We rely on the fact that the - // variable in config has the same name as - // button name in the toolbar. - var options = this.config[cmd]; - var k = 0; - for (var j in options) - { - // FIXME: the following line is scary. - if ((j.toLowerCase() == value) || (options[j].substr(0, value.length).toLowerCase() == value)) - { - btn.element.selectedIndex = k; - throw "ok"; - } - ++k; - } - btn.element.selectedIndex = 0; - } catch(e) {}; - } - break; - - // It's better to search for the format block by tag name from the - // current selection upwards, because IE has a tendancy to return - // things like 'heading 1' for 'h1', which breaks things if you want - // to call your heading blocks 'header 1'. Stupid MS. - case "formatblock" : - { - var blocks = [ ]; - for(var i in this.config['formatblock']) - { - if (typeof(this.config['formatblock'][i]) == 'string') // prevent iterating over wrong type - { - blocks[blocks.length] = this.config['formatblock'][i]; - } - } - - var deepestAncestor = this._getFirstAncestor(this._getSelection(), blocks); - if(deepestAncestor) - { - for(var x= 0; x < blocks.length; x++) - { - if(blocks[x].toLowerCase() == deepestAncestor.tagName.toLowerCase()) - { - btn.element.selectedIndex = x; - } - } - } - else - { - btn.element.selectedIndex = 0; - } - } - break; - - case "textindicator": - if (!text) { - try {with (btn.element.style) { - backgroundColor = HTMLArea._makeColor( - doc.queryCommandValue(HTMLArea.is_ie ? "backcolor" : "hilitecolor")); - if (/transparent/i.test(backgroundColor)) { - // Mozilla - backgroundColor = HTMLArea._makeColor(doc.queryCommandValue("backcolor")); - } - color = HTMLArea._makeColor(doc.queryCommandValue("forecolor")); - fontFamily = doc.queryCommandValue("fontname"); - fontWeight = doc.queryCommandState("bold") ? "bold" : "normal"; - fontStyle = doc.queryCommandState("italic") ? "italic" : "normal"; - }} catch (e) { - // alert(e + "\n\n" + cmd); - } - } - break; - case "htmlmode": btn.state("active", text); break; - case "lefttoright": - case "righttoleft": - var el = this.getParentElement(); - while (el && !HTMLArea.isBlockElement(el)) - el = el.parentNode; - if (el) - btn.state("active", (el.style.direction == ((cmd == "righttoleft") ? "rtl" : "ltr"))); - break; - default: - cmd = cmd.replace(/(un)?orderedlist/i, "insert$1orderedlist"); - try { - btn.state("active", (!text && doc.queryCommandState(cmd))); - } catch (e) {} - } - } - // take undo snapshots - if (this._customUndo && !this._timerUndo) { - this._undoTakeSnapshot(); - var editor = this; - this._timerUndo = setTimeout(function() { - editor._timerUndo = null; - }, this.config.undoTimeout); - } - - // Insert a space in certain locations, this is just to make editing a little - // easier (to "get out of" tags), it's not essential. - // TODO: Make this work for IE? - // TODO: Perhaps should use a plain space character, I'm not sure. - // OK, I've disabled this temporarily, to be honest, I can't rightly remember what the - // original problem was I was trying to solve with it. I think perhaps that EnterParagraphs - // might solve the problem, whatever the hell it was. I'm going senile, I'm sure. - if(0 && HTMLArea.is_gecko) - { - var s = this._getSelection(); - // If the last character in the last text node of the parent tag - // and the parent tag is not a block tag - if(s && s.isCollapsed && s.anchorNode - && s.anchorNode.parentNode.tagName.toLowerCase() != 'body' - && s.anchorNode.nodeType == 3 && s.anchorOffset == s.anchorNode.length - && ! - ( s.anchorNode.parentNode.nextSibling - && s.anchorNode.parentNode.nextSibling.nodeType == 3 - ) - && !HTMLArea.isBlockElement(s.anchorNode.parentNode) - ) - { - // Insert hair-width-space after the close tag if there isn't another text node on the other side - // It could also work with zero-width-space (\u200B) but I don't like it so much. - // Perhaps this won't work well in various character sets and we should use plain space (20)? - try - { - s.anchorNode.parentNode.parentNode.insertBefore - (this._doc.createTextNode('\t'), s.anchorNode.parentNode.nextSibling); - } - catch(e) - { - // Disregard - } - } - } - - // check if any plugins have registered refresh handlers - for (var i in this.plugins) { - var plugin = this.plugins[i].instance; - if (plugin && typeof plugin.onUpdateToolbar == "function") - plugin.onUpdateToolbar(); - } - - -}; - -/** Returns a node after which we can insert other nodes, in the current - * selection. The selection is removed. It splits a text node, if needed. - */ -if (!HTMLArea.is_ie) -{ - HTMLArea.prototype.insertNodeAtSelection = function(toBeInserted) - { - var sel = this._getSelection(); - var range = this._createRange(sel); - // remove the current selection - sel.removeAllRanges(); - range.deleteContents(); - var node = range.startContainer; - var pos = range.startOffset; - switch (node.nodeType) - { - case 3: // Node.TEXT_NODE - // we have to split it at the caret position. - if (toBeInserted.nodeType == 3) - { - // do optimized insertion - node.insertData(pos, toBeInserted.data); - range = this._createRange(); - range.setEnd(node, pos + toBeInserted.length); - range.setStart(node, pos + toBeInserted.length); - sel.addRange(range); - } - else - { - node = node.splitText(pos); - var selnode = toBeInserted; - if (toBeInserted.nodeType == 11 /* Node.DOCUMENT_FRAGMENT_NODE */) - { - selnode = selnode.firstChild; - } - node.parentNode.insertBefore(toBeInserted, node); - this.selectNodeContents(selnode); - this.updateToolbar(); - } - break; - case 1: // Node.ELEMENT_NODE - var selnode = toBeInserted; - if (toBeInserted.nodeType == 11 /* Node.DOCUMENT_FRAGMENT_NODE */) - { - selnode = selnode.firstChild; - } - node.insertBefore(toBeInserted, node.childNodes[pos]); - this.selectNodeContents(selnode); - this.updateToolbar(); - break; - } - }; -} else { - HTMLArea.prototype.insertNodeAtSelection = function(toBeInserted) - { - return null; // this function not yet used for IE - }; + alert("WARNING: _editor_url is not set! You should set this variable to the editor files path; it should preferably be an absolute path, like in '/htmlarea/', but it can be relative if you prefer. Further we will try to load the editor files correctly but we'll probably fail."); + _editor_url = ''; } -// Returns the deepest node that contains both endpoints of the selection. -if (HTMLArea.is_ie) -{ - HTMLArea.prototype.getParentElement = function(sel) - { - if(typeof sel == 'undefined') - { - sel = this._getSelection(); - } - var range = this._createRange(sel); - switch (sel.type) - { - case "Text": - // try to circumvent a bug in IE: - // the parent returned is not always the real parent element - var parent = range.parentElement(); - while (true) - { - var TestRange = range.duplicate(); - TestRange.moveToElementText(parent); - if (TestRange.inRange(range)) - { - break; - } - if ((parent.nodeType != 1) || (parent.tagName.toLowerCase() == 'body')) - { - break; - } - parent = parent.parentElement; - } - return parent; - case "None": - // It seems that even for selection of type "None", - // there _is_ a parent element and it's value is not - // only correct, but very important to us. MSIE is - // certainly the buggiest browser in the world and I - // wonder, God, how can Earth stand it? - return range.parentElement(); - case "Control": - return range.item(0); - default: - return this._doc.body; - } - }; -} -else -{ - HTMLArea.prototype.getParentElement = function(sel) - { - if(typeof sel == 'undefined') - { - sel = this._getSelection(); - } - var range = this._createRange(sel); - try - { - var p = range.commonAncestorContainer; - if (!range.collapsed && range.startContainer == range.endContainer && - range.startOffset - range.endOffset <= 1 && range.startContainer.hasChildNodes()) - { - p = range.startContainer.childNodes[range.startOffset]; - } - /* - alert(range.startContainer + ":" + range.startOffset + "\n" + - range.endContainer + ":" + range.endOffset); - */ - while (p.nodeType == 3) - { - p = p.parentNode; - } - return p; - } - catch (e) - { - return null; - } - }; -} - -// Returns an array with all the ancestor nodes of the selection. -HTMLArea.prototype.getAllAncestors = function() { - var p = this.getParentElement(); - var a = []; - while (p && (p.nodeType == 1) && (p.tagName.toLowerCase() != 'body')) { - a.push(p); - p = p.parentNode; - } - a.push(this._doc.body); - return a; -}; - -// Returns the deepest ancestor of the selection that is of the current type -HTMLArea.prototype._getFirstAncestor = function(sel, types) -{ - var prnt = this._activeElement(sel); - if(prnt == null) - { - try - { - prnt = (HTMLArea.is_ie ? this._createRange(sel).parentElement() : this._createRange(sel).commonAncestorContainer); - } - catch(e) - { - return null; - } - } - - if(typeof types == 'string') - { - types = [types]; - } - - while(prnt) - { - if(prnt.nodeType == 1) - { - if(types == null) return prnt; - if(types.contains(prnt.tagName.toLowerCase())) - { - - return prnt; - } - if(prnt.tagName.toLowerCase() == 'body') break; - if(prnt.tagName.toLowerCase() == 'table') break; - } - prnt = prnt.parentNode; - } - - return null; -}; - -/** - * Returns the selected element, if any. That is, - * the element that you have last selected in the "path" - * at the bottom of the editor, or a "control" (eg image) - * - * @returns null | element - */ -if(HTMLArea.is_ie) -{ - HTMLArea.prototype._activeElement = function(sel) - { - if((sel == null) || this._selectionEmpty(sel)) - { - return null; - } - - if(sel.type.toLowerCase() == "control") - { - return sel.createRange().item(0); - } - else - { - // If it's not a control, then we need to see if - // the selection is the _entire_ text of a parent node - // (this happens when a node is clicked in the tree) - var range = sel.createRange(); - var p_elm = this.getParentElement(sel); - if(p_elm.innerHTML == range.htmlText) - { - return p_elm; - } - /* - if(p_elm) - { - var p_rng = this._doc.body.createTextRange(); - p_rng.moveToElementText(p_elm); - if(p_rng.isEqual(range)) - { - return p_elm; - } - } - - if(range.parentElement()) - { - var prnt_range = this._doc.body.createTextRange(); - prnt_range.moveToElementText(range.parentElement()); - if(prnt_range.isEqual(range)) - { - return range.parentElement(); - } - } - */ - return null; - } - }; -} -else -{ - HTMLArea.prototype._activeElement = function(sel) - { - if((sel == null) || this._selectionEmpty(sel)) - { - return null; - } - - // For Mozilla we just see if the selection is not collapsed (something is selected) - // and that the anchor (start of selection) is an element. This might not be totally - // correct, we possibly should do a simlar check to IE? - if(! sel.isCollapsed) - { - if(sel.anchorNode.childNodes.length > sel.anchorOffset && sel.anchorNode.childNodes[sel.anchorOffset].nodeType == 1) - { - return sel.anchorNode.childNodes[sel.anchorOffset]; - } - else if(sel.anchorNode.nodeType == 1) - { - return sel.anchorNode; - } - else - { - return sel.anchorNode.parentNode; - } - } - return null; - }; -} - -if(HTMLArea.is_ie) -{ - HTMLArea.prototype._selectionEmpty = function(sel) - { - if(!sel) - { - return true; - } - - return this._createRange(sel).htmlText == ''; - }; -} -else -{ - HTMLArea.prototype._selectionEmpty = function(sel) - { - if(!sel) - { - return true; - } - - if(typeof sel.isCollapsed != 'undefined') - { - return sel.isCollapsed; - } - - return true; - }; -} - -HTMLArea.prototype._getAncestorBlock = function(sel) -{ - // Scan upwards to find a block level element that we can change or apply to - var prnt = (HTMLArea.is_ie ? this._createRange(sel).parentElement : this._createRange(sel).commonAncestorContainer); - - while(prnt && (prnt.nodeType == 1)) - { - switch(prnt.tagName.toLowerCase()) - { - case 'div' : - case 'p' : - case 'address' : - case 'blockquote' : - case 'center' : - case 'del' : - case 'ins' : - case 'pre' : - case 'h1' : - case 'h2' : - case 'h3' : - case 'h4' : - case 'h5' : - case 'h6' : - case 'h7' : - // Block Element - return prnt; - - case 'body' : - case 'noframes' : - case 'dd' : - case 'li' : - case 'th' : - case 'td' : - case 'noscript' : - // Halting element (stop searching) - return null; - - default : - // Keep lookin - break; - } - } - - return null; -}; - -HTMLArea.prototype._createImplicitBlock = function(type) -{ - // expand it until we reach a block element in either direction - // then wrap the selection in a block and return - var sel = this._getSelection(); - if(HTMLArea.is_ie) - { - sel.empty(); - } - else - { - sel.collapseToStart(); - } - - var rng = this._createRange(sel); - - // Expand UP - - // Expand DN -}; - -HTMLArea.prototype._formatBlock = function(block_format) -{ - var ancestors = this.getAllAncestors(); - var apply_to = null; - - // Block format can be a tag followed with class defs - // eg div.blue.left - var target_tag = null; - var target_classNames = [ ]; - - if(block_format.indexOf('.') >= 0) - { - target_tag = block_format.substr(0, block_format.indexOf('.')).toLowerCase();; - - target_classNames = block_format.substr(block_format.indexOf('.'), block_format.length - block_format.indexOf('.')).replace(/\./g, '').replace(/^\s*/, '').replace(/\s*$/, '').split(' '); - } - else - { - target_tag = block_format.toLowerCase(); - } - - var sel = this._getSelection(); - var rng = this._createRange(sel); - var apply_to = null; - - if(HTMLArea.is_gecko) - { - if(sel.isCollapsed) - { - // With no selection we want to apply to the whole contents of the ancestor block - apply_to = this._getAncestorBlock(sel); - if(apply_to == null) - { - // If there wasn't an ancestor, make one. - apply_to = this._createImplicitBlock(sel, target_tag); - } - } - else - { - // With a selection it's more tricky - switch(target_tag) - { - - case 'h1' : - case 'h2' : - case 'h3' : - case 'h4' : - case 'h5' : - case 'h6' : - case 'h7' : - apply_to = [ ]; - var search_tags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'h7']; - for(var y = 0; y < search_tags.length; y++) - { - var headers = this._doc.getElementsByTagName(search_tag[y]); - for(var x = 0; x < headers.length; x++) - { - if(sel.containsNode(headers[x])) - { - apply_to[apply_to.length] = headers[x]; - } - } - } - if(apply_to.length > 0) break; - // If there wern't any in the selection drop through - case 'div' : - apply_to = this._doc.createElement(target_tag); - apply_to.appendChild(rng.extractContents()); - rng.insertNode(apply_to); - break; - - case 'p' : - case 'center' : - case 'pre' : - case 'ins' : - case 'del' : - case 'blockquote' : - case 'address' : - apply_to = [ ]; - var paras = this._doc.getElementsByTagName(target_tag); - for(var x = 0; x < paras.length; x++) - { - if(sel.containsNode(paras[x])) - { - apply_to[apply_to.length] = paras[x]; - } - } - - if(apply_to.length == 0) - { - sel.collapseToStart(); - return this._formatBlock(block_format); - } - break; - } - } - } - -}; - -// Selects the contents inside the given node -if (HTMLArea.is_ie) -{ - HTMLArea.prototype.selectNodeContents = function(node, pos) - { - this.focusEditor(); - this.forceRedraw(); - var range; - var collapsed = typeof pos == "undefined" ? true : false; - // Tables and Images get selected as "objects" rather than the text contents - if(collapsed && node.tagName && node.tagName.toLowerCase().match(/table|img|input|select|textarea/)) - { - range = this._doc.body.createControlRange(); - range.add(node); - } - else - { - range = this._doc.body.createTextRange(); - range.moveToElementText(node); - //(collapsed) && range.collapse(pos); - } - range.select(); - }; -} -else -{ - HTMLArea.prototype.selectNodeContents = function(node, pos) - { - this.focusEditor(); - this.forceRedraw(); - var range; - var collapsed = typeof pos == "undefined" ? true : false; - var sel = this._getSelection(); - range = this._doc.createRange(); - // Tables and Images get selected as "objects" rather than the text contents - if(collapsed && node.tagName && node.tagName.toLowerCase().match(/table|img|input|textarea|select/)) - { - range.selectNode(node); - } - else - { - range.selectNodeContents(node); - //(collapsed) && range.collapse(pos); - } - sel.removeAllRanges(); - sel.addRange(range); - }; -} - -/** Call this function to insert HTML code at the current position. It deletes - * the selection, if any. - */ -if (HTMLArea.is_ie) -{ - HTMLArea.prototype.insertHTML = function(html) - { - var sel = this._getSelection(); - var range = this._createRange(sel); - this.focusEditor(); - range.pasteHTML(html); - }; -} -else -{ - HTMLArea.prototype.insertHTML = function(html) - { - var sel = this._getSelection(); - var range = this._createRange(sel); - this.focusEditor(); - // construct a new document fragment with the given HTML - var fragment = this._doc.createDocumentFragment(); - var div = this._doc.createElement("div"); - div.innerHTML = html; - while (div.firstChild) - { - // the following call also removes the node from div - fragment.appendChild(div.firstChild); - } - // this also removes the selection - var node = this.insertNodeAtSelection(fragment); - }; -} - -/** - * Call this function to surround the existing HTML code in the selection with - * your tags. FIXME: buggy! This function will be deprecated "soon". - */ -HTMLArea.prototype.surroundHTML = function(startTag, endTag) { - var html = this.getSelectedHTML(); - // the following also deletes the selection - this.insertHTML(startTag + html + endTag); -}; - -/// Retrieve the selected block -if (HTMLArea.is_ie) -{ - HTMLArea.prototype.getSelectedHTML = function() - { - var sel = this._getSelection(); - var range = this._createRange(sel); - return range.htmlText; - }; -} -else -{ - HTMLArea.prototype.getSelectedHTML = function() - { - var sel = this._getSelection(); - var range = this._createRange(sel); - return HTMLArea.getHTML(range.cloneContents(), false, this); - }; -} - -/// Return true if we have some selection -HTMLArea.prototype.hasSelectedText = function() { - // FIXME: come _on_ mishoo, you can do better than this ;-) - return this.getSelectedHTML() != ''; -}; - -HTMLArea.prototype._createLink = function(link) { - var editor = this; - var outparam = null; - if (typeof link == "undefined") { - link = this.getParentElement(); - if (link) { - while (link && !/^a$/i.test(link.tagName)) - link = link.parentNode; - } - } - if (!link) { - var sel = editor._getSelection(); - var range = editor._createRange(sel); - var compare = 0; - if (HTMLArea.is_ie) { - if(sel.type == "Control") - { - compare = range.length; - } - else - { - compare = range.compareEndPoints("StartToEnd", range); - } - } else { - compare = range.compareBoundaryPoints(range.START_TO_END, range); - } - if (compare == 0) { - alert(HTMLArea._lc("You need to select some text before creating a link")); - return; - } - outparam = { - f_href : '', - f_title : '', - f_target : '', - f_usetarget : editor.config.makeLinkShowsTarget - }; - } else - outparam = { - f_href : HTMLArea.is_ie ? editor.stripBaseURL(link.href) : link.getAttribute("href"), - f_title : link.title, - f_target : link.target, - f_usetarget : editor.config.makeLinkShowsTarget - }; - this._popupDialog(editor.config.URIs["link"], function(param) { - if (!param) - return false; - var a = link; - if (!a) try { - editor._doc.execCommand("createlink", false, param.f_href); - a = editor.getParentElement(); - var sel = editor._getSelection(); - var range = editor._createRange(sel); - if (!HTMLArea.is_ie) { - a = range.startContainer; - if (!/^a$/i.test(a.tagName)) { - a = a.nextSibling; - if (a == null) - a = range.startContainer.parentNode; - } - } - } catch(e) {} - else { - var href = param.f_href.trim(); - editor.selectNodeContents(a); - if (href == "") { - editor._doc.execCommand("unlink", false, null); - editor.updateToolbar(); - return false; - } - else { - a.href = href; - } - } - if (!(a && /^a$/i.test(a.tagName))) - return false; - a.target = param.f_target.trim(); - a.title = param.f_title.trim(); - editor.selectNodeContents(a); - editor.updateToolbar(); - }, outparam); -}; - -// Called when the user clicks on "InsertImage" button. If an image is already -// there, it will just modify it's properties. -HTMLArea.prototype._insertImage = function(image) { - var editor = this; // for nested functions - var outparam = null; - if (typeof image == "undefined") { - image = this.getParentElement(); - if (image && !/^img$/i.test(image.tagName)) - image = null; - } - if (image) outparam = { - f_base : editor.config.baseHref, - f_url : HTMLArea.is_ie ? editor.stripBaseURL(image.src) : image.getAttribute("src"), - f_alt : image.alt, - f_border : image.border, - f_align : image.align, - f_vert : image.vspace, - f_horiz : image.hspace - }; - this._popupDialog(editor.config.URIs["insert_image"], function(param) { - if (!param) { // user must have pressed Cancel - return false; - } - var img = image; - if (!img) { - if (HTMLArea.is_ie) { - var sel = editor._getSelection(); - var range = editor._createRange(sel); - editor._doc.execCommand("insertimage", false, param.f_url); - img = range.parentElement(); - // wonder if this works... - if (img.tagName.toLowerCase() != "img") { - img = img.previousSibling; - } - } else { - img = document.createElement('img'); - img.src = param.f_url; - editor.insertNodeAtSelection(img); - if (!img.tagName) { - // if the cursor is at the beginning of the document - img = range.startContainer.firstChild; - } - } - } else { - img.src = param.f_url; - } - - for (var field in param) { - var value = param[field]; - switch (field) { - case "f_alt" : img.alt = value; break; - case "f_border" : img.border = parseInt(value || "0"); break; - case "f_align" : img.align = value; break; - case "f_vert" : img.vspace = parseInt(value || "0"); break; - case "f_horiz" : img.hspace = parseInt(value || "0"); break; - } - } - }, outparam); -}; - -// Called when the user clicks the Insert Table button -HTMLArea.prototype._insertTable = function() { - var sel = this._getSelection(); - var range = this._createRange(sel); - var editor = this; // for nested functions - this._popupDialog(editor.config.URIs["insert_table"], function(param) { - if (!param) { // user must have pressed Cancel - return false; - } - var doc = editor._doc; - // create the table element - var table = doc.createElement("table"); - // assign the given arguments - - for (var field in param) { - var value = param[field]; - if (!value) { - continue; - } - switch (field) { - case "f_width" : table.style.width = value + param["f_unit"]; break; - case "f_align" : table.align = value; break; - case "f_border" : table.border = parseInt(value); break; - case "f_spacing" : table.cellSpacing = parseInt(value); break; - case "f_padding" : table.cellPadding = parseInt(value); break; - } - } - var cellwidth = 0; - if (param.f_fixed) - cellwidth = Math.floor(100 / parseInt(param.f_cols)); - var tbody = doc.createElement("tbody"); - table.appendChild(tbody); - for (var i = 0; i < param["f_rows"]; ++i) { - var tr = doc.createElement("tr"); - tbody.appendChild(tr); - for (var j = 0; j < param["f_cols"]; ++j) { - var td = doc.createElement("td"); - if (cellwidth) - td.style.width = cellwidth + "%"; - tr.appendChild(td); - // Browsers like to see something inside the cell ( ). - td.appendChild(doc.createTextNode('\u00a0')); - } - } - if (HTMLArea.is_ie) { - range.pasteHTML(table.outerHTML); - } else { - // insert the table - editor.insertNodeAtSelection(table); - } - return true; - }, null); -}; - -/*************************************************** - * Category: EVENT HANDLERS - ***************************************************/ - -// el is reference to the SELECT object -// txt is the name of the select field, as in config.toolbar -HTMLArea.prototype._comboSelected = function(el, txt) { - this.focusEditor(); - var value = el.options[el.selectedIndex].value; - switch (txt) { - case "fontname": - case "fontsize": this.execCommand(txt, false, value); break; - case "formatblock": - // (HTMLArea.is_ie) && (value = "<" + value + ">"); - if(!HTMLArea.is_gecko || value !== 'blockquote') { value = "<" + value + ">";} - this.execCommand(txt, false, value); - break; - default: - // try to look it up in the registered dropdowns - var dropdown = this.config.customSelects[txt]; - if (typeof dropdown != "undefined") { - dropdown.action(this); - } else { - alert("FIXME: combo box " + txt + " not implemented"); - } - } -}; - -// the execCommand function (intercepts some commands and replaces them with -// our own implementation) -HTMLArea.prototype.execCommand = function(cmdID, UI, param) { - var editor = this; // for nested functions - this.focusEditor(); - cmdID = cmdID.toLowerCase(); - if (HTMLArea.is_gecko) try { this._doc.execCommand('useCSS', false, true); } catch (e) {}; //switch useCSS off (true=off) - switch (cmdID) { - case "htmlmode" : this.setMode(); break; - case "hilitecolor": - (HTMLArea.is_ie) && (cmdID = "backcolor"); - if (HTMLArea.is_gecko) try { editor._doc.execCommand('useCSS', false, false); } catch (e) {};//switch on useCSS (mozilla bug #279330) - case "forecolor": - this._popupDialog(editor.config.URIs["select_color"], function(color) { - if (color) { // selection not canceled - editor._doc.execCommand(cmdID, false, "#" + color); - } - }, HTMLArea._colorToRgb(this._doc.queryCommandValue(cmdID))); - break; - case "createlink": - this._createLink(); - break; - case "undo": - case "redo": - if (this._customUndo) - this[cmdID](); - else - this._doc.execCommand(cmdID, UI, param); - break; - case "inserttable": this._insertTable(); break; - case "insertimage": this._insertImage(); break; - case "about" : this._popupDialog(editor.config.URIs["about"], null, this); break; - case "showhelp" : this._popupDialog(editor.config.URIs["help"], null, this); break; - - case "killword": this._wordClean(); break; - - case "cut": - case "copy": - case "paste": - try { - this._doc.execCommand(cmdID, UI, param); - if (this.config.killWordOnPaste) - this._wordClean(); - } catch (e) { - if (HTMLArea.is_gecko) { - alert(HTMLArea._lc("The Paste button does not work in Mozilla based web browsers (technical security reasons). Press CTRL-V on your keyboard to paste directly.")); - } - } - break; - case "lefttoright": - case "righttoleft": - var dir = (cmdID == "righttoleft") ? "rtl" : "ltr"; - var el = this.getParentElement(); - while (el && !HTMLArea.isBlockElement(el)) - el = el.parentNode; - if (el) { - if (el.style.direction == dir) - el.style.direction = ""; - else - el.style.direction = dir; - } - break; - default: try { this._doc.execCommand(cmdID, UI, param); } - catch(e) { if (this.config.debug) { alert(e + "\n\nby execCommand(" + cmdID + ");"); } } - } - - this.updateToolbar(); - return false; -}; - -/** A generic event handler for things that happen in the IFRAME's document. - * This function also handles key bindings. */ -HTMLArea.prototype._editorEvent = function(ev) { - var editor = this; - var keyEvent = (HTMLArea.is_ie && ev.type == "keydown") || (!HTMLArea.is_ie && ev.type == "keypress"); - - //call events of textarea - if(typeof editor._textArea['on'+ev.type] == "function") { - editor._textArea['on'+ev.type](); - } - - if(HTMLArea.is_gecko && keyEvent && ev.ctrlKey && this._unLink && this._unlinkOnUndo) - { - if(String.fromCharCode(ev.charCode).toLowerCase() == 'z') - { - HTMLArea._stopEvent(ev); - this._unLink(); - editor.updateToolbar(); - return; - } - } - - if (keyEvent) - { - for (var i in editor.plugins) - { - var plugin = editor.plugins[i].instance; - if (plugin && typeof plugin.onKeyPress == "function") - if (plugin.onKeyPress(ev)) - return false; - } - } - - if (keyEvent && ev.ctrlKey && !ev.altKey) - { - var sel = null; - var range = null; - var key = String.fromCharCode(HTMLArea.is_ie ? ev.keyCode : ev.charCode).toLowerCase(); - var cmd = null; - var value = null; - switch (key) { - case 'a': - if (!HTMLArea.is_ie) { - // KEY select all - sel = this._getSelection(); - sel.removeAllRanges(); - range = this._createRange(); - range.selectNodeContents(this._doc.body); - sel.addRange(range); - HTMLArea._stopEvent(ev); - } - break; - - // simple key commands follow - - case 'b': cmd = "bold"; break; - case 'i': cmd = "italic"; break; - case 'u': cmd = "underline"; break; - case 's': cmd = "strikethrough"; break; - case 'l': cmd = "justifyleft"; break; - case 'e': cmd = "justifycenter"; break; - case 'r': cmd = "justifyright"; break; - case 'j': cmd = "justifyfull"; break; - case 'z': cmd = "undo"; break; - case 'y': cmd = "redo"; break; - case 'v': if (HTMLArea.is_ie || editor.config.htmlareaPaste) { cmd = "paste"; } break; - case 'n': cmd = "formatblock"; value = HTMLArea.is_ie ? "

" : "p"; break; - - case '0': cmd = "killword"; break; - - // headings - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - cmd = "formatblock"; - value = "h" + key; - if (HTMLArea.is_ie) - value = "<" + value + ">"; - break; - } - if (cmd) { - // execute simple command - this.execCommand(cmd, false, value); - HTMLArea._stopEvent(ev); - } - } - else if (keyEvent) - { - - // IE's textRange and selection object is woefully inadequate, - // which means this fancy stuff is gecko only sorry :-| - // Die Bill, Die. (IE supports it somewhat nativly though) - if(HTMLArea.is_gecko) - { - var s = editor._getSelection() - var autoWrap = function (textNode, tag) - { - var rightText = textNode.nextSibling; - if(typeof tag == 'string') tag = editor._doc.createElement(tag); - var a = textNode.parentNode.insertBefore(tag, rightText); - HTMLArea.removeFromParent(textNode); - a.appendChild(textNode); - rightText.data = ' ' + rightText.data; - - if(HTMLArea.is_ie) - { - var r = editor._createRange(s); - s.moveToElementText(rightText); - s.move('character', 1); - } - else - { - s.collapse(rightText, 1); - } - HTMLArea._stopEvent(ev); - - editor._unLink = function() - { - var t = a.firstChild; - a.removeChild(t); - a.parentNode.insertBefore(t, a); - HTMLArea.removeFromParent(a); - editor._unLink = null; - editor._unlinkOnUndo = false; - } - editor._unlinkOnUndo = true; - - return a; - }; - - switch(ev.which) - { - // Space, see if the text just typed looks like a URL, or email address - // and link it appropriatly - case 32: - { - if(s && s.isCollapsed && s.anchorNode.nodeType == 3 && s.anchorNode.data.length > 3 && s.anchorNode.data.indexOf('.') >= 0) - { - var midStart = s.anchorNode.data.substring(0,s.anchorOffset).search(/\S{4,}$/); - if(midStart == -1) break; - - if(this._getFirstAncestor(s, 'a')) - { - break; // already in an anchor - } - - var matchData = s.anchorNode.data.substring(0,s.anchorOffset).replace(/^.*?(\S*)$/, '$1'); - - var m = matchData.match(HTMLArea.RE_email); - if(m) - { - var leftText = s.anchorNode; - var rightText = leftText.splitText(s.anchorOffset); - var midText = leftText.splitText(midStart); - - autoWrap(midText, 'a').href = 'mailto:' + m[0]; - break; - } - - var m = matchData.match(HTMLArea.RE_url); - if(m) - { - var leftText = s.anchorNode; - var rightText = leftText.splitText(s.anchorOffset); - var midText = leftText.splitText(midStart); - autoWrap(midText, 'a').href = (m[1] ? m[1] : 'http://') + m[2]; - break; - } - } - - } - break; - - default : - { - if(ev.keyCode == 27 || (this._unlinkOnUndo && ev.ctrlKey && ev.which == 122) ) - { - if(this._unLink) - { - this._unLink(); - HTMLArea._stopEvent(ev); - } - break; - } - else if(ev.which || ev.keyCode == 8 || ev.keyCode == 46) - { - this._unlinkOnUndo = false; - - if(s.anchorNode && s.anchorNode.nodeType == 3) - { - // See if we might be changing a link - var a = this._getFirstAncestor(s, 'a'); - if(!a) break; // not an anchor - if(!a._updateAnchTimeout) - { - if( s.anchorNode.data.match(HTMLArea.RE_email) - && (a.href.match('mailto:' + s.anchorNode.data.trim())) - ) - { - var textNode = s.anchorNode; - var fn = function() - { - a.href = 'mailto:' + textNode.data.trim(); - a._updateAnchTimeout = setTimeout(fn, 250); - } - a._updateAnchTimeout = setTimeout(fn, 250); - break; - } - - var m = s.anchorNode.data.match(HTMLArea.RE_url); - if(m && a.href.match(s.anchorNode.data.trim()) ) - { - var textNode = s.anchorNode; - var fn = function() - { - var m = textNode.data.match(HTMLArea.RE_url); - a.href = (m[1] ? m[1] : 'http://') + m[2]; - a._updateAnchTimeout = setTimeout(fn, 250); - } - a._updateAnchTimeout = setTimeout(fn, 250); - } - } - } - - } - } - break; - } - } - - // other keys here - switch (ev.keyCode) - { - case 13: // KEY enter - if (HTMLArea.is_gecko && !ev.shiftKey && this.config.mozParaHandler == 'dirty' ) - { - this.dom_checkInsertP(); - HTMLArea._stopEvent(ev); - } - break; - case 8: // KEY backspace - case 46: // KEY delete - if ((HTMLArea.is_gecko && !ev.shiftKey) || HTMLArea.is_ie) - { - if (this.checkBackspace()) - { - HTMLArea._stopEvent(ev); - } - } - break; - } - } - - // update the toolbar state after some time - if (editor._timerToolbar) { - clearTimeout(editor._timerToolbar); - } - editor._timerToolbar = setTimeout(function() { - editor.updateToolbar(); - editor._timerToolbar = null; - }, 250); -}; - -HTMLArea.prototype.convertNode = function(el, newTagName) { - var newel = this._doc.createElement(newTagName); - while (el.firstChild) - newel.appendChild(el.firstChild); - return newel; -}; - -if(HTMLArea.is_ie) -{ - // this function is for IE - HTMLArea.prototype.checkBackspace = function() - { - var sel = this._getSelection(); - if(sel.type == 'Control') - { - var elm = this._activeElement(sel); - HTMLArea.removeFromParent(elm); - return true; - } - - // This bit of code preseves links when you backspace over the - // endpoint of the link in IE. Without it, if you have something like - // link_here | - // where | is the cursor, and backspace over the last e, then the link - // will de-link, which is a bit tedious - var range = this._createRange(sel); - var r2 = range.duplicate(); - r2.moveStart("character", -1); - var a = r2.parentElement(); - if (a != range.parentElement() && - /^a$/i.test(a.tagName)) - { - r2.collapse(true); - r2.moveEnd("character", 1); - r2.pasteHTML(''); - r2.select(); - return true; - } - }; -} -else -{ - // this function is for DOM - HTMLArea.prototype.checkBackspace = function() - { - var self = this; - setTimeout(function() - { - var sel = self._getSelection(); - var range = self._createRange(sel); - var SC = range.startContainer; - var SO = range.startOffset; - var EC = range.endContainer; - var EO = range.endOffset; - var newr = SC.nextSibling; - if (SC.nodeType == 3) - { - SC = SC.parentNode; - } - if (!/\S/.test(SC.tagName)) - { - var p = document.createElement("p"); - while (SC.firstChild) - { - p.appendChild(SC.firstChild); - } - SC.parentNode.insertBefore(p, SC); - HTMLArea.removeFromParent(SC); - var r = range.cloneRange(); - r.setStartBefore(newr); - r.setEndAfter(newr); - r.extractContents(); - sel.removeAllRanges(); - sel.addRange(r); - } - }, 10); - }; -} - -/** The idea here is - * 1. See if we are in a block element - * 2. If we are not, then wrap the current "block" of text into a paragraph - * 3. Now that we have a block element, select all the text between the insertion point - * and just AFTER the end of the block - * eg

The quick |brown fox jumped over the lazy dog.

| - * --------------------------------------- - * 4. Extract that from the document, making - *

The quick

- * and a document fragment with - *

brown fox jumped over the lazy dog.

- * 5. Reinsert it just after the block element - *

The quick

brown fox jumped over the lazy dog.

- * - * Along the way, allow inserting blank paragraphs, which will look like


- */ - -HTMLArea.prototype.dom_checkInsertP = function() { - - // Get the insertion point, we'll scrub any highlighted text the user wants rid of while we are there. - var sel = this._getSelection(); - var range = this._createRange(sel); - if (!range.collapsed) - { - range.deleteContents(); - } - this.deactivateEditor(); - //sel.removeAllRanges(); - //sel.addRange(range); - - var SC = range.startContainer; - var SO = range.startOffset; - var EC = range.endContainer; - var EO = range.endOffset; - - // If the insertion point is character 0 of the - // document, then insert a space character that we will wrap into a paragraph - // in a bit. - if (SC == EC && SC == body && !SO && !EO) - { - p = this._doc.createTextNode(" "); - body.insertBefore(p, body.firstChild); - range.selectNodeContents(p); - SC = range.startContainer; - SO = range.startOffset; - EC = range.endContainer; - EO = range.endOffset; - } - - // See if we are in a block element, if so, great. - var p = this.getAllAncestors(); - - var block = null; - var body = this._doc.body; - for (var i = 0; i < p.length; ++i) - { - if(HTMLArea.isParaContainer(p[i])) - { - break; - } - else if (HTMLArea.isBlockElement(p[i]) && !/body|html/i.test(p[i].tagName)) - { - block = p[i]; - break; - } - } - - // If not in a block element, we'll have to turn some stuff into a paragraph - if (!block) - { - // We want to wrap as much stuff as possible into the paragraph in both directions - // from the insertion point. We start with the start container and walk back up to the - // node just before any of the paragraph containers. - var wrap = range.startContainer; - while(wrap.parentNode && !HTMLArea.isParaContainer(wrap.parentNode)) - { - wrap = wrap.parentNode; - } - var start = wrap; - var end = wrap; - - // Now we walk up the sibling list until we hit the top of the document - // or an element that we shouldn't put in a p (eg other p, div, ul, ol, table) - while(start.previousSibling) - { - if(start.previousSibling.tagName) - { - if(!HTMLArea.isBlockElement(start.previousSibling)) - { - start = start.previousSibling; - } - else - { - break; - } - } - else - { - start = start.previousSibling; - } - } - - // Same down the list - while(end.nextSibling) - { - if(end.nextSibling.tagName) - { - if(!HTMLArea.isBlockElement(end.nextSibling)) - { - end = end.nextSibling; - } - else - { - break; - } - } - else - { - end = end.nextSibling; - } - } - - // Select the entire block - range.setStartBefore(start); - range.setEndAfter(end); - - // Make it a paragraph - range.surroundContents(this._doc.createElement('p')); - - // Which becomes the block element - block = range.startContainer.firstChild; - - // And finally reset the insertion point to where it was originally - range.setStart(SC, SO); - } - - // The start point is the insertion point, so just move the end point to immediatly - // after the block - range.setEndAfter(block); - - // Extract the range, to split the block - // If we just did range.extractContents() then Mozilla does wierd stuff - // with selections, but if we clone, then remove the original range and extract - // the clone, it's quite happy. - var r2 = range.cloneRange(); - sel.removeRange(range); - var df = r2.extractContents(); - - if(df.childNodes.length == 0) - { - df.appendChild(this._doc.createElement('p')); - df.firstChild.appendChild(this._doc.createElement('br')); - } - - if(df.childNodes.length > 1) - { - var nb = this._doc.createElement('p'); - while(df.firstChild) - { - var s = df.firstChild; - df.removeChild(s); - nb.appendChild(s); - } - df.appendChild(nb); - } - - // If the original block is empty, put a nsbp in it. - if (!/\S/.test(block.innerHTML)) - block.innerHTML = " "; - - p = df.firstChild; - if (!/\S/.test(p.innerHTML)) - p.innerHTML = "
"; - - // If the new block is empty and it's a heading, make it a paragraph - // note, the new block is empty when you are hitting enter at the end of the existing block - if (/^\s*\s*$/.test(p.innerHTML) && /^h[1-6]$/i.test(p.tagName)) - { - df.appendChild(this.convertNode(p, "p")); - df.removeChild(p); - } - - var newblock = block.parentNode.insertBefore(df.firstChild, block.nextSibling); - - // Select the range (to set the insertion) - // collapse to the start of the new block - // (remember the block might be


, so if we collapsed to the end the
would be noticable) - - //range.selectNode(newblock.firstChild); - //range.collapse(true); - - this.activateEditor(); - - var sel = this._getSelection(); - sel.removeAllRanges(); - sel.collapse(newblock,0); - - // scroll into view - this.scrollToElement(newblock); - - //this.forceRedraw(); - -}; - -HTMLArea.prototype.scrollToElement = function(e) -{ - if(HTMLArea.is_gecko) - { - var top = 0; - var left = 0; - while(e) - { - top += e.offsetTop; - left += e.offsetLeft; - if(e.offsetParent && e.offsetParent.tagName.toLowerCase() != 'body') - { - e = e.offsetParent; - } - else - { - e = null; - } - } - this._iframe.contentWindow.scrollTo(left, top); - } -}; - -// retrieve the HTML -HTMLArea.prototype.getHTML = function() { - var html = ''; - switch (this._editMode) { - case "wysiwyg" : - { - if (!this.config.fullPage) - html = HTMLArea.getHTML(this._doc.body, false, this); - else - html = this.doctype + "\n" + HTMLArea.getHTML(this._doc.documentElement, true, this); - break; - } - case "textmode" : - { - html = this._textArea.value; - break; - } - default : - { - alert("Mode <" + mode + "> not defined!"); - return false; - } - } - return html; -}; - -HTMLArea.prototype.outwardHtml = function(html) -{ - html = html.replace(/<(\/?)b(\s|>|\/)/ig, "<$1strong$2"); - html = html.replace(/<(\/?)i(\s|>|\/)/ig, "<$1em$2"); - html = html.replace(/<(\/?)strike(\s|>|\/)/ig, "<$1del$2"); - - // replace window.open to that any clicks won't open a popup in designMode - html = html.replace("onclick=\"try{if(document.designMode && document.designMode == 'on') return false;}catch(e){} window.open(", "onclick=\"window.open("); - - // Figure out what our server name is, and how it's referenced - var serverBase = location.href.replace(/(https?:\/\/[^\/]*)\/.*/, '$1') + '/'; - - // IE puts this in can't figure out why - html = html.replace(/https?:\/\/null\//g, serverBase); - - // Make semi-absolute links to be truely absolute - // we do this just to standardize so that special replacements knows what - // to expect - html = html.replace(/((href|src|background)=[\'\"])\/+/ig, '$1' + serverBase); - - html = this.outwardSpecialReplacements(html); - - html = this.fixRelativeLinks(html); - - if(this.config.sevenBitClean) - { - html = html.replace(/[^ -~\r\n\t]/g, function(c){ return '&#'+c.charCodeAt(0)+';';}); - } - - // ticket:56, the "greesemonkey" plugin for Firefox adds this junk, - // so we strip it out. Original submitter gave a plugin, but that's - // a bit much just for this IMHO - james - if(HTMLArea.is_gecko) - { - html = html.replace(/[\s]*<\/script>/ig, ''); - } - - return html; -}; - -HTMLArea.prototype.inwardHtml = function(html) -{ - // Midas uses b and i instead of strong and em, um, hello, - // mozilla, this is the 21st century calling! - if (HTMLArea.is_gecko) { - html = html.replace(/<(\/?)strong(\s|>|\/)/ig, "<$1b$2"); - html = html.replace(/<(\/?)em(\s|>|\/)/ig, "<$1i$2"); - } - - // Both IE and Gecko use strike instead of del (#523) - html = html.replace(/<(\/?)del(\s|>|\/)/ig, "<$1strike$2"); - - - // replace window.open to that any clicks won't open a popup in designMode - html = html.replace("onclick=\"window.open(", "onclick=\"try{if(document.designMode && document.designMode == 'on') return false;}catch(e){} window.open("); - - html = this.inwardSpecialReplacements(html); - - // For IE's sake, make any URLs that are semi-absolute (="/....") to be - // truely absolute - var nullRE = new RegExp('((href|src|background)=[\'"])/+', 'gi'); - html = html.replace(nullRE, '$1' + location.href.replace(/(https?:\/\/[^\/]*)\/.*/, '$1') + '/'); - - html = this.fixRelativeLinks(html); - return html; -}; - -HTMLArea.prototype.outwardSpecialReplacements = function(html) -{ - for(var i in this.config.specialReplacements) - { - var from = this.config.specialReplacements[i]; - var to = i; - if (typeof(from.replace) != 'function' || typeof(to.replace) != 'function') continue; // prevent iterating over wrong type - // alert('out : ' + from + '=>' + to); - var reg = new RegExp(from.replace(HTMLArea.RE_Specials, '\\$1'), 'g'); - html = html.replace(reg, to.replace(/\$/g, '$$$$')); - //html = html.replace(from, to); - } - return html; -}; - -HTMLArea.prototype.inwardSpecialReplacements = function(html) -{ - // alert("inward"); - for(var i in this.config.specialReplacements) - { - var from = i; - var to = this.config.specialReplacements[i]; - - if (typeof(from.replace) != 'function' || typeof(to.replace) != 'function') continue; // prevent iterating over wrong type - // alert('in : ' + from + '=>' + to); - // - // html = html.replace(reg, to); - // html = html.replace(from, to); - var reg = new RegExp(from.replace(HTMLArea.RE_Specials, '\\$1'), 'g'); - html = html.replace(reg, to.replace(/\$/g, '$$$$')); // IE uses doubled dollar signs to escape backrefs, also beware that IE also implements $& $_ and $' like perl. - } - return html; -}; - - -HTMLArea.prototype.fixRelativeLinks = function(html) -{ - - if(typeof this.config.stripSelfNamedAnchors != 'undefined' && this.config.stripSelfNamedAnchors) - { - var stripRe = new RegExp(document.location.href.replace(HTMLArea.RE_Specials, '\\$1') + '(#[^\'" ]*)', 'g'); - html = html.replace(stripRe, '$1'); - } - - - if(typeof this.config.stripBaseHref != 'undefined' && this.config.stripBaseHref) - { - var baseRe = null - if(typeof this.config.baseHref != 'undefined' && this.config.baseHref != null) - { - baseRe = new RegExp(this.config.baseHref.replace(HTMLArea.RE_Specials, '\\$1'), 'g'); - } - else - { - baseRe = new RegExp(document.location.href.replace(/([^\/]*\/?)$/, '').replace(HTMLArea.RE_Specials, '\\$1'), 'g'); - } - - html = html.replace(baseRe, ''); - } - - if(HTMLArea.is_ie) - { - // This is now done in inward & outward - // Don't know why but IE is doing this (putting http://null/ on links?! - // alert(html); - // var nullRE = new RegExp('https?:\/\/null\/', 'g'); - // html = html.replace(nullRE, location.href.replace(/(https?:\/\/[^\/]*\/).*/, '$1')); - // alert(html); - } - - return html; -}; - -// retrieve the HTML (fastest version, but uses innerHTML) -HTMLArea.prototype.getInnerHTML = function() { - if(!this._doc.body) return ''; - switch (this._editMode) { - case "wysiwyg" : - if (!this.config.fullPage) - // return this._doc.body.innerHTML; - html = this._doc.body.innerHTML; - else - html = this.doctype + "\n" + this._doc.documentElement.innerHTML; - break; - case "textmode" : - html = this._textArea.value; - break; - default : - alert("Mode <" + mode + "> not defined!"); - return false; - } - - return html; -}; - -// completely change the HTML inside -HTMLArea.prototype.setHTML = function(html) { - if (!this.config.fullPage) - { - this._doc.body.innerHTML = html; - } - else - { - this.setFullHTML(html); - } - this._textArea.value = html; -}; - -// sets the given doctype (useful when config.fullPage is true) -HTMLArea.prototype.setDoctype = function(doctype) { - this.doctype = doctype; -}; - -/*************************************************** - * Category: UTILITY FUNCTIONS - ***************************************************/ - -// variable used to pass the object to the popup editor window. -HTMLArea._object = null; - -// function that returns a clone of the given object -HTMLArea.cloneObject = function(obj) { - if (!obj) return null; - var newObj = new Object; - - // check for array objects - if (obj.constructor.toString().match( /\s*function Array\(/ )) { - newObj = obj.constructor(); - } - - // check for function objects (as usual, IE is fucked up) - if (obj.constructor.toString().match( /\s*function Function\(/ )) { - newObj = obj; // just copy reference to it - } else for (var n in obj) { - var node = obj[n]; - if (typeof node == 'object') { newObj[n] = HTMLArea.cloneObject(node); } - else { newObj[n] = node; } - } - - return newObj; -}; - -// FIXME!!! this should return false for IE < 5.5 -HTMLArea.checkSupportedBrowser = function() { - if (HTMLArea.is_gecko) { - if (navigator.productSub < 20021201) { - alert("You need at least Mozilla-1.3 Alpha.\n" + - "Sorry, your Gecko is not supported."); - return false; - } - if (navigator.productSub < 20030210) { - alert("Mozilla < 1.3 Beta is not supported!\n" + - "I'll try, though, but it might not work."); - } - } - return HTMLArea.is_gecko || HTMLArea.is_ie; -}; - -// selection & ranges - -// returns the current selection object -if (HTMLArea.is_ie) -{ - HTMLArea.prototype._getSelection = function() - { - return this._doc.selection; - }; -} -else -{ - HTMLArea.prototype._getSelection = function() - { - return this._iframe.contentWindow.getSelection(); - }; -} - -// returns a range for the current selection -if (HTMLArea.is_ie) -{ - HTMLArea.prototype._createRange = function(sel) - { - return sel.createRange(); - }; -} -else -{ - HTMLArea.prototype._createRange = function(sel) - { - this.activateEditor(); - if (typeof sel != "undefined") - { - try - { - return sel.getRangeAt(0); - } - catch(e) - { - return this._doc.createRange(); - } - } - else - { - return this._doc.createRange(); - } - }; -} - -// event handling - -/** Event Flushing - * To try and work around memory leaks in the rather broken - * garbage collector in IE, HTMLArea.flushEvents can be called - * onunload, it will remove any event listeners (that were added - * through _addEvent(s)) and clear any DOM-0 events. - */ -HTMLArea._eventFlushers = [ ]; -HTMLArea.flushEvents = function() -{ - var x = 0; - var e = null; - while(e = HTMLArea._eventFlushers.pop()) - { - try - { - if(e.length == 3) - { - HTMLArea._removeEvent(e[0], e[1], e[2]); - x++; - } - else if (e.length == 2) - { - e[0]['on' + e[1]] = null; - e[0]._xinha_dom0Events[e[1]] = null; - x++; - } - } - catch(e) - { - // Do Nothing - } - } - - /* - // This code is very agressive, and incredibly slow in IE, so I've disabled it. - - if(document.all) - { - for(var i = 0; i < document.all.length; i++) - { - for(var j in document.all[i]) - { - if(/^on/.test(j) && typeof document.all[i][j] == 'function') - { - document.all[i][j] = null; - x++; - } - } - } - } - */ - - // alert('Flushed ' + x + ' events.'); -}; - -if (document.addEventListener) -{ - HTMLArea._addEvent = function(el, evname, func) - { - el.addEventListener(evname, func, true); - HTMLArea._eventFlushers.push([el, evname, func]); - }; - HTMLArea._removeEvent = function(el, evname, func) - { - el.removeEventListener(evname, func, true); - }; - HTMLArea._stopEvent = function(ev) - { - ev.preventDefault(); - ev.stopPropagation(); - }; -} -else if (document.attachEvent) -{ - HTMLArea._addEvent = function(el, evname, func) - { - el.attachEvent("on" + evname, func); - HTMLArea._eventFlushers.push([el, evname, func]); - }; - HTMLArea._removeEvent = function(el, evname, func) - { - el.detachEvent("on" + evname, func); - }; - HTMLArea._stopEvent = function(ev) - { - try - { - ev.cancelBubble = true; - ev.returnValue = false; - } - catch(e) - { - // Perhaps we could try here to stop the window.event - // window.event.cancelBubble = true; - // window.event.returnValue = false; - } - }; -} -else -{ - HTMLArea._addEvent = function(el, evname, func) - { - alert('_addEvent is not supported'); - }; - HTMLArea._removeEvent = function(el, evname, func) - { - alert('_removeEvent is not supported'); - }; - HTMLArea._stopEvent = function(ev) - { - alert('_stopEvent is not supported'); - }; -} - -HTMLArea._addEvents = function(el, evs, func) { - for (var i = evs.length; --i >= 0;) { - HTMLArea._addEvent(el, evs[i], func); - } -}; - -HTMLArea._removeEvents = function(el, evs, func) { - for (var i = evs.length; --i >= 0;) { - HTMLArea._removeEvent(el, evs[i], func); - } -}; - -/** - * Adds a standard "DOM-0" event listener to an element. - * The DOM-0 events are those applied directly as attributes to - * an element - eg element.onclick = stuff; - * - * By using this function instead of simply overwriting any existing - * DOM-0 event by the same name on the element it will trigger as well - * as the existing ones. Handlers are triggered one after the other - * in the order they are added. - * - * Remember to return true/false from your handler, this will determine - * whether subsequent handlers will be triggered (ie that the event will - * continue or be canceled). - * - */ - -HTMLArea.addDom0Event = function(el, ev, fn) -{ - HTMLArea._prepareForDom0Events(el, ev); - el._xinha_dom0Events[ev].unshift(fn); -}; - - -/** - * See addDom0Event, the difference is that handlers registered using - * prependDom0Event will be triggered before existing DOM-0 events of the - * same name on the same element. - */ - -HTMLArea.prependDom0Event = function(el, ev, fn) -{ - HTMLArea._prepareForDom0Events(el, ev); - el._xinha_dom0Events[ev].push(fn); -}; - -/** - * Prepares an element to receive more than one DOM-0 event handler - * when handlers are added via addDom0Event and prependDom0Event. - */ -HTMLArea._prepareForDom0Events = function(el, ev) -{ - // Create a structure to hold our lists of event handlers - if(typeof el._xinha_dom0Events == 'undefined') - { - el._xinha_dom0Events = { }; - HTMLArea.freeLater(el, '_xinha_dom0Events'); - } - - // Create a list of handlers for this event type - if(typeof el._xinha_dom0Events[ev] == 'undefined') - { - el._xinha_dom0Events[ev] = [ ]; - if(typeof el['on'+ev] == 'function') - { - el._xinha_dom0Events[ev].push(el['on'+ev]); - } - - // Make the actual event handler, which runs through - // each of the handlers in the list and executes them - // in the correct context. - el['on'+ev] = function(event) - { - var a = el._xinha_dom0Events[ev]; - // call previous submit methods if they were there. - var allOK = true; - for (var i = a.length; --i >= 0;) - { - // We want the handler to be a member of the form, not the array, so that "this" will work correctly - el._xinha_tempEventHandler = a[i]; - if(el._xinha_tempEventHandler(event) == false) - { - el._xinha_tempEventHandler = null; - allOK = false; - break; - } - el._xinha_tempEventHandler = null; - } - return allOK; - }; - - HTMLArea._eventFlushers.push([el, ev]); - } -}; - -HTMLArea.prototype.notifyOn = function(ev, fn) -{ - if(typeof this._notifyListeners[ev] == 'undefined') - { - this._notifyListeners[ev] = [ ]; - HTMLArea.freeLater(this, '_notifyListeners'); - } - - this._notifyListeners[ev].push(fn); -}; - -HTMLArea.prototype.notifyOf = function(ev, args) -{ - - if(this._notifyListeners[ev]) - { - - for(var i = 0; i < this._notifyListeners[ev].length; i++) - { - this._notifyListeners[ev][i](ev, args); - } - } -}; - - -HTMLArea._removeClass = function(el, className) { - if (!(el && el.className)) { - return; - } - var cls = el.className.split(" "); - var ar = new Array(); - for (var i = cls.length; i > 0;) { - if (cls[--i] != className) { - ar[ar.length] = cls[i]; - } - } - el.className = ar.join(" "); -}; - -HTMLArea._addClass = function(el, className) { - // remove the class first, if already there - HTMLArea._removeClass(el, className); - el.className += " " + className; -}; - -HTMLArea._hasClass = function(el, className) { - if (!(el && el.className)) { - return false; - } - var cls = el.className.split(" "); - for (var i = cls.length; i > 0;) { - if (cls[--i] == className) { - return true; - } - } - return false; -}; - -HTMLArea._blockTags = " body form textarea fieldset ul ol dl li div " + -"p h1 h2 h3 h4 h5 h6 quote pre table thead " + -"tbody tfoot tr td th iframe address blockquote"; -HTMLArea.isBlockElement = function(el) { - return el && el.nodeType == 1 && (HTMLArea._blockTags.indexOf(" " + el.tagName.toLowerCase() + " ") != -1); -}; - -HTMLArea._paraContainerTags = " body td th caption fieldset div"; -HTMLArea.isParaContainer = function(el) -{ - return el && el.nodeType == 1 && (HTMLArea._paraContainerTags.indexOf(" " + el.tagName.toLowerCase() + " ") != -1); -}; - -// These are all the tags for which the end tag is not optional or -// forbidden, taken from the list at: -// http://www.w3.org/TR/REC-html40/index/elements.html -HTMLArea._closingTags = " a abbr acronym address applet b bdo big blockquote button caption center cite code del dfn dir div dl em fieldset font form frameset h1 h2 h3 h4 h5 h6 i iframe ins kbd label legend map menu noframes noscript object ol optgroup pre q s samp script select small span strike strong style sub sup table textarea title tt u ul var "; - -HTMLArea.needsClosingTag = function(el) { - return el && el.nodeType == 1 && (HTMLArea._closingTags.indexOf(" " + el.tagName.toLowerCase() + " ") != -1); -}; - -// performs HTML encoding of some given string -HTMLArea.htmlEncode = function(str) { - if(typeof str.replace == 'undefined') str = str.toString(); - // we don't need regexp for that, but.. so be it for now. - str = str.replace(/&/ig, "&"); - str = str.replace(//ig, ">"); - str = str.replace(/\xA0/g, " "); // Decimal 160, non-breaking-space - str = str.replace(/\x22/g, """); - // \x22 means '"' -- we use hex reprezentation so that we don't disturb - // JS compressors (well, at least mine fails.. ;) - return str; -}; - -// Retrieves the HTML code from the given node. This is a replacement for -// getting innerHTML, using standard DOM calls. -// Wrapper catch a Mozilla-Exception with non well formed html source code -HTMLArea.getHTML = function(root, outputRoot, editor){ - try{ - return HTMLArea.getHTMLWrapper(root,outputRoot,editor); - } - catch(e){ - alert(HTMLArea._lc('Your Document is not well formed. Check JavaScript console for details.')); - return editor._iframe.contentWindow.document.body.innerHTML; - } -}; - -HTMLArea.getHTMLWrapper = function(root, outputRoot, editor, indent) { - var html = ""; - if(!indent) indent = ''; - - switch (root.nodeType) { - case 10:// Node.DOCUMENT_TYPE_NODE - case 6: // Node.ENTITY_NODE - case 12:// Node.NOTATION_NODE - // this all are for the document type, probably not necessary - break; - - case 2: // Node.ATTRIBUTE_NODE - // Never get here, this has to be handled in the ELEMENT case because - // of IE crapness requring that some attributes are grabbed directly from - // the attribute (nodeValue doesn't return correct values), see - //http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&safe=off&selm=3porgu4mc4ofcoa1uqkf7u8kvv064kjjb4%404ax.com - // for information - break; - - case 4: // Node.CDATA_SECTION_NODE - // Mozilla seems to convert CDATA into a comment when going into wysiwyg mode, - // don't know about IE - html += (HTMLArea.is_ie ? ('\n' + indent) : '') + '' ; - break; - - case 5: // Node.ENTITY_REFERENCE_NODE - html += '&' + root.nodeValue + ';'; - break; - - case 7: // Node.PROCESSING_INSTRUCTION_NODE - // PI's don't seem to survive going into the wysiwyg mode, (at least in moz) - // so this is purely academic - html += (HTMLArea.is_ie ? ('\n' + indent) : '') + ''; - break; - - - case 1: // Node.ELEMENT_NODE - case 11: // Node.DOCUMENT_FRAGMENT_NODE - case 9: // Node.DOCUMENT_NODE - { - var closed; - var i; - var root_tag = (root.nodeType == 1) ? root.tagName.toLowerCase() : ''; - if (outputRoot) - outputRoot = !(editor.config.htmlRemoveTags && editor.config.htmlRemoveTags.test(root_tag)); - if (HTMLArea.is_ie && root_tag == "head") { - if (outputRoot) - html += (HTMLArea.is_ie ? ('\n' + indent) : '') + ""; - // lowercasize - var save_multiline = RegExp.multiline; - RegExp.multiline = true; - var txt = root.innerHTML.replace(HTMLArea.RE_tagName, function(str, p1, p2) { - return p1 + p2.toLowerCase(); - }); - RegExp.multiline = save_multiline; - html += txt + '\n'; - if (outputRoot) - html += (HTMLArea.is_ie ? ('\n' + indent) : '') + ""; - break; - } else if (outputRoot) { - closed = (!(root.hasChildNodes() || HTMLArea.needsClosingTag(root))); - html += (HTMLArea.is_ie && HTMLArea.isBlockElement(root) ? ('\n' + indent) : '') + "<" + root.tagName.toLowerCase(); - var attrs = root.attributes; - for (i = 0; i < attrs.length; ++i) { - var a = attrs.item(i); - if (!a.specified && !(root.tagName.toLowerCase().match(/input|option/) && a.nodeName == 'value')) { - continue; - } - var name = a.nodeName.toLowerCase(); - if (/_moz_editor_bogus_node/.test(name)) { - html = ""; - break; - } - if (/(_moz)|(contenteditable)|(_msh)/.test(name)) { - // avoid certain attributes - continue; - } - var value; - if (name != "style") { - // IE5.5 reports 25 when cellSpacing is - // 1; other values might be doomed too. - // For this reason we extract the - // values directly from the root node. - // I'm starting to HATE JavaScript - // development. Browser differences - // suck. - // - // Using Gecko the values of href and src are converted to absolute links - // unless we get them using nodeValue() - if (typeof root[a.nodeName] != "undefined" && name != "href" && name != "src" && !/^on/.test(name)) { - value = root[a.nodeName]; - } else { - value = a.nodeValue; - // IE seems not willing to return the original values - it converts to absolute - // links using a.nodeValue, a.value, a.stringValue, root.getAttribute("href") - // So we have to strip the baseurl manually :-/ - if (HTMLArea.is_ie && (name == "href" || name == "src")) { - value = editor.stripBaseURL(value); - } - - // High-ascii (8bit) characters in links seem to cause problems for some sites, - // while this seems to be consistent with RFC 3986 Section 2.4 - // because these are not "reserved" characters, it does seem to - // cause links to international resources not to work. See ticket:167 - - // IE always returns high-ascii characters un-encoded in links even if they - // were supplied as % codes (it unescapes them when we pul the value from the link). - - // Hmmm, very strange if we use encodeURI here, or encodeURIComponent in place - // of escape below, then the encoding is wrong. I mean, completely. - // Nothing like it should be at all. Using escape seems to work though. - // It's in both browsers too, so either I'm doing something wrong, or - // something else is going on? - - if(editor.config.only7BitPrintablesInURLs && (name == "href" || name == "src")) - { - value = value.replace(/([^!-~]+)/g, function(match) { return escape(match); }); - } - } - } else { // IE fails to put style in attributes list - // FIXME: cssText reported by IE is UPPERCASE - value = root.style.cssText; - } - if (/^(_moz)?$/.test(value)) { - // Mozilla reports some special tags - // here; we don't need them. - continue; - } - html += " " + name + '="' + HTMLArea.htmlEncode(value) + '"'; - } - if (html != "") { - if(closed && root_tag=="p") { - //never use

as empty paragraphs won't be visible - html += "> 

"; - } else if(closed) { - html += " />"; - } else { - html += ">"; - } - } - } - var containsBlock = false; - for (i = root.firstChild; i; i = i.nextSibling) { - if(!containsBlock && i.nodeType == 1 && HTMLArea.isBlockElement(i)) containsBlock = true; - html += HTMLArea.getHTMLWrapper(i, true, editor, indent + ' '); - } - if (outputRoot && !closed) { - html += (HTMLArea.is_ie && HTMLArea.isBlockElement(root) && containsBlock ? ('\n' + indent) : '') + ""; - } - break; - } - case 3: // Node.TEXT_NODE - html = /^script|style$/i.test(root.parentNode.tagName) ? root.data : HTMLArea.htmlEncode(root.data); - break; - - case 8: // Node.COMMENT_NODE - html = ""; - break; - } - return html; -}; - -/** @see getHTMLWrapper (search for "value = a.nodeValue;") */ - -HTMLArea.prototype.stripBaseURL = function(string) -{ - if(this.config.baseHref==null || !this.config.stripBaseHref) - { - return(string); - } - var baseurl = this.config.baseHref; - - // strip host-part of URL which is added by MSIE to links relative to server root - baseurl = baseurl.replace(/^(https?:\/\/[^\/]+)(.*)$/, '$1'); - basere = new RegExp(baseurl); - return string.replace(basere, ""); -}; - -String.prototype.trim = function() { - return this.replace(/^\s+/, '').replace(/\s+$/, ''); -}; - -// creates a rgb-style color from a number -HTMLArea._makeColor = function(v) { - if (typeof v != "number") { - // already in rgb (hopefully); IE doesn't get here. - return v; - } - // IE sends number; convert to rgb. - var r = v & 0xFF; - var g = (v >> 8) & 0xFF; - var b = (v >> 16) & 0xFF; - return "rgb(" + r + "," + g + "," + b + ")"; -}; - -// returns hexadecimal color representation from a number or a rgb-style color. -HTMLArea._colorToRgb = function(v) { - if (!v) - return ''; - - // returns the hex representation of one byte (2 digits) - function hex(d) { - return (d < 16) ? ("0" + d.toString(16)) : d.toString(16); - } - - if (typeof v == "number") { - // we're talking to IE here - var r = v & 0xFF; - var g = (v >> 8) & 0xFF; - var b = (v >> 16) & 0xFF; - return "#" + hex(r) + hex(g) + hex(b); - } - - if (v.substr(0, 3) == "rgb") { - // in rgb(...) form -- Mozilla - var re = /rgb\s*\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\s*\)/; - if (v.match(re)) { - var r = parseInt(RegExp.$1); - var g = parseInt(RegExp.$2); - var b = parseInt(RegExp.$3); - return "#" + hex(r) + hex(g) + hex(b); - } - // doesn't match RE?! maybe uses percentages or float numbers - // -- FIXME: not yet implemented. - return null; - } - - if (v.substr(0, 1) == "#") { - // already hex rgb (hopefully :D ) - return v; - } - - // if everything else fails ;) - return null; -}; - -// modal dialogs for Mozilla (for IE we're using the showModalDialog() call). - -// receives an URL to the popup dialog and a function that receives one value; -// this function will get called after the dialog is closed, with the return -// value of the dialog. -HTMLArea.prototype._popupDialog = function(url, action, init) { - Dialog(this.popupURL(url), action, init); -}; - -// paths - -HTMLArea.prototype.imgURL = function(file, plugin) { - if (typeof plugin == "undefined") - return _editor_url + file; - else - return _editor_url + "plugins/" + plugin + "/img/" + file; -}; - -HTMLArea.prototype.popupURL = function(file) { - var url = ""; - if (file.match(/^plugin:\/\/(.*?)\/(.*)/)) { - var plugin = RegExp.$1; - var popup = RegExp.$2; - if (!/\.html$/.test(popup)) - popup += ".html"; - url = _editor_url + "plugins/" + plugin + "/popups/" + popup; - } else if(file.match(/^\/.*?/)) - url = file; - else - url = _editor_url + this.config.popupURL + file; - return url; -}; - -/** - * FIX: Internet Explorer returns an item having the _name_ equal to the given - * id, even if it's not having any id. This way it can return a different form - * field even if it's not a textarea. This workarounds the problem by - * specifically looking to search only elements having a certain tag name. - */ -HTMLArea.getElementById = function(tag, id) { - var el, i, objs = document.getElementsByTagName(tag); - for (i = objs.length; --i >= 0 && (el = objs[i]);) - if (el.id == id) - return el; - return null; -}; - - -/** Use some CSS trickery to toggle borders on tables */ - -HTMLArea.prototype._toggleBorders = function() -{ - tables = this._doc.getElementsByTagName('TABLE'); - if(tables.length != 0) - { - if(!this.borders) - { - name = "bordered"; - this.borders = true; - } - else - { - name = ""; - this.borders = false; - } - - for (var ix=0;ix < tables.length;ix++) - { - if(this.borders) - { - // flashing the display forces moz to listen (JB:18-04-2005) - #102 - if(HTMLArea.is_gecko) - { - tables[ix].style.display="none"; - tables[ix].style.display="table"; - } - HTMLArea._addClass(tables[ix], 'htmtableborders'); - } - else - { - HTMLArea._removeClass(tables[ix], 'htmtableborders'); - } - } - } - return true; -}; - - -HTMLArea.addClasses = function(el, classes) - { - if(el != null) - { - var thiers = el.className.trim().split(' '); - var ours = classes.split(' '); - for(var x = 0; x < ours.length; x++) - { - var exists = false; - for(var i = 0; exists == false && i < thiers.length; i++) - { - if(thiers[i] == ours[x]) - { - exists = true; - } - } - if(exists == false) - { - thiers[thiers.length] = ours[x]; - } - } - el.className = thiers.join(' ').trim(); - } - }; - -HTMLArea.removeClasses = function(el, classes) -{ - var existing = el.className.trim().split(); - var new_classes = [ ]; - var remove = classes.trim().split(); - - for(var i = 0; i < existing.length; i++) - { - var found = false; - for(var x = 0; x < remove.length && !found; x++) - { - if(existing[i] == remove[x]) - { - found = true; - } - } - if(!found) - { - new_classes[new_classes.length] = existing[i]; - } - } - return new_classes.join(' '); -}; - -/** Alias these for convenience */ -HTMLArea.addClass = HTMLArea._addClass; -HTMLArea.removeClass = HTMLArea._removeClass; -HTMLArea._addClasses = HTMLArea.addClasses; -HTMLArea._removeClasses = HTMLArea.removeClasses; - -/** Use XML HTTPRequest to post some data back to the server and do something - * with the response (asyncronously!), this is used by such things as the tidy functions - */ -HTMLArea._postback = function(url, data, handler) -{ - var req = null; - if(HTMLArea.is_ie) - { - req = new ActiveXObject("Microsoft.XMLHTTP"); - } - else - { - req = new XMLHttpRequest(); - } - - var content = ''; - for(var i in data) - { - content += (content.length ? '&' : '') + i + '=' + encodeURIComponent(data[i]); - } - - function callBack() - { - if(req.readyState == 4) - { - if(req.status == 200) - { - if(typeof handler == 'function') - handler(req.responseText, req); - } - else - { - alert('An error has occurred: ' + req.statusText); - } - } - } - - req.onreadystatechange = callBack; - - req.open('POST', url, true); - req.setRequestHeader - ( - 'Content-Type', - 'application/x-www-form-urlencoded; charset=UTF-8' - ); - //alert(content); - req.send(content); -}; - -HTMLArea._getback = function(url, handler) -{ - var req = null; - if(HTMLArea.is_ie) - { - req = new ActiveXObject("Microsoft.XMLHTTP"); - } - else - { - req = new XMLHttpRequest(); - } - - function callBack() - { - if(req.readyState == 4) - { - if(req.status == 200) - { - handler(req.responseText, req); - } - else - { - alert('An error has occurred: ' + req.statusText); - } - } - } - - req.onreadystatechange = callBack; - req.open('GET', url, true); - req.send(null); -}; - -HTMLArea._geturlcontent = function(url) -{ - var req = null; - if(HTMLArea.is_ie) - { - req = new ActiveXObject("Microsoft.XMLHTTP"); - } - else - { - req = new XMLHttpRequest(); - } - - // Synchronous! - req.open('GET', url, false); - req.send(null); - if(req.status == 200) - { - return req.responseText; - } - else - { - return ''; - } - -}; - -/** - * Unless somebody already has, make a little function to debug things - */ -if(typeof dump == 'undefined') -{ - function dump(o) { - var s = ''; - for (var prop in o) { - s += prop + ' = ' + o[prop] + '\n'; - } - - x = window.open("", "debugger"); - x.document.write('
' + s + '
'); - } -} - - -HTMLArea.arrayContainsArray = function(a1, a2) -{ - var all_found = true; - for(var x = 0; x < a2.length; x++) - { - var found = false; - for(var i = 0; i < a1.length; i++) - { - if(a1[i] == a2[x]) - { - found = true; - break; - } - } - if(!found) - { - all_found = false; - break; - } - } - return all_found; -}; - -HTMLArea.arrayFilter = function(a1, filterfn) -{ - var new_a = [ ]; - for(var x = 0; x < a1.length; x++) - { - if(filterfn(a1[x])) - new_a[new_a.length] = a1[x]; - } - - return new_a; -}; - -HTMLArea.uniq_count = 0; -HTMLArea.uniq = function(prefix) -{ - return prefix + HTMLArea.uniq_count++; -}; - -/** New language handling functions **/ - - -/** Load a language file. - * This function should not be used directly, HTMLArea._lc will use it when necessary. - * @param context Case sensitive context name, eg 'HTMLArea', 'TableOperations', ... - */ -HTMLArea._loadlang = function(context) -{ - if(typeof _editor_lcbackend == "string") - { - //use backend - var url = _editor_lcbackend; - url = url.replace(/%lang%/, _editor_lang); - url = url.replace(/%context%/, context); - } - else - { - //use internal files - if(context != 'HTMLArea') { - var url = _editor_url+"plugins/"+context+"/lang/"+_editor_lang+".js"; - } else { - var url = _editor_url+"lang/"+_editor_lang+".js"; - } - } - - var lang; - var langData = HTMLArea._geturlcontent(url); - if(langData != "") { - try { - eval('lang = ' + langData); - } catch(Error) { - alert('Error reading Language-File ('+url+'):\n'+Error.toString()); - lang = { } - } - } else { - lang = { }; - } - - return lang; -}; - -/** Return a localised string. - * @param string English language string - * @param context Case sensitive context name, eg 'HTMLArea' (default), 'TableOperations'... - * @param replace Replace $variables in String, eg {foo: 'replaceText'} ($foo in string will be replaced) - */ -HTMLArea._lc = function(string, context, replace) -{ - var ret; - if(_editor_lang == "en") - { - if(typeof string == 'object' && string.string) { - ret = string.string; - } else { - ret = string; - } - } - else - { - if(typeof HTMLArea._lc_catalog == 'undefined') - { - HTMLArea._lc_catalog = [ ]; - } - - if(typeof context == 'undefined') - { - context = 'HTMLArea'; - } - - if(typeof HTMLArea._lc_catalog[context] == 'undefined') - { - HTMLArea._lc_catalog[context] = HTMLArea._loadlang(context); - } - - var key; - if(typeof string == 'object' && string.key) - { - key = string.key; - } - else if(typeof string == 'object' && string.string) - { - key = string.string; - } - else - { - key = string; - } - - if(typeof HTMLArea._lc_catalog[context][key] == 'undefined') - { - if(context=='HTMLArea') - { - // Indicate it's untranslated - if(typeof string == 'object' && string.string) { - ret = string.string; - } else { - ret = string; - } - } - else - { - //if string is not found and context is not HTMLArea try if it is in HTMLArea - return HTMLArea._lc(string, 'HTMLArea', replace); - } - } - else - { - ret = HTMLArea._lc_catalog[context][key]; - } - } - - if(typeof string == 'object' && string.replace) - { - replace = string.replace; - } - if(typeof replace != "undefined") - { - for(var i in replace) - { - ret = ret.replace('$'+i, replace[i]); - } - } - - return ret; -}; - -HTMLArea.hasDisplayedChildren = function(el) -{ - var children = el.childNodes; - for(var i =0; i < children.length;i++) - { - if(children[i].tagName) - { - if(children[i].style.display != 'none') - { - return true; - } - } - } - return false; -}; - - -HTMLArea._loadback = function(src, callback) -{ - var head = document.getElementsByTagName("head")[0]; - var evt = HTMLArea.is_ie ? "onreadystatechange" : "onload"; - - var script = document.createElement("script"); - script.type = "text/javascript"; - script.src = src; - script[evt] = function() - { - if(HTMLArea.is_ie && !/loaded|complete/.test(window.event.srcElement.readyState)) return; - callback(); - } - head.appendChild(script); -}; - -HTMLArea.collectionToArray = function(collection) -{ - var array = [ ]; - for(var i = 0; i < collection.length; i++) - { - array.push(collection.item(i)); - } - return array; -}; - -if(!Array.prototype.append) -{ - Array.prototype.append = function(a) - { - for(var i = 0; i> 2; - enc2 = ((chr1 & 3) << 4) | (chr2 >> 4); - enc3 = ((chr2 & 15) << 2) | (chr3 >> 6); - enc4 = chr3 & 63; - - if (isNaN(chr2)) { - enc3 = enc4 = 64; - } else if (isNaN(chr3)) { - enc4 = 64; - } - - output = output + keyStr.charAt(enc1) + keyStr.charAt(enc2) + - keyStr.charAt(enc3) + keyStr.charAt(enc4); - } while (i < input.length); - - return output; -}; - -/** Utility function to base64_decode some arbitrary data, uses the builtin atob() if it exists (Moz) */ - -HTMLArea.base64_decode =function(input) -{ - var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; - var output = ""; - var chr1, chr2, chr3; - var enc1, enc2, enc3, enc4; - var i = 0; - - // remove all characters that are not A-Z, a-z, 0-9, +, /, or = - input = input.replace(/[^A-Za-z0-9\+\/\=]/g, ""); - - do { - enc1 = keyStr.indexOf(input.charAt(i++)); - enc2 = keyStr.indexOf(input.charAt(i++)); - enc3 = keyStr.indexOf(input.charAt(i++)); - enc4 = keyStr.indexOf(input.charAt(i++)); - - chr1 = (enc1 << 2) | (enc2 >> 4); - chr2 = ((enc2 & 15) << 4) | (enc3 >> 2); - chr3 = ((enc3 & 3) << 6) | enc4; - - output = output + String.fromCharCode(chr1); - - if (enc3 != 64) { - output = output + String.fromCharCode(chr2); - } - if (enc4 != 64) { - output = output + String.fromCharCode(chr3); - } - } while (i < input.length); - - return output; -}; - -HTMLArea.removeFromParent = function(el) -{ - if(!el.parentNode) return; - var pN = el.parentNode; - pN.removeChild(el); - return el; -}; - -HTMLArea.hasParentNode = function(el) -{ - if(el.parentNode) - { - // When you remove an element from the parent in IE it makes the parent - // of the element a document fragment. Moz doesn't. - if(el.parentNode.nodeType == 11) - { - return false; - } - return true; - } - - return false; -}; - -if(HTMLArea.is_ie) -{ - HTMLArea.getOuterHTML = function(element) - { - return element.outerHTML; - }; -} -else -{ - HTMLArea.getOuterHTML = function(element) - { - return (new XMLSerializer()).serializeToString(element); - }; -} - -HTMLArea.toFree = [ ]; -HTMLArea.freeLater = function(obj,prop) -{ - HTMLArea.toFree.push({o:obj,p:prop}); -}; - -HTMLArea.free = function(obj, prop) -{ - if(obj && !prop) - { - for(var p in obj) - { - HTMLArea.free(obj, p); - } - } - else if (obj) - { - try{ obj[prop] = null; } catch(e){ } - } -}; - -/** IE's Garbage Collector is broken very badly. We will do our best to - * do it's job for it, but we can't be perfect. - */ - -HTMLArea.collectGarbageForIE = function() -{ - HTMLArea.flushEvents(); - for(var x = 0; x < HTMLArea.toFree.length; x++) - { - if(!HTMLArea.toFree[x].o) alert("What is " + x + ' ' + HTMLArea.toFree[x].o); - HTMLArea.free(HTMLArea.toFree[x].o, HTMLArea.toFree[x].p); - } -}; - -HTMLArea.init(); -HTMLArea.addDom0Event(window,'unload',HTMLArea.collectGarbageForIE); \ No newline at end of file +document.write(''); \ No newline at end of file Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/inline-dialog.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/inline-dialog.js,v diff -u -r1.2 -r1.3 --- openacs-4/packages/acs-templating/www/resources/xinha-nightly/inline-dialog.js 2 Nov 2005 09:20:03 -0000 1.2 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/inline-dialog.js 2 Feb 2007 21:04:45 -0000 1.3 @@ -1,5 +1,5 @@ -HTMLArea.Dialog = function(editor, html, localizer) +Xinha.Dialog = function(editor, html, localizer) { this.id = { }; this.r_id = { }; // reverse lookup id @@ -23,7 +23,7 @@ { this._lc = function(string) { - return HTMLArea._lc(string,localizer); + return Xinha._lc(string,localizer); }; } else @@ -39,7 +39,7 @@ { if(typeof dialog.id[id] == 'undefined') { - dialog.id[id] = HTMLArea.uniq('Dialog'); + dialog.id[id] = Xinha.uniq('Dialog'); dialog.r_id[dialog.id[id]] = id; } return dialog.id[id]; @@ -72,15 +72,15 @@ ); }; -HTMLArea.Dialog.prototype.onresize = function() +Xinha.Dialog.prototype.onresize = function() { return true; }; -HTMLArea.Dialog.prototype.show = function(values) +Xinha.Dialog.prototype.show = function(values) { // We need to preserve the selection for IE - if(HTMLArea.is_ie) + if(Xinha.is_ie) { this._lastRange = this.editor._createRange(this.editor._getSelection()); } @@ -96,23 +96,23 @@ this.rootElem.style.display = ''; }; -HTMLArea.Dialog.prototype.hide = function() +Xinha.Dialog.prototype.hide = function() { this.rootElem.style.display = 'none'; this.editor._textArea.style.display = this._restoreTo[0]; this.editor._iframe.style.visibility = this._restoreTo[1]; this.editor.showPanels(this._restoreTo[2]); // Restore the selection - if(HTMLArea.is_ie) + if(Xinha.is_ie) { this._lastRange.select(); } this.editor.updateToolbar(); return this.getValues(); }; -HTMLArea.Dialog.prototype.toggle = function() +Xinha.Dialog.prototype.toggle = function() { if(this.rootElem.style.display == 'none') { @@ -124,7 +124,7 @@ } }; -HTMLArea.Dialog.prototype.setValues = function(values) +Xinha.Dialog.prototype.setValues = function(values) { for(var i in values) { @@ -209,12 +209,12 @@ } }; -HTMLArea.Dialog.prototype.getValues = function() +Xinha.Dialog.prototype.getValues = function() { var values = [ ]; - var inputs = HTMLArea.collectionToArray(this.rootElem.getElementsByTagName('input')) - .append(HTMLArea.collectionToArray(this.rootElem.getElementsByTagName('textarea'))) - .append(HTMLArea.collectionToArray(this.rootElem.getElementsByTagName('select'))); + var inputs = Xinha.collectionToArray(this.rootElem.getElementsByTagName('input')) + .append(Xinha.collectionToArray(this.rootElem.getElementsByTagName('textarea'))) + .append(Xinha.collectionToArray(this.rootElem.getElementsByTagName('select'))); for(var x = 0; x < inputs.length; x++) { @@ -316,12 +316,12 @@ return values; }; -HTMLArea.Dialog.prototype.getElementById = function(id) +Xinha.Dialog.prototype.getElementById = function(id) { return this.document.getElementById(this.id[id] ? this.id[id] : id); }; -HTMLArea.Dialog.prototype.getElementsByName = function(name) +Xinha.Dialog.prototype.getElementsByName = function(name) { return this.document.getElementsByName(this.id[name] ? this.id[name] : name); }; \ No newline at end of file Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/panel-dialog.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/panel-dialog.js,v diff -u -r1.2 -r1.3 --- openacs-4/packages/acs-templating/www/resources/xinha-nightly/panel-dialog.js 2 Nov 2005 09:20:03 -0000 1.2 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/panel-dialog.js 2 Feb 2007 21:04:45 -0000 1.3 @@ -1,5 +1,5 @@ -HTMLArea.PanelDialog = function(editor, side, html, localizer) +Xinha.PanelDialog = function(editor, side, html, localizer) { this.id = { }; this.r_id = { }; // reverse lookup id @@ -16,7 +16,7 @@ { this._lc = function(string) { - return HTMLArea._lc(string,localizer); + return Xinha._lc(string,localizer); }; } else @@ -32,7 +32,7 @@ { if(typeof dialog.id[id] == 'undefined') { - dialog.id[id] = HTMLArea.uniq('Dialog'); + dialog.id[id] = Xinha.uniq('Dialog'); dialog.r_id[dialog.id[id]] = id; } return dialog.id[id]; @@ -52,25 +52,25 @@ this.rootElem.innerHTML = html; }; -HTMLArea.PanelDialog.prototype.show = function(values) +Xinha.PanelDialog.prototype.show = function(values) { this.editor.showPanel(this.rootElem); }; -HTMLArea.PanelDialog.prototype.hide = function() +Xinha.PanelDialog.prototype.hide = function() { this.editor.hidePanel(this.rootElem); return this.getValues(); }; -HTMLArea.PanelDialog.prototype.onresize = HTMLArea.Dialog.prototype.onresize; +Xinha.PanelDialog.prototype.onresize = Xinha.Dialog.prototype.onresize; -HTMLArea.PanelDialog.prototype.toggle = HTMLArea.Dialog.prototype.toggle; +Xinha.PanelDialog.prototype.toggle = Xinha.Dialog.prototype.toggle; -HTMLArea.PanelDialog.prototype.setValues = HTMLArea.Dialog.prototype.setValues; +Xinha.PanelDialog.prototype.setValues = Xinha.Dialog.prototype.setValues; -HTMLArea.PanelDialog.prototype.getValues = HTMLArea.Dialog.prototype.getValues; +Xinha.PanelDialog.prototype.getValues = Xinha.Dialog.prototype.getValues; -HTMLArea.PanelDialog.prototype.getElementById = HTMLArea.Dialog.prototype.getElementById; +Xinha.PanelDialog.prototype.getElementById = Xinha.Dialog.prototype.getElementById; -HTMLArea.PanelDialog.prototype.getElementsByName = HTMLArea.Dialog.prototype.getElementsByName; \ No newline at end of file +Xinha.PanelDialog.prototype.getElementsByName = Xinha.Dialog.prototype.getElementsByName; \ No newline at end of file Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/popupdiv.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/popupdiv.js,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/popupdiv.js 2 Feb 2007 21:04:45 -0000 1.1 @@ -0,0 +1,369 @@ +/** This file is derived from PopupDiv, developed by Mihai Bazon for + * SamWare.net. Modifications were needed to make it usable in HTMLArea. + * HTMLArea is a free WYSIWYG online HTML editor from InteractiveTools.com. + * + * This file does not function standalone. It is dependent of global functions + * defined in HTMLArea-3.0 (htmlarea.js). + * + * Please see file htmlarea.js for further details. + **/ + +var is_ie = ( (navigator.userAgent.toLowerCase().indexOf("msie") != -1) && + (navigator.userAgent.toLowerCase().indexOf("opera") == -1) ); +var is_compat = (document.compatMode == "BackCompat"); + +function PopupDiv(editor, titleText, handler, initFunction) { + var self = this; + + this.editor = editor; + this.doc = editor._mdoc; + this.handler = handler; + + var el = this.doc.createElement("div"); + el.className = "content"; + + var popup = this.doc.createElement("div"); + popup.className = "dialog popupdiv"; + this.element = popup; + var s = popup.style; + s.position = "absolute"; + s.left = "0px"; + s.top = "0px"; + + var title = this.doc.createElement("div"); + title.className = "title"; + this.title = title; + popup.appendChild(title); + + HTMLArea._addEvent(title, "mousedown", function(ev) { + self._dragStart(is_ie ? window.event : ev); + }); + + var button = this.doc.createElement("div"); + button.className = "button"; + title.appendChild(button); + button.innerHTML = "×"; + title.appendChild(this.doc.createTextNode(titleText)); + this.titleText = titleText; + + button.onmouseover = function() { + this.className += " button-hilite"; + }; + button.onmouseout = function() { + this.className = this.className.replace(/\s*button-hilite\s*/g, " "); + }; + button.onclick = function() { + this.className = this.className.replace(/\s*button-hilite\s*/g, " "); + self.close(); + }; + + popup.appendChild(el); + this.content = el; + + this.doc.body.appendChild(popup); + + this.dragging = false; + this.onShow = null; + this.onClose = null; + this.modal = false; + + initFunction(this); +}; + +PopupDiv.currentPopup = null; + +PopupDiv.prototype.showAtElement = function(el, mode) { + this.defaultSize(); + var pos, ew, eh; + var popup = this.element; + popup.style.display = "block"; + var w = popup.offsetWidth; + var h = popup.offsetHeight; + popup.style.display = "none"; + if (el != window) { + pos = PopupDiv.getAbsolutePos(el); + ew = el.offsetWidth; + eh = el.offsetHeight; + } else { + pos = {x:0, y:0}; + var size = PopupDiv.getWindowSize(); + ew = size.x; + eh = size.y; + } + var FX = false, FY = false; + if (mode.indexOf("l") != -1) { + pos.x -= w; + FX = true; + } + if (mode.indexOf("r") != -1) { + pos.x += ew; + FX = true; + } + if (mode.indexOf("t") != -1) { + pos.y -= h; + FY = true; + } + if (mode.indexOf("b") != -1) { + pos.y += eh; + FY = true; + } + if (mode.indexOf("c") != -1) { + FX || (pos.x += Math.round((ew - w) / 2)); + FY || (pos.y += Math.round((eh - h) / 2)); + } + this.showAt(pos.x, pos.y); +}; + +PopupDiv.prototype.defaultSize = function() { + var s = this.element.style; + var cs = this.element.currentStyle; + var addX = (is_ie && is_compat) ? (parseInt(cs.borderLeftWidth) + + parseInt(cs.borderRightWidth) + + parseInt(cs.paddingLeft) + + parseInt(cs.paddingRight)) : 0; + var addY = (is_ie && is_compat) ? (parseInt(cs.borderTopWidth) + + parseInt(cs.borderBottomWidth) + + parseInt(cs.paddingTop) + + parseInt(cs.paddingBottom)) : 0; + s.display = "block"; + s.width = (this.content.offsetWidth + addX) + "px"; + s.height = (this.content.offsetHeight + this.title.offsetHeight) + "px"; + s.display = "none"; +}; + +PopupDiv.prototype.showAt = function(x, y) { + this.defaultSize(); + var s = this.element.style; + s.display = "block"; + s.left = x + "px"; + s.top = y + "px"; + this.hideShowCovered(); + + PopupDiv.currentPopup = this; + HTMLArea._addEvents(this.doc.body, ["mousedown", "click"], PopupDiv.checkPopup); + HTMLArea._addEvents(this.editor._doc.body, ["mousedown", "click"], PopupDiv.checkPopup); + if (is_ie && this.modal) { + this.doc.body.setCapture(false); + this.doc.body.onlosecapture = function() { + (PopupDiv.currentPopup) && (this.doc.body.setCapture(false)); + }; + } + window.event && HTMLArea._stopEvent(window.event); + + if (typeof this.onShow == "function") { + this.onShow(); + } else if (typeof this.onShow == "string") { + eval(this.onShow); + } + + var field = this.element.getElementsByTagName("input")[0]; + if (!field) { + field = this.element.getElementsByTagName("select")[0]; + } + if (!field) { + field = this.element.getElementsByTagName("textarea")[0]; + } + if (field) { + field.focus(); + } +}; + +PopupDiv.prototype.close = function() { + this.element.style.display = "none"; + PopupDiv.currentPopup = null; + this.hideShowCovered(); + HTMLArea._removeEvents(this.doc.body, ["mousedown", "click"], PopupDiv.checkPopup); + HTMLArea._removeEvents(this.editor._doc.body, ["mousedown", "click"], PopupDiv.checkPopup); + is_ie && this.modal && this.doc.body.releaseCapture(); + if (typeof this.onClose == "function") { + this.onClose(); + } else if (typeof this.onClose == "string") { + eval(this.onClose); + } + this.element.parentNode.removeChild(this.element); +}; + +PopupDiv.prototype.getForm = function() { + var forms = this.content.getElementsByTagName("form"); + return (forms.length > 0) ? forms[0] : null; +}; + +PopupDiv.prototype.callHandler = function() { + var tags = ["input", "textarea", "select"]; + var params = new Object(); + for (var ti = tags.length; --ti >= 0;) { + var tag = tags[ti]; + var els = this.content.getElementsByTagName(tag); + for (var j = 0; j < els.length; ++j) { + var el = els[j]; + params[el.name] = el.value; + } + } + this.handler(this, params); + return false; +}; + +PopupDiv.getAbsolutePos = function(el) { + var r = { x: el.offsetLeft, y: el.offsetTop }; + if (el.offsetParent) { + var tmp = PopupDiv.getAbsolutePos(el.offsetParent); + r.x += tmp.x; + r.y += tmp.y; + } + return r; +}; + +PopupDiv.getWindowSize = function() { + if (window.innerHeight) { + return { y: window.innerHeight, x: window.innerWidth }; + } + if (this.doc.body.clientHeight) { + return { y: this.doc.body.clientHeight, x: this.doc.body.clientWidth }; + } + return { y: this.doc.documentElement.clientHeight, x: this.doc.documentElement.clientWidth }; +}; + +PopupDiv.prototype.hideShowCovered = function () { + var self = this; + function isContained(el) { + while (el) { + if (el == self.element) { + return true; + } + el = el.parentNode; + } + return false; + }; + var tags = new Array("applet", "select"); + var el = this.element; + + var p = PopupDiv.getAbsolutePos(el); + var EX1 = p.x; + var EX2 = el.offsetWidth + EX1; + var EY1 = p.y; + var EY2 = el.offsetHeight + EY1; + + if (el.style.display == "none") { + EX1 = EX2 = EY1 = EY2 = 0; + } + + for (var k = tags.length; k > 0; ) { + var ar = this.doc.getElementsByTagName(tags[--k]); + var cc = null; + + for (var i = ar.length; i > 0;) { + cc = ar[--i]; + if (isContained(cc)) { + cc.style.visibility = "visible"; + continue; + } + + p = PopupDiv.getAbsolutePos(cc); + var CX1 = p.x; + var CX2 = cc.offsetWidth + CX1; + var CY1 = p.y; + var CY2 = cc.offsetHeight + CY1; + + if ((CX1 > EX2) || (CX2 < EX1) || (CY1 > EY2) || (CY2 < EY1)) { + cc.style.visibility = "visible"; + } else { + cc.style.visibility = "hidden"; + } + } + } +}; + +PopupDiv.prototype._dragStart = function (ev) { + if (this.dragging) { + return false; + } + this.dragging = true; + PopupDiv.currentPopup = this; + var posX = ev.clientX; + var posY = ev.clientY; + if (is_ie) { + posY += this.doc.body.scrollTop; + posX += this.doc.body.scrollLeft; + } else { + posY += window.scrollY; + posX += window.scrollX; + } + var st = this.element.style; + this.xOffs = posX - parseInt(st.left); + this.yOffs = posY - parseInt(st.top); + HTMLArea._addEvent(this.doc, "mousemove", PopupDiv.dragIt); + HTMLArea._addEvent(this.doc, "mouseover", HTMLArea._stopEvent); + HTMLArea._addEvent(this.doc, "mouseup", PopupDiv.dragEnd); + HTMLArea._stopEvent(ev); +}; + +PopupDiv.dragIt = function (ev) { + var popup = PopupDiv.currentPopup; + if (!(popup && popup.dragging)) { + return false; + } + is_ie && (ev = window.event); + var posX = ev.clientX; + var posY = ev.clientY; + if (is_ie) { + posY += this.doc.body.scrollTop; + posX += this.doc.body.scrollLeft; + } else { + posY += window.scrollY; + posX += window.scrollX; + } + popup.hideShowCovered(); + var st = popup.element.style; + st.left = (posX - popup.xOffs) + "px"; + st.top = (posY - popup.yOffs) + "px"; + HTMLArea._stopEvent(ev); +}; + +PopupDiv.dragEnd = function () { + var popup = PopupDiv.currentPopup; + if (!popup) { + return false; + } + popup.dragging = false; + HTMLArea._removeEvent(popup.doc, "mouseup", PopupDiv.dragEnd); + HTMLArea._removeEvent(popup.doc, "mouseover", HTMLArea._stopEvent); + HTMLArea._removeEvent(popup.doc, "mousemove", PopupDiv.dragIt); + popup.hideShowCovered(); +}; + +PopupDiv.checkPopup = function (ev) { + is_ie && (ev = window.event); + var el = is_ie ? ev.srcElement : ev.target; + var cp = PopupDiv.currentPopup; + for (; (el != null) && (el != cp.element); el = el.parentNode); + if (el == null) { + cp.modal || ev.type == "mouseover" || cp.close(); + HTMLArea._stopEvent(ev); + } +}; + +PopupDiv.prototype.addButtons = function() { + var self = this; + var div = this.doc.createElement("div"); + this.content.appendChild(div); + div.className = "buttons"; + for (var i = 0; i < arguments.length; ++i) { + var btn = arguments[i]; + var button = this.doc.createElement("button"); + div.appendChild(button); + button.innerHTML = HTMLArea._lc(buttons[btn], 'HTMLArea'); + switch (btn) { + case "ok": + button.onclick = function() { + self.callHandler(); + self.close(); + }; + break; + case "cancel": + button.onclick = function() { + self.close(); + }; + break; + } + } +}; Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/popupwin.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/popupwin.js,v diff -u -r1.3 -r1.4 --- openacs-4/packages/acs-templating/www/resources/xinha-nightly/popupwin.js 11 Nov 2005 20:32:40 -0000 1.3 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/popupwin.js 2 Feb 2007 21:04:45 -0000 1.4 @@ -1,140 +1,178 @@ // (c) dynarch.com 2003-2004 // Distributed under the same terms as HTMLArea itself. -function PopupWin(editor, title, handler, initFunction) { - this.editor = editor; - this.handler = handler; - var dlg = window.open("", "__ha_dialog", - "toolbar=no,menubar=no,personalbar=no,width=600,height=600,left=20,top=40" + - "scrollbars=no,resizable=no"); - this.window = dlg; - var doc = dlg.document; - this.doc = doc; - var self = this; +function PopupWin(editor, title, handler, initFunction) +{ + this.editor = editor; + this.handler = handler; + var dlg = window.open("", "__ha_dialog", "toolbar=no,menubar=no,personalbar=no,width=600,height=600,left=20,top=40,scrollbars=no,resizable=no"); + this.window = dlg; + var doc = dlg.document; + this.doc = doc; + var self = this; - var base = document.baseURI || document.URL; - if (base && base.match(/(.*)\/([^\/]+)/)) { - base = RegExp.$1 + "/"; - } - if (typeof _editor_url != "undefined" && !/^\//.test(_editor_url) && !/http:\/\//.test(_editor_url)) { - // _editor_url doesn't start with '/' which means it's relative - // FIXME: there's a problem here, it could be http:// which - // doesn't start with slash but it's not relative either. - base += _editor_url; - } else - base = _editor_url; - if (!/\/$/.test(base)) { - // base does not end in slash, add it now - base += '/'; - } - this.baseURL = base; + var base = document.baseURI || document.URL; + if ( base && base.match(/(.*)\/([^\/]+)/) ) + { + base = RegExp.$1 + "/"; + } + // @fixme: why using a regex here and not a simple string test ? + if ( typeof _editor_url != "undefined" && ! ( /^\//.test(_editor_url) ) && ! ( /http:\/\//.test(_editor_url) ) ) + { + // _editor_url doesn't start with '/' which means it's relative + // FIXME: there's a problem here, it could be http:// which + // doesn't start with slash but it's not relative either. + base += _editor_url; + } + else + { + base = _editor_url; + } + + // @fixme: why using a regex here and not a simple string test ? + if ( ! ( /\/$/.test(base) ) ) + { + // base does not end in slash, add it now + base += '/'; + } + this.baseURL = base; - doc.open(); - var html = "" + title + "\n"; - // html += "\n"; - html += "\n"; - html += ""; - doc.write(html); - doc.close(); + doc.open(); + var html = "" + title + "\n"; + // html += "\n"; + html += '\n'; + if ( _editor_skin != "" ) + { + html += '\n'; + } + html += "\n"; + html += ''; + doc.write(html); + doc.close(); - // sometimes I Hate Mozilla... ;-( - function init2() { - var body = doc.body; - if (!body) { - setTimeout(init2, 25); - return false; - } - dlg.title = title; - doc.documentElement.style.padding = "0px"; - doc.documentElement.style.margin = "0px"; - var content = doc.createElement("div"); - content.className = "content"; - self.content = content; - body.appendChild(content); - self.element = body; - initFunction(self); - dlg.focus(); - } - init2(); + // sometimes I Hate Mozilla... ;-( + function init2() + { + var body = doc.body; + if ( !body ) + { + setTimeout(init2, 25); + return false; + } + dlg.title = title; + doc.documentElement.style.padding = "0px"; + doc.documentElement.style.margin = "0px"; + var content = doc.createElement("div"); + content.className = "content"; + self.content = content; + body.appendChild(content); + self.element = body; + initFunction(self); + dlg.focus(); + } + init2(); } -PopupWin.prototype.callHandler = function() { - var tags = ["input", "textarea", "select"]; - var params = new Object(); - for (var ti = tags.length; --ti >= 0;) { - var tag = tags[ti]; - var els = this.content.getElementsByTagName(tag); - for (var j = 0; j < els.length; ++j) { - var el = els[j]; - var val = el.value; - if (el.tagName.toLowerCase() == "input") { - if (el.type == "checkbox") { - val = el.checked; - } - } - params[el.name] = val; - } - } - this.handler(this, params); - return false; +PopupWin.prototype.callHandler = function() +{ + var tags = ["input", "textarea", "select"]; + var params = {}; + for ( var ti = tags.length; --ti >= 0; ) + { + var tag = tags[ti]; + var els = this.content.getElementsByTagName(tag); + for ( var j = 0; j < els.length; ++j ) + { + var el = els[j]; + var val = el.value; + if ( el.tagName.toLowerCase() == "input" ) + { + if ( el.type == "checkbox" ) + { + val = el.checked; + } + } + params[el.name] = val; + } + } + this.handler(this, params); + return false; }; -PopupWin.prototype.close = function() { - this.window.close(); +PopupWin.prototype.close = function() +{ + this.window.close(); }; -PopupWin.prototype.addButtons = function() { - var self = this; - var div = this.doc.createElement("div"); - this.content.appendChild(div); - div.className = "buttons"; - for (var i = 0; i < arguments.length; ++i) { - var btn = arguments[i]; - var button = this.doc.createElement("button"); - div.appendChild(button); - button.innerHTML = HTMLArea._lc(btn, 'HTMLArea'); - switch (btn.toLowerCase()) { - case "ok": - HTMLArea.addDom0Event(button, 'click', - function() { - self.callHandler(); - self.close(); - return false; - }); - break; - case "cancel": - HTMLArea.addDom0Event(button, 'click', function() { - self.close(); - return false; - }); - break; - } - } +PopupWin.prototype.addButtons = function() +{ + // @fixme: isn't self a predefined variable used to access self frame in most browsers ? + // if yes, then we break it here + var self = this; + var div = this.doc.createElement("div"); + this.content.appendChild(div); + div.id = "buttons"; + div.className = "buttons"; + for ( var i = 0; i < arguments.length; ++i ) + { + var btn = arguments[i]; + var button = this.doc.createElement("button"); + div.appendChild(button); + button.innerHTML = HTMLArea._lc(btn, 'HTMLArea'); + switch (btn.toLowerCase()) + { + case "ok": + HTMLArea.addDom0Event(button, 'click', + function() + { + self.callHandler(); + self.close(); + return false; + } + ); + break; + case "cancel": + HTMLArea.addDom0Event(button, 'click', + function() + { + self.close(); + return false; + } + ); + break; + } + } }; -PopupWin.prototype.showAtElement = function() { - var self = this; - // Mozilla needs some time to realize what's goin' on.. - setTimeout(function() { - var w = self.content.offsetWidth + 4; - var h = self.content.offsetHeight + 4; - // size to content -- that's fuckin' buggy in all fuckin' browsers!!! - // so that we set a larger size for the dialog window and then center - // the element inside... phuck! +PopupWin.prototype.showAtElement = function() +{ + var self = this; + // Mozilla needs some time to realize what's goin' on.. + setTimeout(function() + { + var w = self.content.offsetWidth + 4; + var h = self.content.offsetHeight + 4; + // size to content -- that's fuckin' buggy in all fuckin' browsers!!! + // so that we set a larger size for the dialog window and then center + // the element inside... phuck! - // center... - var el = self.content; - var s = el.style; - // s.width = el.offsetWidth + "px"; - // s.height = el.offsetHeight + "px"; - s.position = "absolute"; - s.left = (w - el.offsetWidth) / 2 + "px"; - s.top = (h - el.offsetHeight) / 2 + "px"; - if (HTMLArea.is_gecko) { - self.window.innerWidth = w; - self.window.innerHeight = h; - } else { - self.window.resizeTo(w + 8, h + 35); - } - }, 25); + // center... + var el = self.content; + var s = el.style; + // s.width = el.offsetWidth + "px"; + // s.height = el.offsetHeight + "px"; + s.position = "absolute"; + s.left = parseInt((w - el.offsetWidth) / 2, 10) + "px"; + s.top = parseInt((h - el.offsetHeight) / 2, 10) + "px"; + if (HTMLArea.is_gecko) + { + self.window.innerWidth = w; + self.window.innerHeight = h; + } + else + { + self.window.resizeTo(w + 8, h + 35); + } + }, + 25); }; \ No newline at end of file Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/release-notes.txt =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/release-notes.txt,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/release-notes.txt 2 Feb 2007 21:04:45 -0000 1.1 @@ -0,0 +1,34 @@ +Xinha - The Community-Built Online HTML Editor + +For bug reports, forum, and updates go to +http://xinha.org + +Release History + +Xinha 0.92beta + - fixed Ticket #831 stop empty anchors from being removed + - Make htmlarea.js just load XinhaCore.js instead of being a copy of it. + - fixed Ticket #445 Toggle TableBorder doesn't work if this.fullpage=true or using FullPage plugin + - fixed Ticket #551 shape and coord attributes of area element are ignored by IE + - fixed Ticket #650 SpellChecker is not compatible with FullPage plugin + - fixed Ticket #816 CharacterMap and ListType panel modes make editor jump to top in IE + - fixed Ticket #570 change behaviour of justify when an image is selected to make the image float left/right, + click the justify button again to undo it + - fixed Ticket #891 noscript content got escaped + - fixed Ticket #857 Firefox fails to load in fullpage mode when tag in wrong place. + - fixed Ticket #841 Spell Checker - Won't return to xinha. + - fixed Ticket #914 All buttons stay grey & this.getParentElement is not a function message when not calling + Xinha.loadPlugins() in xinha_init function + - fixed Ticket #911 Background color does not work in Firefox + - fixed Ticket #912 an error is thrown in Mozilla when clicking merge cells button and fewer than 2 cells are selected + +Xinha 0.91beta + - changed namespace from HTMLArea to Xinha + - the core file is now named XinhaCore.js instead of htmlarea.js, + please change your pages accordingly (the htmlarea.js will be removed!) + - the color picker script is now loaded on demand to reduce initial loading time + +Xinha 0.9beta +This equals Xinha revision 635 of Jan 11 2007 + - All JavaScript files over 2kb have been compressed using the dojo JavaScript compressor + - All gifs have been optimized using Trout's GIF Optimizer version 2.3 \ No newline at end of file Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/contrib/compress.bat =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/contrib/compress.bat,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/contrib/compress.bat 2 Feb 2007 21:04:45 -0000 1.1 @@ -0,0 +1,7 @@ +@echo off +FOR %%V IN (%*) DO copy %%V %%V_uncompressed.js +FOR %%V IN (%*) DO java -jar %~p0dojo_js_compressor.jar -c %%V_uncompressed.js > %%V 2>&1 + +FOR %%V IN (%*) DO del %%V_uncompressed.js + +# pause \ No newline at end of file Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/contrib/compression_readme.txt =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/contrib/compression_readme.txt,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/contrib/compression_readme.txt 2 Feb 2007 21:04:45 -0000 1.1 @@ -0,0 +1,6 @@ +You can use the compress.bat to compress JavaScript files by drag&drop in Windows. + +Please be aware that the language files cannot be compressed. + +If you want the original files to be kept, open compress.bat and remvove the # in the line +# FOR %%V IN (%*) DO del %%V_uncompressed.js \ No newline at end of file Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/contrib/dojo_js_compressor.jar =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/contrib/Attic/dojo_js_compressor.jar,v diff -u Binary files differ Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/contrib/lc_parse_strings.php =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/contrib/lc_parse_strings.php,v diff -u -r1.2 -r1.3 --- openacs-4/packages/acs-templating/www/resources/xinha-nightly/contrib/lc_parse_strings.php 2 Nov 2005 09:20:04 -0000 1.2 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/contrib/lc_parse_strings.php 2 Feb 2007 21:04:45 -0000 1.3 @@ -1,5 +1,5 @@ + * with (xinha_config.ImageManager) + * { + * '/home/your/directory', + * 'images_url' => '/directory' + * ) + * ) + * ?> + * } + * + * + */ + + function xinha_pass_to_php_backend($Data, $KeyLocation = 'Xinha:BackendKey') + { + + $bk = array(); + $bk['data'] = serialize($Data); + + @session_start(); + if(!isset($_SESSION[$KeyLocation])) + { + $_SESSION[$KeyLocation] = uniqid('Key_'); + } + + $bk['session_name'] = session_name(); + $bk['key_location'] = $KeyLocation; + $bk['hash'] = + function_exists('sha1') ? + sha1($_SESSION[$KeyLocation] . $bk['data']) + : md5($_SESSION[$KeyLocation] . $bk['data']); + + + // The data will be passed via a postback to the + // backend, we want to make sure these are going to come + // out from the PHP as an array like $bk above, so + // we need to adjust the keys. + $backend_data = array(); + foreach($bk as $k => $v) + { + $backend_data["backend_data[$k]"] = $v; + } + + // The session_start() above may have been after data was sent, so cookies + // wouldn't have worked. + $backend_data[session_name()] = session_id(); + + echo 'backend_data = ' . xinha_to_js($backend_data) . "; \n"; + + } + + /** Convert PHP data structure to Javascript */ + + function xinha_to_js($var, $tabs = 0) + { + if(is_numeric($var)) + { + return $var; + } + + if(is_string($var)) + { + return "'" . xinha_js_encode($var) . "'"; + } + + if(is_array($var)) + { + $useObject = false; + foreach(array_keys($var) as $k) { + if(!is_numeric($k)) $useObject = true; + } + $js = array(); + foreach($var as $k => $v) + { + $i = ""; + if($useObject) { + if(preg_match('#^[a-zA-Z]+[a-zA-Z0-9]*$#', $k)) { + $i .= "$k: "; + } else { + $i .= "'$k': "; + } + } + $i .= xinha_to_js($v, $tabs + 1); + $js[] = $i; + } + if($useObject) { + $ret = "{\n" . xinha_tabify(implode(",\n", $js), $tabs) . "\n}"; + } else { + $ret = "[\n" . xinha_tabify(implode(",\n", $js), $tabs) . "\n]"; + } + return $ret; + } + + return 'null'; + } + + /** Like htmlspecialchars() except for javascript strings. */ + + function xinha_js_encode($string) + { + static $strings = "\\,\",',%,&,<,>,{,},@,\n,\r"; + + if(!is_array($strings)) + { + $tr = array(); + foreach(explode(',', $strings) as $chr) + { + $tr[$chr] = sprintf('\x%02X', ord($chr)); + } + $strings = $tr; + } + + return strtr($string, $strings); + } + + + /** Used by plugins to get the config passed via + * xinha_pass_to_backend() + * returns either the structure given, or NULL + * if none was passed or a security error was encountered. + */ + + function xinha_read_passed_data() + { + if(isset($_REQUEST['backend_data']) && is_array($_REQUEST['backend_data'])) + { + $bk = $_REQUEST['backend_data']; + session_name($bk['session_name']); + @session_start(); + if(!isset($_SESSION[$bk['key_location']])) return NULL; + + if($bk['hash'] === + function_exists('sha1') ? + sha1($_SESSION[$bk['key_location']] . $bk['data']) + : md5($_SESSION[$bk['key_location']] . $bk['data'])) + { + return unserialize(ini_get('magic_quotes_gpc') ? stripslashes($bk['data']) : $bk['data']); + } + } + + return NULL; + } + + /** Used by plugins to get a query string that can be sent to the backend + * (or another part of the backend) to send the same data. + */ + + function xinha_passed_data_querystring() + { + $qs = array(); + if(isset($_REQUEST['backend_data']) && is_array($_REQUEST['backend_data'])) + { + foreach($_REQUEST['backend_data'] as $k => $v) + { + $v = ini_get('magic_quotes_gpc') ? stripslashes($v) : $v; + $qs[] = "backend_data[" . rawurlencode($k) . "]=" . rawurlencode($v); + } + } + + $qs[] = session_name() . '=' . session_id(); + return implode('&', $qs); + } + + + /** Just space-tab indent some text */ + function xinha_tabify($text, $tabs) + { + if($text) + { + return str_repeat(" ", $tabs) . preg_replace('/\n(.)/', "\n" . str_repeat(" ", $tabs) . "\$1", $text); + } + } + + /** Return upload_max_filesize value from php.ini in kilobytes (function adapted from php.net)**/ + function upload_max_filesize_kb() + { + $val = ini_get('upload_max_filesize'); + $val = trim($val); + $last = strtolower($val{strlen($val)-1}); + switch($last) + { + // The 'G' modifier is available since PHP 5.1.0 + case 'g': + $val *= 1024; + case 'm': + $val *= 1024; + } + return $val; +} +?> \ No newline at end of file Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/examples/custom.css =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/examples/custom.css,v diff -u -r1.2 -r1.3 --- openacs-4/packages/acs-templating/www/resources/xinha-nightly/examples/custom.css 2 Nov 2005 09:20:04 -0000 1.2 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/examples/custom.css 2 Feb 2007 21:04:45 -0000 1.3 @@ -4,9 +4,9 @@ -- @TODO Make this CSS more useful. -- -- $HeadURL: http://svn.xinha.python-hosting.com/trunk/examples/custom.css $ - -- $LastChangedDate: 2005-02-19 17:10:03 +1300 (Sat, 19 Feb 2005) $ - -- $LastChangedRevision: 14 $ - -- $LastChangedBy: gogo $ + -- $LastChangedDate: 2007-01-20 11:24:36 +1300 (Sat, 20 Jan 2007) $ + -- $LastChangedRevision: 677 $ + -- $LastChangedBy: ray $ --------------------------------------------------------------------------*/ body { background-color: #234; color: #dd8; font-family: tahoma; font-size: 12px; } Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/examples/dynamic.css =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/examples/dynamic.css,v diff -u -r1.2 -r1.3 --- openacs-4/packages/acs-templating/www/resources/xinha-nightly/examples/dynamic.css 2 Nov 2005 09:20:04 -0000 1.2 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/examples/dynamic.css 2 Feb 2007 21:04:45 -0000 1.3 @@ -4,9 +4,9 @@ -- @TODO Make this CSS more useful. -- -- $HeadURL: http://svn.xinha.python-hosting.com/trunk/examples/dynamic.css $ - -- $LastChangedDate: 2005-02-19 17:10:03 +1300 (Sat, 19 Feb 2005) $ - -- $LastChangedRevision: 14 $ - -- $LastChangedBy: gogo $ + -- $LastChangedDate: 2007-01-20 11:24:36 +1300 (Sat, 20 Jan 2007) $ + -- $LastChangedRevision: 677 $ + -- $LastChangedBy: ray $ --------------------------------------------------------------------------*/ p { Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/examples/ext_example-body.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/examples/ext_example-body.html,v diff -u -r1.3 -r1.4 --- openacs-4/packages/acs-templating/www/resources/xinha-nightly/examples/ext_example-body.html 4 Jun 2006 00:45:49 -0000 1.3 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/examples/ext_example-body.html 2 Feb 2007 21:04:45 -0000 1.4 @@ -4,14 +4,14 @@ Example of Xinha - + - + Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/examples/ext_example-menu.php =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/examples/ext_example-menu.php,v diff -u -r1.3 -r1.4 --- openacs-4/packages/acs-templating/www/resources/xinha-nightly/examples/ext_example-menu.php 4 Jun 2006 00:45:49 -0000 1.3 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/examples/ext_example-menu.php 2 Feb 2007 21:04:45 -0000 1.4 @@ -1,6 +1,6 @@ @@ -10,10 +10,10 @@ -- frame to provide a menu for generating example editors using -- full_example-body.html, and full_example.js. -- - -- $HeadURL$ - -- $LastChangedDate$ - -- $LastChangedRevision$ - -- $LastChangedBy$ + -- $HeadURL: http://svn.xinha.python-hosting.com/trunk/examples/ext_example-menu.php $ + -- $LastChangedDate: 2007-01-20 11:24:36 +1300 (Sat, 20 Jan 2007) $ + -- $LastChangedRevision: 677 $ + -- $LastChangedBy: ray $ ---------------------------------------------------------------------------> @@ -140,15 +140,15 @@ // capture some window's events function capwin(w) { -// HTMLArea._addEvent(w, "click", Dialog._parentEvent); -// HTMLArea._addEvent(w, "mousedown", Dialog._parentEvent); -// HTMLArea._addEvent(w, "focus", Dialog._parentEvent); +// Xinha._addEvent(w, "click", Dialog._parentEvent); +// Xinha._addEvent(w, "mousedown", Dialog._parentEvent); +// Xinha._addEvent(w, "focus", Dialog._parentEvent); }; // release the captured events function relwin(w) { -// HTMLArea._removeEvent(w, "click", Dialog._parentEvent); -// HTMLArea._removeEvent(w, "mousedown", Dialog._parentEvent); -// HTMLArea._removeEvent(w, "focus", Dialog._parentEvent); +// Xinha._removeEvent(w, "click", Dialog._parentEvent); +// Xinha._removeEvent(w, "mousedown", Dialog._parentEvent); +// Xinha._removeEvent(w, "focus", Dialog._parentEvent); }; capwin(window); // capture other frames @@ -259,12 +259,20 @@
read())) //not a dot file or directory { if(substr($entry,0,1) != '.') - { echo ''."\n"; + { + $dir_array[] = $entry; } } $d->close(); + sort($dir_array); + foreach ($dir_array as $entry) + { + echo ''."\n"; + } + ?>
Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/examples/ext_example.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/examples/ext_example.html,v diff -u -r1.3 -r1.4 --- openacs-4/packages/acs-templating/www/resources/xinha-nightly/examples/ext_example.html 4 Jun 2006 00:45:49 -0000 1.3 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/examples/ext_example.html 2 Feb 2007 21:04:45 -0000 1.4 @@ -3,10 +3,10 @@ Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/examples/ext_example.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/examples/ext_example.js,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/examples/ext_example.js 2 Feb 2007 21:04:45 -0000 1.1 @@ -0,0 +1,155 @@ + + /*--------------------------------------:noTabs=true:tabSize=2:indentSize=2:-- + -- Xinha example logic. This javascript is used to auto-generate examples + -- as controlled by the options set in full_example-menu.html. it's called + -- from full_example-body.html. + -- + -- $HeadURL$ + -- $LastChangedDate$ + -- $LastChangedRevision$ + -- $LastChangedBy$ + --------------------------------------------------------------------------*/ + + var num = 1; + if(window.parent && window.parent != window) + { + var f = window.parent.menu.document.forms[0]; + _editor_lang = f.lang.value; + _editor_skin = f.skin.value; + num = parseInt(f.num.value); + if(isNaN(num)) + { + num = 1; + f.num.value = 1; + } + xinha_plugins = [ ]; + for(var x = 0; x < f.plugins.length; x++) + { + if(f.plugins[x].checked) xinha_plugins.push(f.plugins[x].value); + } + } + + xinha_editors = [ ] + for(var x = 0; x < num; x++) + { + var ta = 'myTextarea' + x; + xinha_editors.push(ta); + } + + xinha_config = function() + { + var config = new HTMLArea.Config(); + + if(window.parent && window.parent != window) { + var f = window.parent.menu.document.forms[0]; + if (f.width) config.width = f.width.value; + if (f.height) config.height = f.height.value; + if (f.sizeIncludesBars) config.sizeIncludesBars = f.sizeIncludesBars.value; + if (f.statusBar) config.statusBar = f.statusBar.value; + if (f.mozParaHandler) config.mozParaHandler = f.mozParaHandler.value; + if (f.undoSteps) config.undoSteps = f.undoSteps.value; + if (f.baseHref) config.baseHref = f.baseHref.value; + if (f.stripBaseHref) config.stripBaseHref = f.stripBaseHref.value; + if (f.stripSelfNamedAnchors) config.stripSelfNamedAnchors = f.stripSelfNamedAnchors.value; + if (f.only7BitPrintablesInURLs) config.only7BitPrintablesInURLs = f.only7BitPrintablesInURLs.value; + if (f.sevenBitClean) config.sevenBitClean = f.sevenBitClean.value; + if (f.killWordOnPaste) config.killWordOnPaste = f.killWordOnPaste.value; + if (f.flowToolbars) config.flowToolbars = f.flowToolbars.value; + if ((typeof CharacterMap != 'undefined') && (f.CharacterMapMode)) config.CharacterMap.mode = f.CharacterMapMode.value; + if ((typeof ListType != 'undefined') && (f.ListTypeMode)) config.ListType.mode = f.ListTypeMode.value; + } + + if(typeof CSS != 'undefined') + { + config.pageStyle = "@import url(custom.css);"; + } + + if(typeof Stylist != 'undefined') + { + // We can load an external stylesheet like this - NOTE : YOU MUST GIVE AN ABSOLUTE URL + // otherwise it won't work! + config.stylistLoadStylesheet(document.location.href.replace(/[^\/]*\.html/, 'stylist.css')); + + // Or we can load styles directly + config.stylistLoadStyles('p.red_text { color:red }'); + + // If you want to provide "friendly" names you can do so like + // (you can do this for stylistLoadStylesheet as well) + config.stylistLoadStyles('p.pink_text { color:pink }', {'p.pink_text' : 'Pretty Pink'}); + } + + if(typeof DynamicCSS != 'undefined') + { + config.pageStyle = "@import url(dynamic.css);"; + } + + if(typeof InsertWords != 'undefined') + { + // Register the keyword/replacement list + var keywrds1 = new Object(); + var keywrds2 = new Object(); + + keywrds1['-- Dropdown Label --'] = ''; + keywrds1['onekey'] = 'onevalue'; + keywrds1['twokey'] = 'twovalue'; + keywrds1['threekey'] = 'threevalue'; + + keywrds2['-- Insert Keyword --'] = ''; + keywrds2['Username'] = '%user%'; + keywrds2['Last login date'] = '%last_login%'; + config.InsertWords = { + combos : [ { options: keywrds1, context: "body" }, + { options: keywrds2, context: "li" } ] + } + + } + // Path for InsertPicture plugin + if(typeof InsertPicture != 'undefined') { + InsertPicture.PicturePath = '/schmal/pictures/'; + } + + return config; + } + + + var f = document.forms[0]; + f.method = 'post'; + f.action = 'ext_example-dest.php'; + f.innerHTML = ''; + + var lipsum = document.getElementById('lipsum').innerHTML; + + for(var x = 0; x < num; x++) + { + var ta = 'myTextarea' + x; + + var div = document.createElement('div'); + div.className = 'area_holder'; + + var txta = document.createElement('textarea'); + txta.id = ta; + txta.name = ta; + txta.value = lipsum; + txta.style.width="100%"; + txta.style.height="420px"; + + div.appendChild(txta); + f.appendChild(div); + } + + //check submitted values + var submit = document.createElement('input'); + submit.type = "submit"; + submit.value = "Submit"; + f.appendChild(submit); + + var _oldSubmitHandler = null; + if (document.forms[0].onsubmit != null) { + _oldSubmitHandler = document.forms[0].onsubmit; + } + function frame_onSubmit(){ + if (_oldSubmitHandler != null) { + _oldSubmitHandler(); + } + } + document.forms[0].onsubmit = frame_onSubmit; Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/examples/full_example-body.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/examples/full_example-body.html,v diff -u -r1.2 -r1.3 --- openacs-4/packages/acs-templating/www/resources/xinha-nightly/examples/full_example-body.html 2 Nov 2005 09:20:04 -0000 1.2 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/examples/full_example-body.html 2 Feb 2007 21:04:45 -0000 1.3 @@ -11,14 +11,14 @@ -- use of the file as a boilerplate. -- -- $HeadURL: http://svn.xinha.python-hosting.com/trunk/examples/full_example-body.html $ - -- $LastChangedDate: 2005-07-28 02:43:19 +1200 (Thu, 28 Jul 2005) $ - -- $LastChangedRevision: 287 $ - -- $LastChangedBy: gocher $ + -- $LastChangedDate: 2006-09-26 07:14:02 +1200 (Tue, 26 Sep 2006) $ + -- $LastChangedRevision: 592 $ + -- $LastChangedBy: koto $ ---------------------------------------------------------------------------> Example of Xinha - + + Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/examples/full_example-menu.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/examples/full_example-menu.html,v diff -u -r1.2 -r1.3 --- openacs-4/packages/acs-templating/www/resources/xinha-nightly/examples/full_example-menu.html 2 Nov 2005 09:20:04 -0000 1.2 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/examples/full_example-menu.html 2 Feb 2007 21:04:45 -0000 1.3 @@ -1,4 +1,4 @@ - + + + + + + + + + + + + + +
+ + + +
+ + + \ No newline at end of file Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/examples/stylist.css =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/examples/stylist.css,v diff -u -r1.2 -r1.3 --- openacs-4/packages/acs-templating/www/resources/xinha-nightly/examples/stylist.css 2 Nov 2005 09:20:04 -0000 1.2 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/examples/stylist.css 2 Feb 2007 21:04:45 -0000 1.3 @@ -3,9 +3,9 @@ -- when the Stylist plugin is included in an auto-generated example. -- -- $HeadURL: http://svn.xinha.python-hosting.com/trunk/examples/stylist.css $ - -- $LastChangedDate: 2005-07-19 18:23:58 +1200 (Tue, 19 Jul 2005) $ - -- $LastChangedRevision: 277 $ - -- $LastChangedBy: gogo $ + -- $LastChangedDate: 2007-01-20 11:24:36 +1300 (Sat, 20 Jan 2007) $ + -- $LastChangedRevision: 677 $ + -- $LastChangedBy: ray $ --------------------------------------------------------------------------*/ .bluetext Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/examples/testbed.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/examples/testbed.html,v diff -u -r1.2 -r1.3 --- openacs-4/packages/acs-templating/www/resources/xinha-nightly/examples/testbed.html 2 Nov 2005 09:20:04 -0000 1.2 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/examples/testbed.html 2 Feb 2007 21:04:45 -0000 1.3 @@ -13,10 +13,10 @@ -- of the file to remove the auto-example-generating code and allow for the -- use of the file as a boilerplate. -- - -- $HeadURL: svn://gogo@xinha.gogo.co.nz/repository/trunk/examples/full_example-body.html $ - -- $LastChangedDate: 2005-03-05 21:42:32 +1300 (Sat, 05 Mar 2005) $ - -- $LastChangedRevision: 35 $ - -- $LastChangedBy: gogo $ + -- $HeadURL: http://svn.xinha.python-hosting.com/trunk/examples/testbed.html $ + -- $LastChangedDate: 2007-01-20 11:24:36 +1300 (Sat, 20 Jan 2007) $ + -- $LastChangedRevision: 677 $ + -- $LastChangedBy: ray $ ---------------------------------------------------------------------------> @@ -54,10 +54,10 @@ xinha_plugins = xinha_plugins ? xinha_plugins : [ - + 'CharacterMap', 'SpellChecker', 'Linker' ]; // THIS BIT OF JAVASCRIPT LOADS THE PLUGINS, NO TOUCHING :) - if(!HTMLArea.loadPlugins(xinha_plugins, xinha_init)) return; + if(!Xinha.loadPlugins(xinha_plugins, xinha_init)) return; /** STEP 2 *************************************************************** * Now, what are the names of the textareas you will be turning into @@ -76,13 +76,15 @@ * * If you want to modify the default config you might do something like this. * - * xinha_config = new HTMLArea.Config(); + * xinha_config = new Xinha.Config(); * xinha_config.width = 640; * xinha_config.height = 420; * *************************************************************************/ - xinha_config = xinha_config ? xinha_config : new HTMLArea.Config(); + xinha_config = xinha_config ? xinha_config : new Xinha.Config(); + xinha_config.fullPage = true; + xinha_config.CharacterMap.mode = 'panel'; /* // We can load an external stylesheet like this - NOTE : YOU MUST GIVE AN ABSOLUTE URL // otherwise it won't work! @@ -100,19 +102,19 @@ * * You can do this in two ways, either * - * xinha_editors = HTMLArea.makeEditors(xinha_editors, xinha_config, xinha_plugins); + * xinha_editors = Xinha.makeEditors(xinha_editors, xinha_config, xinha_plugins); * * if you want all the editor objects to use the same set of plugins, OR; * - * xinha_editors = HTMLArea.makeEditors(xinha_editors, xinha_config); + * xinha_editors = Xinha.makeEditors(xinha_editors, xinha_config); * xinha_editors['myTextArea'].registerPlugins(['Stylist','FullScreen']); * xinha_editors['anotherOne'].registerPlugins(['CSS','SuperClean']); * * if you want to use a different set of plugins for one or more of the * editors. ************************************************************************/ - xinha_editors = HTMLArea.makeEditors(xinha_editors, xinha_config, xinha_plugins); + xinha_editors = Xinha.makeEditors(xinha_editors, xinha_config, xinha_plugins); /** STEP 4 *************************************************************** * If you want to change the configuration variables of any of the @@ -130,19 +132,32 @@ * Xinha editors. ************************************************************************/ - HTMLArea.startEditors(xinha_editors); + Xinha.startEditors(xinha_editors); window.onload = null; } window.onload = xinha_init; - // window.onunload = HTMLArea.collectGarbageForIE; + // window.onunload = Xinha.collectGarbageForIE;
Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/images/xinha_logo.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/images/xinha_logo.gif,v diff -u Binary files differ Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/lang/de.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/lang/de.js,v diff -u -r1.2 -r1.3 --- openacs-4/packages/acs-templating/www/resources/xinha-nightly/lang/de.js 2 Nov 2005 09:20:05 -0000 1.2 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/lang/de.js 2 Feb 2007 21:04:45 -0000 1.3 @@ -61,7 +61,7 @@ "Cancel": "Abbrechen", "Path": "Pfad", "You are in TEXT MODE. Use the [<>] button to switch back to WYSIWYG.": "Sie sind im Text-Modus. Benutzen Sie den [<>] Button, um in den visuellen Modus (WYSIWIG) zu gelangen.", - "The Paste button does not work in Mozilla based web browsers (technical security reasons). Press CTRL-V on your keyboard to paste directly.": "Aus Sicherheitsgründen dürfen Skripte normalerweise nicht auf Ausschneiden/Kopieren/Einfügen zugreifen. Bitte klicken Sie OK um die technische Erläuterung auf mozilla.org zu öffnen, in der erklärt wird, wie einem Skript Zugriff gewährt werden kann.", + "The Paste button does not work in Mozilla based web browsers (technical security reasons). Press CTRL-V on your keyboard to paste directly.": "Aus Sicherheitsgründen dürfen Skripte normalerweise nicht auf Ausschneiden/Kopieren/Einfügen zugreifen. Benutzen Sie bitte die entsprechenden Tastatur-Kommandos (Strg + x/c/v).", "You need to select some text before create a link": "Sie müssen einen Text markieren, um einen Link zu erstellen", "Your Document is not well formed. Check JavaScript console for details.": "Ihr Dokument ist in keinem sauberen Format. Benutzen Sie die Javascript Console für weitere Informationen.", @@ -144,5 +144,20 @@ "Set format to paragraph": "Setze Formatierung auf Absatz", "Clean content pasted from Word": "Von Word eingefügter Text bereinigen", "Headings": "Überschrift Typ 1 bis 6", - "Close": "Schließen" + "Close": "Schließen", + + // Loading messages + "Loading in progress. Please wait !": "Editor wird geladen. Bitte warten !", + "Constructing main object": "Hauptteil wird erzeugt", + "Create Toolbar": "Bearbeitungswerkzeuge werden angelegt", + "Register panel right": "Erzeugt rechte Leiste", + "Register panel left": "Erzeugt linke Leiste", + "Register panel top": "Erzeugt obere Leiste", + "Register panel bottom": "Erzeugt untere Leiste", + + // ColorPicker + "Click a color..." : "Farbe wählen", + "Sample" : "Beispiel", + "Web Safe: " : "Web Safe: ", + "Color: " : "Farbe: " }; \ No newline at end of file Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/lang/fa.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/lang/fa.js,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/lang/fa.js 2 Feb 2007 21:04:45 -0000 1.1 @@ -0,0 +1,167 @@ +// I18N constants +// LANG: "fa", ENCODING: UTF-8 +{ + "Bold": "ضخیم", + "Italic": "مورب", + "Underline": "زیر خط", + "Strikethrough": "رو خط", + "Subscript": "زیروند", + "Superscript": "بالاوند", + "Justify Left": "تراز از چپ", + "Justify Center": "تراز در وسط", + "Justify Right": "تراز در راست", + "Justify Full": "تراز از چپ و راست", + "Ordered List": "فهرست مرتب", + "Bulleted List": "فهرست گلوله ای", + "Decrease Indent": "کاهش سر خط", + "Increase Indent": "افزایش سر خط", + "Font Color": "رنگ فلم", + "Background Color": "رنگ پس زمینه", + "Horizontal Rule": "خط افقی", + "Insert Web Link": "افزودن لینک وب", + "Insert/Modify Image": "افزودن یا ویرایش تصویر", + "Insert Table": "افزودن جدول", + "Toggle HTML Source": "مشاهده یا عدم مشاهده متن در قالب HTML", + "Enlarge Editor": "بزرگ کردن ویرایش گر", + "About this editor": "درباره این ویرایش گر", + "Help using editor": "راهنمای استفاده ویرایش گر", + "Current style": "شیوه کنونی", + "Undoes your last action": "برگرداندن آخرین عمل", + "Redoes your last action": "انجام مجدد آخرین عمل", + "Cut selection": "بریدن انتخاب شده", + "Copy selection": "کپی انتخاب شده", + "Paste from clipboard": "چسباندن از تخته کار", + "Direction left to right": "جهت از چپ به راست", + "Direction right to left": "جهت از راست به چپ", + "Remove formatting": "حذف فرمت بندی", + "Select all": "انتخاب همه", + "Print document": "چاپ سند", + "Clear MSOffice tags": "پاک کردن متن از برچسب های MSOffice", + "Clear Inline Font Specifications": "پاک کردن متن از مشخصات فونت", + "Would you like to clear font typefaces?": "آیا تمایل دارید ظاهر فلم را پاک کنید؟", + "Would you like to clear font sizes?": "آیا تمایل دارید اندازه قلم را پاک کنید", + "Would you like to clear font colours?": "آیا تمایل دارید رنگ قلم را پاک کنید؟", + "Split Block": "بلاک جداسازی", + "Toggle Borders": "فعال/غیر فعال کردن لبه ها", + "Save as": "ذخیره مانند...", + "Insert/Overwrite": "افزودن/جانویسی", + "— format —": "— قالب —", + "Heading 1": "تیتر 1", + "Heading 2": "تیتر 2", + "Heading 3": "تیتر 3", + "Heading 4": "تیتر 4", + "Heading 5": "تیتر 5", + "Heading 6": "تیتر 6", + "Normal": "معمولی", + "Address": "آدرس", + "Formatted": "قالب بندی شده", + + //dialogs + "OK": "بله", + "Cancel": "انصراف", + "Path": "مسیر", + "You are in TEXT MODE. Use the [<>] button to switch back to WYSIWYG.": "در مد متنی هستید. از دکمه [<>] استفاده نمایید تا به مد WYSIWYG برگردید.", + "The Paste button does not work in Mozilla based web browsers (technical security reasons). Press CTRL-V on your keyboard to paste directly.": "دکمه چسباندن در مرورگرهای سری Mozilla کار نمی کند (به دلایل فنی امنیتی).برای چسباندن مستقیم ، دکمه CTRL-V را در صفحه کلید بزنید.", + "Your Document is not well formed. Check JavaScript console for details.": "سند شما بدرستی قالب بندی نشده است. برای اطلاعات بیشتر پایانه نمایش جاوااسکریپت را بررسی کنید.", + + "Alignment:": "تراز بندی", + "Not set": "تنظیم نشده", + "Left": "چپ", + "Right": "راست", + "Texttop": "بالای متن", + "Absmiddle": "دقیقا وسط", + "Baseline": "ابتدای خط", + "Absbottom": "دقیقا پایین", + "Bottom": "پایین", + "Middle": "وسط", + "Top": "بالا", + + "Layout": "لایه", + "Spacing": "فاصله گذاری", + "Horizontal:": "افقی", + "Horizontal padding": "پرکننده افقی", + "Vertical:": "عمودی", + "Vertical padding": "پرکننده عمودی", + "Border thickness:": "ضخامت لبه", + "Leave empty for no border": "برای بدون لبه خالی رها کن", + + //Insert Link + "Insert/Modify Link": "افزودن / ویرایش لینک", + "None (use implicit)": "هیچکدام (استفاده از بدون شرط)", + "New window (_blank)": "پنجره جدید (_blank)", + "Same frame (_self)": "فریم یکسان (_self)", + "Top frame (_top)": "فریم بالایی (_top)", + "Other": "سایر", + "Target:": "هدف", + "Title (tooltip):": "عنوان (راهنمای یک خطی)", + "URL:": "URL:", + "You must enter the URL where this link points to": "باید URLی که این لینک به آن اشاره دارد را وارد کنید", + "You need to select some text before creating a link": "باید قبل از ساخت لینک ، متنی را انتخاب نمایید", + + // Insert Table + "Insert Table": "افزودن جدول", + "Rows:": "ردیف ها", + "Number of rows": "تعداد ردیف ها", + "Cols:": "ستون ها", + "Number of columns": "تعداد ستون ها", + "Width:": "طول", + "Width of the table": "طول جدول", + "Percent": "درصد", + "Pixels": "پیکسل ها", + "Em": "Em", + "Width unit": "واحد طول", + "Fixed width columns": "ستون های طول ثابت", + "Positioning of this table": "موقعیت یابی این جدول", + "Cell spacing:": "فاصله سلول ها", + "Space between adjacent cells": "فاصله بین سلول های همجوار", + "Cell padding:": "پر کننده سلول", + "Space between content and border in cell": "فاصله بین محتوا و لبه در سلول", + "You must enter a number of rows": "باید تعداد ردیف ها را وارد کنید", + "You must enter a number of columns": "باید تعداد ستون ها را وارد کنید", + + // Insert Image + "Insert Image": "افزودن تصویر", + "Image URL:": "URL تصویر", + "Enter the image URL here": "URL تصویر را اینجا وارد کنید", + "Preview": "پیش نمایش", + "Preview the image in a new window": "پیش نمایش تصویر در پنجره ای جدید", + "Alternate text:": "متن جایگزین", + "For browsers that don't support images": "برای مرورگرهایی که از تصاویر پشتیبانی نمی کنند", + "Positioning of this image": "موقعیت یابی تصویر", + "Image Preview:": "پیش نمایش تصویر", + "You must enter the URL": "شما باید URL را وارد کنید", + + // toolbar + "button_bold": "fr/bold.gif", + "button_underline": "fr/underline.gif", + "button_strikethrough": "fr/strikethrough.gif", + + // Editor Help + "Xinha Help": "راهنمای Xinha", + "Editor Help": "راهنمای ویرایشگر", + "Keyboard shortcuts": "میانبرهای صفحه کلید", + "The editor provides the following key combinations:": "ویرایشگر استفاده از کلید های گروهی زیر را مسیر می سازد :", + "ENTER": "ENTREE", + "new paragraph": "پاراگراف جدید", + "SHIFT-ENTER": "SHIFT+ENTREE", + "insert linebreak": "افزودن جدا کننده خط", + "Set format to paragraph": "تغییر قالب به پاراگراف", + "Clean content pasted from Word": "تمیز کردن محتوای چسبانده شده از Word", + "Headings": "عنوان گذاری", + "Close": "بستن", + + // Loading messages + "Loading in progress. Please wait !": "بارگذاری در حال انجام است. لطفا صبر کنید !", + "Constructing main object": "ساختن شیء اصلی", + "Constructing object": "ساختن شیء", + "Register panel right": "ثبت قاب راست", + "Register panel left": "ثبت قاب چپ", + "Register panel top": "ثبت قاب بالا", + "Register panel bottom": "ثبت قاب پایین", + "Create Toolbar": "ساخت نوار ابزار", + "Create StatusBar": "ساخت نوار وضعیت", + "Generate Xinha object": "تولید شیء Xinha", + "Init editor size": "مقدار دهی اندازه ویرایشگر", + "Init IFrame": "مقدار دهی IFrame", + "Register plugin $plugin": "ثبت پلاگین $plugin" +}; \ No newline at end of file Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/lang/fr.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/lang/fr.js,v diff -u -r1.3 -r1.4 --- openacs-4/packages/acs-templating/www/resources/xinha-nightly/lang/fr.js 4 Jun 2006 00:45:49 -0000 1.3 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/lang/fr.js 2 Feb 2007 21:04:45 -0000 1.4 @@ -148,5 +148,20 @@ "Set format to paragraph": "Applique le format paragraphe", "Clean content pasted from Word": "Nettoyage du contenu copié depuis Word", "Headings": "Titres", - "Close": "Fermer" + "Close": "Fermer", + + // Loading messages + "Loading in progress. Please wait !": "Chargement en cours. Veuillez patienter !", + "Constructing main object": "Construction de l'objet principal", + "Constructing object": "Construction de l'objet", + "Register panel right": "Enregistrement du panneau droit", + "Register panel left": "Enregistrement du panneau gauche", + "Register panel top": "Enregistrement du panneau supérieur", + "Register panel bottom": "Enregistrement du panneau inférieur", + "Create Toolbar": "Construction de la barre d'icones", + "Create StatusBar": "Construction de la barre de status", + "Generate Xinha object": "Génération de l'objet Xinha", + "Init editor size": "Initialisation de la taille d'édition", + "Init IFrame": "Initialisation de l'iframe", + "Register plugin $plugin": "Enregistrement du plugin $plugin" }; \ No newline at end of file Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/lang/nb.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/lang/nb.js,v diff -u -r1.2 -r1.3 --- openacs-4/packages/acs-templating/www/resources/xinha-nightly/lang/nb.js 2 Nov 2005 09:20:05 -0000 1.2 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/lang/nb.js 2 Feb 2007 21:04:45 -0000 1.3 @@ -1,31 +1,78 @@ // I18N constants -// LANG: "en", ENCODING: UTF-8 +// LANG: "nb", ENCODING: UTF-8 +// - translated by ses +// Additional translations by Håvard Wigtil +// Additional translations by Kim Steinhaug + { "Bold": "Fet", "Italic": "Kursiv", "Underline": "Understreket", "Strikethrough": "Gjennomstreket", - "Subscript": "Senket", - "Superscript": "Hevet", + "Subscript": "Nedsenket", + "Superscript": "Opphøyet", "Justify Left": "Venstrejuster", "Justify Center": "Midtjuster", "Justify Right": "Høyrejuster", "Justify Full": "Blokkjuster", "Ordered List": "Nummerert liste", - "Bulleted List": "Punktmerket liste", - "Decrease Indent": "Øke innrykk", - "Increase Indent": "Reduser innrykk", - "Font Color": "Skriftfarge", - "Background Color": "Bakgrunnsfarge", - "Horizontal Rule": "Horisontal linje", - "Insert Web Link": "Sett inn lenke", + "Bulleted List": "Punktliste", + "Decrease Indent": "Reduser innrykk", + "Increase Indent": "Øke innrykk", + "Font Color": "Tekstfarge", + "Background Color": "Bakgrundsfarge", + "Horizontal Rule": "Vannrett linje", + "Insert Web Link": "Lag lenke", "Insert/Modify Image": "Sett inn bilde", "Insert Table": "Sett inn tabell", - "Toggle HTML Source": "Vis HTML kode", - "Enlarge Editor": "Forstørr redigeringsvindu", - "About this editor": "Om..", + "Toggle HTML Source": "Vis kildekode", + "Enlarge Editor": "Vis i eget vindu", + "About this editor": "Om denne editor", "Help using editor": "Hjelp", - "Current style": "Gjeldende stil" -} + "Current style": "Nåværende stil", + "Undoes your last action": "Angrer siste redigering", + "Redoes your last action": "Gjør om siste angring", + "Cut selection": "Klipp ut område", + "Copy selection": "Kopier område", + "Save as": "Lagre som", + "Paste from clipboard": "Lim inn", + "Remove formatting": "Fjern formattering", + "Direction left to right": "Fra venstre mot høyre", + "Direction right to left": "Fra høyre mot venstre", + "Insert/Overwrite": "Sett inn/Overskriv", + "OK": "OK", + "Cancel": "Avbryt", + "Path": "Tekstvelger", + "You are in TEXT MODE. Use the [<>] button to switch back to WYSIWYG.": "Du er i tekstmodus Klikk på [<>] for å gå tilbake til WYSIWIG.", + "The full screen mode is known to cause problems with Internet Explorer, due to browser bugs that we weren": "Visning i eget vindu har kjente problemer med Internet Explorer, på grunn av problemer med denne nettleseren. Mulige problemer er et uryddig skjermbilde, manglende editorfunksjoner og/eller at nettleseren crasher. Hvis du bruker Windows 95 eller Windows 98 er det også muligheter for at Windows will crashe.\n\nTrykk ", + "Cancel": "Avbryt", + "Insert/Modify Link": "Rediger lenke", + "New window (_blank)": "Eget vindu (_blank)", + "None (use implicit)": "Ingen (bruk standardinnstilling)", + "Other": "Annen", + "Same frame (_self)": "Samme ramme (_self)", + "Target:": "Mål:", + "Title (tooltip):": "Tittel (tooltip):", + "Top frame (_top)": "Toppramme (_top)", + "URL:": "Adresse:", + "You must enter the URL where this link points to": "Du må skrive inn en adresse som denne lenken skal peke til", + "Clear Inline Font Specifications": "Fjerne inline font spesifikasjoner", + "Would you like to clear font typefaces?": "Ønsker du å fjerne skrifttyper", + "Would you like to clear font sizes?": "Ønsker du å fjerne skrift størrelser", + "Would you like to clear font colours?": "Ønsker du å fjerne farger på skriften", + "Print document": "Skriv ut dokumentet", + "Split Block": "Seperasjonsblokk", + "Toggle Borders": "Skru av/på hjelpelinjer på tabeller", + "Select all": "Merk alt", + // Loading messages + "Loading in progress. Please wait !": "WYSIWYG laster, vennligst vent!", + "Constructing main object": "Vennligst vent", + "Create Toolbar": "Lag verktøylinje", + "Register panel right": "Registrer høyrepanel", + "Register panel left": "Registrer venstrepanel", + "Register panel top": "Registrer toppanel", + "Register panel bottom": "Registrer bunnpanel" + +}; Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/lang/no.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/lang/no.js,v diff -u -r1.2 -r1.3 --- openacs-4/packages/acs-templating/www/resources/xinha-nightly/lang/no.js 2 Nov 2005 09:20:05 -0000 1.2 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/lang/no.js 2 Feb 2007 21:04:45 -0000 1.3 @@ -66,4 +66,13 @@ "Split Block": "Seperasjonsblokk", "Toggle Borders": "Skru av/på hjelpelinjer på tabeller", "Select all": "Merk alt" + // Loading messages + "Loading in progress. Please wait !": "WYSIWYG laster, vennligst vent!", + "Constructing main object": "Vennligst vent", + "Create Toolbar": "Lag verktøylinje", + "Register panel right": "Registrer høyrepanel", + "Register panel left": "Registrer venstrepanel", + "Register panel top": "Registrer toppanel", + "Register panel bottom": "Registrer bunnpanel" + }; Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/lang/pl.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/lang/pl.js,v diff -u -r1.2 -r1.3 --- openacs-4/packages/acs-templating/www/resources/xinha-nightly/lang/pl.js 2 Nov 2005 09:20:05 -0000 1.2 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/lang/pl.js 2 Feb 2007 21:04:45 -0000 1.3 @@ -65,9 +65,9 @@ "Left": "Do lewej", "Right": "Do prawej", "Texttop": "Góra tekstu", - "Absmiddle": "Absolutny środek", + "Absmiddle": "Abs. środek", "Baseline": "Linia bazowa", - "Absbottom": "Absolutny dół", + "Absbottom": "Abs. dół", "Bottom": "Dół", "Middle": "Środek", "Top": "Góra", @@ -107,7 +107,7 @@ "Width unit": "Jednostka", "Fixed width columns": "Kolumny o stałej szerokości", "Positioning of this table": "Pozycjonowanie tabeli", - "Cell spacing:": "Spacjowanie komórek:", + "Cell spacing:": "Odstęp komórek:", "Space between adjacent cells": "Przestrzeń pomiędzy komórkami", "Cell padding:": "Wcięcie komórek:", "Space between content and border in cell": "Przestrzeń między krawędzią a zawartością komórki", Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/lang/ru.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/lang/ru.js,v diff -u -r1.2 -r1.3 --- openacs-4/packages/acs-templating/www/resources/xinha-nightly/lang/ru.js 2 Nov 2005 09:20:05 -0000 1.2 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/lang/ru.js 2 Feb 2007 21:04:45 -0000 1.3 @@ -3,6 +3,10 @@ // LANG: "ru", ENCODING: UTF-8 // Author: Yulya Shtyryakova, +// Some additions by: Alexey Kirpichnikov, +// I took French version as a source of English phrases because French version was the most comprehensive +// (fr.js was the largest file, actually) %) + // FOR TRANSLATORS: // // 1. PLEASE PUT YOUR CONTACT INFO IN THE ABOVE LINE @@ -23,8 +27,8 @@ "Justify Center": "По центру", "Justify Right": "По правому краю", "Justify Full": "По ширине", - "Ordered List": "Нумерованный лист", - "Bulleted List": "Маркированный лист", + "Ordered List": "Нумерованный список", + "Bulleted List": "Маркированный список", "Decrease Indent": "Уменьшить отступ", "Increase Indent": "Увеличить отступ", "Font Color": "Цвет шрифта", @@ -43,8 +47,139 @@ "Cut selection": "Вырезать", "Copy selection": "Копировать", "Paste from clipboard": "Вставить", + "Direction left to right": "Направление слева направо", + "Direction right to left": "Направление справа налево", + "Remove formatting": "Убрать форматирование", + "Select all": "Выделить все", + "Print document": "Печать", + "Clear MSOffice tags": "Удалить разметку MSOffice", + "Clear Inline Font Specifications": "Удалить непосредственное задание шрифтов", + "Would you like to clear font typefaces?": "Удалить типы шрифтов?", + "Would you like to clear font sizes?": "Удалить размеры шрифтов ?", + "Would you like to clear font colours?": "Удалить цвета шрифтов ?", + "Split Block": "Разделить блок", + "Toggle Borders": "Включить/выключить отображение границ", + "Save as": "Сохранить как", + "Insert/Overwrite": "Вставка/замена", + "— format —": "— форматирование —", + "Heading 1": "Заголовок 1", + "Heading 2": "Заголовок 2", + "Heading 3": "Заголовок 3", + "Heading 4": "Заголовок 4", + "Heading 5": "Заголовок 5", + "Heading 6": "Заголовок 6", + "Normal": "Обычный текст", + "Address": "Адрес", + "Formatted": "Отформатированный текст", + + "— font —": "— шрифт —", + "— size —": "— размер —", + + +// Диалоги + "OK": "OK", "Cancel": "Отмена", "Path": "Путь", - "You are in TEXT MODE. Use the [<>] button to switch back to WYSIWYG.": "Вы в режиме отображения Html-кода. нажмите кнопку [<>], чтобы переключиться в визуальный режим." -} + "You are in TEXT MODE. Use the [<>] button to switch back to WYSIWYG.": "Вы в режиме отображения Html-кода. нажмите кнопку [<>], чтобы переключиться в визуальный режим.", + +"The Paste button does not work in Mozilla based web browsers (technical security reasons). Press CTRL-V on your keyboard to paste directly.": "Кнопка Вставить не работает в браузерах на основе Mozilla (по техническим причинам, связанным с безопасностью). Нажмите Ctrl-V на клавиатуре, чтобы вставить.", + + "Your Document is not well formed. Check JavaScript console for details.": "Ваш документ неправильно сформирован. Посмотрите Консоль JavaScript, чтобы узнать подробности.", + + "Alignment:": "Выравнивание", + "Not set": "Не установлено", + "Left": "По левому краю", + "Right": "По правому краю", + "Texttop": "По верхней границе текста", + "Absmiddle": "По середине текста", + "Baseline": "По нижней границе текста", + "Absbottom": "По нижней границе", + "Bottom": "По нижнему краю", + "Middle": "Посредине", + "Top": "По верхнему краю", + + "Layout": "Расположение", + "Spacing": "Поля", + "Horizontal:": "По горизонтали", + "Horizontal padding": "Горизонтальные поля", + "Vertical:": "По вертикали", + "Vertical padding": "Вертикальные поля", + "Border thickness:": "Толщина рамки", + "Leave empty for no border": "Оставьте пустым, чтобы убрать рамку", + + //Insert Link + "Insert/Modify Link": "Вставка/изменение ссылки", + "None (use implicit)": "По умолчанию", + "New window (_blank)": "Новое окно (_blank)", + "Same frame (_self)": "То же окно (_self)", + "Top frame (_top)": "Родительское окно (_top)", + "Other": "Другое", + "Target:": "Открывать в окне:", + "Title (tooltip):": "Всплывающая подсказка", + "URL:": "URL:", + "You must enter the URL where this link points to": "Вы должны указать URL, на который будет указывать ссылка", + "You need to select some text before creating a link": "Вы должны выделить текст, который будет преобразован в ссылку", + + // Insert Table + "Insert Table": "Вставка таблицы", + "Rows:": "Строки", + "Number of rows": "Количество строк", + "Cols:": "Столбцы", + "Number of columns": "Количество столбцов", + "Width:": "Ширина", + "Width of the table": "Ширина таблицы", + "Percent": "проценты", + "Pixels": "пикселы", + "Em": "em", + "Width unit": "Единицы измерения", + "Fixed width columns": "Столбцы фиксированной ширины", + "Positioning of this table": "Расположение таблицы", + "Cell spacing:": "Расстояние между ячейками", + "Space between adjacent cells": "Расстояние между соседними ячейками", + "Cell padding:": "Поля в ячейках", + "Space between content and border in cell": "Расстояние между границей ячейки и текстом", + "You must enter a number of rows": "Вы должны ввести количество строк", + "You must enter a number of columns": "Вы должны ввести количество столбцов", + + // Insert Image + "Insert Image": "Вставка изображения", + "Image URL:": "URL изображения", + "Enter the image URL here": "Вставьте адрес изображения", + "Preview": "Предварительный просмотр", + "Preview the image in a new window": "Предварительный просмотр в отдельном окне", + "Alternate text:": "Альтернативный текст", + "For browsers that don't support images": "Для браузеров, которые не отображают картинки", + "Positioning of this image": "Расположение изображения", + "Image Preview:": "Предварительный просмотр", + "You must enter the URL": "Вы должны ввести URL", + + // Editor Help + "Xinha Help": "Помощь", + "Editor Help": "Помощь", + "Keyboard shortcuts": "Горячие клавиши", + "The editor provides the following key combinations:": "Редактор поддерживает следующие комбинации клавиш:", + "ENTER": "ENTER", + "new paragraph": "новый абзац", + "SHIFT-ENTER": "SHIFT+ENTER", + "insert linebreak": "перенос строки", + "Set format to paragraph": "Отформатировать абзац", + "Clean content pasted from Word": "Очистить текст, вставленный из Word", + "Headings": "Заголовки", + "Close": "Закрыть", + + // Loading messages + "Loading in progress. Please wait !": "Загрузка... Пожалуйста, подождите.", + "Constructing main object": "Создание главного объекта", + "Constructing object": "Создание объекта", + "Register panel right": "Регистрация правой панели", + "Register panel left": "Регистрация левой панели", + "Register panel top": "Регистрация верхней панели", + "Register panel bottom": "Регистрация нижней панели", + "Create Toolbar": "Создание панели инструментов", + "Create StatusBar": "Создание панели состояния", + "Generate Xinha object": "Создание объекта Xinha", + "Init editor size": "Инициализация размера редактора", + "Init IFrame": "инициализация iframe", + "Register plugin $plugin": "Регистрация $plugin" +}; Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/lang/sv.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/lang/sv.js,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/lang/sv.js 2 Feb 2007 21:04:45 -0000 1.1 @@ -0,0 +1,116 @@ +// I18N constants +// LANG: "sv", ENCODING: UTF-8 + +// Swedish version for htmlArea v3.0 +// Initital translation by pat +// Synced with additional contants in rev. 477 (Mar 2006) by Thomas Loo + +{ + "Bold": "Fet", + "Italic": "Kursiv", + "Underline": "Understruken", + "Strikethrough": "Genomstruken", + "Subscript": "Nedsänkt", + "Superscript": "Upphöjd", + "Justify Left": "Vänsterjustera", + "Justify Center": "Centrera", + "Justify Right": "Högerjustera", + "Justify Full": "Marginaljustera", + "Ordered List": "Numrerad lista", + "Bulleted List": "Punktlista", + "Decrease Indent": "Minska indrag", + "Increase Indent": "Öka indrag", + "Font Color": "Textfärg", + "Background Color": "Bakgrundsfärg", + "Horizontal Rule": "Vågrät linje", + "Insert Web Link": "Infoga länk", + "Insert/Modify Image": "Infoga bild", + "Toggle HTML Source": "Visa källkod", + "Enlarge Editor": "Visa i eget fönster", + "About this editor": "Om denna editor", + "Help using editor": "Hjälp", + "Current style": "Nuvarande stil", + + "Undoes your last action": "Ångra kommando", + "Redoes your last action": "Upprepa kommando", + "Select all": "Markera allt", + "Print document": "Skriv ut", + "Clear MSOffice tags": "Städa bort MS Office taggar", + "Clear Inline Font Specifications": "Rensa inbäddad typsnittsinformation", + "Remove formatting": "Rensa formattering", + "Toggle Borders": "Objektramar", + "Split Block": "Dela block", + "Direction left to right": "Vänster till höger", + "Direction right to left": "Höger till vänster", + + "Insert/Overwrite": "Infoga/Skriv över", + "OK": "OK", + "Cancel": "Avbryt", + "Path": "Objekt", + "You are in TEXT MODE. Use the [<>] button to switch back to WYSIWYG.": "Du befinner dig i texläge. Klicka på ikonen [<>] ovan för att växla tillbaka till WYSIWIG läge", + "The full screen mode is known to cause problems with Internet Explorer, due to browser bugs that we weren": "Visning i fullskärmsläga fungerar dåligt i din webläsare. Möjliga problem resulterar i en ryckig editor, saknade editorfunktioner och/eller att webläsaren kraschar. Om du använder Windows 95/98 finns också möjligheten att Windows kraschar.\n\nTryck ", + "The Paste button does not work in Mozilla based web browsers (technical security reasons). Press CTRL-V on your keyboard to paste directly.": "Denna knapp fungerar ej i Mozillabaserad webläsare, använd istället snabbtangenterna CTRL-V på tangentbordet för att klistra in.", + + "Insert/Modify Link": "Redigera länk", + "New window (_blank)": "Nytt fönster (_blank)", + "None (use implicit)": "Ingen (använd standardinställing)", + "Other": "Annan", + "Same frame (_self)": "Samma ram (_self)", + "Target:": "Mål:", + "Title (tooltip):": "Titel (tooltip):", + "Top frame (_top)": "Toppram (_top)", + "URL:": "Sökväg:", + "You must enter the URL where this link points to": "Du måsta ange en adress till vilken länken skall peka på", + "Would you like to clear font typefaces?": "Radera alla typsnittsinformation ?", + "Would you like to clear font sizes?": "Radera alla fontstorlekar ?", + "Would you like to clear font colours?": "Ta bort all textfärger ?", + + "You need to select some text before creating a link": "Du måsta markera ett objekt att applicera länken på!", + + // Insert Table + "Insert Table": "Infoga tabell", + "Rows:": "Rader:", + "Number of rows": "Antal rader", + "Cols:": "Kolumner:", + "Number of columns": "Antal kolumner", + "Width:": "Bredd:", + "Width of the table": "Tabellbredd", + "Percent": "Procent", + "Pixels": "Pixlar", + "Em": "", + "Width unit": "Breddenheter", + "Fixed width columns": "Fixerad bredd", + "Alignment:": "Marginaljustering", + "Positioning of this table": "Tabellposition", + "Border thickness:": "Ramtjocklek", + "Leave empty for no border": "Lämna fältet tomt för att undvika ramar", + "Spacing": "Cellegenskaper", + "Cell spacing:": "Cellmarginaler:", + "Space between adjacent cells": "Utrymme mellan celler", + "Cell padding:": "Cellindrag:", + "Space between content and border in cell": "Utrymme mellan ram och cellinnehåll", + "You must enter a number of rows": "Ange ental rader", + "You must enter a number of columns": "Ange antal kolumner", + + // Editor Help + "Keyboard shortcuts": "Snabbtangenter", + "The editor provides the following key combinations:": "Editorn nyttjar följande kombinationer:", + "new paragraph": "Ny paragraf ", + "insert linebreak": "Infoga radbrytning ", + "Set format to paragraph": "Aktivera paragrafläge", + "Clean content pasted from Word": "Rensa innehåll inklistrat från MS Word", + "Headings": "Skapa standardrubrik", + "Cut selection": "Klipp ut markering", + "Copy selection": "Kopiera markering", + "Paste from clipboard": "Klistra in", + "Close": "Stäng", + + // Loading messages + "Loading in progress. Please wait !": "Editorn laddas. Vänta...", + "Constructing main object": "Skapar huvudobjekt", + "Create Toolbar": "Skapar verktygspanel", + "Register panel right": "Registerar panel höger", + "Register panel left": "Registerar panel vänster", + "Register panel top": "Registerar toppanel", + "Register panel bottom": "Registerar fotpanel" +} Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/modules/ColorPicker/ColorPicker.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/modules/ColorPicker/ColorPicker.js,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/modules/ColorPicker/ColorPicker.js 2 Feb 2007 21:04:46 -0000 1.1 @@ -0,0 +1,825 @@ + + /** + * Gogo Internet Services Color Picker Javascript Widget + * colorPicker for short. + * + * @author James Sleeman + * @date June, 2005 + * + * The colorPicker class provides access to a color map for selecting + * colors which will be passed back to a callback (usually such a callback would + * write the RGB hex value returned into a field, but that's up to you). + * + * The color map presented is a standard rectangular pallate with 0->360 degrees of + * hue on the Y axis and 0->100% saturation on the X axis, the value (brightness) is + * selectable as a vertical column of grey values. Also present is a one row of + * white->grey->black for easy selection of these colors. + * + * A checkbox is presented, which when checked will force the palatte into "web safe" + * mode, only colours in the "web safe palatte" of 216 colors will be shown, the palatte + * is adjusted so that the normal blend of colours are "rounded" to the nearest web safe + * one. It should be noted that "web safe" colours really are a thing of the past, + * not only can pretty much every body display several million colours, but it's actually + * been found that of those 216 web safe colours only 20 to 30 are actually going to be + * displayed equally on the majority of monitors, and those are mostly yellows! + * + * =Usage Example= + * {{{ + * "; + break; + } + return html; +}; + +/** @see getHTMLWrapper (search for "value = a.nodeValue;") */ Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/modules/GetHtml/TransformInnerHTML.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/modules/GetHtml/TransformInnerHTML.js,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/modules/GetHtml/TransformInnerHTML.js 2 Feb 2007 21:04:47 -0000 1.1 @@ -0,0 +1,209 @@ +/** + * Based on XML_Utility functions submitted by troels_kn. + * credit also to adios, who helped with reg exps: + * http://www.sitepoint.com/forums/showthread.php?t=201052 + * + * A replacement for HTMLArea.getHTML + * + * Features: + * - Generates XHTML code + * - Much faster than HTMLArea.getHTML + * - Eliminates the hacks to accomodate browser quirks + * - Returns correct code for Flash objects and scripts + * - Formats html in an indented, readable format in html mode + * - Preserves script and pre formatting + * - Preserves formatting in comments + * - Removes contenteditable from body tag in full-page mode + * - Supports only7BitPrintablesInURLs config option + * - Supports htmlRemoveTags config option + */ + +function GetHtmlImplementation(editor) { + this.editor = editor; +} + +GetHtmlImplementation._pluginInfo = { + name : "GetHtmlImplementation TransformInnerHTML", + version : "1.0", + developer : "Nelson Bright", + developer_url : "http://www.brightworkweb.com/", + sponsor : "", + sponsor_url : "", + license : "htmlArea" +}; + +HTMLArea.RegExpCache = [ +/*00*/ new RegExp().compile(/<\s*\/?([^\s\/>]+)[\s*\/>]/gi),//lowercase tags +/*01*/ new RegExp().compile(/(\s+)_moz[^=>]*=[^\s>]*/gi),//strip _moz attributes +/*02*/ new RegExp().compile(/\s*=\s*(([^'"][^>\s]*)([>\s])|"([^"]+)"|'([^']+)')/g),// find attributes +/*03*/ new RegExp().compile(/\/>/g),//strip singlet terminators +/*04*/ new RegExp().compile(/<(br|hr|img|input|link|meta|param|embed|area)((\s*\S*="[^"]*")*)>/g),//terminate singlet tags +/*05*/ new RegExp().compile(/(checked|compact|declare|defer|disabled|ismap|multiple|no(href|resize|shade|wrap)|readonly|selected)([\s>])/gi),//expand singlet attributes +/*06*/ new RegExp().compile(/(="[^']*)'([^'"]*")/),//check quote nesting +/*07*/ new RegExp().compile(/&(?=[^<]*>)/g),//expand query ampersands +/*08*/ new RegExp().compile(/<\s+/g),//strip tagstart whitespace +/*09*/ new RegExp().compile(/\s+(\/)?>/g),//trim whitespace +/*10*/ new RegExp().compile(/\s{2,}/g),//trim extra whitespace +/*11*/ new RegExp().compile(/\s+([^=\s]+)((="[^"]+")|([\s>]))/g),// lowercase attribute names +/*12*/ new RegExp().compile(/\s+contenteditable(=[^>\s\/]*)?/gi),//strip contenteditable +/*13*/ new RegExp().compile(/((href|src)=")([^\s]*)"/g), //find href and src for stripBaseHref() +/*14*/ new RegExp().compile(/<\/?(div|p|h[1-6]|table|tr|td|th|ul|ol|li|blockquote|object|br|hr|img|embed|param|pre|script|html|head|body|meta|link|title|area|input|form|textarea|select|option)[^>]*>/g), +/*15*/ new RegExp().compile(/<\/(div|p|h[1-6]|table|tr|ul|ol|blockquote|object|html|head|body|script|form|select)( [^>]*)?>/g),//blocklevel closing tag +/*16*/ new RegExp().compile(/<(div|p|h[1-6]|table|tr|ul|ol|blockquote|object|html|head|body|script|form|select)( [^>]*)?>/g),//blocklevel opening tag +/*17*/ new RegExp().compile(/<(td|th|li|option|br|hr|embed|param|pre|meta|link|title|area|input|textarea)[^>]*>/g),//singlet tag or output on 1 line +/*18*/ new RegExp().compile(/(^|<\/(pre|script)>)(\s|[^\s])*?(<(pre|script)[^>]*>|$)/g),//find content NOT inside pre and script tags +/*19*/ new RegExp().compile(/(]*>)([\s\S])*?(<\/pre>)/g),//find content inside pre tags +/*20*/ new RegExp().compile(/(^|)([\s\S]*?)(?=|$)/g),//find content NOT inside comments +/*21*/ new RegExp().compile(/\S*=""/g), //find empty attributes +/*22*/ new RegExp().compile(/|<\?[\s\S]*?\?>|<\/?\w[^>]*>/g), //find all tags, including comments and php +/*23*/ new RegExp().compile(/(^|<\/script>)[\s\S]*?(]*>|$)/g) //find content NOT inside script tags +]; + +/** + * Cleans HTML into wellformed xhtml + */ +HTMLArea.prototype.cleanHTML = function(sHtml) { + var c = HTMLArea.RegExpCache; + sHtml = sHtml. + replace(c[0], function(str) { return str.toLowerCase(); } ).//lowercase tags/attribute names + replace(c[1], ' ').//strip _moz attributes + replace(c[12], ' ').//strip contenteditable + replace(c[2], '="$2$4$5"$3').//add attribute quotes + replace(c[21], ' ').//strip empty attributes + replace(c[11], function(str, p1, p2) { return ' '+p1.toLowerCase()+p2; }).//lowercase attribute names + replace(c[3], '>').//strip singlet terminators + replace(c[9], '$1>').//trim whitespace + replace(c[5], '$1="$1"$3').//expand singlet attributes + replace(c[4], '<$1$2 />').//terminate singlet tags + replace(c[6], '$1$2').//check quote nesting + // replace(c[7], '&').//expand query ampersands + replace(c[8], '<').//strip tagstart whitespace + replace(c[10], ' ');//trim extra whitespace + if(HTMLArea.is_ie && c[13].test(sHtml)) { + sHtml = sHtml.replace(c[13],'$1'+this.stripBaseURL(RegExp.$3)+'"'); + } + if(this.config.only7BitPrintablesInURLs) { + if (HTMLArea.is_ie) c[13].test(sHtml); // oddly the test below only triggers when we call this once before (IE6), in Moz it fails if tested twice + if ( c[13].test(sHtml)) { + try { //Mozilla returns an incorrectly encoded value with innerHTML + sHtml = sHtml.replace(c[13], '$1'+decodeURIComponent(RegExp.$3).replace(/([^!-~]+)/g,function(chr){return escape(chr);})+'"'); + } catch (e) { // once the URL is escape()ed, you can't decodeURIComponent() it anymore + sHtml = sHtml.replace(c[13], '$1'+RegExp.$3.replace(/([^!-~]+)/g,function(chr){return escape(chr);})+'"'); + } + } + } + return sHtml; +}; + +/** + * Prettyfies html by inserting linebreaks before tags, and indenting blocklevel tags + */ +HTMLArea.indent = function(s, sindentChar) { + HTMLArea.__nindent = 0; + HTMLArea.__sindent = ""; + HTMLArea.__sindentChar = (typeof sindentChar == "undefined") ? " " : sindentChar; + var c = HTMLArea.RegExpCache; + if(HTMLArea.is_gecko) { //moz changes returns into
inside
 tags
+		s = s.replace(c[19], function(str){return str.replace(/
/g,"\n")}); + } + s = s.replace(c[18], function(strn) { //skip pre and script tags + strn = strn.replace(c[20], function(st,$1,$2) { //exclude comments + string = $2.replace(/[\n\r]/gi, " ").replace(/\s+/gi," ").replace(c[14], function(str) { + if (str.match(c[16])) { + var s = "\n" + HTMLArea.__sindent + str; + // blocklevel openingtag - increase indent + HTMLArea.__sindent += HTMLArea.__sindentChar; + ++HTMLArea.__nindent; + return s; + } else if (str.match(c[15])) { + // blocklevel closingtag - decrease indent + --HTMLArea.__nindent; + HTMLArea.__sindent = ""; + for (var i=HTMLArea.__nindent;i>0;--i) { + HTMLArea.__sindent += HTMLArea.__sindentChar; + } + return "\n" + HTMLArea.__sindent + str; + } else if (str.match(c[17])) { + // singlet tag + return "\n" + HTMLArea.__sindent + str; + } + return str; // this won't actually happen + }); + return $1 + string; + });return strn; + }); + //final cleanup + s = s.replace(/^\s*/,'').//strip leading whitespace + replace(/ +\n/g,'\n').//strip spaces at end of lines + replace(/[\r\n]+<\/script>/g,'\n');//strip returns added into scripts + return s; +}; + +HTMLArea.getHTML = function(root, outputRoot, editor) { + var html = ""; + var c = HTMLArea.RegExpCache; + + if(root.nodeType == 11) {//document fragment + //we can't get innerHTML from the root (type 11) node, so we + //copy all the child nodes into a new div and get innerHTML from the div + var div = document.createElement("div"); + var temp = root.insertBefore(div,root.firstChild); + for (j = temp.nextSibling; j; j = j.nextSibling) { + temp.appendChild(j.cloneNode(true)); + } + html += temp.innerHTML.replace(c[23], function(strn) { //skip content inside script tags + strn = strn.replace(c[22], function(tag){ + if(/^<[!\?]/.test(tag)) return tag; //skip comments and php tags + else return editor.cleanHTML(tag)}); + return strn; + }); + + } else { + + var root_tag = (root.nodeType == 1) ? root.tagName.toLowerCase() : ''; + if (outputRoot) { //only happens with tag in fullpage mode + html += "<" + root_tag; + var attrs = root.attributes; // strangely, this doesn't work in moz + for (i = 0; i < attrs.length; ++i) { + var a = attrs.item(i); + if (!a.specified) { + continue; + } + var name = a.nodeName.toLowerCase(); + var value = a.nodeValue; + html += " " + name + '="' + value + '"'; + } + html += ">"; + } + if(root_tag == "html") { + innerhtml = editor._doc.documentElement.innerHTML; + } else { + innerhtml = root.innerHTML; + } + //pass tags to cleanHTML() one at a time + //includes support for htmlRemoveTags config option + html += innerhtml.replace(c[23], function(strn) { //skip content inside script tags + strn = strn.replace(c[22], function(tag){ + if(/^<[!\?]/.test(tag)) return tag; //skip comments and php tags + else if(!(editor.config.htmlRemoveTags && editor.config.htmlRemoveTags.test(tag.replace(/<([^\s>\/]+)/,'$1')))) + return editor.cleanHTML(tag); + else return ''}); + return strn; + }); + //IE drops all tags in a list except the last one + if(HTMLArea.is_ie) { + html = html.replace(/]*)?>/g,''). + replace(/(<(ul|ol)[^>]*>)[\s\n]*<\/li>/g, '$1'). + replace(/<\/li>([\s\n]*<\/li>)+/g, '<\/li>'); + } + if(HTMLArea.is_gecko) + html = html.replace(/
\n$/, ''); //strip trailing
added by moz + if (outputRoot) { + html += ""; + } + html = HTMLArea.indent(html); + }; +// html = HTMLArea.htmlEncode(html); + + return html; +}; Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/modules/InsertImage/insert_image.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/modules/InsertImage/insert_image.html,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/modules/InsertImage/insert_image.html 2 Feb 2007 21:04:47 -0000 1.1 @@ -0,0 +1,173 @@ + + + + Insert Image + + + + + + + + + + +
Insert Image
+ + + + + + + + + + + + + + + +
Image URL: + +
Alternate text:
+ +

+ +

+Layout + +
+ +
Alignment:
+ + +

+ +

Border thickness:
+ + +
+ +
+ +
+Spacing + +
+ +
Horizontal:
+ + +

+ +

Vertical:
+ + +
+ +
+
+ + + + + +
+
Image Preview:
+ +
+
+ +
+ + + \ No newline at end of file Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/modules/InsertImage/insert_image.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/modules/InsertImage/insert_image.js,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/modules/InsertImage/insert_image.js 2 Feb 2007 21:04:47 -0000 1.1 @@ -0,0 +1,159 @@ + + /*--------------------------------------:noTabs=true:tabSize=2:indentSize=2:-- + -- Xinha (is not htmlArea) - http://xinha.gogo.co.nz/ + -- + -- Use of Xinha is granted by the terms of the htmlArea License (based on + -- BSD license) please read license.txt in this package for details. + -- + -- Xinha was originally based on work by Mihai Bazon which is: + -- Copyright (c) 2003-2004 dynarch.com. + -- Copyright (c) 2002-2003 interactivetools.com, inc. + -- This copyright notice MUST stay intact for use. + -- + -- This is the standard implementation of the Xinha.prototype._insertImage method, + -- which provides the functionality to insert an image in the editor. + -- + -- he file is loaded as a special plugin by the Xinha Core when no alternative method (plugin) is loaded. + -- + -- + -- $HeadURL: http://svn.xinha.python-hosting.com/trunk/modules/InsertImage/insert_image.js $ + -- $LastChangedDate: 2007-01-24 03:26:04 +1300 (Wed, 24 Jan 2007) $ + -- $LastChangedRevision: 694 $ + -- $LastChangedBy: gogo $ + --------------------------------------------------------------------------*/ +InsertImage._pluginInfo = { + name : "InsertImage", + origin : "Xinha Core", + version : "$LastChangedRevision: 694 $".replace(/^[^:]*: (.*) \$$/, '$1'), + developer : "The Xinha Core Developer Team", + developer_url : "$HeadURL: http://svn.xinha.python-hosting.com/trunk/modules/InsertImage/insert_image.js $".replace(/^[^:]*: (.*) \$$/, '$1'), + sponsor : "", + sponsor_url : "", + license : "htmlArea" +}; + +function InsertImage(editor) { +} + +// Called when the user clicks on "InsertImage" button. If an image is already +// there, it will just modify it's properties. +Xinha.prototype._insertImage = function(image) +{ + var editor = this; // for nested functions + var outparam = null; + if ( typeof image == "undefined" ) + { + image = this.getParentElement(); + if ( image && image.tagName.toLowerCase() != 'img' ) + { + image = null; + } + } + if ( image ) + { + outparam = + { + f_base : editor.config.baseHref, + f_url : Xinha.is_ie ? editor.stripBaseURL(image.src) : image.getAttribute("src"), + f_alt : image.alt, + f_border : image.border, + f_align : image.align, + f_vert : image.vspace, + f_horiz : image.hspace, + f_width : image.width, + f_height : image.height + }; + } + Dialog( + editor.config.URIs.insert_image, + function(param) + { + // user must have pressed Cancel + if ( !param ) + { + return false; + } + var img = image; + if ( !img ) + { + if ( Xinha.is_ie ) + { + var sel = editor.getSelection(); + var range = editor.createRange(sel); + editor._doc.execCommand("insertimage", false, param.f_url); + img = range.parentElement(); + // wonder if this works... + if ( img.tagName.toLowerCase() != "img" ) + { + img = img.previousSibling; + } + } + else + { + img = document.createElement('img'); + img.src = param.f_url; + editor.insertNodeAtSelection(img); + if ( !img.tagName ) + { + // if the cursor is at the beginning of the document + img = range.startContainer.firstChild; + } + } + } + else + { + img.src = param.f_url; + } + + for ( var field in param ) + { + var value = param[field]; + switch (field) + { + case "f_alt": + if (value) + img.alt = value + else + img.removeAttribute("alt"); + break; + case "f_border": + if (value) + img.border = parseInt(value || "0") + else + img.removeAttribute("border"); + break; + case "f_align": + if (value) + img.align = value + else + img.removeAttribute("align"); + break; + case "f_vert": + if (value) + img.vspace = parseInt(value || "0") + else + img.removeAttribute("vspace"); + break; + case "f_horiz": + if (value) + img.hspace = parseInt(value || "0") + else + img.removeAttribute("hspace"); + break; + case "f_width": + if (value) + img.width = parseInt(value || "0"); + else + img.removeAttribute("width"); + break; + case "f_height": + if (value) + img.height = parseInt(value || "0"); + else + img.removeAttribute("height"); + break; + } + } + }, + outparam); +}; Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/modules/InsertTable/insert_table.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/modules/InsertTable/insert_table.html,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/modules/InsertTable/insert_table.html 2 Feb 2007 21:04:47 -0000 1.1 @@ -0,0 +1,157 @@ + + + + Insert Table + + + + + + + + + + +
Insert Table
+ +
+ + + + + + + + + + + + + + + + + +
Rows:Width:
Cols:
+ +

+ +

+Layout + +
+ +
Alignment:
+ + +

+ +

Border thickness:
+ + +
+ +
+ +
+Spacing + +
+ +
Cell spacing:
+ + +

+ +

Cell padding:
+ + +
+ +
+ +
+ + +
+ +
+ + + \ No newline at end of file Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/modules/InsertTable/insert_table.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/modules/InsertTable/insert_table.js,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/modules/InsertTable/insert_table.js 2 Feb 2007 21:04:47 -0000 1.1 @@ -0,0 +1,120 @@ + + /*--------------------------------------:noTabs=true:tabSize=2:indentSize=2:-- + -- Xinha (is not htmlArea) - http://xinha.gogo.co.nz/ + -- + -- Use of Xinha is granted by the terms of the htmlArea License (based on + -- BSD license) please read license.txt in this package for details. + -- + -- Xinha was originally based on work by Mihai Bazon which is: + -- Copyright (c) 2003-2004 dynarch.com. + -- Copyright (c) 2002-2003 interactivetools.com, inc. + -- This copyright notice MUST stay intact for use. + -- + -- This is the standard implementation of the Xinha.prototype._insertTable method, + -- which provides the functionality to insert an image in the editor. + -- + -- he file is loaded as a special plugin by the Xinha Core when no alternative method (plugin) is loaded. + -- + -- + -- $HeadURL: http://svn.xinha.python-hosting.com/trunk/modules/InsertTable/insert_table.js $ + -- $LastChangedDate: 2007-01-23 09:22:22 +1300 (Tue, 23 Jan 2007) $ + -- $LastChangedRevision: 688 $ + -- $LastChangedBy: ray $ + --------------------------------------------------------------------------*/ +InsertTable._pluginInfo = { + name : "InsertTable", + origin : "Xinha Core", + version : "$LastChangedRevision: 688 $".replace(/^[^:]*: (.*) \$$/, '$1'), + developer : "The Xinha Core Developer Team", + developer_url : "$HeadURL: http://svn.xinha.python-hosting.com/trunk/modules/InsertTable/insert_table.js $".replace(/^[^:]*: (.*) \$$/, '$1'), + sponsor : "", + sponsor_url : "", + license : "htmlArea" +}; + +function InsertTable(editor) { +} + +Xinha.prototype._insertTable = function() +{ + var sel = this.getSelection(); + var range = this.createRange(sel); + var editor = this; // for nested functions + Dialog( + editor.config.URIs.insert_table, + function(param) + { + // user must have pressed Cancel + if ( !param ) + { + return false; + } + var doc = editor._doc; + // create the table element + var table = doc.createElement("table"); + // assign the given arguments + + for ( var field in param ) + { + var value = param[field]; + if ( !value ) + { + continue; + } + switch (field) + { + case "f_width": + table.style.width = value + param.f_unit; + break; + case "f_align": + table.align = value; + break; + case "f_border": + table.border = parseInt(value, 10); + break; + case "f_spacing": + table.cellSpacing = parseInt(value, 10); + break; + case "f_padding": + table.cellPadding = parseInt(value, 10); + break; + } + } + var cellwidth = 0; + if ( param.f_fixed ) + { + cellwidth = Math.floor(100 / parseInt(param.f_cols, 10)); + } + var tbody = doc.createElement("tbody"); + table.appendChild(tbody); + for ( var i = 0; i < param.f_rows; ++i ) + { + var tr = doc.createElement("tr"); + tbody.appendChild(tr); + for ( var j = 0; j < param.f_cols; ++j ) + { + var td = doc.createElement("td"); + // @todo : check if this line doesnt stop us to use pixel width in cells + if (cellwidth) + { + td.style.width = cellwidth + "%"; + } + tr.appendChild(td); + // Browsers like to see something inside the cell ( ). + td.appendChild(doc.createTextNode('\u00a0')); + } + } + if ( Xinha.is_ie ) + { + range.pasteHTML(table.outerHTML); + } + else + { + // insert the table + editor.insertNodeAtSelection(table); + } + return true; + }, + null + ); +}; \ No newline at end of file Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/modules/InternetExplorer/InternetExplorer.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/modules/InternetExplorer/InternetExplorer.js,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/modules/InternetExplorer/InternetExplorer.js 2 Feb 2007 21:04:48 -0000 1.1 @@ -0,0 +1,452 @@ + + /*--------------------------------------:noTabs=true:tabSize=2:indentSize=2:-- + -- Xinha (is not htmlArea) - http://xinha.gogo.co.nz/ + -- + -- Use of Xinha is granted by the terms of the htmlArea License (based on + -- BSD license) please read license.txt in this package for details. + -- + -- Xinha was originally based on work by Mihai Bazon which is: + -- Copyright (c) 2003-2004 dynarch.com. + -- Copyright (c) 2002-2003 interactivetools.com, inc. + -- This copyright notice MUST stay intact for use. + -- + -- This is the Internet Explorer compatability plugin, part of the + -- Xinha core. + -- + -- The file is loaded as a special plugin by the Xinha Core when + -- Xinha is being run under an Internet Explorer based browser. + -- + -- It provides implementation and specialisation for various methods + -- in the core where different approaches per browser are required. + -- + -- Design Notes:: + -- Most methods here will simply be overriding Xinha.prototype. + -- and should be called that, but methods specific to IE should + -- be a part of the InternetExplorer.prototype, we won't trample on + -- namespace that way. + -- + -- $HeadURL: http://svn.xinha.python-hosting.com/trunk/modules/InternetExplorer/InternetExplorer.js $ + -- $LastChangedDate: 2007-01-31 02:09:44 +1300 (Wed, 31 Jan 2007) $ + -- $LastChangedRevision: 707 $ + -- $LastChangedBy: ray $ + --------------------------------------------------------------------------*/ + +InternetExplorer._pluginInfo = { + name : "Internet Explorer", + origin : "Xinha Core", + version : "$LastChangedRevision: 707 $".replace(/^[^:]*: (.*) \$$/, '$1'), + developer : "The Xinha Core Developer Team", + developer_url : "$HeadURL: http://svn.xinha.python-hosting.com/trunk/modules/InternetExplorer/InternetExplorer.js $".replace(/^[^:]*: (.*) \$$/, '$1'), + sponsor : "", + sponsor_url : "", + license : "htmlArea" +}; + +function InternetExplorer(editor) { + this.editor = editor; + editor.InternetExplorer = this; // So we can do my_editor.InternetExplorer.doSomethingIESpecific(); +} + +/** Allow Internet Explorer to handle some key events in a special way. + */ + +InternetExplorer.prototype.onKeyPress = function(ev) +{ + // Shortcuts + if(this.editor.isShortCut(ev)) + { + switch(this.editor.getKey(ev).toLowerCase()) + { + case 'n': + { + this.editor.execCommand('formatblock', false, '

'); + Xinha._stopEvent(ev); + return true; + } + break; + + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + { + this.editor.execCommand('formatblock', false, ''); + Xinha._stopEvent(ev); + return true; + } + break; + } + } + + switch(ev.keyCode) + { + case 8: // KEY backspace + case 46: // KEY delete + { + if(this.handleBackspace()) + { + Xinha._stopEvent(ev); + return true; + } + } + break; + } + + return false; +} + +/** When backspace is hit, the IE onKeyPress will execute this method. + * It preserves links when you backspace over them and apparently + * deletes control elements (tables, images, form fields) in a better + * way. + * + * @returns true|false True when backspace has been handled specially + * false otherwise (should pass through). + */ + +InternetExplorer.prototype.handleBackspace = function() +{ + var editor = this.editor; + var sel = editor.getSelection(); + if ( sel.type == 'Control' ) + { + var elm = editor.activeElement(sel); + Xinha.removeFromParent(elm); + return true; + } + + // This bit of code preseves links when you backspace over the + // endpoint of the link in IE. Without it, if you have something like + // link_here | + // where | is the cursor, and backspace over the last e, then the link + // will de-link, which is a bit tedious + var range = editor.createRange(sel); + var r2 = range.duplicate(); + r2.moveStart("character", -1); + var a = r2.parentElement(); + // @fixme: why using again a regex to test a single string ??? + if ( a != range.parentElement() && ( /^a$/i.test(a.tagName) ) ) + { + r2.collapse(true); + r2.moveEnd("character", 1); + r2.pasteHTML(''); + r2.select(); + return true; + } +}; + +InternetExplorer.prototype.inwardHtml = function(html) +{ + // Both IE and Gecko use strike internally instead of del (#523) + // Xinha will present del externally (see Xinha.prototype.outwardHtml + html = html.replace(/<(\/?)del(\s|>|\/)/ig, "<$1strike$2"); + + return html; +} + +/*--------------------------------------------------------------------------*/ +/*------- IMPLEMENTATION OF THE ABSTRACT "Xinha.prototype" METHODS ---------*/ +/*--------------------------------------------------------------------------*/ + +/** Insert a node at the current selection point. + * @param toBeInserted DomNode + */ + +Xinha.prototype.insertNodeAtSelection = function(toBeInserted) +{ + Xinha.notImplemented('insertNodeAtSelection'); +}; + + +/** Get the parent element of the supplied or current selection. + * @param sel optional selection as returned by getSelection + * @returns DomNode + */ + +Xinha.prototype.getParentElement = function(sel) +{ + if ( typeof sel == 'undefined' ) + { + sel = this.getSelection(); + } + var range = this.createRange(sel); + switch ( sel.type ) + { + case "Text": + // try to circumvent a bug in IE: + // the parent returned is not always the real parent element + var parent = range.parentElement(); + while ( true ) + { + var TestRange = range.duplicate(); + TestRange.moveToElementText(parent); + if ( TestRange.inRange(range) ) + { + break; + } + if ( ( parent.nodeType != 1 ) || ( parent.tagName.toLowerCase() == 'body' ) ) + { + break; + } + parent = parent.parentElement; + } + return parent; + case "None": + // It seems that even for selection of type "None", + // there _is_ a parent element and it's value is not + // only correct, but very important to us. MSIE is + // certainly the buggiest browser in the world and I + // wonder, God, how can Earth stand it? + return range.parentElement(); + case "Control": + return range.item(0); + default: + return this._doc.body; + } +}; + +/** + * Returns the selected element, if any. That is, + * the element that you have last selected in the "path" + * at the bottom of the editor, or a "control" (eg image) + * + * @returns null | DomNode + */ + +Xinha.prototype.activeElement = function(sel) +{ + if ( ( sel === null ) || this.selectionEmpty(sel) ) + { + return null; + } + + if ( sel.type.toLowerCase() == "control" ) + { + return sel.createRange().item(0); + } + else + { + // If it's not a control, then we need to see if + // the selection is the _entire_ text of a parent node + // (this happens when a node is clicked in the tree) + var range = sel.createRange(); + var p_elm = this.getParentElement(sel); + if ( p_elm.innerHTML == range.htmlText ) + { + return p_elm; + } + /* + if ( p_elm ) + { + var p_rng = this._doc.body.createTextRange(); + p_rng.moveToElementText(p_elm); + if ( p_rng.isEqual(range) ) + { + return p_elm; + } + } + + if ( range.parentElement() ) + { + var prnt_range = this._doc.body.createTextRange(); + prnt_range.moveToElementText(range.parentElement()); + if ( prnt_range.isEqual(range) ) + { + return range.parentElement(); + } + } + */ + return null; + } +}; + +/** + * Determines if the given selection is empty (collapsed). + * @param selection Selection object as returned by getSelection + * @returns true|false + */ + +Xinha.prototype.selectionEmpty = function(sel) +{ + if ( !sel ) + { + return true; + } + + return this.createRange(sel).htmlText === ''; +}; + +/** + * Selects the contents of the given node. If the node is a "control" type element, (image, form input, table) + * the node itself is selected for manipulation. + * + * @param node DomNode + * @param pos Set to a numeric position inside the node to collapse the cursor here if possible. + */ + +Xinha.prototype.selectNodeContents = function(node, pos) +{ + this.focusEditor(); + this.forceRedraw(); + var range; + var collapsed = typeof pos == "undefined" ? true : false; + // Tables and Images get selected as "objects" rather than the text contents + if ( collapsed && node.tagName && node.tagName.toLowerCase().match(/table|img|input|select|textarea/) ) + { + range = this._doc.body.createControlRange(); + range.add(node); + } + else + { + range = this._doc.body.createTextRange(); + range.moveToElementText(node); + //(collapsed) && range.collapse(pos); + } + range.select(); +}; + +/** Insert HTML at the current position, deleting the selection if any. + * + * @param html string + */ + +Xinha.prototype.insertHTML = function(html) +{ + var sel = this.getSelection(); + var range = this.createRange(sel); + this.focusEditor(); + range.pasteHTML(html); +}; + + +/** Get the HTML of the current selection. HTML returned has not been passed through outwardHTML. + * + * @returns string + */ + +Xinha.prototype.getSelectedHTML = function() +{ + var sel = this.getSelection(); + var range = this.createRange(sel); + + // Need to be careful of control ranges which won't have htmlText + if( range.htmlText ) + { + return range.htmlText; + } + else if(range.length >= 1) + { + return range.item(0).outerHTML; + } + + return ''; +}; + +/** Get a Selection object of the current selection. Note that selection objects are browser specific. + * + * @returns Selection + */ + +Xinha.prototype.getSelection = function() +{ + return this._doc.selection; +}; + +/** Create a Range object from the given selection. Note that range objects are browser specific. + * + * @param sel Selection object (see getSelection) + * @returns Range + */ + +Xinha.prototype.createRange = function(sel) +{ + return sel.createRange(); +}; + +/** Determine if the given event object is a keydown/press event. + * + * @param event Event + * @returns true|false + */ + +Xinha.prototype.isKeyEvent = function(event) +{ + return event.type == "keydown"; +} + +/** Return the character (as a string) of a keyEvent - ie, press the 'a' key and + * this method will return 'a', press SHIFT-a and it will return 'A'. + * + * @param keyEvent + * @returns string + */ + +Xinha.prototype.getKey = function(keyEvent) +{ + return String.fromCharCode(keyEvent.keyCode); +} + + +/** Return the HTML string of the given Element, including the Element. + * + * @param element HTML Element DomNode + * @returns string + */ + +Xinha.getOuterHTML = function(element) +{ + return element.outerHTML; +}; + +// Control character for retaining edit location when switching modes +Xinha.prototype.cc = String.fromCharCode(0x2009); + +Xinha.prototype.setCC = function ( target ) +{ + if ( target == "textarea" ) + { + var ta = this._textArea; + var pos = document.selection.createRange(); + pos.collapse(); + pos.text = this.cc; + var index = ta.value.indexOf( this.cc ); + var before = ta.value.substring( 0, index ); + var after = ta.value.substring( index + this.cc.length , ta.value.length ); + + if ( after.match(/^[^<]*>/) ) + { + var tagEnd = after.indexOf(">") + 1; + ta.value = before + after.substring( 0, tagEnd ) + this.cc + after.substring( tagEnd, after.length ); + } + else ta.value = before + this.cc + after; + } + else + { + var sel = this.getSelection(); + var r = sel.createRange(); + if ( sel.type == 'Control' ) + { + var control = r.item(0); + control.outerHTML += this.cc; + } + else + { + r.collapse(); + r.text = this.cc; + } + } +}; + +Xinha.prototype.findCC = function ( target ) +{ + var findIn = ( target == 'textarea' ) ? this._textArea : this._doc.body; + range = findIn.createTextRange(); + if( range.findText( this.cc ) ) + { + range.select(); + range.text = ''; + } + if ( target == 'textarea' ) this._textArea.focus(); +}; \ No newline at end of file Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/Abbreviation/lang/nb.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/Abbreviation/lang/nb.js,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/Abbreviation/lang/nb.js 2 Feb 2007 21:04:48 -0000 1.1 @@ -0,0 +1,8 @@ +// I18N constants +// LANG: "nb", ENCODING: UTF-8 +// translated: Kim Steinhaug, http://www.steinhaug.com/, kim@steinhaug.com +{ + "Abbreviation": "Beskrive forkortelse", + "Expansion:": "Betydning:", + "Delete": "Fjerne" +}; \ No newline at end of file Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/BackgroundImage/lang/nb.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/BackgroundImage/lang/nb.js,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/BackgroundImage/lang/nb.js 2 Feb 2007 21:04:48 -0000 1.1 @@ -0,0 +1,9 @@ +// I18N constants +// LANG: "nb", ENCODING: UTF-8 +// translated: Kim Steinhaug, http://www.steinhaug.com/, kim@steinhaug.com +{ + "Set page background image": "Velg bakgrunnsbilde på siden", + "Set Page Background Image": "Velg bakgrunnsbilde på Siden", + "Remove Current Background": "Fjern gjeldende bakgrunn", + "Cancel": "Avbryt" +}; \ No newline at end of file Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/CharCounter/char-counter.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/CharCounter/char-counter.js,v diff -u -r1.3 -r1.4 --- openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/CharCounter/char-counter.js 4 Jun 2006 00:45:49 -0000 1.3 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/CharCounter/char-counter.js 2 Feb 2007 21:04:48 -0000 1.4 @@ -1,10 +1,15 @@ // Charcounter for HTMLArea-3.0 -// (c) Udo Schmal & L.N.Schaffrath NeueMedien +// (c) Udo Schmal & L.N.Schaffrath NeueMedien // Distributed under the same terms as HTMLArea itself. // This notice MUST stay intact for use (see license.txt). function CharCounter(editor) { - this.editor = editor; + this.editor = editor; + this._Chars = 0; + this._Words = 0; + this._HTML = 0; + this.maxHTML = 1024; + this.onKeyPress = this.__onKeyPress; } HTMLArea.Config.prototype.CharCounter = @@ -16,14 +21,14 @@ }; CharCounter._pluginInfo = { - name : "CharCounter", - version : "1.1", - developer : "Udo Schmal", - developer_url : "http://www.schaffrath-neuemedien.de", - sponsor : "L.N.Schaffrath NeueMedien", - sponsor_url : "http://www.schaffrath-neuemedien.de", - c_owner : "Udo Schmal & L.N.Schaffrath NeueMedien", - license : "htmlArea" + name : "CharCounter", + version : "1.3", + developer : "Udo Schmal", + developer_url : "http://www.schaffrath-neuemedien.de", + sponsor : "L.N.Schaffrath NeueMedien", + sponsor_url : "http://www.schaffrath-neuemedien.de", + c_owner : "Udo Schmal & L.N.Schaffrath NeueMedien", + license : "htmlArea" }; CharCounter.prototype._lc = function(string) { @@ -58,35 +63,27 @@ } }; -CharCounter.prototype.onUpdateToolbar = function() { - this.updateCharCount(); -}; - -CharCounter.prototype.onMode = function (mode) -{ - //Hide Chars in statusbar when switching into textmode - switch (mode) - { - case "textmode": - this.charCount.style.display = "none"; - break; - case "wysiwyg": - this.charCount.style.display = ""; - break; - default: - alert("Mode <" + mode + "> not defined!"); - return false; +CharCounter.prototype.__onKeyPress= function(ev) { + if ((ev.keyCode != 8) && (ev.keyCode !=46)) { // not backspace & delete + if (this.maxHTML!=-1) { + var contents = this.editor.getHTML(); + if (contents.length>=this.maxHTML) { + HTMLArea._stopEvent(ev); + return true; + } + } } -}; +} -CharCounter.prototype.updateCharCount = function(ev) { +CharCounter.prototype._updateCharCount= function() { var editor = this.editor; var cfg = editor.config; - var contents = editor.getHTML(); - var string = new Array(); + var contents = editor.getHTML(); + var string = new Array(); if (cfg.CharCounter.showHtml) { string[string.length] = this._lc("HTML") + ": " + contents.length; } + this._HTML = contents.length; if (cfg.CharCounter.showWord || cfg.CharCounter.showChar) { contents = contents.replace(/<\/?\s*!--[^-->]*-->/gi, "" ); contents = contents.replace(/<(.+?)>/g, '');//Don't count HTML tags @@ -97,18 +94,43 @@ contents = contents.replace(/^\s*|\s*$/g, '');//trim } if (cfg.CharCounter.showWord) { - var words=0; - for (var x=0;x=1) { words++; } - string[string.length] = this._lc("Words") + ": " + words; + if (this._Words >=1) { this._Words++; } + string[string.length] = this._lc("Words") + ": " + this._Words ; } - if (cfg.CharCounter.showChar) { string[string.length] = this._lc("Chars") + ": " + contents.length; + this._Chars = contents.length; } - this.charCount.innerHTML = string.join(cfg.CharCounter.separator); }; + +CharCounter.prototype.onUpdateToolbar = function() { + this.charCount.innerHTML = this._lc("... in progress"); + if(this._timeoutID) { + window.clearTimeout(this._timeoutID); + } + var e = this; + this._timeoutID = window.setTimeout(function() {e._updateCharCount();}, 1000); +}; + +CharCounter.prototype.onMode = function (mode) +{ + //Hide Chars in statusbar when switching into textmode + switch (mode) + { + case "textmode": + this.charCount.style.display = "none"; + break; + case "wysiwyg": + this.charCount.style.display = ""; + break; + default: + alert("Mode <" + mode + "> not defined!"); + return false; + } +}; Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/CharCounter/lang/de.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/CharCounter/lang/de.js,v diff -u -r1.1 -r1.2 --- openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/CharCounter/lang/de.js 2 Nov 2005 08:55:59 -0000 1.1 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/CharCounter/lang/de.js 2 Feb 2007 21:04:49 -0000 1.2 @@ -2,5 +2,7 @@ // LANG: "de", ENCODING: UTF-8 // Author: Udo Schmal (gocher), http://www.schaffrath-neuemedien.de/, udo.schmal@t-online.de { - "Chars": "Zeichen" + "Chars": "Zeichen", + "Words": "Worte", + "... in progress": "... in Bearbeitung" }; Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/CharCounter/lang/fr.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/CharCounter/lang/fr.js,v diff -u -r1.1 -r1.2 --- openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/CharCounter/lang/fr.js 2 Nov 2005 08:55:59 -0000 1.1 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/CharCounter/lang/fr.js 2 Feb 2007 21:04:49 -0000 1.2 @@ -1,5 +1,6 @@ // I18N constants // LANG: "fr", ENCODING: UTF-8 { - "Chars": "Caractères" + "Chars": "Caractères", + "Words": "Mots" }; \ No newline at end of file Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/CharCounter/lang/nb.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/CharCounter/lang/nb.js,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/CharCounter/lang/nb.js 2 Feb 2007 21:04:49 -0000 1.1 @@ -0,0 +1,6 @@ +// I18N constants +// LANG: "nb", ENCODING: UTF-8 +// translated: Kim Steinhaug, http://www.steinhaug.com/, kim@steinhaug.com +{ + "Chars": "Tegn" +}; \ No newline at end of file Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/CharacterMap/character-map.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/CharacterMap/character-map.js,v diff -u -r1.3 -r1.4 --- openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/CharacterMap/character-map.js 4 Jun 2006 00:45:50 -0000 1.3 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/CharacterMap/character-map.js 2 Feb 2007 21:04:49 -0000 1.4 @@ -115,8 +115,8 @@ { if (HTMLArea.is_ie) editor.focusEditor(); editor.insertHTML( entite ); - self._isActive = false; - editor.hidePanel( editor._CharacterMap ); + //self._isActive = false; + //editor.hidePanel( editor._CharacterMap ); return false; }; editor._CharacterMap.appendChild( a ); Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/CharacterMap/lang/nb.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/CharacterMap/lang/nb.js,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/CharacterMap/lang/nb.js 2 Feb 2007 21:04:49 -0000 1.1 @@ -0,0 +1,7 @@ +// I18N constants +// LANG: "nb", ENCODING: UTF-8 +// translated: Kim Steinhaug, http://www.steinhaug.com/, kim@steinhaug.com +{ + "Insert special character": "Sett inn tegn", + "Cancel": "Avbryt" +}; \ No newline at end of file Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/CharacterMap/lang/sv.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/CharacterMap/lang/sv.js,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/CharacterMap/lang/sv.js 2 Feb 2007 21:04:49 -0000 1.1 @@ -0,0 +1,7 @@ +// I18N constants +// LANG: "sv" (Swedish), ENCODING: UTF-8 +// translated: Erik Dalén +{ + "Insert special character": "Infoga tecken", + "Cancel": "Avbryt" +}; Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/ClientsideSpellcheck/lang/nb.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/ClientsideSpellcheck/lang/nb.js,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/ClientsideSpellcheck/lang/nb.js 2 Feb 2007 21:04:49 -0000 1.1 @@ -0,0 +1,3 @@ +// Dummy file + +{}; \ No newline at end of file Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/ContextMenu/context-menu.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/ContextMenu/context-menu.js,v diff -u -r1.3 -r1.4 --- openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/ContextMenu/context-menu.js 4 Jun 2006 00:45:50 -0000 1.3 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/ContextMenu/context-menu.js 2 Feb 2007 21:04:49 -0000 1.4 @@ -44,11 +44,13 @@ if (tbo) tbo = tbo.instance; var selection = editor.hasSelectedText(); - if (selection) - menu.push([ HTMLArea._lc("Cut", "ContextMenu"), function() { editor.execCommand("cut"); }, null, config.btnList["cut"][1] ], - [ HTMLArea._lc("Copy", "ContextMenu"), function() { editor.execCommand("copy"); }, null, config.btnList["copy"][1] ]); - menu.push([ HTMLArea._lc("Paste", "ContextMenu"), function() { editor.execCommand("paste"); }, null, config.btnList["paste"][1] ]); - + if (!HTMLArea.is_gecko) { + if (selection) { + menu.push([ HTMLArea._lc("Cut", "ContextMenu"), function() { editor.execCommand("cut"); }, null, config.btnList["cut"][1] ], + [ HTMLArea._lc("Copy", "ContextMenu"), function() { editor.execCommand("copy"); }, null, config.btnList["copy"][1] ]); + menu.push([ HTMLArea._lc("Paste", "ContextMenu"), function() { editor.execCommand("paste"); }, null, config.btnList["paste"][1] ]); + } + } var currentTarget = target; var elmenus = []; @@ -130,7 +132,27 @@ [ HTMLArea._lc("C_ell Properties...", "ContextMenu"), function() { tableOperation("TO-cell-prop"); }, HTMLArea._lc("Show the Table Cell Properties dialog", "ContextMenu"), - config.btnList["TO-cell-prop"][1] ] + config.btnList["TO-cell-prop"][1] ], + + [ HTMLArea._lc("Insert Cell After", "ContextMenu"), + function() { tableOperation("TO-cell-insert-after"); }, + HTMLArea._lc("Insert Cell After", "ContextMenu"), + config.btnList["TO-cell-insert-after"][1] ], + + [ HTMLArea._lc("Insert Cell Before", "ContextMenu"), + function() { tableOperation("TO-cell-insert-before"); }, + HTMLArea._lc("Insert Cell After", "ContextMenu"), + config.btnList["TO-cell-insert-before"][1] ], + + [ HTMLArea._lc("Delete Cell", "ContextMenu"), + function() { tableOperation("TO-cell-delete"); }, + HTMLArea._lc("Delete Cell", "ContextMenu"), + config.btnList["TO-cell-delete"][1] ], + + [ HTMLArea._lc("Merge Cells", "ContextMenu"), + function() { tableOperation("TO-cell-merge"); }, + HTMLArea._lc("Merge Cells", "ContextMenu"), + config.btnList["TO-cell-merge"][1] ] ); break; case "tr": @@ -243,13 +265,16 @@ function() { insertPara(true); }, HTMLArea._lc("Insert a paragraph after the current node", "ContextMenu") ] ); + if (!menu[0]) menu.shift(); //If the menu begins with a separator, remove it for cosmetical reasons return menu; }; ContextMenu.prototype.popupMenu = function(ev) { var self = this; if (this.currentMenu) - this.currentMenu.parentNode.removeChild(this.currentMenu); + { + this.closeMenu(); + } function getPos(el) { var r = { x: el.offsetLeft, y: el.offsetTop }; if (el.offsetParent) { Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/ContextMenu/lang/nb.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/ContextMenu/lang/nb.js,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/ContextMenu/lang/nb.js 2 Feb 2007 21:04:50 -0000 1.1 @@ -0,0 +1,53 @@ +// I18N constants +// LANG: "no", ENCODING: UTF-8 +// translated: Kim Steinhaug, http://www.steinhaug.com/, kim@steinhaug.com +// Used key commands +// C,D,e, ,I, ,k,k,l,M, ,n,o,R, ,s,T, ,w : English +// H B j R m F v : Norwegian +{ + "Cut": "Klipp ut", + "Copy": "Kopier", + "Paste": "Lim inn", + "_Image Properties...": "_Bildeegenskaper...", + "Show the image properties dialog": "Vis bildeegenskaper", + "_Modify Link...": "_Rediger Link...", + "Current URL is": "Gjeldende URL er", + "Chec_k Link...": "Sje_kk Link...", + "Opens this link in a new window": "Åpner denne link i nytt vindu", + "_Remove Link...": "_Fjerne Link...", + "Please confirm that you want to unlink this element.": "Vennligst bekreft at du ønsker å fjerne link på elementet", + "Link points to:": "Link peker til:", + "Unlink the current element": "Fjerne link på gjeldende element", + "C_ell Properties...": "C_elleegenskaper...", + "Show the Table Cell Properties dialog": "Vis egenskaper for celle", + "Ro_w Properties...": "Rad Egenskaper... (_w)", + "Show the Table Row Properties dialog": "Vis egenskaper for rad", + "I_nsert Row Before": "Sett I_nn rad før", + "Insert a new row before the current one": "Sett inn ny rad før gjeldende", + "In_sert Row After": "_Sett inn rad etter", + "Insert a new row after the current one": "Sett inn ny rad etter gjeldende", + "_Delete Row": "Slett rad (_d)", + "Delete the current row": "Slett gjeldende rad", + "_Table Properties...": "_Tabellegenskaper...", + "Show the Table Properties dialog": "Vis egenskaper for tabellen", + "Insert _Column Before": "Sett inn kolonne etter (_c)", + "Insert a new column before the current one": "Sett inn kolonne før gjeldende", + "Insert C_olumn After": "Sett inn k_olonne etter", + "Insert a new column after the current one": "Sett inn kolonne etter gjeldende", + "De_lete Column": "S_lett kolonne", + "Delete the current column": "Slett gjeldende kolonne", + "Justify Left": "_Venstrejuster", + "Justify Center": "_Midtjuster", + "Justify Right": "_Høyrejuster", + "Justify Full": "Blokk_juster", + "Make lin_k...": "Lag len_ke...", + "Create a link": "Lag ny link", + "Remove the $elem Element...": "Fjerne $elem elementet...", + "Please confirm that you want to remove this element:": "Vennligst bekreft at du ønsker å fjerne elementet:", + "Remove this node from the document": "Fjerne denne node fra dokumentet", + "Insert paragraph before": "Sett inn paragraf før", + "Insert a paragraph before the current node": "Sett inn paragraf før gjeldende node", + "Insert paragraph after": "Sett inn paragraf etter", + "Insert a paragraph after the current node": "Sett inn paragraf etter gjeldende node", + "How did you get here? (Please report!)": "Hva skjedde? (Vennligst beskriv)" +}; \ No newline at end of file Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/ContextMenu/lang/sv.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/ContextMenu/lang/sv.js,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/ContextMenu/lang/sv.js 2 Feb 2007 21:04:50 -0000 1.1 @@ -0,0 +1,54 @@ +// I18N constants +// LANG: "sv", ENCODING: UTF-8 +// Swedish version for rev. 477 (Mar 2006) by Thomas Loo + +// TODO: Proper keybindings +// C,D,e, ,I, ,k,k,l,M, ,n,o,R, ,s,T, ,w : English +// H B j R m F v : Swedish +{ + "Cut": "Klipp ut", + "Copy": "Kopiera", + "Paste": "Klistra in", + "_Image Properties...": "_Bildegenskaper...", + "Show the image properties dialog": "Visa bildegenskaper", + "_Modify Link...": "_Redigera Länk...", + "Current URL is": "Aktuellt URL är", + "Chec_k Link...": "Kontrollera länk...", + "Opens this link in a new window": "Öppna länk i nytt fönster", + "_Remove Link...": "_Ta bort länk...", + "Please confirm that you want to unlink this element.": "Bekräfta borttagning av länk", + "Link points to:": "Länken pekar mot:", + "Unlink the current element": "Ta bort länk kopplad till elementet", + "C_ell Properties...": "C_ellegenskaper...", + "Show the Table Cell Properties dialog": "Visa egenskaper for cellen", + "Ro_w Properties...": "Radegenskaper... (_w)", + "Show the Table Row Properties dialog": "Visa egenskaper för rad", + "I_nsert Row Before": "I_nfoga rad före", + "Insert a new row before the current one": "Infoga ny rad före aktuell", + "In_sert Row After": "Infoga rad efter aktuell rad", + "Insert a new row after the current one": "Infoga ny rad efter aktuell", + "_Delete Row": "Radera rad (_d)", + "Delete the current row": "T bort aktuell rad", + "_Table Properties...": "_Tabellegenskaper...", + "Show the Table Properties dialog": "Visa tabellegenskaper", + "Insert _Column Before": "Infoga kolumn efter (_c)", + "Insert a new column before the current one": "Infoga kolumn före aktuell", + "Insert C_olumn After": "Infoga k_olumn efter", + "Insert a new column after the current one": "Infoga kolumn efter aktuell", + "De_lete Column": "_Radera kolumn", + "Delete the current column": "Radera aktuell kolumn", + "Justify Left": "_Vänsterjustera", + "Justify Center": "_Centerjustera", + "Justify Right": "_Högerjustera", + "Justify Full": "Block_justera", + "Make lin_k...": "Skapa län_k...", + "Create a link": "SKapa ny länk", + "Remove the $elem Element...": "Radera elementet $elem...", + "Please confirm that you want to remove this element:": "Bekräfta borttagning av element:", + "Remove this node from the document": "Radera nod från dokumentet", + "Insert paragraph before": "Infoga paragraf före", + "Insert a paragraph before the current node": "Infoga paragraf före aktuell nod", + "Insert paragraph after": "Infoga paragraf efter", + "Insert a paragraph after the current node": "Infoga paragraf efter aktuell nod", + "How did you get here? (Please report!)": "Hur hamnade du här? (Beskriv förloppet)" +}; \ No newline at end of file Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/DefinitionList/definition-list.css =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/DefinitionList/definition-list.css,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/DefinitionList/definition-list.css 2 Feb 2007 21:04:50 -0000 1.1 @@ -0,0 +1,21 @@ +dl { border: 1px dotted #800000; } +dt { + width: 18px; + height: 18px; + background-image: url(img/ed_dt.gif); + background-repeat: no-repeat; + background-position: left top; + padding-left: 19px; + display: block; + color: #800000; +} +dd { + width: 18px; + height: 18px; + background-image: url(img/ed_dd.gif); + background-repeat: no-repeat; + background-position: left top; + padding-left: 19px; + display: block; + color: #800000; +} \ No newline at end of file Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/DefinitionList/definition-list.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/DefinitionList/definition-list.js,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/DefinitionList/definition-list.js 2 Feb 2007 21:04:50 -0000 1.1 @@ -0,0 +1,99 @@ +// DefinitionList plugin for HTMLArea +// Distributed under the same terms as HTMLArea itself. +// This notice MUST stay intact for use (see license.txt). + + +function DefinitionList(editor) { + this.editor = editor; + var cfg = editor.config; + var bl = DefinitionList.btnList; + var self = this; + // register the toolbar buttons provided by this plugin + var toolbar = ["linebreak"]; + for (var i = 0; i < bl.length; ++i) { + var btn = bl[i]; + if (!btn) { + toolbar.push("separator"); + } else { + var id = btn[0]; + cfg.registerButton(id, HTMLArea._lc(btn[1]), editor.imgURL("ed_" + btn[0] + ".gif", "DefinitionList"), false, + function(editor, id) { + // dispatch button press event + self.buttonPress(editor, id); + }); + toolbar.push(id); + } + } + // add a new line in the toolbar + cfg.toolbar.push(toolbar); +} + +DefinitionList._pluginInfo = { + name : "DefinitionList", + version : "1.0", + developer : "Udo Schmal", + developer_url : "", + c_owner : "Udo Schmal", + license : "htmlArea" +}; + +// the list of buttons added by this plugin +DefinitionList.btnList = [ + ["dl", "definition list"], + ["dt", "definition term"], + ["dd", "definition description"] + ]; + +DefinitionList.prototype._lc = function(string) { + return HTMLArea._lc(string, 'DefinitionList'); +}; + +DefinitionList.prototype.onGenerate = function() { + var style_id = "DefinitionList-style" + var style = this.editor._doc.getElementById(style_id); + if (style == null) { + style = this.editor._doc.createElement("link"); + style.id = style_id; + style.rel = 'stylesheet'; + style.href = _editor_url + 'plugins/DefinitionList/definition-list.css'; + this.editor._doc.getElementsByTagName("HEAD")[0].appendChild(style); + } +}; + +DefinitionList.prototype.buttonPress = function(editor,button_id) { + if (button_id=='dl') { //definition list + var pe = editor.getParentElement(); + while (pe.parentNode.tagName.toLowerCase() != 'body') { + pe = pe.parentNode; + } + var dx = editor._doc.createElement(button_id); + dx.innerHTML = ' '; + if(pe.parentNode.lastChild==pe) { + pe.parentNode.appendChild(dx); + }else{ + pe.parentNode.insertBefore(dx,pe.nextSibling); + } + } else if ((button_id=='dt')||(button_id=='dd')) { //definition term or description + var pe = editor.getParentElement(); + while (pe && (pe.nodeType == 1) && (pe.tagName.toLowerCase() != 'body')) { + if(pe.tagName.toLowerCase() == 'dl') { + var dx = editor._doc.createElement(button_id); + dx.innerHTML = ' '; + pe.appendChild(dx); + break; + }else if((pe.tagName.toLowerCase() == 'dt')||(pe.tagName.toLowerCase() == 'dd')){ + var dx = editor._doc.createElement(button_id) + dx.innerHTML = ' '; + if(pe.parentNode.lastChild==pe) { + pe.parentNode.appendChild(dx); + }else{ + pe.parentNode.insertBefore(dx,pe.nextSibling); + } + break; + } + pe = pe.parentNode; + } + if(pe.tagName.toLowerCase() == 'body') + alert('You can insert a definition term or description only in a definition list!'); + } +}; \ No newline at end of file Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/DefinitionList/img/ed_dd.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/DefinitionList/img/ed_dd.gif,v diff -u Binary files differ Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/DefinitionList/img/ed_dl.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/DefinitionList/img/ed_dl.gif,v diff -u Binary files differ Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/DefinitionList/img/ed_dt.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/DefinitionList/img/ed_dt.gif,v diff -u Binary files differ Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/DoubleClick/double-click.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/DoubleClick/double-click.js,v diff -u -r1.2 -r1.3 --- openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/DoubleClick/double-click.js 11 Nov 2005 20:32:41 -0000 1.2 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/DoubleClick/double-click.js 2 Feb 2007 21:04:50 -0000 1.3 @@ -36,12 +36,8 @@ // - editor is the HTMLArea object that triggered the call // - target is the selected object this.editor.dblClickList = { - u: [ function(e) {e.execCommand("underline");} ], - strike: [ function(e) {e.execCommand("strikethrough");} ], - sub: [ function(e) {e.execCommand("subscript");} ], - sup: [ function(e) {e.execCommand("superscript");} ], // Edit Link dialog - a: [ function(e) {e.execCommand("createlink");} ], + a: [ function(e) {e.config.btnList['createlink'][3](e); } ], // Follow link //a: [ function(editor, target) { window.location = target.href; properties(target); } ], Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/DynamicCSS/lang/nb.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/DynamicCSS/lang/nb.js,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/DynamicCSS/lang/nb.js 2 Feb 2007 21:04:50 -0000 1.1 @@ -0,0 +1,8 @@ +// I18N constants +// LANG: "nb", ENCODING: UTF-8 +// translated: Kim Steinhaug, http://www.steinhaug.com/, kim@steinhaug.com +{ + "Default": "Standard", + "Undefined": "Udefinert", + "Choose stylesheet": "Velg stilsett" +}; \ No newline at end of file Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/EditTag/lang/nb.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/EditTag/lang/nb.js,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/EditTag/lang/nb.js 2 Feb 2007 21:04:50 -0000 1.1 @@ -0,0 +1,6 @@ +// I18N constants +// LANG: "nb", ENCODING: UTF-8 +// translated: Kim Steinhaug, http://www.steinhaug.com/, kim@steinhaug.com +{ + "Edit HTML for selected text": "Rediger HTML for den valgte teksten" +}; \ No newline at end of file Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/EnterParagraphs/enter-paragraphs.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/EnterParagraphs/enter-paragraphs.js,v diff -u -r1.2 -r1.3 --- openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/EnterParagraphs/enter-paragraphs.js 11 Nov 2005 20:32:42 -0000 1.2 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/EnterParagraphs/enter-paragraphs.js 2 Feb 2007 21:04:51 -0000 1.3 @@ -3,7 +3,7 @@ /** * @fileoverview By Adam Wright, for The University of Western Australia * -* Distributed under the same terms as HTMLArea itself. +* Distributed under the same terms as Xinha itself. * This notice MUST stay intact for use (see license.txt). * * Heavily modified by Yermo Lamers of DTLink, LLC, College Park, Md., USA. @@ -107,7 +107,7 @@ // hook into the event handler to intercept key presses if we are using // gecko (Mozilla/FireFox) - if (HTMLArea.is_gecko) + if (Xinha.is_gecko) { //this.ddt._ddt( "enter-paragraphs.js","23", "EnterParagraphs(): we are gecko. Setting event handler." ); this.onKeyPress = this.__onKeyPress; @@ -426,7 +426,7 @@ // does not return content. return new Array(true, false ); - breal; + break; case "find_cursorpoint": @@ -700,12 +700,15 @@ } // NODE TYPE 11 is DOCUMENT_FRAGMENT NODE - - if ( cnt.nodeType == 11 && !cnt.firstChild ) - { - cnt.appendChild(editor._doc.createElement(pify.nodeName)); - } - + // I do not profess to understand any of this, simply applying a patch that others say is good - ticket:446 + if ( cnt.nodeType == 11 && !cnt.firstChild) + { + if (pify.nodeName != "BODY" || (pify.nodeName == "BODY" && pifyOffset != 0)) + { //WKR: prevent body tag in empty doc + cnt.appendChild(editor._doc.createElement(pify.nodeName)); + } + } + // YmL: Added additional last parameter for fill case to work around logic // error in forEachNode() @@ -779,7 +782,7 @@ { // FIXME:/CHECKME: When Xinha is switched from WYSIWYG to text mode - // HTMLArea.getHTMLWrapper() will strip out the trailing br. Not sure why. + // Xinha.getHTMLWrapper() will strip out the trailing br. Not sure why. // fill.appendChild(editor._doc.createElement('br')); @@ -960,8 +963,8 @@ // Grab the selection and associated range - var sel = this.editor._getSelection(); - var rng = this.editor._createRange(sel); + var sel = this.editor.getSelection(); + var rng = this.editor.createRange(sel); //this.ddt._ddtDumpNode( "enter-paragraphs.js", "757", "handleEnter(): initial range is: ", rng ); @@ -1078,7 +1081,7 @@ this.editor.updateToolbar(); - HTMLArea._stopEvent(ev); + Xinha._stopEvent(ev); return true; Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/Equation/ASCIIMathML.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/Equation/ASCIIMathML.js,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/Equation/ASCIIMathML.js 2 Feb 2007 21:04:51 -0000 1.1 @@ -0,0 +1,946 @@ +/* +ASCIIMathML.js +============== +This file contains JavaScript functions to convert ASCII math notation +to Presentation MathML. The conversion is done while the (X)HTML page +loads, and should work with Firefox/Mozilla/Netscape 7+ and Internet +Explorer 6+MathPlayer (http://www.dessci.com/en/products/mathplayer/). +Just add the next line to your (X)HTML page with this file in the same folder: + +This is a convenient and inexpensive solution for authoring MathML. + +Version 1.4.7 Aug 7, 2005, (c) Peter Jipsen http://www.chapman.edu/~jipsen +Latest version at http://www.chapman.edu/~jipsen/mathml/ASCIIMathML.js +For changes see http://www.chapman.edu/~jipsen/mathml/asciimathchanges.txt +If you use it on a webpage, please send the URL to jipsen@chapman.edu + + 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; either version 2.1 of the License, or (at + your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License (at http://www.gnu.org/licenses/lgpl.html) + for more details. + + NOTE: I have changed the license from GPL to LGPL according to a permission + from the author (see http://xinha.gogo.co.nz/punbb/viewtopic.php?pid=4150#p4150) + Raimund Meyer 11-29-2006 +*/ + +var checkForMathML = true; // check if browser can display MathML +var notifyIfNoMathML = true; // put note at top of page if no MathML capability + +if ( typeof mathcolor == "undefined" ) +{ + var mathcolor = "red"; // change it to "" (to inherit) or any other color +} +if ( typeof mathfontfamily == "undefined" ) +{ + var mathfontfamily = "serif"; // change to "" to inherit (works in IE) or another family (e.g. "arial") +} +var displaystyle = true; // puts limits above and below large operators + +if ( typeof showasciiformulaonhover == "undefined" ) +{ + var showasciiformulaonhover = true; // helps students learn ASCIIMath +} + +var decimalsign = "."; // change to "," if you like, beware of `(1,2)`! +var AMdelimiter1 = "`", AMescape1 = "\\\\`"; // can use other characters +var AMdelimiter2 = "$", AMescape2 = "\\\\\\$", AMdelimiter2regexp = "\\$"; +var doubleblankmathdelimiter = false; // if true, x+1 is equal to `x+1` + // for IE this works only in +//var separatetokens;// has been removed (email me if this is a problem) +var isIE = document.createElementNS==null; + +if (document.getElementById==null) + alert("This webpage requires a recent browser such as\ +\nMozilla/Netscape 7+ or Internet Explorer 6+MathPlayer") + +// all further global variables start with "AM" + +function AMcreateElementXHTML(t) { + if (isIE) return document.createElement(t); + else return document.createElementNS("http://www.w3.org/1999/xhtml",t); +} + +function AMnoMathMLNote() { + var nd = AMcreateElementXHTML("h3"); + nd.setAttribute("align","center") + nd.appendChild(AMcreateElementXHTML("p")); + nd.appendChild(document.createTextNode("To view the ")); + var an = AMcreateElementXHTML("a"); + an.appendChild(document.createTextNode("ASCIIMathML")); + an.setAttribute("href","http://www.chapman.edu/~jipsen/asciimath.html"); + nd.appendChild(an); + nd.appendChild(document.createTextNode(" notation use Internet Explorer 6+")); + an = AMcreateElementXHTML("a"); + an.appendChild(document.createTextNode("MathPlayer")); + an.setAttribute("href","http://www.dessci.com/en/products/mathplayer/download.htm"); + nd.appendChild(an); + nd.appendChild(document.createTextNode(" or Netscape/Mozilla/Firefox")); + nd.appendChild(AMcreateElementXHTML("p")); + return nd; +} + +function AMisMathMLavailable() { + if (navigator.appName.slice(0,8)=="Netscape") + if (navigator.appVersion.slice(0,1)>="5") return null; + else return AMnoMathMLNote(); + else if (navigator.appName.slice(0,9)=="Microsoft") + try { + var ActiveX = new ActiveXObject("MathPlayer.Factory.1"); + return null; + } catch (e) { + return AMnoMathMLNote(); + } + else return AMnoMathMLNote(); +} + +// character lists for Mozilla/Netscape fonts +var AMcal = [0xEF35,0x212C,0xEF36,0xEF37,0x2130,0x2131,0xEF38,0x210B,0x2110,0xEF39,0xEF3A,0x2112,0x2133,0xEF3B,0xEF3C,0xEF3D,0xEF3E,0x211B,0xEF3F,0xEF40,0xEF41,0xEF42,0xEF43,0xEF44,0xEF45,0xEF46]; +var AMfrk = [0xEF5D,0xEF5E,0x212D,0xEF5F,0xEF60,0xEF61,0xEF62,0x210C,0x2111,0xEF63,0xEF64,0xEF65,0xEF66,0xEF67,0xEF68,0xEF69,0xEF6A,0x211C,0xEF6B,0xEF6C,0xEF6D,0xEF6E,0xEF6F,0xEF70,0xEF71,0x2128]; +var AMbbb = [0xEF8C,0xEF8D,0x2102,0xEF8E,0xEF8F,0xEF90,0xEF91,0x210D,0xEF92,0xEF93,0xEF94,0xEF95,0xEF96,0x2115,0xEF97,0x2119,0x211A,0x211D,0xEF98,0xEF99,0xEF9A,0xEF9B,0xEF9C,0xEF9D,0xEF9E,0x2124]; + +var CONST = 0, UNARY = 1, BINARY = 2, INFIX = 3, LEFTBRACKET = 4, + RIGHTBRACKET = 5, SPACE = 6, UNDEROVER = 7, DEFINITION = 8, + LEFTRIGHT = 9, TEXT = 10; // token types + +var AMsqrt = {input:"sqrt", tag:"msqrt", output:"sqrt", tex:null, ttype:UNARY}, + AMroot = {input:"root", tag:"mroot", output:"root", tex:null, ttype:BINARY}, + AMfrac = {input:"frac", tag:"mfrac", output:"/", tex:null, ttype:BINARY}, + AMdiv = {input:"/", tag:"mfrac", output:"/", tex:null, ttype:INFIX}, + AMover = {input:"stackrel", tag:"mover", output:"stackrel", tex:null, ttype:BINARY}, + AMsub = {input:"_", tag:"msub", output:"_", tex:null, ttype:INFIX}, + AMsup = {input:"^", tag:"msup", output:"^", tex:null, ttype:INFIX}, + AMtext = {input:"text", tag:"mtext", output:"text", tex:null, ttype:TEXT}, + AMmbox = {input:"mbox", tag:"mtext", output:"mbox", tex:null, ttype:TEXT}, + AMquote = {input:"\"", tag:"mtext", output:"mbox", tex:null, ttype:TEXT}; + +var AMsymbols = [ +//some greek symbols +{input:"alpha", tag:"mi", output:"\u03B1", tex:null, ttype:CONST}, +{input:"beta", tag:"mi", output:"\u03B2", tex:null, ttype:CONST}, +{input:"chi", tag:"mi", output:"\u03C7", tex:null, ttype:CONST}, +{input:"delta", tag:"mi", output:"\u03B4", tex:null, ttype:CONST}, +{input:"Delta", tag:"mo", output:"\u0394", tex:null, ttype:CONST}, +{input:"epsi", tag:"mi", output:"\u03B5", tex:"epsilon", ttype:CONST}, +{input:"varepsilon", tag:"mi", output:"\u025B", tex:null, ttype:CONST}, +{input:"eta", tag:"mi", output:"\u03B7", tex:null, ttype:CONST}, +{input:"gamma", tag:"mi", output:"\u03B3", tex:null, ttype:CONST}, +{input:"Gamma", tag:"mo", output:"\u0393", tex:null, ttype:CONST}, +{input:"iota", tag:"mi", output:"\u03B9", tex:null, ttype:CONST}, +{input:"kappa", tag:"mi", output:"\u03BA", tex:null, ttype:CONST}, +{input:"lambda", tag:"mi", output:"\u03BB", tex:null, ttype:CONST}, +{input:"Lambda", tag:"mo", output:"\u039B", tex:null, ttype:CONST}, +{input:"mu", tag:"mi", output:"\u03BC", tex:null, ttype:CONST}, +{input:"nu", tag:"mi", output:"\u03BD", tex:null, ttype:CONST}, +{input:"omega", tag:"mi", output:"\u03C9", tex:null, ttype:CONST}, +{input:"Omega", tag:"mo", output:"\u03A9", tex:null, ttype:CONST}, +{input:"phi", tag:"mi", output:"\u03C6", tex:null, ttype:CONST}, +{input:"varphi", tag:"mi", output:"\u03D5", tex:null, ttype:CONST}, +{input:"Phi", tag:"mo", output:"\u03A6", tex:null, ttype:CONST}, +{input:"pi", tag:"mi", output:"\u03C0", tex:null, ttype:CONST}, +{input:"Pi", tag:"mo", output:"\u03A0", tex:null, ttype:CONST}, +{input:"psi", tag:"mi", output:"\u03C8", tex:null, ttype:CONST}, +{input:"Psi", tag:"mi", output:"\u03A8", tex:null, ttype:CONST}, +{input:"rho", tag:"mi", output:"\u03C1", tex:null, ttype:CONST}, +{input:"sigma", tag:"mi", output:"\u03C3", tex:null, ttype:CONST}, +{input:"Sigma", tag:"mo", output:"\u03A3", tex:null, ttype:CONST}, +{input:"tau", tag:"mi", output:"\u03C4", tex:null, ttype:CONST}, +{input:"theta", tag:"mi", output:"\u03B8", tex:null, ttype:CONST}, +{input:"vartheta", tag:"mi", output:"\u03D1", tex:null, ttype:CONST}, +{input:"Theta", tag:"mo", output:"\u0398", tex:null, ttype:CONST}, +{input:"upsilon", tag:"mi", output:"\u03C5", tex:null, ttype:CONST}, +{input:"xi", tag:"mi", output:"\u03BE", tex:null, ttype:CONST}, +{input:"Xi", tag:"mo", output:"\u039E", tex:null, ttype:CONST}, +{input:"zeta", tag:"mi", output:"\u03B6", tex:null, ttype:CONST}, + +//binary operation symbols +{input:"*", tag:"mo", output:"\u22C5", tex:"cdot", ttype:CONST}, +{input:"**", tag:"mo", output:"\u22C6", tex:"star", ttype:CONST}, +{input:"//", tag:"mo", output:"/", tex:null, ttype:CONST}, +{input:"\\\\", tag:"mo", output:"\\", tex:"backslash", ttype:CONST}, +{input:"setminus", tag:"mo", output:"\\", tex:null, ttype:CONST}, +{input:"xx", tag:"mo", output:"\u00D7", tex:"times", ttype:CONST}, +{input:"-:", tag:"mo", output:"\u00F7", tex:"divide", ttype:CONST}, +{input:"@", tag:"mo", output:"\u2218", tex:"circ", ttype:CONST}, +{input:"o+", tag:"mo", output:"\u2295", tex:"oplus", ttype:CONST}, +{input:"ox", tag:"mo", output:"\u2297", tex:"otimes", ttype:CONST}, +{input:"o.", tag:"mo", output:"\u2299", tex:"odot", ttype:CONST}, +{input:"sum", tag:"mo", output:"\u2211", tex:null, ttype:UNDEROVER}, +{input:"prod", tag:"mo", output:"\u220F", tex:null, ttype:UNDEROVER}, +{input:"^^", tag:"mo", output:"\u2227", tex:"wedge", ttype:CONST}, +{input:"^^^", tag:"mo", output:"\u22C0", tex:"bigwedge", ttype:UNDEROVER}, +{input:"vv", tag:"mo", output:"\u2228", tex:"vee", ttype:CONST}, +{input:"vvv", tag:"mo", output:"\u22C1", tex:"bigvee", ttype:UNDEROVER}, +{input:"nn", tag:"mo", output:"\u2229", tex:"cap", ttype:CONST}, +{input:"nnn", tag:"mo", output:"\u22C2", tex:"bigcap", ttype:UNDEROVER}, +{input:"uu", tag:"mo", output:"\u222A", tex:"cup", ttype:CONST}, +{input:"uuu", tag:"mo", output:"\u22C3", tex:"bigcup", ttype:UNDEROVER}, + +//binary relation symbols +{input:"!=", tag:"mo", output:"\u2260", tex:"ne", ttype:CONST}, +{input:":=", tag:"mo", output:":=", tex:null, ttype:CONST}, +{input:"lt", tag:"mo", output:"<", tex:null, ttype:CONST}, +{input:"<=", tag:"mo", output:"\u2264", tex:"le", ttype:CONST}, +{input:"lt=", tag:"mo", output:"\u2264", tex:"leq", ttype:CONST}, +{input:">=", tag:"mo", output:"\u2265", tex:"ge", ttype:CONST}, +{input:"geq", tag:"mo", output:"\u2265", tex:null, ttype:CONST}, +{input:"-<", tag:"mo", output:"\u227A", tex:"prec", ttype:CONST}, +{input:"-lt", tag:"mo", output:"\u227A", tex:null, ttype:CONST}, +{input:">-", tag:"mo", output:"\u227B", tex:"succ", ttype:CONST}, +{input:"in", tag:"mo", output:"\u2208", tex:null, ttype:CONST}, +{input:"!in", tag:"mo", output:"\u2209", tex:"notin", ttype:CONST}, +{input:"sub", tag:"mo", output:"\u2282", tex:"subset", ttype:CONST}, +{input:"sup", tag:"mo", output:"\u2283", tex:"supset", ttype:CONST}, +{input:"sube", tag:"mo", output:"\u2286", tex:"subseteq", ttype:CONST}, +{input:"supe", tag:"mo", output:"\u2287", tex:"supseteq", ttype:CONST}, +{input:"-=", tag:"mo", output:"\u2261", tex:"equiv", ttype:CONST}, +{input:"~=", tag:"mo", output:"\u2245", tex:"cong", ttype:CONST}, +{input:"~~", tag:"mo", output:"\u2248", tex:"approx", ttype:CONST}, +{input:"prop", tag:"mo", output:"\u221D", tex:"propto", ttype:CONST}, + +//logical symbols +{input:"and", tag:"mtext", output:"and", tex:null, ttype:SPACE}, +{input:"or", tag:"mtext", output:"or", tex:null, ttype:SPACE}, +{input:"not", tag:"mo", output:"\u00AC", tex:"neg", ttype:CONST}, +{input:"=>", tag:"mo", output:"\u21D2", tex:"implies", ttype:CONST}, +{input:"if", tag:"mo", output:"if", tex:null, ttype:SPACE}, +{input:"<=>", tag:"mo", output:"\u21D4", tex:"iff", ttype:CONST}, +{input:"AA", tag:"mo", output:"\u2200", tex:"forall", ttype:CONST}, +{input:"EE", tag:"mo", output:"\u2203", tex:"exists", ttype:CONST}, +{input:"_|_", tag:"mo", output:"\u22A5", tex:"bot", ttype:CONST}, +{input:"TT", tag:"mo", output:"\u22A4", tex:"top", ttype:CONST}, +{input:"|--", tag:"mo", output:"\u22A2", tex:"vdash", ttype:CONST}, +{input:"|==", tag:"mo", output:"\u22A8", tex:"models", ttype:CONST}, + +//grouping brackets +{input:"(", tag:"mo", output:"(", tex:null, ttype:LEFTBRACKET}, +{input:")", tag:"mo", output:")", tex:null, ttype:RIGHTBRACKET}, +{input:"[", tag:"mo", output:"[", tex:null, ttype:LEFTBRACKET}, +{input:"]", tag:"mo", output:"]", tex:null, ttype:RIGHTBRACKET}, +{input:"{", tag:"mo", output:"{", tex:null, ttype:LEFTBRACKET}, +{input:"}", tag:"mo", output:"}", tex:null, ttype:RIGHTBRACKET}, +{input:"|", tag:"mo", output:"|", tex:null, ttype:LEFTRIGHT}, +//{input:"||", tag:"mo", output:"||", tex:null, ttype:LEFTRIGHT}, +{input:"(:", tag:"mo", output:"\u2329", tex:"langle", ttype:LEFTBRACKET}, +{input:":)", tag:"mo", output:"\u232A", tex:"rangle", ttype:RIGHTBRACKET}, +{input:"<<", tag:"mo", output:"\u2329", tex:null, ttype:LEFTBRACKET}, +{input:">>", tag:"mo", output:"\u232A", tex:null, ttype:RIGHTBRACKET}, +{input:"{:", tag:"mo", output:"{:", tex:null, ttype:LEFTBRACKET, invisible:true}, +{input:":}", tag:"mo", output:":}", tex:null, ttype:RIGHTBRACKET, invisible:true}, + +//miscellaneous symbols +{input:"int", tag:"mo", output:"\u222B", tex:null, ttype:CONST}, +{input:"dx", tag:"mi", output:"{:d x:}", tex:null, ttype:DEFINITION}, +{input:"dy", tag:"mi", output:"{:d y:}", tex:null, ttype:DEFINITION}, +{input:"dz", tag:"mi", output:"{:d z:}", tex:null, ttype:DEFINITION}, +{input:"dt", tag:"mi", output:"{:d t:}", tex:null, ttype:DEFINITION}, +{input:"oint", tag:"mo", output:"\u222E", tex:null, ttype:CONST}, +{input:"del", tag:"mo", output:"\u2202", tex:"partial", ttype:CONST}, +{input:"grad", tag:"mo", output:"\u2207", tex:"nabla", ttype:CONST}, +{input:"+-", tag:"mo", output:"\u00B1", tex:"pm", ttype:CONST}, +{input:"O/", tag:"mo", output:"\u2205", tex:"emptyset", ttype:CONST}, +{input:"oo", tag:"mo", output:"\u221E", tex:"infty", ttype:CONST}, +{input:"aleph", tag:"mo", output:"\u2135", tex:null, ttype:CONST}, +{input:"...", tag:"mo", output:"...", tex:"ldots", ttype:CONST}, +{input:":.", tag:"mo", output:"\u2234", tex:"therefore", ttype:CONST}, +{input:"/_", tag:"mo", output:"\u2220", tex:"angle", ttype:CONST}, +{input:"\\ ", tag:"mo", output:"\u00A0", tex:null, ttype:CONST}, +{input:"quad", tag:"mo", output:"\u00A0\u00A0", tex:null, ttype:CONST}, +{input:"qquad", tag:"mo", output:"\u00A0\u00A0\u00A0\u00A0", tex:null, ttype:CONST}, +{input:"cdots", tag:"mo", output:"\u22EF", tex:null, ttype:CONST}, +{input:"vdots", tag:"mo", output:"\u22EE", tex:null, ttype:CONST}, +{input:"ddots", tag:"mo", output:"\u22F1", tex:null, ttype:CONST}, +{input:"diamond", tag:"mo", output:"\u22C4", tex:null, ttype:CONST}, +{input:"square", tag:"mo", output:"\u25A1", tex:null, ttype:CONST}, +{input:"|__", tag:"mo", output:"\u230A", tex:"lfloor", ttype:CONST}, +{input:"__|", tag:"mo", output:"\u230B", tex:"rfloor", ttype:CONST}, +{input:"|~", tag:"mo", output:"\u2308", tex:"lceiling", ttype:CONST}, +{input:"~|", tag:"mo", output:"\u2309", tex:"rceiling", ttype:CONST}, +{input:"CC", tag:"mo", output:"\u2102", tex:null, ttype:CONST}, +{input:"NN", tag:"mo", output:"\u2115", tex:null, ttype:CONST}, +{input:"QQ", tag:"mo", output:"\u211A", tex:null, ttype:CONST}, +{input:"RR", tag:"mo", output:"\u211D", tex:null, ttype:CONST}, +{input:"ZZ", tag:"mo", output:"\u2124", tex:null, ttype:CONST}, +{input:"f", tag:"mi", output:"f", tex:null, ttype:UNARY, func:true}, +{input:"g", tag:"mi", output:"g", tex:null, ttype:UNARY, func:true}, + +//standard functions +{input:"lim", tag:"mo", output:"lim", tex:null, ttype:UNDEROVER}, +{input:"Lim", tag:"mo", output:"Lim", tex:null, ttype:UNDEROVER}, +{input:"sin", tag:"mo", output:"sin", tex:null, ttype:UNARY, func:true}, +{input:"cos", tag:"mo", output:"cos", tex:null, ttype:UNARY, func:true}, +{input:"tan", tag:"mo", output:"tan", tex:null, ttype:UNARY, func:true}, +{input:"sinh", tag:"mo", output:"sinh", tex:null, ttype:UNARY, func:true}, +{input:"cosh", tag:"mo", output:"cosh", tex:null, ttype:UNARY, func:true}, +{input:"tanh", tag:"mo", output:"tanh", tex:null, ttype:UNARY, func:true}, +{input:"cot", tag:"mo", output:"cot", tex:null, ttype:UNARY, func:true}, +{input:"sec", tag:"mo", output:"sec", tex:null, ttype:UNARY, func:true}, +{input:"csc", tag:"mo", output:"csc", tex:null, ttype:UNARY, func:true}, +{input:"log", tag:"mo", output:"log", tex:null, ttype:UNARY, func:true}, +{input:"ln", tag:"mo", output:"ln", tex:null, ttype:UNARY, func:true}, +{input:"det", tag:"mo", output:"det", tex:null, ttype:UNARY, func:true}, +{input:"dim", tag:"mo", output:"dim", tex:null, ttype:CONST}, +{input:"mod", tag:"mo", output:"mod", tex:null, ttype:CONST}, +{input:"gcd", tag:"mo", output:"gcd", tex:null, ttype:UNARY, func:true}, +{input:"lcm", tag:"mo", output:"lcm", tex:null, ttype:UNARY, func:true}, +{input:"lub", tag:"mo", output:"lub", tex:null, ttype:CONST}, +{input:"glb", tag:"mo", output:"glb", tex:null, ttype:CONST}, +{input:"min", tag:"mo", output:"min", tex:null, ttype:UNDEROVER}, +{input:"max", tag:"mo", output:"max", tex:null, ttype:UNDEROVER}, + +//arrows +{input:"uarr", tag:"mo", output:"\u2191", tex:"uparrow", ttype:CONST}, +{input:"darr", tag:"mo", output:"\u2193", tex:"downarrow", ttype:CONST}, +{input:"rarr", tag:"mo", output:"\u2192", tex:"rightarrow", ttype:CONST}, +{input:"->", tag:"mo", output:"\u2192", tex:"to", ttype:CONST}, +{input:"|->", tag:"mo", output:"\u21A6", tex:"mapsto", ttype:CONST}, +{input:"larr", tag:"mo", output:"\u2190", tex:"leftarrow", ttype:CONST}, +{input:"harr", tag:"mo", output:"\u2194", tex:"leftrightarrow", ttype:CONST}, +{input:"rArr", tag:"mo", output:"\u21D2", tex:"Rightarrow", ttype:CONST}, +{input:"lArr", tag:"mo", output:"\u21D0", tex:"Leftarrow", ttype:CONST}, +{input:"hArr", tag:"mo", output:"\u21D4", tex:"Leftrightarrow", ttype:CONST}, + +//commands with argument +AMsqrt, AMroot, AMfrac, AMdiv, AMover, AMsub, AMsup, +{input:"hat", tag:"mover", output:"\u005E", tex:null, ttype:UNARY, acc:true}, +{input:"bar", tag:"mover", output:"\u00AF", tex:"overline", ttype:UNARY, acc:true}, +{input:"vec", tag:"mover", output:"\u2192", tex:null, ttype:UNARY, acc:true}, +{input:"dot", tag:"mover", output:".", tex:null, ttype:UNARY, acc:true}, +{input:"ddot", tag:"mover", output:"..", tex:null, ttype:UNARY, acc:true}, +{input:"ul", tag:"munder", output:"\u0332", tex:"underline", ttype:UNARY, acc:true}, +AMtext, AMmbox, AMquote, +{input:"bb", tag:"mstyle", atname:"fontweight", atval:"bold", output:"bb", tex:null, ttype:UNARY}, +{input:"mathbf", tag:"mstyle", atname:"fontweight", atval:"bold", output:"mathbf", tex:null, ttype:UNARY}, +{input:"sf", tag:"mstyle", atname:"fontfamily", atval:"sans-serif", output:"sf", tex:null, ttype:UNARY}, +{input:"mathsf", tag:"mstyle", atname:"fontfamily", atval:"sans-serif", output:"mathsf", tex:null, ttype:UNARY}, +{input:"bbb", tag:"mstyle", atname:"mathvariant", atval:"double-struck", output:"bbb", tex:null, ttype:UNARY, codes:AMbbb}, +{input:"mathbb", tag:"mstyle", atname:"mathvariant", atval:"double-struck", output:"mathbb", tex:null, ttype:UNARY, codes:AMbbb}, +{input:"cc", tag:"mstyle", atname:"mathvariant", atval:"script", output:"cc", tex:null, ttype:UNARY, codes:AMcal}, +{input:"mathcal", tag:"mstyle", atname:"mathvariant", atval:"script", output:"mathcal", tex:null, ttype:UNARY, codes:AMcal}, +{input:"tt", tag:"mstyle", atname:"fontfamily", atval:"monospace", output:"tt", tex:null, ttype:UNARY}, +{input:"mathtt", tag:"mstyle", atname:"fontfamily", atval:"monospace", output:"mathtt", tex:null, ttype:UNARY}, +{input:"fr", tag:"mstyle", atname:"mathvariant", atval:"fraktur", output:"fr", tex:null, ttype:UNARY, codes:AMfrk}, +{input:"mathfrak", tag:"mstyle", atname:"mathvariant", atval:"fraktur", output:"mathfrak", tex:null, ttype:UNARY, codes:AMfrk} +]; + +function compareNames(s1,s2) { + if (s1.input > s2.input) return 1 + else return -1; +} + +var AMnames = []; //list of input symbols + +function AMinitSymbols() { + var texsymbols = [], i; + for (i=0; i=n where str appears or would be inserted +// assumes arr is sorted + if (n==0) { + var h,m; + n = -1; + h = arr.length; + while (n+1> 1; + if (arr[m]=str +} + +function AMgetSymbol(str) { +//return maximal initial substring of str that appears in names +//return null if there is none + var k = 0; //new pos + var j = 0; //old pos + var mk; //match pos + var st; + var tagst; + var match = ""; + var more = true; + for (var i=1; i<=str.length && more; i++) { + st = str.slice(0,i); //initial substring of length i + j = k; + k = AMposition(AMnames, st, j); + if (k=AMnames[k]; + } + AMpreviousSymbol=AMcurrentSymbol; + if (match!=""){ + AMcurrentSymbol=AMsymbols[mk].ttype; + return AMsymbols[mk]; + } +// if str[0] is a digit or - return maxsubstring of digits.digits + AMcurrentSymbol=CONST; + k = 1; + st = str.slice(0,1); + var integ = true; + while ("0"<=st && st<="9" && k<=str.length) { + st = str.slice(k,k+1); + k++; + } + if (st == decimalsign) { + st = str.slice(k,k+1); + if ("0"<=st && st<="9") { + integ = false; + k++; + while ("0"<=st && st<="9" && k<=str.length) { + st = str.slice(k,k+1); + k++; + } + } + } + if ((integ && k>1) || k>2) { + st = str.slice(0,k-1); + tagst = "mn"; + } else { + k = 2; + st = str.slice(0,1); //take 1 character + tagst = (("A">st || st>"Z") && ("a">st || st>"z")?"mo":"mi"); + } + if (st=="-" && AMpreviousSymbol==INFIX) + return {input:st, tag:tagst, output:st, ttype:UNARY, func:true}; + return {input:st, tag:tagst, output:st, ttype:CONST}; +} + +function AMremoveBrackets(node) { + var st; + if (node.nodeName=="mrow") { + st = node.firstChild.firstChild.nodeValue; + if (st=="(" || st=="[" || st=="{") node.removeChild(node.firstChild); + } + if (node.nodeName=="mrow") { + st = node.lastChild.firstChild.nodeValue; + if (st==")" || st=="]" || st=="}") node.removeChild(node.lastChild); + } +} + +/*Parsing ASCII math expressions with the following grammar +v ::= [A-Za-z] | greek letters | numbers | other constant symbols +u ::= sqrt | text | bb | other unary symbols for font commands +b ::= frac | root | stackrel binary symbols +l ::= ( | [ | { | (: | {: left brackets +r ::= ) | ] | } | :) | :} right brackets +S ::= v | lEr | uS | bSS Simple expression +I ::= S_S | S^S | S_S^S | S Intermediate expression +E ::= IE | I/I Expression +Each terminal symbol is translated into a corresponding mathml node.*/ + +var AMnestingDepth,AMpreviousSymbol,AMcurrentSymbol; + +function AMparseSexpr(str) { //parses str and returns [node,tailstr] + var symbol, node, result, i, st,// rightvert = false, + newFrag = document.createDocumentFragment(); + str = AMremoveCharsAndBlanks(str,0); + symbol = AMgetSymbol(str); //either a token or a bracket or empty + if (symbol == null || symbol.ttype == RIGHTBRACKET && AMnestingDepth > 0) { + return [null,str]; + } + if (symbol.ttype == DEFINITION) { + str = symbol.output+AMremoveCharsAndBlanks(str,symbol.input.length); + symbol = AMgetSymbol(str); + } + switch (symbol.ttype) { + case UNDEROVER: + case CONST: + str = AMremoveCharsAndBlanks(str,symbol.input.length); + return [AMcreateMmlNode(symbol.tag, //its a constant + document.createTextNode(symbol.output)),str]; + case LEFTBRACKET: //read (expr+) + AMnestingDepth++; + str = AMremoveCharsAndBlanks(str,symbol.input.length); + result = AMparseExpr(str,true); + AMnestingDepth--; + if (typeof symbol.invisible == "boolean" && symbol.invisible) + node = AMcreateMmlNode("mrow",result[0]); + else { + node = AMcreateMmlNode("mo",document.createTextNode(symbol.output)); + node = AMcreateMmlNode("mrow",node); + node.appendChild(result[0]); + } + return [node,result[1]]; + case TEXT: + if (symbol!=AMquote) str = AMremoveCharsAndBlanks(str,symbol.input.length); + if (str.charAt(0)=="{") i=str.indexOf("}"); + else if (str.charAt(0)=="(") i=str.indexOf(")"); + else if (str.charAt(0)=="[") i=str.indexOf("]"); + else if (symbol==AMquote) i=str.slice(1).indexOf("\"")+1; + else i = 0; + if (i==-1) i = str.length; + st = str.slice(1,i); + if (st.charAt(0) == " ") { + node = AMcreateElementMathML("mspace"); + node.setAttribute("width","1ex"); + newFrag.appendChild(node); + } + newFrag.appendChild( + AMcreateMmlNode(symbol.tag,document.createTextNode(st))); + if (st.charAt(st.length-1) == " ") { + node = AMcreateElementMathML("mspace"); + node.setAttribute("width","1ex"); + newFrag.appendChild(node); + } + str = AMremoveCharsAndBlanks(str,i+1); + return [AMcreateMmlNode("mrow",newFrag),str]; + case UNARY: + str = AMremoveCharsAndBlanks(str,symbol.input.length); + result = AMparseSexpr(str); + if (result[0]==null) return [AMcreateMmlNode(symbol.tag, + document.createTextNode(symbol.output)),str]; + if (typeof symbol.func == "boolean" && symbol.func) { // functions hack + st = str.charAt(0); + if (st=="^" || st=="_" || st=="/" || st=="|") { + return [AMcreateMmlNode(symbol.tag, + document.createTextNode(symbol.output)),str]; + } else { + node = AMcreateMmlNode("mrow", + AMcreateMmlNode(symbol.tag,document.createTextNode(symbol.output))); + node.appendChild(result[0]); + return [node,result[1]]; + } + } + AMremoveBrackets(result[0]); + if (symbol.input == "sqrt") { // sqrt + return [AMcreateMmlNode(symbol.tag,result[0]),result[1]]; + } else if (typeof symbol.acc == "boolean" && symbol.acc) { // accent + node = AMcreateMmlNode(symbol.tag,result[0]); + node.appendChild(AMcreateMmlNode("mo",document.createTextNode(symbol.output))); + return [node,result[1]]; + } else { // font change command + if (!isIE && typeof symbol.codes != "undefined") { + for (i=0; i64 && st.charCodeAt(j)<91) newst = newst + + String.fromCharCode(symbol.codes[st.charCodeAt(j)-65]); + else newst = newst + st.charAt(j); + if (result[0].nodeName=="mi") + result[0]=AMcreateElementMathML("mo"). + appendChild(document.createTextNode(newst)); + else result[0].replaceChild(AMcreateElementMathML("mo"). + appendChild(document.createTextNode(newst)),result[0].childNodes[i]); + } + } + node = AMcreateMmlNode(symbol.tag,result[0]); + node.setAttribute(symbol.atname,symbol.atval); + return [node,result[1]]; + } + case BINARY: + str = AMremoveCharsAndBlanks(str,symbol.input.length); + result = AMparseSexpr(str); + if (result[0]==null) return [AMcreateMmlNode("mo", + document.createTextNode(symbol.input)),str]; + AMremoveBrackets(result[0]); + var result2 = AMparseSexpr(result[1]); + if (result2[0]==null) return [AMcreateMmlNode("mo", + document.createTextNode(symbol.input)),str]; + AMremoveBrackets(result2[0]); + if (symbol.input=="root" || symbol.input=="stackrel") + newFrag.appendChild(result2[0]); + newFrag.appendChild(result[0]); + if (symbol.input=="frac") newFrag.appendChild(result2[0]); + return [AMcreateMmlNode(symbol.tag,newFrag),result2[1]]; + case INFIX: + str = AMremoveCharsAndBlanks(str,symbol.input.length); + return [AMcreateMmlNode("mo",document.createTextNode(symbol.output)),str]; + case SPACE: + str = AMremoveCharsAndBlanks(str,symbol.input.length); + node = AMcreateElementMathML("mspace"); + node.setAttribute("width","1ex"); + newFrag.appendChild(node); + newFrag.appendChild( + AMcreateMmlNode(symbol.tag,document.createTextNode(symbol.output))); + node = AMcreateElementMathML("mspace"); + node.setAttribute("width","1ex"); + newFrag.appendChild(node); + return [AMcreateMmlNode("mrow",newFrag),str]; + case LEFTRIGHT: +// if (rightvert) return [null,str]; else rightvert = true; + AMnestingDepth++; + str = AMremoveCharsAndBlanks(str,symbol.input.length); + result = AMparseExpr(str,false); + AMnestingDepth--; + var st = ""; + if (result[0].lastChild!=null) + st = result[0].lastChild.firstChild.nodeValue; +//alert(result[0].lastChild+"***"+st); + if (st == "|") { // its an absolute value subterm + node = AMcreateMmlNode("mo",document.createTextNode(symbol.output)); + node = AMcreateMmlNode("mrow",node); + node.appendChild(result[0]); + return [node,result[1]]; + } else { // the "|" is a \mid + node = AMcreateMmlNode("mo",document.createTextNode(symbol.output)); + node = AMcreateMmlNode("mrow",node); + return [node,str]; + } + default: +//alert("default"); + str = AMremoveCharsAndBlanks(str,symbol.input.length); + return [AMcreateMmlNode(symbol.tag, //its a constant + document.createTextNode(symbol.output)),str]; + } +} + +function AMparseIexpr(str) { + var symbol, sym1, sym2, node, result, underover; + str = AMremoveCharsAndBlanks(str,0); + sym1 = AMgetSymbol(str); + result = AMparseSexpr(str); + node = result[0]; + str = result[1]; + symbol = AMgetSymbol(str); + if (symbol.ttype == INFIX && symbol.input != "/") { + str = AMremoveCharsAndBlanks(str,symbol.input.length); +// if (symbol.input == "/") result = AMparseIexpr(str); else ... + result = AMparseSexpr(str); + if (result[0] == null) // show box in place of missing argument + result[0] = AMcreateMmlNode("mo",document.createTextNode("\u25A1")); + else AMremoveBrackets(result[0]); + str = result[1]; +// if (symbol.input == "/") AMremoveBrackets(node); + if (symbol.input == "_") { + sym2 = AMgetSymbol(str); + underover = (sym1.ttype == UNDEROVER); + if (sym2.input == "^") { + str = AMremoveCharsAndBlanks(str,sym2.input.length); + var res2 = AMparseSexpr(str); + AMremoveBrackets(res2[0]); + str = res2[1]; + node = AMcreateMmlNode((underover?"munderover":"msubsup"),node); + node.appendChild(result[0]); + node.appendChild(res2[0]); + node = AMcreateMmlNode("mrow",node); // so sum does not stretch + } else { + node = AMcreateMmlNode((underover?"munder":"msub"),node); + node.appendChild(result[0]); + } + } else { + node = AMcreateMmlNode(symbol.tag,node); + node.appendChild(result[0]); + } + } + return [node,str]; +} + +function AMparseExpr(str,rightbracket) { + var symbol, node, result, i, nodeList = [], + newFrag = document.createDocumentFragment(); + do { + str = AMremoveCharsAndBlanks(str,0); + result = AMparseIexpr(str); + node = result[0]; + str = result[1]; + symbol = AMgetSymbol(str); + if (symbol.ttype == INFIX && symbol.input == "/") { + str = AMremoveCharsAndBlanks(str,symbol.input.length); + result = AMparseIexpr(str); + if (result[0] == null) // show box in place of missing argument + result[0] = AMcreateMmlNode("mo",document.createTextNode("\u25A1")); + else AMremoveBrackets(result[0]); + str = result[1]; + AMremoveBrackets(node); + node = AMcreateMmlNode(symbol.tag,node); + node.appendChild(result[0]); + newFrag.appendChild(node); + symbol = AMgetSymbol(str); + } + else if (node!=undefined) newFrag.appendChild(node); + } while ((symbol.ttype != RIGHTBRACKET && + (symbol.ttype != LEFTRIGHT || rightbracket) + || AMnestingDepth == 0) && symbol!=null && symbol.output!=""); + if (symbol.ttype == RIGHTBRACKET || symbol.ttype == LEFTRIGHT) { +// if (AMnestingDepth > 0) AMnestingDepth--; + var len = newFrag.childNodes.length; + if (len>0 && newFrag.childNodes[len-1].nodeName == "mrow" && len>1 && + newFrag.childNodes[len-2].nodeName == "mo" && + newFrag.childNodes[len-2].firstChild.nodeValue == ",") { //matrix + var right = newFrag.childNodes[len-1].lastChild.firstChild.nodeValue; + if (right==")" || right=="]") { + var left = newFrag.childNodes[len-1].firstChild.firstChild.nodeValue; + if (left=="(" && right==")" && symbol.output != "}" || + left=="[" && right=="]") { + var pos = []; // positions of commas + var matrix = true; + var m = newFrag.childNodes.length; + for (i=0; matrix && i1) matrix = pos[i].length == pos[i-2].length; + } + if (matrix) { + var row, frag, n, k, table = document.createDocumentFragment(); + for (i=0; i(-,-,...,-,-) + n = node.childNodes.length; + k = 0; + node.removeChild(node.firstChild); //remove ( + for (j=1; j2) { + newFrag.removeChild(newFrag.firstChild); //remove ) + newFrag.removeChild(newFrag.firstChild); //remove , + } + table.appendChild(AMcreateMmlNode("mtr",row)); + } + node = AMcreateMmlNode("mtable",table); + if (typeof symbol.invisible == "boolean" && symbol.invisible) node.setAttribute("columnalign","left"); + newFrag.replaceChild(node,newFrag.firstChild); + } + } + } + } + str = AMremoveCharsAndBlanks(str,symbol.input.length); + if (typeof symbol.invisible != "boolean" || !symbol.invisible) { + node = AMcreateMmlNode("mo",document.createTextNode(symbol.output)); + newFrag.appendChild(node); + } + } + return [newFrag,str]; +} + +function AMparseMath(str) { + var result, node = AMcreateElementMathML("mstyle"); + if (mathcolor != "") node.setAttribute("mathcolor",mathcolor); + if (displaystyle) node.setAttribute("displaystyle","true"); + if (mathfontfamily != "") node.setAttribute("fontfamily",mathfontfamily); + AMnestingDepth = 0; + node.appendChild(AMparseExpr(str.replace(/^\s+/g,""),false)[0]); + node = AMcreateMmlNode("math",node); + if (showasciiformulaonhover) node.setAttribute("title",str); + if (mathfontfamily != "" && (isIE || mathfontfamily != "serif")) { + var fnode = AMcreateElementXHTML("font"); + fnode.setAttribute("face",mathfontfamily); + fnode.appendChild(node); + return fnode; + } + return node; +} + +function AMstrarr2docFrag(arr, linebreaks) { + var newFrag=document.createDocumentFragment(); + var expr = false; + for (var i=0; i1 || mtch) { + if (checkForMathML) { + checkForMathML = false; + var nd = AMisMathMLavailable(); + AMnoMathML = nd != null + if (AMnoMathML && notifyIfNoMathML) + AMbody.insertBefore(nd,AMbody.childNodes[0]); + } + if (!AMnoMathML) { + frg = AMstrarr2docFrag(arr,n.nodeType==8); + var len = frg.childNodes.length; + n.parentNode.replaceChild(frg,n); + return len-1; + } else return 0; + } + } + } else return 0; + } else if (n.nodeName!="math") { + for (i=0; i"); + document.write(""); +} + +// GO1.1 Generic onload by Brothercake +// http://www.brothercake.com/ +//onload function (replaces the onload="translate()" in the tag) +function generic() +{ + translate(); +}; +//setup onload function +if(typeof window.addEventListener != 'undefined') +{ + //.. gecko, safari, konqueror and standard + window.addEventListener('load', generic, false); +} +else if(typeof document.addEventListener != 'undefined') +{ + //.. opera 7 + document.addEventListener('load', generic, false); +} +else if(typeof window.attachEvent != 'undefined') +{ + //.. win/ie + window.attachEvent('onload', generic); +} +//** remove this condition to degrade older browsers +else +{ + //.. mac/ie5 and anything else that gets this far + //if there's an existing onload function + if(typeof window.onload == 'function') + { + //store it + var existing = onload; + //add new onload handler + window.onload = function() + { + //call existing onload function + existing(); + //call generic onload function + generic(); + }; + } + else + { + //setup onload function + window.onload = generic; + } +} Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/Equation/equation.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/Equation/Attic/equation.js,v diff -u -r1.3 -r1.4 --- openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/Equation/equation.js 4 Jun 2006 00:45:50 -0000 1.3 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/Equation/equation.js 2 Feb 2007 21:04:51 -0000 1.4 @@ -1,146 +1,198 @@ -// Table Operations Plugin for HTMLArea-3.0 -// Implementation by Nazarij Dubnytskyj. Sponsored by NasCreative -// -// htmlArea v3.0 - Copyright (c) 2002 interactivetools.com, inc. -// This notice MUST stay intact for use (see license.txt). -// -// A free WYSIWYG editor replacement for + + +

+ + + + Based on ASCIIMathML by Peter Jipsen, +Chapman University
+ For more information on AsciiMathML visit this page: http://www1.chapman.edu/~jipsen/mathml/asciimath.html + + +
+Attention: Editing the formula in the editor is not possible, please use this dialog! + + +
+ + + \ No newline at end of file Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/ExtendedFileManager/Readme.txt =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/ExtendedFileManager/Readme.txt,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/ExtendedFileManager/Readme.txt 2 Feb 2007 21:04:51 -0000 1.1 @@ -0,0 +1,111 @@ +Package : Extended File Manager EFM 1.1.1 + +Version 1.1 created from 1.0 beta by Krzysztof Kotowicz + +Overview : +---------- + +Extended File Manager is an advanced plugin for Xinha + +It works in two different modes. +1). Insert Image Mode and +2). Insert File Link Mode. + +In Insert Image Mode, it replaces the basic insert image functionality of Xinha with its advanced image manager. + +If Insert File Link Mode is enabled, a new icon will be added to the toolbar with advanced file linking capability. + + + +Complete Features : +------------------- +* Easy config.inc file that enables individual options for both modes. +* Thumnail View +* List View +* Nice icons for both views +* Create Folders +* Vertical Scrolling +* Allowed extensions to view or upload. +* File Uploads +* Max File upload limit +* Max Upload Folder size (Including all subfolders and files. A must see option.) +* Dynamic display of available free space in the Upload Folder +* Dynamic Thumbnails using Image libraries or browser resize +* Image Editor (Actually done by Wei...a great addon) +* Can be used to insert images along with properties. +* Can be used to insert link to non-image files like pdf or zip. +* You can specify image margin / padding / background and border colors +* You may edit Alt/title tags for inserted images + +(Most of the features can be enabled/disabled as needed) + +Installation : +-------------- + +Installing involves extracting the archive to 'plugins' subdirectory of Xinha +and selecting the plugin in appropriate xinha_plugins list. + +Plugin may be configured via xinha_config.ExtendedFileManager object. +Look into ImageManager plugin documentation as this plugin uses almost identical +settings. All available options can be found in the file config.inc.php. + +// only snippets of code from initializing file shown below + + + xinha_plugins = xinha_plugins ? xinha_plugins : + [ + 'ContextMenu', + 'SuperClean', + 'CharacterMap', + 'GetHtml', + 'ExtendedFileManager', + /*'ImageManager',*/ // replace image manager with EFM + 'Linker' + ]; + +... + +//If you don't want to add a button for linking files and use only the advanced ImageManager +xinha_config.ExtendedFileManager.use_linker = false; +// pass the configuration to plugin +if (xinha_config.ExtendedFileManager) { + with (xinha_config.ExtendedFileManager) + { + '; + $IMConfig['images_url'] = ''; + $IMConfig['files_dir'] = ''; + $IMConfig['files_url'] = ''; + $IMConfig['thumbnail_prefix'] = 't_'; + $IMConfig['thumbnail_dir'] = 't'; + $IMConfig['resized_prefix'] = 'resized_'; + $IMConfig['resized_dir'] = ''; + $IMConfig['tmp_prefix'] = '_tmp'; + $IMConfig['max_filesize_kb_image'] = 2000; + // maximum size for uploading files in 'insert image' mode (2000 kB here) + + $IMConfig['max_filesize_kb_link'] = 5000; + // maximum size for uploading files in 'insert link' mode (5000 kB here) + + // Maximum upload folder size in Megabytes. + // Use 0 to disable limit + $IMConfig['max_foldersize_mb'] = 0; + + $IMConfig['allowed_image_extensions'] = array("jpg","gif","png"); + $IMConfig['allowed_link_extensions'] = array("jpg","gif","pdf","ip","txt", + "psd","png","html","swf", + "xml","xls"); + + require_once '/path/to/xinha/contrib/php-xinha.php'; + xinha_pass_to_php_backend($IMConfig); + + ?> + } +} + +===== +afrusoft@gmail.com - author of EFM 1.0 beta +koto@webworkers.pl - EFM 1.1 (most of the code taken from Xinha codebase) \ No newline at end of file Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/ExtendedFileManager/backend.php =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/ExtendedFileManager/backend.php,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/ExtendedFileManager/backend.php 2 Feb 2007 21:04:51 -0000 1.1 @@ -0,0 +1,110 @@ + \ No newline at end of file Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/ExtendedFileManager/config.inc.php =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/ExtendedFileManager/config.inc.php,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/ExtendedFileManager/config.inc.php 2 Feb 2007 21:04:51 -0000 1.1 @@ -0,0 +1,384 @@ + + * Package: ExtendedFileManager + * http://www.afrusoft.com/htmlarea + */ + +/* Configuration file usage: + * There are two insertModes for this filemanager. + * One is "image" and another is "link". + * So you can assign config values as below + * + * if($insertMode=="image") $IMConfig['property']=somevalueforimagemode; + * else if($insertMode=="link") $IMConfig['property']=somevalueforlinkmode; + * + * (or) you can directly as $IMConfig['property']=somevalueforbothmodes; + * + * Best of Luck :) Afru. + */ + +/* + * Getting the mode for further differentiation + */ + +if(empty($insertMode)) + $insertMode="image"; + +/** +* Default backend URL +* +* URL to use for unified backend. +* +* The ?__plugin=ExtendedFileManager& is required. +*/ + +$IMConfig['backend_url'] = "backend.php?__plugin=ExtendedFileManager&"; + +/** +* Backend Installation Directory +* +* location of backend install; these are used to link to css and js +* assets because we may have the front end installed in a different +* directory than the backend. (i.e. nothing assumes that the frontend +* and the backend are in the same directory) +*/ +$IMConfig['base_dir'] = getcwd(); +$IMConfig['base_url'] = ''; + + +/* + File system path to the directory you want to manage the images + for multiple user systems, set it dynamically. + + NOTE: This directory requires write access by PHP. That is, + PHP must be able to create files in this directory. + Able to create directories is nice, but not necessary. +*/ +$IMConfig['images_dir'] = 'demo_images'; +//You may set a different directory for the link mode; if you don't, the above setting will be used for both modes +//$IMConfig['files_dir'] = 'demo_files'; + +/* + The URL to the above path, the web browser needs to be able to see it. + It can be protected via .htaccess on apache or directory permissions on IIS, + check you web server documentation for futher information on directory protection + If this directory needs to be publicly accessiable, remove scripting capabilities + for this directory (i.e. disable PHP, Perl, CGI). We only want to store assets + in this directory and its subdirectories. +*/ +$IMConfig['images_url'] = str_replace( array("backend.php","manager.php"), "", $_SERVER["PHP_SELF"] ) . $IMConfig['images_dir']; +//$IMConfig['files_url'] = 'url/to/files_dir'; + +/* + Possible values: true, false + + TRUE - If PHP on the web server is in safe mode, set this to true. + SAFE MODE restrictions: directory creation will not be possible, + only the GD library can be used, other libraries require + Safe Mode to be off. + + FALSE - Set to false if PHP on the web server is not in safe mode. +*/ +$IMConfig['safe_mode'] = false; + +/* +This specifies whether any image library is available to resize and edit images.TRUE - Thumbnails will be resized by image libraries and if there is no library, default thumbnail will be shown. +FALSE - Thumbnails will be resized by browser ignoring image libraries. +*/ +$IMConfig['img_library'] = true; + + +/* +View type when the File manager is in insert image mode. +Valid values are "thumbview" and "listview". +*/ + + +if ($insertMode == 'image') + $IMConfig['view_type'] = "thumbview"; + +else if($insertMode == "link") + $IMConfig['view_type'] = "listview"; + +$IMConfig['insert_mode'] = $insertMode; + +/* + Possible values: 'GD', 'IM', or 'NetPBM' + + The image manipulation library to use, either GD or ImageMagick or NetPBM. + If you have safe mode ON, or don't have the binaries to other packages, + your choice is 'GD' only. Other packages require Safe Mode to be off. +*/ +define('IMAGE_CLASS', 'GD'); + + +/* + After defining which library to use, if it is NetPBM or IM, you need to + specify where the binary for the selected library are. And of course + your server and PHP must be able to execute them (i.e. safe mode is OFF). + GD does not require the following definition. +*/ +define('IMAGE_TRANSFORM_LIB_PATH', 'C:/"Program Files"/ImageMagick-5.5.7-Q16/'); + + +/* + The prefix for thumbnail files, something like .thumb will do. The + thumbnails files will be named as "prefix_imagefile.ext", that is, + prefix + orginal filename. +*/ +$IMConfig['thumbnail_prefix'] = 't_'; + + +/* + Thumbnail can also be stored in a directory, this directory + will be created by PHP. If PHP is in safe mode, this parameter + is ignored, you can not create directories. + + If you do not want to store thumbnails in a directory, set this + to false or empty string ''; +*/ +$IMConfig['thumbnail_dir'] = 't'; + +/** +* Resized prefix +* +* The prefix for resized files, something like .resized will do. The +* resized files will be named _x_ +* resized files are created when one changes the dimensions of an image +* in the image manager selection dialog - the image is scaled when the +* user clicks the ok button. +*/ + +$IMConfig['resized_prefix'] = '.resized'; + +// ------------------------------------------------------------------------- + +/** +* Resized Directory +* +* Resized images may also be stored in a directory, except in safe mode. +*/ + +$IMConfig['resized_dir'] = ''; + +/* + Possible values: true, false + + TRUE - Allow the user to create new sub-directories in the + $IMConfig['base_dir']. + + FALSE - No directory creation. + + NOTE: If $IMConfig['safe_mode'] = true, this parameter + is ignored, you can not create directories +*/ +$IMConfig['allow_new_dir'] = true; + +/* + Possible values: true, false + + TRUE - Allow the user to edit image by image editor. + + FALSE - No edit icon will be displayed. + + NOTE: If $IMConfig['img_library'] = false, this parameter + is ignored, you can not edit images. +*/ +$IMConfig['allow_edit_image'] = true; + +/* + Possible values: true, false + + TRUE - Allow the user to rename files and folders. + + FALSE - No rename icon will be displayed. + +*/ +$IMConfig['allow_rename'] = true; + +/* + Possible values: true, false + + TRUE - Allow the user to perform cut/copy/paste actions. + + FALSE - No cut/copy/paste icons will be displayed. + +*/ +$IMConfig['allow_cut_copy_paste'] = true; + +/* + Possible values: true, false + + TRUE - Display color pickers for image background / border colors + + FALSE - Don't display color pickers +*/ +$IMConfig['use_color_pickers'] = true; + +/* + Possible values: true, false + + TRUE - Allow the user to set alt (alternative text) attribute. + + FALSE - No input field for alt attribute will be displayed. + + NOTE: The alt attribute is _obligatory_ for images, so will be inserted + if 'images_enable_alt' is set to false +*/ +$IMConfig['images_enable_alt'] = true; + +/* + Possible values: true, false + + TRUE - Allow the user to set title attribute (usually displayed when mouse is over element). + + FALSE - No input field for title attribute will be displayed. + +*/ +$IMConfig['images_enable_title'] = false; + +/* + Possible values: true, false + + TRUE - Allow the user to set align attribute. + + FALSE - No selection box for align attribute will be displayed. + +*/ +$IMConfig['images_enable_align'] = true; + +/* + Possible values: true, false + + TRUE - Allow the user to set margin, padding, and border styles for the image + + FALSE - No styling input fields will be displayed. + +*/ +$IMConfig['images_enable_styling'] = true; + +/* + Possible values: true, false + + TRUE - Allow the user to set target attribute for link (the window in which the link will be opened). + + FALSE - No selection box for target attribute will be displayed. + +*/ +$IMConfig['link_enable_target'] = true; +/* + Possible values: true, false + + TRUE - Allow the user to upload files. + + FALSE - No uploading allowed. +*/ +$IMConfig['allow_upload'] = true; + +/* Maximum upload file size + + Possible values: number, "max" + + number - maximum size in Kilobytes. + + "max" - the maximum allowed by the server (the value is retrieved from the server configuration). +*/ +$IMConfig['max_filesize_kb_image'] = 2000000; + +$IMConfig['max_filesize_kb_link'] = 5000; + +/* Maximum upload folder size in Megabytes. Use 0 to disable limit */ +$IMConfig['max_foldersize_mb'] = 0; + +/* +Allowed extensions that can be shown and allowed to upload. +Available icons are for "doc,fla,gif,gz,html,jpg,js,mov,pdf,php,png,ppt,rar,txt,xls,zip" +-Changed by AFRU. +*/ + +$IMConfig['allowed_image_extensions'] = array("jpg","gif","png","bmp"); +$IMConfig['allowed_link_extensions'] = array("jpg","gif","js","php","pdf","zip","txt","psd","png","html","swf","xml","xls"); + + +/* + The default thumbnail and list view icon in case thumbnails are not created and the files are of unknown. +*/ +$IMConfig['default_thumbnail'] = 'icons/def.gif'; +$IMConfig['default_listicon'] = 'icons/def_small.gif'; + + +/* +Only files with these extensions will be shown as thumbnails. All other files will be shown as icons. +*/ +$IMConfig['thumbnail_extensions'] = array("jpg", "gif", "png", "bmp"); + +/* + Thumbnail dimensions. +*/ +$IMConfig['thumbnail_width'] = 84; +$IMConfig['thumbnail_height'] = 84; + +/* + Image Editor temporary filename prefix. +*/ +$IMConfig['tmp_prefix'] = '.editor_'; + + +// Standard PHP Backend Data Passing +// if data was passed using xinha_pass_to_php_backend() we merge the items +// provided into the Config +require_once(realpath(dirname(__FILE__) . '/../../contrib/php-xinha.php')); +if($passed_data = xinha_read_passed_data()) +{ + $IMConfig = array_merge($IMConfig, $passed_data); + $IMConfig['backend_url'] .= xinha_passed_data_querystring() . '&'; +} +// Deprecated config passing, don't use this way any more! +elseif(isset($_REQUEST['backend_config'])) +{ + if(get_magic_quotes_gpc()) { + $_REQUEST['backend_config'] = stripslashes($_REQUEST['backend_config']); + } + + // Config specified from front end, check that it's valid + session_start(); + if (!array_key_exists($_REQUEST['backend_config_secret_key_location'], $_SESSION)) + die("Backend security error."); + + $secret = $_SESSION[$_REQUEST['backend_config_secret_key_location']]; + + if($_REQUEST['backend_config_hash'] !== sha1($_REQUEST['backend_config'] . $secret)) + { + die("Backend security error."); + } + + $to_merge = unserialize($_REQUEST['backend_config']); + if(!is_array($to_merge)) + { + die("Backend config syntax error."); + } + + $IMConfig = array_merge($IMConfig, $to_merge); + + // changed config settings keys in relation to ImageManager + $IMConfig['backend_url'] .= "backend_config=" . rawurlencode($_REQUEST['backend_config']) . '&'; + $IMConfig['backend_url'] .= "backend_config_hash=" . rawurlencode($_REQUEST['backend_config_hash']) . '&'; + $IMConfig['backend_url'] .= "backend_config_secret_key_location=" . rawurlencode($_REQUEST['backend_config_secret_key_location']) . '&'; + +} +if ($IMConfig['max_filesize_kb_link'] == "max") +{ + $IMConfig['max_filesize_kb_link'] = upload_max_filesize_kb(); +} + +if ($IMConfig['max_filesize_kb_image'] == "max") +{ + $IMConfig['max_filesize_kb_image'] = upload_max_filesize_kb(); +} +// END + +?> Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/ExtendedFileManager/editor.php =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/ExtendedFileManager/editor.php,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/ExtendedFileManager/editor.php 2 Feb 2007 21:04:51 -0000 1.1 @@ -0,0 +1,150 @@ + + + + + + + + + + + + + + + +
+ +
+
+ + + + + +
+ +
+ +
+
+ + Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/ExtendedFileManager/editorFrame.php =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/ExtendedFileManager/editorFrame.php,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/ExtendedFileManager/editorFrame.php 2 Feb 2007 21:04:51 -0000 1.1 @@ -0,0 +1,82 @@ +processImage(); + +?> + + + + + + + + + + + + +
+ +isGDEditable() == -1) { ?> +
GIF format is not supported, image editing not supported.
+ + + + + +
+ 0 && is_file($imageInfo['fullpath'])) { ?> + alt="" id="theImage" name="theImage"> + + No Image Available + +
+ + Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/ExtendedFileManager/extended-file-manager.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/ExtendedFileManager/extended-file-manager.js,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/ExtendedFileManager/extended-file-manager.js 2 Feb 2007 21:04:51 -0000 1.1 @@ -0,0 +1,333 @@ +/** + * ExtendedFileManager extended-file-manager.js file. + * Authors: Wei Zhuo, Afru + * Modified by: Krzysztof Kotowicz + * Version: Updated on 08-01-2005 by Afru + * Version: Modified on 20-06-2006 by Krzysztof Kotowicz + * Package: ExtendedFileManager (EFM 1.1.1) + * http://www.afrusoft.com/htmlarea + */ + +/** + * For installation details see Readme.txt in the plugin folder + * + */ + +function ExtendedFileManager(editor) +{ + + this.editor = editor; + + var cfg = editor.config; + var toolbar = cfg.toolbar; + var self = this; + + if (cfg.ExtendedFileManager.use_linker) { + cfg.registerButton({ + id : "linkfile", + tooltip : Xinha._lc("Insert File Link",'ExtendedFileManager'), + image : _editor_url + 'plugins/ExtendedFileManager/img/ed_linkfile.gif', + textMode : false, + action : function(editor) { + editor._linkFile(); + } + }); + cfg.addToolbarElement("linkfile", "createlink", 1); + }; + } + +ExtendedFileManager._pluginInfo = { + name : "ExtendedFileManager", + version : "1.1.1", + developer : "Afru, Krzysztof Kotowicz", + developer_url : "http://www.afrusoft.com/htmlarea/", + license : "htmlArea" +}; + +Xinha.Config.prototype.ExtendedFileManager = +{ + 'use_linker': true, + 'backend' : _editor_url + 'plugins/ExtendedFileManager/backend.php?__plugin=ExtendedFileManager&', + 'backend_data' : null, + // deprecated keys, use passing data through e.g. xinha_pass_to_php_backend() + 'backend_config' : null, + 'backend_config_hash': null, + 'backend_config_secret_key_location': 'Xinha:ImageManager' +}; + +// Over ride the _insertImage function in htmlarea.js. +// Open up the ExtendedFileManger script instead. +Xinha.prototype._insertImage = function(image) { + + var editor = this; // for nested functions + var outparam = {"editor" : this, param : null}; + + if (typeof image == "undefined") { + image = this.getParentElement(); + if (image && !/^img$/i.test(image.tagName)) + image = null; + } + + if (image) { + outparam.param = { + f_url : Xinha.is_ie ? image.src : image.getAttribute("src"), + f_alt : image.alt, + f_title : image.title, + f_border : image.style.borderWidth ? image.style.borderWidth : image.border, + f_align : image.align, + f_width : image.width, + f_height : image.height, + f_padding: image.style.padding, + f_margin : image.style.margin, + f_backgroundColor: image.style.backgroundColor, + f_borderColor: image.style.borderColor, + baseHref: editor.config.baseHref + }; + + // compress 'top right bottom left' syntax into one value if possible + outparam.param.f_border = shortSize(outparam.param.f_border); + outparam.param.f_padding = shortSize(outparam.param.f_padding); + outparam.param.f_margin = shortSize(outparam.param.f_margin); + + // convert rgb() calls to rgb hex + outparam.param.f_backgroundColor = convertToHex(outparam.param.f_backgroundColor); + outparam.param.f_borderColor = convertToHex(outparam.param.f_borderColor); + + } + + var manager = editor.config.ExtendedFileManager.backend + '__function=manager'; + if(editor.config.ExtendedFileManager.backend_config != null) + { + manager += '&backend_config=' + + encodeURIComponent(editor.config.ExtendedFileManager.backend_config); + manager += '&backend_config_hash=' + + encodeURIComponent(editor.config.ExtendedFileManager.backend_config_hash); + manager += '&backend_config_secret_key_location=' + + encodeURIComponent(editor.config.ExtendedFileManager.backend_config_secret_key_location); + } + + if(editor.config.ExtendedFileManager.backend_data != null) + { + for ( var i in editor.config.ExtendedFileManager.backend_data ) + { + manager += '&' + i + '=' + encodeURIComponent(editor.config.ExtendedFileManager.backend_data[i]); + } + } + + Dialog(manager, function(param){ + if (!param) + { // user must have pressed Cancel + return false; + } + + var img = image; + if (!img) { + if ( !param.f_url ) return false; + if (Xinha.is_ie) { + var sel = editor.getSelection(); + var range = editor.createRange(sel); + editor._doc.execCommand("insertimage", false, param.f_url); + img = range.parentElement(); + // wonder if this works... + if (img.tagName.toLowerCase() != "img") { + img = img.previousSibling; + } + + } else { + img = document.createElement('img'); + img.src = param.f_url; + editor.insertNodeAtSelection(img); + } + + } else { + if ( !param.f_url ) { // delete the image if empty url passed + img.parentNode.removeChild(img); + editor.updateToolbar(); + return false; + } else { + img.src = param.f_url; + } + } + + img.alt = img.alt ? img.alt : ''; + + for (field in param) + { + var value = param[field]; + switch (field) + { + case "f_alt" : img.alt = value; break; + case "f_title" : img.title = value; break; + case "f_border" : + if (value) + { + img.style.borderWidth = /[^0-9]/.test(value) ? value : (value != '') ? (parseInt(value) + 'px') : ''; + if(img.style.borderWidth && !img.style.borderStyle) + { + img.style.borderStyle = 'solid'; + } + else if (!img.style.borderWidth) + { + img.style.border = ''; + } + } + break; + case "f_borderColor": img.style.borderColor = value; break; + case "f_backgroundColor": img.style.backgroundColor = value; break; + case "f_align" : img.align = value; break; + case "f_width" : img.width = parseInt(value || "0"); break; + case "f_height" : img.height = parseInt(value || "0"); break; + case "f_padding": img.style.padding = + /[^0-9]/.test(value) ? value : (value != '') ? (parseInt(value) + 'px') :''; break; + case "f_margin": img.style.margin = + /[^0-9]/.test(value) ? value : (value != '') ? (parseInt(value) + 'px') :''; break; + } + } + + }, outparam); + +}; + +Xinha.prototype._linkFile = function(link) { + + var editor = this; + var outparam = {"editor" : this, param : null}; + if (typeof link == "undefined") { + link = this.getParentElement(); + if (link) { + if (/^img$/i.test(link.tagName)) + link = link.parentNode; + if (!/^a$/i.test(link.tagName)) + link = null; + } + } + if (!link) { + var sel = editor.getSelection(); + var range = editor.createRange(sel); + var compare = 0; + if (Xinha.is_ie) { + if ( sel.type == "Control" ) + compare = range.length; + else + compare = range.compareEndPoints("StartToEnd", range); + } else { + compare = range.compareBoundaryPoints(range.START_TO_END, range); + } + if (compare == 0) { + alert(Xinha._lc("You must select some text before making a new link.", 'ExtendedFileManager')); + return; + } + outparam.param = { + f_href : '', + f_title : '', + f_target : '', + f_usetarget : editor.config.makeLinkShowsTarget, + baseHref: editor.config.baseHref + }; + } else + outparam.param = { + f_href : Xinha.is_ie ? link.href : link.getAttribute("href"), + f_title : link.title, + f_target : link.target, + f_usetarget : editor.config.makeLinkShowsTarget, + baseHref: editor.config.baseHref + }; + + var manager = _editor_url + 'plugins/ExtendedFileManager/manager.php?mode=link'; + if(editor.config.ExtendedFileManager.backend_config != null) + { + manager += '&backend_config=' + + encodeURIComponent(editor.config.ExtendedFileManager.backend_config); + manager += '&backend_config_hash=' + + encodeURIComponent(editor.config.ExtendedFileManager.backend_config_hash); + manager += '&backend_config_secret_key_location=' + + encodeURIComponent(editor.config.ExtendedFileManager.backend_config_secret_key_location); + } + + if(editor.config.ExtendedFileManager.backend_data != null) + { + for ( var i in editor.config.ExtendedFileManager.backend_data ) + { + manager += '&' + i + '=' + encodeURIComponent(editor.config.ExtendedFileManager.backend_data[i]); + } + } + + + Dialog(manager, function(param){ + if (!param) + return false; + var a = link; + if (!a) try { + editor._doc.execCommand("createlink", false, param.f_href); + a = editor.getParentElement(); + var sel = editor.getSelection(); + var range = editor.createRange(sel); + if (!Xinha.is_ie) { + a = range.startContainer; + if (!/^a$/i.test(a.tagName)) { + a = a.nextSibling; + if (a == null) + a = range.startContainer.parentNode; + } + } + } catch(e) {} + else { + var href = param.f_href.trim(); + editor.selectNodeContents(a); + if (href == "") { + editor._doc.execCommand("unlink", false, null); + editor.updateToolbar(); + return false; + } + else { + a.href = href; + } + } + if (!(a && /^a$/i.test(a.tagName))) + return false; + a.target = param.f_target.trim(); + a.title = param.f_title.trim(); + editor.selectNodeContents(a); + editor.updateToolbar(); + }, outparam); + +}; + +function shortSize(cssSize) +{ + if(/ /.test(cssSize)) + { + var sizes = cssSize.split(' '); + var useFirstSize = true; + for(var i = 1; i < sizes.length; i++) + { + if(sizes[0] != sizes[i]) + { + useFirstSize = false; + break; + } + } + if(useFirstSize) cssSize = sizes[0]; + } + + return cssSize; +} + +function convertToHex(color) { + + if (typeof color == "string" && /, /.test.color) + color = color.replace(/, /, ','); // rgb(a, b) => rgb(a,b) + + if (typeof color == "string" && / /.test.color) { // multiple values + var colors = color.split(' '); + var colorstring = ''; + for (var i = 0; i < colors.length; i++) { + colorstring += Xinha._colorToRgb(colors[i]); + if (i + 1 < colors.length) + colorstring += " "; + } + return colorstring; + } + + return Xinha._colorToRgb(color); +} Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/ExtendedFileManager/images.php =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/ExtendedFileManager/images.php,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/ExtendedFileManager/images.php 2 Feb 2007 21:04:51 -0000 1.1 @@ -0,0 +1,389 @@ +processUploads(); + +//process any file renames +$renameStatus=$manager->processRenames(); + +//process paste +if (isset($_GET['paste'])) + $pasteStatus = $manager->processPaste(); + +if ($manager->deleteFiles()) + $refreshFile = true; + +$refreshDir = false; +//process any directory functions +if($manager->deleteDirs() || $manager->processNewDir() || $pasteStatus || $renameStatus ) + $refreshDir = true; + + +$diskInfo=$manager->getDiskInfo(); + +//check for any sub-directory request +//check that the requested sub-directory exists +//and valid +if(isset($_REQUEST['dir'])) +{ + $path = rawurldecode($_REQUEST['dir']); + if($manager->validRelativePath($path)) + $relative = $path; +} + + +$afruViewType=""; +if(isset($_REQUEST['viewtype'])) +{ + $afruViewType=$_REQUEST['viewtype']; +} +if($afruViewType!="thumbview" && $afruViewType!="listview") + +$afruViewType=$IMConfig['view_type']; + +//get the list of files and directories +$list = $manager->getFiles($relative); + + +/* ================= OUTPUT/DRAW FUNCTIONS ======================= */ + + +/** + * Draw folders and files. Changed by Afru + */ +function drawDirs_Files($list, &$manager) +{ + global $relative, $afruViewType, $IMConfig, $insertMode; + + switch ($afruViewType) { + case 'listview': + $maxNameLength = 30; + ?> + + + + + $dir) + { ?> + + + + + + + + + + $file) + { + ?> + + + + + + + + + + +
NameSizeImage SizeDate Modified 
+ $maxNameLength) echo substr($dir['entry'],0,$maxNameLength)."..."; else echo $dir['entry']; + ?> + Folder + Trash + + Rename + + + Cut + Copy + +
" alt="" /> onmouseover="showPreview('')" onmouseout="showPreview(window.parent.document.getElementById('f_url').value)" > + $maxNameLength) echo substr($entry,0,$maxNameLength)."..."; else echo $entry; + ?> + 0){ echo $file['image'][0].'x'.$file['image'][1]; } ?> + 0) { ?> + Edit + + Trash + + Rename + + + Cut + Copy + +
+ $dir) + { ?> +
+ <?php echo $dir['entry']; ?> + +
+ $maxFolderNameLength) + echo substr($dir['entry'], 0, $maxFolderNameLength) . "..."; + else + echo $dir['entry']; ?> +
+
+ Trash + + Rename + + + Cut + Copy + +
+
+ $file) + { + $afruimgdimensions=$manager->checkImageSize($file['relative']); + $thisFileNameLength = $maxFileNameLength; + ?> +
+ + <?php echo $entry; ?> - <?php echo Files::formatSize($file['stat']['size']); ?> + +
+ $thisFileNameLength + 3) echo strtolower(substr($entry,0,$thisFileNameLength))."..."; else echo $entry; + ?> +
+
+ 0 ) + { ?> + Edit + + Trash + + Rename + + + Cut + Copy + + +
+
+ +
No Files Found
+ +
Invalid base directory: getImagesDir(); ?>
+ + + + + File List + + + + + + + + + + + +isValidBase() == false) { drawErrorBase($manager); } + elseif(count($list[0]) > 0 || count($list[1]) > 0) { ?> + + + + Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/ExtendedFileManager/manager.php =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/ExtendedFileManager/manager.php,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/ExtendedFileManager/manager.php 2 Feb 2007 21:04:51 -0000 1.1 @@ -0,0 +1,277 @@ +getDirs(); + + // calculate number of table rows to span for the preview cell + $num_rows = 4; // filename & upload & disk info message & width+margin + + if ($insertMode=='image') + { + if ($IMConfig['images_enable_styling'] === false) + { + $hidden_fields[] = 'f_margin'; + $hidden_fields[] = 'f_padding'; + $hidden_fields[] = 'f_border'; + $hidden_fields[] = 'f_backgroundColor'; + $hidden_fields[] = 'f_borderColor'; + $num_rows +=2; + } + else if ($IMConfig['use_color_pickers'] === false) + { + $hidden_fields[] = 'f_backgroundColor'; + $hidden_fields[] = 'f_borderColor'; + $num_rows +=2; + } + + if ($IMConfig['images_enable_align'] === false) + { + $hidden_fields[] = 'f_align'; + } + if ($IMConfig['images_enable_alt']) + { + $num_rows++; + } + else + { + $hidden_fields[] = 'f_alt'; + } + if ($IMConfig['images_enable_title']) + { + $num_rows++; + } + else + { + $hidden_fields[] = 'f_title'; + } + } + + if ($insertMode == 'link') + { + if ($IMConfig['link_enable_target'] === false) + { + $hidden_fields[] = 'f_target'; + } + $num_rows +=2; + } +?> + + + + Insert <?php echo ($insertMode == 'image' ? 'Image' : 'File Link') ?> + + + + + + + + + + +
Insert
+
+ + + + +
File Manager + + + + + +
+ + + + + Directory Up + + + + New Folder + + + + +
+ + +
+
+ + + + + + + + + + + + + + + + + + + +getImagesDir()) > ($IMConfig['max_foldersize_mb']*1048576)) +{ ?> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ +
+ +

+ +
Maximum folder size limit reached. Upload disabled. + + + + + +
+( max.)
+
"; ?>
Constrained Proportions + + +
+ +
+ Color + +
+ + Border Color
+ + +
+
+ + + +
+
+ + Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/ExtendedFileManager/resizer.php =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/ExtendedFileManager/resizer.php,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/ExtendedFileManager/resizer.php 2 Feb 2007 21:04:51 -0000 1.1 @@ -0,0 +1,83 @@ +&height=[&to=/relative/path/to/newimage.jpg] + * relative to the base_dir given in config.inc.php + * This is pretty much just thumbs.php with some mods, I'm too lazy to do it properly + * @author $Author: gustafn $ + * @version $Id: resizer.php,v 1.1 2007/02/02 21:04:51 gustafn Exp $ + * @package ImageManager + */ + +require_once('config.inc.php'); +require_once('Classes/ExtendedFileManager.php'); +require_once('../ImageManager/Classes/Thumbnail.php'); + +function js_fail($message) { echo 'alert(\'ha ' . $message . '\'); false'; exit; } +function js_success($resultFile) { echo '\'' . $resultFile . '\''; exit; } + +//check for img parameter in the url +if(!isset($_GET['img']) || !isset($_GET['width']) || !isset($_GET['height'])) +{ + js_fail('Missing parameter.'); +} + +$manager = new ExtendedFileManager($IMConfig); + +//get the image and the full path to the image +$image = $_GET['img']; +$fullpath = Files::makeFile($manager->getImagesDir(),$image); + +//not a file, so exit +if(!is_file($fullpath)) +{ + js_fail("File {$fullpath} does not exist."); +} + +$imgInfo = @getImageSize($fullpath); + +//Not an image, bail out. +if(!is_array($imgInfo)) +{ + js_fail("File {$fullpath} is not an image."); +} + +if(!isset($_GET['to'])) +{ + $resized = $manager->getResizedName($fullpath,$_GET['width'],$_GET['height']); + $_GET['to'] = $manager->getResizedName($image,$_GET['width'],$_GET['height'], FALSE); +} +else +{ + $resized = Files::makeFile($manager->getImagesDir(),$_GET['to']); +} + +// Check to see if it already exists +if(is_file($resized)) +{ + // And is newer + if(filemtime($resized) >= filemtime($fullpath)) + { + js_success($_GET['to']); + } +} + + + +// resize (thumbnailer will do this for us just fine) +$thumbnailer = new Thumbnail($_GET['width'],$_GET['height']); +$thumbnailer->proportional = FALSE; +$thumbnailer->createThumbnail($fullpath, $resized); + +// did it work? +if(is_file($resized)) +{ + js_success($_GET['to']); +} +else +{ + js_fail("Resize Failed."); +} +?> \ No newline at end of file Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/ExtendedFileManager/thumbs.php =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/ExtendedFileManager/thumbs.php,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/ExtendedFileManager/thumbs.php 2 Feb 2007 21:04:51 -0000 1.1 @@ -0,0 +1,85 @@ +getImagesDir(),$image); + +//not a file, so exit +if(!is_file($fullpath)) + exit(); + +$imgInfo = @getImageSize($fullpath); + +//Not an image, send default thumbnail +if(!is_array($imgInfo)) +{ + //show the default image, otherwise we quit! + $default = $manager->getDefaultThumb(); + if($default) + { + header('Location: '.$default); + exit(); + } +} +//if the image is less than the thumbnail dimensions +//send the original image as thumbnail +if ($imgInfo[0] <= $IMConfig['thumbnail_width'] + && $imgInfo[1] <= $IMConfig['thumbnail_height']) + { + header('Location: '.$manager->getFileURL($image)); + exit(); + } + +//Check for thumbnails +$thumbnail = $manager->getThumbName($fullpath); +if(is_file($thumbnail)) +{ + //if the thumbnail is newer, send it + if(filemtime($thumbnail) >= filemtime($fullpath)) + { + header('Location: '.$manager->getThumbURL($image)); + exit(); + } +} + +//creating thumbnails +$thumbnailer = new Thumbnail($IMConfig['thumbnail_width'],$IMConfig['thumbnail_height']); +$thumbnailer->createThumbnail($fullpath, $thumbnail); + +//Check for NEW thumbnails +if(is_file($thumbnail)) +{ + //send the new thumbnail + header('Location: '.$manager->getThumbURL($image)); + exit(); +} +else +{ + //show the default image, otherwise we quit! + $default = $manager->getDefaultThumb(); + if($default) + header('Location: '.$default); +} +?> \ No newline at end of file Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/ExtendedFileManager/Classes/ExtendedFileManager.php =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/ExtendedFileManager/Classes/ExtendedFileManager.php,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/ExtendedFileManager/Classes/ExtendedFileManager.php 2 Feb 2007 21:04:52 -0000 1.1 @@ -0,0 +1,825 @@ +config = $config; + + $this->mode = empty($mode) ? (empty($config['insert_mode']) ? 'image' : $config['insert_mode']): $mode; + } + + /** + * Get the base directory. + * @return string base dir, see config.inc.php + */ + function getImagesDir() + { + if ($this->mode == 'link' && isset($this->config['files_dir'])) + Return $this->config['files_dir']; + else Return $this->config['images_dir']; + } + + /** + * Get the base URL. + * @return string base url, see config.inc.php + */ + function getImagesURL() + { + if ($this->mode == 'link' && isset($this->config['files_url'])) + Return $this->config['files_url']; + else Return $this->config['images_url']; + } + + function isValidBase() + { + return is_dir($this->getImagesDir()); + } + + /** + * Get the tmp file prefix. + * @return string tmp file prefix. + */ + function getTmpPrefix() + { + Return $this->config['tmp_prefix']; + } + + /** + * Get the sub directories in the base dir. + * Each array element contain + * the relative path (relative to the base dir) as key and the + * full path as value. + * @return array of sub directries + * array('path name' => 'full directory path', ...) + */ + function getDirs() + { + if(is_null($this->dirs)) + { + $dirs = $this->_dirs($this->getImagesDir(),'/'); + ksort($dirs); + $this->dirs = $dirs; + } + return $this->dirs; + } + + /** + * Recursively travese the directories to get a list + * of accessable directories. + * @param string $base the full path to the current directory + * @param string $path the relative path name + * @return array of accessiable sub-directories + * array('path name' => 'full directory path', ...) + */ + function _dirs($base, $path) + { + $base = Files::fixPath($base); + $dirs = array(); + + if($this->isValidBase() == false) + return $dirs; + + $d = @dir($base); + + while (false !== ($entry = $d->read())) + { + //If it is a directory, and it doesn't start with + // a dot, and if is it not the thumbnail directory + if(is_dir($base.$entry) + && substr($entry,0,1) != '.' + && $this->isThumbDir($entry) == false) + { + $relative = Files::fixPath($path.$entry); + $fullpath = Files::fixPath($base.$entry); + $dirs[$relative] = $fullpath; + $dirs = array_merge($dirs, $this->_dirs($fullpath, $relative)); + } + } + $d->close(); + + Return $dirs; + } + + /** + * Get all the files and directories of a relative path. + * @param string $path relative path to be base path. + * @return array of file and path information. + * array(0=>array('relative'=>'fullpath',...), 1=>array('filename'=>fileinfo array(),...) + * fileinfo array: array('url'=>'full url', + * 'relative'=>'relative to base', + * 'fullpath'=>'full file path', + * 'image'=>imageInfo array() false if not image, + * 'stat' => filestat) + */ + function getFiles($path) + { + $files = array(); + $dirs = array(); + + $valid_extensions = $this->mode == 'image' ? $this->config['allowed_image_extensions'] : $this->config['allowed_link_extensions']; + + if($this->isValidBase() == false) + return array($files,$dirs); + + $path = Files::fixPath($path); + $base = Files::fixPath($this->getImagesDir()); + $fullpath = Files::makePath($base,$path); + + + $d = @dir($fullpath); + + while (false !== ($entry = $d->read())) + { + //not a dot file or directory + if(substr($entry,0,1) != '.') + { + if(is_dir($fullpath.$entry) + && $this->isThumbDir($entry) == false) + { + $relative = Files::fixPath($path.$entry); + $full = Files::fixPath($fullpath.$entry); + $count = $this->countFiles($full); + $dirs[$relative] = array('fullpath'=>$full,'entry'=>$entry,'count'=>$count, 'stat'=>stat($fullpath.$entry)); + } + + else if(is_file($fullpath.$entry) && $this->isThumb($entry)==false && $this->isTmpFile($entry) == false) + { + $afruext = strtolower(substr(strrchr($entry, "."), 1)); + + if(in_array($afruext,$valid_extensions)) + { + + $file['url'] = Files::makePath($this->config['base_url'],$path).$entry; + $file['relative'] = $path.$entry; + $file['fullpath'] = $fullpath.$entry; + $img = $this->getImageInfo($fullpath.$entry); + if(!is_array($img)) $img[0]=$img[1]=0; + $file['image'] = $img; + $file['stat'] = stat($fullpath.$entry); + $file['ext'] = $afruext; + $files[$entry] = $file; + } + + } + } + } + $d->close(); + ksort($dirs); + ksort($files); + + Return array($dirs, $files); + } + + /** + * Count the number of files and directories in a given folder + * minus the thumbnail folders and thumbnails. + */ + function countFiles($path) + { + $total = 0; + + if(is_dir($path)) + { + $d = @dir($path); + + while (false !== ($entry = $d->read())) + { + //echo $entry."
"; + if(substr($entry,0,1) != '.' + && $this->isThumbDir($entry) == false + && $this->isTmpFile($entry) == false + && $this->isThumb($entry) == false) + { + $total++; + } + } + $d->close(); + } + return $total; + } + + /** + * Get image size information. + * @param string $file the image file + * @return array of getImageSize information, + * false if the file is not an image. + */ + function getImageInfo($file) + { + Return @getImageSize($file); + } + + /** + * Check if the file contains the thumbnail prefix. + * @param string $file filename to be checked + * @return true if the file contains the thumbnail prefix, false otherwise. + */ + function isThumb($file) + { + $len = strlen($this->config['thumbnail_prefix']); + if(substr($file,0,$len)==$this->config['thumbnail_prefix']) + Return true; + else + Return false; + } + + /** + * Check if the given directory is a thumbnail directory. + * @param string $entry directory name + * @return true if it is a thumbnail directory, false otherwise + */ + function isThumbDir($entry) + { + if($this->config['thumbnail_dir'] == false + || strlen(trim($this->config['thumbnail_dir'])) == 0) + Return false; + else + Return ($entry == $this->config['thumbnail_dir']); + } + + /** + * Check if the given file is a tmp file. + * @param string $file file name + * @return boolean true if it is a tmp file, false otherwise + */ + function isTmpFile($file) + { + $len = strlen($this->config['tmp_prefix']); + if(substr($file,0,$len)==$this->config['tmp_prefix']) + Return true; + else + Return false; + } + + /** + * For a given image file, get the respective thumbnail filename + * no file existence check is done. + * @param string $fullpathfile the full path to the image file + * @return string of the thumbnail file + */ + function getThumbName($fullpathfile) + { + $path_parts = pathinfo($fullpathfile); + + $thumbnail = $this->config['thumbnail_prefix'].$path_parts['basename']; + + if($this->config['safe_mode'] == true + || strlen(trim($this->config['thumbnail_dir'])) == 0) + { + Return Files::makeFile($path_parts['dirname'],$thumbnail); + } + else + { + if(strlen(trim($this->config['thumbnail_dir'])) > 0) + { + $path = Files::makePath($path_parts['dirname'],$this->config['thumbnail_dir']); + if(!is_dir($path)) + Files::createFolder($path); + Return Files::makeFile($path,$thumbnail); + } + else //should this ever happen? + { + //error_log('ExtendedFileManager: Error in creating thumbnail name'); + } + } + } + + /** + * Similar to getThumbName, but returns the URL, base on the + * given base_url in config.inc.php + * @param string $relative the relative image file name, + * relative to the base_dir path + * @return string the url of the thumbnail + */ + function getThumbURL($relative) + { + $path_parts = pathinfo($relative); + $thumbnail = $this->config['thumbnail_prefix'].$path_parts['basename']; + if($path_parts['dirname']=='\\') $path_parts['dirname']='/'; + + if($this->config['safe_mode'] == true + || strlen(trim($this->config['thumbnail_dir'])) == 0) + { + Return Files::makeFile($this->getImagesURL(),$thumbnail); + } + else + { + if(strlen(trim($this->config['thumbnail_dir'])) > 0) + { + $path = Files::makePath($path_parts['dirname'],$this->config['thumbnail_dir']); + $url_path = Files::makePath($this->getImagesURL(), $path); + Return Files::makeFile($url_path,$thumbnail); + } + else //should this ever happen? + { + //error_log('ExtendedFileManager: Error in creating thumbnail url'); + } + + } + } + + /** + * For a given image file, get the respective resized filename + * no file existence check is done. + * @param string $fullpathfile the full path to the image file + * @param integer $width the intended width + * @param integer $height the intended height + * @param boolean $mkDir whether to attempt to make the resized_dir if it doesn't exist + * @return string of the resized filename + */ + function getResizedName($fullpathfile, $width, $height, $mkDir = TRUE) + { + $path_parts = pathinfo($fullpathfile); + + $thumbnail = $this->config['resized_prefix']."_{$width}x{$height}_{$path_parts['basename']}"; + + if( strlen(trim($this->config['resized_dir'])) == 0 || $this->config['safe_mode'] == true ) + { + Return Files::makeFile($path_parts['dirname'],$thumbnail); + } + else + { + $path = Files::makePath($path_parts['dirname'],$this->config['resized_dir']); + if($mkDir && !is_dir($path)) + Files::createFolder($path); + Return Files::makeFile($path,$thumbnail); + } + } + + /** + * Check if the given path is part of the subdirectories + * under the base_dir. + * @param string $path the relative path to be checked + * @return boolean true if the path exists, false otherwise + */ + function validRelativePath($path) + { + $dirs = $this->getDirs(); + if($path == '/') + Return true; + //check the path given in the url against the + //list of paths in the system. + for($i = 0; $i < count($dirs); $i++) + { + $key = key($dirs); + //we found the path + if($key == $path) + Return true; + + next($dirs); + } + Return false; + } + + /** + * Process uploaded files, assumes the file is in + * $_FILES['upload'] and $_POST['dir'] is set. + * The dir must be relative to the base_dir and exists. + * @return null + */ + function processUploads() + { + if($this->isValidBase() == false) + return; + + $relative = null; + + if(isset($_POST['dir'])) + $relative = rawurldecode($_POST['dir']); + else + return; + + //check for the file, and must have valid relative path + if(isset($_FILES['upload']) && $this->validRelativePath($relative)) + { + Return $this->_processFiles($relative, $_FILES['upload']); + } + } + + /** + * Process upload files. The file must be an + * uploaded file. Any duplicate + * file will be renamed. See Files::copyFile for details + * on renaming. + * @param string $relative the relative path where the file + * should be copied to. + * @param array $file the uploaded file from $_FILES + * @return boolean true if the file was processed successfully, + * false otherwise + */ + function _processFiles($relative, $file) + { + + if($file['error']!=0) + { + Return false; + } + + if(!is_file($file['tmp_name'])) + { + Return false; + } + + if(!is_uploaded_file($file['tmp_name'])) + { + Files::delFile($file['tmp_name']); + Return false; + } + + $valid_extensions = $this->mode == 'image' ? $this->config['allowed_image_extensions'] : $this->config['allowed_link_extensions']; + $max_size = $this->mode == 'image' ? $this->config['max_filesize_kb_image'] : $this->config['max_filesize_kb_link']; + $afruext = strtolower(substr(strrchr($file['name'], "."), 1)); + + if(!in_array($afruext, $valid_extensions)) + { + Files::delFile($file['tmp_name']); + Return 'Cannot upload $extension='.$afruext.'$ Files. Permission denied.'; + } + + if($file['size']>($max_size*1024)) + { + Files::delFile($file['tmp_name']); + Return 'Unble to upload file. Maximum file size [$max_size='.$max_size.'$ KB] exceeded.'; + } + + if(!empty($this->config['max_foldersize_mb']) && (Files::dirSize($this->getImagesDir()))+$file['size']> ($this->config['max_foldersize_mb']*1048576)) + { + Files::delFile($file['tmp_name']); + Return ("Cannot upload. Maximum folder size reached. Delete unwanted files and try again."); + } + + //now copy the file + $path = Files::makePath($this->getImagesDir(),$relative); + $result = Files::copyFile($file['tmp_name'], $path, $file['name']); + + //no copy error + if(!is_int($result)) + { + Files::delFile($file['tmp_name']); + Return 'File "$file='.$file['name'].'$" successfully uploaded.'; + } + + //delete tmp files. + Files::delFile($file['tmp_name']); + Return false; + + } + + + function getDiskInfo() + { + if (empty($this->config['max_foldersize_mb'])) + return ''; + + $tmpFreeSize=($this->config['max_foldersize_mb']*1048576)-Files::dirSize($this->getImagesDir()); + + if(!is_numeric($tmpFreeSize) || $tmpFreeSize<0) $tmpFreeSize=0; + + Return 'Total Size : $max_foldersize_mb='.$this->config['max_foldersize_mb'].'$ MB, Free Space: $free_space='.Files::formatSize($tmpFreeSize).'$'; + } + + + + /** + * Get the URL of the relative file. + * basically appends the relative file to the + * base_url given in config.inc.php + * @param string $relative a file the relative to the base_dir + * @return string the URL of the relative file. + */ + function getFileURL($relative) + { + Return Files::makeFile($this->getImagesURL(),$relative); + } + + /** + * Get the fullpath to a relative file. + * @param string $relative the relative file. + * @return string the full path, .ie. the base_dir + relative. + */ + function getFullPath($relative) + { + Return Files::makeFile($this->getImagesDir(),$relative);; + } + + /** + * Get the default thumbnail. + * @return string default thumbnail, empty string if + * the thumbnail doesn't exist. + */ + function getDefaultThumb() + { + if(is_file($this->config['default_thumbnail'])) + Return $this->config['default_thumbnail']; + else + Return ''; + } + + + /** + * Checks image size. If the image size is less than default size + * returns the original size else returns default size to display thumbnail + */ + function checkImageSize($relative) + { + $fullpath = Files::makeFile($this->getImagesDir(),$relative); + + $afruext = strtolower(substr(strrchr($relative, "."), 1)); + + if(!in_array($afruext,$this->config['thumbnail_extensions'])) + { + $imgInfo=array(0,0); + Return $imgInfo; + } + else + { + $imgInfo = @getImageSize($fullpath); + //not an image + if(!is_array($imgInfo)) + { + $imgInfo=array(0,0); + Return $imgInfo; + } + else + { + if($imgInfo[0] > $this->config['thumbnail_width']) + $imgInfo[0] = $this->config['thumbnail_width']; + + if($imgInfo[1] > $this->config['thumbnail_height']) + $imgInfo[1] = $this->config['thumbnail_height']; + + Return $imgInfo; + } + } + + } + + + /** + * Get the thumbnail url to be displayed. + * If the thumbnail exists, and it is up-to-date + * the thumbnail url will be returns. If the + * file is not an image, a default image will be returned. + * If it is an image file, and no thumbnail exists or + * the thumbnail is out-of-date (i.e. the thumbnail + * modified time is less than the original file) + * then a thumbs.php?img=filename.jpg is returned. + * The thumbs.php url will generate a new thumbnail + * on the fly. If the image is less than the dimensions + * of the thumbnails, the image will be display instead. + * @param string $relative the relative image file. + * @return string the url of the thumbnail, be it + * actually thumbnail or a script to generate the + * thumbnail on the fly. + */ + function getThumbnail($relative) + { + global $IMConfig; + + $fullpath = Files::makeFile($this->getImagesDir(),$relative); + + //not a file??? + if(!is_file($fullpath)) + Return $this->getDefaultThumb(); + + $afruext = strtolower(substr(strrchr($relative, "."), 1)); + + if(!in_array($afruext,$this->config['thumbnail_extensions'])) + { + if(is_file('icons/'.$afruext.'.gif')) + Return('icons/'.$afruext.'.gif'); + else + Return $this->getDefaultThumb(); + } + + $imgInfo = @getImageSize($fullpath); + + //not an image + if(!is_array($imgInfo)) + Return $this->getDefaultThumb(); + + + //Returning original image as thumbnail without Image Library by Afru + if(!$this->config['img_library']) Return $this->getFileURL($relative); + + + //the original image is smaller than thumbnails, + //so just return the url to the original image. + if ($imgInfo[0] <= $this->config['thumbnail_width'] + && $imgInfo[1] <= $this->config['thumbnail_height']) + Return $this->getFileURL($relative); + + $thumbnail = $this->getThumbName($fullpath); + + //check for thumbnails, if exists and + // it is up-to-date, return the thumbnail url + if(is_file($thumbnail)) + { + if(filemtime($thumbnail) >= filemtime($fullpath)) + Return $this->getThumbURL($relative); + } + + //well, no thumbnail was found, so ask the thumbs.php + //to generate the thumbnail on the fly. + Return $IMConfig['backend_url'] . '__function=thumbs&img='.rawurlencode($relative)."&mode=$this->mode"; + } + + /** + * Delete and specified files. + * @return boolean true if delete, false otherwise + */ + function deleteFiles() + { + if(isset($_GET['delf'])) + return $this->_delFile(rawurldecode($_GET['delf'])); + return false; + } + + /** + * Delete and specified directories. + * @return boolean true if delete, false otherwise + */ + function deleteDirs() + { + if(isset($_GET['deld'])) + return $this->_delDir(rawurldecode($_GET['deld'])); + else + Return false; + } + + /** + * Delete the relative file, and any thumbnails. + * @param string $relative the relative file. + * @return boolean true if deleted, false otherwise. + */ + function _delFile($relative) + { + $fullpath = Files::makeFile($this->getImagesDir(),$relative); + + $afruext = strtolower(substr(strrchr($relative, "."), 1)); + + $valid_extensions = $this->mode == 'image' ? $this->config['allowed_image_extensions'] : $this->config['allowed_link_extensions']; + + if(!in_array($afruext,$valid_extensions)) + { + return false; + } + + //check that the file is an image + if(is_array($this->getImageInfo($fullpath))) + { + $thumbnail = $this->getThumbName($fullpath); + Files::delFile($thumbnail); + } + + Return Files::delFile($fullpath); + } + + /** + * Delete directories recursively. + * @param string $relative the relative path to be deleted. + * @return boolean true if deleted, false otherwise. + */ + function _delDir($relative) + { + $fullpath = Files::makePath($this->getImagesDir(),$relative); + // if($this->countFiles($fullpath) <= 0) + return Files::delFolder($fullpath,true); //delete recursively. + //else + //Return false; + } + + /** + * Create new directories. + * If in safe_mode, nothing happens. + * @return boolean true if created, false otherwise. + */ + function processNewDir() + { + if($this->config['safe_mode'] == true) + Return false; + + if(isset($_GET['newDir']) && isset($_GET['dir'])) + { + $newDir = rawurldecode($_GET['newDir']); + $dir = rawurldecode($_GET['dir']); + $path = Files::makePath($this->getImagesDir(),$dir); + $fullpath = Files::makePath($path, Files::escape($newDir)); + if(is_dir($fullpath)) + Return false; + + Return Files::createFolder($fullpath); + } + } + + /** + * Renames files if certain GET variables are set + * @return bool + */ + function processRenames() + { + if(!empty($_GET['rename']) && !empty($_GET['renameTo'])) + { + // new file name (without path and extension) + $newName = Files::escape(rawurldecode($_GET['renameTo'])); + $newName = str_replace('.', '', $newName); + + // path to file (from base images directory) + $oldName = rawurldecode($_GET['rename']); + + // strip parent dir ("..") to avoid escaping from base directiory + $oldName = preg_replace('#\.\.#', '', $oldName); + + if (is_dir($oldPath = Files::makeFile($this->getImagesDir(), $_GET['dir'].$oldName))) + { + $newPath = Files::makeFile($this->getImagesDir(), $_GET['dir'].$newName); + return Files::rename($oldPath,$newPath); + } + else + { + // path to old file + $oldPath = Files::makeFile($this->getImagesDir(), $oldName); + + $ret = Files::renameFile($oldPath, $newName); + if ($ret === true) { + // delete old thumbnail + Files::delFile($this->getThumbname($oldPath)); + } + } + return $ret; + } + + return null; + } + + function processPaste() + { + switch ($_GET['paste']) + { + case 'copyFile': + $src = Files::makeFile($this->getImagesDir(), $_GET['srcdir'].$_GET['file']); + $file = $_GET['file']; + $dest = Files::makeFile($this->getImagesDir(), $_GET['dir']); + return Files::copyFile($src,$dest,$file); + break; + case 'copyDir': + $basePath = $this->getImagesDir(); + $src = $_GET['srcdir'].$_GET['file']; + $dest = $_GET['dir'].$_GET['file']; + return Files::copyDir($basePath,$src,$dest); + break; + case 'moveFile': + $src = Files::makePath($this->getImagesDir(), $_GET['srcdir'].$_GET['file']); + $dest = Files::makePath($this->getImagesDir(), $_GET['dir'].$_GET['file']); + return Files::rename($src,$dest); + break; + case 'moveDir': + $src = Files::makeFile($this->getImagesDir(), $_GET['srcdir'].$_GET['file']); + $dest = Files::makeFile($this->getImagesDir(), $_GET['dir'].$_GET['file']); + return Files::rename($src,$dest); + break; + } + } +} + +?> Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/ExtendedFileManager/assets/EditorContent.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/ExtendedFileManager/assets/EditorContent.js,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/ExtendedFileManager/assets/EditorContent.js 2 Feb 2007 21:04:52 -0000 1.1 @@ -0,0 +1,734 @@ +/** + * ImageEditor Interface file. + * Authors: Wei Zhuo, Afru, Krzysztof Kotowicz + * Version: Updated on 08-01-2005 by Afru + * Version: Updated on 20-06-2006 by Krzysztof Kotowicz + * Package: ExtendedFileManager (EFM 1.1.1) + * http://www.afrusoft.com/htmlarea + */ + +function MM_findObj(n, d) { //v4.01 + var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { + d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} + if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i-1 && navigator.appVersion.indexOf("Mac")>-1)) { + ox=0;oy=0;if(g.style.left){x=parseInt(g.style.left);y=parseInt(g.style.top); + }else{var w1=parseInt(el.style.width);bx=(a<0)?-5-w1:-10; + a=(Math.abs(a)<1000)?0:a;b=(Math.abs(b)<1000)?0:b; + //alert(event.clientX); + if (event == null) x=document.body.scrollLeft + bx; + else x=document.body.scrollLeft + event.clientX + bx; + if (event == null) y=document.body.scrollTop; + else y=document.body.scrollTop + event.clientY;}} + }else if (document.layers) {x=g.x;y=g.y;var q0=document.layers,dd=""; + for(var s=0;s4){xx+="px";yy+="px";} + if(navigator.appVersion.indexOf("MSIE 5")>-1 && navigator.appVersion.indexOf("Mac")>-1){ + xx+=parseInt(document.body.leftMargin);yy+=parseInt(document.body.topMargin); + xx+="px";yy+="px";}e.left=xx;e.top=yy;} + pic_x = parseInt(xx); pic_y = parseInt(yy); + //alert(xx+":"+yy); + } +} + +var ie=document.all; +var ns6=document.getElementById&&!document.all; + +var dragapproved=false; +var z,x,y,status, ant, canvas, content, pic_width, pic_height, image, resizeHandle, oa_w, oa_h, oa_x, oa_y, mx2, my2; + +function init_resize() +{ + if(mode == "scale") + { + P7_Snap('theImage','ant',0,0); + + if (canvas == null) + canvas = MM_findObj("imgCanvas"); + + if (pic_width == null || pic_height == null) + { + image = MM_findObj("theImage"); + pic_width = image.width; + pic_height = image.height; + } + + if (ant == null) + ant = MM_findObj("ant"); + + ant.style.left = pic_x; ant.style.top = pic_y; + ant.style.width = pic_width; ant.style.height = pic_height; + ant.style.visibility = "visible"; + + drawBoundHandle(); + jg_doc.paint(); + } +} + +initEditor = function () +{ + init_crop(); + init_resize(); + var markerImg = MM_findObj('markerImg', window.top.document); + + if (markerImg.src.indexOf("img/t_white.gif")>0) + toggleMarker() ; +} + +function init_crop() +{ + //if(mode == "crop") { + P7_Snap('theImage','ant',0,0); + //} +} + +function setMode(newMode) +{ + mode = newMode; + reset(); +} + +function reset() +{ + if (ant == null) + ant = MM_findObj("ant"); + + ant.style.visibility = "hidden"; + ant.style.left = 0; + ant.style.top = 0; + ant.style.width = 0; + ant.style.height = 0; + + mx2 = null; + my2 = null; + + jg_doc.clear(); + if(mode != 'measure') + showStatus(); + + if(mode == "scale") { + init_resize(); + } + + P7_Snap('theImage','ant',0,0); +} + +function toggleMarker() +{ + //alert("Toggle"); + if (ant == null) + ant = MM_findObj("ant"); + + if(ant.className=="selection") + ant.className="selectionWhite"; + else + ant.className="selection"; + + if (jg_doc.getColor() == "#000000") + jg_doc.setColor("#FFFFFF"); + else + jg_doc.setColor("#000000"); + + drawBoundHandle + jg_doc.paint(); +} + +function move(e) +{ + if (dragapproved) + { + //z.style.left=ns6? temp1+e.clientX-x: temp1+event.clientX-x + //z.style.top=ns6? temp2+e.clientY-y : temp2+event.clientY-y + var w = ns6? temp1+e.clientX - x : temp1+event.clientX - x; + var h = ns6? temp2+e.clientY - y : temp2+event.clientY - y; + + //alert(canvas.style.left); + /*if (status !=null) + { + status.innerHTML = "x:"+x+" y:"+y+" w:"+w+" h:"+h+" can_h:"+pic_height; + status.innerHTML += " can_w:"+pic_width+" px:"+pic_x+" py:"+pic_y; + status.innerHTML += " pix:"+image.style.left+" piy:"+image.style.top+" obj:"+obj.id; + }*/ + + /*jg_doc.clear(); + jg_doc.fillRectPattern(0,0,Math.abs(w),Math.abs(h),pattern); + jg_doc.paint(); +*/ + if (ant != null) + { + if (w >= 0) + { + ant.style.left = x; + ant.style.width = w; + } + else + { + ant.style.left = x+w; + ant.style.width = -1*w; + } + + if (h >= 0) + { + ant.style.top = y; + ant.style.height = h; + } + else + { + ant.style.top = y+h; + ant.style.height = -1*h + } + } + + showStatus(); + return false + } +} + +function moveContent(e) +{ + if (dragapproved) + { + + var dx =ns6? oa_x + e.clientX-x: oa_x + event.clientX-x + var dy =ns6? oa_y + e.clientY-y : oa_y + event.clientY-y + + /*if (status !=null) + { + status.innerHTML = "x:"+x+" y:"+y+" dx:"+dx+" dy:"+dy; + }*/ + + ant.style.left = dx; + ant.style.top = dy; + + showStatus(); + + return false; + } +} + +//Code add for constraints by Fr�d�ric Klee +function moveHandle(e) +{ + if (dragapproved) + { + var w = ns6? e.clientX - x : event.clientX - x; + var h = ns6? e.clientY - y : event.clientY - y; + + var constrained = MM_findObj('constProp', window.top.document); + var orginal_height = document.theImage.height ; + var orginal_width = document.theImage.width ; + rapp = orginal_width/orginal_height ; + rapp_inv = orginal_height / orginal_width ; + + switch(resizeHandle) + { + + case "s-resize": + if (oa_h + h >= 0) + { + ant.style.height = oa_h + h; + if(constrained.checked) + { + ant.style.width = rapp * (oa_h + h) ; + ant.style.left = oa_x - rapp * h/2; + } + + } + break; + case "e-resize": + if(oa_w + w >= 0) + { + ant.style.width = oa_w + w; + if(constrained.checked) + { + ant.style.height = rapp_inv * (oa_w + w) ; + ant.style.top = oa_y - rapp_inv * w/2; + } + + } + break; + case "n-resize": + if (oa_h - h >= 0) + { + ant.style.top = oa_y + h; + ant.style.height = oa_h - h; + if(constrained.checked) + { + ant.style.width = rapp * (oa_h - h) ; + ant.style.left = oa_x + rapp * h/2; + } + + } + break; + case "w-resize": + if(oa_w - w >= 0) + { + ant.style.left = oa_x + w; + ant.style.width = oa_w - w; + if(constrained.checked) + { + ant.style.height = rapp_inv * (oa_w - w) ; + ant.style.top = oa_y + rapp_inv * w/2; + } + + }break; + case "nw-resize": + if(oa_h - h >= 0 && oa_w - w >= 0) { + ant.style.left = oa_x + w; + ant.style.width = oa_w - w; + ant.style.top = oa_y + h; + if(constrained.checked) + ant.style.height = rapp_inv * (oa_w - w) ; + else + ant.style.height = oa_h - h; + } + break; + case "ne-resize": + if (oa_h - h >= 0 && oa_w + w >= 0){ + ant.style.top = oa_y + h; + ant.style.width = oa_w + w; + if(constrained.checked) + ant.style.height = rapp_inv * (oa_w + w) ; + else + ant.style.height = oa_h - h; + } + break; + case "se-resize": + if (oa_h + h >= 0 && oa_w + w >= 0) + { + ant.style.width = oa_w + w; + if(constrained.checked) + ant.style.height = rapp_inv * (oa_w + w) ; + else + ant.style.height = oa_h + h; + } + break; + case "sw-resize": + if (oa_h + h >= 0 && oa_w - w >= 0) + { + ant.style.left = oa_x + w; + ant.style.width = oa_w - w; + if(constrained.checked) + ant.style.height = rapp_inv * (oa_w - w) ; + else + ant.style.height = oa_h + h; + } + } + + showStatus(); + return false; + + } +} + +function drags(e) +{ + if (!ie&&!ns6) + return + + var firedobj=ns6? e.target : event.srcElement + var topelement=ns6? "HTML" : "BODY" + + while (firedobj.tagName!=topelement&& + !(firedobj.className=="crop" + || firedobj.className=="handleBox" + || firedobj.className=="selection" || firedobj.className=="selectionWhite")) + { + firedobj=ns6? firedobj.parentNode : firedobj.parentElement + } + + if(firedobj.className=="handleBox") { + + if(content != null) { + if(content.width != null && content.height != null) { + content.width = 0; + content.height = 0; + } + //alert(content.width+":"+content.height); + } + resizeHandle = firedobj.id; + + /*if(status!=null) { + status.innerHTML = " obj:"+firedobj.id; + }*/ + + x=ns6? e.clientX: event.clientX + y=ns6? e.clientY: event.clientY + + oa_w = parseInt(ant.style.width); + oa_h = parseInt(ant.style.height); + oa_x = parseInt(ant.style.left); + oa_y = parseInt(ant.style.top); + + dragapproved=true + document.onmousemove=moveHandle; + return false; + } + else + if((firedobj.className == "selection" || firedobj.className=="selectionWhite")&& mode == "crop") { + + x=ns6? e.clientX: event.clientX + y=ns6? e.clientY: event.clientY + + oa_x = parseInt(ant.style.left); + oa_y = parseInt(ant.style.top); + + dragapproved=true + document.onmousemove=moveContent; + return false; + } + else + if (firedobj.className=="crop" && mode == "crop") + { + if(content != null) { + if(content.width != null && content.height != null) { + content.width = 0; + content.height = 0; + } + //alert(content.width+":"+content.height); + } + + if (status == null) + status = MM_findObj("status"); + + if (ant == null) + ant = MM_findObj("ant"); + + if (canvas == null) + canvas = MM_findObj("imgCanvas"); + if(content == null) { + content = MM_findObj("cropContent"); + } + + if (pic_width == null || pic_height == null) + { + image = MM_findObj("theImage"); + pic_width = image.width; + pic_height = image.height; + } + + ant.style.visibility = "visible"; + + obj = firedobj; + dragapproved=true + z=firedobj + temp1=parseInt(z.style.left+0) + temp2=parseInt(z.style.top+0) + x=ns6? e.clientX: event.clientX + y=ns6? e.clientY: event.clientY + document.onmousemove=move + return false + } + else if(firedobj.className=="crop" && mode == "measure") { + + if (ant == null) + ant = MM_findObj("ant"); + + if (canvas == null) + canvas = MM_findObj("imgCanvas"); + + x=ns6? e.clientX: event.clientX + y=ns6? e.clientY: event.clientY + + //jg_doc.draw + dragapproved=true + document.onmousemove=measure + + return false + } +} + +function measure(e) +{ + if (dragapproved) + { + mx2 = ns6? e.clientX : event.clientX; + my2 = ns6? e.clientY : event.clientY; + + jg_doc.clear(); + jg_doc.setStroke(Stroke.DOTTED); + jg_doc.drawLine(x,y,mx2,my2); + jg_doc.paint(); + showStatus(); + return false; + } +} + +function setMarker(nx,ny,nw,nh) +{ + if (ant == null) + ant = MM_findObj("ant"); + + if (canvas == null) + canvas = MM_findObj("imgCanvas"); + if(content == null) { + content = MM_findObj("cropContent"); + } + + if (pic_width == null || pic_height == null) + { + image = MM_findObj("theImage"); + pic_width = image.width; + pic_height = image.height; + } + + ant.style.visibility = "visible"; + + nx = pic_x + nx; + ny = pic_y + ny; + + if (nw >= 0) + { + ant.style.left = nx; + ant.style.width = nw; + } + else + { + ant.style.left = nx+nw; + ant.style.width = -1*nw; + } + + if (nh >= 0) + { + ant.style.top = ny; + ant.style.height = nh; + } + else + { + ant.style.top = ny+nh; + ant.style.height = -1*nh + } + +} + +function max(x,y) +{ + if(y > x) + return x; + else + return y; +} + +function drawBoundHandle() +{ + if(ant == null || ant.style == null) + return false; + + var ah = parseInt(ant.style.height); + var aw = parseInt(ant.style.width); + var ax = parseInt(ant.style.left); + var ay = parseInt(ant.style.top); + + jg_doc.drawHandle(ax-15,ay-15,30,30,"nw-resize"); //upper left + jg_doc.drawHandle(ax-15,ay+ah-15,30,30,"sw-resize"); //lower left + jg_doc.drawHandle(ax+aw-15,ay-15,30,30,"ne-resize"); //upper right + jg_doc.drawHandle(ax+aw-15,ay+ah-15,30,30,"se-resize"); //lower right + + jg_doc.drawHandle(ax+max(15,aw/10),ay-8,aw-2*max(15,aw/10),8,"n-resize"); //top middle + jg_doc.drawHandle(ax+max(15,aw/10),ay+ah,aw-2*max(15,aw/10),8,"s-resize"); //bottom middle + jg_doc.drawHandle(ax-8, ay+max(15,ah/10),8,ah-2*max(15,ah/10),"w-resize"); //left middle + jg_doc.drawHandle(ax+aw, ay+max(15,ah/10),8,ah-2*max(15,ah/10),"e-resize"); //right middle + + jg_doc.drawHandleBox(ax-4,ay-4,8,8,"nw-resize"); //upper left + jg_doc.drawHandleBox(ax-4,ay+ah-4,8,8,"sw-resize"); //lower left + jg_doc.drawHandleBox(ax+aw-4,ay-4,8,8,"ne-resize"); //upper right + jg_doc.drawHandleBox(ax+aw-4,ay+ah-4,8,8,"se-resize"); //lower right + + jg_doc.drawHandleBox(ax+aw/2-4,ay-4,8,8,"n-resize"); //top middle + jg_doc.drawHandleBox(ax+aw/2-4,ay+ah-4,8,8,"s-resize"); //bottom middle + jg_doc.drawHandleBox(ax-4, ay+ah/2-4,8,8,"w-resize"); //left middle + jg_doc.drawHandleBox(ax+aw-4, ay+ah/2-4,8,8,"e-resize"); //right middle + + //jg_doc.paint(); +} + +function showStatus() +{ + if(ant == null || ant.style == null) { + return false; + } + + if(mode == "measure") { + //alert(pic_x); + mx1 = x - pic_x; + my1 = y - pic_y; + + mw = mx2 - x; + mh = my2 - y; + + md = parseInt(Math.sqrt(mw*mw + mh*mh)*100)/100; + + ma = (Math.atan(-1*mh/mw)/Math.PI)*180; + if(mw < 0 && mh < 0) + ma = ma+180; + + if (mw <0 && mh >0) + ma = ma - 180; + + ma = parseInt(ma*100)/100; + + if (m_sx != null && !isNaN(mx1)) + m_sx.value = mx1+"px"; + if (m_sy != null && !isNaN(my1)) + m_sy.value = my1+"px"; + if(m_w != null && !isNaN(mw)) + m_w.value = mw + "px"; + if(m_h != null && !isNaN(mh)) + m_h.value = mh + "px"; + + if(m_d != null && !isNaN(md)) + m_d.value = md + "px"; + if(m_a != null && !isNaN(ma)) + m_a.value = ma + ""; + + if(r_ra != null &&!isNaN(ma)) + r_ra.value = ma; + + //alert("mx1:"+mx1+" my1"+my1); + return false; + } + + var ah = parseInt(ant.style.height); + var aw = parseInt(ant.style.width); + var ax = parseInt(ant.style.left); + var ay = parseInt(ant.style.top); + + var cx = ax-pic_x<0?0:ax-pic_x; + var cy = ay-pic_y<0?0:ay-pic_y; + cx = cx>pic_width?pic_width:cx; + cy = cy>pic_height?pic_height:cy; + + var cw = ax-pic_x>0?aw:aw-(pic_x-ax); + var ch = ay-pic_y>0?ah:ah-(pic_y-ay); + + ch = ay+ah0 && s_sh.value.indexOf('%')>0) + { + sw = cw/pic_width; + sh = ch/pic_height; + } + if (s_sw != null) + s_sw.value = sw; + if (s_sh != null) + s_sh.value = sh; + } + +} + +function dragStopped() +{ + dragapproved=false; + + if(ant == null || ant.style == null) { + return false; + } + + if(mode == "measure") { + jg_doc.drawLine(x-4,y,x+4,y); + jg_doc.drawLine(x,y-4,x,y+4); + jg_doc.drawLine(mx2-4,my2,mx2+4,my2); + jg_doc.drawLine(mx2,my2-4,mx2,my2+4); + + jg_doc.paint(); + showStatus(); + return false; + } + var ah = parseInt(ant.style.height); + var aw = parseInt(ant.style.width); + var ax = parseInt(ant.style.left); + var ay = parseInt(ant.style.top); + jg_doc.clear(); + + if(content != null) { + if(content.width != null && content.height != null) { + content.width = aw-1; + content.height = ah-1; + } + //alert(content.width+":"+content.height); + } + if(mode == "crop") { + //alert(pic_y); + jg_doc.fillRectPattern(pic_x,pic_y,pic_width,ay-pic_y,pattern); + + var h1 = ah; + var y1 = ay; + if (ah+ay >= pic_height+pic_y) + h1 = pic_height+pic_y-ay; + else if (ay <= pic_y) + { + h1 = ay+ah-pic_y; + y1 = pic_y; + } + jg_doc.fillRectPattern(pic_x,y1,ax-pic_x,h1,pattern); + jg_doc.fillRectPattern(ax+aw,y1,pic_x+pic_width-ax-aw,h1,pattern); + jg_doc.fillRectPattern(pic_x,ay+ah,pic_width,pic_height+pic_y-ay-ah,pattern); + } + else if(mode == "scale") { + //alert("Resizing: iw:"+image.width+" nw:"+aw); + document.theImage.height = ah; + document.theImage.width = aw; + document.theImage.style.height = ah+" px"; + document.theImage.style.width = aw+" px"; + + P7_Snap('theImage','ant',0,0); + + //alert("After Resizing: iw:"+image.width+" nw:"+aw); + } + + drawBoundHandle(); + jg_doc.paint(); + + showStatus(); + return false; +} + +document.onmousedown=drags; +document.onmouseup=dragStopped; \ No newline at end of file Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/ExtendedFileManager/assets/ImageEditor.css =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/ExtendedFileManager/assets/ImageEditor.css,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/ExtendedFileManager/assets/ImageEditor.css 2 Feb 2007 21:04:52 -0000 1.1 @@ -0,0 +1,76 @@ +.icons { + font: 11px Tahoma,Verdana,sans-serif; + color: #666699; + text-align: center; + text-decoration: none; + border: 1px solid #EEEEFF; + -Moz-Border-Radius: 6px 6px 6px 6px; +} + +body, td, p { + font: 11px Tahoma,Verdana,sans-serif; +} +.iconsOver { + font: 11px Tahoma,Verdana,sans-serif; + color: #666699; + text-align: center; + text-decoration: none; + background-color: #F9F9FF; + border: 1px solid #666699; + -Moz-Border-Radius: 6px 6px 6px 6px; +} +.topBar { + font: 11px Tahoma,Verdana,sans-serif; + color: #666699; +} +.iconsSel { + font: 11px Tahoma,Verdana,sans-serif; + color: #666699; + text-align: center; + text-decoration: none; + border: 1px solid #666699; + -Moz-Border-Radius: 6px 6px 6px 6px; +} +.iconText { + font: 11px Tahoma,Verdana,sans-serif; + color: #666699; + text-decoration: none; + text-align: center; +} +.measureStats{ + width: 50px; +} + +#slidercasing { + /*border:1px solid #CCCCCC; + background-color:#FFFFFF;*/ + width:100px; + height:5px; + position:relative; + z-index:4; + padding:10px; +} + + +#slidertrack { + position:relative; + border:1px solid #CCCCCC; + background-color:#FFFFCC; + z-index:5; + height:5px; +} + + +#sliderbar { + position:absolute; + z-index:6; + border:1px solid #CCCCCC; + background-color:#DDDDDD; + width:15px; + padding:0px; + height:20px; + cursor: pointer; + top:2px; +} + +select, input, button { font: 11px Tahoma,Verdana,sans-serif; } Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/ExtendedFileManager/assets/dialog.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/ExtendedFileManager/assets/dialog.js,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/ExtendedFileManager/assets/dialog.js 2 Feb 2007 21:04:52 -0000 1.1 @@ -0,0 +1,107 @@ +// Dialog v3.0 - Copyright (c) 2003-2004 interactivetools.com, inc. +// This copyright notice MUST stay intact for use (see license.txt). +// +// Portions (c) dynarch.com, 2003-2004 +// +// A free WYSIWYG editor replacement for '; - } else if(type == "select") { - text = ''; - var optionsList = param["f_options"]; - for (i=0; i<= optionsList.length-1; i++) { - text += ''; - } - text += ''; + if(type == "textarea") { + text = '' + param["f_text"] + ''; + } else if(type == "select") { + text = ''; + var optionsList = param["f_options"]; + for (i=0; i<= optionsList.length-1; i++) { + text += ''; + } + text += ''; } else if(type == "label") { text = '' + param["f_text"] + ''; } else if(type == "fieldset") { text = ''; if (param["f_legend"] != "") text += '' + param["f_text"] + ''; - text += ''; - } else { - text = ''; - } - editor.insertHTML(text); + text += ''; + } else { + text = ''; + } + editor.insertHTML(text); } } - }, outparam); - } + }, outparam); + } }; \ No newline at end of file Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/FullPage/test.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/FullPage/test.html,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/FullPage/test.html 2 Feb 2007 21:04:56 -0000 1.1 @@ -0,0 +1,89 @@ + + + Test of FullPage plugin + + + + + + + + + + + + + + + + + + +

Test of FullPage plugin

+ + + +
+
Mihai Bazon
+ + +Last modified on Sat Oct 25 01:06:59 2003 + + + + Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/FullPage/lang/nb.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/FullPage/lang/nb.js,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/FullPage/lang/nb.js 2 Feb 2007 21:04:57 -0000 1.1 @@ -0,0 +1,17 @@ +// I18N constants +// LANG: "nb", ENCODING: UTF-8 +// translated: Kim Steinhaug, http://www.steinhaug.com/, kim@steinhaug.com +{ + "Alternate style-sheet:": "Alternativt stilsett:", + "Background color:": "Bakgrunnsfarge:", + "Cancel": "Avbryt", + "DOCTYPE:": "DOCTYPE:", + "Keywords:": "Nøkkelord", + "Description:": "Beskrivelse", + "Character set:": "Tegnsett", + "Document properties": "Egenskaper for dokument", + "Document title:": "Tittel på dokument:", + "OK": "OK", + "Primary style-sheet:": "Stilsett:", + "Text color:": "Tekstfarge:" +}; \ No newline at end of file Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/FullPage/popups/docprop.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/FullPage/popups/docprop.html,v diff -u -r1.2 -r1.3 --- openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/FullPage/popups/docprop.html 11 Nov 2005 20:32:43 -0000 1.2 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/FullPage/popups/docprop.html 2 Feb 2007 21:04:57 -0000 1.3 @@ -2,7 +2,7 @@ Document properties - + - + -
Insert Image
+
@@ -150,7 +150,7 @@ - Align: + Alignment: + Images on the Server:
+ -'; - } else { - echo ''; - } -?> + + + +
-
+
@@ -217,13 +208,15 @@
+ + @@ -252,7 +245,7 @@ - + @@ -262,9 +255,7 @@

Border thickness:
- - +
@@ -290,14 +281,11 @@
Horizontal:
- - +

Vertical:
- +
Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/InsertPicture/insert-picture.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/InsertPicture/insert-picture.js,v diff -u -r1.3 -r1.4 --- openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/InsertPicture/insert-picture.js 4 Jun 2006 00:45:52 -0000 1.3 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/InsertPicture/insert-picture.js 2 Feb 2007 21:05:00 -0000 1.4 @@ -1,93 +1,25 @@ -// Insert Image plugin for HTMLArea +// Insert Image plugin for Xinha // Original Author - Udo Schmal // // (c) www.Schaffrath-NeueMedien.de 2004 // Distributed under the same terms as HTMLArea itself. // This notice MUST stay intact for use (see license.txt). -//Usage: -// if(typeof InsertPicture != 'undefined') -// { InsertPicture.PicturePath = [webpath to imagefolder]; -// InsertPicture.LocalPicturePath = [local server path to imagefolder]; -// } -// for Example: -// if(typeof InsertPicture != 'undefined') -// { InsertPicture.PicturePath = _editor_url + "plugins/insertPicture/demo_pictures/"; -// InsertPicture.LocalPicturePath = "d:\\inetpub\\wwwroot\\xinha\\trunk\\plugins\\insertPicture\\demo_pictures"; -// } - - function InsertPicture(editor) { -// nothing to do + if ( typeof _editor_picturePath !== "string" ) + _editor_picturePath = _editor_url + "plugins/InsertPicture/demo_pictures/"; + InsertPicture.Scripting = "php"; //else "asp" + editor.config.URIs.insert_image = '../plugins/InsertPicture/InsertPicture.' + InsertPicture.Scripting + '?picturepath=' + _editor_picturePath; } InsertPicture._pluginInfo = { - name : "InsertPicture", - version : "1.0.1", - developer : "Udo Schmal", - developer_url : "http://www.Schaffrath-NeueMedien.de/", - sponsor : "L.N.Schaffrath NeueMedien", - sponsor_url : "http://www.schaffrath-neuemedien.de/", - c_owner : "Udo Schmal", - license : "htmlArea" + name : "InsertPicture", + version : "1.0.2", + developer : "Udo Schmal", + developer_url : "http://www.Schaffrath-NeueMedien.de/", + sponsor : "L.N.Schaffrath NeueMedien", + sponsor_url : "http://www.schaffrath-neuemedien.de/", + c_owner : "Udo Schmal", + license : "htmlArea" }; -HTMLArea.prototype._insertImage = function(image) { - var editor = this; - var outparam = null; - if (typeof image == "undefined") { - image = this.getParentElement(); - if (image && !/^img$/i.test(image.tagName)) - image = null; - } - if (image) outparam = { - f_url : image.getAttribute("src"), - f_alt : image.alt, - f_border : image.border, - f_align : image.align, - f_vert : image.vspace, - f_horiz : image.hspace, - f_width : image.width, - f_height : image.height - }; - - var manager = _editor_url + 'plugins/InsertPicture/InsertPicture.php' - + '?picturepath=' + InsertPicture.PicturePath; - - Dialog(manager, function(param) { - if (!param) { // user must have pressed Cancel - return false; - } - if (!image) { - var sel = editor._getSelection(); - var range = editor._createRange(sel); - editor._doc.execCommand("insertimage", false, param.f_url); - if (HTMLArea.is_ie) { - image = range.parentElement(); - // wonder if this works... - if (image.tagName.toLowerCase() != "img") { - image = image.previousSibling; - } - } else { - image = range.startContainer.previousSibling; - } - } else { - image.src = param.f_url; - } - - for (field in param) { - var value = param[field]; - switch (field) { - case "f_alt" : image.alt = value; break; - case "f_border" : image.border = parseInt(value || "0"); break; - case "f_align" : image.align = value; break; - case "f_vert" : image.vspace = parseInt(value || "0"); break; - case "f_horiz" : image.hspace = parseInt(value || "0"); break; - case "f_width" : image.width = parseInt(value || "0"); break; - case "f_height" : image.height = parseInt(value || "0"); break; - } - } - - - }, outparam); -}; Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/InsertPicture/lang/de.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/InsertPicture/lang/de.js,v diff -u -r1.2 -r1.3 --- openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/InsertPicture/lang/de.js 4 Jun 2006 00:45:52 -0000 1.2 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/InsertPicture/lang/de.js 2 Feb 2007 21:05:00 -0000 1.3 @@ -8,5 +8,8 @@ "Images on the Server:": "Bilder auf dem Server:", "Please select a file to upload.": "Wählen Sie eine Datei zum hochladen aus.", "Upload file": "Datei hochladen", - "Open file in new window": "Datei in neuen Fenster anzeigen" + "Open file in new window": "Datei in neuen Fenster anzeigen", + "Size": "Größe", + "Width:": "Breite", + "Height:": "Höhe" }; \ No newline at end of file Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/InsertPicture/lang/nb.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/InsertPicture/lang/nb.js,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/InsertPicture/lang/nb.js 2 Feb 2007 21:05:00 -0000 1.1 @@ -0,0 +1,22 @@ +// LANG: "nb", ENCODING: UTF-8 | ISO-8859-1 +// translated: Kim Steinhaug, http://www.steinhaug.com/, kim@steinhaug.com +{ + "Insert Image": "Sett inn bilde", + "Image Preview:": "Forhåndsvisning:", + "Image URL:": "Bildets URL:", + "Preview": "Forhåndsvisning", + "Alternate text:": "Alternativ tekst", + "Layout": "Oppsett", + "Alignment:": "Plassering", + "Border thickness:": "Rammetykkelse:", + "Spacing": "Luft rundt bildet", + "Horizontal:": "Horisontal:", + "Vertical:": "Vertikal:", + "The file you are uploading doesn't have the correct extension.": "Bildet du laster opp har et ugyldig format, opplastning avbrutt", + "The file you are uploading already exists.": "Bildet du prøver å laste opp eksisterer allerede på serveren", + "The file you are uploading is to big. The max Filesize is": "Bildet du laster opp er for stort, maks tillatt størrelse er", + "Images on the Server:": "Bilder på serveren:", + "Please select a file to upload.": "Velg bilde du skal laste opp", + "Upload file": "Last opp bilde", + "Open file in new window": "Åpne bilde i nytt vindu" +}; \ No newline at end of file Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/InsertPicture/lang/sv.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/InsertPicture/lang/sv.js,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/InsertPicture/lang/sv.js 2 Feb 2007 21:05:00 -0000 1.1 @@ -0,0 +1,35 @@ +// I18N constants +// LANG: "sv", ENCODING: UTF-8 +// Swedish version for rev. 477 (Mar 2006) by Thomas Loo + +{ + "Insert Image": "Infoga bild", + "Image Preview:": "Förhandsgranskning:", + "Image URL:": "Bildens URL:", + "Preview": "Förhandsgranska", + "Alternate text:": "Alternativ text:", + "Layout": "Layout", + "Alignment:": "Placering:", + "Border thickness:": "Ramtjocklek:", + "Spacing": "Marginal", + "Horizontal:": "Horisontell:", + "Vertical:": "Vertikal:", + "The file you are uploading doesn't have the correct extension.": "Uppladdat bild har en ogiltig filändelse, uppladdning avbruten", + "The file you are uploading already exists.": "En fil med detta namn finns redan", + "The file you are uploading is to big. The max Filesize is": "Filen är för stor, maximal filstorlek är", + "Images on the Server:": "Bilder på servern:", + "Please select a file to upload.": "Välj bild att ladda upp", + "Upload file": "Ladda upp bild", + "Size": "Storlek", + "Width:": "Bredd:", + "Height:": "Höjd:", + // tooltips + "Enter the image URL here":"Bildens sökväg (URL)", + "Preview the image in a new window": "Öppna bild i nytt fönster", + "For browsers that don't support images":"Beskrivande text för webläsare som inte stödjer inbäddade bilder", + "Positioning of this image": "Bildens positionering", + "Leave empty for no border": "Lämna tomt för att undvika ram", + "Leave empty for not defined": "Lämna tomt för att låta webläsaren bestämma", + "Horizontal padding": "Horizontellt indrag på bild", + "Vertical padding": "Vertikalt indrag på bild" +}; Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/InsertSmiley/lang/nb.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/InsertSmiley/lang/nb.js,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/InsertSmiley/lang/nb.js 2 Feb 2007 21:05:00 -0000 1.1 @@ -0,0 +1,8 @@ +// I18N constants +// LANG: "nb", ENCODING: UTF-8 +// translated: Kim Steinhaug, http://www.steinhaug.com/, kim@steinhaug.com +{ + "Insert Smiley": "Sett inn smiley", + "Smiley": "Smiley", + "Cancel": "Avbryt" +}; \ No newline at end of file Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/InsertSnippet/demosnippets.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/InsertSnippet/demosnippets.js,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/InsertSnippet/demosnippets.js 2 Feb 2007 21:05:01 -0000 1.1 @@ -0,0 +1,15 @@ +var snippets = []; +var i = 0; +snippets[i] = {}; +snippets[i]['id'] = 'Box 1'; +snippets[i]['HTML'] = '
\n Visit the Xinha website
'; + +i++; +snippets[i] = {}; +snippets[i]['id'] = 'INFORMATION ABOUT SOMETHING'; +snippets[i]['HTML'] = '
\n This is an information about something\n
'; + +i++; +snippets[i] = {}; +snippets[i]['id'] = 'Menu'; +snippets[i]['HTML'] = ''; \ No newline at end of file Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/InsertSnippet/insert-snippet.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/InsertSnippet/insert-snippet.js,v diff -u -r1.2 -r1.3 --- openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/InsertSnippet/insert-snippet.js 4 Jun 2006 00:45:52 -0000 1.2 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/InsertSnippet/insert-snippet.js 2 Feb 2007 21:05:01 -0000 1.3 @@ -4,19 +4,6 @@ Insert HTML fragments or template variables - Usage: - 1. Choose the file that contains the snippets - You can either use a JS array (standard config: ./snippets.js) or a combination of PHP/HTML - where the PHP file reads the HTML file and converts it to a JS format. More convenient to maintain. - Example: xinha_config.InsertSnippet.snippets = _editor_url+"plugins/InsertSnippet/snippets.php" - or - xinha_config.InsertSnippet.snippets = "/Path/to/my/snippets.php" (has to be absolute) - 2. Edit the selected file to contain your stuff - 3. You can then include your own css - Example: xinha_config.InsertSnippet.css = ['../../../CSS/Screen.css']; (may be relative) - 4. You can use the plugin also to insert template variables (i.e. the id in curly brackets) instead of static HTML. - Set xinha_config.InsertSnippet.showInsertVariable true to display a choice option in the dialog - \*------------------------------------------*/ function InsertSnippet(editor) { @@ -36,21 +23,39 @@ } }); cfg.addToolbarElement("insertsnippet", "insertimage", -1); + this.snippets = null; + var backend = cfg.InsertSnippet.snippets + '?'; + + if(cfg.InsertSnippet.backend_data != null) + { + for ( var i in cfg.InsertSnippet.backend_data ) + { + backend += '&' + i + '=' + encodeURIComponent(cfg.InsertSnippet.backend_data[i]); + } + } + Xinha._getback(backend,function (getback) {eval(getback); self.snippets = snippets;}); } +InsertSnippet.prototype.onUpdateToolbar = function() { + if (!this.snippets){ + this.editor._toolbarObjects.insertsnippet.state("enabled", false); + } + else InsertSnippet.prototype.onUpdateToolbar = null; +} + InsertSnippet._pluginInfo = { name : "InsertSnippet", - version : "1.1", + version : "1.2", developer : "Raimund Meyer", developer_url : "http://rheinauf.de", c_owner : "Raimund Meyer", - sponsor : "Raimund Meyer", - sponsor_url : "http://ray-of-light.org/", + sponsor : "", + sponsor_url : "", license : "htmlArea" }; InsertSnippet.prototype._lc = function(string) { - return HTMLArea._lc(string, 'InsertSnippet'); + return Xinha._lc(string, 'InsertSnippet'); }; InsertSnippet.prototype.onGenerate = function() { @@ -65,27 +70,30 @@ } }; -HTMLArea.Config.prototype.InsertSnippet = +Xinha.Config.prototype.InsertSnippet = { - 'snippets' : _editor_url+"plugins/InsertSnippet/snippets.js", - 'css' : ['../InsertSnippet.css'], - 'showInsertVariable': false + 'snippets' : _editor_url+"plugins/InsertSnippet/demosnippets.js", // purely demo purposes, you should change this + 'css' : ['../InsertSnippet.css'], //deprecated, CSS is now pulled from xinha_config + 'showInsertVariable': false, + 'backend_data' : null }; InsertSnippet.prototype.buttonPress = function(editor) { var args = editor.config; + args.snippets = this.snippets; + var self = this; editor._popupDialog( "plugin://InsertSnippet/insertsnippet", function( param ) { if ( !param ) { return false; } - eval(HTMLArea._geturlcontent(editor.config.InsertSnippet.snippets)); + editor.focusEditor(); if (param['how'] == 'variable') { - editor.insertHTML('{'+snippets[param["snippetnum"]].id+'}'); + editor.insertHTML('{'+self.snippets[param["snippetnum"]].id+'}'); } else { - editor.insertHTML(snippets[param["snippetnum"]].HTML); + editor.insertHTML(self.snippets[param["snippetnum"]].HTML); } }, args); Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/InsertSnippet/readme.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/InsertSnippet/readme.html,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/InsertSnippet/readme.html 2 Feb 2007 21:05:01 -0000 1.1 @@ -0,0 +1,57 @@ + + + + + InsertSnippet for Xinha + + + + + +

InsertSnippet for Xinha

+

Insert HTML fragments in your document. + +

+

Usage

+

+In order to use your own snippets you have to al least one parameter to your xinha_config: +

+
+xinha_config.InsertSnippet.snippets = _editor_url+"plugins/InsertSnippet/snippets.php";
+
+

+The path above indicates the use of the provided backend. This parses a file that contains the snippets and +should have the following format: +

+
+<!--Snippet ID-->
+Snippet content
+<!--/Snippet ID-->
+...and so on
+
+

+You can use the snippets.html in the plugin folder or tell the backend where to find the file like this +

+
+with (xinha_config.InsertSnippet)
+{
+	<?php
+
+	// define backend configuration for the plugin
+	$backend_data['snippets_file'] = '/file/containing/snippets.html';
+	require_once '../contrib/php-xinha.php';
+	xinha_pass_to_php_backend($backend_data);
+    
+	?>
+}
+
+ +

Raimund Meyer (xinha@raimundmeyer.de)

+ + \ No newline at end of file Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/InsertSnippet/snippets.php =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/InsertSnippet/snippets.php,v diff -u -r1.2 -r1.3 --- openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/InsertSnippet/snippets.php 4 Jun 2006 00:45:52 -0000 1.2 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/InsertSnippet/snippets.php 2 Feb 2007 21:05:01 -0000 1.3 @@ -1,27 +1,22 @@ -var snippets = new Array(); -var i = 0; (.*?)#s',$string,$matches); - - $array=array(); - for ($i=0;$i$html) +$snippets = file_get_contents($snippets_file); +preg_match_all('/(.*?)/s',$snippets,$matches); + +$array=array(); +for ($i=0;$i$id,'HTML'=>$html); } +print "var snippets = " . xinha_to_js($array); ?> \ No newline at end of file Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/InsertSnippet/lang/nb.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/InsertSnippet/lang/nb.js,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/InsertSnippet/lang/nb.js 2 Feb 2007 21:05:01 -0000 1.1 @@ -0,0 +1,11 @@ +// I18N constants +// LANG: "nb", ENCODING: UTF-8 +// translated: Kim Steinhaug, http://www.steinhaug.com/, kim@steinhaug.com +{ +"Insert Snippet": "Sett inn snutt", +"Cancel": "Avbryt", +"Variable":"Variabel", +"Insert as":"Sett inn som", +"Show preview":"Vis forhåndsvisning", +"Hide preview":"Skjul forhåndsvisning" +}; \ No newline at end of file Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/InsertSnippet/lang/no.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/InsertSnippet/lang/no.js,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/InsertSnippet/lang/no.js 2 Feb 2007 21:05:01 -0000 1.1 @@ -0,0 +1,11 @@ +// I18N constants +// LANG: "no", ENCODING: UTF-8 +// translated: Kim Steinhaug, http://www.steinhaug.com/, kim@steinhaug.com +{ +"Insert Snippet": "Sett inn snutt", +"Cancel": "Avbryt", +"Variable":"Variabel", +"Insert as":"Sett inn som", +"Show preview":"Vis forhåndsvisning", +"Hide preview":"Skjul forhåndsvisning" +}; \ No newline at end of file Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/InsertSnippet/popups/insertsnippet.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/InsertSnippet/popups/insertsnippet.html,v diff -u -r1.2 -r1.3 --- openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/InsertSnippet/popups/insertsnippet.html 4 Jun 2006 00:45:53 -0000 1.2 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/InsertSnippet/popups/insertsnippet.html 2 Feb 2007 21:05:01 -0000 1.3 @@ -1,57 +1,68 @@ - - + + + Insert Snippet + @@ -105,7 +116,7 @@ .preview {} - +
Insert Snippet
Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/LangMarks/lang/nb.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/LangMarks/lang/nb.js,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/LangMarks/lang/nb.js 2 Feb 2007 21:05:01 -0000 1.1 @@ -0,0 +1,11 @@ +// I18N constants +// LANG: "nb", ENCODING: UTF-8 +// translated: Kim Steinhaug, http://www.steinhaug.com/, kim@steinhaug.com +{ + "language select": "Språkvalg", + "— language —": "— Språk —", + "Greek": "grekisk", + "English": "engelsk", + "French": "fransk", + "Latin": "latin" +}; \ No newline at end of file Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/LangMarks/lang/nl.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/LangMarks/lang/nl.js,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/LangMarks/lang/nl.js 2 Feb 2007 21:05:01 -0000 1.1 @@ -0,0 +1,11 @@ +// I18N constants +// LANG: "de", ENCODING: UTF-8 | ISO-8859-1 +// Author: Udo Schmal (gocher), http://www.schaffrath-neuemedien.de/, udo.schmal@t-online.de +{ + "language select": "Taalkeuze", + "— language —": "— taal —", + "Greek": "Grieks", + "English": "Engels", + "French": "Frans", + "Latin": "Latijns" +}; \ No newline at end of file Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/Linker/linker.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/Linker/Attic/linker.js,v diff -u -r1.3 -r1.4 --- openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/Linker/linker.js 4 Jun 2006 00:45:53 -0000 1.3 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/Linker/linker.js 2 Feb 2007 21:05:02 -0000 1.4 @@ -11,11 +11,12 @@ sponsor_url : "http://www.gogo.co.nz/" }; -HTMLArea.loadStyle('dTree/dtree.css', 'Linker'); +Xinha.loadStyle('dTree/dtree.css', 'Linker'); -HTMLArea.Config.prototype.Linker = +Xinha.Config.prototype.Linker = { 'backend' : _editor_url + 'plugins/Linker/scan.php', + 'backend_data' : null, 'files' : null }; @@ -45,12 +46,12 @@ Linker.prototype._lc = function(string) { - return HTMLArea._lc(string, 'Linker'); + return Xinha._lc(string, 'Linker'); }; Linker.prototype._createLink = function(a) { - if(!a && this.editor._selectionEmpty(this.editor._getSelection())) + if(!a && this.editor.selectionEmpty(this.editor.getSelection())) { alert(this._lc("You must select some text before making a new link.")); return false; @@ -66,13 +67,16 @@ p_options: ['menubar=no','toolbar=yes','location=no','status=no','scrollbars=yes','resizeable=yes'], to: 'alice@example.com', subject: '', - body: '' + body: '', + anchor: '' }; if(a && a.tagName.toLowerCase() == 'a') { - var m = a.href.match(/^mailto:(.*@[^?&]*)(\?(.*))?$/); - var anchor = a.href.match(/^#(.*)$/); + var href =this.editor.fixRelativeLinks(a.getAttribute('href')); + var m = href.match(/^mailto:(.*@[^?&]*)(\?(.*))?$/); + var anchor = href.match(/^#(.*)$/); + if(m) { // Mailto @@ -95,7 +99,8 @@ { //Anchor-Link inputs.type = 'anchor'; - inputs.anchor = m[1]; + inputs.anchor = anchor[1]; + } else { @@ -106,7 +111,7 @@ var m = a.getAttribute('onclick').match(/window\.open\(\s*this\.href\s*,\s*'([a-z0-9_]*)'\s*,\s*'([a-z0-9_=,]*)'\s*\)/i); // Popup Window - inputs.href = a.href ? a.href : ''; + inputs.href = href ? href : ''; inputs.target = 'popup'; inputs.p_name = m[1]; inputs.p_options = [ ]; @@ -129,7 +134,7 @@ else { // Normal - inputs.href = a.href; + inputs.href = href; inputs.target = a.target; } } @@ -208,6 +213,8 @@ p.insertBefore(a.removeChild(a.childNodes[0]), a); } p.removeChild(a); + linker.editor.updateToolbar(); + return; } } else @@ -221,7 +228,7 @@ // If we change a mailto link in IE for some hitherto unknown // reason it sets the innerHTML of the link to be the // href of the link. Stupid IE. - if(HTMLArea.is_ie) + if(Xinha.is_ie) { if(/mailto:([^?<>]*)(\?[^<]*)?$/i.test(a.innerHTML)) { @@ -235,24 +242,27 @@ if(!atr.href) return true; // Insert a link, we let the browser do this, we figure it knows best - var tmp = HTMLArea.uniq('http://www.example.com/Link'); + var tmp = Xinha.uniq('http://www.example.com/Link'); linker.editor._doc.execCommand('createlink', false, tmp); // Fix them up var anchors = linker.editor._doc.getElementsByTagName('a'); for(var i = 0; i < anchors.length; i++) { - var a = anchors[i]; - if(a.href == tmp) + var anchor = anchors[i]; + if(anchor.href == tmp) { // Found one. - for(var i in atr) + if (!a) a = anchor; + for(var j in atr) { - a.setAttribute(i, atr[i]); + anchor.setAttribute(j, atr[j]); } } } } + linker.editor.selectNodeContents(a); + linker.editor.updateToolbar(); }; this._dialog.show(inputs, doOK); @@ -261,9 +271,9 @@ Linker.prototype._getSelectedAnchor = function() { - var sel = this.editor._getSelection(); - var rng = this.editor._createRange(sel); - var a = this.editor._activeElement(sel); + var sel = this.editor.getSelection(); + var rng = this.editor.createRange(sel); + var a = this.editor.activeElement(sel); if(a != null && a.tagName.toLowerCase() == 'a') { return a; @@ -315,7 +325,7 @@ // we prepare the dialog. if(typeof dTree == 'undefined') { - HTMLArea._loadback(_editor_url + 'plugins/Linker/dTree/dtree.js', + Xinha._loadback(_editor_url + 'plugins/Linker/dTree/dtree.js', function() {lDialog._prepareDialog(); } ); return; @@ -326,10 +336,11 @@ if(linker.lConfig.backend) { //get files from backend - HTMLArea._getback(linker.lConfig.backend, + Xinha._postback(linker.lConfig.backend, + linker.lConfig.backend_data, function(txt) { try { - eval('lDialog.files = '+txt); + lDialog.files = eval(txt); } catch(Error) { lDialog.files = [ {url:'',title:Error.toString()} ]; } @@ -347,14 +358,14 @@ if(this.html == false) { - HTMLArea._getback(_editor_url + 'plugins/Linker/dialog.html', function(txt) { lDialog.html = txt; lDialog._prepareDialog(); }); + Xinha._getback(_editor_url + 'plugins/Linker/dialog.html', function(txt) { lDialog.html = txt; lDialog._prepareDialog(); }); return; } var html = this.html; // Now we have everything we need, so we can build the dialog. - var dialog = this.dialog = new HTMLArea.Dialog(linker.editor, this.html, 'Linker'); - var dTreeName = HTMLArea.uniq('dTree_'); + var dialog = this.dialog = new Xinha.Dialog(linker.editor, this.html, 'Linker'); + var dTreeName = Xinha.uniq('dTree_'); this.dTree = new dTree(dTreeName, _editor_url + 'plugins/Linker/dTree/'); eval(dTreeName + ' = this.dTree'); @@ -478,10 +489,10 @@ { this.dialog.getElementById('popuptable').style.display = 'none'; } - + var anchor = this.dialog.getElementById('anchor'); - for(var i=0;i=0;i--) { + anchor[i] = null; } var html = this.linker.editor.getHTML(); @@ -508,14 +519,12 @@ for(i=0;i $v) - { - $i = ""; - if($useObject) { - if(preg_match('#[a-zA-Z]+[a-zA-Z0-9]*#', $k)) { - $i .= "$k: "; - } else { - $i .= "'$k': "; - } - } - $i .= to_js($v, $tabs + 1); - $js[] = $i; - } - if($useObject) { - $ret = "{\n" . tabify(implode(",\n", $js), $tabs) . "\n}"; - } else { - $ret = "[\n" . tabify(implode(",\n", $js), $tabs) . "\n]"; - } - return $ret; - } - - return 'null'; - } - - function tabify($text, $tabs) - { - if($text) - { - return str_repeat(" ", $tabs) . preg_replace('/\n(.)/', "\n" . str_repeat(" ", $tabs) . "\$1", $text); - } - } - - function js_encode($string) - { - static $strings = "\\,\",',%,&,<,>,{,},@,\n,\r"; - - if(!is_array($strings)) - { - $tr = array(); - foreach(explode(',', $strings) as $chr) - { - $tr[$chr] = sprintf('\x%02X', ord($chr)); - } - $strings = $tr; - } - - return strtr($string, $strings); - } - - - echo to_js(scan($dir)); + + echo xinha_to_js(scan($dir)); ?> Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/Linker/dTree/dtree.css =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/Linker/dTree/dtree.css,v diff -u -r1.1 -r1.2 --- openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/Linker/dTree/dtree.css 2 Nov 2005 08:56:27 -0000 1.1 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/Linker/dTree/dtree.css 2 Feb 2007 21:05:02 -0000 1.2 @@ -14,7 +14,7 @@ border: 0px; vertical-align: middle; } -.dtree a { +.dtree a,.dtree a:visited { color: #333; text-decoration: none; } Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/Linker/lang/nb.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/Linker/lang/nb.js,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/Linker/lang/nb.js 2 Feb 2007 21:05:02 -0000 1.1 @@ -0,0 +1,7 @@ +// I18N constants +// LANG: "nb", ENCODING: UTF-8 +// translated: Kim Steinhaug, http://www.steinhaug.com/, kim@steinhaug.com +{ + "You must select some text before making a new link.": "Du må markere tekst eller et bilde før du kan lage en lenke.", + "Are you sure you wish to remove this link?": "Er du sikker på at du vil fjerne lenken?" +}; \ No newline at end of file Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/ListType/lang/nb.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/ListType/lang/nb.js,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/ListType/lang/nb.js 2 Feb 2007 21:05:02 -0000 1.1 @@ -0,0 +1,12 @@ +// I18N constants +// LANG: "nb", ENCODING: UTF-8 +// translated: Kim Steinhaug, http://www.steinhaug.com/, kim@steinhaug.com +{ + "Decimal numbers": "Desimaltall", + "Lower roman numbers": "Lower roman numbers", + "Upper roman numbers": "Upper roman numbers", + "Lower latin letters": "Lower latin letters", + "Upper latin letters": "Upper latin letters", + "Lower greek letters": "Lower greek letters", + "Choose list style type (for ordered lists)": "Velg listetype (for nummererte lister)" +}; Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/ListType/lang/sv.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/ListType/lang/sv.js,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/ListType/lang/sv.js 2 Feb 2007 21:05:02 -0000 1.1 @@ -0,0 +1,12 @@ +// I18N constants +// LANG: "sv" (Swedish), ENCODING: UTF-8 +// translated: Erik Dalén, +{ + "Decimal numbers": "Desimaltal", + "Lower roman numbers": "Små romerska siffror", + "Upper roman numbers": "Stora romerska siffror", + "Lower latin letters": "Små latinska bokstäver", + "Upper latin letters": "Stora latinska bokstäver", + "Lower greek letters": "Små grekiska bokstäver", + "Choose list style type (for ordered lists)": "Välj listtyp (för numrerade listor)" +}; Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/NoteServer/lang/nb.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/NoteServer/lang/nb.js,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/NoteServer/lang/nb.js 2 Feb 2007 21:05:02 -0000 1.1 @@ -0,0 +1,17 @@ +// I18N constants +// LANG: "nb", ENCODING: UTF-8 +// translated: Kim Steinhaug, http://www.steinhaug.com/, kim@steinhaug.com +{ + "Insert GUIDO Music Notation": "Sett inn GUIDO-noter", + "Guido code": "GUIDO-kode", + "Options": "Muligheter", + "Format": "Format", + "Image in applet": "Bilde i applet", + "Zoom": "Forstørr", + "MIDI File": "MIDIfil", + "Image Preview": "Bilde forhåndsvisning", + "Source Code": "Kildekode", + "Preview": "Preview", + "Add MIDI link to allow students to hear the music": "Legg til MIDI-link for at studenter kan høre musikken", + "Add GUIDO Code in a textbox on the page": "Sett inn GUIDO-kode i et tekstfelt på siden" +}; \ No newline at end of file Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/PasteText/lang/es.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/PasteText/lang/es.js,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/PasteText/lang/es.js 2 Feb 2007 21:05:03 -0000 1.1 @@ -0,0 +1,6 @@ +// I18N constants + +// LANG: "es", ENCODING: UTF-8 +{ + "Paste as Plain Text" : "Paste as Plain Text" +}; Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/PasteText/lang/nb.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/PasteText/lang/nb.js,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/PasteText/lang/nb.js 2 Feb 2007 21:05:03 -0000 1.1 @@ -0,0 +1,6 @@ +// I18N constants +// LANG: "nb", ENCODING: UTF-8 +// translated: Kim Steinhaug, http://www.steinhaug.com/, kim@steinhaug.com +{ + "Paste as Plain Text": "Lim inn som ren tekst" +}; Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/QuickTag/lang/nb.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/QuickTag/lang/nb.js,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/QuickTag/lang/nb.js 2 Feb 2007 21:05:03 -0000 1.1 @@ -0,0 +1,17 @@ +// I18N constants +// LANG: "nb", ENCODING: UTF-8 +// translated: Kim Steinhaug, http://www.steinhaug.com/, kim@steinhaug.com +{ + "Quick Tag Editor": "Kjapp TAGG-Editor", + "Enter the TAG you want to insert": "Skriv inn taggen du vil ønsker å sette inn", + "You have to select some text": "Du må velge noe tekst", + "There are some unclosed quote": "Det mangler et hermetegn", + "This attribute already exists in the TAG": "Denne attributten eksisterer allerede i taggen", + "No CSS class avaiable": "Ingen CSS klasse tilgjengelig", + "OPTIONS": "EGENSKAPER", + "ATTRIBUTES": "ATTRIBUTTER", + "TAGs": "TAGGer", + "Colors": "Farger", + "Ok": "OK", + "Cancel": "Avbryt" +}; \ No newline at end of file Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/SaveSubmit/README.txt =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/SaveSubmit/README.txt,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/SaveSubmit/README.txt 2 Feb 2007 21:05:03 -0000 1.1 @@ -0,0 +1,15 @@ +SaveSubmit for Xinha + +developed by Raimund Meyer (ray) xinha @ raimundmeyer.de + +Registers a button for submiting the Xinha form using asynchronous +postback for sending the data to the server + +Usage: This should be a drop-in replacement for a normal submit button. +While saving a message is displayed to inform the user what's going on. +On successful transmission the output of the target script is shown, so it should print some information +about the success of saving. + +ATTENTION: The data sent by this method is always UTF-8 encoded, regardless of the actual charset used. So, if you +are using a different encoding you have to convert on the server side. + Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/SaveSubmit/save-submit.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/SaveSubmit/save-submit.js,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/SaveSubmit/save-submit.js 2 Feb 2007 21:05:03 -0000 1.1 @@ -0,0 +1,164 @@ +/*------------------------------------------*\ +SaveSubmit for Xinha +____________________ + +See README.txt for information + +\*------------------------------------------*/ + +function SaveSubmit(editor) { + this.editor = editor; + this.initial_html = null; + this.changed = false; + var self = this; + var cfg = editor.config; + this.textarea = this.editor._textArea; + + this.imgage_changed = _editor_url+"plugins/SaveSubmit/img/ed_save_red.gif"; + this.imgage_unchanged = _editor_url+"plugins/SaveSubmit/img/ed_save_green.gif"; + cfg.registerButton({ + id : "savesubmit", + tooltip : self._lc("Save"), + image : this.imgage_unchanged, + textMode : false, + action : function(editor) { + self.save(editor); + } + }); + cfg.addToolbarElement("savesubmit", "popupeditor", -1); +} + +SaveSubmit.prototype._lc = function(string) { + return Xinha._lc(string, 'SaveSubmit'); +} + +SaveSubmit._pluginInfo = { + name : "SaveSubmit", + version : "1.0", + developer : "Raimund Meyer", + developer_url : "http://rheinauf.de", + c_owner : "Raimund Meyer", + sponsor : "", + sponsor_url : "", + license : "htmlArea" +} + +SaveSubmit.prototype.onGenerate = function() { + var self = this; + var doc = this.editordoc = this.editor._iframe.contentWindow.document; + Xinha._addEvents(doc, ["mouseup","keyup","keypress","keydown"], + function (event) { + return self.onEvent(Xinha.is_ie ? self.editor._iframe.contentWindow.event : event); + }); +} + +SaveSubmit.prototype.onEvent = function(ev) { + + var keyEvent = (Xinha.is_ie && ev.type == "keydown") || (!Xinha.is_ie && ev.type == "keypress"); + + if (keyEvent && ev.ctrlKey && String.fromCharCode(Xinha.is_ie ? ev.keyCode : ev.charCode).toLowerCase() == 's') { + this.save(this.editor); + } + else { + if (!this.changed) { + if (this.getChanged()) this.setChanged(); + } + } +} + +SaveSubmit.prototype.getChanged = function() { + if (this.initial_html == null) this.initial_html = this.editor.getHTML(); + if (this.initial_html != this.editor.getHTML() && this.changed == false) { + + this.changed = true; + return true; + } + else return false; +} +SaveSubmit.prototype.setChanged = function() { + toolbar_objects = this.editor._toolbarObjects; + for (var i in toolbar_objects) { + var btn = toolbar_objects[i]; + if (btn.name == 'savesubmit') { + btn.swapImage(this.imgage_changed); + } + } + this.editor.updateToolbar(); +} +SaveSubmit.prototype.changedReset = function() { + this.changed = false; + this.initial_html = null; + toolbar_objects = this.editor._toolbarObjects; + for (var i in toolbar_objects) { + var btn = toolbar_objects[i]; + if (btn.name == 'savesubmit') { + btn.swapImage(this.imgage_unchanged); + } + } +} + +SaveSubmit.prototype.save = function(editor) { + this.buildMessage() + var self =this; + var form = editor._textArea.form; + form.onsubmit(); + + var content =''; + + for (var i=0;i0) ? '&' : '') + form.elements[i].name + '=' + encodeURIComponent(form.elements[i].value); + } + + Xinha._postback(editor._textArea.form.action, content, function(getback) { + + if (getback) { + self.setMessage(getback); + //self.setMessage(self._lc("Ready")); + self.changedReset(); + } + removeMessage = function() { self.removeMessage()} ; + window.setTimeout("removeMessage()",1000); + + }); +} + +SaveSubmit.prototype.setMessage = function(string) { + var textarea = this.textarea; + if ( !document.getElementById("message_sub_" + textarea.name)) { return ; } + var elt = document.getElementById("message_sub_" + textarea.name); + elt.innerHTML = Xinha._lc(string, 'SaveSubmit'); +} + +SaveSubmit.prototype.removeMessage = function() { + var textarea = this.textarea; + if (!document.getElementById("message_" + textarea.name)) { return ; } + document.body.removeChild(document.getElementById("message_" + textarea.name)); +} + +//ripped mokhet's loading message function +SaveSubmit.prototype.buildMessage = function() { + + var textarea = this.textarea; + var htmlarea = this.editor._htmlArea; + var loading_message = document.createElement("div"); + loading_message.id = "message_" + textarea.name; + loading_message.className = "loading"; + loading_message.style.width = htmlarea.offsetWidth +'px' ;//(this.editor._iframe.offsetWidth != 0) ? this.editor._iframe.offsetWidth +'px' : this.editor._initial_ta_size.w; + + loading_message.style.left = Xinha.findPosX(htmlarea) + 'px'; + loading_message.style.top = (Xinha.findPosY(htmlarea) + parseInt(htmlarea.offsetHeight) / 2) - 50 + 'px'; + + var loading_main = document.createElement("div"); + loading_main.className = "loading_main"; + loading_main.id = "loading_main_" + textarea.name; + loading_main.appendChild(document.createTextNode(this._lc("Saving..."))); + + var loading_sub = document.createElement("div"); + loading_sub.className = "loading_sub"; + loading_sub.id = "message_sub_" + textarea.name; + loading_sub.appendChild(document.createTextNode(this._lc("in progress"))); + loading_message.appendChild(loading_main); + loading_message.appendChild(loading_sub); + document.body.appendChild(loading_message); +} \ No newline at end of file Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/SaveSubmit/img/ed_save_green.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/SaveSubmit/img/ed_save_green.gif,v diff -u Binary files differ Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/SaveSubmit/img/ed_save_red.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/SaveSubmit/img/ed_save_red.gif,v diff -u Binary files differ Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/SaveSubmit/lang/de.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/SaveSubmit/lang/de.js,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/SaveSubmit/lang/de.js 2 Feb 2007 21:05:03 -0000 1.1 @@ -0,0 +1,8 @@ +// I18N constants +// LANG: "de", ENCODING: UTF-8 +{ + "Save": "Speichern", + "Saving...": "Speichern...", + "in progress": "in Arbeit", + "Ready": "Fertig" +}; \ No newline at end of file Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/SaveSubmit/lang/ru.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/SaveSubmit/lang/ru.js,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/SaveSubmit/lang/ru.js 2 Feb 2007 21:05:03 -0000 1.1 @@ -0,0 +1,9 @@ +// I18N constants +// LANG: "ru", ENCODING: UTF-8 +// Simple job done by Alexey Kirpichnikov +{ + "Save": "Сохранить", + "Saving...": "Сохранение...", + "in progress": "пожалуйста, ждите", + "Ready": "Готово" +}; \ No newline at end of file Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/SetId/set-id.css =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/SetId/set-id.css,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/SetId/set-id.css 2 Feb 2007 21:05:04 -0000 1.1 @@ -0,0 +1,7 @@ +.hasid { + background-image: url(img/set-id.gif); + background-repeat: no-repeat; + background-position: left top; + padding-left: 19px; + border: 1px dotted blue; +} Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/SetId/set-id.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/SetId/set-id.js,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/SetId/set-id.js 2 Feb 2007 21:05:04 -0000 1.1 @@ -0,0 +1,96 @@ +function SetId(editor) { + this.editor = editor; + var cfg = editor.config; + var self = this; + + // register the toolbar buttons provided by this plugin + cfg.registerButton({ + id : "setid", + tooltip : this._lc("Set Id and Name"), + image : editor.imgURL("set-id.gif", "SetId"), + textMode : false, + action : function(editor) { + self.buttonPress(editor); + } + }); + cfg.addToolbarElement("setid", "createlink", 1); +} + +SetId._pluginInfo = { + name : "SetId", + version : "2.0", + developer : "Udo Schmal", + developer_url : "http://www.schaffrath-neuemedien.de", + c_owner : "Udo Schmal", + sponsor : "L.N.Schaffrath NeueMedien", + sponsor_url : "http://www.schaffrath-neuemedien.de", + license : "htmlArea" +}; + +SetId.prototype._lc = function(string) { + return HTMLArea._lc(string, 'SetId'); +}; + + +SetId.prototype.onGenerate = function() { + var style_id = "ID-style"; + var style = this.editor._doc.getElementById(style_id); + if (style == null) { + style = this.editor._doc.createElement("link"); + style.id = style_id; + style.rel = 'stylesheet'; + style.href = _editor_url + 'plugins/SetId/set-id.css'; + this.editor._doc.getElementsByTagName("HEAD")[0].appendChild(style); + } +}; + +SetId.prototype.buttonPress = function(editor) { + var outparam = null; + var html = editor.getSelectedHTML(); + var sel = editor._getSelection(); + var range = editor._createRange(sel); + var node = editor._activeElement(sel); + if (node) + outparam = { name : node.id }; + else + outparam = { name : '' }; + + editor._popupDialog( "plugin://SetId/set_id", function( param ) { + if ( param ) { + var name = param["name"]; + if (name == "" || name == null) { + if (node) { + node.removeAttribute("name"); + node.removeAttribute("id"); + node.removeAttribute("title"); + if (node.className == "hasid") { + node.removeAttribute("class"); + } + } + return; + } + try { + var doc = editor._doc; + if (!node) { + node = doc.createElement("span"); + node.id = name; + node.name = name; + node.title = name; + node.className = "hasid"; + node.innerHTML = html; + if (HTMLArea.is_ie) { + range.pasteHTML(node.outerHTML); + } else { + editor.insertNodeAtSelection(node); + } + } else { + node.id = name; + node.name = name; + node.title = name; + node.className = "hasid"; + } + } + catch (e) { } + } + }, outparam); +}; Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/SetId/img/placeholder.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/SetId/img/placeholder.gif,v diff -u Binary files differ Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/SetId/img/set-id.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/SetId/img/set-id.gif,v diff -u Binary files differ Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/SetId/lang/de.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/SetId/lang/de.js,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/SetId/lang/de.js 2 Feb 2007 21:05:04 -0000 1.1 @@ -0,0 +1,8 @@ +// I18N constants +// LANG: "de", ENCODING: UTF-8 +// translated: Raimund Meyer xinha@ray-of-light.org +{ + "Set Id and Name": "Objekt ID und Name einfügen", + "Name/Id": "Name (ID)", + "Delete": "Löschen" +}; Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/SetId/lang/nb.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/SetId/lang/nb.js,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/SetId/lang/nb.js 2 Feb 2007 21:05:04 -0000 1.1 @@ -0,0 +1,8 @@ +// I18N constants +// LANG: "nb", ENCODING: UTF-8 +// translated: Kim Steinhaug, http://www.steinhaug.com/, kim@steinhaug.com +{ + "Set Id and Name": "Sett ID og navn", + "Name/Id": "Navn (ID)", + "Delete": "Slett" +}; Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/SetId/lang/no.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/SetId/lang/no.js,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/SetId/lang/no.js 2 Feb 2007 21:05:04 -0000 1.1 @@ -0,0 +1,8 @@ +// I18N constants +// LANG: "no", ENCODING: UTF-8 +// translated: Kim Steinhaug, http://www.steinhaug.com/, kim@steinhaug.com +{ + "Set Id and Name": "Sett ID og navn", + "Name/Id": "Navn (ID)", + "Delete": "Slett" +}; Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/SetId/popups/set_id.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/SetId/popups/set_id.html,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/SetId/popups/set_id.html 2 Feb 2007 21:05:04 -0000 1.1 @@ -0,0 +1,58 @@ + + + Set Id/Name + + + + + + +
Set ID/Name
+ +
Image URL: + title="Enter the image URL here" value=""/>
+ + + + +
ID/Name:
+ +
+ + + +
+
+ + \ No newline at end of file Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/SmartReplace/readme.txt =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/SmartReplace/readme.txt,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/SmartReplace/readme.txt 2 Feb 2007 21:05:04 -0000 1.1 @@ -0,0 +1,14 @@ +One irritating thing with text processing is the total absence of some typographic essentials on the keyboard -- "real" (typographic) quotes and the dash, typically miss-typed as inch or second sign (") and the hyphon(-). + +This plugin lends the good old Word behaviour to Xinha, as ",', and - get converted to their respective typographic correct relatives while typing. + + Configuration (to change the quote style from default English): + * through language file (see lang/de.js) + * through a config variable (an array that holds four values: opening single quote, closing single quote, opening double quote, closing double quote) + + Additional config option: + * disable automatic replacement by default + + Additional features: + * can be switched on/off + * convert all quotes/dashes in a document that still has the boring "/- stuff \ No newline at end of file Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/SmartReplace/smart-replace.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/SmartReplace/smart-replace.js,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/SmartReplace/smart-replace.js 2 Feb 2007 21:05:04 -0000 1.1 @@ -0,0 +1,255 @@ +/*------------------------------------------*\ + SmartReplace for Xinha + _______________________ + +\*------------------------------------------*/ + +function SmartReplace(editor) { + this.editor = editor; + + var cfg = editor.config; + var self = this; + + cfg.registerButton({ + id : "smartreplace", + tooltip : this._lc("SmartReplace"), + image : _editor_url+"plugins/SmartReplace/img/smartquotes.gif", + textMode : false, + action : function(editor) { + self.dialog(editor); + } + }); + cfg.addToolbarElement("smartreplace", "htmlmode", 1); +} + +SmartReplace._pluginInfo = { + name : "SmartReplace", + version : "1.0", + developer : "Raimund Meyer", + developer_url : "http://rheinauf.de", + c_owner : "Raimund Meyer", + sponsor : "", + sponsor_url : "", + license : "htmlArea" +}; + +SmartReplace.prototype._lc = function(string) { + return Xinha._lc(string, 'SmartReplace'); +}; + +Xinha.Config.prototype.SmartReplace = +{ + 'defaultActive' : true, + 'quotes' : null//[String.fromCharCode(187),String.fromCharCode(171),String.fromCharCode(8250),String.fromCharCode(8249)] +} +SmartReplace.prototype.toggleActivity = function(newState) +{ + if (typeof newState != 'undefined') + { + this.active = newState; + } + else + { + this.active = this.active ? false : true; + } + this.editor._toolbarObjects.smartreplace.state("active", this.active); +} + +SmartReplace.prototype.onUpdateToolbar = function() { + this.editor._toolbarObjects.smartreplace.state("active", this.active); +} + +SmartReplace.prototype.onGenerate = function() { + this.active = this.editor.config.SmartReplace.defaultActive; + this.editor._toolbarObjects.smartreplace.state("active", this.active); + + var self = this; + Xinha._addEvents( + self.editor._doc, + [ "keypress"], + function (event) + { + return self.keyEvent(Xinha.is_ie ? self.editor._iframe.contentWindow.event : event); + }); + + var quotes = this.editor.config.SmartReplace.quotes; + + if (quotes && typeof quotes == 'object') + { + this.openingQuotes = quotes[0]; + this.closingQuotes = quotes[1]; + this.openingQuote = quotes[2]; + this.closingQuote = quotes[3]; + } + else + { + this.openingQuotes = this._lc("OpeningDoubleQuotes"); + this.closingQuotes = this._lc("ClosingDoubleQuotes"); + this.openingQuote = this._lc("OpeningSingleQuote"); + this.closingQuote = this._lc("ClosingSingleQuote"); + } + + if (this.openingQuotes == 'OpeningDoubleQuotes') //If nothing else is defined, English style as default + { + this.openingQuotes = String.fromCharCode(8220); + this.closingQuotes = String.fromCharCode(8221); + this.openingQuote = String.fromCharCode(8216); + this.closingQuote = String.fromCharCode(8217); + } +}; + +SmartReplace.prototype.keyEvent = function(ev) +{ + if ( !this.active) return true; + var editor = this.editor; + var charCode = Xinha.is_ie ? ev.keyCode : ev.charCode; + + var key = String.fromCharCode(charCode); + + if (charCode == 32) //space bar + { + return this.smartDash() + } + if ( key == '"' || key == "'") + { + Xinha._stopEvent(ev); + return this.smartQuotes(key); + } + return true; +} + +SmartReplace.prototype.smartQuotes = function(kind) +{ + if (kind == "'") + { + var opening = this.openingQuote; + var closing = this.closingQuote; + } + else + { + var opening = this.openingQuotes; + var closing = this.closingQuotes; + } + + var editor = this.editor; + + var sel = editor.getSelection(); + + if (Xinha.is_ie) + { + var r = editor.createRange(sel); + if (r.text !== '') + { + r.text = ''; + } + r.moveStart('character', -1); + + if(r.text.match(/\S/)) + { + r.moveStart('character', +1); + r.text = closing; + } + else + { + r.moveStart('character', +1); + r.text = opening; + } + } + else + { + if (!sel.isCollapsed) + { + editor.insertNodeAtSelection(document.createTextNode('')); + } + if (sel.anchorOffset > 0) sel.extend(sel.anchorNode,sel.anchorOffset-1); + + if(sel.toString().match(/\S/)) + { + sel.collapse(sel.anchorNode,sel.anchorOffset); + editor.insertNodeAtSelection(document.createTextNode(closing)); + } + else + { + sel.collapse(sel.anchorNode,sel.anchorOffset); + editor.insertNodeAtSelection(document.createTextNode(opening)); + } + } +} + +SmartReplace.prototype.smartDash = function() +{ + var editor = this.editor; + var sel = this.editor.getSelection(); + if (Xinha.is_ie) + { + var r = this.editor.createRange(sel); + r.moveStart('character', -2); + + if(r.text.match(/\s-/)) + { + r.text = ' '+ String.fromCharCode(8211); + } + } + else + { + sel.extend(sel.anchorNode,sel.anchorOffset-2); + if(sel.toString().match(/^-/)) + { + this.editor.insertNodeAtSelection(document.createTextNode(' '+String.fromCharCode(8211))); + } + sel.collapse(sel.anchorNode,sel.anchorOffset); + } +} + +SmartReplace.prototype.replaceAll = function() +{ + var doubleQuotes = [ + '"', + String.fromCharCode(8220), + String.fromCharCode(8221), + String.fromCharCode(8222), + String.fromCharCode(187), + String.fromCharCode(171) + + ]; + var singleQuotes = [ + "'", + String.fromCharCode(8216), + String.fromCharCode(8217), + String.fromCharCode(8218), + String.fromCharCode(8250), + String.fromCharCode(8249) + ]; + + var html = this.editor.getHTML(); + var reOpeningDouble = new RegExp ('(\\s|^|>)('+doubleQuotes.join('|')+')(\\S)','g'); + html = html.replace(reOpeningDouble,'$1'+this.openingQuotes+'$3'); + + var reOpeningSingle = new RegExp ('(\\s|^|>)('+singleQuotes.join('|')+')(\\S)','g'); + html = html.replace(reOpeningSingle,'$1'+this.openingQuote+'$3'); + + var reClosingDouble = new RegExp ('(\\S)('+doubleQuotes.join('|')+')','g'); + html = html.replace(reClosingDouble,'$1'+this.closingQuotes); + + var reClosingSingle = new RegExp ('(\\S)('+singleQuotes.join('|')+')','g'); + html = html.replace(reClosingSingle,'$1'+this.closingQuote); + + var reDash = new RegExp ('( | )(-)( | )','g'); + html = html.replace(reDash,' '+String.fromCharCode(8211)+' '); + + this.editor.setHTML(html); +} +SmartReplace.prototype.dialog = function() +{ + var self = this; + var action = function (param) + { + self.toggleActivity(param.enable); + if (param.convert) + { + self.replaceAll(); + } + } + var init = this; + Dialog(_editor_url+'plugins/SmartReplace/popups/dialog.html', action, init); +} \ No newline at end of file Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/SmartReplace/img/smartquotes.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/SmartReplace/img/smartquotes.gif,v diff -u Binary files differ Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/SmartReplace/lang/de.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/SmartReplace/lang/de.js,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/SmartReplace/lang/de.js 2 Feb 2007 21:05:05 -0000 1.1 @@ -0,0 +1,19 @@ +// I18N constants +// LANG: "de", ENCODING: UTF-8 +{ + "SmartReplace Settings" : "SmartReplace Einstellungen", + "Enable automatic replacements" : "Automatische Ersetzung aktivieren", + "Convert all quotes and dashes in the current document": "Alle Anführungszeichen und Gedankenstriche umwandeln", + + "OpeningDoubleQuotes": "„", + "ClosingDoubleQuotes": "“", + "OpeningSingleQuote": "‚", + "ClosingSingleQuote": "‘" + + /* + "OpeningDoubleQuotes": "»", + "ClosingDoubleQuotes": "«", + "OpeningSingleQuote": "›", + "ClosingSingleQuote": "‹" +*/ +}; \ No newline at end of file Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/SmartReplace/popups/dialog.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/SmartReplace/popups/dialog.html,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/SmartReplace/popups/dialog.html 2 Feb 2007 21:05:05 -0000 1.1 @@ -0,0 +1,66 @@ + + + + + SmartReplace Settings + + + + + + + + +
SmartReplace Settings
+
+ + + + + + + + + +
Enable automatic replacements
Convert all quotes and dashes in the current document
+ +
+ + +
+
+ + \ No newline at end of file Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/SpellChecker/aspell_setup.php =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/SpellChecker/aspell_setup.php,v diff -u -r1.2 -r1.3 --- openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/SpellChecker/aspell_setup.php 4 Jun 2006 00:45:54 -0000 1.2 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/SpellChecker/aspell_setup.php 2 Feb 2007 21:05:05 -0000 1.3 @@ -58,7 +58,7 @@ // Personal dictionaries $p_dicts_path = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'personal_dicts'; - if(file_exists($_REQUEST['p_dicts_path']) && is_writable($_REQUEST['p_dicts_path'])) + if(isset($_REQUEST['p_dicts_path']) && file_exists($_REQUEST['p_dicts_path']) && is_writable($_REQUEST['p_dicts_path'])) { if(!isset($_REQUEST['p_dicts_name'])) { Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/SpellChecker/spell-check-logic.php =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/SpellChecker/spell-check-logic.php,v diff -u -r1.2 -r1.3 --- openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/SpellChecker/spell-check-logic.php 11 Nov 2005 20:32:48 -0000 1.2 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/SpellChecker/spell-check-logic.php 2 Feb 2007 21:05:05 -0000 1.3 @@ -2,11 +2,16 @@ $text = stripslashes($_POST['content']); // Convert UTF-8 multi-bytes into decimal character entities. This is because - // aspell isn't fully utf8-aware - $text = preg_replace('/([\xC0-\xDF][\x80-\xBF])/e', "'&#' . utf8_ord('\$1') . ';'", $text); - $text = preg_replace('/([\xE0-\xEF][\x80-\xBF][\x80-\xBF])/e', "'&#' . utf8_ord('\$1') . ';'", $text); - $text = preg_replace('/([\xF0-\xF7][\x80-\xBF][\x80-\xBF][\x80-\xBF])/e', "'&#' . utf8_ord('\$1') . ';'", $text); - + // aspell isn't fully utf8-aware - ticket:120 raises the possibility + // that this is not required (any more) and so you can turn it off + // with editor.config.SpellChecker.utf8_to_entities = false + if(!isset($_REQUEST['utf8_to_entitis']) || $_REQUEST['utf8_to_entities']) + { + $text = preg_replace('/([\xC0-\xDF][\x80-\xBF])/e', "'&#' . utf8_ord('\$1') . ';'", $text); + $text = preg_replace('/([\xE0-\xEF][\x80-\xBF][\x80-\xBF])/e', "'&#' . utf8_ord('\$1') . ';'", $text); + $text = preg_replace('/([\xF0-\xF7][\x80-\xBF][\x80-\xBF][\x80-\xBF])/e', "'&#' . utf8_ord('\$1') . ';'", $text); + } + function utf8_ord($chr) { switch(strlen($chr)) Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/SpellChecker/spell-check-ui.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/SpellChecker/spell-check-ui.html,v diff -u -r1.3 -r1.4 --- openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/SpellChecker/spell-check-ui.html 4 Jun 2006 00:45:54 -0000 1.3 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/SpellChecker/spell-check-ui.html 2 Feb 2007 21:05:05 -0000 1.4 @@ -62,6 +62,7 @@ > Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/SpellChecker/spell-check-ui.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/SpellChecker/spell-check-ui.js,v diff -u -r1.3 -r1.4 --- openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/SpellChecker/spell-check-ui.js 4 Jun 2006 00:45:54 -0000 1.3 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/SpellChecker/spell-check-ui.js 2 Feb 2007 21:05:05 -0000 1.4 @@ -11,7 +11,9 @@ // internationalization file was already loaded in parent ;-) var SpellChecker = window.opener.SpellChecker; -var HTMLArea = window.opener.HTMLArea; +var Xinha = window.opener.Xinha; +var HTMLArea = Xinha; + var _editor_url = window.opener._editor_url; var is_ie = HTMLArea.is_ie; @@ -37,15 +39,16 @@ for (var i = words.length; --i >= 0;) { var el = words[i]; if (!(leaveFixed && /HA-spellcheck-fixed/.test(el.className))) { - el.parentNode.insertBefore(el.firstChild, el); + if(el.firstChild) + el.parentNode.insertBefore(el.firstChild, el); el.parentNode.removeChild(el); } else el.className = "HA-spellcheck-fixed"; } // we should use innerHTML here, but IE6's implementation fucks up the // HTML to such extent that our poor Perl parser doesn't understand it // anymore. - return window.opener.HTMLArea.getHTML(frame.contentWindow.document.body, false, editor); + return Xinha.getHTML(frame.contentWindow.document.body, true, editor); } function recheckClicked() { @@ -215,7 +218,14 @@ { field.form.action = _editor_url + '/plugins/SpellChecker/spell-check-logic.php'; } - + if(editor.config.SpellChecker.utf8_to_entities) + { + document.getElementById('utf8_to_entities').value = 1; + } + else + { + document.getElementById('utf8_to_entities').value = 0; + } field.form.submit(); document.getElementById("f_init").value = "0"; Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/SpellChecker/spell-checker.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/SpellChecker/spell-checker.js,v diff -u -r1.3 -r1.4 --- openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/SpellChecker/spell-checker.js 4 Jun 2006 00:45:54 -0000 1.3 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/SpellChecker/spell-checker.js 2 Feb 2007 21:05:05 -0000 1.4 @@ -8,7 +8,7 @@ // // $Id$ -HTMLArea.Config.prototype.SpellChecker = { 'backend': 'php', 'personalFilesDir' : '', 'defaultDictionary' : 'en_GB' }; +HTMLArea.Config.prototype.SpellChecker = { 'backend': 'php', 'personalFilesDir' : '', 'defaultDictionary' : 'en_GB', 'utf8_to_entities' : true }; function SpellChecker(editor) { this.editor = editor; Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/SpellChecker/lang/nb.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/SpellChecker/lang/nb.js,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/SpellChecker/lang/nb.js 2 Feb 2007 21:05:05 -0000 1.1 @@ -0,0 +1,26 @@ +// I18N constants +// LANG: "nb", ENCODING: UTF-8 +// translated: Kim Steinhaug, http://www.steinhaug.com/, kim@steinhaug.com +{ + "Please confirm that you want to open this link": "Ønsker du å åpne denne lenken", + "Cancel": "Avbryt", + "Dictionary": "Ordliste", + "Finished list of mispelled words": "Ferdig med liste over feilstavede ord", + "I will open it in a new page.": "Åpnes i ny side", + "Ignore all": "Ignorer alle", + "Ignore": "Ignorer", + "No mispelled words found with the selected dictionary.": "Ingen feilstavede ord funnet med den valgte ordlisten", + "Spell check complete, didn't find any mispelled words. Closing now...": "Stavekontroll fullført, ingen feilstavede ord ble funnet, stavekontroll avsluttes.", + "OK": "OK", + "Original word": "Opprinnelig ord", + "Please wait. Calling spell checker.": "Vennligst vent, kaller opp stavekontrollprogrammet", + "Please wait: changing dictionary to": "Vennligst vent, endrer ordliste til", + "This will drop changes and quit spell checker. Please confirm.": "Dette vil droppe endringene og avbryte stavekontrollen, vennligst bekreft.", + "Re-check": "Kjør stavekontroll på nytt", + "Replace all": "Erstatt alle", + "Replace with": "Erstatt med", + "Replace": "Erstatt", + "Spell-check": "Stavekontroll", + "Suggestions": "Forslag", + "One moment...": "Et øyeblikk..." +}; \ No newline at end of file Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/Stylist/stylist.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/Stylist/Attic/stylist.js,v diff -u -r1.2 -r1.3 --- openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/Stylist/stylist.js 11 Nov 2005 20:32:48 -0000 1.2 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/Stylist/stylist.js 2 Feb 2007 21:05:06 -0000 1.3 @@ -407,7 +407,7 @@ while(prnt) { - if(prnt.nodeType == 1) + if(prnt.nodeType == 1 && prnt.className) { if(tag == null || prnt.tagName.toLowerCase() == tag) { @@ -517,7 +517,7 @@ sponsor_url : "http://www.gogo.co.nz/" }; -Stylist.prototype.onGenerate = function() +Stylist.prototype.onGenerateOnce = function() { var editor = this.editor; if(typeof editor.config.css_style == 'undefined' || HTMLArea.objectProperties(editor.config.css_style).length == 0) Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/Stylist/lang/nb.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/Stylist/lang/nb.js,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/Stylist/lang/nb.js 2 Feb 2007 21:05:06 -0000 1.1 @@ -0,0 +1,6 @@ +// I18N constants +// LANG: "nb", ENCODING: UTF-8 +// translated: Kim Steinhaug, http://www.steinhaug.com/, kim@steinhaug.com +{ + "Styles": "Stiler" +}; \ No newline at end of file Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/SuperClean/super-clean.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/SuperClean/super-clean.js,v diff -u -r1.1 -r1.2 --- openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/SuperClean/super-clean.js 2 Nov 2005 08:56:29 -0000 1.1 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/SuperClean/super-clean.js 2 Feb 2007 21:05:06 -0000 1.2 @@ -23,7 +23,7 @@ }; SuperClean.prototype._lc = function(string) { - return HTMLArea._lc(string, 'SuperClean'); + return Xinha._lc(string, 'SuperClean'); }; /** superClean combines HTMLTidy, Word Cleaning and font stripping into a single function @@ -47,7 +47,7 @@ if(filter=='tidy' || filter=='word_clean') continue; if(opts[filter]) { - D = SuperClean.filterFunctions[filter](D); + D = SuperClean.filterFunctions[filter](D, editor); } } @@ -58,7 +58,7 @@ if(opts.tidy) { - HTMLArea._postback(editor.config.SuperClean.tidy_handler, {'content' : editor.getInnerHTML()}, + Xinha._postback(editor.config.SuperClean.tidy_handler, {'content' : editor.getInnerHTML()}, function(javascriptResponse) { eval(javascriptResponse) }); } return true; @@ -91,7 +91,7 @@ } }; -HTMLArea.Config.prototype.SuperClean = +Xinha.Config.prototype.SuperClean = { // set to the URL of a handler for html tidy, this handler // (see tidy.php for an example) must that a single post variable @@ -101,12 +101,18 @@ 'tidy_handler': _editor_url + 'plugins/SuperClean/tidy.php', //avaliable filters (these are built-in filters) - 'filters': { 'tidy': HTMLArea._lc('General tidy up and correction of some problems.', 'SuperClean'), - 'word_clean': HTMLArea._lc('Clean bad HTML from Microsoft Word', 'SuperClean'), - 'remove_faces': HTMLArea._lc('Remove custom typefaces (font "styles").', 'SuperClean'), - 'remove_sizes': HTMLArea._lc('Remove custom font sizes.', 'SuperClean'), - 'remove_colors': HTMLArea._lc('Remove custom text colors.', 'SuperClean'), - 'remove_lang': HTMLArea._lc('Remove lang attributes.', 'SuperClean') + // You can either use + // 'filter_name' : "Label/Description String" + // or 'filter_name' : {label: "Label", checked: true/false, filterFunction: function(html) { ... return html;} } + // filterFunction in the second format above is optional. + + 'filters': { 'tidy': Xinha._lc('General tidy up and correction of some problems.', 'SuperClean'), + 'word_clean': Xinha._lc('Clean bad HTML from Microsoft Word', 'SuperClean'), + 'remove_faces': Xinha._lc('Remove custom typefaces (font "styles").', 'SuperClean'), + 'remove_sizes': Xinha._lc('Remove custom font sizes.', 'SuperClean'), + 'remove_colors': Xinha._lc('Remove custom text colors.', 'SuperClean'), + 'remove_lang': Xinha._lc('Remove lang attributes.', 'SuperClean'), + 'remove_fancy_quotes': {label:Xinha._lc('Replace directional quote marks with non-directional quote marks.', 'SuperClean'), checked:false} //additional custom filters (defined in plugins/SuperClean/filters/word.js) //'paragraph': 'remove paragraphs'}, //'word': 'exteded Word-Filter' }, @@ -148,9 +154,23 @@ editor._wordClean(); return editor.getInnerHTML(); }; + +SuperClean.filterFunctions.remove_fancy_quotes = function(D) +{ + D = D.replace(new RegExp(String.fromCharCode(8216),"g"),"'"); + D = D.replace(new RegExp(String.fromCharCode(8217),"g"),"'"); + D = D.replace(new RegExp(String.fromCharCode(8218),"g"),"'"); + D = D.replace(new RegExp(String.fromCharCode(8219),"g"),"'"); + D = D.replace(new RegExp(String.fromCharCode(8220),"g"),"\""); + D = D.replace(new RegExp(String.fromCharCode(8221),"g"),"\""); + D = D.replace(new RegExp(String.fromCharCode(8222),"g"),"\""); + D = D.replace(new RegExp(String.fromCharCode(8223),"g"),"\""); + return D; +}; + SuperClean.filterFunctions.tidy = function(html, editor) { - HTMLArea._postback(editor.config.SuperClean.tidy_handler, {'content' : html}, + Xinha._postback(editor.config.SuperClean.tidy_handler, {'content' : html}, function(javascriptResponse) { eval(javascriptResponse) }); }; @@ -179,11 +199,19 @@ { if(!SuperClean.filterFunctions[filter]) { - HTMLArea._getback(_editor_url + 'plugins/SuperClean/filters/'+filter+'.js', + var filtDetail = this.editor.config.SuperClean.filters[filter]; + if(typeof filtDetail.filterFunction != 'undefined') + { + SuperClean.filterFunctions[filter] = filterFunction; + } + else + { + Xinha._getback(_editor_url + 'plugins/SuperClean/filters/'+filter+'.js', function(func) { eval('SuperClean.filterFunctions.'+filter+'='+func+';'); sc.onGenerate(); }); + } return; } } @@ -215,24 +243,33 @@ if(this.html == false) { - HTMLArea._getback(_editor_url + 'plugins/SuperClean/dialog.html', function(txt) { lDialog.html = txt; lDialog._prepareDialog(); }); + Xinha._getback(_editor_url + 'plugins/SuperClean/dialog.html', function(txt) { lDialog.html = txt; lDialog._prepareDialog(); }); return; } var htmlFilters = ""; for(var filter in this.SuperClean.editor.config.SuperClean.filters) { htmlFilters += "
\n"; - htmlFilters += " \n"; - htmlFilters += " \n"; + var filtDetail = this.SuperClean.editor.config.SuperClean.filters[filter]; + if(typeof filtDetail.label == 'undefined') + { + htmlFilters += " \n"; + htmlFilters += " \n"; + } + else + { + htmlFilters += " \n"; + htmlFilters += " \n"; + } htmlFilters += "
\n"; } this.html = this.html.replace('', htmlFilters); var html = this.html; // Now we have everything we need, so we can build the dialog. - var dialog = this.dialog = new HTMLArea.Dialog(SuperClean.editor, this.html, 'SuperClean'); + var dialog = this.dialog = new Xinha.Dialog(SuperClean.editor, this.html, 'SuperClean'); this.ready = true; }; Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/SuperClean/tidy.php =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/SuperClean/tidy.php,v diff -u -r1.1 -r1.2 --- openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/SuperClean/tidy.php 2 Nov 2005 08:56:29 -0000 1.1 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/SuperClean/tidy.php 2 Feb 2007 21:05:06 -0000 1.2 @@ -1,6 +1,6 @@ " + HTMLArea._lc("Table Properties", "TableOperations") + "\ +
" + HTMLArea._lc("Table Properties", "TableOperations") + "\
\
\ \ @@ -326,8 +333,7 @@ // dialog contents dialog.content.style.width = "400px"; dialog.content.innerHTML = " \ -
" + HTMLArea._lc(cell ? "Cell Properties" : "Row Properties", "TableOperations") + "
\ +
" + HTMLArea._lc(cell ? "Cell Properties" : "Row Properties", "TableOperations") + "
\
\ \
\ @@ -597,6 +603,10 @@ var cells = null; if (!HTMLArea.is_ie) { try { + if (sel.rangeCount < 2) { + alert("Please select the cells you want to merge.") + break; + } while (range = sel.getRangeAt(i++)) { var td = range.startContainer.childNodes[range.startOffset]; if (td.parentNode != row) { Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/TableOperations/img/table-prop.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/TableOperations/img/table-prop.gif,v diff -u -r1.1 -r1.2 Binary files differ Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/TableOperations/lang/nb.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/TableOperations/lang/nb.js,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/TableOperations/lang/nb.js 2 Feb 2007 21:05:07 -0000 1.1 @@ -0,0 +1,80 @@ +// I18N constants +// LANG: "nb", ENCODING: UTF-8 +// Author: Mihai Bazon, +// translated into Norwegian: ses@online.no 11.11.03 +{ + "Align": "Juster", + "All four sides": "Alle fire sider", + "Background": "Bakgrund", + "Baseline": "Grunnlinje", + "Border": "Kantlinje", + "Borders": "Kantlinjer", + "Bottom": "Bunn", + "Style [CSS]": "Stil [CSS]", + "Caption": "Overskrift", + "Cell Properties": "Celleegenskaper", + "Center": "Sentrer", + "Char": "Tegn", + "Collapsed borders": "Fjern kantlinjer", + "Color": "Farge", + "Description": "Beskrivelse", + "FG Color": "FG farge", + "Float": "Flytende", + "Frames": "rammer", + "Height": "Høyde", + "How many columns would you like to merge?": "Hvor mange kolonner vil du slå sammen?", + "How many rows would you like to merge?": "Hvor mange rader vil du slå sammen?", + "Image URL": "Bildets URL", + "Justify": "Juster", + "Layout": "Layout", + "Left": "Venstre", + "Margin": "Marg", + "Middle": "Midten", + "No rules": "Ingen linjal", + "No sides": "Ingen sider", + "None": "Ingen", + "Padding": "Luft", + "Please click into some cell": "Klikk i en eller annen celle", + "Right": "Høyre", + "Row Properties": "Egenskaper for rad", + "Rules will appear between all rows and columns": "Linjer vil synes mellom alle rader og kolonner", + "Rules will appear between columns only": "Linjer vil synes kun mellom kolonner", + "Rules will appear between rows only": "Linjer vil synes kun mellom rader", + "Rules": "Linjer", + "Spacing and padding": "Luft", + "Spacing": "Luft", + "Summary": "Sammendrag", + "Delete cell": "Slett celle", + "Insert cell after": "Sett inn celle etter", + "Insert cell before": "Sett inn celle foran", + "Merge cells": "Slå sammen celler", + "Cell properties": "Egenskaper for celle", + "Split cell": "Del celle", + "Delete column": "Slett kolonne", + "Insert column after": "Skyt inn kolonne etter", + "Insert column before": "Skyt inn kolonne før", + "Split column": "Del kolonne", + "Delete row": "Slett rad", + "Insert row before": "Skyt inn rad foran", + "Insert row after": "Skyt inn rad etter", + "Row properties": "Egenskaper for rad", + "Split row": "Del rad", + "Table properties": "Tabellegenskaper", + "Table Properties": "Tabellegenskaper", + "Text align": "Juster tekst", + "The bottom side only": "Bunnen kun", + "The left-hand side only": "Venstresiden kun", + "The right and left sides only": "Høyre- og venstresiden kun", + "The right-hand side only": "Høyresiden kun", + "The top and bottom sides only": "The top and bottom sides only", + "The top side only": "Overkanten kun", + "Top": "Overkant", + "Unset color": "Ikke-bestemt farge", + "Vertical align": "Vertikal justering", + "Width": "Bredde", + "HTMLArea cowardly refuses to delete the last cell in row.": "HTMLArea nekter å slette siste cellen i tabellen.", + "HTMLArea cowardly refuses to delete the last column in table.": "HTMLArea nekter å slette siste kolonnen i tabellen.", + "HTMLArea cowardly refuses to delete the last row in table.": "HTMLArea nekter å slette siste raden i tabellen.", + "percent": "prosent", + "pixels": "billedpunkter" +}; \ No newline at end of file Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/TableOperations/lang/sv.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/TableOperations/lang/sv.js,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/TableOperations/lang/sv.js 2 Feb 2007 21:05:07 -0000 1.1 @@ -0,0 +1,79 @@ +// I18N constants +// LANG: "sv" (Swedish), ENCODING: UTF-8 +// translated into Swedish: Erik Dalén, +{ + "Align": "Justera", + "All four sides": "Alla fyra sidor", + "Background": "Bakgrund", + "Baseline": "Baslinje", + "Border": "Kantlinje", + "Borders": "Kantlinjer", + "Bottom": "Botten", + "Style [CSS]": "Stil [CSS]", + "Caption": "Överskrift", + "Cell Properties": "Cellegenskaper", + "Center": "Centrera", + "Char": "Tecken", + "Collapsed borders": "Osynliga kantlinjer", + "Color": "Färg", + "Description": "Beskrivning", + "FG Color": "Förgrundsfärg", + "Float": "Flytande", + "Frames": "ramar", + "Height": "Höjd", + "How many columns would you like to merge?": "Hur många kolumner vill du slå samman?", + "How many rows would you like to merge?": "Hur många rader vill du slå samman?", + "Image URL": "Bildens URL", + "Justify": "Justera", + "Layout": "Layout", + "Left": "Venster", + "Margin": "Marginal", + "Middle": "Mitten", + "No rules": "Ingen linjal", + "No sides": "Inga sidor", + "None": "Ingen", + "Padding": "Luft", + "Please click into some cell": "Klicka i valfri cell", + "Right": "Höger", + "Row Properties": "Egenskaper for rad", + "Rules will appear between all rows and columns": "Linjaler kommer att synas mellan alla rader och kolumner", + "Rules will appear between columns only": "Linjaler kommer enbart synas mellan kolumner", + "Rules will appear between rows only": "Linjaler kommer enbart synas mellan rader", + "Rules": "Linjaler", + "Spacing and padding": "Mellanrum och luft", + "Spacing": "Mellanrum", + "Summary": "Sammandrag", + "Delete cell": "Radera cell", + "Insert cell after": "Infoga cell efter", + "Insert cell before": "Infoga cell före", + "Merge cells": "Slå samman celler", + "Cell properties": "Egenskaper for cell", + "Split cell": "Dela cell", + "Delete column": "Radera kolumn", + "Insert column after": "Infoga kolumn efter", + "Insert column before": "Infoga kolumn före", + "Split column": "Dela kolumn", + "Delete row": "Radera rad", + "Insert row before": "Infoga rad före", + "Insert row after": "Infoga rad efter", + "Row properties": "Egenskaper för rad", + "Split row": "Dela rad", + "Table properties": "Tabellegenskaper", + "Table Properties": "Tabellegenskaper", + "Text align": "Justera text", + "The bottom side only": "Nederkanten enbart", + "The left-hand side only": "Vänstersidan enbart", + "The right and left sides only": "Höger- och vänstersidan enbart", + "The right-hand side only": "Högersidan enbart", + "The top and bottom sides only": "Över- och nederkanten enbart", + "The top side only": "Överkanten enbart", + "Top": "Överkant", + "Unset color": "Obestämd färg", + "Vertical align": "Vertikal justering", + "Width": "Bredd", + "HTMLArea cowardly refuses to delete the last cell in row.": "Xinha nekar att radera sista cellen i tabellen.", + "HTMLArea cowardly refuses to delete the last column in table.": "Xinha nekar att radera sista kolumnen i tabellen.", + "HTMLArea cowardly refuses to delete the last row in table.": "Xinha nekar att radera sista raden i tabellen.", + "percent": "procent", + "pixels": "bildpunkter" +}; Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/Template/lang/nb.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/Template/lang/nb.js,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/Template/lang/nb.js 2 Feb 2007 21:05:07 -0000 1.1 @@ -0,0 +1,7 @@ +// I18N constants +// LANG: "nb", ENCODING: UTF-8 +// translated: Kim Steinhaug, http://www.steinhaug.com/, kim@steinhaug.com +{ + "Insert template": "Sett inn template", + "Cancel": "Avbryt" +}; \ No newline at end of file Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/UnFormat/lang/nb.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/UnFormat/lang/nb.js,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/UnFormat/lang/nb.js 2 Feb 2007 21:05:07 -0000 1.1 @@ -0,0 +1,13 @@ +// I18N constants +// LANG: "nb", ENCODING: UTF-8 +// translated: Kim Steinhaug, http://www.steinhaug.com/, kim@steinhaug.com +{ + "Page Cleaner": "Dokumentvasker", + "Cleaning Area": "Vaskeområde", + "Selection": "Markert område", + "All": "Hele dokumentet", + "Cleaning options": "Vaskemetoder", + "Formatting:": "Formattering:", + "All HTML:": "All HTML-kode:", + "Select which types of formatting you would like to remove.": "Velg hva slags formattering du ønsker å fjerne." +}; \ No newline at end of file Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/popups/about.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/popups/about.html,v diff -u -r1.3 -r1.4 --- openacs-4/packages/acs-templating/www/resources/xinha-nightly/popups/about.html 4 Jun 2006 00:45:55 -0000 1.3 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/popups/about.html 2 Feb 2007 21:05:08 -0000 1.4 @@ -44,7 +44,7 @@ var editor = null; function initDocument() { editor = window.dialogArguments; - HTMLArea = window.opener.HTMLArea; + Xinha = window.opener.Xinha; var plugins = document.getElementById("plugins"); var j = 0; @@ -92,7 +92,7 @@ for (var i = bar.firstChild; i; i = i.nextSibling) { TABS.push(i); i.__msh_tab = j; - i.onmousedown = function(ev) { selectTab(this.__msh_tab); HTMLArea._stopEvent(ev || window.event); }; + i.onmousedown = function(ev) { selectTab(this.__msh_tab); Xinha._stopEvent(ev || window.event); }; var area = document.getElementById("tab-area-" + j); if (/tab-current/.test(i.className)) { CURRENT_TAB = j; @@ -181,7 +181,7 @@
-

Xinha

+

Xinha

@@ -255,9 +255,9 @@
@@ -74,59 +79,100 @@ function colorPicker(params) { + // if the savedColors is empty, try to read the savedColors from cookie + if ( colorPicker.savedColors.length === 0 ) + { + colorPicker.loadColors(); + } var picker = this; - this.callback = params.callback?params.callback:function(color){alert('You picked ' + color )}; + var enablepick = false; + var enablevalue = false; + var pickrow = 0; + var pickcol = 0; + this.callback = params.callback?params.callback:function(color){alert('You picked ' + color );}; + this.websafe = params.websafe?params.websafe:false; + this.savecolors = params.savecolors? params.savecolors: 20; - this.cellsize = params.cellsize?params.cellsize:'10px'; + this.cellsize = parseInt(params.cellsize?params.cellsize:'10px', 10); this.side = params.granularity?params.granularity:18; + var valuecol = this.side + 1; + var valuerow = this.side - 1; this.value = 1; this.saved_cells = null; this.table = document.createElement('table'); this.table.cellSpacing = this.table.cellPadding = 0; + this.table.onmouseup = function() + { + enablepick = false; + enablevalue = false; + }; this.tbody = document.createElement('tbody'); this.table.appendChild(this.tbody); this.table.style.border = '1px solid WindowFrame'; - this.table.style.backgroundColor = 'Window'; + this.table.style.backgroundColor = '#fff'; + this.table.style.zIndex = '1000'; // Add a title bar and close button var tr = document.createElement('tr'); + var td = document.createElement('td'); - var but = document.createElement('button'); - but.onclick = function() { picker.close(); } - but.appendChild(document.createTextNode('x')); - td.appendChild(but); - td.style.position = 'relative'; - td.style.verticalAlign = 'middle'; - but.style.cssFloat = 'right'; - but.style.styleFloat = 'right'; - - - td.colSpan = this.side + 3; - td.style.backgroundColor = 'ActiveCaption'; - td.style.color = 'CaptionText'; + td.colSpan = this.side; + td.style.backgroundColor = '#ccc'; + td.style.color = '#000'; td.style.fontFamily = 'small-caption,caption,sans-serif'; td.style.fontSize = 'x-small'; td.appendChild(document.createTextNode('Click a color...')); td.style.borderBottom = '1px solid WindowFrame'; + tr.appendChild(td); + td = null; + var td = document.createElement('td'); + td.colSpan = 2; + td.style.backgroundColor = '#ccc'; //'ActiveCaption'; + td.style.borderBottom = '1px solid WindowFrame'; tr.appendChild(td); + + var but = document.createElement('div'); + but.style.height = '12px'; + but.style.width = '12px'; + but.style.border = '2px outset'; + but.style.cursor = 'pointer'; + but.onclick = function() { picker.close(); }; + but.appendChild(document.createTextNode('\u00D7')); + but.align = 'center'; + but.style.verticalAlign = 'top'; + but.style.position = 'relative'; + but.style.cssFloat = 'right'; + but.style.styleFloat = 'right'; + but.style.backgroundColor = '#eee'; + td.appendChild(but); + this.tbody.appendChild(tr); but = tr = td = null; this.constrain_cb = document.createElement('input'); this.constrain_cb.type = 'checkbox'; - this.chosenColor = document.createElement('input'); + this.chosenColor = document.createElement('input'); this.chosenColor.type = 'text'; - this.chosenColor.size = '7'; + this.chosenColor.maxLength = 7; + this.chosenColor.style.width = '56px'; + this.chosenColor.onchange = function() + { + if(/#[0-9a-f]{6,6}/i.test(this.value)) + { + picker.backSample.style.backgroundColor = this.value; + picker.foreSample.style.color = this.value; + } + }; - this.backSample = document.createElement('div'); + this.backSample = document.createElement('div'); this.backSample.appendChild(document.createTextNode('\u00A0')); this.backSample.style.fontWeight = 'bold'; this.backSample.style.fontFamily = 'small-caption,caption,sans-serif'; this.backSample.fontSize = 'x-small'; - this.foreSample = document.createElement('div'); + this.foreSample = document.createElement('div'); this.foreSample.appendChild(document.createTextNode('Sample')); this.foreSample.style.fontWeight = 'bold'; this.foreSample.style.fontFamily = 'small-caption,caption,sans-serif'; @@ -141,7 +187,7 @@ function toHex(dec) { var h = dec.toString(16); - if(h.length < 2) h = '0' + h; + if(h.length < 2) { h = '0' + h; } return h; } @@ -210,10 +256,10 @@ function hsvToRGB(h,s,v) { var colors; - if(s == 0) + if(s === 0) { // GREY - colors = {red:v,green:v,blue:v} + colors = {red:v,green:v,blue:v}; } else { @@ -230,7 +276,6 @@ case 2: colors = {red:p, green:v, blue:t}; break; case 3: colors = {red:p, green:q, blue:v}; break; case 4: colors = {red:t, green:p, blue:v}; break; - case 5: default:colors = {red:v, green:p, blue:q}; break; } } @@ -251,11 +296,17 @@ * for the class. */ - this.open = function(anchorage,element) + this.open = function(anchorage,element,initcolor) { this.table.style.display = ''; this.pick_color(); + if(initcolor && /#[0-9a-f]{6,6}/i.test(initcolor)) + { + this.chosenColor.value = initcolor; + this.backSample.style.backgroundColor = initcolor; + this.foreSample.style.color = initcolor; + } // Find position of the element this.table.style.position = 'absolute'; @@ -268,12 +319,19 @@ left += e.offsetLeft; e = e.offsetParent; } - while(e) + while(e); var x, y; if(/top/.test(anchorage)) { - this.table.style.top = (top - this.table.offsetHeight) + 'px'; + if(top - this.table.offsetHeight > 0) + { + this.table.style.top = (top - this.table.offsetHeight) + 'px'; + } + else + { + this.table.style.top = 0; + } } else { @@ -286,29 +344,85 @@ } else { - this.table.style.left = (left - (this.table.offsetWidth - element.offsetWidth)) + 'px'; + if(left - (this.table.offsetWidth - element.offsetWidth) > 0) + { + this.table.style.left = (left - (this.table.offsetWidth - element.offsetWidth)) + 'px'; + } + else + { + this.table.style.left = 0; + } } + // IE ONLY - prevent windowed elements () to render above the colorpicker + /*@cc_on + if ( !this.iframe ) + { + this.iframe = document.createElement('iframe'); + this.iframe.frameBorder = 0; + this.iframe.src = "javascript:;"; + this.iframe.style.position = "absolute"; + this.iframe.style.width = this.table.offsetWidth; + this.iframe.style.height = this.table.offsetHeight; + document.body.insertBefore(this.iframe, this.table); + } + this.iframe.style.display = ''; + @*/ } else { - for(var row = 0; row <= this.side; row++) + for(var row = 0; row < this.side; row++) { - for(var col = 0; col <= this.side; col++) + for(var col = 0; col < this.side; col++) { if(constrain) { @@ -486,15 +721,75 @@ this.saved_cells[row][col].colorCode = tupleToColor(hsvToRGB(huestep*row, saturstep*col, this.value)); } this.saved_cells[row][col].style.backgroundColor = this.saved_cells[row][col].colorCode; + this.saved_cells[row][col].style.borderColor = this.saved_cells[row][col].colorCode; } } + var pickcell = this.saved_cells[pickrow][pickcol]; + this.chosenColor.value = pickcell.colorCode; + this.backSample.style.backgroundColor = pickcell.colorCode; + this.foreSample.style.color = pickcell.colorCode; + if((pickcell.hue >= 195 && pickcell.saturation > 0.5) || + (pickcell.hue === 0 && pickcell.saturation === 0 && pickcell.value < 0.5) || + (pickcell.hue !== 0 && picker.value < 0.75)) + { + pickcell.style.borderColor = '#fff'; + } + else + { + pickcell.style.borderColor = '#000'; + } } }; /** Close the color picker */ this.close = function() { this.table.style.display = 'none'; + // IE ONLY - prevent windowed elements (