From: Yves K. <yku...@us...> - 2004-11-09 19:04:05
|
Update of /cvsroot/phpwebsite-comm/modules/xwysiwyg/mod/xwysiwyg/_htmlarea/plugins/ImageManager In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5615/modules/xwysiwyg/mod/xwysiwyg/_htmlarea/plugins/ImageManager Modified Files: image-manager.js Log Message: added alt default-text Index: image-manager.js =================================================================== RCS file: /cvsroot/phpwebsite-comm/modules/xwysiwyg/mod/xwysiwyg/_htmlarea/plugins/ImageManager/image-manager.js,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** image-manager.js 25 Oct 2004 18:16:08 -0000 1.1.1.1 --- image-manager.js 9 Nov 2004 19:02:28 -0000 1.2 *************** *** 1,100 **** ! /** ! * The ImageManager plugin javascript. ! * @author $Author$ ! * @version $Id$ ! * @package ImageManager ! */ ! ! /** ! * To Enable the plug-in add the following line before HTMLArea is initialised. ! * ! * HTMLArea.loadPlugin("ImageManager"); ! * ! * Then configure the config.inc.php file, that is all. ! * For up-to-date documentation, please visit http://www.zhuo.org/htmlarea/ ! */ ! ! /** ! * It is pretty simple, this file over rides the HTMLArea.prototype._insertImage ! * function with our own, only difference is the popupDialog url ! * point that to the php script. ! */ ! function ImageManager(editor) ! { ! var tt = ImageManager.I18N; ! ! }; ! ! ImageManager._pluginInfo = { ! name : "ImageManager", ! version : "1.0", ! developer : "Xiang Wei Zhuo", ! developer_url : "http://www.zhuo.org/htmlarea/", ! license : "htmlArea" ! }; ! ! ! // Over ride the _insertImage function in htmlarea.js. ! // Open up the ImageManger script instead. ! HTMLArea.prototype._insertImage = function(image) { ! ! var editor = this; // for nested functions ! var outparam = null; ! if (typeof image == "undefined") { ! image = this.getParentElement(); ! if (image && !/^img$/i.test(image.tagName)) ! image = null; ! } ! if (image) outparam = { ! f_url : HTMLArea.is_ie ? image.src : image.getAttribute("src"), ! f_alt : image.alt, ! f_border : image.border, ! f_align : image.align, ! f_vert : image.vspace, ! f_horiz : image.hspace, ! f_width : image.width, ! f_height : image.height ! }; ! ! var manager = _editor_url + 'plugins/ImageManager/manager.php'; ! ! Dialog(manager, function(param) { ! if (!param) { // user must have pressed Cancel ! return false; ! } ! var img = image; ! if (!img) { ! var sel = editor._getSelection(); ! var range = editor._createRange(sel); ! editor._doc.execCommand("insertimage", false, param.f_url); ! if (HTMLArea.is_ie) { ! img = range.parentElement(); ! // wonder if this works... ! if (img.tagName.toLowerCase() != "img") { ! img = img.previousSibling; ! } ! } else { ! img = range.startContainer.previousSibling; ! } ! } else { ! img.src = param.f_url; ! } ! ! for (field in param) { ! var value = param[field]; ! switch (field) { ! case "f_alt" : img.alt = value; break; ! case "f_border" : img.border = parseInt(value || "0"); break; ! case "f_align" : img.align = value; break; ! case "f_vert" : img.vspace = parseInt(value || "0"); break; ! case "f_horiz" : img.hspace = parseInt(value || "0"); break; ! case "f_width" : img.width = parseInt(value || "0"); break; ! case "f_height" : img.height = parseInt(value || "0"); break; ! } ! } ! ! ! }, outparam); ! }; ! ! --- 1,98 ---- ! /** ! * The ImageManager plugin javascript. ! * @author $Author$ ! * @version $Id$ ! * @package ImageManager ! */ ! ! /** ! * To Enable the plug-in add the following line before HTMLArea is initialised. ! * ! * HTMLArea.loadPlugin("ImageManager"); ! * ! * Then configure the config.inc.php file, that is all. ! * For up-to-date documentation, please visit http://www.zhuo.org/htmlarea/ ! */ ! ! /** ! * It is pretty simple, this file over rides the HTMLArea.prototype._insertImage ! * function with our own, only difference is the popupDialog url ! * point that to the php script. ! */ ! function ImageManager(editor) ! { ! var tt = ImageManager.I18N; ! ! }; ! ! ImageManager._pluginInfo = { ! name : "ImageManager", ! version : "1.0", ! developer : "Xiang Wei Zhuo", ! developer_url : "http://www.zhuo.org/htmlarea/", ! license : "htmlArea" ! }; ! ! ! // Over ride the _insertImage function in htmlarea.js. ! // Open up the ImageManger script instead. ! HTMLArea.prototype._insertImage = function(image) { ! ! var editor = this; // for nested functions ! var outparam = null; ! if (typeof image == "undefined") { ! image = this.getParentElement(); ! if (image && !/^img$/i.test(image.tagName)) ! image = null; ! } ! if (image) outparam = { ! f_url : HTMLArea.is_ie ? image.src : image.getAttribute("src"), ! f_alt : image.alt, ! f_border : image.border, ! f_align : image.align, ! f_vert : image.vspace, ! f_horiz : image.hspace, ! f_width : image.width, ! f_height : image.height ! }; ! ! var manager = _editor_url + 'plugins/ImageManager/manager.php'; ! ! Dialog(manager, function(param) { ! if (!param) { // user must have pressed Cancel ! return false; ! } ! var img = image; ! if (!img) { ! var sel = editor._getSelection(); ! var range = editor._createRange(sel); ! editor._doc.execCommand("insertimage", false, param.f_url); ! if (HTMLArea.is_ie) { ! img = range.parentElement(); ! // wonder if this works... ! if (img.tagName.toLowerCase() != "img") { ! img = img.previousSibling; ! } ! } else { ! img = range.startContainer.previousSibling; ! } ! } else { ! img.src = param.f_url; ! } ! ! for (field in param) { ! var value = param[field]; ! switch (field) { ! case "f_alt" : img.alt = (value || "Image"); break; ! case "f_border" : img.border = parseInt(value || "0"); break; ! case "f_align" : img.align = value; break; ! case "f_vert" : img.vspace = parseInt(value || "0"); break; ! case "f_horiz" : img.hspace = parseInt(value || "0"); break; ! case "f_width" : img.width = parseInt(value || "0"); break; ! case "f_height" : img.height = parseInt(value || "0"); break; ! } ! } ! ! ! }, outparam); ! }; |