Added: ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/image.js
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/image.js?rev=1178141&view=auto ============================================================================== --- ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/image.js (added) +++ ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/image.js Sun Oct 2 08:06:49 2011 @@ -0,0 +1,421 @@ +/** + * @class button - insert/edit image (open dialog window) + * + * @param elRTE rte обÑекÑ-ÑедакÑÐ¾Ñ + * @param String name название кнопки + * + * @author: Dmitry Levashov (dio) [hidden email] + * Copyright: Studio 42, http://www.std42.ru + **/ +(function($) { +elRTE.prototype.ui.prototype.buttons.image = function(rte, name) { + this.constructor.prototype.constructor.call(this, rte, name); + var self = this, + rte = self.rte, + proportion = 0, + width = 0, + height = 0, + bookmarks = null, + reset = function(nosrc) { + $.each(self.src, function(i, elements) { + $.each(elements, function(n, el) { + if (n == 'src' && nosrc) { + return; + } + el.val(''); + }); + }); + }, + values = function(img) { + $.each(self.src, function(i, elements) { + $.each(elements, function(n, el) { + var val, w, c, s, border; + + if (n == 'width') { + val = img.width(); + } else if (n == 'height') { + val = img.height(); + } else if (n == 'border') { + val = ''; + border = img.css('border') || rte.utils.parseStyle(img.attr('style')).border || ''; + + if (border) { + w = border.match(/(\d(px|em|%))/); + c = border.match(/(#[a-z0-9]+)/); + val = { + width : w ? w[1] : border, + style : border, + color : rte.utils.color2Hex(c ? c[1] : border) + } + } + } else if (n == 'margin') { + val = img; + } else if (n == 'align') { + val = img.css('float'); + + if (val != 'left' && val != 'right') { + val = img.css('vertical-align'); + } + }else { + val = img.attr(n)||''; + } + + if (i == 'events') { + val = rte.utils.trimEventCallback(val); + } + + el.val(val); + }); + }); + }, + preview = function() { + var src = self.src.main.src.val(); + + reset(true); + + if (!src) { + self.preview.children('img').remove(); + self.prevImg = null; + } else { + if (self.prevImg) { + self.prevImg + .removeAttr('src') + .removeAttr('style') + .removeAttr('class') + .removeAttr('id') + .removeAttr('title') + .removeAttr('alt') + .removeAttr('longdesc'); + + $.each(self.src.events, function(name, input) { + self.prevImg.removeAttr(name); + }); + } else { + self.prevImg = $('<img/>').prependTo(self.preview); + } + self.prevImg.load(function() { + self.prevImg.unbind('load'); + setTimeout(function() { + width = self.prevImg.width(); + height = self.prevImg.height(); + proportion = (width/height).toFixed(2); + self.src.main.width.val(width); + self.src.main.height.val(height); + + }, 100); + }) + .attr('src', src); + } + + }, + size = function(e) { + var w = parseInt(self.src.main.width.val())||0, + h = parseInt(self.src.main.height.val())||0; + + if (self.prevImg) { + if (w && h) { + if (e.target === self.src.main.width[0]) { + h = parseInt(w/proportion); + } else { + w = parseInt(h*proportion); + } + } else { + w = width; + h = height; + } + self.src.main.height.val(h); + self.src.main.width.val(w); + self.prevImg.width(w).height(h); + self.src.adv.style.val(self.prevImg.attr('style')); + } + } + ; + + this.img = null; + this.prevImg = null; + this.preview = $('<div class="elrte-image-preview"/>').text('Proin elit arcu, rutrum commodo, vehicula tempus, commodo a, risus. Curabitur nec arcu. Donec sollicitudin mi sit amet mauris. Nam elementum quam ullamcorper ante. Etiam aliquet massa et lorem. Mauris dapibus lacus auctor risus. Aenean tempor ullamcorper leo. Vivamus sed magna quis ligula eleifend adipiscing. Duis orci. Aliquam sodales tortor vitae ipsum. Aliquam nulla. Duis aliquam molestie erat. Ut et mauris vel pede varius sollicitudin'); + + this.init = function() { + this.labels = { + main : 'Properies', + link : 'Link', + adv : 'Advanced', + events : 'Events', + id : 'ID', + 'class' : 'Css class', + style : 'Css style', + longdesc : 'Detail description URL', + href : 'URL', + target : 'Open in', + title : 'Title' + } + + this.src = { + main : { + src : $('<input type="text" />').css('width', '100%').change(preview), + title : $('<input type="text" />').css('width', '100%'), + alt : $('<input type="text" />').css('width', '100%'), + width : $('<input type="text" />').attr('size', 5).css('text-align', 'right').change(size), + height : $('<input type="text" />').attr('size', 5).css('text-align', 'right').change(size), + margin : $('<div />').elPaddingInput({ + type : 'margin', + change : function() { + var margin = self.src.main.margin.val(); + + if (self.prevImg) { + if (margin.css) { + self.prevImg.css('margin', margin.css) + } else { + self.prevImg.css({ + 'margin-left' : margin.left, + 'margin-top' : margin.top, + 'margin-right' : margin.right, + 'margin-bottom' : margin.bottom + }); + } + } + } + }), + align : $('<select />').css('width', '100%') + .append($('<option />').val('').text(this.rte.i18n('Not set', 'dialogs'))) + .append($('<option />').val('left' ).text(this.rte.i18n('Left'))) + .append($('<option />').val('right' ).text(this.rte.i18n('Right'))) + .append($('<option />').val('top' ).text(this.rte.i18n('Top'))) + .append($('<option />').val('text-top' ).text(this.rte.i18n('Text top'))) + .append($('<option />').val('middle' ).text(this.rte.i18n('middle'))) + .append($('<option />').val('baseline' ).text(this.rte.i18n('Baseline'))) + .append($('<option />').val('bottom' ).text(this.rte.i18n('Bottom'))) + .append($('<option />').val('text-bottom').text(this.rte.i18n('Text bottom'))) + .change(function() { + var val = $(this).val(), + css = { + 'float' : '', + 'vertical-align' : '' + }; + if (self.prevImg) { + if (val == 'left' || val == 'right') { + css['float'] = val; + css['vertical-align'] = ''; + } else if (val) { + css['float'] = ''; + css['vertical-align'] = val; + } + self.prevImg.css(css); + } + }) + , + border : $('<div />').elBorderSelect({ + name : 'border', + change : function() { + var border = self.src.main.border.val(); + if (self.prevImg) { + self.prevImg.css('border', border.width ? border.width+' '+border.style+' '+border.color : ''); + } + } + }) + }, + + adv : {}, + events : {} + } + + $.each(['id', 'class', 'style', 'longdesc'], function(i, name) { + self.src.adv[name] = $('<input type="text" style="width:100%" />'); + }); + + this.src.adv['class'].change(function() { + if (self.prevImg) { + self.prevImg.attr('class', $(this).val()); + } + }); + + this.src.adv.style.change(function() { + if (self.prevImg) { + self.prevImg.attr('style', $(this).val()); + values(self.prevImg); + } + }); + + $.each( + ['onblur', 'onfocus', 'onclick', 'ondblclick', 'onmousedown', 'onmouseup', 'onmouseover', 'onmouseout', 'onmouseleave', 'onkeydown', 'onkeypress', 'onkeyup'], + function() { + self.src.events[this] = $('<input type="text" style="width:100%"/>'); + }); + } + + this.command = function() { + !this.src && this.init(); + + var img, + opts = { + rtl : rte.rtl, + submit : function(e, d) { + e.stopPropagation(); + e.preventDefault(); + self.set(); + + dialog.close(); + }, + close : function() { + + bookmarks && rte.selection.moveToBookmark(bookmarks) + }, + dialog : { + autoOpen : false, + width : 500, + position : 'top', + title : rte.i18n('Image'), + resizable : true, + open : function() { + $.fn.resizable && $(this).parents('.ui-dialog:first').resizable('option', 'alsoResize', '.elrte-image-preview'); + } + } + }, + dialog = new elDialogForm(opts), + fm = !!rte.options.fmOpen, + src = fm + ? $('<div class="elrte-image-src-fm"><span class="ui-state-default ui-corner-all"><span class="ui-icon ui-icon-folder-open"/></span></div>') + .append(this.src.main.src.css('width', '87%')) + : this.src.main.src; + + ; + + reset(); + this.preview.children('img').remove(); + this.prevImg = null; + img = rte.selection.getEnd(); + + this.img = img.nodeName == 'IMG' && !$(img).is('.elrte-protected') + ? $(img) + : $('<img/>'); + + bookmarks = rte.selection.getBookmark(); + + if (fm) { + src.children('.ui-state-default') + .click( function() { + rte.options.fmOpen( function(url) { self.src.main.src.val(url).change() } ); + }) + .hover(function() { + $(this).toggleClass('ui-state-hover'); + }); + } + + dialog.tab('main', this.rte.i18n('Properies')) + .append([this.rte.i18n('Image URL'), src], 'main', true) + .append([this.rte.i18n('Title'), this.src.main.title], 'main', true) + .append([this.rte.i18n('Alt text'), this.src.main.alt], 'main', true) + .append([this.rte.i18n('Size'), $('<span />').append(this.src.main.width).append(' x ').append(this.src.main.height).append(' px')], 'main', true) + .append([this.rte.i18n('Alignment'), this.src.main.align], 'main', true) + .append([this.rte.i18n('Margins'), this.src.main.margin], 'main', true) + .append([this.rte.i18n('Border'), this.src.main.border], 'main', true) + + dialog.append($('<fieldset><legend>'+this.rte.i18n('Preview')+'</legend></fieldset>').append(this.preview), 'main'); + + + + $.each(this.src, function(tabname, elements) { + + if (tabname == 'main') { + return; + } + dialog.tab(tabname, rte.i18n(self.labels[tabname])); + + $.each(elements, function(name, el) { + self.src[tabname][name].val(tabname == 'events' ? rte.utils.trimEventCallback(self.img.attr(name)) : self.img.attr(name)||''); + dialog.append([rte.i18n(self.labels[name] || name), self.src[tabname][name]], tabname, true); + }); + }); + + dialog.open(); + + if (this.img.attr('src')) { + values(this.img); + this.prevImg = this.img.clone().prependTo(this.preview); + proportion = (this.img.width()/this.img.height()).toFixed(2); + width = parseInt(this.img.width()); + height = parseInt(this.img.height()); + } + } + + this.set = function() { + var src = this.src.main.src.val(), + link; + + this.rte.history.add(); + bookmarks && rte.selection.moveToBookmark(bookmarks); + + if (!src) { + link = rte.dom.selfOrParentLink(this.img[0]); + link && link.remove(); + return this.img.remove(); + } + + !this.img[0].parentNode && (this.img = $(this.rte.doc.createElement('img'))); + + this.img.attr('src', src) + .attr('style', this.src.adv.style.val()); + + $.each(this.src, function(i, elements) { + $.each(elements, function(name, el) { + var val = el.val(), style; + + switch (name) { + case 'width': + self.img.css('width', val); + break; + case 'height': + self.img.css('height', val); + break; + case 'align': + self.img.css(val == 'left' || val == 'right' ? 'float' : 'vertical-align', val); + break; + case 'margin': + if (val.css) { + self.img.css('margin', val.css); + } else { + self.img.css({ + 'margin-left' : val.left, + 'margin-top' : val.top, + 'margin-right' : val.right, + 'margin-bottom' : val.bottom + }); + } + break; + case 'border': + if (!val.width) { + val = ''; + } else { + val = 'border:'+val.css+';'+$.trim((self.img.attr('style')||'').replace(/border\-[^;]+;?/ig, '')); + name = 'style'; + self.img.attr('style', val) + return; + } + + break; + case 'src': + case 'style': + return; + default: + val ? self.img.attr(name, val) : self.img.removeAttr(name); + } + }); + }); + + !this.img[0].parentNode && rte.selection.insertNode(this.img[0]); + this.rte.ui.update(); + } + + this.update = function() { + this.domElem.removeClass('disabled'); + var n = this.rte.selection.getEnd(), + $n = $(n); + if (n.nodeName == 'IMG' && !$n.hasClass('elrte-protected')) { + this.domElem.addClass('active'); + } else { + this.domElem.removeClass('active'); + } + } + +} +})(jQuery); Propchange: ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/image.js ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/image.js ------------------------------------------------------------------------------ svn:keywords = Date Rev Author URL Id Propchange: ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/image.js ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/indent.js URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/indent.js?rev=1178141&view=auto ============================================================================== --- ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/indent.js (added) +++ ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/indent.js Sun Oct 2 08:06:49 2011 @@ -0,0 +1,49 @@ +/** + * @class УвелиÑение оÑÑÑÑпа + * ÑпиÑки - еÑли вÑделен один ÑÐ»ÐµÐ¼ÐµÐ½Ñ - ÑвелиÑиваеÑÑÑ Ð²Ð»Ð¾Ð¶ÐµÐ½Ð½Ð¾ÑÑÑ ÑпиÑка, в оÑÑалÑнÑÑ ÑлÑÑаÑÑ - padding Ñ ÑодиÑелÑÑкого ul|ol + * ÐÑли ÑаблиÑа вÑделена полноÑÑÑÑ - ей добавлÑеÑÑÑ margin, еÑли ÑаÑÑиÑно - ÑвелиÑиваеÑÑÑ padding Ð´Ð»Ñ ÑÑеек + * + * @param elRTE rte обÑекÑ-ÑедакÑÐ¾Ñ + * @param String name название кнопки + * + * + * @author: Dmitry Levashov (dio) [hidden email] + * @copyright: Studio 42, http://www.std42.ru + **/ +(function($) { +elRTE.prototype.ui.prototype.buttons.indent = function(rte, name) { + this.constructor.prototype.constructor.call(this, rte, name); + var self = this; + + this.command = function() { + this.rte.history.add(); + var nodes = this.rte.selection.selected({collapsed : true, blocks : true, wrap : 'inline', tag : 'p'}); + + function indent(n) { + var css = /(IMG|HR|TABLE|EMBED|OBJECT)/.test(n.nodeName) ? 'margin-left' : 'padding-left'; + var val = self.rte.dom.attr(n, 'style').indexOf(css) != -1 ? parseInt($(n).css(css))||0 : 0; + $(n).css(css, val+40+'px'); + } + + for (var i=0; i < nodes.length; i++) { + if (/^(TABLE|THEAD|TFOOT|TBODY|COL|COLGROUP|TR)$/.test(nodes[i].nodeName)) { + $(nodes[i]).find('td,th').each(function() { + indent(this); + }); + } else if (/^LI$/.test(nodes[i].nodeName)) { + var n = $(nodes[i]); + $(this.rte.dom.create(nodes[i].parentNode.nodeName)) + .append($(this.rte.dom.create('li')).html(n.html()||'')).appendTo(n.html(' ')); + } else { + indent(nodes[i]); + } + }; + this.rte.ui.update(); + } + + this.update = function() { + this.domElem.removeClass('disabled'); + } + +} +})(jQuery); Propchange: ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/indent.js ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/indent.js ------------------------------------------------------------------------------ svn:keywords = Date Rev Author URL Id Propchange: ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/indent.js ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/justifyleft.js URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/justifyleft.js?rev=1178141&view=auto ============================================================================== --- ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/justifyleft.js (added) +++ ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/justifyleft.js Sun Oct 2 08:06:49 2011 @@ -0,0 +1,42 @@ +/** + * @class button - justify text + * + * @param elRTE rte обÑекÑ-ÑедакÑÐ¾Ñ + * @param String name название кнопки + * + * + * @author: Dmitry Levashov (dio) [hidden email] + * @copyright: Studio 42, http://www.std42.ru + **/ +(function($) { +elRTE.prototype.ui.prototype.buttons.justifyleft = function(rte, name) { + this.constructor.prototype.constructor.call(this, rte, name); + this.align = this.name == 'justifyfull' ? 'justify' : this.name.replace('justify', ''); + + this.command = function() { + var s = this.rte.selection.selected({collapsed:true, blocks : true, tag : 'div'}), + l = s.length; + l && this.rte.history.add(); + while (l--) { + this.rte.dom.filter(s[l], 'textNodes') && $(s[l]).css('text-align', this.align); + } + this.rte.ui.update(); + } + + this.update = function() { + var s = this.rte.selection.getNode(), + n = s.nodeName == 'BODY' ? s : this.rte.dom.selfOrParent(s, 'textNodes')||(s.parentNode && s.parentNode.nodeName == 'BODY' ? s.parentNode : null); + if (n) { + this.domElem.removeClass('disabled').toggleClass('active', $(n).css('text-align') == this.align); + } else { + this.domElem.addClass('disabled'); + } + } + +} + +elRTE.prototype.ui.prototype.buttons.justifycenter = elRTE.prototype.ui.prototype.buttons.justifyleft; +elRTE.prototype.ui.prototype.buttons.justifyright = elRTE.prototype.ui.prototype.buttons.justifyleft; +elRTE.prototype.ui.prototype.buttons.justifyfull = elRTE.prototype.ui.prototype.buttons.justifyleft; + +})(jQuery); Propchange: ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/justifyleft.js ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/justifyleft.js ------------------------------------------------------------------------------ svn:keywords = Date Rev Author URL Id Propchange: ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/justifyleft.js ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/link.js URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/link.js?rev=1178141&view=auto ============================================================================== --- ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/link.js (added) +++ ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/link.js Sun Oct 2 08:06:49 2011 @@ -0,0 +1,432 @@ +/** + * @class button - insert/edit link (open dialog window) + * + * @param elRTE rte обÑекÑ-ÑедакÑÐ¾Ñ + * @param String name название кнопки + * + * @author: Dmitry Levashov (dio) [hidden email] + * Copyright: Studio 42, http://www.std42.ru + **/ +(function($) { +elRTE.prototype.ui.prototype.buttons.link = function(rte, name) { + this.constructor.prototype.constructor.call(this, rte, name); + var self = this; + this.img = false; + + this.bm; + + function init() { + self.labels = { + id : 'ID', + 'class' : 'Css class', + style : 'Css style', + dir : 'Script direction', + lang : 'Language', + charset : 'Charset', + type : 'Target MIME type', + rel : 'Relationship page to target (rel)', + rev : 'Relationship target to page (rev)', + tabindex : 'Tab index', + accesskey : 'Access key' + } + self.src = { + main : { + href : $('<input type="text" />'), + title : $('<input type="text" />'), + anchor : $('<select />').attr('name', 'anchor'), + target : $('<select />') + .append($('<option />').text(self.rte.i18n('In this window')).val('')) + .append($('<option />').text(self.rte.i18n('In new window (_blank)')).val('_blank')) + // .append($('<option />').text(self.rte.i18n('In new parent window (_parent)')).val('_parent')) + // .append($('<option />').text(self.rte.i18n('In top frame (_top)')).val('_top')) + }, + + popup : { + use : $('<input type="checkbox" />'), + url : $('<input type="text" />' ).val('http://'), + name : $('<input type="text" />' ), + width : $('<input type="text" />' ).attr({size : 6, title : self.rte.i18n('Width')} ).css('text-align', 'right'), + height : $('<input type="text" />' ).attr({size : 6, title : self.rte.i18n('Height')}).css('text-align', 'right'), + left : $('<input type="text" />' ).attr({size : 6, title : self.rte.i18n('Left')} ).css('text-align', 'right'), + top : $('<input type="text" />' ).attr({size : 6, title : self.rte.i18n('Top')} ).css('text-align', 'right'), + location : $('<input type="checkbox" />'), + menubar : $('<input type="checkbox" />'), + toolbar : $('<input type="checkbox" />'), + scrollbars : $('<input type="checkbox" />'), + status : $('<input type="checkbox" />'), + resizable : $('<input type="checkbox" />'), + dependent : $('<input type="checkbox" />'), + retfalse : $('<input type="checkbox" />').attr('checked', true) + }, + + adv : { + id : $('<input type="text" />'), + 'class' : $('<input type="text" />'), + style : $('<input type="text" />'), + dir : $('<select />') + .append($('<option />').text(self.rte.i18n('Not set')).val('')) + .append($('<option />').text(self.rte.i18n('Left to right')).val('ltr')) + .append($('<option />').text(self.rte.i18n('Right to left')).val('rtl')), + lang : $('<input type="text" />'), + charset : $('<input type="text" />'), + type : $('<input type="text" />'), + rel : $('<input type="text" />'), + rev : $('<input type="text" />'), + tabindex : $('<input type="text" />'), + accesskey : $('<input type="text" />') + }, + events : {} + } + + $.each( + ['onblur', 'onfocus', 'onclick', 'ondblclick', 'onmousedown', 'onmouseup', 'onmouseover', 'onmouseout', 'onmouseleave', 'onkeydown', 'onkeypress', 'onkeyup'], + function() { + self.src.events[this] = $('<input type="text" />'); + }); + + $.each(self.src, function() { + for (var n in this) { + // this[n].attr('name', n); + var t = this[n].attr('type'); + if (!t || (t == 'text' && !this[n].attr('size')) ) { + this[n].css('width', '100%'); + } + } + }); + + } + + this.command = function() { + var n = this.rte.selection.getNode(), + sel, i, v, opts, l, r, link, href, s; + + !this.src && init(); + // this.rte.selection.saveIERange(); + + this.bm = this.rte.selection.getBookmark(); + + function isLink(n) { return n.nodeName == 'A' && n.href; } + + this.link = this.rte.dom.selfOrParentLink(n); + + if (!this.link) { + sel = $.browser.msie ? this.rte.selection.selected() : this.rte.selection.selected({wrap : false}); + if (sel.length) { + for (i=0; i < sel.length; i++) { + if (isLink(sel[i])) { + this.link = sel[i]; + break; + } + }; + if (!this.link) { + this.link = this.rte.dom.parent(sel[0], isLink) || this.rte.dom.parent(sel[sel.length-1], isLink); + } + } + } + + this.link = this.link ? $(this.link) : $(this.rte.doc.createElement('a')); + this.img = n.nodeName == 'IMG' ? n : null; + this.updatePopup(); + + this.src.main.anchor.empty(); + $('a[href!=""][name]', this.rte.doc).each(function() { + var n = $(this).attr('name'); + self.src.main.anchor.append($('<option />').val(n).text(n)); + }); + if (this.src.main.anchor.children().length) { + this.src.main.anchor.prepend($('<option />').val('').text(this.rte.i18n('Select bookmark')) ) + .change(function() { + var v = $(this).val(); + if (v) { + self.src.main.href.val('#'+v); + } + }); + } + + opts = { + rtl : this.rte.rtl, + submit : function(e, d) { e.stopPropagation(); e.preventDefault(); self.set(); d.close(); }, + tabs : { show : function(e, ui) { if (ui.index==3) { self.updateOnclick(); } } }, + close : function() {self.rte.browser.msie && self.rte.selection.restoreIERange(); }, + dialog : { + width : 'auto', + width : 430, + title : this.rte.i18n('Link') + + } + } + + d = new elDialogForm(opts); + + l = $('<div />') + .append( $('<label />').append(this.src.popup.location).append(this.rte.i18n('Location bar'))) + .append( $('<label />').append(this.src.popup.menubar).append(this.rte.i18n('Menu bar'))) + .append( $('<label />').append(this.src.popup.toolbar).append(this.rte.i18n('Toolbar'))) + .append( $('<label />').append(this.src.popup.scrollbars).append(this.rte.i18n('Scrollbars'))); + r = $('<div />') + .append( $('<label />').append(this.src.popup.status).append(this.rte.i18n('Status bar'))) + .append( $('<label />').append(this.src.popup.resizable).append(this.rte.i18n('Resizable'))) + .append( $('<label />').append(this.src.popup.dependent).append(this.rte.i18n('Depedent'))) + .append( $('<label />').append(this.src.popup.retfalse).append(this.rte.i18n('Add return false'))); + + d.tab('main', this.rte.i18n('Properies')) + .tab('popup', this.rte.i18n('Popup')) + .tab('adv', this.rte.i18n('Advanced')) + .tab('events', this.rte.i18n('Events')) + .append($('<label />').append(this.src.popup.use).append(this.rte.i18n('Open link in popup window')), 'popup') + .separator('popup') + .append([this.rte.i18n('URL'), this.src.popup.url], 'popup', true) + .append([this.rte.i18n('Window name'), this.src.popup.name], 'popup', true) + .append([this.rte.i18n('Window size'), $('<span />').append(this.src.popup.width).append(' x ').append(this.src.popup.height).append(' px')], 'popup', true) + .append([this.rte.i18n('Window position'), $('<span />').append(this.src.popup.left).append(' x ').append(this.src.popup.top).append(' px')], 'popup', true) + .separator('popup') + .append([l, r], 'popup', true); + + link = this.link.get(0); + href = this.rte.dom.attr(link, 'href'); + this.src.main.href.val(href).change(function() { + $(this).val(self.rte.utils.absoluteURL($(this).val())); + }); + + if (this.rte.options.fmAllow && this.rte.options.fmOpen) { + var s = $('<span />').append(this.src.main.href.css('width', '87%')) + .append( + $('<span />').addClass('ui-state-default ui-corner-all') + .css({'float' : 'right', 'margin-right' : '3px'}) + .attr('title', self.rte.i18n('Open file manger')) + .append($('<span />').addClass('ui-icon ui-icon-folder-open')) + .click( function() { + self.rte.options.fmOpen( function(url) { self.src.main.href.val(url).change(); } ); + }) + .hover(function() {$(this).addClass('ui-state-hover')}, function() { $(this).removeClass('ui-state-hover')}) + ); + d.append([this.rte.i18n('Link URL'), s], 'main', true); + } else { + d.append([this.rte.i18n('Link URL'), this.src.main.href], 'main', true); + } + this.src.main.href.change(); + + d.append([this.rte.i18n('Title'), this.src.main.title.val(this.rte.dom.attr(link, 'title'))], 'main', true); + if (this.src.main.anchor.children().length) { + d.append([this.rte.i18n('Bookmark'), this.src.main.anchor.val(href)], 'main', true) + } + if (!(this.rte.options.doctype.match(/xhtml/) && this.rte.options.doctype.match(/strict/))) { + d.append([this.rte.i18n('Target'), this.src.main.target.val(this.link.attr('target')||'')], 'main', true); + } + + + + for (var n in this.src.adv) { + this.src.adv[n].val(this.rte.dom.attr(link, n)); + d.append([this.rte.i18n(this.labels[n] ? this.labels[n] : n), this.src.adv[n]], 'adv', true); + } + for (var n in this.src.events) { + var v = this.rte.utils.trimEventCallback(this.rte.dom.attr(link, n)); + this.src.events[n].val(v); + d.append([this.rte.i18n(this.labels[n] ? this.labels[n] : n), this.src.events[n]], 'events', true); + } + + this.src.popup.use.change(function() { + var c = $(this).attr('checked'); + $.each(self.src.popup, function() { + if ($(this).attr('name') != 'use') { + if (c) { + $(this).removeAttr('disabled'); + } else { + $(this).attr('disabled', true); + } + } + }) + }); + this.src.popup.use.change(); + + d.open(); + } + + this.update = function() { + var n = this.rte.selection.getNode(); + + // var t = this.rte.dom.selectionHas(function(n) { return n.nodeName == 'A' && n.href; }); + // this.rte.log(t) + + if (this.rte.dom.selfOrParentLink(n)) { + this.domElem.removeClass('disabled').addClass('active'); + } else if (this.rte.dom.selectionHas(function(n) { return n.nodeName == 'A' && n.href; })) { + this.domElem.removeClass('disabled').addClass('active'); + } else if (!this.rte.selection.collapsed() || n.nodeName == 'IMG') { + this.domElem.removeClass('disabled active'); + } else { + this.domElem.addClass('disabled').removeClass('active'); + } + } + + this.updatePopup = function() { + var onclick = ''+this.link.attr('onclick'); + // onclick = onclick ? $.trim(onclick.toString()) : '' + if ( onclick.length>0 && (m = onclick.match(/window.open\('([^']+)',\s*'([^']*)',\s*'([^']*)'\s*.*\);\s*(return\s+false)?/))) { + this.src.popup.use.attr('checked', 'on') + this.src.popup.url.val(m[1]); + this.src.popup.name.val(m[2]); + + if ( /location=yes/.test(m[3]) ) { + this.src.popup.location.attr('checked', true); + } + if ( /menubar=yes/.test(m[3]) ) { + this.src.popup.menubar.attr('checked', true); + } + if ( /toolbar=yes/.test(m[3]) ) { + this.src.popup.toolbar.attr('checked', true); + } + if ( /scrollbars=yes/.test(m[3]) ) { + this.src.popup.scrollbars.attr('checked', true); + } + if ( /status=yes/.test(m[3]) ) { + this.src.popup.status.attr('checked', true); + } + if ( /resizable=yes/.test(m[3]) ) { + this.src.popup.resizable.attr('checked', true); + } + if ( /dependent=yes/.test(m[3]) ) { + this.src.popup.dependent.attr('checked', true); + } + if ((_m = m[3].match(/width=([^,]+)/))) { + this.src.popup.width.val(_m[1]); + } + if ((_m = m[3].match(/height=([^,]+)/))) { + this.src.popup.height.val(_m[1]); + } + if ((_m = m[3].match(/left=([^,]+)/))) { + this.src.popup.left.val(_m[1]); + } + if ((_m = m[3].match(/top=([^,]+)/))) { + this.src.popup.top.val(_m[1]); + } + if (m[4]) { + this.src.popup.retfalse.attr('checked', true); + } + } else { + $.each(this.src.popup, function() { + var $this = $(this); + if ($this.attr('type') == 'text') { + $this.val($this.attr('name') == 'url' ? 'http://' : ''); + } else { + if ($this.attr('name') == 'retfalse') { + this.attr('checked', true); + } else { + $this.removeAttr('checked'); + } + } + }); + } + + } + + this.updateOnclick = function () { + var url = this.src.popup.url.val(); + if (this.src.popup.use.attr('checked') && url) { + var params = ''; + if (this.src.popup.location.attr('checked')) { + params += 'location=yes,'; + } + if (this.src.popup.menubar.attr('checked')) { + params += 'menubar=yes,'; + } + if (this.src.popup.toolbar.attr('checked')) { + params += 'toolbar=yes,'; + } + if (this.src.popup.scrollbars.attr('checked')) { + params += 'scrollbars=yes,'; + } + if (this.src.popup.status.attr('checked')) { + params += 'status=yes,'; + } + if (this.src.popup.resizable.attr('checked')) { + params += 'resizable=yes,'; + } + if (this.src.popup.dependent.attr('checked')) { + params += 'dependent=yes,'; + } + if (this.src.popup.width.val()) { + params += 'width='+this.src.popup.width.val()+','; + } + if (this.src.popup.height.val()) { + params += 'height='+this.src.popup.height.val()+','; + } + if (this.src.popup.left.val()) { + params += 'left='+this.src.popup.left.val()+','; + } + if (this.src.popup.top.val()) { + params += 'top='+this.src.popup.top.val()+','; + } + if (params.length>0) { + params = params.substring(0, params.length-1) + } + var retfalse = this.src.popup.retfalse.attr('checked') ? 'return false;' : ''; + var onclick = "window.open('"+url+"', '"+$.trim(this.src.popup.name.val())+"', '"+params+"'); "+retfalse; + this.src.events.onclick.val(onclick); + if (!this.src.main.href.val()) { + this.src.main.href.val('#'); + } + } else { + var v = this.src.events.onclick.val(); + v = v.replace(/window\.open\([^\)]+\)\s*;?\s*return\s*false\s*;?/i, ''); + this.src.events.onclick.val(v); + } + } + + this.set = function() { + var href, fakeURL; + this.updateOnclick(); + this.rte.selection.moveToBookmark(this.bm); + // this.rte.selection.restoreIERange(); + this.rte.history.add(); + href = this.rte.utils.absoluteURL(this.src.main.href.val()); + if (!href) { + // this.link.parentNode && this.rte.doc.execCommand('unlink', false, null); + var bm = this.rte.selection.getBookmark(); + this.rte.dom.unwrap(this.link[0]); + this.rte.selection.moveToBookmark(bm); + + } else { + if (this.img && this.img.parentNode) { + this.link = $(this.rte.dom.create('a')).attr('href', href); + this.rte.dom.wrap(this.img, this.link[0]); + } else if (!this.link[0].parentNode) { + fakeURL = '#--el-editor---'+Math.random(); + this.rte.doc.execCommand('createLink', false, fakeURL); + this.link = $('a[href="'+fakeURL+'"]', this.rte.doc); + this.link.each(function() { + var $this = $(this); + + // ÑдалÑем ÑÑÑлки вокÑÑг пÑÑÑÑÑ ÑлеменÑов + if (!$.trim($this.html()) && !$.trim($this.text())) { + $this.replaceWith($this.text()); // ÑÐ¾Ñ ÑанÑем пÑÐ¾Ð±ÐµÐ»Ñ :) + } + }); + } + + this.src.main.href.val(href); + for (var tab in this.src) { + if (tab != 'popup') { + for (var n in this.src[tab]) { + if (n != 'anchors') { + var v = $.trim(this.src[tab][n].val()); + if (v) { + this.link.attr(n, v); + } else { + this.link.removeAttr(n); + } + } + } + } + }; + + + this.img && this.rte.selection.select(this.img); + } + this.rte.ui.update(true); + } + +} + +})(jQuery); Propchange: ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/link.js ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/link.js ------------------------------------------------------------------------------ svn:keywords = Date Rev Author URL Id Propchange: ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/link.js ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/nbsp.js URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/nbsp.js?rev=1178141&view=auto ============================================================================== --- ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/nbsp.js (added) +++ ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/nbsp.js Sun Oct 2 08:06:49 2011 @@ -0,0 +1,28 @@ +/** + * @class button - insert non breakable space + * ÐÑли вÑделение ÑÑ Ð»Ð¾Ð¿Ð½ÑÑо и Ð½Ð°Ñ Ð¾Ð´Ð¸ÑÑÑ Ð²Ð½ÑÑÑи div'a - он ÑдалÑеÑÑÑ + * ÐовÑе div'Ñ ÑоздаÑÑÑÑ ÑолÑко из неÑÑ Ð»Ð¾Ð¿Ð½ÑÑого вÑÐ´ÐµÐ»ÐµÐ½Ð¸Ñ + * + * @param elRTE rte обÑекÑ-ÑедакÑÐ¾Ñ + * @param String name название кнопки + * + * @author: Dmitry Levashov (dio) [hidden email] + * @copyright: Studio 42, http://www.std42.ru + **/ +(function($) { +elRTE.prototype.ui.prototype.buttons.nbsp = function(rte, name) { + this.constructor.prototype.constructor.call(this, rte, name); + + this.command = function() { + this.rte.history.add(); + this.rte.selection.insertHtml(' ', true); + this.rte.window.focus(); + this.rte.ui.update(); + } + + this.update = function() { + this.domElem.removeClass('disabled'); + } +} +})(jQuery); + Propchange: ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/nbsp.js ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/nbsp.js ------------------------------------------------------------------------------ svn:keywords = Date Rev Author URL Id Propchange: ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/nbsp.js ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/outdent.js URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/outdent.js?rev=1178141&view=auto ============================================================================== --- ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/outdent.js (added) +++ ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/outdent.js Sun Oct 2 08:06:49 2011 @@ -0,0 +1,67 @@ +/** + * @class button - outdent text + * ÑменÑÑÐ°ÐµÑ padding/margin/Ñамомнение ;) + * + * @param elRTE rte обÑекÑ-ÑедакÑÐ¾Ñ + * @param String name название кнопки + * @todo decrease lists nesting level! + * + * @author: Dmitry Levashov (dio) [hidden email] + * @copyright: Studio 42, http://www.std42.ru + **/ +(function($) { +elRTE.prototype.ui.prototype.buttons.outdent = function(rte, name) { + this.constructor.prototype.constructor.call(this, rte, name); + var self = this; + + this.command = function() { + var v = this.find(); + if (v.node) { + this.rte.history.add(); + $(v.node).css(v.type, (v.val>40 ? v.val-40 : 0)+'px'); + this.rte.ui.update(); + } + } + + this.find = function(n) { + function checkNode(n) { + var ret = {type : '', val : 0}; + var s; + if ((s = self.rte.dom.attr(n, 'style'))) { + ret.type = s.indexOf('padding-left') != -1 + ? 'padding-left' + : (s.indexOf('margin-left') != -1 ? 'margin-left' : ''); + ret.val = ret.type ? parseInt($(n).css(ret.type))||0 : 0; + } + return ret; + } + + var n = this.rte.selection.getNode(); + var ret = checkNode(n); + if (ret.val) { + ret.node = n; + } else { + $.each(this.rte.dom.parents(n, '*'), function() { + ret = checkNode(this); + if (ret.val) { + ret.node = this; + return ret; + } + }) + } + return ret; + } + + this.update = function() { + var v = this.find(); + if (v.node) { + this.domElem.removeClass('disabled'); + } else { + this.domElem.addClass('disabled'); + } + } + + +} + +})(jQuery); Propchange: ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/outdent.js ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/outdent.js ------------------------------------------------------------------------------ svn:keywords = Date Rev Author URL Id Propchange: ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/outdent.js ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/pagebreak.js URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/pagebreak.js?rev=1178141&view=auto ============================================================================== --- ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/pagebreak.js (added) +++ ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/pagebreak.js Sun Oct 2 08:06:49 2011 @@ -0,0 +1,21 @@ +(function($) { + elRTE.prototype.ui.prototype.buttons.pagebreak = function(rte, name) { + this.constructor.prototype.constructor.call(this, rte, name); + + // prevent resize + $(this.rte.doc.body).bind('mousedown', function(e) { + if ($(e.target).hasClass('elrte-pagebreak')) { + e.preventDefault(); + } + }) + + this.command = function() { + this.rte.selection.insertHtml('<img src="'+this.rte.filter.url+'pixel.gif" class="elrte-protected elrte-pagebreak"/>', false); + } + + this.update = function() { + this.domElem.removeClass('disabled'); + } + } + +})(jQuery); \ No newline at end of file Propchange: ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/pagebreak.js ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/pagebreak.js ------------------------------------------------------------------------------ svn:keywords = Date Rev Author URL Id Propchange: ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/pagebreak.js ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/pasteformattext.js URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/pasteformattext.js?rev=1178141&view=auto ============================================================================== --- ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/pasteformattext.js (added) +++ ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/pasteformattext.js Sun Oct 2 08:06:49 2011 @@ -0,0 +1,68 @@ +/** + * @class button - insert formatted text (open dialog window) + * + * @param elRTE rte обÑекÑ-ÑедакÑÐ¾Ñ + * @param String name название кнопки + * + * @author: Dmitry Levashov (dio) [hidden email] + * @copyright: Studio 42, http://www.std42.ru + **/ +(function($) { +elRTE.prototype.ui.prototype.buttons.pasteformattext = function(rte, name) { + this.constructor.prototype.constructor.call(this, rte, name); + this.iframe = $(document.createElement('iframe')).addClass('el-rte-paste-input'); + this.doc = null; + var self = this; + + this.command = function() { + this.rte.selection.saveIERange(); + var self = this, + opts = { + submit : function(e, d) { + e.stopPropagation(); + e.preventDefault(); + self.paste(); + d.close(); + }, + dialog : { + width : 500, + title : this.rte.i18n('Paste formatted text') + } + }, + d = new elDialogForm(opts); + d.append(this.iframe).open(); + this.doc = this.iframe.get(0).contentWindow.document; + html = this.rte.options.doctype + +'<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />'; + html += '</head><body> <br /> </body></html>'; + + this.doc.open(); + this.doc.write(html); + this.doc.close(); + + if (!this.rte.browser.msie) { + try { this.doc.designMode = "on"; } + catch(e) { } + } else { + this.doc.body.contentEditable = true; + } + setTimeout(function() { self.iframe[0].contentWindow.focus(); }, 50); + } + + this.paste = function() { + $(this.doc.body).find('[class]').removeAttr('class'); + var html = $.trim($(this.doc.body).html()); + if (html) { + this.rte.history.add(); + this.rte.selection.restoreIERange(); + this.rte.selection.insertHtml(this.rte.filter.wysiwyg2wysiwyg(this.rte.filter.proccess('paste', html))); + this.rte.ui.update(true); + } + } + + this.update = function() { + this.domElem.removeClass('disabled'); + } +} +})(jQuery); + Propchange: ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/pasteformattext.js ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/pasteformattext.js ------------------------------------------------------------------------------ svn:keywords = Date Rev Author URL Id Propchange: ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/pasteformattext.js ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/pastetext.js URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/pastetext.js?rev=1178141&view=auto ============================================================================== --- ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/pastetext.js (added) +++ ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/pastetext.js Sun Oct 2 08:06:49 2011 @@ -0,0 +1,50 @@ +/** + * @class кнопка "вÑÑавиÑÑ ÑолÑко ÑекÑÑ" + * + * @param elRTE rte обÑекÑ-ÑедакÑÐ¾Ñ + * @param String name название кнопки + * + * @author: Dmitry Levashov (dio) [hidden email] + * @copyright: Studio 42, http://www.std42.ru + **/ +(function($) { +elRTE.prototype.ui.prototype.buttons.pastetext = function(rte, name) { + this.constructor.prototype.constructor.call(this, rte, name); + this.input = $('<textarea />').addClass('el-rte-paste-input'); + var self = this; + + this.command = function() { + this.rte.browser.msie && this.rte.selection.saveIERange(); + var opts = { + submit : function(e, d) { + e.stopPropagation(); + e.preventDefault(); + self.paste(); + d.close(); + }, + dialog : { + width : 500, + title : this.rte.i18n('Paste only text') + } + } + var d = new elDialogForm(opts); + d.append(this.input).open(); + } + + this.paste = function() { + var txt = $.trim(this.input.val()); + if (txt) { + this.rte.history.add(); + this.rte.browser.msie && this.rte.selection.restoreIERange(); + this.rte.selection.insertText(txt.replace(/\r?\n/g, '<br />'), true); + this.rte.ui.update(true); + } + this.input.val(''); + } + + this.update = function() { + this.domElem.removeClass('disabled'); + } + +} +})(jQuery); Propchange: ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/pastetext.js ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/pastetext.js ------------------------------------------------------------------------------ svn:keywords = Date Rev Author URL Id Propchange: ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/pastetext.js ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/save.js URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/save.js?rev=1178141&view=auto ============================================================================== --- ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/save.js (added) +++ ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/save.js Sun Oct 2 08:06:49 2011 @@ -0,0 +1,21 @@ +/** + * @class button - save editor content (submit form) + * + * @param elRTE rte обÑекÑ-ÑедакÑÐ¾Ñ + * @param String name название кнопки + * + * @author: Dmitry Levashov (dio) [hidden email] + * @copyright: Studio 42, http://www.std42.ru + **/ +(function($) { +elRTE.prototype.ui.prototype.buttons.save = function(rte, name) { + this.constructor.prototype.constructor.call(this, rte, name); + this.active = true; + + this.command = function() { + this.rte.save(); + } + + this.update = function() { } +} +})(jQuery); Propchange: ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/save.js ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/save.js ------------------------------------------------------------------------------ svn:keywords = Date Rev Author URL Id Propchange: ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/save.js ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/smiley.js URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/smiley.js?rev=1178141&view=auto ============================================================================== --- ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/smiley.js (added) +++ ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/smiley.js Sun Oct 2 08:06:49 2011 @@ -0,0 +1,71 @@ +/** + * @class button - insert smiley (open dialog window) + * + * @param elRTE rte обÑекÑ-ÑедакÑÐ¾Ñ + * @param String name название кнопки + * + * @author: eSabbath + * + **/ +(function($) { +elRTE.prototype.ui.prototype.buttons.smiley = function(rte, name) { + this.constructor.prototype.constructor.call(this, rte, name); + var self = this; + this.img = null; + this.url = this.rte.filter.url+'smileys/'; + this.smileys = { + 'smile' : 'smile.png', + 'happy' : 'happy.png', + 'tongue' : 'tongue.png', + 'surprised' : 'surprised.png', + 'waii' : 'waii.png', + 'wink' : 'wink.png', + 'evilgrin' : 'evilgrin.png', + 'grin' : 'grin.png', + + + 'unhappy' : 'unhappy.png' + }; + this.width = 120; + + this.command = function() { + var self = this, url = this.url, d, opts, img; + + this.rte.browser.msie && this.rte.selection.saveIERange(); + + opts = { + dialog : { + height : 120, + width : this.width, + title : this.rte.i18n('Smiley'), + buttons : {} + } + } + d = new elDialogForm(opts); + $.each(this.smileys, function(name, img) { + d.append($('<img src="'+url+img+'" title="'+name+'" id="'+name+'" class="el-rte-smiley"/>').click(function() { self.set(this.id, d); })); + }); + d.open(); + } + + this.update = function() { + this.domElem.removeClass('disabled'); + this.domElem.removeClass('active'); + } + + this.set = function(s, d) { + this.rte.browser.msie && this.rte.selection.restoreIERange(); + if (this.smileys[s]) { + this.img = $(this.rte.doc.createElement('img')); + this.img.attr({ + src : this.url + this.smileys[s], + title : s, + alt : s + }); + this.rte.selection.insertNode(this.img.get(0)); + this.rte.ui.update(); + } + d.close(); + } +} +})(jQuery); Propchange: ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/smiley.js ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/smiley.js ------------------------------------------------------------------------------ svn:keywords = Date Rev Author URL Id Propchange: ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/smiley.js ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/stopfloat.js URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/stopfloat.js?rev=1178141&view=auto ============================================================================== --- ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/stopfloat.js (added) +++ ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/stopfloat.js Sun Oct 2 08:06:49 2011 @@ -0,0 +1,51 @@ +/** + * @class button - stops elements floating. Insert div with style="clear:all" + * ÐÑли вÑделение ÑÑ Ð»Ð¾Ð¿Ð½ÑÑо и Ð½Ð°Ñ Ð¾Ð´Ð¸ÑÑÑ Ð²Ð½ÑÑÑи div'a Ñ Ð°ÑÑÑибÑÑом или css clear - он ÑдалÑеÑÑÑ + * + * @param elRTE rte обÑекÑ-ÑедакÑÐ¾Ñ + * @param String name название кнопки + * + * @author: Dmitry Levashov (dio) [hidden email] + * @copyright: Studio 42, http://www.std42.ru + **/ +(function($) { +elRTE.prototype.ui.prototype.buttons.stopfloat = function(rte, name) { + this.constructor.prototype.constructor.call(this, rte, name); + + this.find = function() { + if (this.rte.selection.collapsed()) { + var n = this.rte.dom.selfOrParent(this.rte.selection.getEnd(), /^DIV$/); + if (n && (this.rte.dom.attr(n, 'clear') || $(n).css('clear') != 'none')) { + return n; + } + } + } + + this.command = function() { + var n; + if ((n = this.find())) { + var n = $(n); + this.rte.history.add(); + if (!n.children().length && !$.trim(n.text()).length) { + n.remove(); + } else { + n.removeAttr('clear').css('clear', ''); + } + } else { + this.rte.history.add(); + this.rte.selection.insertNode($(this.rte.dom.create('div')).css('clear', 'both').get(0), true); + } + this.rte.ui.update(true); + } + + this.update = function() { + this.domElem.removeClass('disabled'); + if (this.find()) { + this.domElem.addClass('active'); + } else { + this.domElem.removeClass('active'); + } + } +} + +})(jQuery); \ No newline at end of file Propchange: ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/stopfloat.js ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/stopfloat.js ------------------------------------------------------------------------------ svn:keywords = Date Rev Author URL Id Propchange: ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/stopfloat.js ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/table.js URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/table.js?rev=1178141&view=auto ============================================================================== --- ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/table.js (added) +++ ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/table.js Sun Oct 2 08:06:49 2011 @@ -0,0 +1,345 @@ +/** + * @class button - create/edit table (open dialog window) + * + * @param elRTE rte обÑекÑ-ÑедакÑÐ¾Ñ + * @param String name название кнопки + * + * @author: Dmitry Levashov (dio) [hidden email] + * Copyright: Studio 42, http://www.std42.ru + **/ +(function($) { +elRTE.prototype.ui.prototype.buttons.table = function(rte, name) { + this.constructor.prototype.constructor.call(this, rte, name); + var self = this; + this.src = null; + this.labels = null; + + function init() { + self.labels = { + main : 'Properies', + adv : 'Advanced', + events : 'Events', + id : 'ID', + 'class' : 'Css class', + style : 'Css style', + dir : 'Script direction', + summary : 'Summary', + lang : 'Language', + href : 'URL' + } + + self.src = { + main : { + caption : $('<input type="text" />'), + rows : $('<input type="text" />').attr('size', 5).val(2), + cols : $('<input type="text" />').attr('size', 5).val(2), + width : $('<input type="text" />').attr('size', 5), + wunit : $('<select />') + .append($('<option />').val('%').text('%')) + .append($('<option />').val('px').text('px')), + height : $('<input type="text" />').attr('size', 5), + hunit : $('<select />') + .append($('<option />').val('%').text('%')) + .append($('<option />').val('px').text('px')), + align : $('<select />') + .append($('<option />').val('').text(self.rte.i18n('Not set'))) + .append($('<option />').val('left').text(self.rte.i18n('Left'))) + .append($('<option />').val('center').text(self.rte.i18n('Center'))) + .append($('<option />').val('right').text(self.rte.i18n('Right'))), + spacing : $('<input type="text" />').attr('size', 5), + padding : $('<input type="text" />').attr('size', 5), + border : $('<div />'), + // frame : $('<select />') + // .append($('<option />').val('void').text(self.rte.i18n('No'))) + // .append($('<option />').val('border').text(self.rte.i18n('Yes'))), + rules : $('<select />') + .append($('<option />').val('none').text(self.rte.i18n('No'))) + .append($('<option />').val('all').text(self.rte.i18n('Cells'))) + .append($('<option />').val('groups').text(self.rte.i18n('Groups'))) + .append($('<option />').val('rows').text(self.rte.i18n('Rows'))) + .append($('<option />').val('cols').text(self.rte.i18n('Columns'))), + margin : $('<div />'), + bg : $('<div />'), + bgimg : $('<input type="text" />').css('width', '90%') + }, + + adv : { + id : $('<input type="text" />'), + summary : $('<input type="text" />'), + 'class' : $('<input type="text" />'), + style : $('<input type="text" />'), + dir : $('<select />') + .append($('<option />').text(self.rte.i18n('Not set')).val('')) + .append($('<option />').text(self.rte.i18n('Left to right')).val('ltr')) + .append($('<option />').text(self.rte.i18n('Right to left')).val('rtl')), + lang : $('<input type="text" />') + }, + + events : {} + } + + $.each(self.src, function() { + for (var n in this) { + this[n].attr('name', n); + var t = this[n].get(0).nodeName; + if (t == 'INPUT' && n != 'bgimg') { + this[n].css(this[n].attr('size') ? {'text-align' : 'right'} : {width : '100%'}); + } else if (t == 'SELECT' && n!='wunit' && n!='hunit') { + this[n].css('width', '100%'); + } + } + }); + + $.each( + ['onblur', 'onfocus', 'onclick', 'ondblclick', 'onmousedown', 'onmouseup', 'onmouseover', 'onmouseout', 'onmouseleave', 'onkeydown', 'onkeypress', 'onkeyup'], + function() { + self.src.events[this] = $('<input type="text" />').css('width', '100%'); + }); + + self.src.main.align.change(function() { + var v = $(this).val(); + if (v == 'center') { + self.src.main.margin.val({left : 'auto', right : 'auto'}); + } else { + var m = self.src.main.margin.val(); + if (m.left == 'auto' && m.right == 'auto') { + self.src.main.margin.val({left : '', right : ''}); + } + } + }); + + self.src.main.bgimg.change(function() { + var t = $(this); + t.val(self.rte.utils.absoluteURL(t.val())); + }) + + } + + this.command = function() { + var n = this.rte.dom.selfOrParent(this.rte.selection.getNode(), /^TABLE$/); + + if (this.name == 'table') { + this.table = $(this.rte.doc.createElement('table')); + } else { + this.table = n ? $(n) : $(this.rte.doc.createElement('table')); + } + + !this.src && init(); + this.src.main.border.elBorderSelect({styleHeight : 117}); + this.src.main.bg.elColorPicker({palettePosition : 'outer', 'class' : 'el-colorpicker ui-icon ui-icon-pencil'}); + this.src.main.margin.elPaddingInput({ type : 'margin', value : this.table}); + + if (this.table.parents().length) { + this.src.main.rows.val('').attr('disabled', true); + this.src.main.cols.val('').attr('disabled', true); + } else { + this.src.main.rows.val(2).removeAttr('disabled'); + this.src.main.cols.val(2).removeAttr('disabled'); + } + + var w = this.table.css('width') || this.table.attr('width'); + this.src.main.width.val(parseInt(w)||''); + this.src.main.wunit.val(w.indexOf('px') != -1 ? 'px' : '%'); + + var h = this.table.css('height') || this.table.attr('height'); + this.src.main.height.val(parseInt(h)||''); + this.src.main.hunit.val(h && h.indexOf('px') != -1 ? 'px' : '%'); + + var f = this.table.css('float'); + this.src.main.align.val(''); + if (f == 'left' || f == 'right') { + this.src.main.align.val(f); + } else { + var ml = this.table.css('margin-left'); + var mr = this.table.css('margin-right'); + if (ml == 'auto' && mr == 'auto') { + this.src.main.align.val('center'); + } + } + + this.src.main.border.val(this.table); + //this.src.main.frame.val(this.table.attr('frame')); + this.src.main.rules.val(this.rte.dom.attr(this.table.get(0), 'rules')); + + this.src.main.bg.val(this.table.css('background-color')); + var bgimg = (this.table.css('background-image')||'').replace(/url\(([^\)]+)\)/i, "$1"); + this.src.main.bgimg.val(bgimg!='none' ? bgimg : ''); + + var opts = { + rtl : this.rte.rtl, + submit : function(e, d) { e.stopPropagation(); e.preventDefault(); self.set(); d.close(); }, + dialog : { + width : 530, + title : this.rte.i18n('Table') + } + } + var d = new elDialogForm(opts); + + for (var tab in this.src) { + d.tab(tab, this.rte.i18n(this.labels[tab])); + if (tab == 'main') { + var t1 = $('<table />') + .append($('<tr />').append('<td>'+this.rte.i18n('Rows')+'</td>').append($('<td />').append(this.src.main.rows))) + .append($('<tr />').append('<td>'+this.rte.i18n('Columns')+'</td>').append($('<td />').append(this.src.main.cols))); + var t2 = $('<table />') + .append($('<tr />').append('<td>'+this.rte.i18n('Width')+'</td>').append($('<td />').append(this.src.main.width).append(this.src.main.wunit))) + .append($('<tr />').append('<td>'+this.rte.i18n('Height')+'</td>').append($('<td />').append(this.src.main.height).append(this.src.main.hunit))); + var t3 = $('<table />') + .append($('<tr />').append('<td>'+this.rte.i18n('Spacing')+'</td>').append($('<td />').append(this.src.main.spacing.val(this.table.attr('cellspacing')||'')))) + .append($('<tr />').append('<td>'+this.rte.i18n('Padding')+'</td>').append($('<td />').append(this.src.main.padding.val(this.table.attr('cellpadding')||'')))); + + d.append([this.rte.i18n('Caption'), this.src.main.caption.val(this.table.find('caption').eq(0).text() || '')], 'main', true) + .separator('main') + .append([t1, t2, t3], 'main', true) + .separator('main') + .append([this.rte.i18n('Border'), this.src.main.border], 'main', true) + //.append([this.rte.i18n('Frame'), this.src.main.frame], 'main', true) + .append([this.rte.i18n('Inner borders'), this.src.main.rules], 'main', true) + .append([this.rte.i18n('Alignment'), this.src.main.align], 'main', true) + .append([this.rte.i18n('Margins'), this.src.main.margin], 'main', true) + .append([this.rte.i18n('Background'), $('<span />').append($('<span />').css({'float' : 'left', 'margin-right' : '3px'}).append(this.src.main.bg)).append(this.src.main.bgimg)], 'main', true) + } else { + for (var name in this.src[tab]) { + var v = this.rte.dom.attr(this.table, name); + if (tab == 'events') { + v = this.rte.utils.trimEventCallback(v); + } + d.append([this.rte.i18n(this.labels[name] ? this.labels[name] : name), this.src[tab][name].val(v)], tab, true); + } + } + } + + d.open(); + } + + this.set = function() { + + if (!this.table.parents().length) { + var r = parseInt(this.src.main.rows.val()) || 0; + var c = parseInt(this.src.main.cols.val()) || 0; + if (r<=0 || c<=0) { + return; + } + this.rte.history.add(); + var b = $(this.rte.doc.createElement('tbody')).appendTo(this.table); + + for (var i=0; i < r; i++) { + var tr = '<tr>'; + for (var j=0; j < c; j++) { + tr += '<td> </td>'; + } + b.append(tr+'</tr>'); + }; + + // var tr = $(this.rte.doc.createElement('tr')); + // + // for (var i=0; i < c; i++) { + // tr.append($(this.rte.doc.createElement('td')).html(' ')); + // }; + // + // for (var i=0; i<r; i++) { + // b.append(tr.clone(true)); + // }; + + // this.rte.selection.insertNode(this.table.get(0), true); + } else { + this.table + .removeAttr('width') + .removeAttr('height') + .removeAttr('border') + .removeAttr('align') + .removeAttr('bordercolor') + .removeAttr('bgcolor') + .removeAttr('cellspacing') + .removeAttr('cellpadding') + .removeAttr('frame') + .removeAttr('rules') + .removeAttr('style'); + } + + var cap = $.trim(this.src.main.caption.val()); + if (cap) { + if (!this.table.children('caption').length) { + this.table.prepend('<caption />' ); + } + this.table.children('caption').text(cap); + } else { + this.table.children('caption').remove(); + } + + + for (var tab in this.src) { + if (tab != 'main') { + for (var n in this.src[tab]) { + var v = $.trim(this.src[tab][n].val()); + if (v) { + this.table.attr(n, v); + } else { + this.table.removeAttr(n); + } + } + } + } + var spacing, padding, rules; + + if ((spacing = parseInt(this.src.main.spacing.val())) && spacing>=0) { + this.table.attr('cellspacing', spacing); + } + + if ((padding = parseInt(this.src.main.padding.val())) && padding>=0) { + this.table.attr('cellpadding', padding); + } + + if ((rules = this.src.main.rules.val())) { + this.table.attr('rules', rules); + } + + var + w = parseInt(this.src.main.width.val()) || '', + h = parseInt(this.src.main.height.val()) || '', + i = $.trim(this.src.main.bgimg.val()), + b = this.src.main.border.val(), + m = this.src.main.margin.val(), + f = this.src.main.align.val(); + this.table.css({ + width : w ? w+this.src.main.wunit.val() : '', + height : h ? h+this.src.main.hunit.val() : '', + border : $.trim(b.width+' '+b.style+' '+b.color), + 'background-color' : this.src.main.bg.val(), + 'background-image' : i ? 'url('+i+')' : '' + }); + if (m.css) { + this.table.css('margin', m.css); + } else { + this.table.css({ + 'margin-top' : m.top, + 'margin-right' : m.right, + 'margin-bottom' : m.bottom, + 'margin-left' : m.left + }); + } + if ((f=='left' || f=='right') && this.table.css('margin-left')!='auto' && this.table.css('margin-right')!='auto') { + this.table.css('float', f); + } + if (!this.table.attr('style')) { + this.table.removeAttr('style'); + } + if (!this.table.parents().length) { + this.rte.selection.insertNode(this.table.get(0), true); + } + this.rte.ui.update(); + } + + this.update = function() { + this.domElem.removeClass('disabled'); + if (this.name == 'tableprops' && !this.rte.dom.selfOrParent(this.rte.selection.getNode(), /^TABLE$/)) { + this.domElem.addClass('disabled').removeClass('active'); + } + } + +} + +elRTE.prototype.ui.prototype.buttons.tableprops = elRTE.prototype.ui.prototype.buttons.table; + +})(jQuery); + Propchange: ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/table.js ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/table.js ------------------------------------------------------------------------------ svn:keywords = Date Rev Author URL Id Propchange: ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/table.js ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/tablerm.js URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/tablerm.js?rev=1178141&view=auto ============================================================================== --- ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/tablerm.js (added) +++ ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/tablerm.js Sun Oct 2 08:06:49 2011 @@ -0,0 +1,32 @@ +/** + * @class button - remove table + * + * @param elRTE rte обÑекÑ-ÑедакÑÐ¾Ñ + * @param String name название кнопки + * + * @author: Dmitry Levashov (dio) [hidden email] + * @copyright: Studio 42, http://www.std42.ru + **/ +(function($) { +elRTE.prototype.ui.prototype.buttons.tablerm = function(rte, name) { + this.constructor.prototype.constructor.call(this, rte, name); + + this.command = function() { + var t = this.rte.dom.parent(this.rte.selection.getNode(), /^TABLE$/); + // t && $(t).remove(); + if (t) { + this.rte.history.add(); + $(t).remove(); + } + this.rte.ui.update(true); + } + + this.update = function() { + if (this.rte.dom.parent(this.rte.selection.getNode(), /^TABLE$/)) { + this.domElem.removeClass('disabled'); + } else { + this.domElem.addClass('disabled'); + } + } +} +})(jQuery); Propchange: ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/tablerm.js ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/tablerm.js ------------------------------------------------------------------------------ svn:keywords = Date Rev Author URL Id Propchange: ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/tablerm.js ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/tbcellprops.js URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/tbcellprops.js?rev=1178141&view=auto ============================================================================== --- ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/tbcellprops.js (added) +++ ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/tbcellprops.js Sun Oct 2 08:06:49 2011 @@ -0,0 +1,261 @@ +/** + * @class button - table cell properties + * + * @param elRTE rte обÑекÑ-ÑедакÑÐ¾Ñ + * @param String name название кнопки + * + * + * @author: Dmitry Levashov (dio) [hidden email] + * @copyright: Studio 42, http://www.std42.ru + **/ +(function($) { +elRTE.prototype.ui.prototype.buttons.tbcellprops = function(rte, name) { + this.constructor.prototype.constructor.call(this, rte, name); + var self = this; + this.src = null; + this.labels = null; + + function init() { + self.labels = { + main : 'Properies', + adv : 'Advanced', + events : 'Events', + id : 'ID', + 'class' : 'Css class', + style : 'Css style', + dir : 'Script direction', + lang : 'Language' + } + + self.src = { + main : { + type : $('<select />').css('width', '100%') + .append($('<option />').val('td').text(self.rte.i18n('Data'))) + .append($('<option />').val('th').text(self.rte.i18n('Header'))), + width : $('<input type="text" />').attr('size', 4), + wunit : $('<select />') + .append($('<option />').val('%').text('%')) + .append($('<option />').val('px').text('px')), + height : $('<input type="text" />').attr('size', 4), + hunit : $('<select />') + .append($('<option />').val('%').text('%')) + .append($('<option />').val('px').text('px')), + align : $('<select />').css('width', '100%') + .append($('<option />').val('').text(self.rte.i18n('Not set'))) + .append($('<option />').val('left').text(self.rte.i18n('Left'))) + .append($('<option />').val('center').text(self.rte.i18n('Center'))) + .append($('<option />').val('right').text(self.rte.i18n('Right'))) + .append($('<option />').val('justify').text(self.rte.i18n('Justify'))), + border : $('<div />'), + padding : $('<div />'), + bg : $('<div />'), + bgimg : $('<input type="text" />').css('width', '90%'), + apply : $('<select />').css('width', '100%') + .append($('<option />').val('').text(self.rte.i18n('Current cell'))) + .append($('<option />').val('row').text(self.rte.i18n('All cells in row'))) + .append($('<option />').val('column').text(self.rte.i18n('All cells in column'))) + .append($('<option />').val('table').text(self.rte.i18n('All cells in table'))) + }, + + adv : { + id : $('<input type="text" />'), + 'class' : $('<input type="text" />'), + style : $('<input type="text" />'), + dir : $('<select />').css('width', '100%') + .append($('<option />').text(self.rte.i18n('Not set')).val('')) + .append($('<option />').text(self.rte.i18n('Left to right')).val('ltr')) + .append($('<option />').text(self.rte.i18n('Right to left')).val('rtl')), + lang : $('<input type="text" />') + }, + + events : {} + } + + $.each(self.src, function() { + for (var n in this) { + this[n].attr('name', n); + if (this[n].attr('type') == 'text' && !this[n].attr('size') && n!='bgimg') { + this[n].css('width', '100%') + } + } + }); + + $.each( + ['onblur', 'onfocus', 'onclick', 'ondblclick', 'onmousedown', 'onmouseup', 'onmouseover', 'onmouseout', 'onmouseleave', 'onkeydown', 'onkeypress', 'onkeyup'], + function() { + self.src.events[this] = $('<input type="text" />').css('width', '100%'); + }); + + } + + this.command = function() { + !this.src && init(); + this.cell = this.rte.dom.selfOrParent(this.rte.selection.getNode(), /^(TD|TH)$/); + if (!this.cell) { + return; + } + this.src.main.type.val(this.cell.nodeName.toLowerCase()); + this.cell = $(this.cell); + this.src.main.border.elBorderSelect({styleHeight : 117, value : this.cell}); + this.src.main.bg.elColorPicker({palettePosition : 'outer', 'class' : 'el-colorpicker ui-icon ui-icon-pencil'}); + this.src.main.padding.elPaddingInput({ value : this.cell}); + + var w = this.cell.css('width') || this.cell.attr('width'); + this.src.main.width.val(parseInt(w)||''); + this.src.main.wunit.val(w.indexOf('px') != -1 ? 'px' : '%'); + + var h = this.cell.css('height') || this.cell.attr('height'); + this.src.main.height.val(parseInt(h)||''); + this.src.main.hunit.val(h.indexOf('px') != -1 ? 'px' : '%'); + + this.src.main.align.val(this.cell.attr('align') || this.cell.css('text-align')); + this.src.main.bg.val(this.cell.css('background-color')); + var bgimg = this.cell.css('background-image'); + this.src.main.bgimg.val(bgimg && bgimg!='none' ? bgimg.replace(/url\(([^\)]+)\)/i, "$1") : ''); + this.src.main.apply.val(''); + + var opts = { + rtl : this.rte.rtl, + submit : function(e, d) { e.stopPropagation(); e.preventDefault(); self.set(); d.close(); }, + dialog : { + width : 520, + title : this.rte.i18n('Table cell properties') + } + } + var d = new elDialogForm(opts); + for (var tab in this.src) { + d.tab(tab, this.rte.i18n(this.labels[tab])); + + if (tab == 'main') { + d.append([this.rte.i18n('Width'), $('<span />').append(this.src.main.width).append(this.src.main.wunit)], 'main', true) + .append([this.rte.i18n('Height'), $('<span />').append(this.src.main.height).append(this.src.main.hunit)], 'main', true) + .append([this.rte.i18n('Table cell type'), this.src.main.type], 'main', true) + .append([this.rte.i18n('Border'), this.src.main.border], 'main', true) + .append([this.rte.i18n('Alignment'), this.src.main.align], 'main', true) + .append([this.rte.i18n('Paddings'), this.src.main.padding], 'main', true) + .append([this.rte.i18n('Background'), $('<span />').append($('<span />').css({'float' : 'left', 'margin-right' : '3px'}).append(this.src.main.bg)).append(this.src.main.bgimg)], 'main', true) + .append([this.rte.i18n('Apply to'), this.src.main.apply], 'main', true); + } else { + for (var name in this.src[tab]) { + var v = this.cell.attr(name) || ''; + if (tab == 'events') { + v = this.rte.utils.trimEventCallback(v); + } + d.append([this.rte.i18n(this.labels[name] ? this.labels[name] : name), this.src[tab][name].val(v)], tab, true); + } + } + } + d.open() + } + + this.set = function() { + // $(t).remove(); + var target = this.cell, + apply = this.src.main.apply.val(); + switch (this.src.main.apply.val()) { + case 'row': + target = this.cell.parent('tr').children('td,th'); + break; + + case 'column': + target = $(this.rte.dom.tableColumn(this.cell.get(0))); + break; + + case 'table': + target = this.cell.parents('table').find('td,th'); + break; + } + + for (var tab in this.src) { + if (tab != 'main') { + for (var n in this.src[tab]) { + var v = $.trim(this.src[tab][n].val()); + if (v) { + target.attr(n, v); + } else { + target.removeAttr(n); + } + } + } + } + + target.removeAttr('width') + .removeAttr('height') + .removeAttr('border') + .removeAttr('align') + .removeAttr('bordercolor') + .removeAttr('bgcolor'); + + var t = this.src.main.type.val(); + var w = parseInt(this.src.main.width.val()) || ''; + var h = parseInt(this.src.main.height.val()) || ''; + var i = $.trim(this.src.main.bgimg.val()); + var b = this.src.main.border.val(); + var css = { + 'width' : w ? w+this.src.main.wunit.val() : '', + 'height' : h ? h+this.src.main.hunit.val() : '', + 'background-color' : this.src.main.bg.val(), + 'background-image' : i ? 'url('+i+')' : '', + 'border' : $.trim(b.width+' '+b.style+' '+b.color), + 'text-align' : this.src.main.align.val() || '' + }; + var p = this.src.main.padding.val(); + if (p.css) { + css.padding = p.css; + } else { + css['padding-top'] = p.top; + css['padding-right'] = p.right; + css['padding-bottom'] = p.bottom; + css['padding-left'] = p.left; + } + + target = target.get(); + + $.each(target, function() { + var type = this.nodeName.toLowerCase(); + var $this = $(this); + if (type != t) { + + var attr = {} + for (var i in self.src.adv) { + var v = $this.attr(i) + if (v) { + attr[i] = v.toString(); + } + } + for (var i in self.src.events) { + var v = $this.attr(i) + if (v) { + attr[i] = v.toString(); + } + } + var colspan = $this.attr('colspan')||1; + var rowspan = $this.attr('rowspan')||1; + if (colspan>1) { + attr.colspan = colspan; + } + if (rowspan>1) { + attr.rowspan = rowspan; + } + + $this.replaceWith($('<'+t+' />').html($this.html()).attr(attr).css(css) ); + + } else { + $this.css(css); + } + }); + + this.rte.ui.update(); + } + + this.update = function() { + if (this.rte.dom.parent(this.rte.selection.getNode(), /^TABLE$/)) { + this.domElem.removeClass('disabled'); + } else { + this.domElem.addClass('disabled'); + } + } + +} + +})(jQuery); \ No newline at end of file Propchange: ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/tbcellprops.js ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/tbcellprops.js ------------------------------------------------------------------------------ svn:keywords = Date Rev Author URL Id Propchange: ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/tbcellprops.js ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/tbcellsmerge.js URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/tbcellsmerge.js?rev=1178141&view=auto ============================================================================== --- ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/tbcellsmerge.js (added) +++ ofbiz/trunk/framework/images/webapp/images/jquery/plugins/elrte-1.3/src/elrte/js/ui/tbcellsmerge.js Sun Oct 2 08:06:49 2011 @@ -0,0 +1,132 @@ +/** + * @class button - table cells merge + * + * @param elRTE rte обÑекÑ-ÑедакÑÐ¾Ñ + * @param String name название кнопки + * + * @author: Dmitry Levashov (dio) [hidden email] + * @copyright: Studio 42, http://www.std42.ru + **/ +(function($) { +elRTE.prototype.ui.prototype.buttons.tbcellsmerge = function(rte, name) { + this.constructor.prototype.constructor.call(this, rte, name); + var self = this; + + function selectedCells() { + var c1 = self.rte.dom.selfOrParent(self.rte.selection.getStart(), /^(TD|TH)$/); + var c2 = self.rte.dom.selfOrParent(self.rte.selection.getEnd(), /^(TD|TH)$/); + if (c1 && c2 && c1!=c2 && $(c1).parents('table').get(0) == $(c2).parents('table').get(0)) { + return [c1, c2]; + } + return null; + } + + this.command = function() { + var cells = selectedCells(); + + if (cells) { + + var _s = this.rte.dom.indexOf($(cells[0]).parent('tr').get(0)); + var _e = this.rte.dom.indexOf($(cells[1]).parent('tr').get(0)); + var ro = Math.min(_s, _e); // row offset + var rl = Math.max(_s, _e) - ro + 1; // row length + var _c1 = this.rte.dom.tableColumn(cells[0], true, true); + var _c2 = this.rte.dom.tableColumn(cells[1], true); + var _i1 = $.inArray(cells[0], _c1.column); + var _i2 = $.inArray(cells[1], _c2.column); + + var colBegin = _c1.info.offset[_i1] < _c2.info.offset[_i2] ? _c1 : _c2; + var colEnd = _c1.info.offset[_i1] >= _c2.info.offset[_i2] ? _c1 : _c2; + var length = 0; + var target = null; + var html = ''; + this.rte.history.add(); + var rows = $($(cells[0]).parents('table').eq(0).find('tr').get().slice(ro, ro+rl)) + .each( function(i) { + var _l = html.length; + var accept = false; + $(this).children('td,th').each(function() { + var $this = $(this); + var inBegin = $.inArray(this, colBegin.column); + var inEnd = $.inArray(this, colEnd.column); + + if (inBegin!=-1 || inEnd!=-1) { + accept = inBegin!=-1 && inEnd==-1; + var len = parseInt($this.attr('colspan')||1) + if (i == 0) { + length += len; + } + + if (inBegin!=-1 && i>0) { + var delta = colBegin.info.delta[inBegin]; + if (delta>0) { + if ($this.css('text-align') == 'left') { + var cell = $this.clone(true); + $this.html(' '); + } else { + var cell = $this.clone().html(' '); + } + cell.removeAttr('colspan').removeAttr('id').insertBefore(this); + if (delta>1) { + cell.attr('colspan', delta); + } + } + } + + if (inEnd!=-1) { + var delta = colEnd.info.delta[inEnd]; + if (len-delta>1) { + var cp = len-delta-1; + if ($this.css('text-align') == 'right') { + var cell = $this.clone(true); + $this.html(' '); + } else { + var cell = $this.clone().html(' '); + } + cell.removeAttr('colspan').removeAttr('id').insertAfter(this); + if (cp>1) { + cell.attr('colspan', cp); + } + } + } + if (!target) { + target = $this; + } else { + html += $this.html(); + $this.remove(); + } + } else if (accept) { + if (i == 0) { + length += parseInt($this.attr('colspan')||1); + } + html += $this.html(); + $this.remove(); + + + } + }) + html += _l!=html.length ? '<br />' : ''; + }); + + target.removeAttr('colspan').removeAttr('rowspan').html(target.html()+html) + if (length>1) { + target.attr('colspan', length); + } + if (rl>1) { + target.attr('rowspan', rl); + } + // sometimes when merge cells with different rowspans we get "lost" cells in rows + // this add cells if needed + this.rte.dom.fixTable($(cells[0]).parents('table').get(0)); + } + } + + this.update = function() { + if (selectedCells()) { + this.domElem.removeClass('disabled'); + } else { + this.domElem.addClass('disabled'); + } + } +} +})(jQuery); |
Free forum by Nabble | Edit this page |