Index: openacs-4/packages/xowiki/www/resources/wymeditor/GPL-license.txt =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/resources/wymeditor/GPL-license.txt,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xowiki/www/resources/wymeditor/GPL-license.txt 15 Jul 2007 16:07:45 -0000 1.1 @@ -0,0 +1,278 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. Index: openacs-4/packages/xowiki/www/resources/wymeditor/MIT-license.txt =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/resources/wymeditor/MIT-license.txt,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xowiki/www/resources/wymeditor/MIT-license.txt 15 Jul 2007 16:07:45 -0000 1.1 @@ -0,0 +1,20 @@ +Copyright (C) 2007 H.O.net - http://www.honet.be/ + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Index: openacs-4/packages/xowiki/www/resources/wymeditor/README =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/resources/wymeditor/README,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xowiki/www/resources/wymeditor/README 15 Jul 2007 16:07:45 -0000 1.1 @@ -0,0 +1,20 @@ +WYMeditor : what you see is What You Mean web-based editor +Copyright (C) 2007 H.O.net - http://www.honet.be/ +Dual licensed under the MIT (MIT-license.txt) +and GPL (GPL-license.txt) licenses. + +For further information visit: + http://www.wymeditor.org/ + +File Name: + README + +File Authors: + Jean-François Hovinne (jf.hovinne@wymeditor.org) + + +Important Note +============== + +For WYMeditor to work, you'll need at least jQuery 1.1.3 +Please see the documentation for more information: http://trac.wymeditor.org/ Index: openacs-4/packages/xowiki/www/resources/wymeditor/jquery.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/resources/wymeditor/Attic/jquery.js,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xowiki/www/resources/wymeditor/jquery.js 15 Jul 2007 16:07:45 -0000 1.1 @@ -0,0 +1,2295 @@ +// prevent execution of jQuery if included more than once +if(typeof window.jQuery == "undefined") { +/* + * jQuery 1.1.3a - New Wave Javascript + * + * Copyright (c) 2007 John Resig (jquery.com) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * $Date: 2007/07/15 16:07:45 $ + * $Rev: 1961 $ + */ + +// Global undefined variable +window.undefined = window.undefined; +var jQuery = function(a,c) { + // If the context is global, return a new object + if ( window == this ) + return new jQuery(a,c); + + return this.init(a,c); +}; + +// Map over the $ in case of overwrite +if ( typeof $ != "undefined" ) + jQuery._$ = $; + +// Map the jQuery namespace to the '$' one +var $ = jQuery; + +jQuery.fn = jQuery.prototype = { + init: function(a,c) { + // Make sure that a selection was provided + a = a || document; + + // HANDLE: $(function) + // Shortcut for document ready + if ( jQuery.isFunction(a) ) + return new jQuery(document)[ jQuery.fn.ready ? "ready" : "load" ]( a ); + + // Handle HTML strings + if ( typeof a == "string" ) { + // HANDLE: $(html) -> $(array) + var m = /^[^<]*(<(.|\s)+>)[^>]*$/.exec(a); + if ( m ) + a = jQuery.clean( [ m[1] ] ); + + // HANDLE: $(expr) + else + return new jQuery( c ).find( a ); + } + + return this.setArray( + // HANDLE: $(array) + a.constructor == Array && a || + + // HANDLE: $(arraylike) + // Watch for when an array-like object is passed as the selector + (a.jquery || a.length && a != window && !a.nodeType && a[0] != undefined && a[0].nodeType) && jQuery.makeArray( a ) || + + // HANDLE: $(*) + [ a ] ); + }, + jquery: "1.1.3a", + + size: function() { + return this.length; + }, + + length: 0, + + get: function( num ) { + return num == undefined ? + + // Return a 'clean' array + jQuery.makeArray( this ) : + + // Return just the object + this[num]; + }, + pushStack: function( a ) { + var ret = jQuery(a); + ret.prevObject = this; + return ret; + }, + setArray: function( a ) { + this.length = 0; + [].push.apply( this, a ); + return this; + }, + each: function( fn, args ) { + return jQuery.each( this, fn, args ); + }, + index: function( obj ) { + var pos = -1; + this.each(function(i){ + if ( this == obj ) pos = i; + }); + return pos; + }, + + attr: function( key, value, type ) { + var obj = key; + + // Look for the case where we're accessing a style value + if ( key.constructor == String ) + if ( value == undefined ) + return this.length && jQuery[ type || "attr" ]( this[0], key ) || undefined; + else { + obj = {}; + obj[ key ] = value; + } + + // Check to see if we're setting style values + return this.each(function(index){ + // Set all the styles + for ( var prop in obj ) + jQuery.attr( + type ? this.style : this, + prop, jQuery.prop(this, obj[prop], type, index, prop) + ); + }); + }, + + css: function( key, value ) { + return this.attr( key, value, "curCSS" ); + }, + + text: function(e) { + if ( typeof e == "string" ) + return this.empty().append( document.createTextNode( e ) ); + + var t = ""; + jQuery.each( e || this, function(){ + jQuery.each( this.childNodes, function(){ + if ( this.nodeType != 8 ) + t += this.nodeType != 1 ? + this.nodeValue : jQuery.fn.text([ this ]); + }); + }); + return t; + }, + + wrap: function() { + // The elements to wrap the target around + var a, args = arguments; + + // Wrap each of the matched elements individually + return this.each(function(){ + if ( !a ) + a = jQuery.clean(args, this.ownerDocument); + + // Clone the structure that we're using to wrap + var b = a[0].cloneNode(true); + + // Insert it before the element to be wrapped + this.parentNode.insertBefore( b, this ); + + // Find the deepest point in the wrap structure + while ( b.firstChild ) + b = b.firstChild; + + // Move the matched element to within the wrap structure + b.appendChild( this ); + }); + }, + append: function() { + return this.domManip(arguments, true, 1, function(a){ + this.appendChild( a ); + }); + }, + prepend: function() { + return this.domManip(arguments, true, -1, function(a){ + this.insertBefore( a, this.firstChild ); + }); + }, + before: function() { + return this.domManip(arguments, false, 1, function(a){ + this.parentNode.insertBefore( a, this ); + }); + }, + after: function() { + return this.domManip(arguments, false, -1, function(a){ + this.parentNode.insertBefore( a, this.nextSibling ); + }); + }, + end: function() { + return this.prevObject || jQuery([]); + }, + find: function(t) { + return this.pushStack( jQuery.unique( jQuery.map( this, function(a){ + return jQuery.find(t,a); + }) ), t ); + }, + clone: function(deep) { + // Need to remove events on the element and its descendants + var $this = this.add(this.find("*")); + $this.each(function() { + this._$events = {}; + for (var type in this.$events) + this._$events[type] = jQuery.extend({},this.$events[type]); + }).unbind(); + + // Do the clone + var r = this.pushStack( jQuery.map( this, function(a){ + return a.cloneNode( deep != undefined ? deep : true ); + }) ); + + // Add the events back to the original and its descendants + $this.each(function() { + var events = this._$events; + for (var type in events) + for (var handler in events[type]) + jQuery.event.add(this, type, events[type][handler], events[type][handler].data); + this._$events = null; + }); + + // Return the cloned set + return r; + }, + + filter: function(t) { + return this.pushStack( + jQuery.isFunction( t ) && + jQuery.grep(this, function(el, index){ + return t.apply(el, [index]) + }) || + + jQuery.multiFilter(t,this) ); + }, + + not: function(t) { + return this.pushStack( + t.constructor == String && + jQuery.multiFilter(t, this, true) || + + jQuery.grep(this, function(a) { + return ( t.constructor == Array || t.jquery ) + ? jQuery.inArray( a, t ) < 0 + : a != t; + }) + ); + }, + + add: function(t) { + return this.pushStack( jQuery.merge( + this.get(), + t.constructor == String ? + jQuery(t).get() : + t.length != undefined && (!t.nodeName || t.nodeName == "FORM") ? + t : [t] ) + ); + }, + is: function(expr) { + return expr ? jQuery.multiFilter(expr,this).length > 0 : false; + }, + + val: function( val ) { + return val == undefined ? + ( this.length ? this[0].value : null ) : + this.attr( "value", val ); + }, + + html: function( val ) { + return val == undefined ? + ( this.length ? this[0].innerHTML : null ) : + this.empty().append( val ); + }, + domManip: function(args, table, dir, fn){ + var clone = this.length > 1, a; + + return this.each(function(){ + if ( !a ) { + a = jQuery.clean(args, this.ownerDocument); + if ( dir < 0 ) + a.reverse(); + } + + var obj = this; + + if ( table && jQuery.nodeName(this, "table") && jQuery.nodeName(a[0], "tr") ) + obj = this.getElementsByTagName("tbody")[0] || this.appendChild(document.createElement("tbody")); + + jQuery.each( a, function(){ + fn.apply( obj, [ clone ? this.cloneNode(true) : this ] ); + }); + + }); + } +}; + +jQuery.extend = jQuery.fn.extend = function() { + // copy reference to target object + var target = arguments[0], a = 1; + + // extend jQuery itself if only one argument is passed + if ( arguments.length == 1 ) { + target = this; + a = 0; + } + var prop; + while ( (prop = arguments[a++]) != null ) + // Extend the base object + for ( var i in prop ) target[i] = prop[i]; + + // Return the modified object + return target; +}; + +jQuery.extend({ + noConflict: function() { + if ( jQuery._$ ) + $ = jQuery._$; + return jQuery; + }, + + // This may seem like some crazy code, but trust me when I say that this + // is the only cross-browser way to do this. --John + isFunction: function( fn ) { + return !!fn && typeof fn != "string" && !fn.nodeName && + fn.constructor != Array && /function/i.test( fn + "" ); + }, + + // check if an element is in a XML document + isXMLDoc: function(elem) { + return elem.tagName && elem.ownerDocument && !elem.ownerDocument.body; + }, + + nodeName: function( elem, name ) { + return elem.nodeName && elem.nodeName.toUpperCase() == name.toUpperCase(); + }, + // args is for internal usage only + each: function( obj, fn, args ) { + if ( obj.length == undefined ) + for ( var i in obj ) + fn.apply( obj[i], args || [i, obj[i]] ); + else + for ( var i = 0, ol = obj.length; i < ol; i++ ) + if ( fn.apply( obj[i], args || [i, obj[i]] ) === false ) break; + return obj; + }, + + prop: function(elem, value, type, index, prop){ + // Handle executable functions + if ( jQuery.isFunction( value ) ) + value = value.call( elem, [index] ); + + // exclude the following css properties to add px + var exclude = /z-?index|font-?weight|opacity|zoom|line-?height/i; + + // Handle passing in a number to a CSS property + return value && value.constructor == Number && type == "curCSS" && !exclude.test(prop) ? + value + "px" : + value; + }, + + className: { + // internal only, use addClass("class") + add: function( elem, c ){ + jQuery.each( c.split(/\s+/), function(i, cur){ + if ( !jQuery.className.has( elem.className, cur ) ) + elem.className += ( elem.className ? " " : "" ) + cur; + }); + }, + + // internal only, use removeClass("class") + remove: function( elem, c ){ + elem.className = c != undefined ? + jQuery.grep( elem.className.split(/\s+/), function(cur){ + return !jQuery.className.has( c, cur ); + }).join(" ") : ""; + }, + + // internal only, use is(".class") + has: function( t, c ) { + return jQuery.inArray( c, (t.className || t).toString().split(/\s+/) ) > -1; + } + }, + swap: function(e,o,f) { + for ( var i in o ) { + e.style["old"+i] = e.style[i]; + e.style[i] = o[i]; + } + f.apply( e, [] ); + for ( var i in o ) + e.style[i] = e.style["old"+i]; + }, + + css: function(e,p) { + if ( p == "height" || p == "width" ) { + var old = {}, oHeight, oWidth, d = ["Top","Bottom","Right","Left"]; + + jQuery.each( d, function(){ + old["padding" + this] = 0; + old["border" + this + "Width"] = 0; + }); + + jQuery.swap( e, old, function() { + if ( jQuery(e).is(':visible') ) { + oHeight = e.offsetHeight; + oWidth = e.offsetWidth; + } else { + e = jQuery(e.cloneNode(true)) + .find(":radio").removeAttr("checked").end() + .css({ + visibility: "hidden", position: "absolute", display: "block", right: "0", left: "0" + }).appendTo(e.parentNode)[0]; + + var parPos = jQuery.css(e.parentNode,"position") || "static"; + if ( parPos == "static" ) + e.parentNode.style.position = "relative"; + + oHeight = e.clientHeight; + oWidth = e.clientWidth; + + if ( parPos == "static" ) + e.parentNode.style.position = "static"; + + e.parentNode.removeChild(e); + } + }); + + return p == "height" ? oHeight : oWidth; + } + + return jQuery.curCSS( e, p ); + }, + + curCSS: function(elem, prop, force) { + var ret; + + if (prop == "opacity" && jQuery.browser.msie) { + ret = jQuery.attr(elem.style, "opacity"); + return ret == "" ? "1" : ret; + } + + if (prop.match(/float/i)) + prop = jQuery.browser.msie ? "styleFloat" : "cssFloat"; + + if (!force && elem.style[prop]) + ret = elem.style[prop]; + + else if (document.defaultView && document.defaultView.getComputedStyle) { + + if (prop.match(/float/i)) + prop = "float"; + + prop = prop.replace(/([A-Z])/g,"-$1").toLowerCase(); + var cur = document.defaultView.getComputedStyle(elem, null); + + if ( cur ) + ret = cur.getPropertyValue(prop); + else if ( prop == "display" ) + ret = "none"; + else + jQuery.swap(elem, { display: "block" }, function() { + var c = document.defaultView.getComputedStyle(this, ""); + ret = c && c.getPropertyValue(prop) || ""; + }); + + } else if (elem.currentStyle) { + var newProp = prop.replace(/\-(\w)/g,function(m,c){return c.toUpperCase();}); + ret = elem.currentStyle[prop] || elem.currentStyle[newProp]; + } + + return ret; + }, + + clean: function(a, doc) { + var r = []; + doc = doc || document; + + jQuery.each( a, function(i,arg){ + if ( !arg ) return; + + if ( arg.constructor == Number ) + arg = arg.toString(); + + // Convert html string into DOM nodes + if ( typeof arg == "string" ) { + // Trim whitespace, otherwise indexOf won't work as expected + var s = jQuery.trim(arg).toLowerCase(), div = doc.createElement("div"), tb = []; + + var wrap = + // option or optgroup + !s.indexOf("", ""] || + + !s.indexOf("", ""] || + + (!s.indexOf("", ""] || + + !s.indexOf("", ""] || + + // matched above + (!s.indexOf("", ""] || + + !s.indexOf("", ""] || + + [0,"",""]; + + // Go to html and back, then peel off extra wrappers + div.innerHTML = wrap[1] + arg + wrap[2]; + + // Move to the right depth + while ( wrap[0]-- ) + div = div.firstChild; + + // Remove IE's autoinserted from table fragments + if ( jQuery.browser.msie ) { + + // String was a , *may* have spurious + if ( !s.indexOf(" or + else if ( wrap[1] == "
" && s.indexOf("= 0 ; --n ) + if ( jQuery.nodeName(tb[n], "tbody") && !tb[n].childNodes.length ) + tb[n].parentNode.removeChild(tb[n]); + + } + + arg = jQuery.makeArray( div.childNodes ); + } + + if ( 0 === arg.length && !jQuery(arg).is("form, select") ) + return; + + if ( arg[0] == undefined || jQuery.nodeName(arg, "form") || arg.options ) + r.push( arg ); + else + r = jQuery.merge( r, arg ); + + }); + + return r; + }, + + attr: function(elem, name, value){ + var fix = jQuery.isXMLDoc(elem) ? {} : { + "for": "htmlFor", + "class": "className", + "float": jQuery.browser.msie ? "styleFloat" : "cssFloat", + cssFloat: jQuery.browser.msie ? "styleFloat" : "cssFloat", + styleFloat: jQuery.browser.msie ? "styleFloat" : "cssFloat", + innerHTML: "innerHTML", + className: "className", + value: "value", + disabled: "disabled", + checked: "checked", + readonly: "readOnly", + selected: "selected", + maxlength: "maxLength" + }; + + // IE actually uses filters for opacity ... elem is actually elem.style + if ( name == "opacity" && jQuery.browser.msie ) { + if ( value != undefined ) { + // IE has trouble with opacity if it does not have layout + // Force it by setting the zoom level + elem.zoom = 1; + + // Set the alpha filter to set the opacity + elem.filter = (elem.filter || "").replace(/alpha\([^)]*\)/,"") + + (parseFloat(value).toString() == "NaN" ? "" : "alpha(opacity=" + value * 100 + ")"); + } + + return elem.filter ? + (parseFloat( elem.filter.match(/opacity=([^)]*)/)[1] ) / 100).toString() : ""; + } + + // Certain attributes only work when accessed via the old DOM 0 way + if ( fix[name] ) { + if ( value != undefined ) elem[fix[name]] = value; + return elem[fix[name]]; + + } else if ( value == undefined && jQuery.browser.msie && jQuery.nodeName(elem, "form") && (name == "action" || name == "method") ) + return elem.getAttributeNode(name).nodeValue; + + // IE elem.getAttribute passes even for style + else if ( elem.tagName ) { + if ( value != undefined ) elem.setAttribute( name, value ); + if ( jQuery.browser.msie && /href|src/.test(name) && !jQuery.isXMLDoc(elem) ) + return elem.getAttribute( name, 2 ); + return elem.getAttribute( name ); + + // elem is actually elem.style ... set the style + } else { + name = name.replace(/-([a-z])/ig,function(z,b){return b.toUpperCase();}); + if ( value != undefined ) elem[name] = value; + return elem[name]; + } + }, + trim: function(t){ + return t.replace(/^\s+|\s+$/g, ""); + }, + + makeArray: function( a ) { + var r = []; + + // Need to use typeof to fight Safari childNodes crashes + if ( typeof a != "array" ) + for ( var i = 0, al = a.length; i < al; i++ ) + r.push( a[i] ); + else + r = a.slice( 0 ); + + return r; + }, + + inArray: function( b, a ) { + for ( var i = 0, al = a.length; i < al; i++ ) + if ( a[i] == b ) + return i; + return -1; + }, + merge: function(first, second) { + // We have to loop this way because IE & Opera overwrite the length + // expando of getElementsByTagName + for ( var i = 0; second[i]; i++ ) + first.push(second[i]); + return first; + }, + unique: function(first) { + var r = [], num = jQuery.mergeNum++; + + for ( var i = 0, fl = first.length; i < fl; i++ ) + if ( num != first[i].mergeNum ) { + first[i].mergeNum = num; + r.push(first[i]); + } + + return r; + }, + + mergeNum: 0, + grep: function(elems, fn, inv) { + // If a string is passed in for the function, make a function + // for it (a handy shortcut) + if ( typeof fn == "string" ) + fn = new Function("a","i","return " + fn); + + var result = []; + + // Go through the array, only saving the items + // that pass the validator function + for ( var i = 0, el = elems.length; i < el; i++ ) + if ( !inv && fn(elems[i],i) || inv && !fn(elems[i],i) ) + result.push( elems[i] ); + + return result; + }, + map: function(elems, fn) { + // If a string is passed in for the function, make a function + // for it (a handy shortcut) + if ( typeof fn == "string" ) + fn = new Function("a","return " + fn); + + var result = []; + + // Go through the array, translating each of the items to their + // new value (or values). + for ( var i = 0, el = elems.length; i < el; i++ ) { + var val = fn(elems[i],i); + + if ( val !== null && val != undefined ) { + if ( val.constructor != Array ) val = [val]; + result = result.concat( val ); + } + } + + return result; + } +}); + +/* + * Whether the W3C compliant box model is being used. + * + * @property + * @name $.boxModel + * @type Boolean + * @cat JavaScript + */ +new function() { + var b = navigator.userAgent.toLowerCase(); + + // Figure out what browser is being used + jQuery.browser = { + version: b.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)[1], + safari: /webkit/.test(b), + opera: /opera/.test(b), + msie: /msie/.test(b) && !/opera/.test(b), + mozilla: /mozilla/.test(b) && !/(compatible|webkit)/.test(b) + }; + + // Check to see if the W3C box model is being used + jQuery.boxModel = !jQuery.browser.msie || document.compatMode == "CSS1Compat"; +}; + +jQuery.each({ + parent: "a.parentNode", + parents: "jQuery.parents(a)", + next: "jQuery.nth(a,2,'nextSibling')", + prev: "jQuery.nth(a,2,'previousSibling')", + siblings: "jQuery.sibling(a.parentNode.firstChild,a)", + children: "jQuery.sibling(a.firstChild)" +}, function(i,n){ + jQuery.fn[ i ] = function(a) { + var ret = jQuery.map(this,n); + if ( a && typeof a == "string" ) + ret = jQuery.multiFilter(a,ret); + return this.pushStack( ret ); + }; +}); + +jQuery.each({ + appendTo: "append", + prependTo: "prepend", + insertBefore: "before", + insertAfter: "after" +}, function(i,n){ + jQuery.fn[ i ] = function(){ + var a = arguments; + return this.each(function(){ + for ( var j = 0, al = a.length; j < al; j++ ) + jQuery(a[j])[n]( this ); + }); + }; +}); + +jQuery.each( { + removeAttr: function( key ) { + jQuery.attr( this, key, "" ); + this.removeAttribute( key ); + }, + addClass: function(c){ + jQuery.className.add(this,c); + }, + removeClass: function(c){ + jQuery.className.remove(this,c); + }, + toggleClass: function( c ){ + jQuery.className[ jQuery.className.has(this,c) ? "remove" : "add" ](this, c); + }, + remove: function(a){ + if ( !a || jQuery.filter( a, [this] ).r.length ) + this.parentNode.removeChild( this ); + }, + empty: function() { + while ( this.firstChild ) + this.removeChild( this.firstChild ); + } +}, function(i,n){ + jQuery.fn[ i ] = function() { + return this.each( n, arguments ); + }; +}); + +jQuery.each( [ "eq", "lt", "gt", "contains" ], function(i,n){ + jQuery.fn[ n ] = function(num,fn) { + return this.filter( ":" + n + "(" + num + ")", fn ); + }; +}); + +jQuery.each( [ "height", "width" ], function(i,n){ + jQuery.fn[ n ] = function(h) { + return h == undefined ? + ( this.length ? jQuery.css( this[0], n ) : null ) : + this.css( n, h.constructor == String ? h : h + "px" ); + }; +}); +jQuery.extend({ + expr: { + "": "m[2]=='*'||jQuery.nodeName(a,m[2])", + "#": "a.getAttribute('id')==m[2]", + ":": { + // Position Checks + lt: "im[3]-0", + nth: "m[3]-0==i", + eq: "m[3]-0==i", + first: "i==0", + last: "i==r.length-1", + even: "i%2==0", + odd: "i%2", + + // Child Checks + "nth-child": "jQuery.nth(a.parentNode.firstChild,m[3],'nextSibling',a)==a", + "first-child": "jQuery.nth(a.parentNode.firstChild,1,'nextSibling')==a", + "last-child": "jQuery.nth(a.parentNode.lastChild,1,'previousSibling')==a", + "only-child": "jQuery.sibling(a.parentNode.firstChild).length==1", + + // Parent Checks + parent: "a.firstChild", + empty: "!a.firstChild", + + // Text Check + contains: "jQuery.fn.text.apply([a]).indexOf(m[3])>=0", + + // Visibility + visible: '"hidden"!=a.type&&jQuery.css(a,"display")!="none"&&jQuery.css(a,"visibility")!="hidden"', + hidden: '"hidden"==a.type||jQuery.css(a,"display")=="none"||jQuery.css(a,"visibility")=="hidden"', + + // Form attributes + enabled: "!a.disabled", + disabled: "a.disabled", + checked: "a.checked", + selected: "a.selected||jQuery.attr(a,'selected')", + + // Form elements + text: "'text'==a.type", + radio: "'radio'==a.type", + checkbox: "'checkbox'==a.type", + file: "'file'==a.type", + password: "'password'==a.type", + submit: "'submit'==a.type", + image: "'image'==a.type", + reset: "'reset'==a.type", + button: '"button"==a.type||jQuery.nodeName(a,"button")', + input: "/input|select|textarea|button/i.test(a.nodeName)" + }, + ".": "jQuery.className.has(a,m[2])", + "@": { + "=": "z==m[4]", + "!=": "z!=m[4]", + "^=": "z&&!z.indexOf(m[4])", + "$=": "z&&z.substr(z.length - m[4].length,m[4].length)==m[4]", + "*=": "z&&z.indexOf(m[4])>=0", + "": "z", + _resort: function(m){ + return ["", m[1], m[3], m[2], m[5]]; + }, + _prefix: "var z=a[m[3]];if(!z||/href|src/.test(m[3]))z=jQuery.attr(a,m[3]);" + }, + "[": "jQuery.find(m[2],a).length" + }, + + // The regular expressions that power the parsing engine + parse: [ + // Match: [@value='test'], [@foo] + /^\[ *(@)([\w-]+) *([!*$^=]*) *('?"?)(.*?)\4 *\]/, + + // Match: [div], [div p] + /^(\[)\s*(.*?(\[.*?\])?[^[]*?)\s*\]/, + + // Match: :contains('foo') + /^(:)([\w-]+)\("?'?(.*?(\(.*?\))?[^(]*?)"?'?\)/, + + // Match: :even, :last-chlid, #id, .class + new RegExp("^([:.#]*)(" + + ( jQuery.chars = "(?:[\\w\u0128-\uFFFF*_-]|\\\\.)" ) + "+)") + ], + + token: [ + /^(\/?\.\.)/, "a.parentNode", + /^(>|\/)/, "jQuery.sibling(a.firstChild)", + /^(\+)/, "jQuery.nth(a,2,'nextSibling')", + /^(~)/, function(a){ + var s = jQuery.sibling(a.parentNode.firstChild); + return s.slice(jQuery.inArray(a,s) + 1); + } + ], + + multiFilter: function( expr, elems, not ) { + var old, cur = []; + + while ( expr && expr != old ) { + old = expr; + var f = jQuery.filter( expr, elems, not ); + expr = f.t.replace(/^\s*,\s*/, "" ); + cur = not ? elems = f.r : jQuery.merge( cur, f.r ); + } + + return cur; + }, + find: function( t, context ) { + // Quickly handle non-string expressions + if ( typeof t != "string" ) + return [ t ]; + + // Make sure that the context is a DOM Element + if ( context && !context.nodeType ) + context = null; + + // Set the correct context (if none is provided) + context = context || document; + + // Handle the common XPath // expression + if ( !t.indexOf("//") ) { + context = context.documentElement; + t = t.substr(2,t.length); + + // And the / root expression + } else if ( !t.indexOf("/") && !context.ownerDocument ) { + context = context.documentElement; + t = t.substr(1,t.length); + if ( t.indexOf("/") >= 1 ) + t = t.substr(t.indexOf("/"),t.length); + } + + // Initialize the search + var ret = [context], done = [], last; + + // Continue while a selector expression exists, and while + // we're no longer looping upon ourselves + while ( t && last != t ) { + var r = []; + last = t; + + t = jQuery.trim(t).replace( /^\/\//, "" ); + + var foundToken = false; + + // An attempt at speeding up child selectors that + // point to a specific element tag + var re = new RegExp("^[/>]\\s*(" + jQuery.chars + "+)"); + var m = re.exec(t); + + if ( m ) { + // Perform our own iteration and filter + for ( var i = 0; ret[i]; i++ ) + for ( var c = ret[i].firstChild; c; c = c.nextSibling ) + if ( c.nodeType == 1 && ( m[1] == "*" || jQuery.nodeName(c, m[1]) ) ) + r.push( c ); + + ret = r; + t = t.replace( re, "" ); + if ( t.indexOf(" ") == 0 ) continue; + foundToken = true; + } else { + // Look for pre-defined expression tokens + for ( var i = 0, tl = jQuery.token.length; i < tl; i += 2 ) { + // Attempt to match each, individual, token in + // the specified order + var re = jQuery.token[i], fn = jQuery.token[i+1]; + var m = re.exec(t); + + // If the token match was found + if ( m ) { + // Map it against the token's handler + r = ret = jQuery.map( ret, jQuery.isFunction( fn ) ? + fn : new Function( "a", "return " + fn ) ); + + // And remove the token + t = jQuery.trim( t.replace( re, "" ) ); + foundToken = true; + break; + } + } + } + + // See if there's still an expression, and that we haven't already + // matched a token + if ( t && !foundToken ) { + // Handle multiple expressions + if ( !t.indexOf(",") ) { + // Clean the result set + if ( context == ret[0] ) ret.shift(); + + // Merge the result sets + done = jQuery.merge( done, ret ); + + // Reset the context + r = ret = [context]; + + // Touch up the selector string + t = " " + t.substr(1,t.length); + + } else { + // Optomize for the case nodeName#idName + var re2 = new RegExp("^(" + jQuery.chars + "+)(#)(" + jQuery.chars + "+)"); + var m = re2.exec(t); + + // Re-organize the results, so that they're consistent + if ( m ) { + m = [ 0, m[2], m[3], m[1] ]; + + } else { + // Otherwise, do a traditional filter check for + // ID, class, and element selectors + re2 = new RegExp("^([#.]?)(" + jQuery.chars + "*)"); + m = re2.exec(t); + } + + m[2] = m[2].replace(/\\/g, ""); + + var elem = ret[ret.length-1]; + + // Try to do a global search by ID, where we can + if ( m[1] == "#" && elem && elem.getElementById ) { + // Optimization for HTML document case + var oid = elem.getElementById(m[2]); + + // Do a quick check for the existence of the actual ID attribute + // to avoid selecting by the name attribute in IE + // also check to insure id is a string to avoid selecting an element with the name of 'id' inside a form + if ( (jQuery.browser.msie||jQuery.browser.opera) && oid && typeof oid.id == "string" && oid.id != m[2] ) + oid = jQuery('[@id="'+m[2]+'"]', elem)[0]; + + // Do a quick check for node name (where applicable) so + // that div#foo searches will be really fast + ret = r = oid && (!m[3] || jQuery.nodeName(oid, m[3])) ? [oid] : []; + } else { + // We need to find all descendant elements + for ( var i = 0; ret[i]; i++ ) { + // Grab the tag name being searched for + var tag = m[1] != "" || m[0] == "" ? "*" : m[2]; + + // Handle IE7 being really dumb about s + if ( tag == "*" && ret[i].nodeName.toLowerCase() == "object" ) + tag = "param"; + + r = jQuery.merge( r, ret[i].getElementsByTagName( tag )); + } + + // It's faster to filter by class and be done with it + if ( m[1] == "." ) + r = jQuery.classFilter( r, m[2] ); + + // Same with ID filtering + if ( m[1] == "#" ) { + var tmp = []; + + // Try to find the element with the ID + for ( var i = 0; r[i]; i++ ) + if ( r[i].getAttribute("id") == m[2] ) { + tmp = [ r[i] ]; + break; + } + + r = tmp; + } + + ret = r; + } + + t = t.replace( re2, "" ); + } + + } + + // If a selector string still exists + if ( t ) { + // Attempt to filter it + var val = jQuery.filter(t,r); + ret = r = val.r; + t = jQuery.trim(val.t); + } + } + + // An error occurred with the selector; + // just return an empty set instead + if ( t ) + ret = []; + + // Remove the root context + if ( ret && context == ret[0] ) + ret.shift(); + + // And combine the results + done = jQuery.merge( done, ret ); + + return done; + }, + + classFilter: function(r,m,not){ + m = " " + m + " "; + var tmp = []; + for ( var i = 0; r[i]; i++ ) { + var pass = (" " + r[i].className + " ").indexOf( m ) >= 0; + if ( !not && pass || not && !pass ) + tmp.push( r[i] ); + } + return tmp; + }, + + filter: function(t,r,not) { + var last; + + // Look for common filter expressions + while ( t && t != last ) { + last = t; + + var p = jQuery.parse, m; + + for ( var i = 0; p[i]; i++ ) { + m = p[i].exec( t ); + + if ( m ) { + // Remove what we just matched + t = t.substring( m[0].length ); + + // Re-organize the first match + if ( jQuery.expr[ m[1] ]._resort ) + m = jQuery.expr[ m[1] ]._resort( m ); + + m[2] = m[2].replace(/\\/g, ""); + + break; + } + } + + if ( !m ) + break; + + // :not() is a special case that can be optimized by + // keeping it out of the expression list + if ( m[1] == ":" && m[2] == "not" ) + r = jQuery.filter(m[3], r, true).r; + + // We can get a big speed boost by filtering by class here + else if ( m[1] == "." ) + r = jQuery.classFilter(r, m[2], not); + + // Otherwise, find the expression to execute + else { + var f = jQuery.expr[m[1]]; + if ( typeof f != "string" ) + f = jQuery.expr[m[1]][m[2]]; + + // Build a custom macro to enclose it + eval("f = function(a,i){" + + ( jQuery.expr[ m[1] ]._prefix || "" ) + + "return " + f + "}"); + + // Execute it against the current filter + r = jQuery.grep( r, f, not ); + } + } + + // Return an array of filtered elements (r) + // and the modified expression string (t) + return { r: r, t: t }; + }, + parents: function( elem ){ + var matched = []; + var cur = elem.parentNode; + while ( cur && cur != document ) { + matched.push( cur ); + cur = cur.parentNode; + } + return matched; + }, + nth: function(cur,result,dir,elem){ + result = result || 1; + var num = 0; + for ( ; cur; cur = cur[dir] ) { + if ( cur.nodeType == 1 ) num++; + if ( num == result || result == "even" && num % 2 == 0 && num > 1 && cur == elem || + result == "odd" && num % 2 == 1 && cur == elem ) break; + } + return cur; + }, + sibling: function( n, elem ) { + var r = []; + + for ( ; n; n = n.nextSibling ) { + if ( n.nodeType == 1 && (!elem || n != elem) ) + r.push( n ); + } + + return r; + } +}); +/* + * A number of helper functions used for managing events. + * Many of the ideas behind this code orignated from + * Dean Edwards' addEvent library. + */ +jQuery.event = { + + // Bind an event to an element + // Original by Dean Edwards + add: function(element, type, handler, data) { + // For whatever reason, IE has trouble passing the window object + // around, causing it to be cloned in the process + if ( jQuery.browser.msie && element.setInterval != undefined ) + element = window; + + // Make sure that the function being executed has a unique ID + if ( !handler.guid ) + handler.guid = this.guid++; + + // if data is passed, bind to handler + if( data != undefined ) { + // Create temporary function pointer to original handler + var fn = handler; + + // Create unique handler function, wrapped around original handler + handler = function() { + // Pass arguments and context to original handler + return fn.apply(this, arguments); + }; + + // Store data in unique handler + handler.data = data; + + // Set the guid of unique handler to the same of original handler, so it can be removed + handler.guid = fn.guid; + } + + // Init the element's event structure + if (!element.$events) + element.$events = {}; + + if (!element.$handle) + element.$handle = function() { + // returned undefined or false + var val; + + // Handle the second event of a trigger and when + // an event is called after a page has unloaded + if ( typeof jQuery == "undefined" || jQuery.event.triggered ) + return val; + + val = jQuery.event.handle.apply(element, arguments); + + return val; + }; + + // Get the current list of functions bound to this event + var handlers = element.$events[type]; + + // Init the event handler queue + if (!handlers) { + handlers = element.$events[type] = {}; + + // And bind the global event handler to the element + if (element.addEventListener) + element.addEventListener(type, element.$handle, false); + else if (element.attachEvent) + element.attachEvent("on" + type, element.$handle); + } + + // Add the function to the element's handler list + handlers[handler.guid] = handler; + + // Remember the function in a global list (for triggering) + if (!this.global[type]) + this.global[type] = []; + // Only add the element to the global list once + if (jQuery.inArray(element, this.global[type]) == -1) + this.global[type].push( element ); + }, + + guid: 1, + global: {}, + + // Detach an event or set of events from an element + remove: function(element, type, handler) { + var events = element.$events, ret, index; + + if ( events ) { + // type is actually an event object here + if ( type && type.type ) { + handler = type.handler; + type = type.type; + } + + if ( !type ) { + for ( type in events ) + this.remove( element, type ); + + } else if ( events[type] ) { + // remove the given handler for the given type + if ( handler ) + delete events[type][handler.guid]; + + // remove all handlers for the given type + else + for ( handler in element.$events[type] ) + delete events[type][handler]; + + // remove generic event handler if no more handlers exist + for ( ret in events[type] ) break; + if ( !ret ) { + if (element.removeEventListener) + element.removeEventListener(type, element.$handle, false); + else if (element.detachEvent) + element.detachEvent("on" + type, element.$handle); + ret = null; + delete events[type]; + + // Remove element from the global event type cache + while ( this.global[type] && ( (index = jQuery.inArray(element, this.global[type])) >= 0 ) ) + delete this.global[type][index]; + } + } + + // Remove the expando if it's no longer used + for ( ret in events ) break; + if ( !ret ) + element.$handle = element.$events = null; + } + }, + + trigger: function(type, data, element) { + // Clone the incoming data, if any + data = jQuery.makeArray(data || []); + + // Handle a global trigger + if ( !element ) + jQuery.each( this.global[type] || [], function(){ + jQuery.event.trigger( type, data, this ); + }); + + // Handle triggering a single element + else { + var val, ret, fn = jQuery.isFunction( element[ type ] || null ); + + // Pass along a fake event + data.unshift( this.fix({ type: type, target: element }) ); + + // Trigger the event + if ( (val = element.$handle.apply( element, data )) !== false ) + this.triggered = true; + + if ( fn && val !== false && !jQuery.nodeName(element, 'a') ) + element[ type ](); + + this.triggered = false; + } + }, + + handle: function(event) { + // returned undefined or false + var val; + + // Empty object is for triggered events with no data + event = jQuery.event.fix( event || window.event || {} ); + + var c = this.$events && this.$events[event.type], args = [].slice.call( arguments, 1 ); + args.unshift( event ); + + for ( var j in c ) { + // Pass in a reference to the handler function itself + // So that we can later remove it + args[0].handler = c[j]; + args[0].data = c[j].data; + + if ( c[j].apply( this, args ) === false ) { + event.preventDefault(); + event.stopPropagation(); + val = false; + } + } + + // Clean up added properties in IE to prevent memory leak + if (jQuery.browser.msie) + event.target = event.preventDefault = event.stopPropagation = + event.handler = event.data = null; + + return val; + }, + + fix: function(event) { + // store a copy of the original event object + // and clone to set read-only properties + var originalEvent = event; + event = jQuery.extend({}, originalEvent); + + // add preventDefault and stopPropagation since + // they will not work on the clone + event.preventDefault = function() { + // if preventDefault exists run it on the original event + if (originalEvent.preventDefault) + return originalEvent.preventDefault(); + // otherwise set the returnValue property of the original event to false (IE) + originalEvent.returnValue = false; + }; + event.stopPropagation = function() { + // if stopPropagation exists run it on the original event + if (originalEvent.stopPropagation) + return originalEvent.stopPropagation(); + // otherwise set the cancelBubble property of the original event to true (IE) + originalEvent.cancelBubble = true; + }; + + // Fix target property, if necessary + if ( !event.target && event.srcElement ) + event.target = event.srcElement; + + // check if target is a textnode (safari) + if (jQuery.browser.safari && event.target.nodeType == 3) + event.target = originalEvent.target.parentNode; + + // Add relatedTarget, if necessary + if ( !event.relatedTarget && event.fromElement ) + event.relatedTarget = event.fromElement == event.target ? event.toElement : event.fromElement; + + // Calculate pageX/Y if missing and clientX/Y available + if ( event.pageX == null && event.clientX != null ) { + var e = document.documentElement || document.body; + event.pageX = event.clientX + e.scrollLeft; + event.pageY = event.clientY + e.scrollTop; + } + + // Add which for key events + if ( !event.which && (event.charCode || event.keyCode) ) + event.which = event.charCode || event.keyCode; + + // Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs) + if ( !event.metaKey && event.ctrlKey ) + event.metaKey = event.ctrlKey; + + // Add which for click: 1 == left; 2 == middle; 3 == right + // Note: button is not normalized, so don't use it + if ( !event.which && event.button ) + event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) )); + + return event; + } +}; + +jQuery.fn.extend({ + bind: function( type, data, fn ) { + return type == "unload" ? this.one(type, data, fn) : this.each(function(){ + jQuery.event.add( this, type, fn || data, fn && data ); + }); + }, + one: function( type, data, fn ) { + return this.each(function(){ + jQuery.event.add( this, type, function(event) { + jQuery(this).unbind(event); + return (fn || data).apply( this, arguments); + }, fn && data); + }); + }, + unbind: function( type, fn ) { + return this.each(function(){ + jQuery.event.remove( this, type, fn ); + }); + }, + trigger: function( type, data ) { + return this.each(function(){ + jQuery.event.trigger( type, data, this ); + }); + }, + toggle: function() { + // Save reference to arguments for access in closure + var a = arguments; + + return this.click(function(e) { + // Figure out which function to execute + this.lastToggle = 0 == this.lastToggle ? 1 : 0; + + // Make sure that clicks stop + e.preventDefault(); + + // and execute the function + return a[this.lastToggle].apply( this, [e] ) || false; + }); + }, + hover: function(f,g) { + + // A private function for handling mouse 'hovering' + function handleHover(e) { + // Check if mouse(over|out) are still within the same parent element + var p = e.relatedTarget; + + // Traverse up the tree + while ( p && p != this ) try { p = p.parentNode } catch(e) { p = this; }; + + // If we actually just moused on to a sub-element, ignore it + if ( p == this ) return false; + + // Execute the right function + return (e.type == "mouseover" ? f : g).apply(this, [e]); + } + + // Bind the function to the two event listeners + return this.mouseover(handleHover).mouseout(handleHover); + }, + ready: function(f) { + // If the DOM is already ready + if ( jQuery.isReady ) + // Execute the function immediately + f.apply( document, [jQuery] ); + + // Otherwise, remember the function for later + else { + // Add the function to the wait list + jQuery.readyList.push( function() { return f.apply(this, [jQuery]) } ); + } + + return this; + } +}); + +jQuery.extend({ + /* + * All the code that makes DOM Ready work nicely. + */ + isReady: false, + readyList: [], + + // Handle when the DOM is ready + ready: function() { + // Make sure that the DOM is not already loaded + if ( !jQuery.isReady ) { + // Remember that the DOM is ready + jQuery.isReady = true; + + // If there are functions bound, to execute + if ( jQuery.readyList ) { + // Execute all of them + jQuery.each( jQuery.readyList, function(){ + this.apply( document ); + }); + + // Reset the list of functions + jQuery.readyList = null; + } + // Remove event listener to avoid memory leak + if ( jQuery.browser.mozilla || jQuery.browser.opera ) + document.removeEventListener( "DOMContentLoaded", jQuery.ready, false ); + + // Remove script element used by IE hack + jQuery(window).load(function(){ jQuery("#__ie_init").remove(); }); + } + } +}); + +new function(){ + + jQuery.each( ("blur,focus,load,resize,scroll,unload,click,dblclick," + + "mousedown,mouseup,mousemove,mouseover,mouseout,change,select," + + "submit,keydown,keypress,keyup,error").split(","), function(i,o){ + + // Handle event binding + jQuery.fn[o] = function(f){ + return f ? this.bind(o, f) : this.trigger(o); + }; + + }); + + // If Mozilla is used + if ( jQuery.browser.mozilla || jQuery.browser.opera ) + // Use the handy event callback + document.addEventListener( "DOMContentLoaded", jQuery.ready, false ); + + // If IE is used, use the excellent hack by Matthias Miller + // http://www.outofhanwell.com/blog/index.php?title=the_window_onload_problem_revisited + else if ( jQuery.browser.msie ) { + + // Only works if you document.write() it + document.write("<\/script>"); + + // Use the defer script hack + var script = document.getElementById("__ie_init"); + + // script does not exist if jQuery is loaded dynamically + if ( script ) + script.onreadystatechange = function() { + if ( this.readyState != "complete" ) return; + jQuery.ready(); + }; + + // Clear from memory + script = null; + + // If Safari is used + } else if ( jQuery.browser.safari ) + // Continually check to see if the document.readyState is valid + jQuery.safariTimer = setInterval(function(){ + // loaded and complete are both valid states + if ( document.readyState == "loaded" || + document.readyState == "complete" ) { + + // If either one are found, remove the timer + clearInterval( jQuery.safariTimer ); + jQuery.safariTimer = null; + + // and execute any waiting functions + jQuery.ready(); + } + }, 10); + + // A fallback to window.onload, that will always work + jQuery.event.add( window, "load", jQuery.ready ); + +}; + +// Clean up after IE to avoid memory leaks +if (jQuery.browser.msie) + jQuery(window).one("unload", function() { + var global = jQuery.event.global; + for ( var type in global ) { + var els = global[type], i = els.length; + if ( i && type != 'unload' ) + do + jQuery.event.remove(els[i-1], type); + while (--i); + } + }); +jQuery.fn.extend({ + loadIfModified: function( url, params, callback ) { + this.load( url, params, callback, 1 ); + }, + load: function( url, params, callback, ifModified ) { + if ( jQuery.isFunction( url ) ) + return this.bind("load", url); + + callback = callback || function(){}; + + // Default to a GET request + var type = "GET"; + + // If the second parameter was provided + if ( params ) + // If it's a function + if ( jQuery.isFunction( params ) ) { + // We assume that it's the callback + callback = params; + params = null; + + // Otherwise, build a param string + } else { + params = jQuery.param( params ); + type = "POST"; + } + + var self = this; + + // Request the remote document + jQuery.ajax({ + url: url, + type: type, + data: params, + ifModified: ifModified, + complete: function(res, status){ + if ( status == "success" || !ifModified && status == "notmodified" ) + // Inject the HTML into all the matched elements + self.attr("innerHTML", res.responseText) + // Execute all the scripts inside of the newly-injected HTML + .evalScripts() + // Execute callback + .each( callback, [res.responseText, status, res] ); + else + callback.apply( self, [res.responseText, status, res] ); + } + }); + return this; + }, + serialize: function() { + return jQuery.param( this ); + }, + evalScripts: function() { + return this.find("script").each(function(){ + if ( this.src ) + jQuery.getScript( this.src ); + else + jQuery.globalEval( this.text || this.textContent || this.innerHTML || "" ); + }).end(); + } + +}); + +// Attach a bunch of functions for handling common AJAX events + +jQuery.each( "ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","), function(i,o){ + jQuery.fn[o] = function(f){ + return this.bind(o, f); + }; +}); + +jQuery.extend({ + get: function( url, data, callback, type, ifModified ) { + // shift arguments if data argument was ommited + if ( jQuery.isFunction( data ) ) { + callback = data; + data = null; + } + + return jQuery.ajax({ + type: "GET", + url: url, + data: data, + success: callback, + dataType: type, + ifModified: ifModified + }); + }, + getIfModified: function( url, data, callback, type ) { + return jQuery.get(url, data, callback, type, 1); + }, + getScript: function( url, callback ) { + return jQuery.get(url, null, callback, "script"); + }, + getJSON: function( url, data, callback ) { + return jQuery.get(url, data, callback, "json"); + }, + post: function( url, data, callback, type ) { + if ( jQuery.isFunction( data ) ) { + callback = data; + data = {}; + } + + return jQuery.ajax({ + type: "POST", + url: url, + data: data, + success: callback, + dataType: type + }); + }, + ajaxTimeout: function( timeout ) { + jQuery.ajaxSettings.timeout = timeout; + }, + ajaxSetup: function( settings ) { + jQuery.extend( jQuery.ajaxSettings, settings ); + }, + + ajaxSettings: { + global: true, + type: "GET", + timeout: 0, + contentType: "application/x-www-form-urlencoded", + processData: true, + async: true, + data: null + }, + + // Last-Modified header cache for next request + lastModified: {}, + ajax: function( s ) { + // TODO introduce global settings, allowing the client to modify them for all requests, not only timeout + s = jQuery.extend({}, jQuery.ajaxSettings, s); + + // if data available + if ( s.data ) { + // convert data if not already a string + if (s.processData && typeof s.data != "string") + s.data = jQuery.param(s.data); + // append data to url for get requests + if( s.type.toLowerCase() == "get" ) { + // "?" + data or "&" + data (in case there are already params) + s.url += ((s.url.indexOf("?") > -1) ? "&" : "?") + s.data; + // IE likes to send both get and post data, prevent this + s.data = null; + } + } + + // Watch for a new set of requests + if ( s.global && ! jQuery.active++ ) + jQuery.event.trigger( "ajaxStart" ); + + var requestDone = false; + + // Create the request object; Microsoft failed to properly + // implement the XMLHttpRequest in IE7, so we use the ActiveXObject when it is available + var xml = window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest(); + + // Open the socket + xml.open(s.type, s.url, s.async); + + // Set the correct header, if data is being sent + if ( s.data ) + xml.setRequestHeader("Content-Type", s.contentType); + + // Set the If-Modified-Since header, if ifModified mode. + if ( s.ifModified ) + xml.setRequestHeader("If-Modified-Since", + jQuery.lastModified[s.url] || "Thu, 01 Jan 1970 00:00:00 GMT" ); + + // Set header so the called script knows that it's an XMLHttpRequest + xml.setRequestHeader("X-Requested-With", "XMLHttpRequest"); + + // Allow custom headers/mimetypes + if( s.beforeSend ) + s.beforeSend(xml); + + if ( s.global ) + jQuery.event.trigger("ajaxSend", [xml, s]); + + // Wait for a response to come back + var onreadystatechange = function(isTimeout){ + // The transfer is complete and the data is available, or the request timed out + if ( xml && (xml.readyState == 4 || isTimeout == "timeout") ) { + requestDone = true; + + // clear poll interval + if (ival) { + clearInterval(ival); + ival = null; + } + + var status; + try { + status = jQuery.httpSuccess( xml ) && isTimeout != "timeout" ? + s.ifModified && jQuery.httpNotModified( xml, s.url ) ? "notmodified" : "success" : "error"; + // Make sure that the request was successful or notmodified + if ( status != "error" ) { + // Cache Last-Modified header, if ifModified mode. + var modRes; + try { + modRes = xml.getResponseHeader("Last-Modified"); + } catch(e) {} // swallow exception thrown by FF if header is not available + + if ( s.ifModified && modRes ) + jQuery.lastModified[s.url] = modRes; + + // process the data (runs the xml through httpData regardless of callback) + var data = jQuery.httpData( xml, s.dataType ); + + // If a local callback was specified, fire it and pass it the data + if ( s.success ) + s.success( data, status ); + + // Fire the global callback + if( s.global ) + jQuery.event.trigger( "ajaxSuccess", [xml, s] ); + } else + jQuery.handleError(s, xml, status); + } catch(e) { + status = "error"; + jQuery.handleError(s, xml, status, e); + } + + // The request was completed + if( s.global ) + jQuery.event.trigger( "ajaxComplete", [xml, s] ); + + // Handle the global AJAX counter + if ( s.global && ! --jQuery.active ) + jQuery.event.trigger( "ajaxStop" ); + + // Process result + if ( s.complete ) + s.complete(xml, status); + + // Stop memory leaks + if(s.async) + xml = null; + } + }; + + // don't attach the handler to the request, just poll it instead + var ival = setInterval(onreadystatechange, 13); + + // Timeout checker + if ( s.timeout > 0 ) + setTimeout(function(){ + // Check to see if the request is still happening + if ( xml ) { + // Cancel the request + xml.abort(); + + if( !requestDone ) + onreadystatechange( "timeout" ); + } + }, s.timeout); + + // Send the data + try { + xml.send(s.data); + } catch(e) { + jQuery.handleError(s, xml, null, e); + } + + // firefox 1.5 doesn't fire statechange for sync requests + if ( !s.async ) + onreadystatechange(); + + // return XMLHttpRequest to allow aborting the request etc. + return xml; + }, + + handleError: function( s, xml, status, e ) { + // If a local callback was specified, fire it + if ( s.error ) s.error( xml, status, e ); + + // Fire the global callback + if ( s.global ) + jQuery.event.trigger( "ajaxError", [xml, s, e] ); + }, + + // Counter for holding the number of active queries + active: 0, + + // Determines if an XMLHttpRequest was successful or not + httpSuccess: function( r ) { + try { + return !r.status && location.protocol == "file:" || + ( r.status >= 200 && r.status < 300 ) || r.status == 304 || + jQuery.browser.safari && r.status == undefined; + } catch(e){} + return false; + }, + + // Determines if an XMLHttpRequest returns NotModified + httpNotModified: function( xml, url ) { + try { + var xmlRes = xml.getResponseHeader("Last-Modified"); + + // Firefox always returns 200. check Last-Modified date + return xml.status == 304 || xmlRes == jQuery.lastModified[url] || + jQuery.browser.safari && xml.status == undefined; + } catch(e){} + return false; + }, + + /* Get the data out of an XMLHttpRequest. + * Return parsed XML if content-type header is "xml" and type is "xml" or omitted, + * otherwise return plain text. + * (String) data - The type of data that you're expecting back, + * (e.g. "xml", "html", "script") + */ + httpData: function( r, type ) { + var ct = r.getResponseHeader("content-type"); + var data = !type && ct && ct.indexOf("xml") >= 0; + data = type == "xml" || data ? r.responseXML : r.responseText; + + // If the type is "script", eval it in global context + if ( type == "script" ) + jQuery.globalEval( data ); + + // Get the JavaScript object, if JSON is used. + if ( type == "json" ) + eval( "data = " + data ); + + // evaluate scripts within html + if ( type == "html" ) + jQuery("
").html(data).evalScripts(); + + return data; + }, + + // Serialize an array of form elements or a set of + // key/values into a query string + param: function( a ) { + var s = []; + + // If an array was passed in, assume that it is an array + // of form elements + if ( a.constructor == Array || a.jquery ) + // Serialize the form elements + jQuery.each( a, function(){ + s.push( encodeURIComponent(this.name) + "=" + encodeURIComponent( this.value ) ); + }); + + // Otherwise, assume that it's an object of key/value pairs + else + // Serialize the key/values + for ( var j in a ) + // If the value is an array then the key names need to be repeated + if ( a[j] && a[j].constructor == Array ) + jQuery.each( a[j], function(){ + s.push( encodeURIComponent(j) + "=" + encodeURIComponent( this ) ); + }); + else + s.push( encodeURIComponent(j) + "=" + encodeURIComponent( a[j] ) ); + + // Return the resulting serialization + return s.join("&"); + }, + + // evalulates a script in global context + // not reliable for safari + globalEval: function( data ) { + if ( window.execScript ) + window.execScript( data ); + else if ( jQuery.browser.safari ) + // safari doesn't provide a synchronous global eval + window.setTimeout( data, 0 ); + else + eval.call( window, data ); + } + +}); +jQuery.fn.extend({ + + show: function(speed,callback){ + return speed ? + this.animate({ + height: "show", width: "show", opacity: "show" + }, speed, callback) : + + this.filter(":hidden").each(function(){ + this.style.display = this.oldblock ? this.oldblock : ""; + if ( jQuery.css(this,"display") == "none" ) + this.style.display = "block"; + }).end(); + }, + + hide: function(speed,callback){ + return speed ? + this.animate({ + height: "hide", width: "hide", opacity: "hide" + }, speed, callback) : + + this.filter(":visible").each(function(){ + this.oldblock = this.oldblock || jQuery.css(this,"display"); + if ( this.oldblock == "none" ) + this.oldblock = "block"; + this.style.display = "none"; + }).end(); + }, + + // Save the old toggle function + _toggle: jQuery.fn.toggle, + toggle: function( fn, fn2 ){ + return jQuery.isFunction(fn) && jQuery.isFunction(fn2) ? + this._toggle( fn, fn2 ) : + this.animate({ + height: "toggle", width: "toggle", opacity: "toggle" + }, fn, fn2); + }, + slideDown: function(speed,callback){ + return this.animate({height: "show"}, speed, callback); + }, + slideUp: function(speed,callback){ + return this.animate({height: "hide"}, speed, callback); + }, + slideToggle: function(speed, callback){ + return this.animate({height: "toggle"}, speed, callback); + }, + fadeIn: function(speed, callback){ + return this.animate({opacity: "show"}, speed, callback); + }, + fadeOut: function(speed, callback){ + return this.animate({opacity: "hide"}, speed, callback); + }, + fadeTo: function(speed,to,callback){ + return this.animate({opacity: to}, speed, callback); + }, + animate: function( prop, speed, easing, callback ) { + return this.queue(function(){ + var hidden = jQuery(this).is(":hidden"); + + for ( var p in prop ) + if ( prop[p] == "hide" && hidden || + prop[p] == "show" && !hidden ) + return; + + this.curAnim = jQuery.extend({}, prop); + var opt = jQuery.speed(speed, easing, callback); + var self = this; + + jQuery.each( prop, function(name, val){ + var e = new jQuery.fx( self, opt, name ); + if ( val.constructor == Number ) + e.custom( e.cur(), val ); + else + e[ val == "toggle" ? hidden ? "show" : "hide" : val ]( prop ); + }); + }); + }, + queue: function(type,fn){ + if ( !fn ) { + fn = type; + type = "fx"; + } + + return this.each(function(){ + if ( !this.queue ) + this.queue = {}; + + if ( !this.queue[type] ) + this.queue[type] = []; + + this.queue[type].push( fn ); + + if ( this.queue[type].length == 1 ) + fn.apply(this); + }); + } + +}); + +jQuery.extend({ + + speed: function(speed, easing, fn) { + var opt = speed && speed.constructor == Object ? speed : { + complete: fn || !fn && easing || + jQuery.isFunction( speed ) && speed, + duration: speed, + easing: fn && easing || easing && easing.constructor != Function && easing || "swing" + }; + + opt.duration = (opt.duration && opt.duration.constructor == Number ? + opt.duration : + { slow: 600, fast: 200 }[opt.duration]) || 400; + + // Queueing + opt.old = opt.complete; + opt.complete = function(){ + jQuery.dequeue(this, "fx"); + if ( jQuery.isFunction( opt.old ) ) + opt.old.apply( this ); + }; + + return opt; + }, + + easing: { + linear: function( p, n, firstNum, diff ) { + return firstNum + diff * p; + }, + swing: function( p, n, firstNum, diff ) { + return ((-Math.cos(p*Math.PI)/2) + 0.5) * diff + firstNum; + } + }, + + queue: {}, + + dequeue: function(elem,type){ + type = type || "fx"; + + if ( elem.queue && elem.queue[type] ) { + // Remove self + elem.queue[type].shift(); + + // Get next function + var f = elem.queue[type][0]; + + if ( f ) f.apply( elem ); + } + }, + + timers: [], + + /* + * I originally wrote fx() as a clone of moo.fx and in the process + * of making it small in size the code became illegible to sane + * people. You've been warned. + */ + + fx: function( elem, options, prop ){ + + var z = this; + + // The styles + var y = elem.style; + + if ( prop == "height" || prop == "width" ) { + // Store display property + var oldDisplay = jQuery.css(elem, "display"); + + // Make sure that nothing sneaks out + var oldOverflow = y.overflow; + y.overflow = "hidden"; + } + + // Simple function for setting a style value + z.a = function(){ + if ( options.step ) + options.step.apply( elem, [ z.now ] ); + + if ( prop == "opacity" ) + jQuery.attr(y, "opacity", z.now); // Let attr handle opacity + else { + y[prop] = parseInt(z.now) + "px"; + y.display = "block"; // Set display property to block for animation + } + }; + + // Figure out the maximum number to run to + z.max = function(){ + return parseFloat( jQuery.css(elem,prop) ); + }; + + // Get the current size + z.cur = function(){ + var r = parseFloat( jQuery.curCSS(elem, prop) ); + return r && r > -10000 ? r : z.max(); + }; + + // Start an animation from one number to another + z.custom = function(from,to){ + z.startTime = (new Date()).getTime(); + z.now = from; + z.a(); + + jQuery.timers.push(function(){ + return z.step(from, to); + }); + + if ( jQuery.timers.length == 1 ) { + var timer = setInterval(function(){ + var timers = jQuery.timers; + + for ( var i = 0; i < timers.length; i++ ) + if ( !timers[i]() ) + timers.splice(i--, 1); + + if ( !timers.length ) + clearInterval( timer ); + }, 13); + } + }; + + // Simple 'show' function + z.show = function(){ + if ( !elem.orig ) elem.orig = {}; + + // Remember where we started, so that we can go back to it later + elem.orig[prop] = jQuery.attr( elem.style, prop ); + + options.show = true; + + // Begin the animation + z.custom(0, this.cur()); + + // Make sure that we start at a small width/height to avoid any + // flash of content + if ( prop != "opacity" ) + y[prop] = "1px"; + + // Start by showing the element + jQuery(elem).show(); + }; + + // Simple 'hide' function + z.hide = function(){ + if ( !elem.orig ) elem.orig = {}; + + // Remember where we started, so that we can go back to it later + elem.orig[prop] = jQuery.attr( elem.style, prop ); + + options.hide = true; + + // Begin the animation + z.custom(this.cur(), 0); + }; + + // Each step of an animation + z.step = function(firstNum, lastNum){ + var t = (new Date()).getTime(); + + if (t > options.duration + z.startTime) { + z.now = lastNum; + z.a(); + + if (elem.curAnim) elem.curAnim[ prop ] = true; + + var done = true; + for ( var i in elem.curAnim ) + if ( elem.curAnim[i] !== true ) + done = false; + + if ( done ) { + if ( oldDisplay != null ) { + // Reset the overflow + y.overflow = oldOverflow; + + // Reset the display + y.display = oldDisplay; + if ( jQuery.css(elem, "display") == "none" ) + y.display = "block"; + } + + // Hide the element if the "hide" operation was done + if ( options.hide ) + y.display = "none"; + + // Reset the properties, if the item has been hidden or shown + if ( options.hide || options.show ) + for ( var p in elem.curAnim ) + jQuery.attr(y, p, elem.orig[p]); + } + + // If a callback was provided, execute it + if ( done && jQuery.isFunction( options.complete ) ) + // Execute the complete function + options.complete.apply( elem ); + + return false; + } else { + var n = t - this.startTime; + // Figure out where in the animation we are and set the number + var p = n / options.duration; + + // Perform the easing function, defaults to swing + z.now = jQuery.easing[options.easing](p, n, firstNum, (lastNum-firstNum), options.duration); + + // Perform the next step of the animation + z.a(); + } + + return true; + }; + + } +}); +} Index: openacs-4/packages/xowiki/www/resources/wymeditor/jquery.wymeditor.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/resources/wymeditor/jquery.wymeditor.js,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xowiki/www/resources/wymeditor/jquery.wymeditor.js 15 Jul 2007 16:07:45 -0000 1.1 @@ -0,0 +1,2119 @@ +if(!WYM_STRINGS) var WYM_STRINGS = new Array(); + +var WYM_STRINGS_EN = { + Strong: 'Strong', + Emphasis: 'Emphasis', + Superscript: 'Superscript', + Subscript: 'Subscript', + Ordered_List: 'Ordered List', + Unordered_List: 'Unordered List', + Indent: 'Indent', + Outdent: 'Outdent', + Undo: 'Undo', + Redo: 'Redo', + Link: 'Link', + Unlink: 'Unlink', + Image: 'Image', + Table: 'Table', + HTML: 'HTML', + Paragraph: 'Paragraph', + Heading_1: 'Heading 1', + Heading_2: 'Heading 2', + Heading_3: 'Heading 3', + Heading_4: 'Heading 4', + Heading_5: 'Heading 5', + Heading_6: 'Heading 6', + Preformatted: 'Preformatted', + Blockquote: 'Blockquote', + Table_Header: 'Table Header', + URL: 'URL', + Title: 'Title', + Alternative_Text: 'Alternative text', + Caption: 'Caption', + Number_Of_Rows: 'Number of rows', + Number_Of_Cols: 'Number of cols', + Submit: 'Submit', + Cancel: 'Cancel', + Choose: 'Choose', + Preview: 'Preview', + Paste_From_Word: 'Paste from Word', + Tools: 'Tools', + Containers: 'Containers', + Classes: 'Classes', + Status: 'Status', + Source_Code: 'Source code' +}; + +WYM_STRINGS['en'] = WYM_STRINGS_EN; +if(!WYM_STRINGS) var WYM_STRINGS = new Array(); + +var WYM_STRINGS_DE = { + Strong: 'Fett', + Emphasis: 'Kursiv', + Superscript: 'Text hochstellen', + Subscript: 'Text tiefstellen', + Ordered_List: 'Geordnete Liste einfügen', + Unordered_List: 'Ungeordnete Liste einfügen', + Indent: 'Einzug erhöhen', + Outdent: 'Einzug vermindern', + Undo: 'Befehle rückgängig machen', + Redo: 'Befehle wiederherstellen', + Link: 'Hyperlink einfügen', + Unlink: 'Hyperlink entfernen', + Image: 'Bild einfügen', + Table: 'Tabelle einfügen', + HTML: 'HTML anzeigen/verstecken', + Paragraph: 'Absatz', + Heading_1: 'Überschrift 1', + Heading_2: 'Überschrift 2', + Heading_3: 'Überschrift 3', + Heading_4: 'Überschrift 4', + Heading_5: 'Überschrift 5', + Heading_6: 'Überschrift 6', + Preformatted: 'Vorformatiert', + Blockquote: 'Zitat', + Table_Header: 'Tabellenüberschrift', + URL: 'URL', + Title: 'Titel', + Alternative_Text: 'Alternativer Text', + Caption: 'Tabellenüberschrift', + Number_Of_Rows: 'Anzahl Zeilen', + Number_Of_Cols: 'Anzahl Spalten', + Submit: 'Absenden', + Cancel: 'Abbrechen', + Choose: 'Auswählen', + Preview: 'Vorschau', + Paste_From_Word: 'Aus Word einfügen', + Tools: 'Werkzeuge', + Containers: 'Inhaltstyp', + Classes: 'Klassen', + Status: 'Status', + Source_Code: 'Quellcode' +}; + +WYM_STRINGS['de'] = WYM_STRINGS_DE; +if(!WYM_STRINGS) var WYM_STRINGS = new Array(); + +var WYM_STRINGS_ES = { + Strong: 'Resaltar', + Emphasis: 'Enfatizar', + Superscript: 'Superindice', + Subscript: 'Subindice', + Ordered_List: 'Lista ordenada', + Unordered_List: 'Lista sin ordenar', + Indent: 'Indentado', + Outdent: 'Sin indentar', + Undo: 'Deshacer', + Redo: 'Rehacer', + Link: 'Enlazar', + Unlink: 'Eliminar enlace', + Image: 'Imagen', + Table: 'Tabla', + HTML: 'HTML', + Paragraph: 'Párrafo', + Heading_1: 'Cabecera 1', + Heading_2: 'Cabecera 2', + Heading_3: 'Cabecera 3', + Heading_4: 'Cabecera 4', + Heading_5: 'Cabecera 5', + Heading_6: 'Cabecera 6', + Preformatted: 'Preformateado', + Blockquote: 'Cita', + Table_Header: 'Cabecera de la tabla', + URL: 'URL', + Title: 'Título', + Alternative_Text: 'Texto alternativo', + Caption: 'Leyenda', + Number_Of_Rows: 'Número de filas', + Number_Of_Cols: 'Número de columnas', + Submit: 'Enviar', + Cancel: 'Cancelar', + Choose: 'Seleccionar', + Preview: 'Vista previa', + Paste_From_Word: 'Pegar desde Word', + Tools: 'Herramientas', + Containers: 'Contenedores', + Classes: 'Clases', + Status: 'Estado', + Source_Code: 'Código fuente' +}; + +WYM_STRINGS['es'] = WYM_STRINGS_ES; +if(!WYM_STRINGS) var WYM_STRINGS = new Array(); + +var WYM_STRINGS_FR = { + Strong: 'Mise en évidence', + Emphasis: 'Emphase', + Superscript: 'Exposant', + Subscript: 'Indice', + Ordered_List: 'Liste Ordonnée', + Unordered_List: 'Liste Non-Ordonnée', + Indent: 'Imbriqué', + Outdent: 'Non-imbriqué', + Undo: 'Annuler', + Redo: 'Rétablir', + Link: 'Lien', + Unlink: 'Supprimer le Lien', + Image: 'Image', + Table: 'Tableau', + HTML: 'HTML', + Paragraph: 'Paragraphe', + Heading_1: 'Titre 1', + Heading_2: 'Titre 2', + Heading_3: 'Titre 3', + Heading_4: 'Titre 4', + Heading_5: 'Titre 5', + Heading_6: 'Titre 6', + Preformatted: 'Pré-formatté', + Blockquote: 'Citation', + Table_Header: 'Cellule de titre', + URL: 'URL', + Title: 'Titre', + Alternative_Text: 'Texte alternatif', + Caption: 'Légende', + Number_Of_Rows: 'Nombre de lignes', + Number_Of_Cols: 'Nombre de colonnes', + Submit: 'Envoyer', + Cancel: 'Annuler', + Choose: 'Choisir', + Preview: 'Prévisualisation', + Paste_From_Word: 'Copier depuis Word', + Tools: 'Outils', + Containers: 'Type de texte', + Classes: 'Type de contenu', + Status: 'Infos', + Source_Code: 'Code source' +}; + +WYM_STRINGS['fr'] = WYM_STRINGS_FR; +/* + * WYMeditor : what you see is What You Mean web-based editor + * Copyright (C) 2007 H.O.net - http://www.honet.be/ + * Dual licensed under the MIT (MIT-license.txt) + * and GPL (GPL-license.txt) licenses. + * + * For further information visit: + * http://www.wymeditor.org/ + * + * File Name: + * jquery.wymeditor.js + * Main JS file with core class and functions. + * See the documentation for more info. + * + * File Authors: + * Jean-Francois Hovinne (jf.hovinne@wymeditor.org) + * Volker Mische (vmx@gmx.de) + * Scott Lewis (scott@bright-crayon.com) + * Bermi Ferrer (wymeditor a-t bermi dotorg) + * Daniel Reszka (d.reszka@wymeditor.org) + */ + + +/********** CONSTANTS **********/ + + var $j = jQuery.noConflict(); + + var WYM_INSTANCES = new Array(); + var WYM_NAME = "name"; + var WYM_INDEX = "{Wym_Index}"; + var WYM_BASE_PATH = "{Wym_Base_Path}"; + var WYM_CSS_PATH = "{Wym_Css_Path}"; + var WYM_IFRAME_BASE_PATH = "{Wym_Iframe_Base_Path}"; + var WYM_IFRAME_DEFAULT = "iframe/default/"; + var WYM_JQUERY_PATH = "{Wym_Jquery_Path}"; + var WYM_TOOLS = "{Wym_Tools}"; + var WYM_TOOLS_ITEMS = "{Wym_Tools_Items}"; + var WYM_TOOL_NAME = "{Wym_Tool_Name}"; + var WYM_TOOL_TITLE = "{Wym_Tool_Title}"; + var WYM_TOOL_CLASS = "{Wym_Tool_Class}"; + var WYM_CLASSES = "{Wym_Classes}"; + var WYM_CLASSES_ITEMS = "{Wym_Classes_Items}"; + var WYM_CLASS_NAME = "{Wym_Class_Name}"; + var WYM_CLASS_TITLE = "{Wym_Class_Title}"; + var WYM_CONTAINERS = "{Wym_Containers}"; + var WYM_CONTAINERS_ITEMS = "{Wym_Containers_Items}"; + var WYM_CONTAINER_NAME = "{Wym_Container_Name}"; + var WYM_CONTAINER_TITLE = "{Wym_Containers_Title}"; + var WYM_CONTAINER_CLASS = "{Wym_Container_Class}"; + var WYM_HTML = "{Wym_Html}"; + var WYM_IFRAME = "{Wym_Iframe}"; + var WYM_STATUS = "{Wym_Status}"; + var WYM_DIALOG_TITLE = "{Wym_Dialog_Title}"; + var WYM_DIALOG_BODY = "{Wym_Dialog_Body}"; + var WYM_BODY = "body"; + var WYM_STRING = "string"; + var WYM_P = "p"; + var WYM_H1 = "h1"; + var WYM_H2 = "h2"; + var WYM_H3 = "h3"; + var WYM_H4 = "h4"; + var WYM_H5 = "h5"; + var WYM_H6 = "h6"; + var WYM_PRE = "pre"; + var WYM_BLOCKQUOTE = "blockquote"; + var WYM_TD = "td"; + var WYM_TH = "th"; + var WYM_A = "a"; + var WYM_BR = "br"; + var WYM_IMG = "img"; + var WYM_TABLE = "table"; + var WYM_UL = "ul"; + var WYM_OL = "ol"; + var WYM_LI = "li"; + var WYM_CLASS = "class"; + var WYM_HREF = "href"; + var WYM_SRC = "src"; + var WYM_TITLE = "title"; + var WYM_ALT = "alt"; + var WYM_DIALOG_LINK = "Link"; + var WYM_DIALOG_IMAGE = "Image"; + var WYM_DIALOG_TABLE = "Table"; + var WYM_DIALOG_PASTE = "Paste_From_Word"; + var WYM_BOLD = "Bold"; + var WYM_ITALIC = "Italic"; + var WYM_CREATE_LINK = "CreateLink"; + var WYM_INSERT_IMAGE = "InsertImage"; + var WYM_INSERT_TABLE = "InsertTable"; + var WYM_PASTE = "Paste"; + var WYM_INDENT = "Indent"; + var WYM_OUTDENT = "Outdent"; + var WYM_TOGGLE_HTML = "ToggleHtml"; + var WYM_FORMAT_BLOCK = "FormatBlock"; + var WYM_PREVIEW = "Preview"; + + var WYM_DEFAULT_SKIN = "default"; + + var WYM_MAIN_CONTAINERS = new Array(WYM_P,WYM_H1,WYM_H2,WYM_H3,WYM_H4, + WYM_H5,WYM_H6,WYM_PRE,WYM_BLOCKQUOTE); + + var WYM_BLOCKS = new Array("address", "blockquote", "div", "dl", + "fieldset", "form", "h1", "h2", "h3", "h4", "h5", "h6", "hr", + "noscript", "ol", "p", "pre", "table", "ul", "dd", "dt", + "li", "tbody", "td", "tfoot", "th", "thead", "tr"); + + var WYM_KEY = { + BACKSPACE: 8, + ENTER: 13, + END: 35, + HOME: 36, + LEFT: 37, + UP: 38, + RIGHT: 39, + DOWN: 40, + CURSOR: new Array(37, 38, 39, 40), + DELETE: 46 + }; + + var WYM_NODE = { + ELEMENT: 1, + ATTRIBUTE: 2, + TEXT: 3 + }; + + +/********** JQUERY **********/ + +/** + * Replace an HTML element by WYMeditor + * + * @example $j(".wymeditor").wymeditor( + * { + * + * } + * ); + * @desc Example description here + * + * @name WYMeditor + * @description WYMeditor is a web-based WYSIWYM XHTML editor + * @param Hash hash A hash of parameters + * @option Integer iExample Description here + * @option String sExample Description here + * + * @type jQuery + * @cat Plugins/WYMeditor + * @author Jean-Francois Hovinne + */ +$j.fn.wymeditor = function(options) { + + options = $j.extend({ + + html: "", + + basePath: false, + + cssPath: false, + + iframeBasePath: false, + + jQueryPath: false, + + styles: false, + + stylesheet: false, + + lang: "en", + + boxHtml: "
" + + "
" + + WYM_TOOLS + + "
" + + "
" + + "
" + + WYM_CONTAINERS + + WYM_CLASSES + + "
" + + "
" + + WYM_HTML + + WYM_IFRAME + + WYM_STATUS + + "
" + + "
" + + "
" + + "
", + + iframeHtml:"
" + + "" + + "
", + + editorStyles: [], + + toolsHtml: "
" + + "

{Tools}

" + + "
    " + + WYM_TOOLS_ITEMS + + "
" + + "
", + + toolsItemHtml: "
  • " + + WYM_TOOL_TITLE + + "
  • ", + + toolsItems: [ + {'name': 'Bold', 'title': 'Strong', 'css': 'wym_tools_strong'}, + {'name': 'Italic', 'title': 'Emphasis', 'css': 'wym_tools_emphasis'}, + {'name': 'Superscript', 'title': 'Superscript', + 'css': 'wym_tools_superscript'}, + {'name': 'Subscript', 'title': 'Subscript', + 'css': 'wym_tools_subscript'}, + {'name': 'InsertOrderedList', 'title': 'Ordered_List', + 'css': 'wym_tools_ordered_list'}, + {'name': 'InsertUnorderedList', 'title': 'Unordered_List', + 'css': 'wym_tools_unordered_list'}, + {'name': 'Indent', 'title': 'Indent', 'css': 'wym_tools_indent'}, + {'name': 'Outdent', 'title': 'Outdent', 'css': 'wym_tools_outdent'}, + {'name': 'Undo', 'title': 'Undo', 'css': 'wym_tools_undo'}, + {'name': 'Redo', 'title': 'Redo', 'css': 'wym_tools_redo'}, + {'name': 'CreateLink', 'title': 'Link', 'css': 'wym_tools_link'}, + {'name': 'Unlink', 'title': 'Unlink', 'css': 'wym_tools_unlink'}, + {'name': 'InsertImage', 'title': 'Image', 'css': 'wym_tools_image'}, + {'name': 'InsertTable', 'title': 'Table', 'css': 'wym_tools_table'}, + {'name': 'Paste', 'title': 'Paste_From_Word', + 'css': 'wym_tools_paste'}, + {'name': 'ToggleHtml', 'title': 'HTML', 'css': 'wym_tools_html'}, + {'name': 'Preview', 'title': 'Preview', 'css': 'wym_tools_preview'} + ], + + containersHtml: "
    " + + "

    {Containers}

    " + + "
      " + + WYM_CONTAINERS_ITEMS + + "
    " + + "
    ", + + containersItemHtml:"
  • " + + "" + + WYM_CONTAINER_TITLE + + "
  • ", + + containersItems: [ + {'name': 'P', 'title': 'Paragraph', 'css': 'wym_containers_p'}, + {'name': 'H1', 'title': 'Heading_1', 'css': 'wym_containers_h1'}, + {'name': 'H2', 'title': 'Heading_2', 'css': 'wym_containers_h2'}, + {'name': 'H3', 'title': 'Heading_3', 'css': 'wym_containers_h3'}, + {'name': 'H4', 'title': 'Heading_4', 'css': 'wym_containers_h4'}, + {'name': 'H5', 'title': 'Heading_5', 'css': 'wym_containers_h5'}, + {'name': 'H6', 'title': 'Heading_6', 'css': 'wym_containers_h6'}, + {'name': 'PRE', 'title': 'Preformatted', 'css': 'wym_containers_pre'}, + {'name': 'BLOCKQUOTE', 'title': 'Blockquote', + 'css': 'wym_containers_blockquote'}, + {'name': 'TH', 'title': 'Table_Header', 'css': 'wym_containers_th'} + ], + + classesHtml: "
    " + + "

    {Classes}

      " + + WYM_CLASSES_ITEMS + + "
    ", + + classesItemHtml: "
  • " + + WYM_CLASS_TITLE + + "
  • ", + + classesItems: [], + + statusHtml: "
    " + + "

    {Status}

    " + + "
    ", + + htmlHtml: "
    " + + "

    {Source_Code}

    " + + "" + + "
    ", + + boxSelector: ".wym_box", + toolsSelector: ".wym_tools", + toolsListSelector: " ul", + containersSelector:".wym_containers", + classesSelector: ".wym_classes", + htmlSelector: ".wym_html", + iframeSelector: ".wym_iframe iframe", + statusSelector: ".wym_status", + toolSelector: ".wym_tools a", + containerSelector: ".wym_containers a", + classSelector: ".wym_classes a", + htmlValSelector: ".wym_html_val", + + hrefSelector: ".wym_href", + srcSelector: ".wym_src", + titleSelector: ".wym_title", + altSelector: ".wym_alt", + textSelector: ".wym_text", + + rowsSelector: ".wym_rows", + colsSelector: ".wym_cols", + captionSelector: ".wym_caption", + + submitSelector: ".wym_submit", + cancelSelector: ".wym_cancel", + previewSelector: "", + + dialogLinkSelector: ".wym_dialog_link", + dialogImageSelector: ".wym_dialog_image", + dialogTableSelector: ".wym_dialog_table", + dialogPasteSelector: ".wym_dialog_paste", + dialogPreviewSelector: ".wym_dialog_preview", + + updateSelector: ".wymupdate", + updateEvent: "click", + + dialogFeatures: "menubar=no,titlebar=no,toolbar=no,resizable=no" + + ",width=560,height=300,top=0,left=0", + + dialogHtml: "" + + "" + + "" + + "" + + WYM_DIALOG_TITLE + + "" + + "" + + "" + + "" + + WYM_DIALOG_BODY + + "", + + dialogLinkHtml: "" + + "
    " + + "
    " + + "{Link}" + + "
    " + + "" + + "" + + "
    " + + "
    " + + "" + + "" + + "
    " + + "
    " + + "" + + "" + + "
    " + + "
    " + + "" + + "", + + dialogImageHtml: "" + + "
    " + + "
    " + + "{Image}" + + "
    " + + "" + + "" + + "
    " + + "
    " + + "" + + "" + + "
    " + + "
    " + + "" + + "" + + "
    " + + "
    " + + "" + + "" + + "
    " + + "
    " + + "" + + "", + + dialogTableHtml: "" + + "
    " + + "
    " + + "{Table}" + + "
    " + + "" + + "" + + "
    " + + "
    " + + "" + + "" + + "
    " + + "
    " + + "" + + "" + + "
    " + + "
    " + + "" + + "" + + "
    " + + "
    " + + "" + + "", + + dialogPasteHtml: "" + + "
    " + + "
    " + + "{Paste_From_Word}" + + "
    " + + "" + + "
    " + + "
    " + + "" + + "" + + "
    " + + "
    " + + "" + + "", + + dialogPreviewHtml: "", + + dialogStyles: [], + + skin: WYM_DEFAULT_SKIN, + + stringDelimiterLeft: "{", + stringDelimiterRight:"}", + + preInit: null, + preBind: null, + postInit: null, + + preInitDialog: null, + postInitDialog: null + + }, options); + + return this.each(function(i) { + + new Wymeditor($j(this),i,options); + }); +}; + +/* @name extend + * @description Returns the WYMeditor instance based on its index + */ +$j.extend({ + wymeditors: function(i) { + return (WYM_INSTANCES[i]); + }, + wymstrings: function(lang, sKey) { + return (WYM_STRINGS[lang][sKey]); + } +}); + + +/********** WYMEDITOR **********/ + +/* @name Wymeditor + * @description WYMeditor class + */ +function Wymeditor(elem,index,options) { + + WYM_INSTANCES[index] = this; + + this._element = elem; + this._index = index; + this._options = options; + this._html = $j(elem).val(); + + if(this._options.html) this._html = this._options.html; + this._options.basePath = this._options.basePath + || this.computeBasePath(); + this._options.cssPath = this._options.cssPath + || this.computeCssPath(); + this._options.iframeBasePath = this._options.iframeBasePath + || this._options.basePath + WYM_IFRAME_DEFAULT; + this._options.jQueryPath = this._options.jQueryPath + || this.computeJqueryPath(); + + this.init(); + +}; + +/* @name init + * @description Initializes a WYMeditor instance + */ +Wymeditor.prototype.init = function() { + + //load subclass - browser specific + //unsupported browsers: do nothing + if ($j.browser.msie) { + var WymClass = new WymClassExplorer(this); + } + else if ($j.browser.mozilla) { + var WymClass = new WymClassMozilla(this); + } + else if ($j.browser.opera) { + var WymClass = new WymClassOpera(this); + } + else if ($j.browser.safari) { + //commented until supported + //var WymClass = new WymClassSafari(this); + } + + + if(WymClass) { + + if($j.isFunction(this._options.preInit)) this._options.preInit(this); + + this.loadXhtmlParser(WymClass); + + if(this._options.styles || this._options.stylesheet){ + this.configureEditorUsingRawCss(); + } + + this.helper = new XmlHelper(); + + //extend the Wymeditor object + $j.extend(this, WymClass); + + //load wymbox + this._box = $j(this._element).hide().after(this._options.boxHtml).next(); + + //construct the iframe + var iframeHtml = this._options.iframeHtml; + iframeHtml = iframeHtml + .replaceAll(WYM_INDEX,this._index) + .replaceAll(WYM_IFRAME_BASE_PATH, this._options.iframeBasePath); + + //construct wymbox + var boxHtml = $j(this._box).html(); + + boxHtml = boxHtml.replaceAll(WYM_TOOLS, this._options.toolsHtml); + boxHtml = boxHtml.replaceAll(WYM_CONTAINERS,this._options.containersHtml); + boxHtml = boxHtml.replaceAll(WYM_CLASSES, this._options.classesHtml); + boxHtml = boxHtml.replaceAll(WYM_HTML, this._options.htmlHtml); + boxHtml = boxHtml.replaceAll(WYM_IFRAME, iframeHtml); + boxHtml = boxHtml.replaceAll(WYM_STATUS, this._options.statusHtml); + + //construct tools list + var aTools = eval(this._options.toolsItems); + var sTools = ""; + + for(var i = 0; i < aTools.length; i++) { + var oTool = aTools[i]; + if(oTool.name && oTool.title) + sTools += this._options.toolsItemHtml + .replaceAll(WYM_TOOL_NAME, oTool.name) + .replaceAll(WYM_TOOL_TITLE, + this._options.stringDelimiterLeft + + oTool.title + + this._options.stringDelimiterRight) + .replaceAll(WYM_TOOL_CLASS, oTool.css); + } + + boxHtml = boxHtml.replaceAll(WYM_TOOLS_ITEMS, sTools); + + //construct classes list + var aClasses = eval(this._options.classesItems); + var sClasses = ""; + + for(var i = 0; i < aClasses.length; i++) { + var oClass = aClasses[i]; + if(oClass.name && oClass.title) + sClasses += this._options.classesItemHtml + .replaceAll(WYM_CLASS_NAME, oClass.name) + .replaceAll(WYM_CLASS_TITLE, oClass.title); + } + + boxHtml = boxHtml.replaceAll(WYM_CLASSES_ITEMS, sClasses); + + //construct containers list + var aContainers = eval(this._options.containersItems); + var sContainers = ""; + + for(var i = 0; i < aContainers.length; i++) { + var oContainer = aContainers[i]; + if(oContainer.name && oContainer.title) + sContainers += this._options.containersItemHtml + .replaceAll(WYM_CONTAINER_NAME, oContainer.name) + .replaceAll(WYM_CONTAINER_TITLE, + this._options.stringDelimiterLeft + + oContainer.title + + this._options.stringDelimiterRight) + .replaceAll(WYM_CONTAINER_CLASS, oContainer.css); + } + + boxHtml = boxHtml.replaceAll(WYM_CONTAINERS_ITEMS, sContainers); + + //l10n + boxHtml = this.replaceStrings(boxHtml); + + //load html in wymbox + $j(this._box).html(boxHtml); + + //hide the html value + $j(this._box).find(this._options.htmlSelector).hide(); + + //enable the skin + this.skin(); + + } +}; + +Wymeditor.prototype.bindEvents = function() { + + //copy the instance + var wym = this; + + //handle click event on tools buttons + $j(this._box).find(this._options.toolSelector).click(function() { + wym.exec($j(this).attr(WYM_NAME)); + return(false); + }); + + //handle click event on containers buttons + $j(this._box).find(this._options.containerSelector).click(function() { + wym.container($j(this).attr(WYM_NAME)); + return(false); + }); + + //handle keyup event on html value: set the editor value + $j(this._box).find(this._options.htmlValSelector).keyup(function() { + $j(wym._doc.body).html($j(this).val()); + }); + + //handle click event on classes buttons + $j(this._box).find(this._options.classSelector).click(function() { + + var aClasses = eval(wym._options.classesItems); + var sName = $j(this).attr(WYM_NAME); + + var oClass = aClasses.findByName(sName); + + if(oClass) { + jqexpr = oClass.expr; + wym.toggleClass(sName, jqexpr); + } + return(false); + }); + + //handle event on update element + $j(this._options.updateSelector) + .bind(this._options.updateEvent, function() { + wym.update(); + }); +}; + +Wymeditor.prototype.ready = function() { + return(this._doc != null); +}; + + +/********** METHODS **********/ + +/* @name box + * @description Returns the WYMeditor container + */ +Wymeditor.prototype.box = function() { + return(this._box); +}; + +/* @name html + * @description Get/Set the html value + */ +Wymeditor.prototype.html = function(html) { + + if(html) $j(this._doc.body).html(html); + else return($j(this._doc.body).html()); +}; + +/* @name xhtml + * @description Cleans up the HTML + */ +Wymeditor.prototype.xhtml = function() { + return this.parser.parse(this.html()); +}; + +/* @name exec + * @description Executes a button command + */ +Wymeditor.prototype.exec = function(cmd) { + + //base function for execCommand + //open a dialog or exec + switch(cmd) { + case WYM_CREATE_LINK: + var container = this.container(); + if(container || this._selected_image) this.dialog(WYM_DIALOG_LINK); + break; + + case WYM_INSERT_IMAGE: + this.dialog(WYM_DIALOG_IMAGE); + break; + + case WYM_INSERT_TABLE: + this.dialog(WYM_DIALOG_TABLE); + break; + + case WYM_PASTE: + this.dialog(WYM_DIALOG_PASTE); + break; + + case WYM_TOGGLE_HTML: + this.update(); + this.toggleHtml(); + break; + + case WYM_PREVIEW: + this.dialog(WYM_PREVIEW); + break; + + default: + this._exec(cmd); + break; + } +}; + +/* @name container + * @description Get/Set the selected container + */ +Wymeditor.prototype.container = function(sType) { + + if(sType) { + + var container = null; + + if(sType.toLowerCase() == WYM_TH) { + + container = this.container(); + + //find the TD or TH container + switch(container.tagName.toLowerCase()) { + + case WYM_TD: case WYM_TH: + break; + default: + var aTypes = new Array(WYM_TD,WYM_TH); + container = this.findUp(this.container(), aTypes); + break; + } + + //if it exists, switch + if(container!=null) { + + sType = (container.tagName.toLowerCase() == WYM_TD)? WYM_TH: WYM_TD; + this.switchTo(container,sType); + this.update(); + } + } else { + + //set the container type + var aTypes=new Array(WYM_P,WYM_H1,WYM_H2,WYM_H3,WYM_H4,WYM_H5, + WYM_H6,WYM_PRE,WYM_BLOCKQUOTE); + container = this.findUp(this.container(), aTypes); + + if(container) { + + var newNode = null; + + //blockquotes must contain a block level element + if(sType.toLowerCase() == WYM_BLOCKQUOTE) { + + var blockquote = this.findUp(this.container(), WYM_BLOCKQUOTE); + + if(blockquote == null) { + + newNode = this._doc.createElement(sType); + container.parentNode.insertBefore(newNode,container); + newNode.appendChild(container); + this.setFocusToNode(newNode.firstChild); + + } else { + + var nodes = blockquote.childNodes; + var lgt = nodes.length; + var firstNode = null; + + if(lgt > 0) firstNode = nodes.item(0); + for(var x=0; x= 0; x--) { + sTmp = aP[x]; + //simple newlines are replaced by a break + sTmp = sTmp.replace(rExp, "
    "); + $j(container).after("

    " + sTmp + "

    "); + } + } else { + for(x = 0; x < aP.length; x++) { + sTmp = aP[x]; + //simple newlines are replaced by a break + sTmp = sTmp.replace(rExp, "
    "); + $j(this._doc.body).append("

    " + sTmp + "

    "); + } + + } +}; + +Wymeditor.prototype.addCssRules = function(doc, aCss) { + var styles = doc.styleSheets[0]; + if(styles) { + for(var i = 0; i < aCss.length; i++) { + var oCss = aCss[i]; + if(oCss.name && oCss.css) this.addCssRule(styles, oCss); + } + } +}; + +/********** CONFIGURATION **********/ + +Wymeditor.prototype.computeBasePath = function() { + return $j($j.grep($j('script'), function(s){ + return (s.src && s.src.match(/jquery\.wymeditor\.js(\?.*)?$/ )) + })).attr('src').replace(/jquery\.wymeditor\.js(\?.*)?$/, ''); +}; + +Wymeditor.prototype.computeJqueryPath = function() { + return $j($j.grep($j('script'), function(s){ + return (s.src && s.src.match(/jquery\.js(\?.*)?$/ )) + })).attr('src'); +}; + +Wymeditor.prototype.computeCssPath = function() { + return $j($j.grep($j('link'), function(s){ + return (s.href && s.href.match(/wymeditor\/skins\/(.*)screen\.css(\?.*)?$/ )) + })).attr('href'); +}; + +Wymeditor.prototype.loadXhtmlParser = function(WymClass) { + if(typeof XhtmlSaxListener != 'function'){ + // This is the only way to get loaded functions in the global scope until jQuery.globalEval works in safari + eval($j.ajax({url:this._options.basePath+'xhtml_parser.js',async:false}).responseText); + window.XmlHelper = XmlHelper; + window.XhtmlValidator = XhtmlValidator; + window.ParallelRegex = ParallelRegex; + window.StateStack = StateStack; + window.Lexer = Lexer; + window.XhtmlLexer = XhtmlLexer; + window.XhtmlParser = XhtmlParser; + window.XhtmlSaxListener = XhtmlSaxListener; + + } + var SaxListener = new XhtmlSaxListener(); + jQuery.extend(SaxListener, WymClass); + this.parser = new XhtmlParser(SaxListener); +}; + +Wymeditor.prototype.configureEditorUsingRawCss = function() { + if(typeof WymCssParser != 'function'){ + eval($j.ajax({url:this._options.basePath+'wym_css_parser.js',async:false}).responseText); + window.WymCssLexer = WymCssLexer; + window.WymCssParser = WymCssParser; + } + var CssParser = new WymCssParser(); + if(this._options.stylesheet){ + CssParser.parse($j.ajax({url: this._options.stylesheet,async:false}).responseText); + }else{ + CssParser.parse(this._options.styles, false); + } + + if(this._options.classesItems.length == 0) { + this._options.classesItems = CssParser.css_settings.classesItems; + } + if(this._options.editorStyles.length == 0) { + this._options.editorStyles = CssParser.css_settings.editorStyles; + } + if(this._options.dialogStyles.length == 0) { + this._options.dialogStyles = CssParser.css_settings.dialogStyles; + } +}; + +/********** EVENTS **********/ + +Wymeditor.prototype.listen = function() { + + //don't use jQuery.find() on the iframe body + //because of MSIE + jQuery + expando issue (#JQ1143) + //$j(this._doc.body).find("*").bind("mouseup", this.mouseup); + + $j(this._doc.body).bind("mouseup", this.mouseup); + var images = this._doc.body.getElementsByTagName("img"); + for(var i=0; i < images.length; i++) { + $j(images[i]).bind("mouseup", this.mouseup); + } +}; + +//mouseup handler +Wymeditor.prototype.mouseup = function(evt) { + + var wym = WYM_INSTANCES[this.ownerDocument.title]; + if(this.tagName.toLowerCase() == WYM_IMG) wym._selected_image = this; + else wym._selected_image = null; + evt.stopPropagation(); +}; + +/********** SKINS **********/ + +Wymeditor.prototype.skin = function() { + + switch(this._options.skin) { + + case WYM_DEFAULT_SKIN: + + $j(this._box).addClass("wym_skin_default"); + + //render following sections as panels + $j(this._box).find(this._options.classesSelector) + .addClass("wym_panel"); + + //render following sections as buttons + $j(this._box).find(this._options.toolsSelector) + .addClass("wym_buttons"); + + //render following sections as dropdown menus + $j(this._box).find(this._options.containersSelector) + .addClass("wym_dropdown") + .find(WYM_H2) + .append(" >"); + + // auto add some margin to the main area sides if left area + // or right area are not empty (if they contain sections) + $j(this._box).find("div.wym_area_right ul") + .parents("div.wym_area_right").show() + .parents(this._options.boxSelector) + .find("div.wym_area_main") + .css({"margin-right": "155px"}); + + $j(this._box).find("div.wym_area_left ul") + .parents("div.wym_area_left").show() + .parents(this._options.boxSelector) + .find("div.wym_area_main") + .css({"margin-left": "155px"}); + + //make hover work under IE < 7 + $j(this._box).find(".wym_section").hover(function(){ + $j(this).addClass("hover"); + },function(){ + $j(this).removeClass("hover"); + }); + + break; + + } + +}; + +/********** DIALOGS **********/ + +function WYM_INIT_DIALOG(index) { + + var wym = window.opener.WYM_INSTANCES[index]; + var doc = window.document; + var selected = wym.selected(); + var sStamp = wym.uniqueStamp(); + + //fix MSIE selection if link image has been clicked + if(!selected && wym._selected_image) { + selected = $j(wym._selected_image).parentsOrSelf(WYM_A); + } + + //pre-init functions + if($j.isFunction(wym._options.preInitDialog)) + wym._options.preInitDialog(wym,window); + + //add css rules from options + var styles = doc.styleSheets[0]; + var aCss = eval(wym._options.dialogStyles); + + wym.addCssRules(doc, aCss); + + //auto populate fields if selected container (e.g. A) + if(selected) { + $j(wym._options.hrefSelector).val($j(selected).attr(WYM_HREF)); + $j(wym._options.srcSelector).val($j(selected).attr(WYM_SRC)); + $j(wym._options.titleSelector).val($j(selected).attr(WYM_TITLE)); + $j(wym._options.altSelector).val($j(selected).attr(WYM_ALT)); + } + + //auto populate image fields if selected image + if(wym._selected_image) { + $j(wym._options.dialogImageSelector + " " + wym._options.srcSelector) + .val($j(wym._selected_image).attr(WYM_SRC)); + $j(wym._options.dialogImageSelector + " " + wym._options.titleSelector) + .val($j(wym._selected_image).attr(WYM_TITLE)); + $j(wym._options.dialogImageSelector + " " + wym._options.altSelector) + .val($j(wym._selected_image).attr(WYM_ALT)); + } + + $j(wym._options.dialogLinkSelector + " " + + wym._options.submitSelector).click(function() { + + var sUrl = $j(wym._options.hrefSelector).val(); + if(sUrl.length > 0) { + wym._exec(WYM_CREATE_LINK, sStamp); + //don't use jQuery.find() see #JQ1143 + //var link = $j(wym._doc.body).find("a[@href=" + sStamp + "]"); + var link = null; + var nodes = wym._doc.body.getElementsByTagName(WYM_A); + for(var i=0; i < nodes.length; i++) { + if($j(nodes[i]).attr(WYM_HREF) == sStamp) { + link = $j(nodes[i]); + break; + } + } + if(link) { + link.attr(WYM_HREF, sUrl); + link.attr(WYM_TITLE, $j(wym._options.titleSelector).val()); + } + } + window.close(); + }); + + $j(wym._options.dialogImageSelector + " " + + wym._options.submitSelector).click(function() { + + var sUrl = $j(wym._options.srcSelector).val(); + if(sUrl.length > 0) { + wym._exec(WYM_INSERT_IMAGE, sStamp); + //don't use jQuery.find() see #JQ1143 + //var image = $j(wym._doc.body).find("img[@src=" + sStamp + "]"); + var image = null; + var nodes = wym._doc.body.getElementsByTagName(WYM_IMG); + for(var i=0; i < nodes.length; i++) { + if($j(nodes[i]).attr(WYM_SRC) == sStamp) { + image = $j(nodes[i]); + break; + } + } + if(image) { + image.attr(WYM_SRC, sUrl); + image.attr(WYM_TITLE, $j(wym._options.titleSelector).val()); + image.attr(WYM_ALT, $j(wym._options.altSelector).val()); + } + } + window.close(); + }); + + $j(wym._options.dialogTableSelector + " " + + wym._options.submitSelector).click(function() { + + var iRows = $j(wym._options.rowsSelector).val(); + var iCols = $j(wym._options.colsSelector).val(); + + if(iRows > 0 && iCols > 0) { + + var table = wym._doc.createElement(WYM_TABLE); + var newRow = null; + var newCol = null; + + var sCaption = $j(wym._options.captionSelector).val(); + + //we create the caption + var newCaption = table.createCaption(); + newCaption.innerHTML = sCaption; + + //we create the rows and cells + for(x=0; x]*)>/gi, "") + .replace(/<\/em>/gi, "") + .replace(/]*)>/gi, "") + .replace(/<\/strong>/gi, ""); + + //update the html body + $j(this._doc.body).html(html); + + //re-init designMode + this.enableDesignMode(); + } + else return($j(this._doc.body).html()); +}; + +WymClassMozilla.prototype._exec = function(cmd,param) { + + switch(cmd) { + + case WYM_INDENT: case WYM_OUTDENT: + + var focusNode = this.selected(); + var sel = this._iframe.contentWindow.getSelection(); + var anchorNode = sel.anchorNode; + if(anchorNode.nodeName == "#text") anchorNode = anchorNode.parentNode; + + focusNode = this.findUp(focusNode, WYM_BLOCKS); + anchorNode = this.findUp(anchorNode, WYM_BLOCKS); + + if(focusNode && focusNode == anchorNode + && focusNode.tagName.toLowerCase() == WYM_LI) { + + var ancestor = focusNode.parentNode.parentNode; + + if(focusNode.parentNode.childNodes.length>1 + || ancestor.tagName.toLowerCase() == WYM_OL + || ancestor.tagName.toLowerCase() == WYM_UL) + this._doc.execCommand(cmd,'',null); + } + + break; + + default: + + if(param) this._doc.execCommand(cmd,'',param); + else this._doc.execCommand(cmd,'',null); + } + + //set to P if parent = BODY + var container = this.selected(); + if(container.tagName.toLowerCase() == WYM_BODY) + this._exec(WYM_FORMAT_BLOCK, WYM_P); + + //add event handlers on doc elements + + this.listen(); +}; + +/* @name selected + * @description Returns the selected container + */ +WymClassMozilla.prototype.selected = function() { + + var sel = this._iframe.contentWindow.getSelection(); + var node = sel.focusNode; + if(node) { + if(node.nodeName == "#text") return(node.parentNode); + else return(node); + } else return(null); +}; + +WymClassMozilla.prototype.addCssRule = function(styles, oCss) { + + styles.insertRule(oCss.name + " {" + oCss.css + "}", + styles.cssRules.length); +}; + + +//keydown handler, mainly used for keyboard shortcuts +WymClassMozilla.prototype.keydown = function(evt) { + + //'this' is the doc + var wym = WYM_INSTANCES[this.title]; + + if(evt.ctrlKey){ + if(evt.keyCode == 66){ + //CTRL+b => STRONG + wym._exec(WYM_BOLD); + return false; + } + if(evt.keyCode == 73){ + //CTRL+i => EMPHASIS + wym._exec(WYM_ITALIC); + return false; + } + } +}; + +//keyup handler, mainly used for cleanups +WymClassMozilla.prototype.keyup = function(evt) { + + //'this' is the doc + var wym = WYM_INSTANCES[this.title]; + + wym._selected_image = null; + + if(evt.keyCode == 13 && !evt.shiftKey) { + + //RETURN key + //cleanup

    between paragraphs + $j(wym._doc.body).children(WYM_BR).remove(); + } + + else if(evt.keyCode != 8 + && evt.keyCode != 17 + && evt.keyCode != 46 + && evt.keyCode != 224 + && !evt.metaKey + && !evt.ctrlKey) { + + //NOT BACKSPACE, NOT DELETE, NOT CTRL, NOT COMMAND + //text nodes replaced by P + + var container = wym.selected(); + var name = container.tagName.toLowerCase(); + + //fix forbidden main containers + if( + name == "strong" || + name == "b" || + name == "em" || + name == "i" || + name == "sub" || + name == "sup" || + name == "a" + + ) name = container.parentNode.tagName.toLowerCase(); + + if(name == WYM_BODY) wym._exec(WYM_FORMAT_BLOCK, WYM_P); + } +}; + +WymClassMozilla.prototype.enableDesignMode = function() { + if(this.designMode == "off") { + try { + this.designMode = "on"; + this.execCommand("styleWithCSS", '', false); + } catch(e) { } + } +}; + +WymClassMozilla.prototype.setFocusToNode = function(node) { + var range = document.createRange(); + range.selectNode(node); + var selected = this._iframe.contentWindow.getSelection(); + selected.addRange(range); + selected.collapse(node, node.childNodes.length); + this._iframe.contentWindow.focus(); +}; + +WymClassMozilla.prototype.openBlockTag = function(tag, attributes) +{ + var attributes = this.validator.getValidTagAttributes(tag, attributes); + + // Handle Mozilla styled spans + if(tag == 'span' && attributes.style){ + var new_tag = this.getTagForStyle(attributes.style); + if(new_tag){ + this._tag_stack.pop(); + var tag = new_tag; + this._tag_stack.push(new_tag); + attributes.style = ''; + }else{ + return; + } + } + + if(tag != 'li' && (tag == 'ul' || tag == 'ol') && this.last_tag && !this.last_tag_opened && this.last_tag == 'li'){ + this.output = this.output.replace(/<\/li>$/, ''); + this.insertContentAfterClosingTag(tag, ''); + } + + this.output += this.helper.tag(tag, attributes, true); +}; + +WymClassMozilla.prototype.closeBlockTag = function(tag) +{ + this.output = this.output.replace(/
    $/, '')+this._getClosingTagContent('before', tag)+""+this._getClosingTagContent('after', tag); +}; + +WymClassMozilla.prototype.getTagForStyle = function(style) { + + if(/bold/.test(style)) return 'strong'; + if(/italic/.test(style)) return 'em'; + if(/sub/.test(style)) return 'sub'; + if(/sub/.test(style)) return 'super'; + return false; +}; +/* + * WYMeditor : what you see is What You Mean web-based editor + * Copyright (C) 2007 H.O.net - http://www.honet.be/ + * Dual licensed under the MIT (MIT-license.txt) + * and GPL (GPL-license.txt) licenses. + * + * For further information visit: + * http://www.wymeditor.org/ + * + * File Name: + * jquery.wymeditor.opera.js + * Opera specific class and functions. + * See the documentation for more info. + * + * File Authors: + * Jean-Francois Hovinne (jf.hovinne@wymeditor.org) + */ + +function WymClassOpera(wym) { + + this._wym = wym; + this._class = "class"; + this._newLine = "\r\n"; +}; + +WymClassOpera.prototype.initIframe = function(iframe) { + + this._iframe = iframe; + this._doc = iframe.contentWindow.document; + + //add css rules from options + var styles = this._doc.styleSheets[0]; + var aCss = eval(this._options.editorStyles); + + this.addCssRules(this._doc, aCss); + + this._doc.title = this._wym._index; + + //init designMode + this._doc.designMode = "on"; + + //init html value + this.html(this._wym._html); + + //pre-bind functions + if($j.isFunction(this._options.preBind)) this._options.preBind(this); + + //hide indent and outdent until supported + $j(this._box).find(this._options.toolSelector + + '[@name=' + WYM_INDENT +']').hide(); + $j(this._box).find(this._options.toolSelector + + '[@name=' + WYM_OUTDENT +']').hide(); + + //bind external events + this._wym.bindEvents(); + + //bind editor events + $j(this._doc).bind("keyup", this.keyup); + + //post-init functions + if($j.isFunction(this._options.postInit)) this._options.postInit(this); + + //add event listeners to doc elements, e.g. images + this.listen(); +}; + +WymClassOpera.prototype._exec = function(cmd,param) { + + switch(cmd) { + + case WYM_INDENT: case WYM_OUTDENT: + //TODO: support nested lists + //Opera creates blockquotes + this.status("Unsupported feature."); + break; + default: + if(param) this._doc.execCommand(cmd,false,param); + else this._doc.execCommand(cmd); + break; + } + + this.listen(); +}; + +WymClassOpera.prototype.selected = function() { + + var sel=this._iframe.contentWindow.getSelection(); + var node=sel.focusNode; + if(node) { + if(node.nodeName=="#text")return(node.parentNode); + else return(node); + } else return(null); +}; + +WymClassOpera.prototype.addCssRule = function(styles, oCss) { + + styles.insertRule(oCss.name + " {" + oCss.css + "}", + styles.cssRules.length); +}; + +//keyup handler +WymClassOpera.prototype.keyup = function(evt) { + + //'this' is the doc + var wym = WYM_INSTANCES[this.title]; + wym._selected_image = null; +}; + +// TODO: implement me +WymClassOpera.prototype.setFocusToNode = function(node) { + +}; Index: openacs-4/packages/xowiki/www/resources/wymeditor/jquery.wymeditor.pack.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/resources/wymeditor/jquery.wymeditor.pack.js,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xowiki/www/resources/wymeditor/jquery.wymeditor.pack.js 15 Jul 2007 16:07:45 -0000 1.1 @@ -0,0 +1 @@ +if(!WYM_STRINGS)var WYM_STRINGS=new Array();var WYM_STRINGS_EN={Strong:'Strong',Emphasis:'Emphasis',Superscript:'Superscript',Subscript:'Subscript',Ordered_List:'Ordered List',Unordered_List:'Unordered List',Indent:'Indent',Outdent:'Outdent',Undo:'Undo',Redo:'Redo',Link:'Link',Unlink:'Unlink',Image:'Image',Table:'Table',HTML:'HTML',Paragraph:'Paragraph',Heading_1:'Heading 1',Heading_2:'Heading 2',Heading_3:'Heading 3',Heading_4:'Heading 4',Heading_5:'Heading 5',Heading_6:'Heading 6',Preformatted:'Preformatted',Blockquote:'Blockquote',Table_Header:'Table Header',URL:'URL',Title:'Title',Alternative_Text:'Alternative text',Caption:'Caption',Number_Of_Rows:'Number of rows',Number_Of_Cols:'Number of cols',Submit:'Submit',Cancel:'Cancel',Choose:'Choose',Preview:'Preview',Paste_From_Word:'Paste from Word',Tools:'Tools',Containers:'Containers',Classes:'Classes',Status:'Status',Source_Code:'Source code'};WYM_STRINGS['en']=WYM_STRINGS_EN;if(!WYM_STRINGS)var WYM_STRINGS=new Array();var WYM_STRINGS_DE={Strong:'Fett',Emphasis:'Kursiv',Superscript:'Text hochstellen',Subscript:'Text tiefstellen',Ordered_List:'Geordnete Liste einfügen',Unordered_List:'Ungeordnete Liste einfügen',Indent:'Einzug erhöhen',Outdent:'Einzug vermindern',Undo:'Befehle rückgängig machen',Redo:'Befehle wiederherstellen',Link:'Hyperlink einfügen',Unlink:'Hyperlink entfernen',Image:'Bild einfügen',Table:'Tabelle einfügen',HTML:'HTML anzeigen/verstecken',Paragraph:'Absatz',Heading_1:'Überschrift 1',Heading_2:'Überschrift 2',Heading_3:'Überschrift 3',Heading_4:'Überschrift 4',Heading_5:'Überschrift 5',Heading_6:'Überschrift 6',Preformatted:'Vorformatiert',Blockquote:'Zitat',Table_Header:'Tabellenüberschrift',URL:'URL',Title:'Titel',Alternative_Text:'Alternativer Text',Caption:'Tabellenüberschrift',Number_Of_Rows:'Anzahl Zeilen',Number_Of_Cols:'Anzahl Spalten',Submit:'Absenden',Cancel:'Abbrechen',Choose:'Auswählen',Preview:'Vorschau',Paste_From_Word:'Aus Word einfügen',Tools:'Werkzeuge',Containers:'Inhaltstyp',Classes:'Klassen',Status:'Status',Source_Code:'Quellcode'};WYM_STRINGS['de']=WYM_STRINGS_DE;if(!WYM_STRINGS)var WYM_STRINGS=new Array();var WYM_STRINGS_ES={Strong:'Resaltar',Emphasis:'Enfatizar',Superscript:'Superindice',Subscript:'Subindice',Ordered_List:'Lista ordenada',Unordered_List:'Lista sin ordenar',Indent:'Indentado',Outdent:'Sin indentar',Undo:'Deshacer',Redo:'Rehacer',Link:'Enlazar',Unlink:'Eliminar enlace',Image:'Imagen',Table:'Tabla',HTML:'HTML',Paragraph:'Párrafo',Heading_1:'Cabecera 1',Heading_2:'Cabecera 2',Heading_3:'Cabecera 3',Heading_4:'Cabecera 4',Heading_5:'Cabecera 5',Heading_6:'Cabecera 6',Preformatted:'Preformateado',Blockquote:'Cita',Table_Header:'Cabecera de la tabla',URL:'URL',Title:'Título',Alternative_Text:'Texto alternativo',Caption:'Leyenda',Number_Of_Rows:'Número de filas',Number_Of_Cols:'Número de columnas',Submit:'Enviar',Cancel:'Cancelar',Choose:'Seleccionar',Preview:'Vista previa',Paste_From_Word:'Pegar desde Word',Tools:'Herramientas',Containers:'Contenedores',Classes:'Clases',Status:'Estado',Source_Code:'Código fuente'};WYM_STRINGS['es']=WYM_STRINGS_ES;if(!WYM_STRINGS)var WYM_STRINGS=new Array();var WYM_STRINGS_FR={Strong:'Mise en évidence',Emphasis:'Emphase',Superscript:'Exposant',Subscript:'Indice',Ordered_List:'Liste Ordonnée',Unordered_List:'Liste Non-Ordonnée',Indent:'Imbriqué',Outdent:'Non-imbriqué',Undo:'Annuler',Redo:'Rétablir',Link:'Lien',Unlink:'Supprimer le Lien',Image:'Image',Table:'Tableau',HTML:'HTML',Paragraph:'Paragraphe',Heading_1:'Titre 1',Heading_2:'Titre 2',Heading_3:'Titre 3',Heading_4:'Titre 4',Heading_5:'Titre 5',Heading_6:'Titre 6',Preformatted:'Pré-formatté',Blockquote:'Citation',Table_Header:'Cellule de titre',URL:'URL',Title:'Titre',Alternative_Text:'Texte alternatif',Caption:'Légende',Number_Of_Rows:'Nombre de lignes',Number_Of_Cols:'Nombre de colonnes',Submit:'Envoyer',Cancel:'Annuler',Choose:'Choisir',Preview:'Prévisualisation',Paste_From_Word:'Copier depuis Word',Tools:'Outils',Containers:'Type de texte',Classes:'Type de contenu',Status:'Infos',Source_Code:'Code source'};WYM_STRINGS['fr']=WYM_STRINGS_FR;var $j=jQuery.noConflict();var WYM_INSTANCES=new Array();var WYM_NAME="name";var WYM_INDEX="{Wym_Index}";var WYM_BASE_PATH="{Wym_Base_Path}";var WYM_CSS_PATH="{Wym_Css_Path}";var WYM_IFRAME_BASE_PATH="{Wym_Iframe_Base_Path}";var WYM_IFRAME_DEFAULT="iframe/default/";var WYM_JQUERY_PATH="{Wym_Jquery_Path}";var WYM_TOOLS="{Wym_Tools}";var WYM_TOOLS_ITEMS="{Wym_Tools_Items}";var WYM_TOOL_NAME="{Wym_Tool_Name}";var WYM_TOOL_TITLE="{Wym_Tool_Title}";var WYM_TOOL_CLASS="{Wym_Tool_Class}";var WYM_CLASSES="{Wym_Classes}";var WYM_CLASSES_ITEMS="{Wym_Classes_Items}";var WYM_CLASS_NAME="{Wym_Class_Name}";var WYM_CLASS_TITLE="{Wym_Class_Title}";var WYM_CONTAINERS="{Wym_Containers}";var WYM_CONTAINERS_ITEMS="{Wym_Containers_Items}";var WYM_CONTAINER_NAME="{Wym_Container_Name}";var WYM_CONTAINER_TITLE="{Wym_Containers_Title}";var WYM_CONTAINER_CLASS="{Wym_Container_Class}";var WYM_HTML="{Wym_Html}";var WYM_IFRAME="{Wym_Iframe}";var WYM_STATUS="{Wym_Status}";var WYM_DIALOG_TITLE="{Wym_Dialog_Title}";var WYM_DIALOG_BODY="{Wym_Dialog_Body}";var WYM_BODY="body";var WYM_STRING="string";var WYM_P="p";var WYM_H1="h1";var WYM_H2="h2";var WYM_H3="h3";var WYM_H4="h4";var WYM_H5="h5";var WYM_H6="h6";var WYM_PRE="pre";var WYM_BLOCKQUOTE="blockquote";var WYM_TD="td";var WYM_TH="th";var WYM_A="a";var WYM_BR="br";var WYM_IMG="img";var WYM_TABLE="table";var WYM_UL="ul";var WYM_OL="ol";var WYM_LI="li";var WYM_CLASS="class";var WYM_HREF="href";var WYM_SRC="src";var WYM_TITLE="title";var WYM_ALT="alt";var WYM_DIALOG_LINK="Link";var WYM_DIALOG_IMAGE="Image";var WYM_DIALOG_TABLE="Table";var WYM_DIALOG_PASTE="Paste_From_Word";var WYM_BOLD="Bold";var WYM_ITALIC="Italic";var WYM_CREATE_LINK="CreateLink";var WYM_INSERT_IMAGE="InsertImage";var WYM_INSERT_TABLE="InsertTable";var WYM_PASTE="Paste";var WYM_INDENT="Indent";var WYM_OUTDENT="Outdent";var WYM_TOGGLE_HTML="ToggleHtml";var WYM_FORMAT_BLOCK="FormatBlock";var WYM_PREVIEW="Preview";var WYM_DEFAULT_SKIN="default";var WYM_MAIN_CONTAINERS=new Array(WYM_P,WYM_H1,WYM_H2,WYM_H3,WYM_H4,WYM_H5,WYM_H6,WYM_PRE,WYM_BLOCKQUOTE);var WYM_BLOCKS=new Array("address","blockquote","div","dl","fieldset","form","h1","h2","h3","h4","h5","h6","hr","noscript","ol","p","pre","table","ul","dd","dt","li","tbody","td","tfoot","th","thead","tr");var WYM_KEY={BACKSPACE:8,ENTER:13,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,CURSOR:new Array(37,38,39,40),DELETE:46};var WYM_NODE={ELEMENT:1,ATTRIBUTE:2,TEXT:3};$j.fn.wymeditor=function(options){options=$j.extend({html:"",basePath:false,cssPath:false,iframeBasePath:false,jQueryPath:false,styles:false,stylesheet:false,lang:"en",boxHtml:"
    "+"
    "+WYM_TOOLS+"
    "+"
    "+"
    "+WYM_CONTAINERS+WYM_CLASSES+"
    "+"
    "+WYM_HTML+WYM_IFRAME+WYM_STATUS+"
    "+"
    "+"
    "+"
    ",iframeHtml:"
    "+""+"
    ",editorStyles:[],toolsHtml:"
    "+"

    {Tools}

    "+"
      "+WYM_TOOLS_ITEMS+"
    "+"
    ",toolsItemHtml:"
  • "+WYM_TOOL_TITLE+"
  • ",toolsItems:[{'name':'Bold','title':'Strong','css':'wym_tools_strong'},{'name':'Italic','title':'Emphasis','css':'wym_tools_emphasis'},{'name':'Superscript','title':'Superscript','css':'wym_tools_superscript'},{'name':'Subscript','title':'Subscript','css':'wym_tools_subscript'},{'name':'InsertOrderedList','title':'Ordered_List','css':'wym_tools_ordered_list'},{'name':'InsertUnorderedList','title':'Unordered_List','css':'wym_tools_unordered_list'},{'name':'Indent','title':'Indent','css':'wym_tools_indent'},{'name':'Outdent','title':'Outdent','css':'wym_tools_outdent'},{'name':'Undo','title':'Undo','css':'wym_tools_undo'},{'name':'Redo','title':'Redo','css':'wym_tools_redo'},{'name':'CreateLink','title':'Link','css':'wym_tools_link'},{'name':'Unlink','title':'Unlink','css':'wym_tools_unlink'},{'name':'InsertImage','title':'Image','css':'wym_tools_image'},{'name':'InsertTable','title':'Table','css':'wym_tools_table'},{'name':'Paste','title':'Paste_From_Word','css':'wym_tools_paste'},{'name':'ToggleHtml','title':'HTML','css':'wym_tools_html'},{'name':'Preview','title':'Preview','css':'wym_tools_preview'}],containersHtml:"
    "+"

    {Containers}

    "+"
      "+WYM_CONTAINERS_ITEMS+"
    "+"
    ",containersItemHtml:"
  • "+""+WYM_CONTAINER_TITLE+"
  • ",containersItems:[{'name':'P','title':'Paragraph','css':'wym_containers_p'},{'name':'H1','title':'Heading_1','css':'wym_containers_h1'},{'name':'H2','title':'Heading_2','css':'wym_containers_h2'},{'name':'H3','title':'Heading_3','css':'wym_containers_h3'},{'name':'H4','title':'Heading_4','css':'wym_containers_h4'},{'name':'H5','title':'Heading_5','css':'wym_containers_h5'},{'name':'H6','title':'Heading_6','css':'wym_containers_h6'},{'name':'PRE','title':'Preformatted','css':'wym_containers_pre'},{'name':'BLOCKQUOTE','title':'Blockquote','css':'wym_containers_blockquote'},{'name':'TH','title':'Table_Header','css':'wym_containers_th'}],classesHtml:"
    "+"

    {Classes}

      "+WYM_CLASSES_ITEMS+"
    ",classesItemHtml:"
  • "+WYM_CLASS_TITLE+"
  • ",classesItems:[],statusHtml:"
    "+"

    {Status}

    "+"
    ",htmlHtml:"
    "+"

    {Source_Code}

    "+""+"
    ",boxSelector:".wym_box",toolsSelector:".wym_tools",toolsListSelector:" ul",containersSelector:".wym_containers",classesSelector:".wym_classes",htmlSelector:".wym_html",iframeSelector:".wym_iframe iframe",statusSelector:".wym_status",toolSelector:".wym_tools a",containerSelector:".wym_containers a",classSelector:".wym_classes a",htmlValSelector:".wym_html_val",hrefSelector:".wym_href",srcSelector:".wym_src",titleSelector:".wym_title",altSelector:".wym_alt",textSelector:".wym_text",rowsSelector:".wym_rows",colsSelector:".wym_cols",captionSelector:".wym_caption",submitSelector:".wym_submit",cancelSelector:".wym_cancel",previewSelector:"",dialogLinkSelector:".wym_dialog_link",dialogImageSelector:".wym_dialog_image",dialogTableSelector:".wym_dialog_table",dialogPasteSelector:".wym_dialog_paste",dialogPreviewSelector:".wym_dialog_preview",updateSelector:".wymupdate",updateEvent:"click",dialogFeatures:"menubar=no,titlebar=no,toolbar=no,resizable=no"+",width=560,height=300,top=0,left=0",dialogHtml:""+""+""+""+WYM_DIALOG_TITLE+""+""+""+""+WYM_DIALOG_BODY+"",dialogLinkHtml:""+"
    "+"
    "+"{Link}"+"
    "+""+""+"
    "+"
    "+""+""+"
    "+"
    "+""+""+"
    "+"
    "+""+"",dialogImageHtml:""+"
    "+"
    "+"{Image}"+"
    "+""+""+"
    "+"
    "+""+""+"
    "+"
    "+""+""+"
    "+"
    "+""+""+"
    "+"
    "+""+"",dialogTableHtml:""+"
    "+"
    "+"{Table}"+"
    "+""+""+"
    "+"
    "+""+""+"
    "+"
    "+""+""+"
    "+"
    "+""+""+"
    "+"
    "+""+"",dialogPasteHtml:""+"
    "+"
    "+"{Paste_From_Word}"+"
    "+""+"
    "+"
    "+""+""+"
    "+"
    "+""+"",dialogPreviewHtml:"",dialogStyles:[],skin:WYM_DEFAULT_SKIN,stringDelimiterLeft:"{",stringDelimiterRight:"}",preInit:null,preBind:null,postInit:null,preInitDialog:null,postInitDialog:null},options);return this.each(function(i){new Wymeditor($j(this),i,options)})};$j.extend({wymeditors:function(i){return(WYM_INSTANCES[i])},wymstrings:function(lang,sKey){return(WYM_STRINGS[lang][sKey])}});function Wymeditor(elem,index,options){WYM_INSTANCES[index]=this;this._element=elem;this._index=index;this._options=options;this._html=$j(elem).val();if(this._options.html)this._html=this._options.html;this._options.basePath=this._options.basePath||this.computeBasePath();this._options.cssPath=this._options.cssPath||this.computeCssPath();this._options.iframeBasePath=this._options.iframeBasePath||this._options.basePath+WYM_IFRAME_DEFAULT;this._options.jQueryPath=this._options.jQueryPath||this.computeJqueryPath();this.init()};Wymeditor.prototype.init=function(){if($j.browser.msie){var WymClass=new WymClassExplorer(this)}else if($j.browser.mozilla){var WymClass=new WymClassMozilla(this)}else if($j.browser.opera){var WymClass=new WymClassOpera(this)}else if($j.browser.safari){}if(WymClass){if($j.isFunction(this._options.preInit))this._options.preInit(this);this.loadXhtmlParser(WymClass);if(this._options.styles||this._options.stylesheet){this.configureEditorUsingRawCss()}this.helper=new XmlHelper();$j.extend(this,WymClass);this._box=$j(this._element).hide().after(this._options.boxHtml).next();var iframeHtml=this._options.iframeHtml;iframeHtml=iframeHtml.replaceAll(WYM_INDEX,this._index).replaceAll(WYM_IFRAME_BASE_PATH,this._options.iframeBasePath);var boxHtml=$j(this._box).html();boxHtml=boxHtml.replaceAll(WYM_TOOLS,this._options.toolsHtml);boxHtml=boxHtml.replaceAll(WYM_CONTAINERS,this._options.containersHtml);boxHtml=boxHtml.replaceAll(WYM_CLASSES,this._options.classesHtml);boxHtml=boxHtml.replaceAll(WYM_HTML,this._options.htmlHtml);boxHtml=boxHtml.replaceAll(WYM_IFRAME,iframeHtml);boxHtml=boxHtml.replaceAll(WYM_STATUS,this._options.statusHtml);var aTools=eval(this._options.toolsItems);var sTools="";for(var i=0;i0)firstNode=nodes.item(0);for(var x=0;x=0;x--){sTmp=aP[x];sTmp=sTmp.replace(rExp,"
    ");$j(container).after("

    "+sTmp+"

    ")}}else{for(x=0;x");$j(this._doc.body).append("

    "+sTmp+"

    ")}}};Wymeditor.prototype.addCssRules=function(doc,aCss){var styles=doc.styleSheets[0];if(styles){for(var i=0;i >");$j(this._box).find("div.wym_area_right ul").parents("div.wym_area_right").show().parents(this._options.boxSelector).find("div.wym_area_main").css({"margin-right":"155px"});$j(this._box).find("div.wym_area_left ul").parents("div.wym_area_left").show().parents(this._options.boxSelector).find("div.wym_area_main").css({"margin-left":"155px"});$j(this._box).find(".wym_section").hover(function(){$j(this).addClass("hover")},function(){$j(this).removeClass("hover")});break}};function WYM_INIT_DIALOG(index){var wym=window.opener.WYM_INSTANCES[index];var doc=window.document;var selected=wym.selected();var sStamp=wym.uniqueStamp();if(!selected&&wym._selected_image){selected=$j(wym._selected_image).parentsOrSelf(WYM_A)}if($j.isFunction(wym._options.preInitDialog))wym._options.preInitDialog(wym,window);var styles=doc.styleSheets[0];var aCss=eval(wym._options.dialogStyles);wym.addCssRules(doc,aCss);if(selected){$j(wym._options.hrefSelector).val($j(selected).attr(WYM_HREF));$j(wym._options.srcSelector).val($j(selected).attr(WYM_SRC));$j(wym._options.titleSelector).val($j(selected).attr(WYM_TITLE));$j(wym._options.altSelector).val($j(selected).attr(WYM_ALT))}if(wym._selected_image){$j(wym._options.dialogImageSelector+" "+wym._options.srcSelector).val($j(wym._selected_image).attr(WYM_SRC));$j(wym._options.dialogImageSelector+" "+wym._options.titleSelector).val($j(wym._selected_image).attr(WYM_TITLE));$j(wym._options.dialogImageSelector+" "+wym._options.altSelector).val($j(wym._selected_image).attr(WYM_ALT))}$j(wym._options.dialogLinkSelector+" "+wym._options.submitSelector).click(function(){var sUrl=$j(wym._options.hrefSelector).val();if(sUrl.length>0){wym._exec(WYM_CREATE_LINK,sStamp);var link=null;var nodes=wym._doc.body.getElementsByTagName(WYM_A);for(var i=0;i0){wym._exec(WYM_INSERT_IMAGE,sStamp);var image=null;var nodes=wym._doc.body.getElementsByTagName(WYM_IMG);for(var i=0;i0&&iCols>0){var table=wym._doc.createElement(WYM_TABLE);var newRow=null;var newCol=null;var sCaption=$j(wym._options.captionSelector).val();var newCaption=table.createCaption();newCaption.innerHTML=sCaption;for(x=0;x]*)>/gi,"").replace(/<\/em>/gi,"").replace(/]*)>/gi,"").replace(/<\/strong>/gi,"");$j(this._doc.body).html(html);this.enableDesignMode()}else return($j(this._doc.body).html())};WymClassMozilla.prototype._exec=function(cmd,param){switch(cmd){case WYM_INDENT:case WYM_OUTDENT:var focusNode=this.selected();var sel=this._iframe.contentWindow.getSelection();var anchorNode=sel.anchorNode;if(anchorNode.nodeName=="#text")anchorNode=anchorNode.parentNode;focusNode=this.findUp(focusNode,WYM_BLOCKS);anchorNode=this.findUp(anchorNode,WYM_BLOCKS);if(focusNode&&focusNode==anchorNode&&focusNode.tagName.toLowerCase()==WYM_LI){var ancestor=focusNode.parentNode.parentNode;if(focusNode.parentNode.childNodes.length>1||ancestor.tagName.toLowerCase()==WYM_OL||ancestor.tagName.toLowerCase()==WYM_UL)this._doc.execCommand(cmd,'',null)}break;default:if(param)this._doc.execCommand(cmd,'',param);else this._doc.execCommand(cmd,'',null)}var container=this.selected();if(container.tagName.toLowerCase()==WYM_BODY)this._exec(WYM_FORMAT_BLOCK,WYM_P);this.listen()};WymClassMozilla.prototype.selected=function(){var sel=this._iframe.contentWindow.getSelection();var node=sel.focusNode;if(node){if(node.nodeName=="#text")return(node.parentNode);else return(node)}else return(null)};WymClassMozilla.prototype.addCssRule=function(styles,oCss){styles.insertRule(oCss.name+" {"+oCss.css+"}",styles.cssRules.length)};WymClassMozilla.prototype.keydown=function(evt){var wym=WYM_INSTANCES[this.title];if(evt.ctrlKey){if(evt.keyCode==66){wym._exec(WYM_BOLD);return false}if(evt.keyCode==73){wym._exec(WYM_ITALIC);return false}}};WymClassMozilla.prototype.keyup=function(evt){var wym=WYM_INSTANCES[this.title];wym._selected_image=null;if(evt.keyCode==13&&!evt.shiftKey){$j(wym._doc.body).children(WYM_BR).remove()}else if(evt.keyCode!=8&&evt.keyCode!=17&&evt.keyCode!=46&&evt.keyCode!=224&&!evt.metaKey&&!evt.ctrlKey){var container=wym.selected();var name=container.tagName.toLowerCase();if(name=="strong"||name=="b"||name=="em"||name=="i"||name=="sub"||name=="sup"||name=="a")name=container.parentNode.tagName.toLowerCase();if(name==WYM_BODY)wym._exec(WYM_FORMAT_BLOCK,WYM_P)}};WymClassMozilla.prototype.enableDesignMode=function(){if(this.designMode=="off"){try{this.designMode="on";this.execCommand("styleWithCSS",'',false)}catch(e){}}};WymClassMozilla.prototype.setFocusToNode=function(node){var range=document.createRange();range.selectNode(node);var selected=this._iframe.contentWindow.getSelection();selected.addRange(range);selected.collapse(node,node.childNodes.length);this._iframe.contentWindow.focus()};WymClassMozilla.prototype.openBlockTag=function(tag,attributes){var attributes=this.validator.getValidTagAttributes(tag,attributes);if(tag=='span'&&attributes.style){var new_tag=this.getTagForStyle(attributes.style);if(new_tag){this._tag_stack.pop();var tag=new_tag;this._tag_stack.push(new_tag);attributes.style=''}else{return}}if(tag!='li'&&(tag=='ul'||tag=='ol')&&this.last_tag&&!this.last_tag_opened&&this.last_tag=='li'){this.output=this.output.replace(/<\/li>$/,'');this.insertContentAfterClosingTag(tag,'')}this.output+=this.helper.tag(tag,attributes,true)};WymClassMozilla.prototype.closeBlockTag=function(tag){this.output=this.output.replace(/
    $/,'')+this._getClosingTagContent('before',tag)+""+this._getClosingTagContent('after',tag)};WymClassMozilla.prototype.getTagForStyle=function(style){if(/bold/.test(style))return'strong';if(/italic/.test(style))return'em';if(/sub/.test(style))return'sub';if(/sub/.test(style))return'super';return false};function WymClassOpera(wym){this._wym=wym;this._class="class";this._newLine="\r\n"};WymClassOpera.prototype.initIframe=function(iframe){this._iframe=iframe;this._doc=iframe.contentWindow.document;var styles=this._doc.styleSheets[0];var aCss=eval(this._options.editorStyles);this.addCssRules(this._doc,aCss);this._doc.title=this._wym._index;this._doc.designMode="on";this.html(this._wym._html);if($j.isFunction(this._options.preBind))this._options.preBind(this);$j(this._box).find(this._options.toolSelector+'[@name='+WYM_INDENT+']').hide();$j(this._box).find(this._options.toolSelector+'[@name='+WYM_OUTDENT+']').hide();this._wym.bindEvents();$j(this._doc).bind("keyup",this.keyup);if($j.isFunction(this._options.postInit))this._options.postInit(this);this.listen()};WymClassOpera.prototype._exec=function(cmd,param){switch(cmd){case WYM_INDENT:case WYM_OUTDENT:this.status("Unsupported feature.");break;default:if(param)this._doc.execCommand(cmd,false,param);else this._doc.execCommand(cmd);break}this.listen()};WymClassOpera.prototype.selected=function(){var sel=this._iframe.contentWindow.getSelection();var node=sel.focusNode;if(node){if(node.nodeName=="#text")return(node.parentNode);else return(node)}else return(null)};WymClassOpera.prototype.addCssRule=function(styles,oCss){styles.insertRule(oCss.name+" {"+oCss.css+"}",styles.cssRules.length)};WymClassOpera.prototype.keyup=function(evt){var wym=WYM_INSTANCES[this.title];wym._selected_image=null};WymClassOpera.prototype.setFocusToNode=function(node){}; \ No newline at end of file Index: openacs-4/packages/xowiki/www/resources/wymeditor/wym_css_parser.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/resources/wymeditor/wym_css_parser.js,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xowiki/www/resources/wymeditor/wym_css_parser.js 15 Jul 2007 16:07:45 -0000 1.1 @@ -0,0 +1,153 @@ + +function WymCssLexer(parser, only_wym_blocks) +{ + var only_wym_blocks = (only_wym_blocks == undefined ? true : only_wym_blocks); + + jQuery.extend(this, new Lexer(parser, (only_wym_blocks?'Ignore':'WymCss'))); + + this.mapHandler('WymCss', 'Ignore'); + + if(only_wym_blocks == true){ + this.addEntryPattern("/\\\x2a[<\\s]*WYMeditor[>\\s]*\\\x2a/", 'Ignore', 'WymCss'); + this.addExitPattern("/\\\x2a[<\/\\s]*WYMeditor[>\\s]*\\\x2a/", 'WymCss'); + } + + this.addSpecialPattern("\\\x2e[a-z-_0-9]+[\\sa-z]*", 'WymCss', 'WymCssStyleDeclaration'); + + this.addEntryPattern("/\\\x2a", 'WymCss', 'WymCssComment'); + this.addExitPattern("\\\x2a/", 'WymCssComment'); + + this.addEntryPattern("\x7b", 'WymCss', 'WymCssStyle'); + this.addExitPattern("\x7d", 'WymCssStyle'); + + this.addEntryPattern("/\\\x2a", 'WymCssStyle', 'WymCssFeddbackStyle'); + this.addExitPattern("\\\x2a/", 'WymCssFeddbackStyle'); + + return this; +} + +function WymCssParser() +{ + this._in_style = false; + this._has_title = false; + this.only_wym_blocks = true; + this.css_settings = {'classesItems':[], 'editorStyles':[], 'dialogStyles':[]}; + return this; +} + +WymCssParser.prototype.parse = function(raw, only_wym_blocks) +{ + var only_wym_blocks = (only_wym_blocks == undefined ? this.only_wym_blocks : only_wym_blocks); + this._Lexer = new WymCssLexer(this, only_wym_blocks); + this._Lexer.parse(raw); +} + +WymCssParser.prototype.Ignore = function(match, state) +{ + return true; +} + +WymCssParser.prototype.WymCssComment = function(text, status) +{ + if(text.match(/end[a-z0-9\s]*wym[a-z0-9\s]*/mi)){ + return false; + } + if(status == LEXER_UNMATCHED){ + if(!this._in_style){ + this._has_title = true; + this._current_item = {'title':text.trim()}; + }else{ + if(this._current_item[this._current_element]){ + if(!this._current_item[this._current_element].expressions){ + this._current_item[this._current_element].expressions = [text]; + }else{ + this._current_item[this._current_element].expressions.push(text); + } + } + } + this._in_style = true; + } + return true; +} + +WymCssParser.prototype.WymCssStyle = function(match, status) +{ + if(status == LEXER_UNMATCHED){ + match = match.trim(); + if(match != ''){ + this._current_item[this._current_element].style = match; + } + }else if (status == LEXER_EXIT){ + this._in_style = false; + this._has_title = false; + this.addStyleSetting(this._current_item); + } + return true; +} + +WymCssParser.prototype.WymCssFeddbackStyle = function(match, status) +{ + if(status == LEXER_UNMATCHED){ + this._current_item[this._current_element].feedback_style = match.replace(/^([\s\/\*]*)|([\s\/\*]*)$/gm,''); + } + return true; +} + +WymCssParser.prototype.WymCssStyleDeclaration = function(match) +{ + match = match.replace(/^([\s\.]*)|([\s\.*]*)$/gm, ''); + + var tag = ''; + if(match.indexOf(' ') > 0){ + var parts = match.split(' '); + this._current_element = parts[0]; + var tag = parts[1]; + }else{ + this._current_element = match; + } + + if(!this._has_title){ + this._current_item = {'title':(!tag?'':tag.toUpperCase()+': ')+this._current_element}; + this._has_title = true; + } + + if(!this._current_item[this._current_element]){ + this._current_item[this._current_element] = {'name':this._current_element}; + } + if(tag){ + if(!this._current_item[this._current_element].tags){ + this._current_item[this._current_element].tags = [tag]; + }else{ + this._current_item[this._current_element].tags.push(tag); + } + } + return true; +} + +WymCssParser.prototype.addStyleSetting = function(style_details) +{ + for (var name in style_details){ + var details = style_details[name]; + if(typeof details == 'object' && name != 'title'){ + + this.css_settings.classesItems.push({ + 'name': details.name.trim(), + 'title': style_details.title, + 'expr' : (details.expressions||details.tags).join(', ').trim() + }); + if(details.feedback_style){ + this.css_settings.editorStyles.push({ + 'name': '.'+details.name.trim(), + 'css': details.feedback_style + }); + } + if(details.style){ + this.css_settings.dialogStyles.push({ + 'name': '.'+details.name.trim(), + 'css': details.style + }); + } + } + } +} + Index: openacs-4/packages/xowiki/www/resources/wymeditor/xhtml_parser.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/resources/wymeditor/xhtml_parser.js,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xowiki/www/resources/wymeditor/xhtml_parser.js 15 Jul 2007 16:07:45 -0000 1.1 @@ -0,0 +1,2007 @@ +/* + * WYMeditor : what you see is What You Mean web-based editor + * Copyright (C) 2007 H.O.net - http://www.honet.be/ + * Dual licensed under the MIT (MIT-license.txt) + * and GPL (GPL-license.txt) licenses. + * + * For further information visit: + * http://www.wymeditor.org/ + * + * File Name: + * xhtml_parser.js + * XHTML parser and generator + * + * File Authors: + * Bermi Ferrer (http://bermi.org) + * David Heinemeier Hansson (http://loudthinking.com) XmlHelper + * Marcus Baker (http://lastcraft.com) Lexer/Parser + */ + + +/* +* @name xml +* @description Use these methods to generate XML and XHTML compliant tags and +* escape tag attributes correctly +* @author Bermi Ferrer - http://bermi.org +* @author David Heinemeier Hansson http://loudthinking.com +*/ +function XmlHelper() +{ + this._entitiesDiv = document.createElement('div'); + return this; +} + + +/* +* @name tag +* @description +* Returns an empty HTML tag of type *name* which by default is XHTML +* compliant. Setting *open* to true will create an open tag compatible +* with HTML 4.0 and below. Add HTML attributes by passing an attributes +* array to *options*. For attributes with no value like (disabled and +* readonly), give it a value of true in the *options* array. +* +* Examples: +* +* this.tag('br') +* # =>
    +* this.tag ('br', false, true) +* # =>
    +* this.tag ('input', $j({type:'text',disabled:true }) ) +* # => +*/ +XmlHelper.prototype.tag = function(name, options, open) +{ + options = options || false; + open = open || false; + return '<'+name+(options ? this.tagOptions(options) : '')+(open ? '>' : ' />'); +} + +/* +* @name contentTag +* @description +* Returns a XML block tag of type *name* surrounding the *content*. Add +* XML attributes by passing an attributes array to *options*. For attributes +* with no value like (disabled and readonly), give it a value of true in +* the *options* array. You can use symbols or strings for the attribute names. +* +* this.contentTag ('p', 'Hello world!' ) +* # =>

    Hello world!

    +* this.contentTag('div', this.contentTag('p', "Hello world!"), $j({class : "strong"})) +* # =>

    Hello world!

    +* this.contentTag("select", options, $j({multiple : true})) +* # => +*/ +XmlHelper.prototype.contentTag = function(name, content, options) +{ + options = options || false; + return '<'+name+(options ? this.tagOptions(options) : '')+'>'+content+''; +} + +/* +* @name cdataSection +* @description +* Returns a CDATA section for the given +content+. CDATA sections +* are used to escape blocks of text containing characters which would +* otherwise be recognized as markup. CDATA sections begin with the string +* <![CDATA[ and } with (and may not contain) the string +* ]]>. +*/ +XmlHelper.prototype.cdataSection = function(content) +{ + return ''; +} + + +/* +* @name escapeOnce +* @description +* Returns the escaped +xml+ without affecting existing escaped entities. +* +* this.escapeOnce( "1 > 2 & 3") +* # => "1 > 2 & 3" +*/ +XmlHelper.prototype.escapeOnce = function(xml) +{ + return this._fixDoubleEscape(this.escapeEntities(xml)); +} + +/* +* @name _fixDoubleEscape +* @description +* Fix double-escaped entities, such as &amp;, &#123;, etc. +*/ +XmlHelper.prototype._fixDoubleEscape = function(escaped) +{ + return escaped.replace(/&([a-z]+|(#\d+));/i, "&$1;"); +} + +/* +* @name tagOptions +* @description +* Takes an array like the one generated by Tag.parseAttributes +* [["src", "http://www.editam.com/?a=b&c=d&f=g"], ["title", "Editam, CMS"]] +* or an object like {src:"http://www.editam.com/?a=b&c=d&f=g", title:"Editam, CMS"} +* and returns a string properly escaped like +* ' src = "http://www.editam.com/?a=b&c=d&f=g" title = "Editam, <Simplified> CMS"' +* which is valid for strict XHTML +*/ +XmlHelper.prototype.tagOptions = function(options) +{ + var xml = this; + xml._formated_options = ''; + + for (key in options) { + var formated_options = ''; + var value = options[key]; + if(typeof value != 'function' && value.length > 0) { + + if(parseInt(key) == key && typeof value == 'object'){ + key = value.shift(); + value = value.pop(); + } + if(key != '' && value != ''){ + xml._formated_options += ' '+key+'="'+xml.escapeOnce(value)+'"'; + } + } + } + return xml._formated_options; +} + +/* +* @name escapeEntities +* @description +* Escapes XML/HTML entities <, >, & and ". If seccond parameter is set to false it +* will not escape ". If set to true it will also escape ' +*/ +XmlHelper.prototype.escapeEntities = function(string, escape_quotes) +{ + this._entitiesDiv.innerHTML = string; + this._entitiesDiv.textContent = string; + var result = this._entitiesDiv.innerHTML; + if(typeof escape_quotes == 'undefined'){ + if(escape_quotes != false) result = result.replace('"', '"'); + if(escape_quotes == true) result = result.replace('"', '''); + } + return result; +} + +/* +* Parses a string conatining tag attributes and values an returns an array formated like +* [["src", "http://www.editam.com"], ["title", "Editam, Simplified CMS"]] +*/ +XmlHelper.prototype.parseAttributes = function(tag_attributes) +{ + // Use a compounded regex to match single quoted, double quoted and unquoted attribute pairs + var result = []; + var matches = tag_attributes.split(/((=\s*")(")("))|((=\s*\')(\')(\'))|((=\s*[^>\s]*))/g); + if(matches.toString() != tag_attributes){ + for (k in matches) { + var v = matches[k]; + if(typeof v != 'function' && v.length != 0){ + var re = new RegExp('(\\w+)\\s*'+v); + if(match = tag_attributes.match(re) ){ + var value = v.replace(/^[\s=]+/, ""); + var delimiter = value.charAt(0); + delimiter = delimiter == '"' ? '"' : (delimiter=="'"?"'":''); + if(delimiter != ''){ + value = delimiter == '"' ? value.replace(/^"|"+$/g, '') : value.replace(/^'|'+$/g, ''); + } + tag_attributes = tag_attributes.replace(match[0],''); + result.push([match[1] , value]); + } + } + } + } + return result; +} + +/** +* XhtmlValidator for validating tag attributes +* +* @author Bermi Ferrer - http://bermi.org +*/ +var XhtmlValidator = { + "_attributes": + { + "core": + { + "except":[ + "base", + "head", + "html", + "meta", + "param", + "script", + "style", + "title" + ], + "attributes":[ + "class", + "id", + "style", + "title", + "accesskey", + "tabindex" + ] + }, + "language": + { + "except":[ + "base", + "br", + "hr", + "iframe", + "param", + "script" + ], + "attributes": + { + "dir":[ + "ltr", + "rtl" + ], + "0":"lang", + "1":"xml:lang" + } + }, + "keyboard": + { + "attributes": + { + "accesskey":/^(\w){1}$/, + "tabindex":/^(\d)+$/ + } + } + }, + "_events": + { + "window": + { + "only":[ + "body" + ], + "attributes":[ + "onload", + "onunload" + ] + }, + "form": + { + "only":[ + "form", + "input", + "textarea", + "select", + "a", + "label", + "button" + ], + "attributes":[ + "onchange", + "onsubmit", + "onreset", + "onselect", + "onblur", + "onfocus" + ] + }, + "keyboard": + { + "except":[ + "base", + "bdo", + "br", + "frame", + "frameset", + "head", + "html", + "iframe", + "meta", + "param", + "script", + "style", + "title" + ], + "attributes":[ + "onkeydown", + "onkeypress", + "onkeyup" + ] + }, + "mouse": + { + "except":[ + "base", + "bdo", + "br", + "head", + "html", + "meta", + "param", + "script", + "style", + "title" + ], + "attributes":[ + "onclick", + "ondblclick", + "onmousedown", + "onmousemove", + "onmouseover", + "onmouseout", + "onmouseup" + ] + } + }, + "_tags": + { + "a": + { + "attributes": + { + "0":"charset", + "1":"coords", + "2":"href", + "3":"hreflang", + "4":"name", + "rel":/^(alternate|designates|stylesheet|start|next|prev|contents|index|glossary|copyright|chapter|section|subsection|appendix|help|bookmark| |shortcut|icon)+$/, + "rev":/^(alternate|designates|stylesheet|start|next|prev|contents|index|glossary|copyright|chapter|section|subsection|appendix|help|bookmark| |shortcut|icon)+$/, + "shape":/^(rect|rectangle|circ|circle|poly|polygon)$/, + "5":"type" + } + }, + "0":"abbr", + "1":"acronym", + "2":"address", + "area": + { + "attributes": + { + "0":"alt", + "1":"coords", + "2":"href", + "nohref":/^(true|false)$/, + "shape":/^(rect|rectangle|circ|circle|poly|polygon)$/ + }, + "required":[ + "alt" + ] + }, + "3":"b", + "base": + { + "attributes":[ + "href" + ], + "required":[ + "href" + ] + }, + "bdo": + { + "attributes": + { + "dir":/^(ltr|rtl)$/ + }, + "required":[ + "dir" + ] + }, + "4":"big", + "blockquote": + { + "attributes":[ + "cite" + ] + }, + "5":"body", + "6":"br", + "button": + { + "attributes": + { + "disabled":/^(disabled)$/, + "type":/^(button|reset|submit)$/, + "0":"value" + }, + "inside":"form" + }, + "7":"caption", + "8":"cite", + "9":"code", + "col": + { + "attributes": + { + "align":/^(right|left|center|justify)$/, + "0":"char", + "1":"charoff", + "span":/^(\d)+$/, + "valign":/^(top|middle|bottom|baseline)$/, + "2":"width" + }, + "inside":"colgroup" + }, + "colgroup": + { + "attributes": + { + "align":/^(right|left|center|justify)$/, + "0":"char", + "1":"charoff", + "span":/^(\d)+$/, + "valign":/^(top|middle|bottom|baseline)$/, + "2":"width" + } + }, + "10":"dd", + "del": + { + "attributes": + { + "0":"cite", + "datetime":/^([0-9]){8}/ + } + }, + "11":"div", + "12":"dfn", + "13":"dl", + "14":"dt", + "15":"em", + "fieldset": + { + "inside":"form" + }, + "form": + { + "attributes": + { + "0":"action", + "1":"accept", + "2":"accept-charset", + "3":"enctype", + "method":/^(get|post)$/ + }, + "required":[ + "action" + ] + }, + "head": + { + "attributes":[ + "profile" + ] + }, + "16":"h1", + "17":"h2", + "18":"h3", + "19":"h4", + "20":"h5", + "21":"h6", + "22":"hr", + "html": + { + "attributes":[ + "xmlns" + ] + }, + "23":"i", + "img": + { + "attributes":[ + "alt", + "src", + "height", + "ismap", + "longdesc", + "usemap", + "width" + ], + "required":[ + "alt", + "src" + ] + }, + "input": + { + "attributes": + { + "0":"accept", + "1":"alt", + "checked":/^(checked)$/, + "disabled":/^(disabled)$/, + "maxlength":/^(\d)+$/, + "2":"name", + "readonly":/^(readonly)$/, + "size":/^(\d)+$/, + "3":"src", + "type":/^(button|checkbox|file|hidden|image|password|radio|reset|submit|text)$/, + "4":"value" + }, + "inside":"form" + }, + "ins": + { + "attributes": + { + "0":"cite", + "datetime":/^([0-9]){8}/ + } + }, + "24":"kbd", + "label": + { + "attributes":[ + "for" + ], + "inside":"form" + }, + "25":"legend", + "26":"li", + "link": + { + "attributes": + { + "0":"charset", + "1":"href", + "2":"hreflang", + "media":/^(all|braille|print|projection|screen|speech|,|;| )+$/i, + "rel":/^(alternate|appendix|bookmark|chapter|contents|copyright|glossary|help|home|index|next|prev|section|start|stylesheet|subsection| |shortcut|icon)+$/i, + "rev":/^(alternate|appendix|bookmark|chapter|contents|copyright|glossary|help|home|index|next|prev|section|start|stylesheet|subsection| |shortcut|icon)+$/i, + "3":"type" + }, + "inside":"head" + }, + "map": + { + "attributes":[ + "id", + "name" + ], + "required":[ + "id" + ] + }, + "meta": + { + "attributes": + { + "0":"content", + "http-equiv":/^(content\-type|expires|refresh|set\-cookie)$/i, + "1":"name", + "2":"scheme" + }, + "required":[ + "content" + ] + }, + "27":"noscript", + "object": + { + "attributes":[ + "archive", + "classid", + "codebase", + "codetype", + "data", + "declare", + "height", + "name", + "standby", + "type", + "usemap", + "width" + ] + }, + "28":"ol", + "optgroup": + { + "attributes": + { + "0":"label", + "disabled": /^(disabled)$/ + }, + "required":[ + "label" + ] + }, + "option": + { + "attributes": + { + "0":"label", + "disabled":/^(disabled)$/, + "selected":/^(selected)$/, + "1":"value" + }, + "inside":"select" + }, + "29":"p", + "param": + { + "attributes": + { + "0":"type", + "valuetype":/^(data|ref|object)$/, + "1":"valuetype", + "2":"value" + }, + "required":[ + "name" + ] + }, + "30":"pre", + "q": + { + "attributes":[ + "cite" + ] + }, + "31":"samp", + "script": + { + "attributes": + { + "type":/^(text\/ecmascript|text\/javascript|text\/jscript|text\/vbscript|text\/vbs|text\/xml)$/, + "0":"charset", + "defer":/^(defer)$/, + "1":"src" + }, + "required":[ + "type" + ] + }, + "select": + { + "attributes": + { + "disabled":/^(disabled)$/, + "multiple":/^(multiple)$/, + "0":"name", + "1":"size" + }, + "inside":"form" + }, + "32":"small", + "33":"span", + "34":"strong", + "style": + { + "attributes": + { + "0":"type", + "media":/^(screen|tty|tv|projection|handheld|print|braille|aural|all)$/ + }, + "required":[ + "type" + ] + }, + "35":"sub", + "36":"sup", + "table": + { + "attributes": + { + "0":"border", + "1":"cellpadding", + "2":"cellspacing", + "frame":/^(void|above|below|hsides|lhs|rhs|vsides|box|border)$/, + "rules":/^(none|groups|rows|cols|all)$/, + "3":"summary", + "4":"width" + } + }, + "tbody": + { + "attributes": + { + "align":/^(right|left|center|justify)$/, + "0":"char", + "1":"charoff", + "valign":/^(top|middle|bottom|baseline)$/ + } + }, + "td": + { + "attributes": + { + "0":"abbr", + "align":/^(left|right|center|justify|char)$/, + "1":"axis", + "2":"char", + "3":"charoff", + "colspan":/^(\d)+$/, + "4":"headers", + "rowspan":/^(\d)+$/, + "scope":/^(col|colgroup|row|rowgroup)$/, + "valign":/^(top|middle|bottom|baseline)$/ + } + }, + "textarea": + { + "attributes":[ + "cols", + "rows", + "disabled", + "name", + "readonly" + ], + "required":[ + "cols", + "rows" + ], + "inside":"form" + }, + "tfoot": + { + "attributes": + { + "align":/^(right|left|center|justify)$/, + "0":"char", + "1":"charoff", + "valign":/^(top|middle|bottom)$/, + "2":"baseline" + } + }, + "th": + { + "attributes": + { + "0":"abbr", + "align":/^(left|right|center|justify|char)$/, + "1":"axis", + "2":"char", + "3":"charoff", + "colspan":/^(\d)+$/, + "4":"headers", + "rowspan":/^(\d)+$/, + "scope":/^(col|colgroup|row|rowgroup)$/, + "valign":/^(top|middle|bottom|baseline)$/ + } + }, + "thead": + { + "attributes": + { + "align":/^(right|left|center|justify)$/, + "0":"char", + "1":"charoff", + "valign":/^(top|middle|bottom|baseline)$/ + } + }, + "37":"title", + "tr": + { + "attributes": + { + "align":/^(right|left|center|justify|char)$/, + "0":"char", + "1":"charoff", + "valign":/^(top|middle|bottom|baseline)$/ + } + }, + "38":"tt", + "39":"ul", + "40":"var" + }, + + // Temporary skiped attributes + skiped_attributes : [], + skiped_attribute_values : [], + + getValidTagAttributes: function(tag, attributes) + { + var valid_attributes = {}; + var possible_attributes = this.getPossibleTagAttributes(tag); + for(var attribute in attributes) { + var value = attributes[attribute]; + if(!this.skiped_attributes.contains(attribute) && !this.skiped_attribute_values.contains(value)){ + if (typeof value != 'function' && possible_attributes.contains(attribute)) { + if (this.doesAttributeNeedsValidation(tag, attribute)) { + if(this.validateAttribute(tag, attribute, value)){ + valid_attributes[attribute] = value; + } + }else{ + valid_attributes[attribute] = value; + } + } + } + } + return valid_attributes; + }, + getUniqueAttributesAndEventsForTag : function(tag) + { + var result = []; + + if (this._tags[tag] && this._tags[tag]['attributes']) { + for (k in this._tags[tag]['attributes']) { + result.push(parseInt(k) == k ? this._tags[tag]['attributes'][k] : k); + } + } + return result; + }, + getDefaultAttributesAndEventsForTags : function() + { + var result = []; + for (var key in this._events){ + result.push(this._events[key]); + } + for (var key in this._attributes){ + result.push(this._attributes[key]); + } + return result; + }, + isValidTag : function(tag) + { + if(this._tags[tag]){ + return true; + } + for(var key in this._tags){ + if(this._tags[key] == tag){ + return true; + } + } + return false; + }, + getDefaultAttributesAndEventsForTag : function(tag) + { + var default_attributes = []; + if (this.isValidTag(tag)) { + var default_attributes_and_events = this.getDefaultAttributesAndEventsForTags(); + + for(var key in default_attributes_and_events) { + var defaults = default_attributes_and_events[key]; + if(typeof defaults == 'object'){ + + if ((defaults['except'] && defaults['except'].contains(tag)) || (defaults['only'] && !defaults['only'].contains(tag))) { + continue; + } + + var tag_defaults = defaults['attributes'] ? defaults['attributes'] : defaults['events']; + for(k in tag_defaults) { + default_attributes.push(typeof tag_defaults[k] != 'string' ? k : tag_defaults[k]); + } + } + } + } + return default_attributes; + }, + doesAttributeNeedsValidation: function(tag, attribute) + { + return this._tags[tag] && ((this._tags[tag]['attributes'] && this._tags[tag]['attributes'][attribute]) || (this._tags[tag]['required'] && this._tags[tag]['required'].contains(attribute))); + }, + validateAttribute : function(tag, attribute, value) + { + if ( this._tags[tag] && + (this._tags[tag]['attributes'] && this._tags[tag]['attributes'][attribute] && value.length > 0 && !value.match(this._tags[tag]['attributes'][attribute])) || // invalid format + (this._tags[tag] && this._tags[tag]['required'] && this._tags[tag]['required'].contains(attribute) && value.length == 0) // required attribute + ) { + return false; + } + return this._tags[tag] != undefined; + }, + getPossibleTagAttributes : function(tag) + { + if (!this._possible_tag_attributes) { + this._possible_tag_attributes = {}; + } + if (!this._possible_tag_attributes[tag]) { + this._possible_tag_attributes[tag] = this.getUniqueAttributesAndEventsForTag(tag).concat(this.getDefaultAttributesAndEventsForTag(tag));; + } + return this._possible_tag_attributes[tag]; + } +} + + +/** +* Compounded regular expression. Any of +* the contained patterns could match and +* when one does, it's label is returned. +* +* Constructor. Starts with no patterns. +* @param boolean case True for case sensitive, false +* for insensitive. +* @access public +* @author Marcus Baker (http://lastcraft.com) +* @author Bermi Ferrer (http://bermi.org) +*/ +function ParallelRegex(case_sensitive) +{ + this._case = case_sensitive; + this._patterns = []; + this._labels = []; + this._regex = null; + return this; +} + + +/** +* Adds a pattern with an optional label. +* @param string pattern Perl style regex, but ( and ) +* lose the usual meaning. +* @param string label Label of regex to be returned +* on a match. +* @access public +*/ +ParallelRegex.prototype.addPattern = function(pattern, label) +{ + label = label || true; + var count = this._patterns.length; + this._patterns[count] = pattern; + this._labels[count] = label; + this._regex = null; +} + +/** +* Attempts to match all patterns at once against +* a string. +* @param string subject String to match against. +* +* @return boolean True on success. +* @return string match First matched portion of +* subject. +* @access public +*/ +ParallelRegex.prototype.match = function(subject) +{ + if (this._patterns.length == 0) { + return [false, '']; + } + matches = subject.match(this._getCompoundedRegex()); + + if(!matches){ + return [false, '']; + } + var match = matches[0]; + for (i = 1; i < matches.length; i++) { + if (matches[i]) { + return [this._labels[i-1], match]; + } + } + return [true, matches[0]]; +} + +/** +* Compounds the patterns into a single +* regular expression separated with the +* "or" operator. Caches the regex. +* Will automatically escape (, ) and / tokens. +* @param array patterns List of patterns in order. +* @access private +*/ +ParallelRegex.prototype._getCompoundedRegex = function() +{ + if (this._regex == null) { + for (i = 0, count = this._patterns.length; i < count; i++) { + this._patterns[i] = '(' + this._untokenizeRegex(this._tokenizeRegex(this._patterns[i]).replace(/([\/\(\)])/g,'\\$1')) + ')'; + } + this._regex = new RegExp(this._patterns.join("|") ,this._getPerlMatchingFlags()); + } + return this._regex; +} + +/** +* Escape lookahead/lookbehind blocks +*/ +ParallelRegex.prototype._tokenizeRegex = function(regex) +{ + return regex. + replace(/\(\?(i|m|s|x|U)\)/, '~~~~~~Tk1\$1~~~~~~'). + replace(/\(\?(\-[i|m|s|x|U])\)/, '~~~~~~Tk2\$1~~~~~~'). + replace(/\(\?\=(.*)\)/, '~~~~~~Tk3\$1~~~~~~'). + replace(/\(\?\!(.*)\)/, '~~~~~~Tk4\$1~~~~~~'). + replace(/\(\?\<\=(.*)\)/, '~~~~~~Tk5\$1~~~~~~'). + replace(/\(\?\<\!(.*)\)/, '~~~~~~Tk6\$1~~~~~~'). + replace(/\(\?\:(.*)\)/, '~~~~~~Tk7\$1~~~~~~'); +} + +/** +* Unscape lookahead/lookbehind blocks +*/ +ParallelRegex.prototype._untokenizeRegex = function(regex) +{ + return regex. + replace(/~~~~~~Tk1(.{1})~~~~~~/, "(?\$1)"). + replace(/~~~~~~Tk2(.{2})~~~~~~/, "(?\$1)"). + replace(/~~~~~~Tk3(.*)~~~~~~/, "(?=\$1)"). + replace(/~~~~~~Tk4(.*)~~~~~~/, "(?!\$1)"). + replace(/~~~~~~Tk5(.*)~~~~~~/, "(?<=\$1)"). + replace(/~~~~~~Tk6(.*)~~~~~~/, "(?", 'Comment'); +} + +XhtmlLexer.prototype.addScriptTokens = function(scope) +{ + this.addEntryPattern("", 'Script'); +} + +XhtmlLexer.prototype.addCssTokens = function(scope) +{ + this.addEntryPattern("", 'Css'); +} + +XhtmlLexer.prototype.addTagTokens = function(scope) +{ + this.addSpecialPattern("<\\s*[a-z0-9:\-]+\\s*>", scope, 'OpeningTag'); + this.addEntryPattern("<[a-z0-9:\-]+"+'[\\\/ \\\>]+', scope, 'OpeningTag'); + this.addInTagDeclarationTokens('OpeningTag'); + + this.addSpecialPattern("", scope, 'ClosingTag'); + +} + +XhtmlLexer.prototype.addInTagDeclarationTokens = function(scope) +{ + this.addSpecialPattern('\\s+', scope, 'Ignore'); + + this.addAttributeTokens(scope); + + this.addExitPattern('/>', scope); + this.addExitPattern('>', scope); + +} + +XhtmlLexer.prototype.addAttributeTokens = function(scope) +{ + this.addSpecialPattern("\\s*[a-z-_0-9]+\\s*(?=\=)\\s*", scope, 'TagAttributes'); + + this.addEntryPattern('=\\s*"', scope, 'DoubleQuotedAttribute'); + this.addPattern("\\\\\"", 'DoubleQuotedAttribute'); + this.addExitPattern('"', 'DoubleQuotedAttribute'); + + this.addEntryPattern("=\\s*'", scope, 'SingleQuotedAttribute'); + this.addPattern("\\\\'", 'SingleQuotedAttribute'); + this.addExitPattern("'", 'SingleQuotedAttribute'); + + this.addSpecialPattern('=\\s*[^>\\s]*', scope, 'UnquotedAttribute'); +} + + + +/** +* XHTML Parser. +* +* This XHTML parser will trigger the events available on on +* current SaxListener +* +* @author Bermi Ferrer (http://bermi.org) +*/ +function XhtmlParser(Listener, mode) +{ + var mode = mode || 'Text'; + this._Lexer = new XhtmlLexer(this); + this._Listener = Listener; + this._mode = mode; + this._matches = []; + this._last_match = ''; + this._current_match = ''; + + return this; +} + +XhtmlParser.prototype.parse = function(raw) +{ + this._Lexer.parse(this.beforeParsing(raw)); + return this.afterParsing(this._Listener.getResult()); +} + +XhtmlParser.prototype.beforeParsing = function(raw) +{ + if(raw.match(/class="MsoNormal"/) || raw.match(/ns = "urn:schemas-microsoft-com/)){ + // Usefull for cleaning up content pasted from other sources (MSWord) + this._Listener.avoidStylingTagsAndAttributes(); + } + return this._Listener.beforeParsing(raw); +} + +XhtmlParser.prototype.afterParsing = function(parsed) +{ + if(this._Listener._avoiding_tags_implicitly){ + this._Listener.allowStylingTagsAndAttributes(); + } + return this._Listener.afterParsing(parsed); +} + + +XhtmlParser.prototype.Ignore = function(match, state) +{ + return true; +} + +XhtmlParser.prototype.Text = function(text) +{ + this._Listener.addContent(text); + return true; +} + +XhtmlParser.prototype.Comment = function(match, status) +{ + return this._addNonTagBlock(match, status, 'addComment'); +} + +XhtmlParser.prototype.Script = function(match, status) +{ + return this._addNonTagBlock(match, status, 'addScript'); +} + +XhtmlParser.prototype.Css = function(match, status) +{ + return this._addNonTagBlock(match, status, 'addCss'); +} + +XhtmlParser.prototype._addNonTagBlock = function(match, state, type) +{ + switch (state){ + case LEXER_ENTER: + this._non_tag = match; + break; + case LEXER_UNMATCHED: + this._non_tag += match; + break; + case LEXER_EXIT: + switch(type) { + case 'addComment': + this._Listener.addComment(this._non_tag+match); + break; + case 'addScript': + this._Listener.addScript(this._non_tag+match); + break; + case 'addCss': + this._Listener.addCss(this._non_tag+match); + break; + } + } + return true; +} + +XhtmlParser.prototype.OpeningTag = function(match, state) +{ + switch (state){ + case LEXER_ENTER: + this._tag = this.normalizeTag(match); + this._tag_attributes = {}; + break; + case LEXER_SPECIAL: + this._callOpenTagListener(this.normalizeTag(match)); + break; + case LEXER_EXIT: + this._callOpenTagListener(this._tag, this._tag_attributes); + } + return true; +} + +XhtmlParser.prototype.ClosingTag = function(match, state) +{ + this._callCloseTagListener(this.normalizeTag(match)); + return true; +} + +XhtmlParser.prototype._callOpenTagListener = function(tag, attributes) +{ + var attributes = attributes || {}; + this.autoCloseUnclosedBeforeNewOpening(tag); + + if(this._Listener.isBlockTag(tag)){ + this._Listener._tag_stack.push(tag); + this._Listener.openBlockTag(tag, attributes); + this._increaseOpenTagCounter(tag); + }else if(this._Listener.isInlineTag(tag)){ + this._Listener.inlineTag(tag, attributes); + }else{ + this._Listener.openUnknownTag(tag, attributes); + this._increaseOpenTagCounter(tag); + } + this._Listener.last_tag = tag; + this._Listener.last_tag_opened = true; + this._Listener.last_tag_attributes = attributes; +} + +XhtmlParser.prototype._callCloseTagListener = function(tag) +{ + if(this._decreaseOpenTagCounter(tag)){ + this.autoCloseUnclosedBeforeTagClosing(tag); + + if(this._Listener.isBlockTag(tag)){ + var expected_tag = this._Listener._tag_stack.pop(); + if(expected_tag == false){ + return; + }else if(expected_tag != tag){ + tag = expected_tag; + } + this._Listener.closeBlockTag(tag); + }else{ + this._Listener.closeUnknownTag(tag); + } + }else{ + this._Listener.closeUnopenedTag(tag); + } + this._Listener.last_tag = tag; + this._Listener.last_tag_opened = false; +} + +XhtmlParser.prototype._increaseOpenTagCounter = function(tag) +{ + this._Listener._open_tags[tag] = this._Listener._open_tags[tag] || 0; + this._Listener._open_tags[tag]++; +} + +XhtmlParser.prototype._decreaseOpenTagCounter = function(tag) +{ + if(this._Listener._open_tags[tag]){ + this._Listener._open_tags[tag]--; + if(this._Listener._open_tags[tag] == 0){ + this._Listener._open_tags[tag] = undefined; + } + return true; + } + return false; +} + +XhtmlParser.prototype.autoCloseUnclosedBeforeNewOpening = function(new_tag) +{ + this._autoCloseUnclosed(new_tag, false); +} + +XhtmlParser.prototype.autoCloseUnclosedBeforeTagClosing = function(tag) +{ + this._autoCloseUnclosed(tag, true); +} + +XhtmlParser.prototype._autoCloseUnclosed = function(new_tag, closing) +{ + var closing = closing || false; + if(this._Listener._open_tags){ + for (tag in this._Listener._open_tags) { + counter = this._Listener._open_tags[tag]; + if(counter > 0 && this._Listener.shouldCloseTagAutomatically(tag, new_tag, closing)){ + this._callCloseTagListener(tag, true); + } + } + } +} + +XhtmlParser.prototype.getTagReplacements = function() +{ + return this._Listener.getTagReplacements(); +} + +XhtmlParser.prototype.normalizeTag = function(tag) +{ + tag = tag.replace(/^([\s<\/>]*)|([\s<\/>]*)$/gm,'').toLowerCase(); + tags = this._Listener.getTagReplacements(); + if(tags[tag]){ + return tags[tag]; + } + return tag; +} + +XhtmlParser.prototype.TagAttributes = function(match, state) +{ + if(LEXER_SPECIAL == state){ + this._current_attribute = match; + } + return true; +} + +XhtmlParser.prototype.DoubleQuotedAttribute = function(match, state) +{ + if(LEXER_UNMATCHED == state){ + this._tag_attributes[this._current_attribute] = match; + } + return true; +} +XhtmlParser.prototype.SingleQuotedAttribute = function(match, state) +{ + if(LEXER_UNMATCHED == state){ + this._tag_attributes[this._current_attribute] = match; + } + return true; +} +XhtmlParser.prototype.UnquotedAttribute = function(match, state) +{ + this._tag_attributes[this._current_attribute] = match.replace(/^=/,''); + return true; +} + + + +/** +* XHTML Sax parser. +* +* @author Bermi Ferrer (http://bermi.org) +*/ +function XhtmlSaxListener() +{ + this.output = ''; + this.helper = new XmlHelper(); + this._open_tags = {}; + this.validator = XhtmlValidator; + this._tag_stack = []; + this.avoided_tags = []; + + this.entities = { + ' ':' ','¡':'¡','¢':'¢', + '£':'£','¤':'¤','¥':'¥', + '¦':'¦','§':'§','¨':'¨', + '©':'©','ª':'ª','«':'«', + '¬':'¬','­':'­','®':'®', + '¯':'¯','°':'°','±':'±', + '²':'²','³':'³','´':'´', + 'µ':'µ','¶':'¶','·':'·', + '¸':'¸','¹':'¹','º':'º', + '»':'»','¼':'¼','½':'½', + '¾':'¾','¿':'¿','À':'À', + 'Á':'Á','Â':'Â','Ã':'Ã', + 'Ä':'Ä','Å':'Å','Æ':'Æ', + 'Ç':'Ç','È':'È','É':'É', + 'Ê':'Ê','Ë':'Ë','Ì':'Ì', + 'Í':'Í','Î':'Î','Ï':'Ï', + 'Ð':'Ð','Ñ':'Ñ','Ò':'Ò', + 'Ó':'Ó','Ô':'Ô','Õ':'Õ', + 'Ö':'Ö','×':'×','Ø':'Ø', + 'Ù':'Ù','Ú':'Ú','Û':'Û', + 'Ü':'Ü','Ý':'Ý','Þ':'Þ', + 'ß':'ß','à':'à','á':'á', + 'â':'â','ã':'ã','ä':'ä', + 'å':'å','æ':'æ','ç':'ç', + 'è':'è','é':'é','ê':'ê', + 'ë':'ë','ì':'ì','í':'í', + 'î':'î','ï':'ï','ð':'ð', + 'ñ':'ñ','ò':'ò','ó':'ó', + 'ô':'ô','õ':'õ','ö':'ö', + '÷':'÷','ø':'ø','ù':'ù', + 'ú':'ú','û':'û','ü':'ü', + 'ý':'ý','þ':'þ','ÿ':'ÿ', + 'Œ':'Œ','œ':'œ','Š':'Š', + 'š':'š','Ÿ':'Ÿ','ƒ':'ƒ', + 'ˆ':'ˆ','˜':'˜','Α':'Α', + 'Β':'Β','Γ':'Γ','Δ':'Δ', + 'Ε':'Ε','Ζ':'Ζ','Η':'Η', + 'Θ':'Θ','Ι':'Ι','Κ':'Κ', + 'Λ':'Λ','Μ':'Μ','Ν':'Ν', + 'Ξ':'Ξ','Ο':'Ο','Π':'Π', + 'Ρ':'Ρ','Σ':'Σ','Τ':'Τ', + 'Υ':'Υ','Φ':'Φ','Χ':'Χ', + 'Ψ':'Ψ','Ω':'Ω','α':'α', + 'β':'β','γ':'γ','δ':'δ', + 'ε':'ε','ζ':'ζ','η':'η', + 'θ':'θ','ι':'ι','κ':'κ', + 'λ':'λ','μ':'μ','ν':'ν', + 'ξ':'ξ','ο':'ο','π':'π', + 'ρ':'ρ','ς':'ς','σ':'σ', + 'τ':'τ','υ':'υ','φ':'φ', + 'χ':'χ','ψ':'ψ','ω':'ω', + 'ϑ':'ϑ','ϒ':'ϒ','ϖ':'ϖ', + ' ':' ',' ':' ',' ':' ', + '‌':'‌','‍':'‍','‎':'‎', + '‏':'‏','–':'–','—':'—', + '‘':'‘','’':'’','‚':'‚', + '“':'“','”':'”','„':'„', + '†':'†','‡':'‡','•':'•', + '…':'…','‰':'‰','′':'′', + '″':'″','‹':'‹','›':'›', + '‾':'‾','⁄':'⁄','€':'€', + 'ℑ':'ℑ','℘':'℘','ℜ':'ℜ', + '™':'™','ℵ':'ℵ','←':'←', + '↑':'↑','→':'→','↓':'↓', + '↔':'↔','↵':'↵','⇐':'⇐', + '⇑':'⇑','⇒':'⇒','⇓':'⇓', + '⇔':'⇔','∀':'∀','∂':'∂', + '∃':'∃','∅':'∅','∇':'∇', + '∈':'∈','∉':'∉','∋':'∋', + '∏':'∏','∑':'∑','−':'−', + '∗':'∗','√':'√','∝':'∝', + '∞':'∞','∠':'∠','∧':'∧', + '∨':'∨','∩':'∩','∪':'∪', + '∫':'∫','∴':'∴','∼':'∼', + '≅':'≅','≈':'≈','≠':'≠', + '≡':'≡','≤':'≤','≥':'≥', + '⊂':'⊂','⊃':'⊃','⊄':'⊄', + '⊆':'⊆','⊇':'⊇','⊕':'⊕', + '⊗':'⊗','⊥':'⊥','⋅':'⋅', + '⌈':'⌈','⌉':'⌉','⌊':'⌊', + '⌋':'⌋','⟨':'〈','⟩':'〉', + '◊':'◊','♠':'♠','♣':'♣', + '♥':'♥','♦':'♦'}; + + this.block_tags = ["a", "abbr", "acronym", "address", "area", "b", + "base", "bdo", "big", "blockquote", "body", "button", + "caption", "cite", "code", "col", "colgroup", "dd", "del", "div", + "dfn", "dl", "dt", "em", "fieldset", "form", "head", "h1", "h2", + "h3", "h4", "h5", "h6", "html", "i", "ins", + "kbd", "label", "legend", "li", "map", "noscript", + "object", "ol", "optgroup", "option", "p", "param", "pre", "q", + "samp", "script", "select", "small", "span", "strong", "style", + "sub", "sup", "table", "tbody", "td", "textarea", "tfoot", "th", + "thead", "title", "tr", "tt", "ul", "var", "extends"]; + + + this.inline_tags = ["br", "hr", "img", "input"]; + + return this; +} + +XhtmlSaxListener.prototype.shouldCloseTagAutomatically = function(tag, now_on_tag, closing) +{ + var closing = closing || false; + if(tag == 'td'){ + if((closing && now_on_tag == 'tr') || (!closing && now_on_tag == 'td')){ + return true; + } + } + if(tag == 'option'){ + if((closing && now_on_tag == 'select') || (!closing && now_on_tag == 'option')){ + return true; + } + } + return false; +} + +XhtmlSaxListener.prototype.beforeParsing = function(raw) +{ + this.output = ''; + return raw; +} + +XhtmlSaxListener.prototype.afterParsing = function(xhtml) +{ + xhtml = this.replaceNamedEntities(xhtml); + xhtml = this.joinRepeatedEntities(xhtml); + xhtml = this.removeEmptyTags(xhtml); + return xhtml; +} + +XhtmlSaxListener.prototype.replaceNamedEntities = function(xhtml) +{ + for (entity in this.entities) { + xhtml = xhtml.replace(entity, this.entities[entity]); + } + return xhtml; +} + +XhtmlSaxListener.prototype.joinRepeatedEntities = function(xhtml) +{ + var tags = 'em|strong|sub|sup|acronym|pre|del|blockquote|address'; + return xhtml.replace(new RegExp('<\/('+tags+')><\\1>' ,''),''). + replace(new RegExp('(\s*<('+tags+')>\s*){2}(.*)(\s*<\/\\2>\s*){2}' ,''),'<\$2>\$3<\$2>'); +} + +XhtmlSaxListener.prototype.removeEmptyTags = function(xhtml) +{ + return xhtml.replace(new RegExp('<('+this.block_tags.join("|")+')>(
    | | |\s)*<\/\\1>' ,'g'),''); +} + +XhtmlSaxListener.prototype.getResult = function() +{ + return this.output; +} + +XhtmlSaxListener.prototype.getTagReplacements = function() +{ + return {'b':'strong', 'i':'em'}; +} + +XhtmlSaxListener.prototype.addContent = function(text) +{ + this.output += text; +} + +XhtmlSaxListener.prototype.addComment = function(text) +{ + if(this.remove_comments){ + this.output += text; + } +} + +XhtmlSaxListener.prototype.addScript = function(text) +{ + if(!this.remove_scripts){ + this.output += text; + } +} + +XhtmlSaxListener.prototype.addCss = function(text) +{ + if(!this.remove_embeded_styles){ + this.output += text; + } +} +XhtmlSaxListener.prototype.openBlockTag = function(tag, attributes) +{ + this.output += this.helper.tag(tag, this.validator.getValidTagAttributes(tag, attributes), true); +} + +XhtmlSaxListener.prototype.inlineTag = function(tag, attributes) +{ + this.output += this.helper.tag(tag, this.validator.getValidTagAttributes(tag, attributes)); +} + +XhtmlSaxListener.prototype.openUnknownTag = function(tag, attributes) +{ + //this.output += this.helper.tag(tag, attributes, true); +} + +XhtmlSaxListener.prototype.closeBlockTag = function(tag) +{ + this.output += this._getClosingTagContent('before', tag)+""+this._getClosingTagContent('after', tag); +}; + +XhtmlSaxListener.prototype.closeUnknownTag = function(tag) +{ + //this.output += ""; +} + +XhtmlSaxListener.prototype.closeUnopenedTag = function(tag) +{ + this.output += ""; +} + +XhtmlSaxListener.prototype.avoidStylingTagsAndAttributes = function() +{ + this.avoided_tags = ['div','span']; + this.validator.skiped_attributes = ['style']; + this.validator.skiped_attribute_values = ['MsoNormal','main1']; // MS Word attributes for class + this._avoiding_tags_implicitly = true; +} + +XhtmlSaxListener.prototype.allowStylingTagsAndAttributes = function() +{ + this.avoided_tags = []; + this.validator.skiped_attributes = []; + this.validator.skiped_attribute_values = []; + this._avoiding_tags_implicitly = false; +} + +XhtmlSaxListener.prototype.isBlockTag = function(tag) +{ + return !this.avoided_tags.contains(tag) && this.block_tags.contains(tag); +} + +XhtmlSaxListener.prototype.isInlineTag = function(tag) +{ + return !this.avoided_tags.contains(tag) && this.inline_tags.contains(tag); +} + +XhtmlSaxListener.prototype.insertContentAfterClosingTag = function(tag, content) +{ + this._insertContentWhenClosingTag('after', tag, content); +}; + +XhtmlSaxListener.prototype.insertContentBeforeClosingTag = function(tag, content) +{ + this._insertContentWhenClosingTag('before', tag, content); +}; + +XhtmlSaxListener.prototype._insertContentWhenClosingTag = function(position, tag, content) +{ + if(!this['_insert_'+position+'_closing']){ + this['_insert_'+position+'_closing'] = []; + } + if(!this['_insert_'+position+'_closing'][tag]){ + this['_insert_'+position+'_closing'][tag] = []; + } + this['_insert_'+position+'_closing'][tag].push(content); +}; + +XhtmlSaxListener.prototype._getClosingTagContent = function(position, tag) +{ + if( this['_insert_'+position+'_closing'] && + this['_insert_'+position+'_closing'][tag] && + this['_insert_'+position+'_closing'][tag].length > 0){ + return this['_insert_'+position+'_closing'][tag].pop(); + } + return ''; +}; Index: openacs-4/packages/xowiki/www/resources/wymeditor/iframe/default/lbl-blockquote.png =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/resources/wymeditor/iframe/default/lbl-blockquote.png,v diff -u Binary files differ Index: openacs-4/packages/xowiki/www/resources/wymeditor/iframe/default/lbl-h1.png =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/resources/wymeditor/iframe/default/lbl-h1.png,v diff -u Binary files differ Index: openacs-4/packages/xowiki/www/resources/wymeditor/iframe/default/lbl-h2.png =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/resources/wymeditor/iframe/default/lbl-h2.png,v diff -u Binary files differ Index: openacs-4/packages/xowiki/www/resources/wymeditor/iframe/default/lbl-h3.png =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/resources/wymeditor/iframe/default/lbl-h3.png,v diff -u Binary files differ Index: openacs-4/packages/xowiki/www/resources/wymeditor/iframe/default/lbl-h4.png =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/resources/wymeditor/iframe/default/lbl-h4.png,v diff -u Binary files differ Index: openacs-4/packages/xowiki/www/resources/wymeditor/iframe/default/lbl-h5.png =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/resources/wymeditor/iframe/default/lbl-h5.png,v diff -u Binary files differ Index: openacs-4/packages/xowiki/www/resources/wymeditor/iframe/default/lbl-h6.png =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/resources/wymeditor/iframe/default/lbl-h6.png,v diff -u Binary files differ Index: openacs-4/packages/xowiki/www/resources/wymeditor/iframe/default/lbl-p.png =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/resources/wymeditor/iframe/default/lbl-p.png,v diff -u Binary files differ Index: openacs-4/packages/xowiki/www/resources/wymeditor/iframe/default/lbl-pre.png =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/resources/wymeditor/iframe/default/lbl-pre.png,v diff -u Binary files differ Index: openacs-4/packages/xowiki/www/resources/wymeditor/iframe/default/wymiframe.css =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/resources/wymeditor/iframe/default/wymiframe.css,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xowiki/www/resources/wymeditor/iframe/default/wymiframe.css 15 Jul 2007 16:07:45 -0000 1.1 @@ -0,0 +1,89 @@ +/* + * WYMeditor : what you see is What You Mean web-based editor + * Copyright (C) 2007 H.O.net - http://www.honet.be/ + * Dual licensed under the MIT (MIT-license.txt) + * and GPL (GPL-license.txt) licenses. + * + * For further information visit: + * http://www.wymeditor.org/ + * + * File Name: + * wymeditor.css + * Main editor css file. + * See the documentation for more info. + * + * File Authors: + * Jean-Francois Hovinne (jf.hovinne@wymeditor.org) + * Daniel Reszka (d.reszka@wymeditor.org) +*/ + +/* VISUAL FEEDBACK */ + +/* basic */ + body { background: #e1e8f1;} + +/* make HTML blocs visible */ + p, + h1, + h2, + h3, + h4, + h5, + h6, + ul, + ol, + table, + blockquote, + pre { background: #FFFFFF no-repeat 2px 2px; + padding:8px 5px 5px; + margin:10px; } + td { background: #F0F4F8; } + th { background: #ffffcc; } + ul, + ol { border-left:20px solid #B9C4D0; padding:0px 5px; } + caption { background: #E4E4B0; padding: 5px; font-weight: bold; } + table { font-size: 12px; width: 500px; } + td { width: 25%; } + blockquote { margin-left: 30px; } + pre { background-color:transparent; border: 1px solid white; } + +/* Gecko min height fix */ + p { min-height: 1em; } /*min-height is needed under Firefox, because empty parargraphs */ + *+html p { min-height: auto; } /* but we have to remove it under IE7 because it triggers the 'haslayout' mode */ + td { height: 1.6em; } + +/* labels */ + p { background-image: url(lbl-p.png); } + h1 { background-image: url(lbl-h1.png); } + h2 { background-image: url(lbl-h2.png); } + h3 { background-image: url(lbl-h3.png); } + h4 { background-image: url(lbl-h4.png); } + h5 { background-image: url(lbl-h5.png); } + h6 { background-image: url(lbl-h6.png); } + blockquote{ background-image: url(lbl-blockquote.png); } + pre { background-image: url(lbl-pre.png); } + +/* specific HTML elements */ + caption { text-align: left; } + img { margin-right: 5px; + border-style: solid; + border-color: gray; + border-width: 0; } + a img { border-width: 1px; border-color: blue; } + acronym { border: 1px solid gray; } + +/* visual feedback for non-valid nesting of elements*/ + h1 h1, h1 h2, h1 h3, h1 h4, h1 h5, h1 h6, h1 p, h1 pre, h1 address, + h2 h1, h2 h2, h2 h3, h2 h4, h2 h5, h2 h6, h2 p, h2 pre, h2 address, + h3 h1, h3 h2, h3 h3, h3 h4, h3 h5, h3 h6, h3 p, h3 pre, h3 address, + h4 h1, h4 h2, h4 h3, h4 h4, h4 h5, h4 h6, h4 p, h4 pre, h4 address, + h5 h1, h5 h2, h5 h3, h5 h4, h5 h5, h5 h6, h5 p, h5 pre, h5 address, + h6 h1, h6 h2, h6 h3, h6 h4, h6 h4, h6 h6, h6 p, h6 pre, h6 address, + p h1, p h2, p h3, p h4, p h5, p h6, p pre, p address, + pre h1, pre h2, pre h3, pre h4, pre h5, pre h6, pre p, pre pre, pre address, + address h1, address h2, address h3, address h4, address h5, address h6, + address p, address pre, address address + { background-color: #ff9999 !important; + border: 1px solid red !important; + font-size: 12px !important; + font-weight: normal; } Index: openacs-4/packages/xowiki/www/resources/wymeditor/iframe/default/wymiframe.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/resources/wymeditor/iframe/default/wymiframe.html,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xowiki/www/resources/wymeditor/iframe/default/wymiframe.html 15 Jul 2007 16:07:45 -0000 1.1 @@ -0,0 +1,25 @@ + + + + +WYMeditor iframe + + + + Index: openacs-4/packages/xowiki/www/resources/wymeditor/iframe/default/wymiframe.html~ =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/resources/wymeditor/iframe/default/Attic/wymiframe.html~,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xowiki/www/resources/wymeditor/iframe/default/wymiframe.html~ 15 Jul 2007 16:07:45 -0000 1.1 @@ -0,0 +1,25 @@ + + + + +WYMeditor iframe + + + + Index: openacs-4/packages/xowiki/www/resources/wymeditor/lang/ca.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/resources/wymeditor/lang/ca.js,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xowiki/www/resources/wymeditor/lang/ca.js 15 Jul 2007 16:07:46 -0000 1.1 @@ -0,0 +1,47 @@ +if(!WYM_STRINGS) var WYM_STRINGS = new Array(); + +var WYM_STRINGS_CA = { + Strong: 'Ressaltar', + Emphasis: 'Emfatitzar', + Superscript: 'Superindex', + Subscript: 'Subindex', + Ordered_List: 'Llistat ordenat', + Unordered_List: 'Llistat sense ordenar', + Indent: 'Indentat', + Outdent: 'Sense indentar', + Undo: 'Desfer', + Redo: 'Refer', + Link: 'Enllaçar', + Unlink: 'Eliminar enllaç', + Image: 'Imatge', + Table: 'Taula', + HTML: 'HTML', + Paragraph: 'Paràgraf', + Heading_1: 'Capçalera 1', + Heading_2: 'Capçalera 2', + Heading_3: 'Capçalera 3', + Heading_4: 'Capçalera 4', + Heading_5: 'Capçalera 5', + Heading_6: 'Capçalera 6', + Preformatted: 'Pre-formatejat', + Blockquote: 'Cita', + Table_Header: 'Capçalera de la taula', + URL: 'URL', + Title: 'Títol', + Alternative_Text: 'Text alternatiu', + Caption: 'Llegenda', + Number_Of_Rows: 'Nombre de files', + Number_Of_Cols: 'Nombre de columnes', + Submit: 'Enviar', + Cancel: 'Cancel·lar', + Choose: 'Triar', + Preview: 'Vista prèvia', + Paste_From_Word: 'Pegar des de Word', + Tools: 'Eines', + Containers: 'Contenidors', + Classes: 'Classes', + Status: 'Estat', + Source_Code: 'Codi font' +}; + +WYM_STRINGS['ca'] = WYM_STRINGS_CA; Index: openacs-4/packages/xowiki/www/resources/wymeditor/lang/de.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/resources/wymeditor/lang/de.js,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xowiki/www/resources/wymeditor/lang/de.js 15 Jul 2007 16:07:46 -0000 1.1 @@ -0,0 +1,47 @@ +if(!WYM_STRINGS) var WYM_STRINGS = new Array(); + +var WYM_STRINGS_DE = { + Strong: 'Fett', + Emphasis: 'Kursiv', + Superscript: 'Text hochstellen', + Subscript: 'Text tiefstellen', + Ordered_List: 'Geordnete Liste einfügen', + Unordered_List: 'Ungeordnete Liste einfügen', + Indent: 'Einzug erhöhen', + Outdent: 'Einzug vermindern', + Undo: 'Befehle rückgängig machen', + Redo: 'Befehle wiederherstellen', + Link: 'Hyperlink einfügen', + Unlink: 'Hyperlink entfernen', + Image: 'Bild einfügen', + Table: 'Tabelle einfügen', + HTML: 'HTML anzeigen/verstecken', + Paragraph: 'Absatz', + Heading_1: 'Überschrift 1', + Heading_2: 'Überschrift 2', + Heading_3: 'Überschrift 3', + Heading_4: 'Überschrift 4', + Heading_5: 'Überschrift 5', + Heading_6: 'Überschrift 6', + Preformatted: 'Vorformatiert', + Blockquote: 'Zitat', + Table_Header: 'Tabellenüberschrift', + URL: 'URL', + Title: 'Titel', + Alternative_Text: 'Alternativer Text', + Caption: 'Tabellenüberschrift', + Number_Of_Rows: 'Anzahl Zeilen', + Number_Of_Cols: 'Anzahl Spalten', + Submit: 'Absenden', + Cancel: 'Abbrechen', + Choose: 'Auswählen', + Preview: 'Vorschau', + Paste_From_Word: 'Aus Word einfügen', + Tools: 'Werkzeuge', + Containers: 'Inhaltstyp', + Classes: 'Klassen', + Status: 'Status', + Source_Code: 'Quellcode' +}; + +WYM_STRINGS['de'] = WYM_STRINGS_DE; Index: openacs-4/packages/xowiki/www/resources/wymeditor/lang/en.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/resources/wymeditor/lang/en.js,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xowiki/www/resources/wymeditor/lang/en.js 15 Jul 2007 16:07:46 -0000 1.1 @@ -0,0 +1,47 @@ +if(!WYM_STRINGS) var WYM_STRINGS = new Array(); + +var WYM_STRINGS_EN = { + Strong: 'Strong', + Emphasis: 'Emphasis', + Superscript: 'Superscript', + Subscript: 'Subscript', + Ordered_List: 'Ordered List', + Unordered_List: 'Unordered List', + Indent: 'Indent', + Outdent: 'Outdent', + Undo: 'Undo', + Redo: 'Redo', + Link: 'Link', + Unlink: 'Unlink', + Image: 'Image', + Table: 'Table', + HTML: 'HTML', + Paragraph: 'Paragraph', + Heading_1: 'Heading 1', + Heading_2: 'Heading 2', + Heading_3: 'Heading 3', + Heading_4: 'Heading 4', + Heading_5: 'Heading 5', + Heading_6: 'Heading 6', + Preformatted: 'Preformatted', + Blockquote: 'Blockquote', + Table_Header: 'Table Header', + URL: 'URL', + Title: 'Title', + Alternative_Text: 'Alternative text', + Caption: 'Caption', + Number_Of_Rows: 'Number of rows', + Number_Of_Cols: 'Number of cols', + Submit: 'Submit', + Cancel: 'Cancel', + Choose: 'Choose', + Preview: 'Preview', + Paste_From_Word: 'Paste from Word', + Tools: 'Tools', + Containers: 'Containers', + Classes: 'Classes', + Status: 'Status', + Source_Code: 'Source code' +}; + +WYM_STRINGS['en'] = WYM_STRINGS_EN; Index: openacs-4/packages/xowiki/www/resources/wymeditor/lang/es.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/resources/wymeditor/lang/es.js,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xowiki/www/resources/wymeditor/lang/es.js 15 Jul 2007 16:07:46 -0000 1.1 @@ -0,0 +1,47 @@ +if(!WYM_STRINGS) var WYM_STRINGS = new Array(); + +var WYM_STRINGS_ES = { + Strong: 'Resaltar', + Emphasis: 'Enfatizar', + Superscript: 'Superindice', + Subscript: 'Subindice', + Ordered_List: 'Lista ordenada', + Unordered_List: 'Lista sin ordenar', + Indent: 'Indentado', + Outdent: 'Sin indentar', + Undo: 'Deshacer', + Redo: 'Rehacer', + Link: 'Enlazar', + Unlink: 'Eliminar enlace', + Image: 'Imagen', + Table: 'Tabla', + HTML: 'HTML', + Paragraph: 'Párrafo', + Heading_1: 'Cabecera 1', + Heading_2: 'Cabecera 2', + Heading_3: 'Cabecera 3', + Heading_4: 'Cabecera 4', + Heading_5: 'Cabecera 5', + Heading_6: 'Cabecera 6', + Preformatted: 'Preformateado', + Blockquote: 'Cita', + Table_Header: 'Cabecera de la tabla', + URL: 'URL', + Title: 'Título', + Alternative_Text: 'Texto alternativo', + Caption: 'Leyenda', + Number_Of_Rows: 'Número de filas', + Number_Of_Cols: 'Número de columnas', + Submit: 'Enviar', + Cancel: 'Cancelar', + Choose: 'Seleccionar', + Preview: 'Vista previa', + Paste_From_Word: 'Pegar desde Word', + Tools: 'Herramientas', + Containers: 'Contenedores', + Classes: 'Clases', + Status: 'Estado', + Source_Code: 'Código fuente' +}; + +WYM_STRINGS['es'] = WYM_STRINGS_ES; Index: openacs-4/packages/xowiki/www/resources/wymeditor/lang/fr.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/resources/wymeditor/lang/fr.js,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xowiki/www/resources/wymeditor/lang/fr.js 15 Jul 2007 16:07:46 -0000 1.1 @@ -0,0 +1,47 @@ +if(!WYM_STRINGS) var WYM_STRINGS = new Array(); + +var WYM_STRINGS_FR = { + Strong: 'Mise en évidence', + Emphasis: 'Emphase', + Superscript: 'Exposant', + Subscript: 'Indice', + Ordered_List: 'Liste Ordonnée', + Unordered_List: 'Liste Non-Ordonnée', + Indent: 'Imbriqué', + Outdent: 'Non-imbriqué', + Undo: 'Annuler', + Redo: 'Rétablir', + Link: 'Lien', + Unlink: 'Supprimer le Lien', + Image: 'Image', + Table: 'Tableau', + HTML: 'HTML', + Paragraph: 'Paragraphe', + Heading_1: 'Titre 1', + Heading_2: 'Titre 2', + Heading_3: 'Titre 3', + Heading_4: 'Titre 4', + Heading_5: 'Titre 5', + Heading_6: 'Titre 6', + Preformatted: 'Pré-formatté', + Blockquote: 'Citation', + Table_Header: 'Cellule de titre', + URL: 'URL', + Title: 'Titre', + Alternative_Text: 'Texte alternatif', + Caption: 'Légende', + Number_Of_Rows: 'Nombre de lignes', + Number_Of_Cols: 'Nombre de colonnes', + Submit: 'Envoyer', + Cancel: 'Annuler', + Choose: 'Choisir', + Preview: 'Prévisualisation', + Paste_From_Word: 'Copier depuis Word', + Tools: 'Outils', + Containers: 'Type de texte', + Classes: 'Type de contenu', + Status: 'Infos', + Source_Code: 'Code source' +}; + +WYM_STRINGS['fr'] = WYM_STRINGS_FR; Index: openacs-4/packages/xowiki/www/resources/wymeditor/lang/hu.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/resources/wymeditor/lang/hu.js,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xowiki/www/resources/wymeditor/lang/hu.js 15 Jul 2007 16:07:46 -0000 1.1 @@ -0,0 +1,47 @@ +if(!WYM_STRINGS) var WYM_STRINGS = new Array(); + +var WYM_STRINGS_HU = { + Strong: 'Félkövér', + Emphasis: 'Kiemelt', + Superscript: 'Felső index', + Subscript: 'Alsó index', + Ordered_List: 'Rendezett lista', + Unordered_List: 'Rendezetlen lista', + Indent: 'Bekezdés', + Outdent: 'Bekezdés törlése', + Undo: 'Visszavon', + Redo: 'Visszaállít', + Link: 'Link', + Unlink: 'Link törlése', + Image: 'Kép', + Table: 'Tábla', + HTML: 'HTML', + Paragraph: 'Bekezdés', + Heading_1: 'Címsor 1', + Heading_2: 'Címsor 2', + Heading_3: 'Címsor 3', + Heading_4: 'Címsor 4', + Heading_5: 'Címsor 5', + Heading_6: 'Címsor 6', + Preformatted: 'Előformázott', + Blockquote: 'Idézet', + Table_Header: 'Tábla Fejléc', + URL: 'Webcím', + Title: 'Megnevezés', + Alternative_Text: 'Alternatív szöveg', + Caption: 'Fejléc', + Number_Of_Rows: 'Sorok száma', + Number_Of_Cols: 'Oszlopok száma', + Submit: 'Elküld', + Cancel: 'Mégsem', + Choose: 'Választ', + Preview: 'Előnézet', + Paste_From_Word: 'Másolás Word-ból', + Tools: 'Eszközök', + Containers: 'Tartalmak', + Classes: 'Osztályok', + Status: 'Állapot', + Source_Code: 'Forráskód' +}; + +WYM_STRINGS['hu'] = WYM_STRINGS_HU; Index: openacs-4/packages/xowiki/www/resources/wymeditor/lang/it.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/resources/wymeditor/lang/it.js,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xowiki/www/resources/wymeditor/lang/it.js 15 Jul 2007 16:07:46 -0000 1.1 @@ -0,0 +1,47 @@ +if(!WYM_STRINGS) var WYM_STRINGS = new Array(); + +var WYM_STRINGS_IT = { + Strong: 'Grassetto', + Emphasis: 'Corsetto', + Superscript: 'Apice', + Subscript: 'Pedice', + Ordered_List: 'Lista Ordinata', + Unordered_List: 'Lista Puntata', + Indent: 'Indenta', + Outdent: 'Caccia', + Undo: 'Indietro', + Redo: 'Avanti', + Link: 'Inserisci Link', + Unlink: 'Togli Link', + Image: 'Inserisci Immagine', + Table: 'Inserisci Tabella', + HTML: 'HTML', + Paragraph: 'Paragrafo', + Heading_1: 'Heading 1', + Heading_2: 'Heading 2', + Heading_3: 'Heading 3', + Heading_4: 'Heading 4', + Heading_5: 'Heading 5', + Heading_6: 'Heading 6', + Preformatted: 'Preformattato', + Blockquote: 'Blockquote', + Table_Header: 'Header Tabella', + URL: 'Indirizzo', + Title: 'Titolo', + Alternative_Text: 'Testo Alternativo', + Caption: 'Caption', + Number_Of_Rows: 'Numero di Righe', + Number_Of_Cols: 'Numero di Colonne', + Submit: 'Invia', + Cancel: 'Cancella', + Choose: 'Scegli', + Preview: 'Anteprima', + Paste_From_Word: 'Incolla', + Tools: 'Tools', + Containers: 'Contenitori', + Classes: 'Classi', + Status: 'Stato', + Source_Code: 'Codice Sorgente' +}; + +WYM_STRINGS['it'] = WYM_STRINGS_IT; Index: openacs-4/packages/xowiki/www/resources/wymeditor/lang/nl.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/resources/wymeditor/lang/nl.js,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xowiki/www/resources/wymeditor/lang/nl.js 15 Jul 2007 16:07:46 -0000 1.1 @@ -0,0 +1,47 @@ +if(!WYM_STRINGS) var WYM_STRINGS = new Array(); + +var WYM_STRINGS_NL = { + Strong: 'Sterk benadrukken', + Emphasis: 'Benadrukken', + Superscript: 'Bovenschrift', + Subscript: 'Onderschrift', + Ordered_List: 'Geordende lijst', + Unordered_List: 'Ongeordende lijst', + Indent: 'Inspringen', + Outdent: 'Terugspringen', + Undo: 'Ongedaan maken', + Redo: 'Opnieuw uitvoeren', + Link: 'Linken', + Unlink: 'Ontlinken', + Image: 'Afbeelding', + Table: 'Tabel', + HTML: 'HTML', + Paragraph: 'Paragraaf', + Heading_1: 'Hoofding 1', + Heading_2: 'Hoofding 2', + Heading_3: 'Hoofding 3', + Heading_4: 'Hoofding 4', + Heading_5: 'Hoofding 5', + Heading_6: 'Hoofding 6', + Preformatted: 'Voorgeformatteerd', + Blockquote: 'Aanhaling', + Table_Header: 'Tabel hoofding', + URL: 'URL', + Title: 'Titel', + Alternative_Text: 'Alternatieve tekst', + Caption: 'Bijschrift', + Number_Of_Rows: 'Aantal rijen', + Number_Of_Cols: 'Aantal kolommen', + Submit: 'Versturen', + Cancel: 'Annuleren', + Choose: 'Kiezen', + Preview: 'Voorbeeld bekijken', + Paste_From_Word: 'Plakken uit Word', + Tools: 'Tools', + Containers: 'Containers', + Classes: 'Classes', + Status: 'Status', + Source_Code: 'Broncode' +}; + +WYM_STRINGS['nl'] = WYM_STRINGS_NL; Index: openacs-4/packages/xowiki/www/resources/wymeditor/lang/pl.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/resources/wymeditor/lang/pl.js,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xowiki/www/resources/wymeditor/lang/pl.js 15 Jul 2007 16:07:46 -0000 1.1 @@ -0,0 +1,47 @@ +if(!WYM_STRINGS) var WYM_STRINGS = new Array(); + +var WYM_STRINGS_PL = { + Strong: 'Nacisk', + Emphasis: 'Emfaza', + Superscript: 'Indeks górny', + Subscript: 'Indeks dolny', + Ordered_List: 'Lista numerowana', + Unordered_List: 'Lista wypunktowana', + Indent: 'Zwiększ wcięcie', + Outdent: 'Zmniejsz wcięcie', + Undo: 'Cofnij', + Redo: 'Ponów', + Link: 'Wstaw link', + Unlink: 'Usuń link', + Image: 'Obraz', + Table: 'Tabela', + HTML: 'Źródło HTML', + Paragraph: 'Akapit', + Heading_1: 'Nagłówek 1', + Heading_2: 'Nagłówek 2', + Heading_3: 'Nagłówek 3', + Heading_4: 'Nagłówek 4', + Heading_5: 'Nagłówek 5', + Heading_6: 'Nagłówek 6', + Preformatted: 'Preformatowany', + Blockquote: 'Cytat blokowy', + Table_Header: 'Nagłówek tabeli', + URL: 'URL', + Title: 'Tytuł', + Alternative_Text: 'Tekst alternatywny', + Caption: 'Tytuł tabeli', + Number_Of_Rows: 'Liczba wierszy', + Number_Of_Cols: 'Liczba kolumn', + Submit: 'Wyślij', + Cancel: 'Anuluj', + Choose: 'Wybierz', + Preview: 'Podgląd', + Paste_From_Word: 'Wklej z Worda', + Tools: 'Narzędzia', + Containers: 'Format', + Classes: 'Styl', + Status: 'Status', + Source_Code: 'Kod źródłowy' +}; + +WYM_STRINGS['pl'] = WYM_STRINGS_PL; Index: openacs-4/packages/xowiki/www/resources/wymeditor/lang/sv.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/resources/wymeditor/lang/sv.js,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xowiki/www/resources/wymeditor/lang/sv.js 15 Jul 2007 16:07:46 -0000 1.1 @@ -0,0 +1,47 @@ +if(!WYM_STRINGS) var WYM_STRINGS = new Array(); + +var WYM_STRINGS_SV = { + Strong: 'Viktigt', + Emphasis: 'Betoning', + Superscript: 'Upphöjt', + Subscript: 'Nedsänkt', + Ordered_List: 'Nummerlista', + Unordered_List: 'Punktlista', + Indent: 'Indrag', + Outdent: 'Utdrag', + Undo: 'Ångra', + Redo: 'Gör om', + Link: 'Länk', + Unlink: 'Ta bort länk', + Image: 'Bild', + Table: 'Tabell', + HTML: 'HTML', + Paragraph: 'Paragraf', + Heading_1: 'Rubrik 1', + Heading_2: 'Rubrik 2', + Heading_3: 'Rubrik 3', + Heading_4: 'Rubrik 4', + Heading_5: 'Rubrik 5', + Heading_6: 'Rubrik 6', + Preformatted: 'Förformaterad', + Blockquote: 'Blockcitat', + Table_Header: 'Tabellrubrik', + URL: 'URL', + Title: 'Titel', + Alternative_Text: 'Alternativ text', + Caption: 'Överskrift', + Number_Of_Rows: 'Antal rader', + Number_Of_Cols: 'Antal kolumner', + Submit: 'Skicka', + Cancel: 'Avbryt', + Choose: 'Välj', + Preview: 'Förhandsgranska', + Paste_From_Word: 'Klistra in från Word', + Tools: 'Verktyg', + Containers: 'Formatering', + Classes: 'Klasser', + Status: 'Status', + Source_Code: 'Källkod' +}; + +WYM_STRINGS['sv'] = WYM_STRINGS_SV; Index: openacs-4/packages/xowiki/www/resources/wymeditor/plugins/hovertools/jquery.wymeditor.hovertools.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/resources/wymeditor/plugins/hovertools/jquery.wymeditor.hovertools.js,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xowiki/www/resources/wymeditor/plugins/hovertools/jquery.wymeditor.hovertools.js 15 Jul 2007 16:07:46 -0000 1.1 @@ -0,0 +1,57 @@ +/* + * WYMeditor : what you see is What You Mean web-based editor + * Copyright (C) 2007 H.O.net - http://www.honet.be/ + * Dual licensed under the MIT (MIT-license.txt) + * and GPL (GPL-license.txt) licenses. + * + * For further information visit: + * http://www.wymeditor.org/ + * + * File Name: + * jquery.wymeditor.hovertools.js + * hovertools plugin for WYMeditor + * + * File Authors: + * Jean-Francois Hovinne (jf.hovinne@wymeditor.org) + */ + +//Extend WYMeditor +Wymeditor.prototype.hovertools = function() { + + var wym = this; + + //bind events on buttons + $j(this._box).find(this._options.toolSelector).hover( + function() { + wym.status($j(this).html()); + }, + function() { + wym.status(' '); + } + ); + + //classes: add/remove a style attr to matching elems + //while mouseover/mouseout + $j(this._box).find(this._options.classSelector).hover( + function() { + var aClasses = eval(wym._options.classesItems); + var sName = $j(this).attr(WYM_NAME); + var oClass = aClasses.findByName(sName); + + if(oClass){ + jqexpr = oClass.expr; + //don't use jQuery.find() on the iframe body + //because of MSIE + jQuery + expando issue (#JQ1143) + if(!$j.browser.msie) + $j(wym._doc).find(jqexpr).css('background-color','#cfc'); + } + }, + function() { + //don't use jQuery.find() on the iframe body + //because of MSIE + jQuery + expando issue (#JQ1143) + if(!$j.browser.msie) + $j(wym._doc).find('*').removeAttr('style'); + } + ); + +}; Index: openacs-4/packages/xowiki/www/resources/wymeditor/plugins/tidy/README =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/resources/wymeditor/plugins/tidy/README,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xowiki/www/resources/wymeditor/plugins/tidy/README 15 Jul 2007 16:07:46 -0000 1.1 @@ -0,0 +1,19 @@ +WYMeditor : what you see is What You Mean web-based editor +Copyright (C) 2007 H.O.net - http://www.honet.be/ +Dual licensed under the MIT (MIT-license.txt) +and GPL (GPL-license.txt) licenses. + +For further information visit: + http://www.wymeditor.org/ + +File Name: + README - HTML Tidy plugin for WYMeditor + +File Authors: + Jean-François Hovinne (jf.hovinne@wymeditor.org) + +Credits: + 'HTML Tidy' by Dave Ragget - http://tidy.sourceforge.net/ + Icon 'wand' by Mark James - http://famfamfam.com/ + +WYMeditor documentation is available online at http://www.wymeditor.org/ Index: openacs-4/packages/xowiki/www/resources/wymeditor/plugins/tidy/jquery.wymeditor.tidy.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/resources/wymeditor/plugins/tidy/jquery.wymeditor.tidy.js,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xowiki/www/resources/wymeditor/plugins/tidy/jquery.wymeditor.tidy.js 15 Jul 2007 16:07:46 -0000 1.1 @@ -0,0 +1,82 @@ +/* + * WYMeditor : what you see is What You Mean web-based editor + * Copyright (C) 2007 H.O.net - http://www.honet.be/ + * Dual licensed under the MIT (MIT-license.txt) + * and GPL (GPL-license.txt) licenses. + * + * For further information visit: + * http://www.wymeditor.org/ + * + * File Name: + * jquery.wymeditor.tidy.js + * HTML Tidy plugin for WYMeditor + * + * File Authors: + * Jean-Francois Hovinne (jf.hovinne@wymeditor.org) + */ + +//Extend WYMeditor +Wymeditor.prototype.tidy = function(options) { + var tidy = new WymTidy(options, this); + return(tidy); +}; + +//WymTidy constructor +function WymTidy(options, wym) { + + options = $j.extend({ + + sUrl: "wymeditor/plugins/tidy/tidy.php", + sButtonHtml: "
  • " + + "" + + "Clean up HTML" + + "
  • ", + + sButtonSelector: "li.wym_tools_tidy a" + + }, options); + + this._options = options; + this._wym = wym; + +}; + +//WymTidy initialization +WymTidy.prototype.init = function() { + + var tidy = this; + + $j(this._wym._box).find( + this._wym._options.toolsSelector + this._wym._options.toolsListSelector) + .append(this._options.sButtonHtml); + + //handle click event + $j(this._wym._box).find(this._options.sButtonSelector).click(function() { + tidy.cleanup(); + return(false); + }); + +}; + +//WymTidy cleanup +WymTidy.prototype.cleanup = function() { + + var wym = this._wym; + var html = "" + wym.xhtml() + ""; + + $j.post(this._options.sUrl, { html: html}, function(data) { + + if(data.length > 0 && data != '0') { + if(data.indexOf(" 0) { + + // Specify configuration + $config = array( + 'bare' => true, + 'clean' => true, + 'doctype' => 'strict', + 'drop-empty-paras' => true, + 'drop-font-tags' => true, + 'drop-proprietary-attributes' => true, + 'enclose-block-text' => true, + 'indent' => false, + 'join-classes' => true, + 'join-styles' => true, + 'logical-emphasis' => true, + 'output-xhtml' => true, + 'show-body-only' => true, + 'wrap' => 0); + + // Tidy + $tidy = new tidy; + $tidy->parseString($html, $config, 'utf8'); + $tidy->cleanRepair(); + + // Output + echo $tidy; +} else { + +echo ('0'); +} +?> Index: openacs-4/packages/xowiki/www/resources/wymeditor/plugins/tidy/wand.png =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/resources/wymeditor/plugins/tidy/wand.png,v diff -u Binary files differ Index: openacs-4/packages/xowiki/www/resources/wymeditor/skins/default/icons.png =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/resources/wymeditor/skins/default/icons.png,v diff -u Binary files differ Index: openacs-4/packages/xowiki/www/resources/wymeditor/skins/default/screen.css =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/resources/wymeditor/skins/default/screen.css,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xowiki/www/resources/wymeditor/skins/default/screen.css 15 Jul 2007 16:07:46 -0000 1.1 @@ -0,0 +1,131 @@ +/* + * WYMeditor : what you see is What You Mean web-based editor + * Copyright (C) 2007 H.O.net - http://www.honet.be/ + * Dual licensed under the MIT (MIT-license.txt) + * and GPL (GPL-license.txt) licenses. + * + * For further information visit: + * http://www.wymeditor.org/ + * + * File Name: + * screen.css + * main stylesheet for the default WYMeditor skin + * See the documentation for more info. + * + * File Authors: + * Daniel Reszka (d.reszka@wymeditor.org) +*/ + +/*TRYING TO RESET STYLES THAT MAY INTERFERE WITH WYMEDITOR*/ + .wym_skin_default p, .wym_skin_default h2, .wym_skin_default h3, + .wym_skin_default ul, .wym_skin_default li { background: transparent url(); margin: 0; padding: 0; border-width:0; list-style: none; } + + +/*HIDDEN BY DEFAULT*/ + .wym_skin_default .wym_area_left, + .wym_skin_default .wym_area_right { display: none; } + + +/*TYPO*/ + .wym_skin_default { font-size: 62.5%; font-family: Verdana, Arial, sans-serif; } + .wym_skin_default h2 { font-size: 110%; /* = 11px */} + .wym_skin_default h3 { font-size: 100%; /* = 10px */} + .wym_skin_default li { font-size: 100%; /* = 10px */} + + +/*WYM_BOX*/ + .wym_skin_default { border: 1px solid gray; background: #f2f2f2; padding: 5px} + + /*auto-clear the wym_box*/ + .wym_skin_default:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; } + * html .wym_skin_default { height: 1%;} + + +/*WYM_HTML*/ + .wym_skin_default .wym_html { width: 98%;} + .wym_skin_default .wym_html textarea { width: 100%; height: 200px; border: 1px solid gray; background: white; } + + +/*WYM_IFRAME*/ + .wym_skin_default .wym_iframe { width: 98%;} + .wym_skin_default .wym_iframe iframe { width: 100%; height: 200px; border: 1px solid gray; background: white } + + +/*AREAS*/ + .wym_skin_default .wym_area_left { width: 150px; float: left;} + .wym_skin_default .wym_area_right { width: 150px; float: right;} + .wym_skin_default .wym_area_bottom { clear: both;} + * html .wym_skin_default .wym_area_main { height: 1%;} + * html .wym_skin_default .wym_area_top { height: 1%;} + *+html .wym_skin_default .wym_area_top { height: 1%;} + +/*SECTIONS SYSTEM*/ + + /*common defaults for all sections*/ + .wym_skin_default .wym_section { margin-bottom: 5px; } + .wym_skin_default .wym_section h2, + .wym_skin_default .wym_section h3 { padding: 1px 3px; margin: 0; } + .wym_skin_default .wym_section a { padding: 0 3px; display: block; text-decoration: none; color: black; } + .wym_skin_default .wym_section a:hover { background-color: yellow; } + /*hide section titles by default*/ + .wym_skin_default .wym_section h2 { display: none; } + /*disable any margin-collapse*/ + .wym_skin_default .wym_section { padding-top: 1px; padding-bottom: 1px; } + /*auto-clear sections*/ + .wym_skin_default .wym_section ul:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; } + * html .wym_skin_default .wym_section ul { height: 1%;} + + /*option: add this class to a section to make it render as a panel*/ + .wym_skin_default .wym_panel { } + .wym_skin_default .wym_panel h2 { display: block; } + + /*option: add this class to a section to make it render as a dropdown menu*/ + .wym_skin_default .wym_dropdown h2 { display: block; } + .wym_skin_default .wym_dropdown ul { display: none; position: absolute; background: white; } + .wym_skin_default .wym_dropdown:hover ul, + .wym_skin_default .wym_dropdown.hover ul { display: block; } + + /*option: add this class to a section to make its elements render buttons (icons are only available for the wym_tools section for now)*/ + .wym_skin_default .wym_buttons li { float:left;} + .wym_skin_default .wym_buttons a { width: 20px; height: 20px; overflow: hidden; padding: 2px } + /*image replacements*/ + .wym_skin_default .wym_buttons li a { background: url(icons.png) no-repeat; text-indent: -9999px;} + .wym_skin_default .wym_buttons li.wym_tools_strong a { background-position: 0 -382px;} + .wym_skin_default .wym_buttons li.wym_tools_emphasis a { background-position: 0 -22px;} + .wym_skin_default .wym_buttons li.wym_tools_superscript a { background-position: 0 -430px;} + .wym_skin_default .wym_buttons li.wym_tools_subscript a { background-position: 0 -454px;} + .wym_skin_default .wym_buttons li.wym_tools_ordered_list a { background-position: 0 -48px;} + .wym_skin_default .wym_buttons li.wym_tools_unordered_list a{ background-position: 0 -72px;} + .wym_skin_default .wym_buttons li.wym_tools_indent a { background-position: 0 -574px;} + .wym_skin_default .wym_buttons li.wym_tools_outdent a { background-position: 0 -598px;} + .wym_skin_default .wym_buttons li.wym_tools_undo a { background-position: 0 -502px;} + .wym_skin_default .wym_buttons li.wym_tools_redo a { background-position: 0 -526px;} + .wym_skin_default .wym_buttons li.wym_tools_link a { background-position: 0 -96px;} + .wym_skin_default .wym_buttons li.wym_tools_unlink a { background-position: 0 -168px;} + .wym_skin_default .wym_buttons li.wym_tools_image a { background-position: 0 -121px;} + .wym_skin_default .wym_buttons li.wym_tools_table a { background-position: 0 -144px;} + .wym_skin_default .wym_buttons li.wym_tools_paste a { background-position: 0 -552px;} + .wym_skin_default .wym_buttons li.wym_tools_html a { background-position: 0 -193px;} + .wym_skin_default .wym_buttons li.wym_tools_preview a { background-position: 0 -408px;} + +/*DECORATION*/ + .wym_skin_default .wym_section h2 { background: #ddd; border: solid gray; border-width: 0 0 1px;} + .wym_skin_default .wym_section h2 span { color: gray;} + .wym_skin_default .wym_panel { padding: 0; border: solid gray; border-width: 1px; background: white;} + .wym_skin_default .wym_panel ul { margin: 2px 0 5px; } + .wym_skin_default .wym_dropdown { padding: 0; border: solid gray; border-width: 1px 1px 0 1px; } + .wym_skin_default .wym_dropdown ul { border: solid gray; border-width: 0 1px 1px 1px; margin-left: -1px; padding: 5px 10px 5px 3px;} + +/*DIALOGS*/ + .wym_dialog div.row { margin-bottom: 5px;} + .wym_dialog div.row input { margin-right: 5px;} + .wym_dialog div.row label { float: left; width: 150px; display: block; text-align: right; margin-right: 10px; } + .wym_dialog div.row-indent { padding-left: 160px; } + /*autoclearing*/ + .wym_dialog div.row:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; } + .wym_dialog div.row { display: inline-block; } + /* Hides from IE-mac \*/ + * html .wym_dialog div.row { height: 1%; } + .wym_dialog div.row { display: block; } + /* End hide from IE-mac */ +