Übernahme der Änderungen von Sidoine:
- jQuery aktualisiert - Fancybox 2 integriert - Xinha auf aktuelle Version aktualisert git-svn-id: https://svn.libreccm.org/ccm/trunk@2664 8810af33-2d31-482b-a856-94f89814c4dfmaster
|
|
@ -0,0 +1,50 @@
|
|||
/* This is the OpenCCM default Xinha configuration file. It provides basic funcionality *
|
||||
* which might be used by any CCM module. A module may provide its own configuration *
|
||||
* file during Xinha loading or may extend com.arsdigita.bebop.form.DHTMLEditor as *
|
||||
* ccm-cms does (com.arsdigita.cms.CMSDHTMLEditor) to provide extensive configuration *
|
||||
* options. */
|
||||
/* It is based on the original configuration file XinhaConfig.js (compressed version) */
|
||||
/* http://svn.xinha.webfactional.com/trunk/examples/XinhaConfig.js */
|
||||
_editor_skin = "silva";
|
||||
_editor_icons = "Crystal";
|
||||
xinha_init=null;
|
||||
xinha_config=null;
|
||||
xinha_init=xinha_init?xinha_init:function(){
|
||||
xinha_editors=xinha_editors?xinha_editors:["myTextArea","anotherOne"];
|
||||
xinha_plugins=xinha_plugins?xinha_plugins:["CharacterMap","CharCounter",
|
||||
"ContextMenu","DefinitionList","FindReplace","ListType","QuickTag",
|
||||
"SmartReplace","Stylist","TableOperations","UnFormat","Equation","OpenCCM"];
|
||||
if(!Xinha.loadPlugins(xinha_plugins,xinha_init)){
|
||||
return;
|
||||
}
|
||||
xinha_config=xinha_config?xinha_config():new Xinha.Config();
|
||||
//this is the standard toolbar for CCM, feel free to remove buttons as you like
|
||||
xinha_config.toolbar =
|
||||
[
|
||||
["popupeditor"],
|
||||
["separator","formatblock","bold","italic","underline","strikethrough"],
|
||||
["separator","subscript","superscript"],
|
||||
["separator","justifyleft","justifycenter","justifyright","justifyfull"],
|
||||
["separator","insertorderedlist","insertunorderedlist","outdent","indent"],
|
||||
["separator","createlink"],
|
||||
["separator","undo","redo","selectall"],
|
||||
(Xinha.is_gecko ? [] : ["cut","copy","paste","overwrite"]),
|
||||
["separator","killword","clearfonts","removeformat"],
|
||||
["linebreak","separator","htmlmode","showhelp","about"]
|
||||
];
|
||||
xinha_config.formatblock =
|
||||
{
|
||||
"— format —" : "",
|
||||
"Heading 3": "h3",
|
||||
"Heading 4": "h4",
|
||||
"Heading 5": "h5",
|
||||
"Heading 6": "h6",
|
||||
"Normal" : "p"
|
||||
};
|
||||
|
||||
xinha_config.pageStyleSheets=[_editor_url+"examples/full_example.css"];
|
||||
xinha_editors=Xinha.makeEditors(xinha_editors,xinha_config,xinha_plugins);
|
||||
Xinha.startEditors(xinha_editors);
|
||||
};
|
||||
Xinha.addOnloadHandler(xinha_init);
|
||||
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
/* This compressed file is part of Xinha. For uncompressed sources, forum, and bug reports, go to xinha.org */
|
||||
/* This file is part of version 0.95 released Mon, 12 May 2008 17:33:15 +0200 */
|
||||
/* The URL of the most recent version of this file is http://svn.xinha.webfactional.com/trunk/examples/XinhaConfig.js */
|
||||
xinha_init=null;
|
||||
xinha_config=null;
|
||||
xinha_init=xinha_init?xinha_init:function(){
|
||||
xinha_editors=xinha_editors?xinha_editors:["myTextArea","anotherOne"];
|
||||
xinha_plugins=xinha_plugins?xinha_plugins:["CharacterMap","ContextMenu","SmartReplace","Stylist","Linker","SuperClean","TableOperations"];
|
||||
if(!Xinha.loadPlugins(xinha_plugins,xinha_init)){
|
||||
return;
|
||||
}
|
||||
xinha_config=xinha_config?xinha_config():new Xinha.Config();
|
||||
xinha_config.pageStyleSheets=[_editor_url+"examples/full_example.css"];
|
||||
xinha_editors=Xinha.makeEditors(xinha_editors,xinha_config,xinha_plugins);
|
||||
Xinha.startEditors(xinha_editors);
|
||||
};
|
||||
Xinha.addOnloadHandler(xinha_init);
|
||||
|
||||
|
|
@ -1,2 +1,283 @@
|
|||
/* This compressed file is part of Xinha. For uncompressed sources, forum, and bug reports, go to xinha.org */
|
||||
var Xinha={};if(!window._editor_url){(function(){var scripts=document.getElementsByTagName("script");var this_script=scripts[scripts.length-1];var args=this_script.src.split("?");args=args.length==2?args[1].split("&"):"";for(var index=0;index<args.length;++index){var arg=args[index].split("=");if(arg.length==2){switch(arg[0]){case"lang":case"icons":case"skin":case"url":window["_editor_"+arg[0]]=arg[1];break}}}if(this_script.innerHTML.replace(/\s+/,"")){eval(this_script.innerHTML)}_editor_lang=window._editor_lang||"en";_editor_url=window._editor_url||this_script.src.split("?")[0].split("/").slice(0,-1).join("/")})()}_editor_url=_editor_url.replace(/\x2f*$/,"/");Xinha.agt=navigator.userAgent.toLowerCase();Xinha.is_ie=((Xinha.agt.indexOf("msie")!=-1)&&(Xinha.agt.indexOf("opera")==-1));Xinha.ie_version=parseFloat(Xinha.agt.substring(Xinha.agt.indexOf("msie")+5));Xinha.is_opera=(Xinha.agt.indexOf("opera")!=-1);Xinha.is_khtml=(Xinha.agt.indexOf("khtml")!=-1);Xinha.is_webkit=(Xinha.agt.indexOf("applewebkit")!=-1);Xinha.is_safari=(Xinha.agt.indexOf("safari")!=-1);Xinha.opera_version=navigator.appVersion.substring(0,navigator.appVersion.indexOf(" "))*1;Xinha.is_mac=(Xinha.agt.indexOf("mac")!=-1);Xinha.is_mac_ie=(Xinha.is_ie&&Xinha.is_mac);Xinha.is_win_ie=(Xinha.is_ie&&!Xinha.is_mac);Xinha.is_gecko=(navigator.product=="Gecko"&&!Xinha.is_safari);Xinha.isRunLocally=document.URL.toLowerCase().search(/^file:/)!=-1;Xinha.is_designMode=(typeof document.designMode!="undefined"&&!Xinha.is_ie);Xinha.isSupportedBrowser=Xinha.is_gecko||(Xinha.is_opera&&Xinha.opera_version>=9.1)||Xinha.ie_version>=5.5||Xinha.is_safari;Xinha.loadPlugins=function(b,a){if(!Xinha.isSupportedBrowser){return}Xinha.loadStyle(typeof _editor_css=="string"?_editor_css:"Xinha.css","XinhaCoreDesign");Xinha.createLoadingMessages(xinha_editors);var c=Xinha.loadingMessages;Xinha._loadback(_editor_url+"XinhaCore.js",function(){Xinha.removeLoadingMessages(xinha_editors);Xinha.createLoadingMessages(xinha_editors);a()});return false};Xinha._loadback=function(f,e,a,d){var b=!Xinha.is_ie?"onload":"onreadystatechange";var c=document.createElement("script");c.type="text/javascript";c.src=f;if(e){c[b]=function(){if(Xinha.is_ie&&(!(/loaded|complete/.test(window.event.srcElement.readyState)))){return}e.call(a?a:this,d);c[b]=null}}document.getElementsByTagName("head")[0].appendChild(c)};Xinha.getElementTopLeft=function(b){var c=0;var a=0;if(b.offsetParent){c=b.offsetLeft;a=b.offsetTop;while(b=b.offsetParent){c+=b.offsetLeft;a+=b.offsetTop}}return{top:a,left:c}};Xinha.findPosX=function(a){var b=0;if(a.offsetParent){return Xinha.getElementTopLeft(a).left}else{if(a.x){b+=a.x}}return b};Xinha.findPosY=function(b){var a=0;if(b.offsetParent){return Xinha.getElementTopLeft(b).top}else{if(b.y){a+=b.y}}return a};Xinha.createLoadingMessages=function(b){if(Xinha.loadingMessages||!Xinha.isSupportedBrowser){return}Xinha.loadingMessages=[];for(var a=0;a<b.length;a++){if(!document.getElementById(b[a])){continue}Xinha.loadingMessages.push(Xinha.createLoadingMessage(document.getElementById(b[a])))}};Xinha.createLoadingMessage=function(d,e){if(document.getElementById("loading_"+d.id)||!Xinha.isSupportedBrowser){return}var a=document.createElement("div");a.id="loading_"+d.id;a.className="loading";a.style.left=(Xinha.findPosX(d)+d.offsetWidth/2)-106+"px";a.style.top=(Xinha.findPosY(d)+d.offsetHeight/2)-50+"px";var b=document.createElement("div");b.className="loading_main";b.id="loading_main_"+d.id;b.appendChild(document.createTextNode(Xinha._lc("Loading in progress. Please wait!")));var c=document.createElement("div");c.className="loading_sub";c.id="loading_sub_"+d.id;e=e?e:Xinha._lc("Loading Core");c.appendChild(document.createTextNode(e));a.appendChild(b);a.appendChild(c);document.body.appendChild(a);return c};Xinha.loadStyle=function(c,e){var a=_editor_url||"";a+=c;var b=document.getElementsByTagName("head")[0];var d=document.createElement("link");d.rel="stylesheet";d.href=a;if(e){d.id=e}b.appendChild(d)};Xinha._lc=function(a){return a};Xinha._addEvent=function(b,a,c){if(document.addEventListener){b.addEventListener(a,c,true)}else{b.attachEvent("on"+a,c)}};Xinha.addOnloadHandler=function(a){var b=function(){if(arguments.callee.done){return}arguments.callee.done=true;if(Xinha.onloadTimer){clearInterval(Xinha.onloadTimer)}a.call()};if(Xinha.is_ie){document.attachEvent("onreadystatechange",function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",arguments.callee);b()}});if(document.documentElement.doScroll&&typeof window.frameElement==="undefined"){(function(){if(arguments.callee.done){return}try{document.documentElement.doScroll("left")}catch(c){setTimeout(arguments.callee,0);return}b()})()}}else{if(/WebKit/i.test(navigator.userAgent)){Xinha.onloadTimer=setInterval(function(){if(/loaded|complete/.test(document.readyState)){b()}},10)}else{document.addEventListener("DOMContentLoaded",b,false)}}};
|
||||
var Xinha = {};
|
||||
|
||||
// Auto detect _editor_url if it's not set.
|
||||
if (!window._editor_url)
|
||||
{
|
||||
(function() // wrap this in an ad-hoc function to avoid unecessary pollution of global namespace
|
||||
{
|
||||
// Because of the way the DOM is loaded, this is guaranteed to always pull our script tag.
|
||||
var scripts = document.getElementsByTagName('script');
|
||||
var this_script = scripts[scripts.length - 1];
|
||||
|
||||
// We'll allow two ways to specify arguments. We'll accept them in the
|
||||
// argument of the script, or we'll accept them embedded into our script tag.
|
||||
var args = this_script.src.split('?');
|
||||
args = args.length == 2 ? args[1].split('&') : '';
|
||||
for (var index = 0; index < args.length; ++index)
|
||||
{
|
||||
var arg = args[index].split('=');
|
||||
if (arg.length == 2)
|
||||
{
|
||||
switch (arg[0])
|
||||
{
|
||||
case 'lang':
|
||||
case 'icons':
|
||||
case 'skin':
|
||||
case 'url':
|
||||
window['_editor_' + arg[0]] = arg[1];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// We can grab the script innerHTML and execute that to cut down on script
|
||||
// tags. Thanks John Resig!
|
||||
// http://ejohn.org/blog/degrading-script-tags/
|
||||
if (this_script.innerHTML.replace(/\s+/, ''))
|
||||
{
|
||||
eval(this_script.innerHTML);
|
||||
}
|
||||
|
||||
// Default values
|
||||
_editor_lang = window._editor_lang || 'en';
|
||||
|
||||
// Chop off any query string. Chop the filename off of the URL.
|
||||
_editor_url = window._editor_url || this_script.src.split('?')[0].split('/').slice(0, -1).join('/');
|
||||
|
||||
})()
|
||||
}
|
||||
_editor_url = _editor_url.replace(/\x2f*$/, '/');
|
||||
|
||||
Xinha.agt = navigator.userAgent.toLowerCase();
|
||||
Xinha.is_ie = ((Xinha.agt.indexOf("msie") != -1) && (Xinha.agt.indexOf("opera") == -1));
|
||||
Xinha.ie_version= parseFloat(Xinha.agt.substring(Xinha.agt.indexOf("msie")+5));
|
||||
Xinha.is_opera = (Xinha.agt.indexOf("opera") != -1);
|
||||
Xinha.is_khtml = (Xinha.agt.indexOf("khtml") != -1);
|
||||
Xinha.is_webkit = (Xinha.agt.indexOf("applewebkit") != -1);
|
||||
Xinha.is_safari = (Xinha.agt.indexOf("safari") != -1);
|
||||
Xinha.opera_version = navigator.appVersion.substring(0, navigator.appVersion.indexOf(" "))*1;
|
||||
Xinha.is_mac = (Xinha.agt.indexOf("mac") != -1);
|
||||
Xinha.is_mac_ie = (Xinha.is_ie && Xinha.is_mac);
|
||||
Xinha.is_win_ie = (Xinha.is_ie && !Xinha.is_mac);
|
||||
Xinha.is_gecko = (navigator.product == "Gecko" && !Xinha.is_safari); // Safari lies!
|
||||
Xinha.isRunLocally = document.URL.toLowerCase().search(/^file:/) != -1;
|
||||
Xinha.is_designMode = (typeof document.designMode != 'undefined' && !Xinha.is_ie); // IE has designMode, but we're not using it
|
||||
Xinha.isSupportedBrowser = Xinha.is_gecko || (Xinha.is_opera && Xinha.opera_version >= 9.1) || Xinha.ie_version >= 5.5 || Xinha.is_safari;
|
||||
|
||||
Xinha.loadPlugins = function(plugins, callbackIfNotReady)
|
||||
{
|
||||
if ( !Xinha.isSupportedBrowser ) return;
|
||||
|
||||
Xinha.loadStyle(typeof _editor_css == "string" ? _editor_css : "Xinha.css","XinhaCoreDesign");
|
||||
Xinha.createLoadingMessages(xinha_editors);
|
||||
var loadingMessages = Xinha.loadingMessages;
|
||||
Xinha._loadback(_editor_url + "XinhaCore.js",function () {
|
||||
Xinha.removeLoadingMessages(xinha_editors);
|
||||
Xinha.createLoadingMessages(xinha_editors);
|
||||
callbackIfNotReady()
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
Xinha._loadback = function(Url, Callback, Scope, Bonus)
|
||||
{
|
||||
var T = !Xinha.is_ie ? "onload" : 'onreadystatechange';
|
||||
var S = document.createElement("script");
|
||||
S.type = "text/javascript";
|
||||
S.src = Url;
|
||||
if ( Callback )
|
||||
{
|
||||
S[T] = function()
|
||||
{
|
||||
if ( Xinha.is_ie && ( ! ( /loaded|complete/.test(window.event.srcElement.readyState) ) ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Callback.call(Scope ? Scope : this, Bonus);
|
||||
S[T] = null;
|
||||
};
|
||||
}
|
||||
document.getElementsByTagName("head")[0].appendChild(S);
|
||||
};
|
||||
|
||||
Xinha.getElementTopLeft = function(element)
|
||||
{
|
||||
var curleft = 0;
|
||||
var curtop = 0;
|
||||
if (element.offsetParent)
|
||||
{
|
||||
curleft = element.offsetLeft
|
||||
curtop = element.offsetTop
|
||||
while (element = element.offsetParent)
|
||||
{
|
||||
curleft += element.offsetLeft
|
||||
curtop += element.offsetTop
|
||||
}
|
||||
}
|
||||
return { top:curtop, left:curleft };
|
||||
}
|
||||
|
||||
// find X position of an element
|
||||
Xinha.findPosX = function(obj)
|
||||
{
|
||||
var curleft = 0;
|
||||
if ( obj.offsetParent )
|
||||
{
|
||||
return Xinha.getElementTopLeft(obj).left;
|
||||
}
|
||||
else if ( obj.x )
|
||||
{
|
||||
curleft += obj.x;
|
||||
}
|
||||
return curleft;
|
||||
};
|
||||
|
||||
// find Y position of an element
|
||||
Xinha.findPosY = function(obj)
|
||||
{
|
||||
var curtop = 0;
|
||||
if ( obj.offsetParent )
|
||||
{
|
||||
return Xinha.getElementTopLeft(obj).top;
|
||||
}
|
||||
else if ( obj.y )
|
||||
{
|
||||
curtop += obj.y;
|
||||
}
|
||||
return curtop;
|
||||
};
|
||||
|
||||
Xinha.createLoadingMessages = function(xinha_editors)
|
||||
{
|
||||
if ( Xinha.loadingMessages || !Xinha.isSupportedBrowser )
|
||||
{
|
||||
return;
|
||||
}
|
||||
Xinha.loadingMessages = [];
|
||||
|
||||
for (var i=0;i<xinha_editors.length;i++)
|
||||
{
|
||||
if (!document.getElementById(xinha_editors[i]))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
Xinha.loadingMessages.push(Xinha.createLoadingMessage(document.getElementById(xinha_editors[i])));
|
||||
}
|
||||
}
|
||||
|
||||
Xinha.createLoadingMessage = function(textarea,text)
|
||||
{
|
||||
if ( document.getElementById("loading_" + textarea.id) || !Xinha.isSupportedBrowser)
|
||||
{
|
||||
return;
|
||||
}
|
||||
// Create and show the main loading message and the sub loading message for details of loading actions
|
||||
// global element
|
||||
var loading_message = document.createElement("div");
|
||||
loading_message.id = "loading_" + textarea.id;
|
||||
loading_message.className = "loading";
|
||||
|
||||
loading_message.style.left = (Xinha.findPosX(textarea) + textarea.offsetWidth / 2) - 106 + 'px';
|
||||
loading_message.style.top = (Xinha.findPosY(textarea) + textarea.offsetHeight / 2) - 50 + 'px';
|
||||
// main static message
|
||||
var loading_main = document.createElement("div");
|
||||
loading_main.className = "loading_main";
|
||||
loading_main.id = "loading_main_" + textarea.id;
|
||||
loading_main.appendChild(document.createTextNode(Xinha._lc("Loading in progress. Please wait!")));
|
||||
// sub dynamic message
|
||||
var loading_sub = document.createElement("div");
|
||||
loading_sub.className = "loading_sub";
|
||||
loading_sub.id = "loading_sub_" + textarea.id;
|
||||
text = text ? text : Xinha._lc("Loading Core");
|
||||
loading_sub.appendChild(document.createTextNode(text));
|
||||
loading_message.appendChild(loading_main);
|
||||
loading_message.appendChild(loading_sub);
|
||||
document.body.appendChild(loading_message);
|
||||
|
||||
return loading_sub;
|
||||
}
|
||||
|
||||
Xinha.loadStyle = function(style, id)
|
||||
{
|
||||
var url = _editor_url || '';
|
||||
|
||||
url += style;
|
||||
|
||||
var head = document.getElementsByTagName("head")[0];
|
||||
var link = document.createElement("link");
|
||||
link.rel = "stylesheet";
|
||||
link.href = url;
|
||||
if (id) link.id = id;
|
||||
head.appendChild(link);
|
||||
};
|
||||
Xinha._lc = function(string) {return string;}
|
||||
|
||||
Xinha._addEvent = function(el, evname, func)
|
||||
{
|
||||
if ( document.addEventListener )
|
||||
{
|
||||
el.addEventListener(evname, func, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
el.attachEvent("on" + evname, func);
|
||||
}
|
||||
}
|
||||
Xinha.addOnloadHandler = function (func)
|
||||
{
|
||||
// Dean Edwards/Matthias Miller/John Resig
|
||||
// http://dean.edwards.name/weblog/2006/06/again/
|
||||
// IE part from jQuery
|
||||
|
||||
|
||||
var init = function ()
|
||||
{
|
||||
// quit if this function has already been called
|
||||
if (arguments.callee.done) return;
|
||||
// flag this function so we don't do the same thing twice
|
||||
arguments.callee.done = true;
|
||||
// kill the timer
|
||||
if (Xinha.onloadTimer) clearInterval(Xinha.onloadTimer);
|
||||
|
||||
func.call();
|
||||
}
|
||||
if (Xinha.is_ie)
|
||||
{
|
||||
// ensure firing before onload,
|
||||
// maybe late but safe also for iframes
|
||||
document.attachEvent("onreadystatechange", function(){
|
||||
if ( document.readyState === "complete" ) {
|
||||
document.detachEvent( "onreadystatechange", arguments.callee );
|
||||
init();
|
||||
}
|
||||
});
|
||||
if ( document.documentElement.doScroll && typeof window.frameElement === "undefined" ) (function(){
|
||||
if (arguments.callee.done) return;
|
||||
try {
|
||||
// If IE is used, use the trick by Diego Perini
|
||||
// http://javascript.nwbox.com/IEContentLoaded/
|
||||
document.documentElement.doScroll("left");
|
||||
} catch( error ) {
|
||||
setTimeout( arguments.callee, 0 );
|
||||
return;
|
||||
}
|
||||
// and execute any waiting functions
|
||||
init();
|
||||
})();
|
||||
}
|
||||
else if (/WebKit/i.test(navigator.userAgent))
|
||||
{
|
||||
Xinha.onloadTimer = setInterval(function()
|
||||
{
|
||||
if (/loaded|complete/.test(document.readyState))
|
||||
{
|
||||
init(); // call the onload handler
|
||||
}
|
||||
}, 10);
|
||||
}
|
||||
else /* for Mozilla/Opera9 */
|
||||
{
|
||||
document.addEventListener("DOMContentLoaded", init, false);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,61 @@
|
|||
#!/usr/bin/python
|
||||
"""Runs a very basic file server so that we can test Xinha. By default, the
|
||||
server runs on port 8080, but you can pass the -p or --port option to change
|
||||
the port used."""
|
||||
|
||||
import os
|
||||
import SimpleHTTPServer
|
||||
import SocketServer
|
||||
|
||||
# File server for testing Xinha
|
||||
|
||||
def __main():
|
||||
"""Use the embed_url.py program from the command-line
|
||||
|
||||
The embed_url.py program downloads files and processes links in the case of
|
||||
HTML files. See embed_url.py -h for more info. This procedure has the
|
||||
sole purpose of reading in and verifying the command-line arguments before
|
||||
passing them to the embed_url funtion."""
|
||||
|
||||
from getopt import getopt, GetoptError
|
||||
from sys import argv, exit, stderr
|
||||
|
||||
try:
|
||||
options, arguments = getopt(argv[1:], "p:", ["port="])
|
||||
except GetoptError:
|
||||
print "Invalid option"
|
||||
__usage()
|
||||
exit(2)
|
||||
|
||||
PORT = 8080
|
||||
for option, value in options:
|
||||
if option in ("-p", "--port"):
|
||||
try:
|
||||
PORT = int(value)
|
||||
except ValueError:
|
||||
print "'%s' is not a valid port number" % value
|
||||
__usage()
|
||||
exit(2)
|
||||
|
||||
# SimpleHTTPRequestHandler serves data from the current directory, so if we
|
||||
# are running from inside contrib, we have to change our current working
|
||||
# directory
|
||||
if os.path.split(os.getcwd())[1] == 'contrib':
|
||||
os.chdir('..')
|
||||
|
||||
Handler = SimpleHTTPServer.SimpleHTTPRequestHandler
|
||||
|
||||
httpd = SocketServer.TCPServer(("", PORT), Handler)
|
||||
|
||||
print "Serving at port %s" % PORT
|
||||
print "Try viewing the example at http://localhost:%s/examples/Newbie.html" % PORT
|
||||
httpd.serve_forever()
|
||||
|
||||
def __usage():
|
||||
"""
|
||||
Print the usage information contained in the module docstring
|
||||
"""
|
||||
print __doc__
|
||||
|
||||
if __name__ == '__main__':
|
||||
__main()
|
||||
|
|
@ -1,2 +1,134 @@
|
|||
/* This compressed file is part of Xinha. For uncompressed sources, forum, and bug reports, go to xinha.org */
|
||||
xinha_editors=null;xinha_init=null;xinha_config=null;xinha_plugins=null;xinha_init=xinha_init?xinha_init:function(){xinha_editors=xinha_editors?xinha_editors:["myTextArea","anotherOne"];xinha_plugins=xinha_plugins?xinha_plugins:["CharacterMap","ContextMenu","SmartReplace","Stylist","ExtendedFileManager","Linker","SuperClean","TableOperations"];if(!Xinha.loadPlugins(xinha_plugins,xinha_init)){return}xinha_config=xinha_config?xinha_config():new Xinha.Config();xinha_config.toolbar=[["popupeditor"],["separator","formatblock","fontname","fontsize","bold","italic","underline","strikethrough"],["separator","forecolor","hilitecolor","textindicator"],["separator","subscript","superscript"],["linebreak","separator","justifyleft","justifycenter","justifyright","justifyfull"],["separator","insertorderedlist","insertunorderedlist","outdent","indent"],["separator","inserthorizontalrule","createlink","insertimage","inserttable"],["linebreak","separator","undo","redo","selectall","print"],(Xinha.is_gecko?[]:["cut","copy","paste","overwrite","saveas"]),["separator","killword","clearfonts","removeformat","toggleborders","splitblock","lefttoright","righttoleft"],["separator","htmlmode","showhelp","about"]];xinha_config.pageStyleSheets=[_editor_url+"examples/files/full_example.css"];xinha_config.stylistLoadStylesheet(_editor_url+"examples/files/stylist.css");xinha_editors=Xinha.makeEditors(xinha_editors,xinha_config,xinha_plugins);Xinha.startEditors(xinha_editors)};Xinha.addOnloadHandler(xinha_init);
|
||||
xinha_editors = null;
|
||||
xinha_init = null;
|
||||
xinha_config = null;
|
||||
xinha_plugins = null;
|
||||
|
||||
// This contains the names of textareas we will make into Xinha editors
|
||||
xinha_init = xinha_init ? xinha_init : function()
|
||||
{
|
||||
/** STEP 1 ***************************************************************
|
||||
* First, specify the textareas that shall be turned into Xinhas.
|
||||
* For each one add the respective id to the xinha_editors array.
|
||||
* I you want add more than on textarea, keep in mind that these
|
||||
* values are comma seperated BUT there is no comma after the last value.
|
||||
* If you are going to use this configuration on several pages with different
|
||||
* textarea ids, you can add them all. The ones that are not found on the
|
||||
* current page will just be skipped.
|
||||
************************************************************************/
|
||||
|
||||
xinha_editors = xinha_editors ? xinha_editors :
|
||||
[
|
||||
'myTextArea', 'anotherOne'
|
||||
];
|
||||
|
||||
/** STEP 2 ***************************************************************
|
||||
* Now, what are the plugins you will be using in the editors on this
|
||||
* page. List all the plugins you will need, even if not all the editors
|
||||
* will use all the plugins.
|
||||
*
|
||||
* The list of plugins below is a good starting point, but if you prefer
|
||||
* a simpler editor to start with then you can use the following
|
||||
*
|
||||
* xinha_plugins = xinha_plugins ? xinha_plugins : [ ];
|
||||
*
|
||||
* which will load no extra plugins at all.
|
||||
************************************************************************/
|
||||
|
||||
xinha_plugins = xinha_plugins ? xinha_plugins :
|
||||
[
|
||||
'CharacterMap',
|
||||
'ContextMenu',
|
||||
'SmartReplace',
|
||||
'Stylist',
|
||||
'ExtendedFileManager',
|
||||
'Linker',
|
||||
'SuperClean',
|
||||
'TableOperations'
|
||||
];
|
||||
|
||||
// THIS BIT OF JAVASCRIPT LOADS THE PLUGINS, NO TOUCHING :)
|
||||
if(!Xinha.loadPlugins(xinha_plugins, xinha_init)) return;
|
||||
|
||||
|
||||
/** STEP 3 ***************************************************************
|
||||
* We create a default configuration to be used by all the editors.
|
||||
* If you wish to configure some of the editors differently this will be
|
||||
* done in step 5.
|
||||
*
|
||||
* If you want to modify the default config you might do something like this.
|
||||
*
|
||||
* xinha_config = new Xinha.Config();
|
||||
* xinha_config.width = '640px';
|
||||
* xinha_config.height = '420px';
|
||||
*
|
||||
*
|
||||
* For a list of the available configuration options, see:
|
||||
* http://trac.xinha.org/wiki/Documentation/ConfigVariablesList
|
||||
*
|
||||
*************************************************************************/
|
||||
|
||||
xinha_config = xinha_config ? xinha_config() : new Xinha.Config();
|
||||
|
||||
//this is the standard toolbar, feel free to remove buttons as you like
|
||||
xinha_config.toolbar =
|
||||
[
|
||||
["popupeditor"],
|
||||
["separator","formatblock","fontname","fontsize","bold","italic","underline","strikethrough"],
|
||||
["separator","forecolor","hilitecolor","textindicator"],
|
||||
["separator","subscript","superscript"],
|
||||
["linebreak","separator","justifyleft","justifycenter","justifyright","justifyfull"],
|
||||
["separator","insertorderedlist","insertunorderedlist","outdent","indent"],
|
||||
["separator","inserthorizontalrule","createlink","insertimage","inserttable"],
|
||||
["linebreak","separator","undo","redo","selectall","print"], (Xinha.is_gecko ? [] : ["cut","copy","paste","overwrite","saveas"]),
|
||||
["separator","killword","clearfonts","removeformat","toggleborders","splitblock","lefttoright", "righttoleft"],
|
||||
["separator","htmlmode","showhelp","about"]
|
||||
];
|
||||
|
||||
// To adjust the styling inside the editor, we can load an external stylesheet like this
|
||||
// NOTE : YOU MUST GIVE AN ABSOLUTE URL
|
||||
xinha_config.pageStyleSheets = [ _editor_url + "examples/files/full_example.css" ];
|
||||
//if you're using Stylist, import a stylesheet like this
|
||||
xinha_config.stylistLoadStylesheet(_editor_url + "examples/files/stylist.css");
|
||||
|
||||
|
||||
/** STEP 4 ***************************************************************
|
||||
* We first create editors for the textareas.
|
||||
*
|
||||
* You can do this in two ways, either
|
||||
*
|
||||
* xinha_editors = Xinha.makeEditors(xinha_editors, xinha_config, xinha_plugins);
|
||||
*
|
||||
* if you want all the editor objects to use the same set of plugins, OR;
|
||||
*
|
||||
* xinha_editors = Xinha.makeEditors(xinha_editors, xinha_config);
|
||||
* xinha_editors.myTextArea.registerPlugins(['Stylist']);
|
||||
* xinha_editors.anotherOne.registerPlugins(['CSS','SuperClean']);
|
||||
*
|
||||
* if you want to use a different set of plugins for one or more of the
|
||||
* editors.
|
||||
************************************************************************/
|
||||
|
||||
xinha_editors = Xinha.makeEditors(xinha_editors, xinha_config, xinha_plugins);
|
||||
|
||||
/** STEP 5 ***************************************************************
|
||||
* If you want to change the configuration variables of any of the
|
||||
* editors, this is the place to do that, for example you might want to
|
||||
* change the width and height of one of the editors, like this...
|
||||
*
|
||||
* xinha_editors.myTextArea.config.width = '640px';
|
||||
* xinha_editors.myTextArea.config.height = '480px';
|
||||
*
|
||||
************************************************************************/
|
||||
|
||||
|
||||
/** STEP 6 ***************************************************************
|
||||
* Finally we "start" the editors, this turns the textareas into
|
||||
* Xinha editors.
|
||||
************************************************************************/
|
||||
|
||||
Xinha.startEditors(xinha_editors);
|
||||
}
|
||||
|
||||
Xinha.addOnloadHandler(xinha_init); // this executes the xinha_init function on page load
|
||||
// and does not interfere with window.onload properties set by other scripts
|
||||
|
||||
|
|
|
|||
|
|
@ -1,2 +1,156 @@
|
|||
/* This compressed file is part of Xinha. For uncompressed sources, forum, and bug reports, go to xinha.org */
|
||||
(function(){Xinha.plugins.AboutBox=a;function a(b){this.editor=b}a._pluginInfo={name:"AboutBox",developer:"The Xinha Core Developer Team"};a.prototype._lc=function(b){return Xinha._lc(b,"AboutBox")};a.prototype._prepareDialog=function(){var c=this;var b=this.editor;Xinha.loadStyle("about.css","AboutBox","aboutCSS");this.dialog=new Xinha.Dialog(b,a.html,"Xinha",{width:600});this.dialog.getElementById("close").onclick=function(){c.dialog.hide()};this.dialog.getElementById("xinha_logo").src=_editor_url+"images/xinha_logo.gif";var d=this.dialog.getElementsByClassName("tab");this.currentTab=d[0];d.forEach(function(e){e.onclick=function(){if(c.currentTab){Xinha._removeClass(c.currentTab,"tab-current");c.dialog.getElementById(c.currentTab.rel).style.display="none"}Xinha._addClass(e,"tab-current");e.blur();c.currentTab=e;c.dialog.getElementById(e.rel).style.display="block"}});this.fillPlugins();this.fillVersion();this.dialog.onresize=function(){this.getElementById("content").style.height=parseInt(this.height,10)-this.getElementById("h1").offsetHeight-this.getElementById("buttons").offsetHeight-100+"px"}};a.prototype.fillPlugins=function(){var k=this.editor;var d=this.dialog.getElementById("plugins_table");var g,l,b;var c=0;for(var f in k.plugins){var h=k.plugins[f];g=document.createElement("tr");if(c%2){g.style.backgroundColor="#e5e5e5"}d.appendChild(g);l=document.createElement("td");l.innerHTML=h.name;if(h.version){l.innerHTML+=" v"+h.version}g.appendChild(l);l=document.createElement("td");if(h.developer){if(h.developer_url){l.innerHTML='<a target="_blank" href="'+h.developer_url+'">'+h.developer+"</a>"}else{l.innerHTML=h.developer}}g.appendChild(l);l=document.createElement("td");if(h.sponsor){if(h.sponsor_url){l.innerHTML='<a target="_blank" href="'+h.sponsor_url+'">'+h.sponsor+"</a>"}else{l.innerHTML=h.sponsor}}g.appendChild(l);l=document.createElement("td");if(h.license){l.innerHTML=h.license}else{l.innerHTML="htmlArea"}g.appendChild(l);c++}};a.prototype.fillVersion=function(){var b=Xinha.version;this.dialog.getElementById("version").innerHTML="<pre>\nRelease: "+b.Release+" ("+b.Date+")\nHead: "+b.Head+"\nRevision: "+b.Revision+"\nLast Changed By: "+b.RevisionBy+"\n</pre>"};a.prototype.show=function(){var b=this;if(!a.html){if(a.loading){return}a.loading=true;Xinha._getback(Xinha.getPluginDir("AboutBox")+"/dialog.html",function(d){a.html=d;b.show()});return}if(!this.dialog){this._prepareDialog()}var c={inputArea:""};this.dialog.show(c)}})();
|
||||
// Paste Plain Text plugin for Xinha
|
||||
|
||||
// Distributed under the same terms as Xinha itself.
|
||||
// This notice MUST stay intact for use (see license.txt).
|
||||
(function(){
|
||||
Xinha.plugins.AboutBox = AboutBox;
|
||||
function AboutBox(editor) {
|
||||
this.editor = editor;
|
||||
}
|
||||
|
||||
AboutBox._pluginInfo = {
|
||||
name : "AboutBox",
|
||||
developer : "The Xinha Core Developer Team"
|
||||
};
|
||||
|
||||
AboutBox.prototype._lc = function(string) {
|
||||
return Xinha._lc(string, 'AboutBox');
|
||||
};
|
||||
|
||||
|
||||
AboutBox.prototype._prepareDialog = function()
|
||||
{
|
||||
var self = this;
|
||||
var editor = this.editor;
|
||||
|
||||
Xinha.loadStyle ('about.css', 'AboutBox', 'aboutCSS');
|
||||
/// Now we have everything we need, so we can build the dialog.
|
||||
this.dialog = new Xinha.Dialog(editor, AboutBox.html, 'Xinha',{width:600})
|
||||
|
||||
this.dialog.getElementById('close').onclick = function() { self.dialog.hide()};
|
||||
this.dialog.getElementById('xinha_logo').src = _editor_url + 'images/xinha_logo.gif';
|
||||
|
||||
var tabs = this.dialog.getElementsByClassName('tab');
|
||||
this.currentTab = tabs[0];
|
||||
tabs.forEach(function(tab){
|
||||
//alert (tab);
|
||||
tab.onclick = function() {
|
||||
if (self.currentTab)
|
||||
{
|
||||
Xinha._removeClass(self.currentTab,'tab-current');
|
||||
self.dialog.getElementById(self.currentTab.rel).style.display = 'none';
|
||||
}
|
||||
Xinha._addClass(tab, 'tab-current');
|
||||
tab.blur();
|
||||
self.currentTab = tab;
|
||||
self.dialog.getElementById(tab.rel).style.display = 'block';
|
||||
}
|
||||
})
|
||||
this.fillPlugins();
|
||||
this.fillVersion();
|
||||
this.dialog.onresize = function ()
|
||||
{
|
||||
this.getElementById("content").style.height =
|
||||
parseInt(this.height,10) // the actual height of the dialog
|
||||
- this.getElementById('h1').offsetHeight // the title bar
|
||||
- this.getElementById('buttons').offsetHeight // the buttons
|
||||
- 100 // we have a padding at the bottom, gotta take this into acount
|
||||
+ 'px'; // don't forget this ;)
|
||||
|
||||
//this.getElementById("content").style.width =(this.width - 2) + 'px'; // and the width
|
||||
}
|
||||
};
|
||||
AboutBox.prototype.fillPlugins = function()
|
||||
{
|
||||
var e = this.editor;
|
||||
var tbody = this.dialog.getElementById('plugins_table');
|
||||
var tr,td,a;
|
||||
var j = 0;
|
||||
for (var i in e.plugins)
|
||||
{
|
||||
var info = e.plugins[i];
|
||||
tr = document.createElement('tr');
|
||||
if (j%2) tr.style.backgroundColor = '#e5e5e5';
|
||||
tbody.appendChild(tr);
|
||||
td = document.createElement('td');
|
||||
td.innerHTML = info.name;
|
||||
if (info.version) td.innerHTML += ' v'+info.version;
|
||||
tr.appendChild(td);
|
||||
|
||||
td = document.createElement('td');
|
||||
if (info.developer)
|
||||
{
|
||||
if (info.developer_url)
|
||||
{
|
||||
td.innerHTML = '<a target="_blank" href="'+info.developer_url+'">'+info.developer+'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
td.innerHTML = info.developer
|
||||
}
|
||||
}
|
||||
tr.appendChild(td);
|
||||
|
||||
td = document.createElement('td');
|
||||
if (info.sponsor)
|
||||
{
|
||||
if (info.sponsor_url)
|
||||
{
|
||||
td.innerHTML = '<a target="_blank" href="'+info.sponsor_url+'">'+info.sponsor+'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
td.innerHTML = info.sponsor
|
||||
}
|
||||
}
|
||||
tr.appendChild(td);
|
||||
|
||||
td = document.createElement('td');
|
||||
if (info.license)
|
||||
{
|
||||
td.innerHTML = info.license;
|
||||
}
|
||||
else
|
||||
{
|
||||
td.innerHTML = 'htmlArea';
|
||||
}
|
||||
tr.appendChild(td);
|
||||
j++;
|
||||
}
|
||||
}
|
||||
AboutBox.prototype.fillVersion = function()
|
||||
{
|
||||
var ver = Xinha.version;
|
||||
this.dialog.getElementById('version').innerHTML = '<pre>'
|
||||
+ '\nRelease: ' + ver.Release + ' (' + ver.Date + ')'
|
||||
+ '\nHead: ' + ver.Head
|
||||
+ '\nRevision: ' + ver.Revision
|
||||
+ '\nLast Changed By: ' + ver.RevisionBy
|
||||
+ '\n' +
|
||||
'</pre>';
|
||||
}
|
||||
AboutBox.prototype.show = function()
|
||||
{
|
||||
var self = this;
|
||||
if (!AboutBox.html)
|
||||
{
|
||||
if (AboutBox.loading) return;
|
||||
AboutBox.loading = true;
|
||||
Xinha._getback(Xinha.getPluginDir("AboutBox") + '/dialog.html', function(getback) { AboutBox.html = getback; self.show()});
|
||||
return;
|
||||
}
|
||||
if (!this.dialog) this._prepareDialog();
|
||||
|
||||
// here we can pass values to the dialog
|
||||
// each property pair consists of the "name" of the input we want to populate, and the value to be set
|
||||
var inputs =
|
||||
{
|
||||
inputArea : '' // we want the textarea always to be empty on showing
|
||||
}
|
||||
// now calling the show method of the Xinha.Dialog object to set the values and show the actual dialog
|
||||
this.dialog.show(inputs);
|
||||
|
||||
// Init the sizes (only if we have set up the custom resize function)
|
||||
//this.dialog.onresize();
|
||||
};
|
||||
})()
|
||||
|
|
|
|||
|
|
@ -1,150 +0,0 @@
|
|||
<html>
|
||||
|
||||
<head>
|
||||
<title>Insert/Modify Link</title>
|
||||
<script type="text/javascript" src="../../popups/popup.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="../../popups/popup.css" />
|
||||
|
||||
<script type="text/javascript">
|
||||
window.resizeTo(400, 200);
|
||||
|
||||
Xinha = window.opener.Xinha;
|
||||
|
||||
function i18n(str) {
|
||||
return (Xinha._lc(str, 'Xinha'));
|
||||
}
|
||||
|
||||
function onTargetChanged() {
|
||||
var f = document.getElementById("f_other_target");
|
||||
if (this.value == "_other") {
|
||||
f.style.visibility = "visible";
|
||||
f.select();
|
||||
f.focus();
|
||||
} else f.style.visibility = "hidden";
|
||||
}
|
||||
|
||||
function Init() {
|
||||
__dlg_translate('Xinha');
|
||||
__dlg_init();
|
||||
|
||||
// Make sure the translated string appears in the drop down. (for gecko)
|
||||
document.getElementById("f_target").selectedIndex = 1;
|
||||
document.getElementById("f_target").selectedIndex = 0;
|
||||
|
||||
var param = window.dialogArguments;
|
||||
var target_select = document.getElementById("f_target");
|
||||
var use_target = true;
|
||||
if (param) {
|
||||
if ( typeof param["f_usetarget"] != "undefined" ) {
|
||||
use_target = param["f_usetarget"];
|
||||
}
|
||||
if ( typeof param["f_href"] != "undefined" ) {
|
||||
document.getElementById("f_href").value = param["f_href"];
|
||||
document.getElementById("f_title").value = param["f_title"];
|
||||
comboSelectValue(target_select, param["f_target"]);
|
||||
if (target_select.value != param.f_target) {
|
||||
var opt = document.createElement("option");
|
||||
opt.value = param.f_target;
|
||||
opt.innerHTML = opt.value;
|
||||
target_select.appendChild(opt);
|
||||
opt.selected = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (! use_target) {
|
||||
document.getElementById("f_target_label").style.visibility = "hidden";
|
||||
document.getElementById("f_target").style.visibility = "hidden";
|
||||
document.getElementById("f_other_target").style.visibility = "hidden";
|
||||
}
|
||||
var opt = document.createElement("option");
|
||||
opt.value = "_other";
|
||||
opt.innerHTML = i18n("Other");
|
||||
target_select.appendChild(opt);
|
||||
target_select.onchange = onTargetChanged;
|
||||
document.getElementById("f_href").focus();
|
||||
document.getElementById("f_href").select();
|
||||
}
|
||||
|
||||
function onOK() {
|
||||
var required = {
|
||||
// f_href shouldn't be required or otherwise removing the link by entering an empty
|
||||
// url isn't possible anymore.
|
||||
// "f_href": i18n("You must enter the URL where this link points to")
|
||||
};
|
||||
for (var i in required) {
|
||||
var el = document.getElementById(i);
|
||||
if (!el.value) {
|
||||
alert(required[i]);
|
||||
el.focus();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// pass data back to the calling window
|
||||
var fields = ["f_href", "f_title", "f_target" ];
|
||||
var param = new Object();
|
||||
for (var i in fields) {
|
||||
var id = fields[i];
|
||||
var el = document.getElementById(id);
|
||||
param[id] = el.value;
|
||||
}
|
||||
if (param.f_target == "_other")
|
||||
param.f_target = document.getElementById("f_other_target").value;
|
||||
__dlg_close(param);
|
||||
return false;
|
||||
}
|
||||
|
||||
function onCancel() {
|
||||
__dlg_close(null);
|
||||
return false;
|
||||
}
|
||||
|
||||
function onBrowse(){
|
||||
baseURL = opener.location.pathname;
|
||||
offset = baseURL.lastIndexOf("/");
|
||||
destURL = baseURL.slice(0, offset+1) + "search.jsp?useURL=true&widget=getElementById('f_href')";
|
||||
aWindow = window.open(destURL,
|
||||
"search",
|
||||
"toolbar=no,width=800,height=600,status=no,scrollbars=yes,resize=yes,menubar=no");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
</head>
|
||||
|
||||
<body class="dialog" onload="Init()">
|
||||
<div class="title">Insert/Modify Link</div>
|
||||
<form>
|
||||
<table border="0" style="width: 100%;">
|
||||
<tr>
|
||||
<td class="label">URL:</td>
|
||||
<td><input type="text" id="f_href" style="width: 100%" />
|
||||
<button name="browse" onclick="return onBrowse();"
|
||||
title="Browse for a content item">Browse</button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">Title (tooltip):</td>
|
||||
<td><input type="text" id="f_title" style="width: 100%" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label"><span id="f_target_label">Target:</span></td>
|
||||
<td><select id="f_target">
|
||||
<option value="">None (use implicit)</option>
|
||||
<option value="_blank">New window (_blank)</option>
|
||||
<option value="_self">Same frame (_self)</option>
|
||||
<option value="_top">Top frame (_top)</option>
|
||||
</select>
|
||||
<input type="text" name="f_other_target" id="f_other_target" size="10" style="visibility: hidden" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<div id="buttons">
|
||||
<button type="submit" name="ok" onclick="return onOK();">OK</button>
|
||||
<button type="button" name="cancel" onclick="return onCancel();">Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1,87 +0,0 @@
|
|||
/* This compressed file is part of Xinha. For uncompressed sources, forum, and bug reports, go to xinha.org */
|
||||
/* This file is part of version 0.95 released Mon, 12 May 2008 17:33:15 +0200 */
|
||||
/* The URL of the most recent version of this file is http://svn.xinha.webfactional.com/trunk/modules/CreateLink/link.js */
|
||||
CreateLink._pluginInfo={name:"CreateLink",origin:"Xinha Core",version:"$LastChangedRevision:990 $".replace(/^[^:]*:\s*(.*)\s*\$$/,"$1"),developer:"The Xinha Core Developer Team",developer_url:"$HeadURL:http://svn.xinha.webfactional.com/trunk/modules/CreateLink/link.js $".replace(/^[^:]*:\s*(.*)\s*\$$/,"$1"),sponsor:"",sponsor_url:"",license:"htmlArea"};
|
||||
function CreateLink(_1){
|
||||
}
|
||||
Xinha.prototype._createLink=function(_2){
|
||||
var _3=this;
|
||||
var _4=null;
|
||||
if(typeof _2=="undefined"){
|
||||
_2=this.getParentElement();
|
||||
if(_2){
|
||||
while(_2&&!/^a$/i.test(_2.tagName)){
|
||||
_2=_2.parentNode;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!_2){
|
||||
var _5=_3.getSelection();
|
||||
var _6=_3.createRange(_5);
|
||||
var _7=0;
|
||||
if(Xinha.is_ie){
|
||||
if(_5.type=="Control"){
|
||||
_7=_6.length;
|
||||
}else{
|
||||
_7=_6.compareEndPoints("StartToEnd",_6);
|
||||
}
|
||||
}else{
|
||||
_7=_6.compareBoundaryPoints(_6.START_TO_END,_6);
|
||||
}
|
||||
if(_7===0){
|
||||
alert(Xinha._lc("You need to select some text before creating a link"));
|
||||
return;
|
||||
}
|
||||
_4={f_href:"",f_title:"",f_target:"",f_usetarget:_3.config.makeLinkShowsTarget};
|
||||
}else{
|
||||
_4={f_href:Xinha.is_ie?_3.stripBaseURL(_2.href):_2.getAttribute("href"),f_title:_2.title,f_target:_2.target,f_usetarget:_3.config.makeLinkShowsTarget};
|
||||
}
|
||||
Dialog(_3.config.URIs.link,function(_8){
|
||||
if(!_8){
|
||||
return false;
|
||||
}
|
||||
var a=_2;
|
||||
if(!a){
|
||||
try{
|
||||
var _a=Xinha.uniq("http://www.example.com/Link");
|
||||
_3._doc.execCommand("createlink",false,_a);
|
||||
var _b=_3._doc.getElementsByTagName("a");
|
||||
for(var i=0;i<_b.length;i++){
|
||||
var _d=_b[i];
|
||||
if(_d.href==_a){
|
||||
if(!a){
|
||||
a=_d;
|
||||
}
|
||||
_d.href=_8.f_href;
|
||||
if(_8.f_target){
|
||||
_d.target=_8.f_target;
|
||||
}
|
||||
if(_8.f_title){
|
||||
_d.title=_8.f_title;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(ex){
|
||||
}
|
||||
}else{
|
||||
var _e=_8.f_href.trim();
|
||||
_3.selectNodeContents(a);
|
||||
if(_e===""){
|
||||
_3._doc.execCommand("unlink",false,null);
|
||||
_3.updateToolbar();
|
||||
return false;
|
||||
}else{
|
||||
a.href=_e;
|
||||
}
|
||||
}
|
||||
if(!(a&&a.tagName.toLowerCase()=="a")){
|
||||
return false;
|
||||
}
|
||||
a.target=_8.f_target.trim();
|
||||
a.title=_8.f_title.trim();
|
||||
_3.selectNodeContents(a);
|
||||
_3.updateToolbar();
|
||||
},_4);
|
||||
};
|
||||
|
||||
|
|
@ -1,136 +0,0 @@
|
|||
<html>
|
||||
|
||||
<head>
|
||||
<title>Insert/Modify Link</title>
|
||||
<script type="text/javascript" src="../../popups/popup.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="../../popups/popup.css" />
|
||||
|
||||
<script type="text/javascript">
|
||||
window.resizeTo(400, 200);
|
||||
|
||||
Xinha = window.opener.Xinha;
|
||||
|
||||
function i18n(str) {
|
||||
return (Xinha._lc(str, 'Xinha'));
|
||||
}
|
||||
|
||||
function onTargetChanged() {
|
||||
var f = document.getElementById("f_other_target");
|
||||
if (this.value == "_other") {
|
||||
f.style.visibility = "visible";
|
||||
f.select();
|
||||
f.focus();
|
||||
} else f.style.visibility = "hidden";
|
||||
}
|
||||
|
||||
function Init() {
|
||||
__dlg_translate('Xinha');
|
||||
__dlg_init();
|
||||
|
||||
// Make sure the translated string appears in the drop down. (for gecko)
|
||||
document.getElementById("f_target").selectedIndex = 1;
|
||||
document.getElementById("f_target").selectedIndex = 0;
|
||||
|
||||
var param = window.dialogArguments;
|
||||
var target_select = document.getElementById("f_target");
|
||||
var use_target = true;
|
||||
if (param) {
|
||||
if ( typeof param["f_usetarget"] != "undefined" ) {
|
||||
use_target = param["f_usetarget"];
|
||||
}
|
||||
if ( typeof param["f_href"] != "undefined" ) {
|
||||
document.getElementById("f_href").value = param["f_href"];
|
||||
document.getElementById("f_title").value = param["f_title"];
|
||||
comboSelectValue(target_select, param["f_target"]);
|
||||
if (target_select.value != param.f_target) {
|
||||
var opt = document.createElement("option");
|
||||
opt.value = param.f_target;
|
||||
opt.innerHTML = opt.value;
|
||||
target_select.appendChild(opt);
|
||||
opt.selected = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (! use_target) {
|
||||
document.getElementById("f_target_label").style.visibility = "hidden";
|
||||
document.getElementById("f_target").style.visibility = "hidden";
|
||||
document.getElementById("f_other_target").style.visibility = "hidden";
|
||||
}
|
||||
var opt = document.createElement("option");
|
||||
opt.value = "_other";
|
||||
opt.innerHTML = i18n("Other");
|
||||
target_select.appendChild(opt);
|
||||
target_select.onchange = onTargetChanged;
|
||||
document.getElementById("f_href").focus();
|
||||
document.getElementById("f_href").select();
|
||||
}
|
||||
|
||||
function onOK() {
|
||||
var required = {
|
||||
// f_href shouldn't be required or otherwise removing the link by entering an empty
|
||||
// url isn't possible anymore.
|
||||
// "f_href": i18n("You must enter the URL where this link points to")
|
||||
};
|
||||
for (var i in required) {
|
||||
var el = document.getElementById(i);
|
||||
if (!el.value) {
|
||||
alert(required[i]);
|
||||
el.focus();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// pass data back to the calling window
|
||||
var fields = ["f_href", "f_title", "f_target" ];
|
||||
var param = new Object();
|
||||
for (var i in fields) {
|
||||
var id = fields[i];
|
||||
var el = document.getElementById(id);
|
||||
param[id] = el.value;
|
||||
}
|
||||
if (param.f_target == "_other")
|
||||
param.f_target = document.getElementById("f_other_target").value;
|
||||
__dlg_close(param);
|
||||
return false;
|
||||
}
|
||||
|
||||
function onCancel() {
|
||||
__dlg_close(null);
|
||||
return false;
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
</head>
|
||||
|
||||
<body class="dialog" onload="Init()">
|
||||
<div class="title">Insert/Modify Link</div>
|
||||
<form>
|
||||
<table border="0" style="width: 100%;">
|
||||
<tr>
|
||||
<td class="label">URL:</td>
|
||||
<td><input type="text" id="f_href" style="width: 100%" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">Title (tooltip):</td>
|
||||
<td><input type="text" id="f_title" style="width: 100%" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label"><span id="f_target_label">Target:</span></td>
|
||||
<td><select id="f_target">
|
||||
<option value="">None (use implicit)</option>
|
||||
<option value="_blank">New window (_blank)</option>
|
||||
<option value="_self">Same frame (_self)</option>
|
||||
<option value="_top">Top frame (_top)</option>
|
||||
</select>
|
||||
<input type="text" name="f_other_target" id="f_other_target" size="10" style="visibility: hidden" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<div id="buttons">
|
||||
<button type="submit" name="ok" onclick="return onOK();">OK</button>
|
||||
<button type="button" name="cancel" onclick="return onCancel();">Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
/* This compressed file is part of Xinha. For uncompressed sources, forum, and bug reports, go to xinha.org */
|
||||
function CreateLink(c){this.editor=c;var a=c.config;var b=this;c.config.btnList.createlink[3]=function(){b.show(b._getSelectedAnchor())}}CreateLink._pluginInfo={name:"CreateLink",origin:"Xinha Core",version:"$LastChangedRevision: 1084 $".replace(/^[^:]*:\s*(.*)\s*\$$/,"$1"),developer:"The Xinha Core Developer Team",developer_url:"$HeadURL: http://svn.xinha.org/trunk/modules/CreateLink/link.js $".replace(/^[^:]*:\s*(.*)\s*\$$/,"$1"),sponsor:"",sponsor_url:"",license:"htmlArea"};CreateLink.prototype._lc=function(a){return Xinha._lc(a,"Xinha")};CreateLink.prototype.onGenerateOnce=function(){CreateLink.loadAssets()};CreateLink.loadAssets=function(){var self=CreateLink;if(self.loading){return}self.loading=true;Xinha._getback(_editor_url+"modules/CreateLink/dialog.html",function(getback){self.html=getback;self.dialogReady=true});Xinha._getback(_editor_url+"modules/CreateLink/pluginMethods.js",function(getback){eval(getback);self.methodsReady=true})};CreateLink.prototype.onUpdateToolbar=function(){if(!(CreateLink.dialogReady&&CreateLink.methodsReady)){this.editor._toolbarObjects.createlink.state("enabled",false)}else{this.onUpdateToolbar=null}};CreateLink.prototype.prepareDialog=function(){var b=this;var a=this.editor;var c=this.dialog=new Xinha.Dialog(a,CreateLink.html,"Xinha",{width:400});c.getElementById("ok").onclick=function(){b.apply()};c.getElementById("cancel").onclick=function(){b.dialog.hide()};if(!a.config.makeLinkShowsTarget){c.getElementById("f_target_label").style.visibility="hidden";c.getElementById("f_target").style.visibility="hidden";c.getElementById("f_other_target").style.visibility="hidden"}c.getElementById("f_target").onchange=function(){var d=c.getElementById("f_other_target");if(this.value=="_other"){d.style.visibility="visible";d.select();d.focus()}else{d.style.visibility="hidden"}};this.dialogReady=true};
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
/* This compressed file is part of Xinha. For uncompressed sources, forum, and bug reports, go to xinha.org */
|
||||
CreateLink.prototype.show=function(b){if(!this.dialog){this.prepareDialog()}var c=this.editor;this.a=b;if(!b&&this.editor.selectionEmpty(this.editor.getSelection())){alert(this._lc("You need to select some text before creating a link"));return false}var d={f_href:"",f_title:"",f_target:"",f_other_target:""};if(b&&b.tagName.toLowerCase()=="a"){d.f_href=this.editor.fixRelativeLinks(b.getAttribute("href"));d.f_title=b.title;if(b.target){if(!/_self|_top|_blank/.test(b.target)){d.f_target="_other";d.f_other_target=b.target}else{d.f_target=b.target;d.f_other_target=""}}}this.dialog.show(d)};CreateLink.prototype.apply=function(){var m=this.dialog.hide();var k=this.a;var c=this.editor;var l={href:"",target:"",title:""};if(m.f_href){l.href=m.f_href;l.title=m.f_title;if(m.f_target.value){if(m.f_target.value=="other"){l.target=m.f_other_target}else{l.target=m.f_target.value}}}if(m.f_target.value){if(m.f_target.value!="_other"){l.target=m.f_target.value}else{l.target=m.f_other_target}}if(k&&k.tagName.toLowerCase()=="a"){if(!l.href){if(confirm(this._lc("Are you sure you wish to remove this link?"))){var b=k.parentNode;while(k.hasChildNodes()){b.insertBefore(k.removeChild(k.childNodes[0]),k)}b.removeChild(k);c.updateToolbar();return}}else{for(var g in l){k.setAttribute(g,l[g])}if(Xinha.is_ie){if(/mailto:([^?<>]*)(\?[^<]*)?$/i.test(k.innerHTML)){k.innerHTML=RegExp.$1}}}}else{if(!l.href){return true}var f=Xinha.uniq("http://www.example.com/Link");c._doc.execCommand("createlink",false,f);var h=c._doc.getElementsByTagName("a");for(var g=0;g<h.length;g++){var d=h[g];if(d.href==f){if(!k){k=d}for(var e in l){d.setAttribute(e,l[e])}}}}c.selectNodeContents(k);c.updateToolbar()};CreateLink.prototype._getSelectedAnchor=function(){var d=this.editor.getSelection();var c=this.editor.createRange(d);var b=this.editor.activeElement(d);if(b!=null&&b.tagName.toLowerCase()=="a"){return b}else{b=this.editor._getFirstAncestor(d,"a");if(b!=null){return b}}return null};
|
||||
|
|
@ -98,17 +98,6 @@ function onCancel() {
|
|||
return false;
|
||||
}
|
||||
|
||||
function onBrowse(){
|
||||
baseURL = opener.location.pathname;
|
||||
offset = baseURL.lastIndexOf("/");
|
||||
destURL = baseURL.slice(0, offset+1) + "search.jsp?useURL=true&widget=getElementById('f_href')";
|
||||
aWindow = window.open(destURL,
|
||||
"search",
|
||||
"toolbar=no,width=800,height=600,status=no,scrollbars=yes,resize=yes,menubar=no");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
</head>
|
||||
|
|
@ -119,10 +108,7 @@ function onBrowse(){
|
|||
<table border="0" style="width: 100%;">
|
||||
<tr>
|
||||
<td class="label">URL:</td>
|
||||
<td><input type="text" id="f_href" style="width: 100%" />
|
||||
<button name="browse" onclick="return onBrowse();"
|
||||
title="Browse for a content item">Browse</button>
|
||||
</td>
|
||||
<td><input type="text" id="f_href" style="width: 100%" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">Title (tooltip):</td>
|
||||
|
|
@ -147,4 +133,4 @@ function onBrowse(){
|
|||
</div>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
|
@ -1,87 +1,103 @@
|
|||
/* This compressed file is part of Xinha. For uncompressed sources, forum, and bug reports, go to xinha.org */
|
||||
/* This file is part of version 0.95 released Mon, 12 May 2008 17:33:15 +0200 */
|
||||
/* The URL of the most recent version of this file is http://svn.xinha.webfactional.com/trunk/modules/CreateLink/link.js */
|
||||
CreateLink._pluginInfo={name:"CreateLink",origin:"Xinha Core",version:"$LastChangedRevision:990 $".replace(/^[^:]*:\s*(.*)\s*\$$/,"$1"),developer:"The Xinha Core Developer Team",developer_url:"$HeadURL:http://svn.xinha.webfactional.com/trunk/modules/CreateLink/link.js $".replace(/^[^:]*:\s*(.*)\s*\$$/,"$1"),sponsor:"",sponsor_url:"",license:"htmlArea"};
|
||||
function CreateLink(_1){
|
||||
/*--------------------------------------:noTabs=true:tabSize=2:indentSize=2:--
|
||||
-- Xinha (is not htmlArea) - http://xinha.org
|
||||
--
|
||||
-- Use of Xinha is granted by the terms of the htmlArea License (based on
|
||||
-- BSD license) please read license.txt in this package for details.
|
||||
--
|
||||
-- Copyright (c) 2005-2008 Xinha Developer Team and contributors
|
||||
--
|
||||
-- Xinha was originally based on work by Mihai Bazon which is:
|
||||
-- Copyright (c) 2003-2004 dynarch.com.
|
||||
-- Copyright (c) 2002-2003 interactivetools.com, inc.
|
||||
-- This copyright notice MUST stay intact for use.
|
||||
--
|
||||
-- This is the standard implementation of the Xinha.prototype._createLink method,
|
||||
-- which provides the functionality to insert a hyperlink in the editor.
|
||||
--
|
||||
-- The file is loaded as a special plugin by the Xinha Core when no alternative method (plugin) is loaded.
|
||||
--
|
||||
--
|
||||
-- $HeadURL: http://svn.xinha.org/trunk/modules/CreateLink/link.js $
|
||||
-- $LastChangedDate: 2008-10-13 06:42:42 +1300 (Mon, 13 Oct 2008) $
|
||||
-- $LastChangedRevision: 1084 $
|
||||
-- $LastChangedBy: ray $
|
||||
--------------------------------------------------------------------------*/
|
||||
|
||||
function CreateLink(editor) {
|
||||
this.editor = editor;
|
||||
var cfg = editor.config;
|
||||
var self = this;
|
||||
|
||||
editor.config.btnList.createlink[3] = function() { self.show(self._getSelectedAnchor()); }
|
||||
}
|
||||
Xinha.prototype._createLink=function(_2){
|
||||
var _3=this;
|
||||
var _4=null;
|
||||
if(typeof _2=="undefined"){
|
||||
_2=this.getParentElement();
|
||||
if(_2){
|
||||
while(_2&&!/^a$/i.test(_2.tagName)){
|
||||
_2=_2.parentNode;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!_2){
|
||||
var _5=_3.getSelection();
|
||||
var _6=_3.createRange(_5);
|
||||
var _7=0;
|
||||
if(Xinha.is_ie){
|
||||
if(_5.type=="Control"){
|
||||
_7=_6.length;
|
||||
}else{
|
||||
_7=_6.compareEndPoints("StartToEnd",_6);
|
||||
}
|
||||
}else{
|
||||
_7=_6.compareBoundaryPoints(_6.START_TO_END,_6);
|
||||
}
|
||||
if(_7===0){
|
||||
alert(Xinha._lc("You need to select some text before creating a link"));
|
||||
return;
|
||||
}
|
||||
_4={f_href:"",f_title:"",f_target:"",f_usetarget:_3.config.makeLinkShowsTarget};
|
||||
}else{
|
||||
_4={f_href:Xinha.is_ie?_3.stripBaseURL(_2.href):_2.getAttribute("href"),f_title:_2.title,f_target:_2.target,f_usetarget:_3.config.makeLinkShowsTarget};
|
||||
}
|
||||
Dialog(_3.config.URIs.link,function(_8){
|
||||
if(!_8){
|
||||
return false;
|
||||
}
|
||||
var a=_2;
|
||||
if(!a){
|
||||
try{
|
||||
var _a=Xinha.uniq("http://www.example.com/Link");
|
||||
_3._doc.execCommand("createlink",false,_a);
|
||||
var _b=_3._doc.getElementsByTagName("a");
|
||||
for(var i=0;i<_b.length;i++){
|
||||
var _d=_b[i];
|
||||
if(_d.href==_a){
|
||||
if(!a){
|
||||
a=_d;
|
||||
}
|
||||
_d.href=_8.f_href;
|
||||
if(_8.f_target){
|
||||
_d.target=_8.f_target;
|
||||
}
|
||||
if(_8.f_title){
|
||||
_d.title=_8.f_title;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(ex){
|
||||
}
|
||||
}else{
|
||||
var _e=_8.f_href.trim();
|
||||
_3.selectNodeContents(a);
|
||||
if(_e===""){
|
||||
_3._doc.execCommand("unlink",false,null);
|
||||
_3.updateToolbar();
|
||||
return false;
|
||||
}else{
|
||||
a.href=_e;
|
||||
}
|
||||
}
|
||||
if(!(a&&a.tagName.toLowerCase()=="a")){
|
||||
return false;
|
||||
}
|
||||
a.target=_8.f_target.trim();
|
||||
a.title=_8.f_title.trim();
|
||||
_3.selectNodeContents(a);
|
||||
_3.updateToolbar();
|
||||
},_4);
|
||||
|
||||
CreateLink._pluginInfo = {
|
||||
name : "CreateLink",
|
||||
origin : "Xinha Core",
|
||||
version : "$LastChangedRevision: 1084 $".replace(/^[^:]*:\s*(.*)\s*\$$/, '$1'),
|
||||
developer : "The Xinha Core Developer Team",
|
||||
developer_url : "$HeadURL: http://svn.xinha.org/trunk/modules/CreateLink/link.js $".replace(/^[^:]*:\s*(.*)\s*\$$/, '$1'),
|
||||
sponsor : "",
|
||||
sponsor_url : "",
|
||||
license : "htmlArea"
|
||||
};
|
||||
|
||||
CreateLink.prototype._lc = function(string) {
|
||||
return Xinha._lc(string, 'Xinha');
|
||||
};
|
||||
|
||||
|
||||
CreateLink.prototype.onGenerateOnce = function()
|
||||
{
|
||||
CreateLink.loadAssets();
|
||||
};
|
||||
|
||||
CreateLink.loadAssets = function()
|
||||
{
|
||||
var self = CreateLink;
|
||||
if (self.loading) return;
|
||||
self.loading = true;
|
||||
Xinha._getback(_editor_url + 'modules/CreateLink/dialog.html', function(getback) { self.html = getback; self.dialogReady = true; });
|
||||
Xinha._getback(_editor_url + 'modules/CreateLink/pluginMethods.js', function(getback) { eval(getback); self.methodsReady = true; });
|
||||
}
|
||||
|
||||
CreateLink.prototype.onUpdateToolbar = function()
|
||||
{
|
||||
if (!(CreateLink.dialogReady && CreateLink.methodsReady))
|
||||
{
|
||||
this.editor._toolbarObjects.createlink.state("enabled", false);
|
||||
}
|
||||
else this.onUpdateToolbar = null;
|
||||
};
|
||||
|
||||
CreateLink.prototype.prepareDialog = function()
|
||||
{
|
||||
var self = this;
|
||||
var editor = this.editor;
|
||||
|
||||
var dialog = this.dialog = new Xinha.Dialog(editor, CreateLink.html, 'Xinha',{width:400})
|
||||
// Connect the OK and Cancel buttons
|
||||
dialog.getElementById('ok').onclick = function() {self.apply();}
|
||||
|
||||
dialog.getElementById('cancel').onclick = function() { self.dialog.hide()};
|
||||
|
||||
if (!editor.config.makeLinkShowsTarget)
|
||||
{
|
||||
dialog.getElementById("f_target_label").style.visibility = "hidden";
|
||||
dialog.getElementById("f_target").style.visibility = "hidden";
|
||||
dialog.getElementById("f_other_target").style.visibility = "hidden";
|
||||
}
|
||||
|
||||
dialog.getElementById('f_target').onchange= function()
|
||||
{
|
||||
var f = dialog.getElementById("f_other_target");
|
||||
if (this.value == "_other") {
|
||||
f.style.visibility = "visible";
|
||||
f.select();
|
||||
f.focus();
|
||||
} else f.style.visibility = "hidden";
|
||||
};
|
||||
|
||||
|
||||
this.dialogReady = true;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -0,0 +1,165 @@
|
|||
|
||||
CreateLink.prototype.show = function(a)
|
||||
{
|
||||
if (!this.dialog)
|
||||
{
|
||||
this.prepareDialog();
|
||||
}
|
||||
var editor = this.editor;
|
||||
this.a = a;
|
||||
if(!a && this.editor.selectionEmpty(this.editor.getSelection()))
|
||||
{
|
||||
alert(this._lc("You need to select some text before creating a link"));
|
||||
return false;
|
||||
}
|
||||
|
||||
var inputs =
|
||||
{
|
||||
f_href : '',
|
||||
f_title : '',
|
||||
f_target : '',
|
||||
f_other_target : ''
|
||||
};
|
||||
|
||||
if(a && a.tagName.toLowerCase() == 'a')
|
||||
{
|
||||
inputs.f_href = this.editor.fixRelativeLinks(a.getAttribute('href'));
|
||||
inputs.f_title = a.title;
|
||||
if (a.target)
|
||||
{
|
||||
if (!/_self|_top|_blank/.test(a.target))
|
||||
{
|
||||
inputs.f_target = '_other';
|
||||
inputs.f_other_target = a.target;
|
||||
}
|
||||
else
|
||||
{
|
||||
inputs.f_target = a.target;
|
||||
inputs.f_other_target = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// now calling the show method of the Xinha.Dialog object to set the values and show the actual dialog
|
||||
this.dialog.show(inputs);
|
||||
};
|
||||
|
||||
// and finally ... take some action
|
||||
CreateLink.prototype.apply = function()
|
||||
{
|
||||
|
||||
var values = this.dialog.hide();
|
||||
var a = this.a;
|
||||
var editor = this.editor;
|
||||
|
||||
var atr =
|
||||
{
|
||||
href: '',
|
||||
target:'',
|
||||
title:''
|
||||
};
|
||||
|
||||
if(values.f_href)
|
||||
{
|
||||
atr.href = values.f_href;
|
||||
atr.title = values.f_title;
|
||||
if (values.f_target.value)
|
||||
{
|
||||
if (values.f_target.value == 'other') atr.target = values.f_other_target;
|
||||
else atr.target = values.f_target.value;
|
||||
}
|
||||
}
|
||||
if (values.f_target.value)
|
||||
{
|
||||
if (values.f_target.value != '_other')
|
||||
{
|
||||
atr.target = values.f_target.value;
|
||||
}
|
||||
else
|
||||
{
|
||||
atr.target = values.f_other_target;
|
||||
}
|
||||
}
|
||||
|
||||
if(a && a.tagName.toLowerCase() == 'a')
|
||||
{
|
||||
if(!atr.href)
|
||||
{
|
||||
if(confirm(this._lc('Are you sure you wish to remove this link?')))
|
||||
{
|
||||
var p = a.parentNode;
|
||||
while(a.hasChildNodes())
|
||||
{
|
||||
p.insertBefore(a.removeChild(a.childNodes[0]), a);
|
||||
}
|
||||
p.removeChild(a);
|
||||
editor.updateToolbar();
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Update the link
|
||||
for(var i in atr)
|
||||
{
|
||||
a.setAttribute(i, atr[i]);
|
||||
}
|
||||
|
||||
// If we change a mailto link in IE for some hitherto unknown
|
||||
// reason it sets the innerHTML of the link to be the
|
||||
// href of the link. Stupid IE.
|
||||
if(Xinha.is_ie)
|
||||
{
|
||||
if(/mailto:([^?<>]*)(\?[^<]*)?$/i.test(a.innerHTML))
|
||||
{
|
||||
a.innerHTML = RegExp.$1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!atr.href) return true;
|
||||
|
||||
// Insert a link, we let the browser do this, we figure it knows best
|
||||
var tmp = Xinha.uniq('http://www.example.com/Link');
|
||||
editor._doc.execCommand('createlink', false, tmp);
|
||||
|
||||
// Fix them up
|
||||
var anchors = editor._doc.getElementsByTagName('a');
|
||||
for(var i = 0; i < anchors.length; i++)
|
||||
{
|
||||
var anchor = anchors[i];
|
||||
if(anchor.href == tmp)
|
||||
{
|
||||
// Found one.
|
||||
if (!a) a = anchor;
|
||||
for(var j in atr)
|
||||
{
|
||||
anchor.setAttribute(j, atr[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
editor.selectNodeContents(a);
|
||||
editor.updateToolbar();
|
||||
};
|
||||
CreateLink.prototype._getSelectedAnchor = function()
|
||||
{
|
||||
var sel = this.editor.getSelection();
|
||||
var rng = this.editor.createRange(sel);
|
||||
var a = this.editor.activeElement(sel);
|
||||
if(a != null && a.tagName.toLowerCase() == 'a')
|
||||
{
|
||||
return a;
|
||||
}
|
||||
else
|
||||
{
|
||||
a = this.editor._getFirstAncestor(sel, 'a');
|
||||
if(a != null)
|
||||
{
|
||||
return a;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
|
@ -1,2 +1,101 @@
|
|||
/* This compressed file is part of Xinha. For uncompressed sources, forum, and bug reports, go to xinha.org */
|
||||
function Dialog(b,a,d){if(typeof d=="undefined"){d=window}if(typeof window.showModalDialog=="function"&&!Xinha.is_webkit){Dialog._return=function(e){if(typeof a=="function"){a(e)}};var c=window.showModalDialog(b,d,"dialogheight=300;dialogwidth=400;resizable=yes")}else{Dialog._geckoOpenModal(b,a,d)}}Dialog._parentEvent=function(a){setTimeout(function(){if(Dialog._modal&&!Dialog._modal.closed){Dialog._modal.focus()}},50);try{if(Dialog._modal&&!Dialog._modal.closed){Xinha._stopEvent(a)}}catch(b){}};Dialog._return=null;Dialog._modal=null;Dialog._arguments=null;Dialog._selection=null;Dialog._geckoOpenModal=function(b,a,j){var h=window.open(b,"hadialog","toolbar=no,menubar=no,personalbar=no,width=10,height=10,scrollbars=no,resizable=yes,modal=yes,dependable=yes");Dialog._modal=h;Dialog._arguments=j;function d(e){Xinha._addEvent(e,"click",Dialog._parentEvent);Xinha._addEvent(e,"mousedown",Dialog._parentEvent);Xinha._addEvent(e,"focus",Dialog._parentEvent)}function f(e){Xinha._removeEvent(e,"click",Dialog._parentEvent);Xinha._removeEvent(e,"mousedown",Dialog._parentEvent);Xinha._removeEvent(e,"focus",Dialog._parentEvent)}d(window);for(var c=0;c<window.frames.length;c++){try{d(window.frames[c])}catch(g){}}Dialog._return=function(m){if(m&&a){a(m)}f(window);for(var k=0;k<window.frames.length;k++){try{f(window.frames[k])}catch(l){}}Dialog._modal=null};Dialog._modal.focus()};
|
||||
|
||||
/*--------------------------------------:noTabs=true:tabSize=2:indentSize=2:--
|
||||
-- Xinha (is not htmlArea) - http://xinha.gogo.co.nz/
|
||||
--
|
||||
-- Use of Xinha is granted by the terms of the htmlArea License (based on
|
||||
-- BSD license) please read license.txt in this package for details.
|
||||
--
|
||||
-- Xinha was originally based on work by Mihai Bazon which is:
|
||||
-- Copyright (c) 2003-2004 dynarch.com.
|
||||
-- Copyright (c) 2002-2003 interactivetools.com, inc.
|
||||
-- This copyright notice MUST stay intact for use.
|
||||
--
|
||||
-- This is the implementation of the standard popup dialog
|
||||
--
|
||||
-- Though "Dialog" looks like an object, it isn't really an object. Instead
|
||||
-- it's just namespace for protecting global symbols.
|
||||
--
|
||||
--
|
||||
-- $HeadURL: http://svn.xinha.org/trunk/modules/Dialogs/dialog.js $
|
||||
-- $LastChangedDate: 2008-10-13 06:42:42 +1300 (Mon, 13 Oct 2008) $
|
||||
-- $LastChangedRevision: 1084 $
|
||||
-- $LastChangedBy: ray $
|
||||
--------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
function Dialog(url, action, init) {
|
||||
if (typeof init == "undefined") {
|
||||
init = window; // pass this window object by default
|
||||
}
|
||||
if (typeof window.showModalDialog == 'function' && !Xinha.is_webkit) // webkit easily looses the selection with window.showModalDialog
|
||||
{
|
||||
Dialog._return = function(retVal) {
|
||||
if (typeof action == 'function') action (retVal);
|
||||
}
|
||||
var r = window.showModalDialog(url, init, "dialogheight=300;dialogwidth=400;resizable=yes");
|
||||
}
|
||||
else
|
||||
{
|
||||
Dialog._geckoOpenModal(url, action, init);
|
||||
}
|
||||
}
|
||||
|
||||
Dialog._parentEvent = function(ev) {
|
||||
setTimeout( function() { if (Dialog._modal && !Dialog._modal.closed) { Dialog._modal.focus() } }, 50);
|
||||
try {
|
||||
if (Dialog._modal && !Dialog._modal.closed) {
|
||||
Xinha._stopEvent(ev);
|
||||
}
|
||||
} catch (e) {
|
||||
//after closing the popup in IE the events are not released and trying to access Dialog._modal.closed causes an error
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// should be a function, the return handler of the currently opened dialog.
|
||||
Dialog._return = null;
|
||||
|
||||
// constant, the currently opened dialog
|
||||
Dialog._modal = null;
|
||||
|
||||
// the dialog will read it's args from this variable
|
||||
Dialog._arguments = null;
|
||||
|
||||
Dialog._selection = null;
|
||||
|
||||
Dialog._geckoOpenModal = function(url, action, init) {
|
||||
var dlg = window.open(url, "hadialog",
|
||||
"toolbar=no,menubar=no,personalbar=no,width=10,height=10," +
|
||||
"scrollbars=no,resizable=yes,modal=yes,dependable=yes");
|
||||
Dialog._modal = dlg;
|
||||
Dialog._arguments = init;
|
||||
|
||||
// capture some window's events
|
||||
function capwin(w) {
|
||||
Xinha._addEvent(w, "click", Dialog._parentEvent);
|
||||
Xinha._addEvent(w, "mousedown", Dialog._parentEvent);
|
||||
Xinha._addEvent(w, "focus", Dialog._parentEvent);
|
||||
}
|
||||
// release the captured events
|
||||
function relwin(w) {
|
||||
Xinha._removeEvent(w, "click", Dialog._parentEvent);
|
||||
Xinha._removeEvent(w, "mousedown", Dialog._parentEvent);
|
||||
Xinha._removeEvent(w, "focus", Dialog._parentEvent);
|
||||
}
|
||||
capwin(window);
|
||||
// capture other frames, note the exception trapping, this is because
|
||||
// we are not permitted to add events to frames outside of the current
|
||||
// window's domain.
|
||||
for (var i = 0; i < window.frames.length; i++) {try { capwin(window.frames[i]); } catch(e) { } };
|
||||
// make up a function to be called when the Dialog ends.
|
||||
Dialog._return = function (val) {
|
||||
if (val && action) {
|
||||
action(val);
|
||||
}
|
||||
relwin(window);
|
||||
// capture other frames
|
||||
for (var i = 0; i < window.frames.length; i++) { try { relwin(window.frames[i]); } catch(e) { } };
|
||||
Dialog._modal = null;
|
||||
};
|
||||
Dialog._modal.focus();
|
||||
};
|
||||
|
|
@ -1,2 +1,179 @@
|
|||
/* This compressed file is part of Xinha. For uncompressed sources, forum, and bug reports, go to xinha.org */
|
||||
function PopupWin(c,g,j,a){this.editor=c;this.handler=j;var f=window.open("","__ha_dialog","toolbar=no,menubar=no,personalbar=no,width=600,height=600,left=20,top=40,scrollbars=no,resizable=yes");this.window=f;var h=f.document;this.doc=h;var i=this;var b=document.baseURI||document.URL;if(b&&b.match(/(.*)\/([^\/]+)/)){b=RegExp.$1+"/"}if(typeof _editor_url!="undefined"&&!(/^\//.test(_editor_url))&&!(/http:\/\//.test(_editor_url))){b+=_editor_url}else{b=_editor_url}if(!(/\/$/.test(b))){b+="/"}this.baseURL=b;h.open();var e="<html><head><title>"+g+"</title>\n";e+='<style type="text/css">@import url('+_editor_url+"Xinha.css);</style>\n";if(_editor_skin!=""){e+='<style type="text/css">@import url('+_editor_url+"skins/"+_editor_skin+"/skin.css);</style>\n"}e+="</head>\n";e+='<body class="dialog popupwin" id="--HA-body"></body></html>';h.write(e);h.close();function d(){var k=h.body;if(!k){setTimeout(d,25);return false}f.title=g;h.documentElement.style.padding="0px";h.documentElement.style.margin="0px";var l=h.createElement("div");l.className="content";i.content=l;k.appendChild(l);i.element=k;a(i);f.focus()}d()}PopupWin.prototype.callHandler=function(){var c=["input","textarea","select"];var h={};for(var f=c.length;--f>=0;){var a=c[f];var d=this.content.getElementsByTagName(a);for(var b=0;b<d.length;++b){var e=d[b];var g=e.value;if(e.tagName.toLowerCase()=="input"){if(e.type=="checkbox"){g=e.checked}}h[e.name]=g}}this.handler(this,h);return false};PopupWin.prototype.close=function(){this.window.close()};PopupWin.prototype.addButtons=function(){var a=this;var e=this.doc.createElement("div");this.content.appendChild(e);e.id="buttons";e.className="buttons";for(var d=0;d<arguments.length;++d){var c=arguments[d];var b=this.doc.createElement("button");e.appendChild(b);b.innerHTML=Xinha._lc(c,"Xinha");switch(c.toLowerCase()){case"ok":Xinha.addDom0Event(b,"click",function(){a.callHandler();a.close();return false});break;case"cancel":Xinha.addDom0Event(b,"click",function(){a.close();return false});break}}};PopupWin.prototype.showAtElement=function(){var a=this;setTimeout(function(){var b=a.content.offsetWidth+4;var e=a.content.offsetHeight+4;var d=a.content;var c=d.style;c.position="absolute";c.left=parseInt((b-d.offsetWidth)/2,10)+"px";c.top=parseInt((e-d.offsetHeight)/2,10)+"px";if(Xinha.is_gecko){a.window.innerWidth=b;a.window.innerHeight=e}else{a.window.resizeTo(b+8,e+70)}},25)};
|
||||
// (c) dynarch.com 2003-2004
|
||||
// Distributed under the same terms as HTMLArea itself.
|
||||
|
||||
function PopupWin(editor, title, handler, initFunction)
|
||||
{
|
||||
this.editor = editor;
|
||||
this.handler = handler;
|
||||
var dlg = window.open("", "__ha_dialog", "toolbar=no,menubar=no,personalbar=no,width=600,height=600,left=20,top=40,scrollbars=no,resizable=yes");
|
||||
this.window = dlg;
|
||||
var doc = dlg.document;
|
||||
this.doc = doc;
|
||||
var self = this;
|
||||
|
||||
var base = document.baseURI || document.URL;
|
||||
if ( base && base.match(/(.*)\/([^\/]+)/) )
|
||||
{
|
||||
base = RegExp.$1 + "/";
|
||||
}
|
||||
// @fixme: why using a regex here and not a simple string test ?
|
||||
if ( typeof _editor_url != "undefined" && ! ( /^\//.test(_editor_url) ) && ! ( /http:\/\//.test(_editor_url) ) )
|
||||
{
|
||||
// _editor_url doesn't start with '/' which means it's relative
|
||||
// FIXME: there's a problem here, it could be http:// which
|
||||
// doesn't start with slash but it's not relative either.
|
||||
base += _editor_url;
|
||||
}
|
||||
else
|
||||
{
|
||||
base = _editor_url;
|
||||
}
|
||||
|
||||
// @fixme: why using a regex here and not a simple string test ?
|
||||
if ( ! ( /\/$/.test(base) ) )
|
||||
{
|
||||
// base does not end in slash, add it now
|
||||
base += '/';
|
||||
}
|
||||
this.baseURL = base;
|
||||
|
||||
doc.open();
|
||||
var html = "<html><head><title>" + title + "</title>\n";
|
||||
// html += "<base href='" + base + "htmlarea.js' />\n";
|
||||
html += '<style type="text/css">@import url(' + _editor_url + 'Xinha.css);</style>\n';
|
||||
if ( _editor_skin != "" )
|
||||
{
|
||||
html += '<style type="text/css">@import url(' + _editor_url + 'skins/' + _editor_skin + '/skin.css);</style>\n';
|
||||
}
|
||||
html += "</head>\n";
|
||||
html += '<body class="dialog popupwin" id="--HA-body"></body></html>';
|
||||
doc.write(html);
|
||||
doc.close();
|
||||
|
||||
// sometimes I Hate Mozilla... ;-(
|
||||
function init2()
|
||||
{
|
||||
var body = doc.body;
|
||||
if ( !body )
|
||||
{
|
||||
setTimeout(init2, 25);
|
||||
return false;
|
||||
}
|
||||
dlg.title = title;
|
||||
doc.documentElement.style.padding = "0px";
|
||||
doc.documentElement.style.margin = "0px";
|
||||
var content = doc.createElement("div");
|
||||
content.className = "content";
|
||||
self.content = content;
|
||||
body.appendChild(content);
|
||||
self.element = body;
|
||||
initFunction(self);
|
||||
dlg.focus();
|
||||
}
|
||||
init2();
|
||||
}
|
||||
|
||||
PopupWin.prototype.callHandler = function()
|
||||
{
|
||||
var tags = ["input", "textarea", "select"];
|
||||
var params = {};
|
||||
for ( var ti = tags.length; --ti >= 0; )
|
||||
{
|
||||
var tag = tags[ti];
|
||||
var els = this.content.getElementsByTagName(tag);
|
||||
for ( var j = 0; j < els.length; ++j )
|
||||
{
|
||||
var el = els[j];
|
||||
var val = el.value;
|
||||
if ( el.tagName.toLowerCase() == "input" )
|
||||
{
|
||||
if ( el.type == "checkbox" )
|
||||
{
|
||||
val = el.checked;
|
||||
}
|
||||
}
|
||||
params[el.name] = val;
|
||||
}
|
||||
}
|
||||
this.handler(this, params);
|
||||
return false;
|
||||
};
|
||||
|
||||
PopupWin.prototype.close = function()
|
||||
{
|
||||
this.window.close();
|
||||
};
|
||||
|
||||
PopupWin.prototype.addButtons = function()
|
||||
{
|
||||
// @fixme: isn't self a predefined variable used to access self frame in most browsers ?
|
||||
// if yes, then we break it here
|
||||
var self = this;
|
||||
var div = this.doc.createElement("div");
|
||||
this.content.appendChild(div);
|
||||
div.id = "buttons";
|
||||
div.className = "buttons";
|
||||
for ( var i = 0; i < arguments.length; ++i )
|
||||
{
|
||||
var btn = arguments[i];
|
||||
var button = this.doc.createElement("button");
|
||||
div.appendChild(button);
|
||||
button.innerHTML = Xinha._lc(btn, 'Xinha');
|
||||
switch (btn.toLowerCase())
|
||||
{
|
||||
case "ok":
|
||||
Xinha.addDom0Event(button, 'click',
|
||||
function()
|
||||
{
|
||||
self.callHandler();
|
||||
self.close();
|
||||
return false;
|
||||
}
|
||||
);
|
||||
break;
|
||||
case "cancel":
|
||||
Xinha.addDom0Event(button, 'click',
|
||||
function()
|
||||
{
|
||||
self.close();
|
||||
return false;
|
||||
}
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
PopupWin.prototype.showAtElement = function()
|
||||
{
|
||||
var self = this;
|
||||
// Mozilla needs some time to realize what's goin' on..
|
||||
setTimeout(function()
|
||||
{
|
||||
var w = self.content.offsetWidth + 4;
|
||||
var h = self.content.offsetHeight + 4;
|
||||
// size to content -- that's fuckin' buggy in all fuckin' browsers!!!
|
||||
// so that we set a larger size for the dialog window and then center
|
||||
// the element inside... phuck!
|
||||
|
||||
// center...
|
||||
var el = self.content;
|
||||
var s = el.style;
|
||||
// s.width = el.offsetWidth + "px";
|
||||
// s.height = el.offsetHeight + "px";
|
||||
s.position = "absolute";
|
||||
s.left = parseInt((w - el.offsetWidth) / 2, 10) + "px";
|
||||
s.top = parseInt((h - el.offsetHeight) / 2, 10) + "px";
|
||||
if (Xinha.is_gecko)
|
||||
{
|
||||
self.window.innerWidth = w;
|
||||
self.window.innerHeight = h;
|
||||
}
|
||||
else
|
||||
{
|
||||
self.window.resizeTo(w + 8, h + 70);
|
||||
}
|
||||
|
||||
},
|
||||
25);
|
||||
};
|
||||
|
|
@ -1,2 +1,241 @@
|
|||
/* This compressed file is part of Xinha. For uncompressed sources, forum, and bug reports, go to xinha.org */
|
||||
function FullScreen(b,c){this.editor=b;this.originalSizes=null;b._superclean_on=false;var a=b.config;a.registerIcon("fullscreen",[_editor_url+a.imgURL+"ed_buttons_main.png",8,0]);a.registerIcon("fullscreenrestore",[_editor_url+a.imgURL+"ed_buttons_main.png",9,0]);a.registerButton("fullscreen",this._lc("Maximize/Minimize Editor"),a.iconList.fullscreen,true,function(g,f,d){g._fullScreen()});a.addToolbarElement("fullscreen","popupeditor",0)}FullScreen._pluginInfo={name:"FullScreen",version:"1.0",developer:"James Sleeman",developer_url:"http://www.gogo.co.nz/",c_owner:"Gogo Internet Services",license:"htmlArea",sponsor:"Gogo Internet Services",sponsor_url:"http://www.gogo.co.nz/"};FullScreen.prototype._lc=function(a){return Xinha._lc(a,{url:_editor_url+"modules/FullScreen/lang/",context:"FullScreen"})};Xinha.prototype._fullScreen=function(){var g=this;var d=g.config;function j(){if(!g._isFullScreen||g._sizing){return false}g._sizing=true;var n=Xinha.viewportSize();if(g.config.fullScreenSizeDownMethod=="restore"){g.originalSizes={x:parseInt(g._htmlArea.style.width),y:parseInt(g._htmlArea.style.height),dim:n}}var i=n.y-g.config.fullScreenMargins[0]-g.config.fullScreenMargins[2];var e=n.x-g.config.fullScreenMargins[1]-g.config.fullScreenMargins[3];g.sizeEditor(e+"px",i+"px",true,true);g._sizing=false;if(g._toolbarObjects.fullscreen){g._toolbarObjects.fullscreen.swapImage(d.iconList.fullscreenrestore)}}function l(){if(g._isFullScreen||g._sizing){return false}g._sizing=true;if(g.originalSizes!=null){var o=g.originalSizes;var n=Xinha.viewportSize();var e=o.x+(n.x-o.dim.x);var i=o.y+(n.y-o.dim.y);g.sizeEditor(e+"px",i+"px",g.config.sizeIncludesBars,g.config.sizeIncludesPanels);g.originalSizes=null}else{g.initSize()}g._sizing=false;if(g._toolbarObjects.fullscreen){g._toolbarObjects.fullscreen.swapImage(d.iconList.fullscreen)}}function f(){if(g._isFullScreen){window.scroll(0,0);window.setTimeout(f,150)}}if(typeof this._isFullScreen=="undefined"){this._isFullScreen=false;if(g.target!=g._iframe){Xinha._addEvent(window,"resize",j)}}if(Xinha.is_gecko){this.deactivateEditor()}if(this._isFullScreen){this._htmlArea.style.position="";if(!Xinha.is_ie){this._htmlArea.style.border=""}try{if(Xinha.is_ie&&document.compatMode=="CSS1Compat"){var b=document.getElementsByTagName("html")}else{var b=document.getElementsByTagName("body")}b[0].style.overflow=""}catch(g){}this._isFullScreen=false;l();var a=this._htmlArea;while((a=a.parentNode)&&a.style){a.style.position=a._xinha_fullScreenOldPosition;a._xinha_fullScreenOldPosition=null}if(Xinha.ie_version<7){var h=document.getElementsByTagName("select");for(var c=0;c<h.length;++c){h[c].style.visibility="visible"}}window.scroll(this._unScroll.x,this._unScroll.y)}else{this._unScroll={x:(window.pageXOffset)?(window.pageXOffset):(document.documentElement)?document.documentElement.scrollLeft:document.body.scrollLeft,y:(window.pageYOffset)?(window.pageYOffset):(document.documentElement)?document.documentElement.scrollTop:document.body.scrollTop};var a=this._htmlArea;while((a=a.parentNode)&&a.style){a._xinha_fullScreenOldPosition=a.style.position;a.style.position="static"}if(Xinha.ie_version<7){var h=document.getElementsByTagName("select");var m,k;for(var c=0;c<h.length;++c){m=h[c];k=false;while(m=m.parentNode){if(m==this._htmlArea){k=true;break}}if(!k&&h[c].style.visibility!="hidden"){h[c].style.visibility="hidden"}}}window.scroll(0,0);this._htmlArea.style.position="absolute";this._htmlArea.style.zIndex=999;this._htmlArea.style.left=g.config.fullScreenMargins[3]+"px";this._htmlArea.style.top=g.config.fullScreenMargins[0]+"px";if(!Xinha.is_ie&&!Xinha.is_webkit){this._htmlArea.style.border="none"}this._isFullScreen=true;f();try{if(Xinha.is_ie&&document.compatMode=="CSS1Compat"){var b=document.getElementsByTagName("html")}else{var b=document.getElementsByTagName("body")}b[0].style.overflow="hidden"}catch(g){}j()}if(Xinha.is_gecko){this.activateEditor()}this.focusEditor()};
|
||||
function FullScreen(editor, args)
|
||||
{
|
||||
this.editor = editor;
|
||||
this.originalSizes = null;
|
||||
editor._superclean_on = false;
|
||||
var cfg = editor.config;
|
||||
|
||||
cfg.registerIcon('fullscreen', [_editor_url + cfg.imgURL + 'ed_buttons_main.png',8,0]);
|
||||
cfg.registerIcon('fullscreenrestore', [_editor_url + cfg.imgURL + 'ed_buttons_main.png',9,0]);
|
||||
|
||||
cfg.registerButton
|
||||
( 'fullscreen',
|
||||
this._lc("Maximize/Minimize Editor"),
|
||||
cfg.iconList.fullscreen, true,
|
||||
function(e, objname, obj)
|
||||
{
|
||||
e._fullScreen();
|
||||
}
|
||||
);
|
||||
|
||||
// See if we can find 'popupeditor' and replace it with fullscreen
|
||||
cfg.addToolbarElement("fullscreen", "popupeditor", 0);
|
||||
}
|
||||
|
||||
FullScreen._pluginInfo =
|
||||
{
|
||||
name : "FullScreen",
|
||||
version : "1.0",
|
||||
developer: "James Sleeman",
|
||||
developer_url: "http://www.gogo.co.nz/",
|
||||
c_owner : "Gogo Internet Services",
|
||||
license : "htmlArea",
|
||||
sponsor : "Gogo Internet Services",
|
||||
sponsor_url : "http://www.gogo.co.nz/"
|
||||
};
|
||||
|
||||
FullScreen.prototype._lc = function(string) {
|
||||
return Xinha._lc(string, {url : _editor_url + 'modules/FullScreen/lang/',context:"FullScreen"});
|
||||
};
|
||||
|
||||
/** fullScreen makes an editor take up the full window space (and resizes when the browser is resized)
|
||||
* the principle is the same as the "popupwindow" functionality in the original htmlArea, except
|
||||
* this one doesn't popup a window (it just uses to positioning hackery) so it's much more reliable
|
||||
* and much faster to switch between
|
||||
*/
|
||||
|
||||
Xinha.prototype._fullScreen = function()
|
||||
{
|
||||
var e = this;
|
||||
var cfg = e.config;
|
||||
function sizeItUp()
|
||||
{
|
||||
if(!e._isFullScreen || e._sizing) return false;
|
||||
e._sizing = true;
|
||||
// Width & Height of window
|
||||
var dim = Xinha.viewportSize();
|
||||
if(e.config.fullScreenSizeDownMethod == 'restore')
|
||||
{
|
||||
e.originalSizes = {
|
||||
x: parseInt(e._htmlArea.style.width),
|
||||
y: parseInt(e._htmlArea.style.height),
|
||||
dim: dim
|
||||
};
|
||||
}
|
||||
|
||||
var h = dim.y - e.config.fullScreenMargins[0] - e.config.fullScreenMargins[2];
|
||||
var w = dim.x - e.config.fullScreenMargins[1] - e.config.fullScreenMargins[3];
|
||||
|
||||
e.sizeEditor(w + 'px', h + 'px',true,true);
|
||||
e._sizing = false;
|
||||
if ( e._toolbarObjects.fullscreen ) e._toolbarObjects.fullscreen.swapImage(cfg.iconList.fullscreenrestore);
|
||||
}
|
||||
|
||||
function sizeItDown()
|
||||
{
|
||||
if(e._isFullScreen || e._sizing) return false;
|
||||
e._sizing = true;
|
||||
|
||||
if(e.originalSizes != null)
|
||||
{
|
||||
var os = e.originalSizes;
|
||||
var nDim = Xinha.viewportSize();
|
||||
var nW = os.x + (nDim.x - os.dim.x);
|
||||
var nH = os.y + (nDim.y - os.dim.y);
|
||||
e.sizeEditor( nW + 'px', nH + 'px', e.config.sizeIncludesBars, e.config.sizeIncludesPanels);
|
||||
e.originalSizes = null;
|
||||
}
|
||||
else e.initSize();
|
||||
|
||||
e._sizing = false;
|
||||
if ( e._toolbarObjects.fullscreen ) e._toolbarObjects.fullscreen.swapImage(cfg.iconList.fullscreen);
|
||||
}
|
||||
|
||||
/** It's not possible to reliably get scroll events, particularly when we are hiding the scrollbars
|
||||
* so we just reset the scroll ever so often while in fullscreen mode
|
||||
*/
|
||||
function resetScroll()
|
||||
{
|
||||
if(e._isFullScreen)
|
||||
{
|
||||
window.scroll(0,0);
|
||||
window.setTimeout(resetScroll,150);
|
||||
}
|
||||
}
|
||||
|
||||
if(typeof this._isFullScreen == 'undefined')
|
||||
{
|
||||
this._isFullScreen = false;
|
||||
if(e.target != e._iframe)
|
||||
{
|
||||
Xinha._addEvent(window, 'resize', sizeItUp);
|
||||
}
|
||||
}
|
||||
|
||||
// Gecko has a bug where if you change position/display on a
|
||||
// designMode iframe that designMode dies.
|
||||
if(Xinha.is_gecko)
|
||||
{
|
||||
this.deactivateEditor();
|
||||
}
|
||||
|
||||
if(this._isFullScreen)
|
||||
{
|
||||
// Unmaximize
|
||||
this._htmlArea.style.position = '';
|
||||
if (!Xinha.is_ie ) this._htmlArea.style.border = '';
|
||||
|
||||
try
|
||||
{
|
||||
if(Xinha.is_ie && document.compatMode == 'CSS1Compat')
|
||||
{
|
||||
var bod = document.getElementsByTagName('html');
|
||||
}
|
||||
else
|
||||
{
|
||||
var bod = document.getElementsByTagName('body');
|
||||
}
|
||||
bod[0].style.overflow='';
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
// Nutthin
|
||||
}
|
||||
this._isFullScreen = false;
|
||||
sizeItDown();
|
||||
|
||||
// Restore all ancestor positions
|
||||
var ancestor = this._htmlArea;
|
||||
while((ancestor = ancestor.parentNode) && ancestor.style)
|
||||
{
|
||||
ancestor.style.position = ancestor._xinha_fullScreenOldPosition;
|
||||
ancestor._xinha_fullScreenOldPosition = null;
|
||||
}
|
||||
|
||||
if ( Xinha.ie_version < 7 )
|
||||
{
|
||||
var selects = document.getElementsByTagName("select");
|
||||
for ( var i=0;i<selects.length;++i )
|
||||
{
|
||||
selects[i].style.visibility = 'visible';
|
||||
}
|
||||
}
|
||||
window.scroll(this._unScroll.x, this._unScroll.y);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
// Get the current Scroll Positions
|
||||
this._unScroll =
|
||||
{
|
||||
x:(window.pageXOffset)?(window.pageXOffset):(document.documentElement)?document.documentElement.scrollLeft:document.body.scrollLeft,
|
||||
y:(window.pageYOffset)?(window.pageYOffset):(document.documentElement)?document.documentElement.scrollTop:document.body.scrollTop
|
||||
};
|
||||
|
||||
|
||||
// Make all ancestors position = static
|
||||
var ancestor = this._htmlArea;
|
||||
while((ancestor = ancestor.parentNode) && ancestor.style)
|
||||
{
|
||||
ancestor._xinha_fullScreenOldPosition = ancestor.style.position;
|
||||
ancestor.style.position = 'static';
|
||||
}
|
||||
// very ugly bug in IE < 7 shows select boxes through elements that are positioned over them
|
||||
if ( Xinha.ie_version < 7 )
|
||||
{
|
||||
var selects = document.getElementsByTagName("select");
|
||||
var s, currentEditor;
|
||||
for ( var i=0;i<selects.length;++i )
|
||||
{
|
||||
s = selects[i];
|
||||
currentEditor = false;
|
||||
while ( s = s.parentNode )
|
||||
{
|
||||
if ( s == this._htmlArea )
|
||||
{
|
||||
currentEditor = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ( !currentEditor && selects[i].style.visibility != 'hidden')
|
||||
{
|
||||
selects[i].style.visibility = 'hidden';
|
||||
}
|
||||
}
|
||||
}
|
||||
// Maximize
|
||||
window.scroll(0,0);
|
||||
this._htmlArea.style.position = 'absolute';
|
||||
this._htmlArea.style.zIndex = 999;
|
||||
this._htmlArea.style.left = e.config.fullScreenMargins[3] + 'px';
|
||||
this._htmlArea.style.top = e.config.fullScreenMargins[0] + 'px';
|
||||
if ( !Xinha.is_ie && !Xinha.is_webkit ) this._htmlArea.style.border = 'none';
|
||||
this._isFullScreen = true;
|
||||
resetScroll();
|
||||
|
||||
try
|
||||
{
|
||||
if(Xinha.is_ie && document.compatMode == 'CSS1Compat')
|
||||
{
|
||||
var bod = document.getElementsByTagName('html');
|
||||
}
|
||||
else
|
||||
{
|
||||
var bod = document.getElementsByTagName('body');
|
||||
}
|
||||
bod[0].style.overflow='hidden';
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
// Nutthin
|
||||
}
|
||||
|
||||
sizeItUp();
|
||||
}
|
||||
|
||||
if(Xinha.is_gecko)
|
||||
{
|
||||
this.activateEditor();
|
||||
}
|
||||
this.focusEditor();
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,2 +1,339 @@
|
|||
/* This compressed file is part of Xinha. For uncompressed sources, forum, and bug reports, go to xinha.org */
|
||||
function GetHtmlImplementation(a){this.editor=a}GetHtmlImplementation._pluginInfo={name:"GetHtmlImplementation DOMwalk",origin:"Xinha Core",version:"$LastChangedRevision: 1185 $".replace(/^[^:]*:\s*(.*)\s*\$$/,"$1"),developer:"The Xinha Core Developer Team",developer_url:"$HeadURL: http://svn.xinha.org/trunk/modules/GetHtml/DOMwalk.js $".replace(/^[^:]*:\s*(.*)\s*\$$/,"$1"),sponsor:"",sponsor_url:"",license:"htmlArea"};Xinha.getHTML=function(a,c,b){return Xinha.getHTMLWrapper(a,c,b)};Xinha.emptyAttributes=" checked disabled ismap readonly nowrap compact declare selected defer multiple noresize noshade ";Xinha.getHTMLWrapper=function(m,l,d,k){var j="";if(!k){k=""}switch(m.nodeType){case 10:case 6:case 12:break;case 2:break;case 4:j+=(Xinha.is_ie?("\n"+k):"")+"<![CDATA["+m.data+"]]>";break;case 5:j+="&"+m.nodeValue+";";break;case 7:j+=(Xinha.is_ie?("\n"+k):"")+"<?"+m.target+" "+m.data+" ?>";break;case 1:case 11:case 9:var e;var g;var q=(m.nodeType==1)?m.tagName.toLowerCase():"";if((q=="script"||q=="noscript")&&d.config.stripScripts){break}if(l){l=!(d.config.htmlRemoveTags&&d.config.htmlRemoveTags.test(q))}if(Xinha.is_ie&&q=="head"){if(l){j+=(Xinha.is_ie?("\n"+k):"")+"<head>"}var r=RegExp.multiline;RegExp.multiline=true;var f=m.innerHTML.replace(Xinha.RE_tagName,function(s,i,a){return i+a.toLowerCase()}).replace(/\s*=\s*(([^'"][^>\s]*)([>\s])|"([^"]+)"|'([^']+)')/g,'="$2$4$5"$3').replace(/<(link|meta)((\s*\S*="[^"]*")*)>([\n\r]*)/g,"<$1$2 />\n");RegExp.multiline=r;j+=f+"\n";if(l){j+=(Xinha.is_ie?("\n"+k):"")+"</head>"}break}else{if(l){e=(!(m.hasChildNodes()||Xinha.needsClosingTag(m)));j+=((Xinha.isBlockElement(m))?("\n"+k):"")+"<"+m.tagName.toLowerCase();var p=m.attributes;for(g=0;g<p.length;++g){var n=p.item(g);if(Xinha.is_real_gecko&&(m.tagName.toLowerCase()=="img")&&((n.nodeName.toLowerCase()=="height")||(n.nodeName.toLowerCase()=="width"))){if(!m.complete||m.naturalWidth===0){continue}}if(typeof n.nodeValue=="object"){continue}if(m.tagName.toLowerCase()=="input"&&m.type.toLowerCase()=="checkbox"&&n.nodeName.toLowerCase()=="value"&&n.nodeValue.toLowerCase()=="on"){continue}if(!n.specified&&!(m.tagName.toLowerCase().match(/input|option/)&&n.nodeName=="value")&&!(m.tagName.toLowerCase().match(/area/)&&n.nodeName.match(/shape|coords/i))){continue}var b=n.nodeName.toLowerCase();if(/_moz_editor_bogus_node/.test(b)||(b=="class"&&n.nodeValue=="webkit-block-placeholder")){j="";break}if(/(_moz)|(contenteditable)|(_msh)/.test(b)){continue}var o;if(Xinha.emptyAttributes.indexOf(" "+b+" ")!=-1){o=b}else{if(b!="style"){if(typeof m[n.nodeName]!="undefined"&&b!="href"&&b!="src"&&!(/^on/.test(b))){o=m[n.nodeName]}else{o=n.nodeValue;if(b=="class"){o=o.replace(/Apple-style-span/,"");if(!o){continue}}if(Xinha.is_ie&&(b=="href"||b=="src")){o=d.stripBaseURL(o)}if(d.config.only7BitPrintablesInURLs&&(b=="href"||b=="src")){o=o.replace(/([^!-~]+)/g,function(a){return escape(a)})}}}else{if(!Xinha.is_ie){o=m.style.cssText.replace(/rgb\(.*?\)/ig,function(a){return Xinha._colorToRgb(a)})}else{if(!o){continue}}}}if(/^(_moz)?$/.test(o)){continue}j+=" "+b+'="'+Xinha.htmlEncode(o)+'"'}if(Xinha.is_ie&&m.style.cssText){j+=' style="'+m.style.cssText.replace(/(^)?([^:]*):(.*?)(;|$)/g,function(u,t,s,i,a){return s.toLowerCase()+":"+i+a})+'"'}if(Xinha.is_ie&&m.tagName.toLowerCase()=="option"&&m.selected){j+=' selected="selected"'}if(j!==""){if(e&&q=="p"){j+="> </p>"}else{if(e){j+=" />"}else{j+=">"}}}}}var h=false;if(q=="script"||q=="noscript"){if(!d.config.stripScripts){if(Xinha.is_ie){var c="\n"+m.innerHTML.replace(/^[\n\r]*/,"").replace(/\s+$/,"")+"\n"+k}else{var c=(m.hasChildNodes())?m.firstChild.nodeValue:""}j+=c+"</"+q+">"+((Xinha.is_ie)?"\n":"")}}else{if(q=="pre"){j+=((Xinha.is_ie)?"\n":"")+m.innerHTML.replace(/<br>/g,"\n")+"</"+q+">"}else{for(g=m.firstChild;g;g=g.nextSibling){if(!h&&g.nodeType==1&&Xinha.isBlockElement(g)){h=true}j+=Xinha.getHTMLWrapper(g,true,d,k+" ")}if(l&&!e){j+=(((Xinha.isBlockElement(m)&&h)||q=="head"||q=="html")?("\n"+k):"")+"</"+m.tagName.toLowerCase()+">"}}}break;case 3:if(/^script|noscript|style$/i.test(m.parentNode.tagName)){j=m.data}else{if(m.data.trim()==""){if(m.data){j=" "}else{j=""}}else{j=Xinha.htmlEncode(m.data)}}break;case 8:j="<!--"+m.data+"-->";break}return j};
|
||||
|
||||
/*--------------------------------------:noTabs=true:tabSize=2:indentSize=2:--
|
||||
-- Xinha (is not htmlArea) - http://xinha.gogo.co.nz/
|
||||
--
|
||||
-- Use of Xinha is granted by the terms of the htmlArea License (based on
|
||||
-- BSD license) please read license.txt in this package for details.
|
||||
--
|
||||
-- Xinha was originally based on work by Mihai Bazon which is:
|
||||
-- Copyright (c) 2003-2004 dynarch.com.
|
||||
-- Copyright (c) 2002-2003 interactivetools.com, inc.
|
||||
-- This copyright notice MUST stay intact for use.
|
||||
--
|
||||
-- This is the standard implementation of the method for rendering HTML code from the DOM
|
||||
--
|
||||
-- The file is loaded by the Xinha Core when no alternative method (plugin) is loaded.
|
||||
--
|
||||
--
|
||||
-- $HeadURL: http://svn.xinha.org/trunk/modules/GetHtml/DOMwalk.js $
|
||||
-- $LastChangedDate: 2009-04-14 21:07:43 +1200 (Tue, 14 Apr 2009) $
|
||||
-- $LastChangedRevision: 1185 $
|
||||
-- $LastChangedBy: ray $
|
||||
--------------------------------------------------------------------------*/
|
||||
function GetHtmlImplementation(editor) {
|
||||
this.editor = editor;
|
||||
}
|
||||
|
||||
GetHtmlImplementation._pluginInfo = {
|
||||
name : "GetHtmlImplementation DOMwalk",
|
||||
origin : "Xinha Core",
|
||||
version : "$LastChangedRevision: 1185 $".replace(/^[^:]*:\s*(.*)\s*\$$/, '$1'),
|
||||
developer : "The Xinha Core Developer Team",
|
||||
developer_url : "$HeadURL: http://svn.xinha.org/trunk/modules/GetHtml/DOMwalk.js $".replace(/^[^:]*:\s*(.*)\s*\$$/, '$1'),
|
||||
sponsor : "",
|
||||
sponsor_url : "",
|
||||
license : "htmlArea"
|
||||
};
|
||||
|
||||
// Retrieves the HTML code from the given node. This is a replacement for
|
||||
// getting innerHTML, using standard DOM calls.
|
||||
// Wrapper legacy see #442
|
||||
Xinha.getHTML = function(root, outputRoot, editor)
|
||||
{
|
||||
return Xinha.getHTMLWrapper(root,outputRoot,editor);
|
||||
};
|
||||
|
||||
Xinha.emptyAttributes = " checked disabled ismap readonly nowrap compact declare selected defer multiple noresize noshade "
|
||||
|
||||
Xinha.getHTMLWrapper = function(root, outputRoot, editor, indent)
|
||||
{
|
||||
var html = "";
|
||||
if ( !indent )
|
||||
{
|
||||
indent = '';
|
||||
}
|
||||
|
||||
switch ( root.nodeType )
|
||||
{
|
||||
case 10:// Node.DOCUMENT_TYPE_NODE
|
||||
case 6: // Node.ENTITY_NODE
|
||||
case 12:// Node.NOTATION_NODE
|
||||
// this all are for the document type, probably not necessary
|
||||
break;
|
||||
|
||||
case 2: // Node.ATTRIBUTE_NODE
|
||||
// Never get here, this has to be handled in the ELEMENT case because
|
||||
// of IE crapness requring that some attributes are grabbed directly from
|
||||
// the attribute (nodeValue doesn't return correct values), see
|
||||
//http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&safe=off&selm=3porgu4mc4ofcoa1uqkf7u8kvv064kjjb4%404ax.com
|
||||
// for information
|
||||
break;
|
||||
|
||||
case 4: // Node.CDATA_SECTION_NODE
|
||||
// Mozilla seems to convert CDATA into a comment when going into wysiwyg mode,
|
||||
// don't know about IE
|
||||
html += (Xinha.is_ie ? ('\n' + indent) : '') + '<![CDATA[' + root.data + ']]>' ;
|
||||
break;
|
||||
|
||||
case 5: // Node.ENTITY_REFERENCE_NODE
|
||||
html += '&' + root.nodeValue + ';';
|
||||
break;
|
||||
|
||||
case 7: // Node.PROCESSING_INSTRUCTION_NODE
|
||||
// PI's don't seem to survive going into the wysiwyg mode, (at least in moz)
|
||||
// so this is purely academic
|
||||
html += (Xinha.is_ie ? ('\n' + indent) : '') + '<'+'?' + root.target + ' ' + root.data + ' ?>';
|
||||
break;
|
||||
|
||||
case 1: // Node.ELEMENT_NODE
|
||||
case 11: // Node.DOCUMENT_FRAGMENT_NODE
|
||||
case 9: // Node.DOCUMENT_NODE
|
||||
var closed;
|
||||
var i;
|
||||
var root_tag = (root.nodeType == 1) ? root.tagName.toLowerCase() : '';
|
||||
if ( ( root_tag == "script" || root_tag == "noscript" ) && editor.config.stripScripts )
|
||||
{
|
||||
break;
|
||||
}
|
||||
if ( outputRoot )
|
||||
{
|
||||
outputRoot = !(editor.config.htmlRemoveTags && editor.config.htmlRemoveTags.test(root_tag));
|
||||
}
|
||||
if ( Xinha.is_ie && root_tag == "head" )
|
||||
{
|
||||
if ( outputRoot )
|
||||
{
|
||||
html += (Xinha.is_ie ? ('\n' + indent) : '') + "<head>";
|
||||
}
|
||||
|
||||
var save_multiline = RegExp.multiline;
|
||||
RegExp.multiline = true;
|
||||
var txt =
|
||||
root.innerHTML
|
||||
.replace(Xinha.RE_tagName, function(str, p1, p2) { return p1 + p2.toLowerCase(); }) // lowercasize
|
||||
.replace(/\s*=\s*(([^'"][^>\s]*)([>\s])|"([^"]+)"|'([^']+)')/g, '="$2$4$5"$3') //add attribute quotes
|
||||
.replace(/<(link|meta)((\s*\S*="[^"]*")*)>([\n\r]*)/g, '<$1$2 />\n'); //terminate singlet tags
|
||||
RegExp.multiline = save_multiline;
|
||||
html += txt + '\n';
|
||||
if ( outputRoot )
|
||||
{
|
||||
html += (Xinha.is_ie ? ('\n' + indent) : '') + "</head>";
|
||||
}
|
||||
break;
|
||||
}
|
||||
else if ( outputRoot )
|
||||
{
|
||||
closed = (!(root.hasChildNodes() || Xinha.needsClosingTag(root)));
|
||||
html += ((Xinha.isBlockElement(root)) ? ('\n' + indent) : '') + "<" + root.tagName.toLowerCase();
|
||||
var attrs = root.attributes;
|
||||
|
||||
for ( i = 0; i < attrs.length; ++i )
|
||||
{
|
||||
var a = attrs.item(i);
|
||||
// In certain browsers (*cough* firefox) the dom node loses
|
||||
// information if the image is currently broken. In order to prevent
|
||||
// corrupting the height and width of image tags, we strip height and
|
||||
// width from the image rather than reporting bad information.
|
||||
if (Xinha.is_real_gecko && (root.tagName.toLowerCase() == 'img') &&
|
||||
((a.nodeName.toLowerCase() == 'height') || (a.nodeName.toLowerCase() == 'width')))
|
||||
{
|
||||
if (!root.complete || root.naturalWidth === 0)
|
||||
{
|
||||
// This means that firefox has been unable to read the dimensions from the actual image
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (typeof a.nodeValue == 'object' ) continue; // see #684
|
||||
if (root.tagName.toLowerCase() == "input"
|
||||
&& root.type.toLowerCase() == "checkbox"
|
||||
&& a.nodeName.toLowerCase() == "value"
|
||||
&& a.nodeValue.toLowerCase() == "on")
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if ( !a.specified
|
||||
// IE claims these are !a.specified even though they are. Perhaps others too?
|
||||
&& !(root.tagName.toLowerCase().match(/input|option/) && a.nodeName == 'value')
|
||||
&& !(root.tagName.toLowerCase().match(/area/) && a.nodeName.match(/shape|coords/i))
|
||||
)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
var name = a.nodeName.toLowerCase();
|
||||
if ( /_moz_editor_bogus_node/.test(name) || ( name == 'class' && a.nodeValue == 'webkit-block-placeholder') )
|
||||
{
|
||||
html = "";
|
||||
break;
|
||||
}
|
||||
if ( /(_moz)|(contenteditable)|(_msh)/.test(name) )
|
||||
{
|
||||
// avoid certain attributes
|
||||
continue;
|
||||
}
|
||||
var value;
|
||||
if ( Xinha.emptyAttributes.indexOf(" "+name+" ") != -1)
|
||||
{
|
||||
value = name;
|
||||
}
|
||||
else if ( name != "style" )
|
||||
{
|
||||
// IE5.5 reports 25 when cellSpacing is
|
||||
// 1; other values might be doomed too.
|
||||
// For this reason we extract the
|
||||
// values directly from the root node.
|
||||
// I'm starting to HATE JavaScript
|
||||
// development. Browser differences
|
||||
// suck.
|
||||
//
|
||||
// Using Gecko the values of href and src are converted to absolute links
|
||||
// unless we get them using nodeValue()
|
||||
if ( typeof root[a.nodeName] != "undefined" && name != "href" && name != "src" && !(/^on/.test(name)) )
|
||||
{
|
||||
value = root[a.nodeName];
|
||||
}
|
||||
else
|
||||
{
|
||||
value = a.nodeValue;
|
||||
if (name == 'class')
|
||||
{
|
||||
value = value.replace(/Apple-style-span/,'');
|
||||
if (!value) continue;
|
||||
}
|
||||
// IE seems not willing to return the original values - it converts to absolute
|
||||
// links using a.nodeValue, a.value, a.stringValue, root.getAttribute("href")
|
||||
// So we have to strip the baseurl manually :-/
|
||||
if ( Xinha.is_ie && (name == "href" || name == "src") )
|
||||
{
|
||||
value = editor.stripBaseURL(value);
|
||||
}
|
||||
|
||||
// High-ascii (8bit) characters in links seem to cause problems for some sites,
|
||||
// while this seems to be consistent with RFC 3986 Section 2.4
|
||||
// because these are not "reserved" characters, it does seem to
|
||||
// cause links to international resources not to work. See ticket:167
|
||||
|
||||
// IE always returns high-ascii characters un-encoded in links even if they
|
||||
// were supplied as % codes (it unescapes them when we pul the value from the link).
|
||||
|
||||
// Hmmm, very strange if we use encodeURI here, or encodeURIComponent in place
|
||||
// of escape below, then the encoding is wrong. I mean, completely.
|
||||
// Nothing like it should be at all. Using escape seems to work though.
|
||||
// It's in both browsers too, so either I'm doing something wrong, or
|
||||
// something else is going on?
|
||||
|
||||
if ( editor.config.only7BitPrintablesInURLs && ( name == "href" || name == "src" ) )
|
||||
{
|
||||
value = value.replace(/([^!-~]+)/g, function(match) { return escape(match); });
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( !Xinha.is_ie )
|
||||
{
|
||||
value = root.style.cssText.replace(/rgb\(.*?\)/ig,function(rgb){ return Xinha._colorToRgb(rgb) });
|
||||
}
|
||||
else if (!value) // IE8 has style in attributes (see below), but it's empty!
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if ( /^(_moz)?$/.test(value) )
|
||||
{
|
||||
// Mozilla reports some special tags
|
||||
// here; we don't need them.
|
||||
continue;
|
||||
}
|
||||
html += " " + name + '="' + Xinha.htmlEncode(value) + '"';
|
||||
}
|
||||
//IE fails to put style in attributes list & cssText is UPPERCASE
|
||||
if ( Xinha.is_ie && root.style.cssText )
|
||||
{
|
||||
html += ' style="' + root.style.cssText.replace(/(^)?([^:]*):(.*?)(;|$)/g, function(m0, m1,m2,m3, m4){return m2.toLowerCase() + ':' + m3 + m4;}) + '"';
|
||||
}
|
||||
if ( Xinha.is_ie && root.tagName.toLowerCase() == "option" && root.selected )
|
||||
{
|
||||
html += ' selected="selected"';
|
||||
}
|
||||
if ( html !== "" )
|
||||
{
|
||||
if ( closed && root_tag=="p" )
|
||||
{
|
||||
//never use <p /> as empty paragraphs won't be visible
|
||||
html += "> </p>";
|
||||
}
|
||||
else if ( closed )
|
||||
{
|
||||
html += " />";
|
||||
}
|
||||
else
|
||||
{
|
||||
html += ">";
|
||||
}
|
||||
}
|
||||
}
|
||||
var containsBlock = false;
|
||||
if ( root_tag == "script" || root_tag == "noscript" )
|
||||
{
|
||||
if ( !editor.config.stripScripts )
|
||||
{
|
||||
if (Xinha.is_ie)
|
||||
{
|
||||
var innerText = "\n" + root.innerHTML.replace(/^[\n\r]*/,'').replace(/\s+$/,'') + '\n' + indent;
|
||||
}
|
||||
else
|
||||
{
|
||||
var innerText = (root.hasChildNodes()) ? root.firstChild.nodeValue : '';
|
||||
}
|
||||
html += innerText + '</'+root_tag+'>' + ((Xinha.is_ie) ? '\n' : '');
|
||||
}
|
||||
}
|
||||
else if (root_tag == "pre")
|
||||
{
|
||||
html += ((Xinha.is_ie) ? '\n' : '') + root.innerHTML.replace(/<br>/g,'\n') + '</'+root_tag+'>';
|
||||
}
|
||||
else
|
||||
{
|
||||
for ( i = root.firstChild; i; i = i.nextSibling )
|
||||
{
|
||||
if ( !containsBlock && i.nodeType == 1 && Xinha.isBlockElement(i) )
|
||||
{
|
||||
containsBlock = true;
|
||||
}
|
||||
html += Xinha.getHTMLWrapper(i, true, editor, indent + ' ');
|
||||
}
|
||||
if ( outputRoot && !closed )
|
||||
{
|
||||
html += (((Xinha.isBlockElement(root) && containsBlock) || root_tag == 'head' || root_tag == 'html') ? ('\n' + indent) : '') + "</" + root.tagName.toLowerCase() + ">";
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 3: // Node.TEXT_NODE
|
||||
if ( /^script|noscript|style$/i.test(root.parentNode.tagName) )
|
||||
{
|
||||
html = root.data;
|
||||
}
|
||||
else if(root.data.trim() == '')
|
||||
{
|
||||
if(root.data)
|
||||
{
|
||||
html = ' ';
|
||||
}
|
||||
else
|
||||
{
|
||||
html = '';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
html = Xinha.htmlEncode(root.data);
|
||||
}
|
||||
break;
|
||||
|
||||
case 8: // Node.COMMENT_NODE
|
||||
html = "<!--" + root.data + "-->";
|
||||
break;
|
||||
}
|
||||
return html;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,2 +1,231 @@
|
|||
/* This compressed file is part of Xinha. For uncompressed sources, forum, and bug reports, go to xinha.org */
|
||||
function GetHtmlImplementation(a){this.editor=a}GetHtmlImplementation._pluginInfo={name:"GetHtmlImplementation TransformInnerHTML",version:"1.0",developer:"Nelson Bright",developer_url:"http://www.brightworkweb.com/",sponsor:"",sponsor_url:"",license:"htmlArea"};Xinha.RegExpCache=[/<\s*\/?([^\s\/>]+)[\s*\/>]/gi,/(\s+)_moz[^=>]*=[^\s>]*/gi,/\s*=\s*(([^'"][^>\s]*)([>\s])|"([^"]+)"|'([^']+)')/g,/\/>/g,/<(br|hr|img|input|link|meta|param|embed|area)((\s*\S*="[^"]*")*)>/g,/(<\w+\s+(\w*="[^"]*"\s+)*)(checked|compact|declare|defer|disabled|ismap|multiple|no(href|resize|shade|wrap)|readonly|selected)([\s>])/gi,/(="[^']*)'([^'"]*")/,/&(?=(?!(#[0-9]{2,5};|[a-zA-Z0-9]{2,6};|#x[0-9a-fA-F]{2,4};))[^<]*>)/g,/<\s+/g,/\s+(\/)?>/g,/\s{2,}/g,/\s+([^=\s]+)((="[^"]+")|([\s>]))/g,/\s+contenteditable(=[^>\s\/]*)?/gi,/((href|src)=")([^\s]*)"/g,/<\/?(div|p|h[1-6]|table|tr|td|th|ul|ol|li|dl|dt|dd|blockquote|object|br|hr|img|embed|param|pre|script|html|head|body|meta|link|title|area|input|form|textarea|select|option)[^>]*>/g,/<\/(div|p|h[1-6]|table|tr|ul|ol|dl|blockquote|html|head|body|script|form|select)( [^>]*)?>/g,/<(div|p|h[1-6]|table|tr|ul|ol|dl|blockquote|object|html|head|body|script|form|select)( [^>]*)?>/g,/<(td|th|li|dt|dd|option|br|hr|embed|param|pre|meta|link|title|area|input|textarea)[^>]*>/g,/(^|<\/(pre|script)>)(\s|[^\s])*?(<(pre|script)[^>]*>|$)/g,/(<pre[^>]*>)([\s\S])*?(<\/pre>)/g,/(^|<!--[\s\S]*?-->)([\s\S]*?)(?=<!--[\s\S]*?-->|$)/g,/\S*=""/g,/<!--[\s\S]*?-->|<\?[\s\S]*?\?>|<\/?\w[^>]*>/g,/(^|<\/script>)[\s\S]*?(<script[^>]*>|$)/g];var testRE=new RegExp().compile(Xinha.RegExpCache[3]);if(typeof testRE!="undefined"){for(var i=0;i<Xinha.RegExpCache.length;i++){Xinha.RegExpCache[i]=new RegExp().compile(Xinha.RegExpCache[i])}}Xinha.prototype.cleanHTML=function(b){var d=Xinha.RegExpCache;b=b.replace(d[0],function(c){return c.toLowerCase()}).replace(d[1]," ").replace(d[12]," ").replace(d[2],'="$2$4$5"$3').replace(d[21]," ").replace(d[11],function(f,e,c){return" "+e.toLowerCase()+c}).replace(d[3],">").replace(d[9],"$1>").replace(d[5],'$1$3="$3"$5').replace(d[4],"<$1$2 />").replace(d[6],"$1$2").replace(d[7],"&").replace(d[8],"<").replace(d[10]," ");if(Xinha.is_ie&&d[13].test(b)){b=b.replace(d[13],"$1"+Xinha._escapeDollars(this.stripBaseURL(RegExp.$3))+'"')}if(this.config.only7BitPrintablesInURLs){if(Xinha.is_ie){d[13].test(b)}if(d[13].test(b)){try{b=b.replace(d[13],"$1"+Xinha._escapeDollars(decodeURIComponent(RegExp.$3).replace(/([^!-~]+)/g,function(c){return escape(c)}))+'"')}catch(a){b=b.replace(d[13],Xinha._escapeDollars("$1"+RegExp.$3.replace(/([^!-~]+)/g,function(c){return escape(c)})+'"'))}}}return b};Xinha.indent=function(a,d){Xinha.__nindent=0;Xinha.__sindent="";Xinha.__sindentChar=(typeof d=="undefined")?" ":d;var b=Xinha.RegExpCache;if(Xinha.is_gecko){a=a.replace(b[19],function(c){return c.replace(/<br \/>/g,"\n")})}a=a.replace(b[18],function(c){c=c.replace(b[20],function(f,e,g){string=g.replace(/[\n\r]/gi," ").replace(/\s+/gi," ").replace(b[14],function(l){if(l.match(b[16])){var k="\n"+Xinha.__sindent+l;Xinha.__sindent+=Xinha.__sindentChar;++Xinha.__nindent;return k}else{if(l.match(b[15])){--Xinha.__nindent;Xinha.__sindent="";for(var h=Xinha.__nindent;h>0;--h){Xinha.__sindent+=Xinha.__sindentChar}return"\n"+Xinha.__sindent+l}else{if(l.match(b[17])){return"\n"+Xinha.__sindent+l}}}return l});return e+string});return c});a=a.replace(/^\s*/,"").replace(/ +\n/g,"\n").replace(/[\r\n]+(\s+)<\/script>/g,"\n$1<\/script>");return a};Xinha.getHTML=function(k,g,e){var f="";var h=Xinha.RegExpCache;if(k.nodeType==11){var d=document.createElement("div");var o=k.insertBefore(d,k.firstChild);for(j=o.nextSibling;j;j=j.nextSibling){o.appendChild(j.cloneNode(true))}f+=o.innerHTML.replace(h[23],function(a){a=a.replace(h[22],function(c){if(/^<[!\?]/.test(c)){return c}else{return e.cleanHTML(c)}});return a})}else{var p=(k.nodeType==1)?k.tagName.toLowerCase():"";if(g){f+="<"+p;var n=k.attributes;for(i=0;i<n.length;++i){var l=n.item(i);if(!l.specified){continue}var b=l.nodeName.toLowerCase();var m=l.nodeValue;f+=" "+b+'="'+m+'"'}f+=">"}if(p=="html"){innerhtml=e._doc.documentElement.innerHTML}else{innerhtml=k.innerHTML}f+=innerhtml.replace(h[23],function(a){a=a.replace(h[22],function(c){if(/^<[!\?]/.test(c)){return c}else{if(!(e.config.htmlRemoveTags&&e.config.htmlRemoveTags.test(c.replace(/<([^\s>\/]+)/,"$1")))){return e.cleanHTML(c)}else{return""}}});return a});if(Xinha.is_ie){f=f.replace(/<(li|dd|dt)( [^>]*)?>/g,"</$1><$1$2>").replace(/(<[uod]l[^>]*>[\s\S]*?)<\/(li|dd|dt)>/g,"$1").replace(/\s*<\/(li|dd|dt)>(\s*<\/(li|dd|dt)>)+/g,"</$1>").replace(/(<dt[\s>][\s\S]*?)(<\/d[dt]>)+/g,"$1</dt>")}if(Xinha.is_gecko){f=f.replace(/<br \/>\n$/,"")}f=f.replace(/\s*(<\/(li|dd|dt)>)/g,"$1");if(g){f+="</"+p+">"}f=Xinha.indent(f)}return f};Xinha._escapeDollars=function(a){return a.replace(/\$/g,"$$$$")};
|
||||
/**
|
||||
* Based on XML_Utility functions submitted by troels_kn.
|
||||
* credit also to adios, who helped with reg exps:
|
||||
* http://www.sitepoint.com/forums/showthread.php?t=201052
|
||||
*
|
||||
* A replacement for Xinha.getHTML
|
||||
*
|
||||
* Features:
|
||||
* - Generates XHTML code
|
||||
* - Much faster than Xinha.getHTML
|
||||
* - Eliminates the hacks to accomodate browser quirks
|
||||
* - Returns correct code for Flash objects and scripts
|
||||
* - Formats html in an indented, readable format in html mode
|
||||
* - Preserves script and pre formatting
|
||||
* - Preserves formatting in comments
|
||||
* - Removes contenteditable from body tag in full-page mode
|
||||
* - Supports only7BitPrintablesInURLs config option
|
||||
* - Supports htmlRemoveTags config option
|
||||
*/
|
||||
|
||||
function GetHtmlImplementation(editor) {
|
||||
this.editor = editor;
|
||||
}
|
||||
|
||||
GetHtmlImplementation._pluginInfo = {
|
||||
name : "GetHtmlImplementation TransformInnerHTML",
|
||||
version : "1.0",
|
||||
developer : "Nelson Bright",
|
||||
developer_url : "http://www.brightworkweb.com/",
|
||||
sponsor : "",
|
||||
sponsor_url : "",
|
||||
license : "htmlArea"
|
||||
};
|
||||
|
||||
Xinha.RegExpCache = [
|
||||
/*00*/ /<\s*\/?([^\s\/>]+)[\s*\/>]/gi,//lowercase tags
|
||||
/*01*/ /(\s+)_moz[^=>]*=[^\s>]*/gi,//strip _moz attributes
|
||||
/*02*/ /\s*=\s*(([^'"][^>\s]*)([>\s])|"([^"]+)"|'([^']+)')/g,// find attributes
|
||||
/*03*/ /\/>/g,//strip singlet terminators
|
||||
/*04*/ /<(br|hr|img|input|link|meta|param|embed|area)((\s*\S*="[^"]*")*)>/g,//terminate singlet tags
|
||||
/*05*/ /(<\w+\s+(\w*="[^"]*"\s+)*)(checked|compact|declare|defer|disabled|ismap|multiple|no(href|resize|shade|wrap)|readonly|selected)([\s>])/gi,//expand singlet attributes
|
||||
/*06*/ /(="[^']*)'([^'"]*")/,//check quote nesting
|
||||
/*07*/ /&(?=(?!(#[0-9]{2,5};|[a-zA-Z0-9]{2,6};|#x[0-9a-fA-F]{2,4};))[^<]*>)/g,//expand query ampersands not in html entities
|
||||
/*08*/ /<\s+/g,//strip tagstart whitespace
|
||||
/*09*/ /\s+(\/)?>/g,//trim whitespace
|
||||
/*10*/ /\s{2,}/g,//trim extra whitespace
|
||||
/*11*/ /\s+([^=\s]+)((="[^"]+")|([\s>]))/g,// lowercase attribute names
|
||||
/*12*/ /\s+contenteditable(=[^>\s\/]*)?/gi,//strip contenteditable
|
||||
/*13*/ /((href|src)=")([^\s]*)"/g, //find href and src for stripBaseHref()
|
||||
/*14*/ /<\/?(div|p|h[1-6]|table|tr|td|th|ul|ol|li|dl|dt|dd|blockquote|object|br|hr|img|embed|param|pre|script|html|head|body|meta|link|title|area|input|form|textarea|select|option)[^>]*>/g,
|
||||
/*15*/ /<\/(div|p|h[1-6]|table|tr|ul|ol|dl|blockquote|html|head|body|script|form|select)( [^>]*)?>/g,//blocklevel closing tag
|
||||
/*16*/ /<(div|p|h[1-6]|table|tr|ul|ol|dl|blockquote|object|html|head|body|script|form|select)( [^>]*)?>/g,//blocklevel opening tag
|
||||
/*17*/ /<(td|th|li|dt|dd|option|br|hr|embed|param|pre|meta|link|title|area|input|textarea)[^>]*>/g,//singlet tag or output on 1 line
|
||||
/*18*/ /(^|<\/(pre|script)>)(\s|[^\s])*?(<(pre|script)[^>]*>|$)/g,//find content NOT inside pre and script tags
|
||||
/*19*/ /(<pre[^>]*>)([\s\S])*?(<\/pre>)/g,//find content inside pre tags
|
||||
/*20*/ /(^|<!--[\s\S]*?-->)([\s\S]*?)(?=<!--[\s\S]*?-->|$)/g,//find content NOT inside comments
|
||||
/*21*/ /\S*=""/g, //find empty attributes
|
||||
/*22*/ /<!--[\s\S]*?-->|<\?[\s\S]*?\?>|<\/?\w[^>]*>/g, //find all tags, including comments and php
|
||||
/*23*/ /(^|<\/script>)[\s\S]*?(<script[^>]*>|$)/g //find content NOT inside script tags
|
||||
];
|
||||
// compile for performance; WebKit doesn't support this
|
||||
var testRE = new RegExp().compile(Xinha.RegExpCache[3]);
|
||||
if (typeof testRE != 'undefined') {
|
||||
for (var i=0; i<Xinha.RegExpCache.length;i++ ) {
|
||||
Xinha.RegExpCache[i] = new RegExp().compile(Xinha.RegExpCache[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Cleans HTML into wellformed xhtml
|
||||
*/
|
||||
Xinha.prototype.cleanHTML = function(sHtml) {
|
||||
var c = Xinha.RegExpCache;
|
||||
sHtml = sHtml.
|
||||
replace(c[0], function(str) { return str.toLowerCase(); } ).//lowercase tags/attribute names
|
||||
replace(c[1], ' ').//strip _moz attributes
|
||||
replace(c[12], ' ').//strip contenteditable
|
||||
replace(c[2], '="$2$4$5"$3').//add attribute quotes
|
||||
replace(c[21], ' ').//strip empty attributes
|
||||
replace(c[11], function(str, p1, p2) { return ' '+p1.toLowerCase()+p2; }).//lowercase attribute names
|
||||
replace(c[3], '>').//strip singlet terminators
|
||||
replace(c[9], '$1>').//trim whitespace
|
||||
replace(c[5], '$1$3="$3"$5').//expand singlet attributes
|
||||
replace(c[4], '<$1$2 />').//terminate singlet tags
|
||||
replace(c[6], '$1$2').//check quote nesting
|
||||
replace(c[7], '&').//expand query ampersands
|
||||
replace(c[8], '<').//strip tagstart whitespace
|
||||
replace(c[10], ' ');//trim extra whitespace
|
||||
if(Xinha.is_ie && c[13].test(sHtml)) {
|
||||
sHtml = sHtml.replace(c[13],'$1'+Xinha._escapeDollars(this.stripBaseURL(RegExp.$3))+'"');
|
||||
}
|
||||
|
||||
if(this.config.only7BitPrintablesInURLs) {
|
||||
if (Xinha.is_ie) c[13].test(sHtml); // oddly the test below only triggers when we call this once before (IE6), in Moz it fails if tested twice
|
||||
if ( c[13].test(sHtml)) {
|
||||
try { //Mozilla returns an incorrectly encoded value with innerHTML
|
||||
sHtml = sHtml.replace(c[13], '$1'+Xinha._escapeDollars(decodeURIComponent(RegExp.$3).replace(/([^!-~]+)/g, function(chr)
|
||||
{return escape(chr);}))+'"');
|
||||
} catch (e) { // once the URL is escape()ed, you can't decodeURIComponent() it anymore
|
||||
sHtml = sHtml.replace(c[13], Xinha._escapeDollars('$1'+RegExp.$3.replace(/([^!-~]+)/g,function(chr){return escape(chr);})+'"'));
|
||||
}
|
||||
}
|
||||
}
|
||||
return sHtml;
|
||||
};
|
||||
|
||||
/**
|
||||
* Prettyfies html by inserting linebreaks before tags, and indenting blocklevel tags
|
||||
*/
|
||||
Xinha.indent = function(s, sindentChar) {
|
||||
Xinha.__nindent = 0;
|
||||
Xinha.__sindent = "";
|
||||
Xinha.__sindentChar = (typeof sindentChar == "undefined") ? " " : sindentChar;
|
||||
var c = Xinha.RegExpCache;
|
||||
if(Xinha.is_gecko) { //moz changes returns into <br> inside <pre> tags
|
||||
s = s.replace(c[19], function(str){return str.replace(/<br \/>/g,"\n")});
|
||||
}
|
||||
s = s.replace(c[18], function(strn) { //skip pre and script tags
|
||||
strn = strn.replace(c[20], function(st,$1,$2) { //exclude comments
|
||||
string = $2.replace(/[\n\r]/gi, " ").replace(/\s+/gi," ").replace(c[14], function(str) {
|
||||
if (str.match(c[16])) {
|
||||
var s = "\n" + Xinha.__sindent + str;
|
||||
// blocklevel openingtag - increase indent
|
||||
Xinha.__sindent += Xinha.__sindentChar;
|
||||
++Xinha.__nindent;
|
||||
return s;
|
||||
} else if (str.match(c[15])) {
|
||||
// blocklevel closingtag - decrease indent
|
||||
--Xinha.__nindent;
|
||||
Xinha.__sindent = "";
|
||||
for (var i=Xinha.__nindent;i>0;--i) {
|
||||
Xinha.__sindent += Xinha.__sindentChar;
|
||||
}
|
||||
return "\n" + Xinha.__sindent + str;
|
||||
} else if (str.match(c[17])) {
|
||||
// singlet tag
|
||||
return "\n" + Xinha.__sindent + str;
|
||||
}
|
||||
return str; // this won't actually happen
|
||||
});
|
||||
return $1 + string;
|
||||
});return strn;
|
||||
});
|
||||
//final cleanup
|
||||
s = s.replace(/^\s*/,'').//strip leading whitespace
|
||||
replace(/ +\n/g,'\n').//strip spaces at end of lines
|
||||
replace(/[\r\n]+(\s+)<\/script>/g,'\n$1</script>');//strip returns added into scripts
|
||||
return s;
|
||||
};
|
||||
|
||||
Xinha.getHTML = function(root, outputRoot, editor) {
|
||||
var html = "";
|
||||
var c = Xinha.RegExpCache;
|
||||
|
||||
if(root.nodeType == 11) {//document fragment
|
||||
//we can't get innerHTML from the root (type 11) node, so we
|
||||
//copy all the child nodes into a new div and get innerHTML from the div
|
||||
var div = document.createElement("div");
|
||||
var temp = root.insertBefore(div,root.firstChild);
|
||||
for (j = temp.nextSibling; j; j = j.nextSibling) {
|
||||
temp.appendChild(j.cloneNode(true));
|
||||
}
|
||||
html += temp.innerHTML.replace(c[23], function(strn) { //skip content inside script tags
|
||||
strn = strn.replace(c[22], function(tag){
|
||||
if(/^<[!\?]/.test(tag)) return tag; //skip comments and php tags
|
||||
else return editor.cleanHTML(tag)});
|
||||
return strn;
|
||||
});
|
||||
|
||||
} else {
|
||||
|
||||
var root_tag = (root.nodeType == 1) ? root.tagName.toLowerCase() : '';
|
||||
if (outputRoot) { //only happens with <html> tag in fullpage mode
|
||||
html += "<" + root_tag;
|
||||
var attrs = root.attributes; // strangely, this doesn't work in moz
|
||||
for (i = 0; i < attrs.length; ++i) {
|
||||
var a = attrs.item(i);
|
||||
if (!a.specified) {
|
||||
continue;
|
||||
}
|
||||
var name = a.nodeName.toLowerCase();
|
||||
var value = a.nodeValue;
|
||||
html += " " + name + '="' + value + '"';
|
||||
}
|
||||
html += ">";
|
||||
}
|
||||
if(root_tag == "html") {
|
||||
innerhtml = editor._doc.documentElement.innerHTML;
|
||||
} else {
|
||||
innerhtml = root.innerHTML;
|
||||
}
|
||||
//pass tags to cleanHTML() one at a time
|
||||
//includes support for htmlRemoveTags config option
|
||||
html += innerhtml.replace(c[23], function(strn) { //skip content inside script tags
|
||||
strn = strn.replace(c[22], function(tag){
|
||||
if(/^<[!\?]/.test(tag)) return tag; //skip comments and php tags
|
||||
else if(!(editor.config.htmlRemoveTags && editor.config.htmlRemoveTags.test(tag.replace(/<([^\s>\/]+)/,'$1'))))
|
||||
return editor.cleanHTML(tag);
|
||||
else return ''});
|
||||
return strn;
|
||||
});
|
||||
//IE drops all </li>,</dt>,</dd> tags in a list except the last one
|
||||
if(Xinha.is_ie) {
|
||||
html = html.replace(/<(li|dd|dt)( [^>]*)?>/g,'</$1><$1$2>').
|
||||
replace(/(<[uod]l[^>]*>[\s\S]*?)<\/(li|dd|dt)>/g, '$1').
|
||||
replace(/\s*<\/(li|dd|dt)>(\s*<\/(li|dd|dt)>)+/g, '</$1>').
|
||||
replace(/(<dt[\s>][\s\S]*?)(<\/d[dt]>)+/g, '$1</dt>');
|
||||
}
|
||||
if(Xinha.is_gecko)
|
||||
html = html.replace(/<br \/>\n$/, ''); //strip trailing <br> added by moz
|
||||
//Cleanup redundant whitespace before </li></dd></dt> in IE and Mozilla
|
||||
html = html.replace(/\s*(<\/(li|dd|dt)>)/g, '$1');
|
||||
if (outputRoot) {
|
||||
html += "</" + root_tag + ">";
|
||||
}
|
||||
html = Xinha.indent(html);
|
||||
};
|
||||
// html = Xinha.htmlEncode(html);
|
||||
|
||||
return html;
|
||||
};
|
||||
|
||||
/**
|
||||
* Escapes dollar signs ($) to make them safe to use in regex replacement functions by replacing each $ in the input with $$.
|
||||
*
|
||||
* This is advisable any time the replacement string for a call to replace() is a variable and could contain dollar signs that should not be interpreted as references to captured groups (e.g., when you want the text "$10" and not the first captured group followed by a 0).
|
||||
* See http://trac.xinha.org/ticket/1337
|
||||
*/
|
||||
Xinha._escapeDollars = function(str) {
|
||||
return str.replace(/\$/g, "$$$$");
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,2 +1,109 @@
|
|||
/* This compressed file is part of Xinha. For uncompressed sources, forum, and bug reports, go to xinha.org */
|
||||
InsertImage._pluginInfo={name:"InsertImage",origin:"Xinha Core",version:"$LastChangedRevision: 1239 $".replace(/^[^:]*:\s*(.*)\s*\$$/,"$1"),developer:"The Xinha Core Developer Team",developer_url:"$HeadURL: http://svn.xinha.org/trunk/modules/InsertImage/insert_image.js $".replace(/^[^:]*:\s*(.*)\s*\$$/,"$1"),sponsor:"",sponsor_url:"",license:"htmlArea"};function InsertImage(c){this.editor=c;var a=c.config;var b=this;if(typeof c._insertImage=="undefined"){c._insertImage=function(){b.show()}}}InsertImage.prototype._lc=function(a){return Xinha._lc(a,"Xinha")};InsertImage.prototype.onGenerateOnce=function(){InsertImage.loadAssets()};InsertImage.loadAssets=function(){var self=InsertImage;if(self.loading){return}self.loading=true;Xinha._getback(_editor_url+"modules/InsertImage/dialog.html",function(getback){self.html=getback;self.dialogReady=true});Xinha._getback(_editor_url+"modules/InsertImage/pluginMethods.js",function(getback){eval(getback);self.methodsReady=true})};InsertImage.prototype.onUpdateToolbar=function(){if(!(InsertImage.dialogReady&&InsertImage.methodsReady)){this.editor._toolbarObjects.insertimage.state("enabled",false)}else{this.onUpdateToolbar=null}};InsertImage.prototype.prepareDialog=function(){var b=this;var a=this.editor;var c=this.dialog=new Xinha.Dialog(a,InsertImage.html,"Xinha",{width:410});c.getElementById("ok").onclick=function(){b.apply()};c.getElementById("cancel").onclick=function(){b.dialog.hide()};c.getElementById("preview").onclick=function(){var d=c.getElementById("f_url");var e=d.value;if(!e){alert(c._lc("You must enter the URL"));d.focus();return false}c.getElementById("ipreview").src=e;return false};this.dialog.onresize=function(){var d=parseInt(this.height,10)-this.getElementById("h1").offsetHeight-this.getElementById("buttons").offsetHeight-this.getElementById("inputs").offsetHeight-parseInt(this.rootElem.style.paddingBottom,10);this.getElementById("ipreview").style.height=((d>0)?d:0)+"px";this.getElementById("ipreview").style.width=this.width-2+"px"};this.dialogReady=true};
|
||||
/*--------------------------------------:noTabs=true:tabSize=2:indentSize=2:--
|
||||
-- Xinha (is not htmlArea) - http://xinha.org
|
||||
--
|
||||
-- Use of Xinha is granted by the terms of the htmlArea License (based on
|
||||
-- BSD license) please read license.txt in this package for details.
|
||||
--
|
||||
-- Copyright (c) 2005-2008 Xinha Developer Team and contributors
|
||||
--
|
||||
-- This is the Xinha standard implementation of an image insertion plugin
|
||||
--
|
||||
-- he file is loaded as a special plugin by the Xinha Core when no alternative method (plugin) is loaded.
|
||||
--
|
||||
--
|
||||
-- $HeadURL: http://svn.xinha.org/trunk/modules/InsertImage/insert_image.js $
|
||||
-- $LastChangedDate: 2010-02-18 15:14:45 +1300 (Thu, 18 Feb 2010) $
|
||||
-- $LastChangedRevision: 1239 $
|
||||
-- $LastChangedBy: gogo $
|
||||
--------------------------------------------------------------------------*/
|
||||
|
||||
InsertImage._pluginInfo = {
|
||||
name : "InsertImage",
|
||||
origin : "Xinha Core",
|
||||
version : "$LastChangedRevision: 1239 $".replace(/^[^:]*:\s*(.*)\s*\$$/, '$1'),
|
||||
developer : "The Xinha Core Developer Team",
|
||||
developer_url : "$HeadURL: http://svn.xinha.org/trunk/modules/InsertImage/insert_image.js $".replace(/^[^:]*:\s*(.*)\s*\$$/, '$1'),
|
||||
sponsor : "",
|
||||
sponsor_url : "",
|
||||
license : "htmlArea"
|
||||
};
|
||||
|
||||
function InsertImage(editor) {
|
||||
this.editor = editor;
|
||||
var cfg = editor.config;
|
||||
var self = this;
|
||||
|
||||
|
||||
if(typeof editor._insertImage == 'undefined')
|
||||
{
|
||||
editor._insertImage = function() { self.show(); };
|
||||
// editor.config.btnList.insertimage[3] = function() { self.show(); }
|
||||
}
|
||||
}
|
||||
|
||||
InsertImage.prototype._lc = function(string) {
|
||||
return Xinha._lc(string, 'Xinha');
|
||||
};
|
||||
|
||||
InsertImage.prototype.onGenerateOnce = function()
|
||||
{
|
||||
InsertImage.loadAssets();
|
||||
};
|
||||
|
||||
InsertImage.loadAssets = function()
|
||||
{
|
||||
var self = InsertImage;
|
||||
if (self.loading) return;
|
||||
self.loading = true;
|
||||
Xinha._getback(_editor_url + 'modules/InsertImage/dialog.html', function(getback) { self.html = getback; self.dialogReady = true; });
|
||||
Xinha._getback(_editor_url + 'modules/InsertImage/pluginMethods.js', function(getback) { eval(getback); self.methodsReady = true; });
|
||||
};
|
||||
InsertImage.prototype.onUpdateToolbar = function()
|
||||
{
|
||||
if (!(InsertImage.dialogReady && InsertImage.methodsReady))
|
||||
{
|
||||
this.editor._toolbarObjects.insertimage.state("enabled", false);
|
||||
}
|
||||
else this.onUpdateToolbar = null;
|
||||
};
|
||||
|
||||
InsertImage.prototype.prepareDialog = function()
|
||||
{
|
||||
var self = this;
|
||||
var editor = this.editor;
|
||||
|
||||
var dialog = this.dialog = new Xinha.Dialog(editor, InsertImage.html, 'Xinha',{width:410})
|
||||
// Connect the OK and Cancel buttons
|
||||
dialog.getElementById('ok').onclick = function() {self.apply();}
|
||||
|
||||
dialog.getElementById('cancel').onclick = function() { self.dialog.hide()};
|
||||
|
||||
dialog.getElementById('preview').onclick = function() {
|
||||
var f_url = dialog.getElementById("f_url");
|
||||
var url = f_url.value;
|
||||
|
||||
if (!url) {
|
||||
alert(dialog._lc("You must enter the URL"));
|
||||
f_url.focus();
|
||||
return false;
|
||||
}
|
||||
dialog.getElementById('ipreview').src = url;
|
||||
return false;
|
||||
}
|
||||
this.dialog.onresize = function ()
|
||||
{
|
||||
var newHeightForPreview =
|
||||
parseInt(this.height,10)
|
||||
- this.getElementById('h1').offsetHeight
|
||||
- this.getElementById('buttons').offsetHeight
|
||||
- this.getElementById('inputs').offsetHeight
|
||||
- parseInt(this.rootElem.style.paddingBottom,10); // we have a padding at the bottom, gotta take this into acount
|
||||
|
||||
|
||||
this.getElementById("ipreview").style.height = ((newHeightForPreview > 0) ? newHeightForPreview : 0) + "px"; // no-go beyond 0
|
||||
|
||||
this.getElementById("ipreview").style.width = this.width - 2 + 'px'; // and the width
|
||||
|
||||
}
|
||||
this.dialogReady = true;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,2 +1,152 @@
|
|||
/* This compressed file is part of Xinha. For uncompressed sources, forum, and bug reports, go to xinha.org */
|
||||
InsertImage.prototype.show=function(c){if(!this.dialog){this.prepareDialog()}var b=this.editor;if(typeof c=="undefined"){c=b.getParentElement();if(c&&c.tagName.toLowerCase()!="img"){c=null}}if(c){function a(e,g){var d=e.attributes;for(var f=0;f<d.length;f++){if(d[f].nodeName==g&&d[f].specified){return d[f].value}}return""}outparam={f_url:b.stripBaseURL(c.getAttribute("src",2)),f_alt:c.alt,f_border:c.border,f_align:c.align,f_vert:a(c,"vspace"),f_horiz:a(c,"hspace"),f_width:c.width,f_height:c.height}}else{outparam={f_url:"",f_alt:"",f_border:"",f_align:"",f_vert:"",f_horiz:"",f_width:"",f_height:""}}this.image=c;this.dialog.show(outparam)};InsertImage.prototype.apply=function(){var g=this.dialog.hide();if(!g.f_url){return}var c=this.editor;var b=this.image;if(!b){if(Xinha.is_ie){var e=c.getSelection();var a=c.createRange(e);c._doc.execCommand("insertimage",false,g.f_url);b=a.parentElement();if(b.tagName.toLowerCase()!="img"){b=b.previousSibling}}else{b=document.createElement("img");b.src=g.f_url;c.insertNodeAtSelection(b);if(!b.tagName){b=a.startContainer.firstChild}}}else{b.src=g.f_url}for(var f in g){var d=g[f];switch(f){case"f_alt":if(d){b.alt=d}else{b.removeAttribute("alt")}break;case"f_border":if(d){b.border=parseInt(d||"0")}else{b.removeAttribute("border")}break;case"f_align":if(d.value){b.align=d.value}else{b.removeAttribute("align")}break;case"f_vert":if(d!=""){b.vspace=parseInt(d||"0")}else{b.removeAttribute("vspace")}break;case"f_horiz":if(d!=""){b.hspace=parseInt(d||"0")}else{b.removeAttribute("hspace")}break;case"f_width":if(d){b.width=parseInt(d||"0")}else{b.removeAttribute("width")}break;case"f_height":if(d){b.height=parseInt(d||"0")}else{b.removeAttribute("height")}break}}};
|
||||
InsertImage.prototype.show = function(image)
|
||||
{
|
||||
if (!this.dialog) this.prepareDialog();
|
||||
|
||||
var editor = this.editor;
|
||||
if ( typeof image == "undefined" )
|
||||
{
|
||||
image = editor.getParentElement();
|
||||
if ( image && image.tagName.toLowerCase() != 'img' )
|
||||
{
|
||||
image = null;
|
||||
}
|
||||
}
|
||||
|
||||
if ( image )
|
||||
{
|
||||
function getSpecifiedAttribute(element,attribute)
|
||||
{
|
||||
var a = element.attributes;
|
||||
for (var i=0;i<a.length;i++)
|
||||
{
|
||||
if (a[i].nodeName == attribute && a[i].specified)
|
||||
{
|
||||
return a[i].value;
|
||||
}
|
||||
}
|
||||
return '';
|
||||
}
|
||||
outparam =
|
||||
{
|
||||
f_url : editor.stripBaseURL(image.getAttribute('src',2)), // the second parameter makes IE return the value as it is set, as opposed to an "interpolated" (as MSDN calls it) value
|
||||
f_alt : image.alt,
|
||||
f_border : image.border,
|
||||
f_align : image.align,
|
||||
f_vert : getSpecifiedAttribute(image,'vspace'),
|
||||
f_horiz : getSpecifiedAttribute(image,'hspace'),
|
||||
f_width : image.width,
|
||||
f_height : image.height
|
||||
};
|
||||
}
|
||||
else{
|
||||
{
|
||||
outparam =
|
||||
{
|
||||
f_url : '',
|
||||
f_alt : '',
|
||||
f_border : '',
|
||||
f_align : '',
|
||||
f_vert : '',
|
||||
f_horiz : '',
|
||||
f_width : '',
|
||||
f_height : ''
|
||||
};
|
||||
}
|
||||
}
|
||||
this.image = image;
|
||||
// now calling the show method of the Xinha.Dialog object to set the values and show the actual dialog
|
||||
this.dialog.show(outparam);
|
||||
};
|
||||
|
||||
// and finally ... take some action
|
||||
InsertImage.prototype.apply = function()
|
||||
{
|
||||
var param = this.dialog.hide();
|
||||
if (!param.f_url)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var editor = this.editor;
|
||||
var img = this.image;
|
||||
if ( !img )
|
||||
{
|
||||
if ( Xinha.is_ie )
|
||||
{
|
||||
var sel = editor.getSelection();
|
||||
var range = editor.createRange(sel);
|
||||
editor._doc.execCommand("insertimage", false, param.f_url);
|
||||
img = range.parentElement();
|
||||
// wonder if this works...
|
||||
if ( img.tagName.toLowerCase() != "img" )
|
||||
{
|
||||
img = img.previousSibling;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
img = document.createElement('img');
|
||||
img.src = param.f_url;
|
||||
editor.insertNodeAtSelection(img);
|
||||
if ( !img.tagName )
|
||||
{
|
||||
// if the cursor is at the beginning of the document
|
||||
img = range.startContainer.firstChild;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
img.src = param.f_url;
|
||||
}
|
||||
|
||||
for ( var field in param )
|
||||
{
|
||||
var value = param[field];
|
||||
switch (field)
|
||||
{
|
||||
case "f_alt":
|
||||
if (value)
|
||||
img.alt = value;
|
||||
else
|
||||
img.removeAttribute("alt");
|
||||
break;
|
||||
case "f_border":
|
||||
if (value)
|
||||
img.border = parseInt(value || "0");
|
||||
else
|
||||
img.removeAttribute("border");
|
||||
break;
|
||||
case "f_align":
|
||||
if (value.value)
|
||||
img.align = value.value;
|
||||
else
|
||||
img.removeAttribute("align");
|
||||
break;
|
||||
case "f_vert":
|
||||
if (value != "")
|
||||
img.vspace = parseInt(value || "0");
|
||||
else
|
||||
img.removeAttribute("vspace");
|
||||
break;
|
||||
case "f_horiz":
|
||||
if (value != "")
|
||||
img.hspace = parseInt(value || "0");
|
||||
else
|
||||
img.removeAttribute("hspace");
|
||||
break;
|
||||
case "f_width":
|
||||
if (value)
|
||||
img.width = parseInt(value || "0");
|
||||
else
|
||||
img.removeAttribute("width");
|
||||
break;
|
||||
case "f_height":
|
||||
if (value)
|
||||
img.height = parseInt(value || "0");
|
||||
else
|
||||
img.removeAttribute("height");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,2 +1,90 @@
|
|||
/* This compressed file is part of Xinha. For uncompressed sources, forum, and bug reports, go to xinha.org */
|
||||
InsertTable._pluginInfo={name:"InsertTable",origin:"Xinha Core",version:"$LastChangedRevision: 1085 $".replace(/^[^:]*:\s*(.*)\s*\$$/,"$1"),developer:"The Xinha Core Developer Team",developer_url:"$HeadURL: http://svn.xinha.org/trunk/modules/InsertTable/insert_table.js $".replace(/^[^:]*:\s*(.*)\s*\$$/,"$1"),sponsor:"",sponsor_url:"",license:"htmlArea"};function InsertTable(c){this.editor=c;var a=c.config;var b=this;c.config.btnList.inserttable[3]=function(){b.show()}}InsertTable.prototype._lc=function(a){return Xinha._lc(a,"Xinha")};InsertTable.prototype.onGenerateOnce=function(){InsertTable.loadAssets()};InsertTable.loadAssets=function(){var self=InsertTable;if(self.loading){return}self.loading=true;Xinha._getback(_editor_url+"modules/InsertTable/dialog.html",function(getback){self.html=getback;self.dialogReady=true});Xinha._getback(_editor_url+"modules/InsertTable/pluginMethods.js",function(getback){eval(getback);self.methodsReady=true})};InsertTable.prototype.onUpdateToolbar=function(){if(!(InsertTable.dialogReady&&InsertTable.methodsReady)){this.editor._toolbarObjects.inserttable.state("enabled",false)}else{this.onUpdateToolbar=null}};InsertTable.prototype.prepareDialog=function(){var b=this;var a=this.editor;var c=this.dialog=new Xinha.Dialog(a,InsertTable.html,"Xinha",{width:400});c.getElementById("ok").onclick=function(){b.apply()};c.getElementById("cancel").onclick=function(){b.dialog.hide()};this.borderColorPicker=new Xinha.colorPicker.InputBinding(c.getElementById("border_color"));this.dialog.onresize=function(){this.getElementById("layout_fieldset").style.width=(this.width/2)+50+"px";this.getElementById("spacing_fieldset").style.width=(this.width/2)-120+"px"};this.dialogReady=true};
|
||||
|
||||
/*--------------------------------------:noTabs=true:tabSize=2:indentSize=2:--
|
||||
-- Xinha (is not htmlArea) - http://xinha.org
|
||||
--
|
||||
-- Use of Xinha is granted by the terms of the htmlArea License (based on
|
||||
-- BSD license) please read license.txt in this package for details.
|
||||
--
|
||||
-- Copyright (c) 2005-2008 Xinha Developer Team and contributors
|
||||
--
|
||||
-- Xinha was originally based on work by Mihai Bazon which is:
|
||||
-- Copyright (c) 2003-2004 dynarch.com.
|
||||
-- Copyright (c) 2002-2003 interactivetools.com, inc.
|
||||
-- This copyright notice MUST stay intact for use.
|
||||
--
|
||||
-- This is the Xinha standard implementation of a table insertion plugin
|
||||
--
|
||||
-- The file is loaded by the Xinha Core when no alternative method (plugin) is loaded.
|
||||
--
|
||||
--
|
||||
-- $HeadURL: http://svn.xinha.org/trunk/modules/InsertTable/insert_table.js $
|
||||
-- $LastChangedDate: 2008-10-13 06:52:26 +1300 (Mon, 13 Oct 2008) $
|
||||
-- $LastChangedRevision: 1085 $
|
||||
-- $LastChangedBy: ray $
|
||||
--------------------------------------------------------------------------*/
|
||||
InsertTable._pluginInfo = {
|
||||
name : "InsertTable",
|
||||
origin : "Xinha Core",
|
||||
version : "$LastChangedRevision: 1085 $".replace(/^[^:]*:\s*(.*)\s*\$$/, '$1'),
|
||||
developer : "The Xinha Core Developer Team",
|
||||
developer_url : "$HeadURL: http://svn.xinha.org/trunk/modules/InsertTable/insert_table.js $".replace(/^[^:]*:\s*(.*)\s*\$$/, '$1'),
|
||||
sponsor : "",
|
||||
sponsor_url : "",
|
||||
license : "htmlArea"
|
||||
};
|
||||
|
||||
function InsertTable(editor) {
|
||||
this.editor = editor;
|
||||
var cfg = editor.config;
|
||||
var self = this;
|
||||
|
||||
editor.config.btnList.inserttable[3] = function() { self.show(); }
|
||||
}
|
||||
|
||||
InsertTable.prototype._lc = function(string) {
|
||||
return Xinha._lc(string, 'Xinha');
|
||||
};
|
||||
|
||||
|
||||
InsertTable.prototype.onGenerateOnce = function()
|
||||
{
|
||||
InsertTable.loadAssets();
|
||||
};
|
||||
InsertTable.loadAssets = function()
|
||||
{
|
||||
var self = InsertTable;
|
||||
if (self.loading) return;
|
||||
self.loading = true;
|
||||
Xinha._getback(_editor_url + 'modules/InsertTable/dialog.html', function(getback) { self.html = getback; self.dialogReady = true; });
|
||||
Xinha._getback(_editor_url + 'modules/InsertTable/pluginMethods.js', function(getback) { eval(getback); self.methodsReady = true; });
|
||||
};
|
||||
|
||||
InsertTable.prototype.onUpdateToolbar = function()
|
||||
{
|
||||
if (!(InsertTable.dialogReady && InsertTable.methodsReady))
|
||||
{
|
||||
this.editor._toolbarObjects.inserttable.state("enabled", false);
|
||||
}
|
||||
else this.onUpdateToolbar = null;
|
||||
};
|
||||
|
||||
InsertTable.prototype.prepareDialog = function()
|
||||
{
|
||||
var self = this;
|
||||
var editor = this.editor;
|
||||
|
||||
var dialog = this.dialog = new Xinha.Dialog(editor, InsertTable.html, 'Xinha',{width:400})
|
||||
// Connect the OK and Cancel buttons
|
||||
dialog.getElementById('ok').onclick = function() {self.apply();}
|
||||
dialog.getElementById('cancel').onclick = function() { self.dialog.hide()};
|
||||
|
||||
this.borderColorPicker = new Xinha.colorPicker.InputBinding(dialog.getElementById('border_color'));
|
||||
|
||||
this.dialog.onresize = function ()
|
||||
{
|
||||
this.getElementById("layout_fieldset").style.width =(this.width / 2) + 50 + 'px';
|
||||
this.getElementById("spacing_fieldset").style.width =(this.width / 2) - 120 + 'px';
|
||||
}
|
||||
|
||||
this.dialogReady = true;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,2 +1,118 @@
|
|||
/* This compressed file is part of Xinha. For uncompressed sources, forum, and bug reports, go to xinha.org */
|
||||
InsertTable.prototype.show=function(c){if(!this.dialog){this.prepareDialog()}var a=this.editor;var b={caption:"",rows:"2",cols:"4",width:"100",unit:"%",fixed:"",align:"",border:"1",border_style:"dotted",border_color:"#000000",border_collapse:"on",spacing:"",padding:"5"};this.borderColorPicker.setColor("#000000");this.dialog.show(b);this.dialog.onresize()};InsertTable.prototype.apply=function(){var a=this.editor;var m=a._doc;var b=this.dialog.getValues();if(!b.rows||!b.cols){if(!b.rows){this.dialog.getElementById("rows_alert").style.display=""}if(!b.cols){this.dialog.getElementById("columns_alert").style.display=""}return}this.dialog.hide();var o=m.createElement("table");for(var k in b){var l=b[k];if(!l){continue}switch(k){case"width":o.style.width=l+b.unit.value;break;case"align":o.align=l.value;break;case"border":o.style.border=l+"px "+b.border_style.value+" "+b.border_color;break;case"border_collapse":o.style.borderCollapse=(l=="on")?"collapse":"";break;case"spacing":o.cellSpacing=parseInt(l,10);break;case"padding":o.cellPadding=parseInt(l,10);break}}if(b.caption){var n=o.createCaption();n.appendChild(m.createTextNode(b.caption))}var g=0;if(b.fixed){g=Math.floor(100/parseInt(b.cols,10))}var f=m.createElement("tbody");o.appendChild(f);for(var e=0;e<b.rows;++e){var h=m.createElement("tr");f.appendChild(h);for(var d=0;d<b.cols;++d){var c=m.createElement("td");if(g&&e===0){c.style.width=g+"%"}if(b.border){c.style.border=b.border+"px "+b.border_style.value+" "+b.border_color}h.appendChild(c);c.appendChild(m.createTextNode("\u00a0"))}}a.insertNodeAtSelection(o)};
|
||||
InsertTable.prototype.show = function(image)
|
||||
{
|
||||
if (!this.dialog) this.prepareDialog();
|
||||
|
||||
var editor = this.editor;
|
||||
|
||||
var values =
|
||||
{
|
||||
"caption" : '',
|
||||
"rows" : '2',
|
||||
"cols" : '4',
|
||||
"width" : '100',
|
||||
"unit" : '%',
|
||||
"fixed" : '',
|
||||
"align" : '',
|
||||
"border" : '1',
|
||||
"border_style" : 'dotted',
|
||||
"border_color" : '#000000',
|
||||
"border_collapse" : 'on',
|
||||
"spacing" : '',
|
||||
"padding" : '5'
|
||||
}
|
||||
// update the color of the picker manually
|
||||
this.borderColorPicker.setColor('#000000');
|
||||
// now calling the show method of the Xinha.Dialog object to set the values and show the actual dialog
|
||||
this.dialog.show(values);
|
||||
this.dialog.onresize();
|
||||
};
|
||||
|
||||
InsertTable.prototype.apply = function()
|
||||
{
|
||||
var editor = this.editor;
|
||||
var doc = editor._doc;
|
||||
var param = this.dialog.getValues();
|
||||
|
||||
if (!param.rows || !param.cols)
|
||||
{
|
||||
if (!param.rows)
|
||||
{
|
||||
this.dialog.getElementById("rows_alert").style.display = '';
|
||||
}
|
||||
if (!param.cols)
|
||||
{
|
||||
this.dialog.getElementById("columns_alert").style.display = '';
|
||||
}
|
||||
return;
|
||||
}
|
||||
// selection is only restored on dialog.hide()
|
||||
this.dialog.hide();
|
||||
// create the table element
|
||||
var table = doc.createElement("table");
|
||||
// assign the given arguments
|
||||
|
||||
for ( var field in param )
|
||||
{
|
||||
var value = param[field];
|
||||
if ( !value )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
switch (field)
|
||||
{
|
||||
case "width":
|
||||
table.style.width = value + param.unit.value;
|
||||
break;
|
||||
case "align":
|
||||
table.align = value.value;
|
||||
break;
|
||||
case "border":
|
||||
table.style.border = value + 'px ' + param.border_style.value + ' ' + param.border_color;
|
||||
break;
|
||||
case "border_collapse":
|
||||
table.style.borderCollapse = (value == 'on') ? 'collapse' : '' ;
|
||||
break;
|
||||
case "spacing":
|
||||
table.cellSpacing = parseInt(value, 10);
|
||||
break;
|
||||
case "padding":
|
||||
table.cellPadding = parseInt(value, 10);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (param.caption)
|
||||
{
|
||||
var caption = table.createCaption();
|
||||
caption.appendChild(doc.createTextNode(param.caption));
|
||||
}
|
||||
var cellwidth = 0;
|
||||
if ( param.fixed )
|
||||
{
|
||||
cellwidth = Math.floor(100 / parseInt(param.cols, 10));
|
||||
}
|
||||
var tbody = doc.createElement("tbody");
|
||||
table.appendChild(tbody);
|
||||
for ( var i = 0; i < param.rows; ++i )
|
||||
{
|
||||
var tr = doc.createElement("tr");
|
||||
tbody.appendChild(tr);
|
||||
for ( var j = 0; j < param.cols; ++j )
|
||||
{
|
||||
var td = doc.createElement("td");
|
||||
// @todo : check if this line doesnt stop us to use pixel width in cells
|
||||
if (cellwidth && i===0)
|
||||
{
|
||||
td.style.width = cellwidth + "%";
|
||||
}
|
||||
if (param.border)
|
||||
{
|
||||
td.style.border = param.border + 'px ' + param.border_style.value + ' ' + param.border_color;
|
||||
}
|
||||
tr.appendChild(td);
|
||||
// Browsers like to see something inside the cell ( ).
|
||||
td.appendChild(doc.createTextNode('\u00a0'));
|
||||
}
|
||||
}
|
||||
// insert the table
|
||||
editor.insertNodeAtSelection(table);
|
||||
};
|
||||
|
|
@ -1,2 +1,153 @@
|
|||
/* This compressed file is part of Xinha. For uncompressed sources, forum, and bug reports, go to xinha.org */
|
||||
function Abbreviation(c){this.editor=c;var a=c.config;var b=this;a.registerButton({id:"abbreviation",tooltip:Xinha._lc("Abbreviation","Abbreviation"),image:c.imgURL("ed_abbreviation.gif","Abbreviation"),textMode:false,action:function(d){b.show()}});a.addToolbarElement("abbreviation","inserthorizontalrule",1)}Abbreviation._pluginInfo={name:"Abbreviation",version:"1.0",developer:"Udo Schmal",developer_url:"",sponsor:"L.N.Schaffrath NeueMedien",sponsor_url:"http://www.schaffrath-neuemedien.de/",c_owner:"Udo Schmal & Schaffrath-NeueMedien",license:"htmlArea"};Abbreviation.prototype.fillText=function(){var editor=this.editor;var text=this.html.toUpperCase();var abbr=Xinha.getPluginDir(this.constructor.name)+"/abbr/"+_editor_lang+".js";var abbrData=Xinha._geturlcontent(abbr);if(abbrData){eval("abbrObj = "+abbrData);if(abbrObj!=""){var dest=this.dialog.getElementById("title");dest.value=this.title||"";for(var i in abbrObj){same=(i.toUpperCase()==text);if(same){dest.value=abbrObj[i]}}}}};Abbreviation.prototype.onGenerateOnce=function(b){this.editor.addEditorStylesheet(Xinha.getPluginDir("Abbreviation")+"/abbreviation.css");this.methodsReady=true;var a=Abbreviation;Xinha._getback(Xinha.getPluginDir("Abbreviation")+"/dialog.html",function(c){a.html=c;a.dialogReady=true})};Abbreviation.prototype.OnUpdateToolbar=function(a){if(!(Abbreviation.dialogReady&&Abbreviation.methodsReady)){this.editor._toolbarObjects.Abbreviation.state("enabled",false)}else{this.onUpdateToolbar=null}};Abbreviation.prototype.prepareDialog=function(d){var b=this;var a=this.editor;var c=this.dialog=new Xinha.Dialog(a,Abbreviation.html,"Xinha",{width:260,height:140});c.getElementById("ok").onclick=function(){b.apply()};c.getElementById("delete").onclick=function(){b.ondelete()};c.getElementById("cancel").onclick=function(){b.dialog.hide()};this.dialogReady=true};Abbreviation.prototype.show=function(c){var c=this.editor;this.html=c.getSelectedHTML();if(!this.dialog){this.prepareDialog()}var b=this;var f=c._doc;var e=c._getSelection();var a=c._createRange(e);var d=c._activeElement(e);if(!(d!=null&&d.tagName.toLowerCase()=="abbr")){d=c._getFirstAncestor(e,"abbr")}this.abbr=d;if(d){this.title=d.title}this.fillText();this.dialog.getElementById("inputs").onsubmit=function(){b.apply();return false};this.dialog.show();this.dialog.getElementById("title").select()};Abbreviation.prototype.apply=function(){var a=this.editor;var f=a._doc;var b=this.abbr;var c=this.html;var h=this.dialog.hide();if(h){var g=h.title;if(g==""||g==null){if(b){var i=b.innerHTML;b.parentNode.removeChild(b);a.insertHTML(i)}return}try{if(!b){b=f.createElement("abbr");b.title=g;b.innerHTML=c;if(Xinha.is_ie){range.pasteHTML(b.outerHTML)}else{a.insertNodeAtSelection(b)}}else{b.title=g}}catch(d){}}};Abbreviation.prototype.ondelete=function(){this.dialog.getElementById("title").value="";this.apply()};
|
||||
// Abbreviation plugin for Xinha
|
||||
// Implementation by Udo Schmal & Schaffrath NeueMedien
|
||||
// Original Author - Udo Schmal
|
||||
//
|
||||
// (c) Udo Schmal & Schaffrath NeueMedien 2004
|
||||
// Distributed under the same terms as HTMLArea itself.
|
||||
// This notice MUST stay intact for use (see license.txt).
|
||||
|
||||
function Abbreviation(editor) {
|
||||
this.editor = editor;
|
||||
var cfg = editor.config;
|
||||
var self = this;
|
||||
|
||||
// register the toolbar buttons provided by this plugin
|
||||
cfg.registerButton({
|
||||
id : "abbreviation",
|
||||
tooltip : Xinha._lc("Abbreviation", "Abbreviation"),
|
||||
image : editor.imgURL("ed_abbreviation.gif", "Abbreviation"),
|
||||
textMode : false,
|
||||
action : function(editor) {
|
||||
self.show();
|
||||
}
|
||||
});
|
||||
cfg.addToolbarElement("abbreviation", "inserthorizontalrule", 1);
|
||||
}
|
||||
|
||||
Abbreviation._pluginInfo = {
|
||||
name : "Abbreviation",
|
||||
version : "1.0",
|
||||
developer : "Udo Schmal",
|
||||
developer_url : "",
|
||||
sponsor : "L.N.Schaffrath NeueMedien",
|
||||
sponsor_url : "http://www.schaffrath-neuemedien.de/",
|
||||
c_owner : "Udo Schmal & Schaffrath-NeueMedien",
|
||||
license : "htmlArea"
|
||||
};
|
||||
|
||||
// Fills in the text field if the acronym is either known (i.e., in the [lang].js file)
|
||||
// or if we're editing an existing abbreviation.
|
||||
Abbreviation.prototype.fillText = function() {
|
||||
var editor = this.editor;
|
||||
var text = this.html.toUpperCase();
|
||||
var abbr = Xinha.getPluginDir(this.constructor.name) + "/abbr/" + _editor_lang + ".js";
|
||||
var abbrData = Xinha._geturlcontent(abbr);
|
||||
|
||||
if (abbrData) {
|
||||
eval('abbrObj = ' + abbrData);
|
||||
if (abbrObj != "") {
|
||||
var dest = this.dialog.getElementById("title");
|
||||
dest.value = this.title || "";
|
||||
for (var i in abbrObj) {
|
||||
same = (i.toUpperCase()==text);
|
||||
if (same)
|
||||
dest.value = abbrObj[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Abbreviation.prototype.onGenerateOnce = function(editor) {
|
||||
this.editor.addEditorStylesheet(Xinha.getPluginDir('Abbreviation') + '/abbreviation.css');
|
||||
this.methodsReady = true; //remove this?
|
||||
var self = Abbreviation;
|
||||
Xinha._getback(Xinha.getPluginDir('Abbreviation') + '/dialog.html', function(getback) { self.html = getback; self.dialogReady = true; });
|
||||
};
|
||||
|
||||
Abbreviation.prototype.OnUpdateToolbar = function(editor) {
|
||||
if (!(Abbreviation.dialogReady && Abbreviation.methodsReady))
|
||||
{
|
||||
this.editor._toolbarObjects.Abbreviation.state("enabled", false);
|
||||
}
|
||||
else this.onUpdateToolbar = null;
|
||||
}
|
||||
|
||||
Abbreviation.prototype.prepareDialog = function(html) {
|
||||
var self = this;
|
||||
var editor = this.editor;
|
||||
var dialog = this.dialog = new Xinha.Dialog(editor, Abbreviation.html, 'Xinha', {width: 260, height:140});
|
||||
|
||||
dialog.getElementById('ok').onclick = function() { self.apply(); };
|
||||
dialog.getElementById('delete').onclick = function() { self.ondelete(); };
|
||||
dialog.getElementById('cancel').onclick = function() { self.dialog.hide(); };
|
||||
|
||||
this.dialogReady = true;
|
||||
}
|
||||
|
||||
Abbreviation.prototype.show = function(editor) {
|
||||
var editor = this.editor;
|
||||
this.html = editor.getSelectedHTML();
|
||||
if (!this.dialog) this.prepareDialog();
|
||||
var self = this;
|
||||
var doc = editor._doc;
|
||||
var sel = editor._getSelection();
|
||||
var range = editor._createRange(sel);
|
||||
var abbr = editor._activeElement(sel);
|
||||
|
||||
if(!(abbr != null && abbr.tagName.toLowerCase() == "abbr")) {
|
||||
abbr = editor._getFirstAncestor(sel, 'abbr');
|
||||
}
|
||||
this.abbr = abbr;
|
||||
|
||||
if (abbr) this.title = abbr.title;
|
||||
this.fillText();
|
||||
|
||||
this.dialog.getElementById("inputs").onsubmit = function() {
|
||||
self.apply();
|
||||
return false;
|
||||
}
|
||||
|
||||
this.dialog.show();
|
||||
this.dialog.getElementById("title").select();
|
||||
}
|
||||
|
||||
Abbreviation.prototype.apply = function() {
|
||||
var editor = this.editor;
|
||||
var doc = editor._doc;
|
||||
var abbr = this.abbr;
|
||||
var html = this.html;
|
||||
var param = this.dialog.hide();
|
||||
|
||||
if ( param ) {
|
||||
var title = param["title"];
|
||||
if (title == "" || title == null) {
|
||||
if (abbr) {
|
||||
var child = abbr.innerHTML;
|
||||
abbr.parentNode.removeChild(abbr);
|
||||
editor.insertHTML(child); // FIX: This doesn't work in Safari 3
|
||||
}
|
||||
return;
|
||||
}
|
||||
try {
|
||||
if (!abbr) {
|
||||
abbr = doc.createElement("abbr");
|
||||
abbr.title = title;
|
||||
abbr.innerHTML = html;
|
||||
if (Xinha.is_ie) {
|
||||
range.pasteHTML(abbr.outerHTML);
|
||||
} else {
|
||||
editor.insertNodeAtSelection(abbr);
|
||||
}
|
||||
} else {
|
||||
abbr.title = title;
|
||||
}
|
||||
}
|
||||
catch (e) { }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Abbreviation.prototype.ondelete = function() {
|
||||
this.dialog.getElementById('title').value = "";
|
||||
this.apply();
|
||||
}
|
||||
|
|
@ -1,2 +1,149 @@
|
|||
/* This compressed file is part of Xinha. For uncompressed sources, forum, and bug reports, go to xinha.org */
|
||||
Xinha.Config.prototype.cssPluginConfig={combos:[{label:"Syntax",options:{None:"",Code:"code",String:"string",Comment:"comment","Variable name":"variable-name",Type:"type",Reference:"reference",Preprocessor:"preprocessor",Keyword:"keyword","Function name":"function-name","Html tag":"html-tag","Html italic":"html-helper-italic",Warning:"warning","Html bold":"html-helper-bold"},context:"pre"},{label:"Info",options:{None:"",Quote:"quote",Highlight:"highlight",Deprecated:"deprecated"}}]};function CSS(b,d){this.editor=b;var g=b.config;var k=this;var e;if(d&&d.length){e=d[0]}else{e=b.config.cssPluginConfig}var h=e.combos;for(var f=0;f<h.length;f++){var c=h[f];var a="CSS-class"+f;var j={id:a,options:c.options,action:function(i){k.onSelect(i,this,c.context,c.updatecontextclass)},refresh:function(i){k.updateValue(i,this)},context:c.context};g.registerDropdown(j);g.addToolbarElement(["T["+c.label+"]",a,"separator"],"formatblock",-1)}}CSS._pluginInfo={name:"CSS",version:"1.0",developer:"Mihai Bazon",developer_url:"http://dynarch.com/mishoo/",c_owner:"Mihai Bazon",sponsor:"Miro International",sponsor_url:"http://www.miro.com.au",license:"htmlArea"};CSS.prototype.onSelect=function(d,e,c,a){var i=d._toolbarObjects[e.id];var f=i.element.selectedIndex;var b=i.element.value;var k=d.getParentElement();var j=true;var h=(k&&k.tagName.toLowerCase()=="span");var g=(c&&a&&k&&k.tagName.toLowerCase()==c);if(g){k.className=b;d.updateToolbar();return}if(h&&f==0&&!/\S/.test(k.style.cssText)){while(k.firstChild){k.parentNode.insertBefore(k.firstChild,k)}k.parentNode.removeChild(k);d.updateToolbar();return}if(h){if(k.childNodes.length==1){k.className=b;j=false;d.updateToolbar()}}if(j){d.surroundHTML("<span class='"+b+"'>","</span>")}};CSS.prototype.updateValue=function(c,h){var g=c._toolbarObjects[h.id].element;var b=c.getParentElement();if(typeof b.className!="undefined"&&/\S/.test(b.className)){var e=g.options;var f=b.className;for(var d=e.length;--d>=0;){var a=e[d];if(f==a.value){g.selectedIndex=d;return}}}g.selectedIndex=0};
|
||||
// Simple CSS (className) plugin for the editor
|
||||
// Sponsored by http://www.miro.com.au
|
||||
// Implementation by Mihai Bazon, http://dynarch.com/mishoo.
|
||||
//
|
||||
// (c) dynarch.com 2003
|
||||
// Distributed under the same terms as HTMLArea itself.
|
||||
// This notice MUST stay intact for use (see license.txt).
|
||||
//
|
||||
// $Id: CSS.js 1084 2008-10-12 17:42:42Z ray $
|
||||
// @TODO This is the default and won't be very useful to others.
|
||||
// We should make this better.
|
||||
Xinha.Config.prototype.cssPluginConfig =
|
||||
{
|
||||
combos : [
|
||||
{ label: "Syntax",
|
||||
// menu text // CSS class
|
||||
options: { "None" : "",
|
||||
"Code" : "code",
|
||||
"String" : "string",
|
||||
"Comment" : "comment",
|
||||
"Variable name" : "variable-name",
|
||||
"Type" : "type",
|
||||
"Reference" : "reference",
|
||||
"Preprocessor" : "preprocessor",
|
||||
"Keyword" : "keyword",
|
||||
"Function name" : "function-name",
|
||||
"Html tag" : "html-tag",
|
||||
"Html italic" : "html-helper-italic",
|
||||
"Warning" : "warning",
|
||||
"Html bold" : "html-helper-bold"
|
||||
},
|
||||
context: "pre"
|
||||
},
|
||||
{ label: "Info",
|
||||
options: { "None" : "",
|
||||
"Quote" : "quote",
|
||||
"Highlight" : "highlight",
|
||||
"Deprecated" : "deprecated"
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
function CSS(editor, params) {
|
||||
this.editor = editor;
|
||||
var cfg = editor.config;
|
||||
var self = this;
|
||||
var plugin_config;
|
||||
if(params && params.length)
|
||||
{
|
||||
plugin_config = params[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
plugin_config = editor.config.cssPluginConfig;
|
||||
}
|
||||
|
||||
var combos = plugin_config.combos;
|
||||
|
||||
for (var i = 0; i < combos.length; i++) {
|
||||
var combo = combos[i];
|
||||
var id = "CSS-class" + i;
|
||||
var css_class = {
|
||||
id : id,
|
||||
options : combo.options,
|
||||
action : function(editor) { self.onSelect(editor, this, combo.context, combo.updatecontextclass); },
|
||||
refresh : function(editor) { self.updateValue(editor, this); },
|
||||
context : combo.context
|
||||
};
|
||||
cfg.registerDropdown(css_class);
|
||||
cfg.addToolbarElement(["T[" + combo.label + "]", id, "separator"] , "formatblock", -1);
|
||||
}
|
||||
}
|
||||
|
||||
CSS._pluginInfo = {
|
||||
name : "CSS",
|
||||
version : "1.0",
|
||||
developer : "Mihai Bazon",
|
||||
developer_url : "http://dynarch.com/mishoo/",
|
||||
c_owner : "Mihai Bazon",
|
||||
sponsor : "Miro International",
|
||||
sponsor_url : "http://www.miro.com.au",
|
||||
license : "htmlArea"
|
||||
};
|
||||
|
||||
CSS.prototype.onSelect = function(editor, obj, context, updatecontextclass) {
|
||||
var tbobj = editor._toolbarObjects[obj.id];
|
||||
var index = tbobj.element.selectedIndex;
|
||||
var className = tbobj.element.value;
|
||||
|
||||
// retrieve parent element of the selection
|
||||
var parent = editor.getParentElement();
|
||||
var surround = true;
|
||||
|
||||
var is_span = (parent && parent.tagName.toLowerCase() == "span");
|
||||
var update_parent = (context && updatecontextclass && parent && parent.tagName.toLowerCase() == context);
|
||||
|
||||
if (update_parent) {
|
||||
parent.className = className;
|
||||
editor.updateToolbar();
|
||||
return;
|
||||
}
|
||||
|
||||
if (is_span && index == 0 && !/\S/.test(parent.style.cssText)) {
|
||||
while (parent.firstChild) {
|
||||
parent.parentNode.insertBefore(parent.firstChild, parent);
|
||||
}
|
||||
parent.parentNode.removeChild(parent);
|
||||
editor.updateToolbar();
|
||||
return;
|
||||
}
|
||||
|
||||
if (is_span) {
|
||||
// maybe we could simply change the class of the parent node?
|
||||
if (parent.childNodes.length == 1) {
|
||||
parent.className = className;
|
||||
surround = false;
|
||||
// in this case we should handle the toolbar updation
|
||||
// ourselves.
|
||||
editor.updateToolbar();
|
||||
}
|
||||
}
|
||||
|
||||
// Other possibilities could be checked but require a lot of code. We
|
||||
// can't afford to do that now.
|
||||
if (surround) {
|
||||
// shit happens ;-) most of the time. this method works, but
|
||||
// it's dangerous when selection spans multiple block-level
|
||||
// elements.
|
||||
editor.surroundHTML("<span class='" + className + "'>", "</span>");
|
||||
}
|
||||
};
|
||||
|
||||
CSS.prototype.updateValue = function(editor, obj) {
|
||||
var select = editor._toolbarObjects[obj.id].element;
|
||||
var parent = editor.getParentElement();
|
||||
if (typeof parent.className != "undefined" && /\S/.test(parent.className)) {
|
||||
var options = select.options;
|
||||
var value = parent.className;
|
||||
for (var i = options.length; --i >= 0;) {
|
||||
var option = options[i];
|
||||
if (value == option.value) {
|
||||
select.selectedIndex = i;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
select.selectedIndex = 0;
|
||||
};
|
||||
|
|
@ -1,2 +1,167 @@
|
|||
/* This compressed file is part of Xinha. For uncompressed sources, forum, and bug reports, go to xinha.org */
|
||||
function CSSPicker(a,b){this.editor=a;var c=this}CSSPicker._pluginInfo={name:"CSSPicker",version:"2008-12-01",author:"Justin Rovang"};CSSPicker.prototype.onGenerateOnce=function(){var a=this.editor;var b=this;a._cssPicker=a.addPanel("right");this.main=document.createElement("div");a._cssPicker.style.backgroundColor="#dee5f8";a._cssPicker.appendChild(this.main);Xinha.freeLater(this,"main");a.showPanel(a._cssPicker)};CSSPicker.prototype.onUpdateToolbar=function(){if(this.editor._cssPicker){if(this._timeoutID){window.clearTimeout(this._timeoutID)}var a=this.editor;this._timeoutID=window.setTimeout(function(){a._gen()},250)}};Xinha.prototype.listStyles=function(c){var a=this;var e=this.getSelection();var g;if(Xinha.is_ie){g=this.saveSelection();e=this.createRange(e).text}var f=document.createElement("div");f.className="CSSPickerOption";var b=a.getStyleInfo(c);if(b){Xinha._addClass(f,"CSSPickerOptionActive")}f.align="center";f.innerHTML='<div class="'+c+'">'+CSSPicker.cssList[c].name+"</div>";f.onclick=function(){a.wrapStyle(c,e,g,CSSPicker.cssList[c].wrapper);return false};Xinha._addEvent(f,"mouseover",function(d){Xinha._addClass(f,"CSSPickerOptionOver")});Xinha._addEvent(f,"mouseout",function(d){Xinha._removeClass(f,"CSSPickerOptionOver")});return f};Xinha.prototype._gen=function(){this.plugins.CSSPicker.instance.main.innerHTML="";for(var a in CSSPicker.cssList){this.plugins.CSSPicker.instance.main.appendChild(this.listStyles(a))}return true};Xinha.prototype.wrapStyle=function(d,e,g,f){if(!f){f="div"}f=f.toLowerCase();var a="";if(f=="div"){a="<br/>"}var b=this;this.focusEditor();if(Xinha.is_ie){this.restoreSelection(g)}var c=b.getStyleInfo(d);if(!c){if(e==""){e=" "}this.insertHTML("<"+f+" class='"+d+"'>"+e+"</"+f+">"+a)}else{Xinha._removeClass(c,d)}return true};Xinha.prototype.getStyleInfo=function(c){var d=this;var e=this.getAllAncestors();var b,f;if(e){e.pop()}if(e.length>0){for(var g in e){b=e[g];if(b.className){f=b.className.trim()+" ";if(f.toLowerCase().match(c.toLowerCase()+" ")){return b}}}}return false};
|
||||
/** CSS Picker Plugin by Justin Rovang
|
||||
*
|
||||
* For full documentation, please see
|
||||
* http://bitbucket.org/rovangju/xinha_csspicker/wiki/Home
|
||||
*
|
||||
* SAMPLE CONFIG:
|
||||
*
|
||||
* You can configure the appearance of the item/style list using the following CSS classes:
|
||||
* .CSSPickerOption (Normal state)
|
||||
* .CSSPickerOptionOver (Mouse-over state, typically border change)
|
||||
* .CSSPickerOptionActive (Indicator for active classes under the selection/carat)
|
||||
*
|
||||
* Keys are CSS Class names
|
||||
* wrapper: tag to wrap selected text with
|
||||
* name: friendly name to display in panel with that class style applied to it.
|
||||
*
|
||||
* Sample config:
|
||||
* CSSPicker.cssList = {
|
||||
* 'xinhaDashedBox' : { 'wrapper':'div', 'name':'Breakout box' }
|
||||
* 'xinhaMiniHeadline' : { 'wrapper':'div', 'name':'Sub-headline' }
|
||||
* }
|
||||
*
|
||||
*/
|
||||
|
||||
function CSSPicker(editor, args) {
|
||||
this.editor = editor;
|
||||
var CSSPicker = this;
|
||||
}
|
||||
|
||||
CSSPicker._pluginInfo = {
|
||||
name : "CSSPicker",
|
||||
version : "2008-12-01",
|
||||
author : "Justin Rovang"
|
||||
}
|
||||
|
||||
CSSPicker.prototype.onGenerateOnce = function() {
|
||||
var editor = this.editor;
|
||||
var CSSPicker = this;
|
||||
editor._cssPicker = editor.addPanel("right");
|
||||
|
||||
this.main = document.createElement("div");
|
||||
editor._cssPicker.style.backgroundColor='#dee5f8';
|
||||
editor._cssPicker.appendChild(this.main);
|
||||
|
||||
Xinha.freeLater(this,"main");
|
||||
editor.showPanel(editor._cssPicker);
|
||||
}
|
||||
|
||||
|
||||
CSSPicker.prototype.onUpdateToolbar = function() {
|
||||
if(this.editor._cssPicker) {
|
||||
if(this._timeoutID) window.clearTimeout(this._timeoutID);
|
||||
var e = this.editor;
|
||||
this._timeoutID = window.setTimeout(function() { e._gen(); }, 250); //1000 = 1sec / 500=.5sec / 250=.25sec
|
||||
}
|
||||
}
|
||||
|
||||
Xinha.prototype.listStyles = function(s) {
|
||||
var editor = this;
|
||||
var mySel = this.getSelection();
|
||||
var myRange;
|
||||
if(Xinha.is_ie) {
|
||||
myRange = this.saveSelection();//mySel;
|
||||
mySel = this.createRange(mySel).text;
|
||||
}
|
||||
|
||||
var d = document.createElement("div");
|
||||
|
||||
d.className='CSSPickerOption';
|
||||
|
||||
/* If our carat is within an active class, highlight it */
|
||||
var toggleState = editor.getStyleInfo(s);
|
||||
if(toggleState) Xinha._addClass(d, 'CSSPickerOptionActive');
|
||||
|
||||
d.align='center';
|
||||
d.innerHTML='<div class="'+s+'">'+CSSPicker.cssList[s].name+'</div>';
|
||||
d.onclick = function() {
|
||||
editor.wrapStyle(s, mySel, myRange, CSSPicker.cssList[s].wrapper);
|
||||
return false;
|
||||
};
|
||||
|
||||
Xinha._addEvent(d, 'mouseover', function(ev) {
|
||||
Xinha._addClass(d, 'CSSPickerOptionOver');
|
||||
});
|
||||
|
||||
Xinha._addEvent(d, 'mouseout', function(ev) {
|
||||
Xinha._removeClass(d, 'CSSPickerOptionOver');
|
||||
});
|
||||
|
||||
return d;
|
||||
}
|
||||
|
||||
Xinha.prototype._gen = function() {
|
||||
this.plugins.CSSPicker.instance.main.innerHTML='';
|
||||
for(var s in CSSPicker.cssList) {
|
||||
this.plugins.CSSPicker.instance.main.appendChild(this.listStyles(s));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
(string) s: style name
|
||||
(string) sel: selection text
|
||||
(object) myRange: selection object
|
||||
(string) sWrapper: wrapper tag (e.g.: div, span)
|
||||
*/
|
||||
Xinha.prototype.wrapStyle = function(s, sel, myRange, sWrapper) {
|
||||
if(!sWrapper) sWrapper="div";
|
||||
sWrapper=sWrapper.toLowerCase();
|
||||
|
||||
/* The reason for these next lines is that we want the user to be able to place
|
||||
* their cursor below the new div element. Otherwise they can't which makes
|
||||
* placing anything after a div wrapper difficult/almost impossible. */
|
||||
var divBreak='';
|
||||
if(sWrapper=="div") divBreak='<br/>';
|
||||
|
||||
var editor=this;
|
||||
this.focusEditor();
|
||||
if(Xinha.is_ie) this.restoreSelection(myRange);
|
||||
|
||||
/*
|
||||
* First - Get parent elements and see if the style is already applied.
|
||||
*/
|
||||
var toggleState = editor.getStyleInfo(s);
|
||||
if(!toggleState) {
|
||||
/* Create a new wrapper when:
|
||||
* 1. Selected text has no 'snug' wrapper around it already.
|
||||
* 2. If it does have a 'snug' wrapper, only append to the className if it's of the same type (span or div)
|
||||
*/
|
||||
if(sel == '') sel = ' '; //We insert this if the selection is empty, making it easier for carat placement via click
|
||||
|
||||
this.insertHTML("<"+sWrapper+" class='"+s+"'>"+sel+"</"+sWrapper+">"+divBreak);
|
||||
/* Modify the 'snug' wrapper if the above conditions are not met for a new element: */
|
||||
}
|
||||
else {
|
||||
/* 1. If the current ancestor has -just- this classname. It should be removed.
|
||||
* 2. If it has more than one class, it should be removed from the list of the parents
|
||||
*/
|
||||
Xinha._removeClass(toggleState, s);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Xinha.prototype.getStyleInfo = function(sClassToProbe) {
|
||||
var editor = this;
|
||||
var aList = this.getAllAncestors();
|
||||
var a,s;
|
||||
|
||||
if(aList) aList.pop(); //We don't want the body element to show up in this list.
|
||||
if(aList.length > 0) {
|
||||
for(var o in aList){
|
||||
a = aList[o];
|
||||
/* Instead of break down and rebuild the array for this search, we're going
|
||||
* to do some string trickery...
|
||||
* // NOTE: THIS MAY BE PRONE TO PARTIAL MATCHES. SOLUTION IS TO ADD A SPACE PREPEND
|
||||
*/
|
||||
if(a.className) {
|
||||
s = a.className.trim()+' ';
|
||||
if(s.toLowerCase().match(sClassToProbe.toLowerCase()+' ')) {
|
||||
return a;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,2 +1,101 @@
|
|||
/* This compressed file is part of Xinha. For uncompressed sources, forum, and bug reports, go to xinha.org */
|
||||
function CharCounter(a){this.editor=a;this._Chars=0;this._Words=0;this._HTML=0;this.onKeyPress=this.__onKeyPress}Xinha.Config.prototype.CharCounter={showChar:true,showWord:true,showHtml:true,separator:" | ",maxHTML:-1};CharCounter._pluginInfo={name:"CharCounter",version:"1.31",developer:"Udo Schmal",developer_url:"http://www.schaffrath-neuemedien.de",sponsor:"L.N.Schaffrath NeueMedien",sponsor_url:"http://www.schaffrath-neuemedien.de",c_owner:"Udo Schmal & L.N.Schaffrath NeueMedien",license:"htmlArea"};CharCounter.prototype._lc=function(a){return Xinha._lc(a,"CharCounter")};CharCounter.prototype.onGenerateOnce=function(){var b=this;if(this.charCount==null){var a=b.editor.registerStatusWidget("CharCounter",["wysiwyg"]);this.charCount=a}};CharCounter.prototype.__onKeyPress=function(b){if((b.keyCode!=8)&&(b.keyCode!=46)){if(this.editor.config.CharCounter.maxHTML!=-1){var a=this.editor.getHTML();if(a.length>=this.editor.config.CharCounter.maxHTML){Xinha._stopEvent(b);return true}}}};CharCounter.prototype._updateCharCount=function(){var d=this.editor;var c=d.config;var b=d.getHTML();var e=new Array();if(c.CharCounter.showHtml){e[e.length]=this._lc("HTML")+": "+b.length}this._HTML=b.length;if(c.CharCounter.showWord||c.CharCounter.showChar){b=b.replace(/<\/?\s*!--[^-->]*-->/gi,"");b=b.replace(/<(.+?)>/g,"");b=b.replace(/ /gi," ");b=b.replace(/([\n\r\t])/g," ");b=b.replace(/( +)/g," ");b=b.replace(/&(.*);/g," ");b=b.replace(/^\s*|\s*$/g,"")}if(c.CharCounter.showWord){this._Words=0;for(var a=0;a<b.length;a++){if(b.charAt(a)==" "){this._Words++}}if(this._Words>=1){this._Words++}e[e.length]=this._lc("Words")+": "+this._Words}if(c.CharCounter.showChar){e[e.length]=this._lc("Chars")+": "+b.length;this._Chars=b.length}this.charCount.innerHTML=e.join(c.CharCounter.separator)};CharCounter.prototype.onUpdateToolbar=function(){this.charCount.innerHTML=this._lc("... in progress");if(this._timeoutID){window.clearTimeout(this._timeoutID)}var a=this;this._timeoutID=window.setTimeout(function(){a._updateCharCount()},1000)};
|
||||
// Charcounter for Xinha
|
||||
// (c) Udo Schmal & L.N.Schaffrath NeueMedien
|
||||
// Distributed under the same terms as HTMLArea itself.
|
||||
// This notice MUST stay intact for use (see license.txt).
|
||||
|
||||
function CharCounter(editor) {
|
||||
this.editor = editor;
|
||||
this._Chars = 0;
|
||||
this._Words = 0;
|
||||
this._HTML = 0;
|
||||
this.onKeyPress = this.__onKeyPress;
|
||||
}
|
||||
|
||||
Xinha.Config.prototype.CharCounter =
|
||||
{
|
||||
'showChar': true, // show the characters count,
|
||||
'showWord': true, // show the words count,
|
||||
'showHtml': true, // show the exact html count
|
||||
'separator': ' | ', // separator used to join informations
|
||||
'maxHTML' : -1 // -1 for unlimited length, other number for limiting the length of the edited HTML
|
||||
};
|
||||
|
||||
CharCounter._pluginInfo = {
|
||||
name : "CharCounter",
|
||||
version : "1.31",
|
||||
developer : "Udo Schmal",
|
||||
developer_url : "http://www.schaffrath-neuemedien.de",
|
||||
sponsor : "L.N.Schaffrath NeueMedien",
|
||||
sponsor_url : "http://www.schaffrath-neuemedien.de",
|
||||
c_owner : "Udo Schmal & L.N.Schaffrath NeueMedien",
|
||||
license : "htmlArea"
|
||||
};
|
||||
|
||||
CharCounter.prototype._lc = function(string) {
|
||||
return Xinha._lc(string, "CharCounter");
|
||||
};
|
||||
|
||||
|
||||
CharCounter.prototype.onGenerateOnce = function() {
|
||||
var self = this;
|
||||
if (this.charCount==null) {
|
||||
var charCount = self.editor.registerStatusWidget('CharCounter', ['wysiwyg']);
|
||||
this.charCount = charCount;
|
||||
}
|
||||
};
|
||||
|
||||
CharCounter.prototype.__onKeyPress= function(ev) {
|
||||
if ((ev.keyCode != 8) && (ev.keyCode !=46)) { // not backspace & delete
|
||||
if (this.editor.config.CharCounter.maxHTML!=-1) {
|
||||
var contents = this.editor.getHTML();
|
||||
if (contents.length >= this.editor.config.CharCounter.maxHTML) {
|
||||
Xinha._stopEvent(ev);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CharCounter.prototype._updateCharCount= function() {
|
||||
var editor = this.editor;
|
||||
var cfg = editor.config;
|
||||
var contents = editor.getHTML();
|
||||
var string = new Array();
|
||||
if (cfg.CharCounter.showHtml) {
|
||||
string[string.length] = this._lc("HTML") + ": " + contents.length;
|
||||
}
|
||||
this._HTML = contents.length;
|
||||
if (cfg.CharCounter.showWord || cfg.CharCounter.showChar) {
|
||||
contents = contents.replace(/<\/?\s*!--[^-->]*-->/gi, "" );
|
||||
contents = contents.replace(/<(.+?)>/g, '');//Don't count HTML tags
|
||||
contents = contents.replace(/ /gi, ' ');
|
||||
contents = contents.replace(/([\n\r\t])/g, ' ');//convert newlines and tabs into space
|
||||
contents = contents.replace(/( +)/g, ' ');//count spaces only once
|
||||
contents = contents.replace(/&(.*);/g, ' ');//Count htmlentities as one keystroke
|
||||
contents = contents.replace(/^\s*|\s*$/g, '');//trim
|
||||
}
|
||||
if (cfg.CharCounter.showWord) {
|
||||
this._Words = 0;
|
||||
for (var x=0;x<contents.length;x++)
|
||||
{
|
||||
if (contents.charAt(x) == " " ) {this._Words++;}
|
||||
}
|
||||
if (this._Words >=1) { this._Words++; }
|
||||
string[string.length] = this._lc("Words") + ": " + this._Words ;
|
||||
}
|
||||
if (cfg.CharCounter.showChar) {
|
||||
string[string.length] = this._lc("Chars") + ": " + contents.length;
|
||||
this._Chars = contents.length;
|
||||
}
|
||||
this.charCount.innerHTML = string.join(cfg.CharCounter.separator);
|
||||
};
|
||||
|
||||
CharCounter.prototype.onUpdateToolbar = function() {
|
||||
this.charCount.innerHTML = this._lc("... in progress");
|
||||
if(this._timeoutID) {
|
||||
window.clearTimeout(this._timeoutID);
|
||||
}
|
||||
var e = this;
|
||||
this._timeoutID = window.setTimeout(function() {e._updateCharCount();}, 1000);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,2 +1,124 @@
|
|||
/* This compressed file is part of Xinha. For uncompressed sources, forum, and bug reports, go to xinha.org */
|
||||
Xinha.loadStyle("CharacterMap.css","CharacterMap");function CharacterMap(c){this.editor=c;var a=c.config;var b=this;a.registerButton({id:"insertcharacter",tooltip:Xinha._lc("Insert special character","CharacterMap"),image:c.imgURL("images/tango/16x16/apps/accessories-character-map.png"),textMode:false,action:function(){b.show()}});a.addToolbarElement("insertcharacter","createlink",-1)}Xinha.Config.prototype.CharacterMap={mode:"popup"};CharacterMap._pluginInfo={name:"CharacterMap",version:"2.0",developer:"Laurent Vilday",developer_url:"http://www.mokhet.com/",c_owner:"Xinha community",sponsor:"",sponsor_url:"",license:"HTMLArea"};CharacterMap._isActive=false;CharacterMap.prototype.addEntity=function(e,f){var d=this.editor;var c=this;var b=document.createElement("a");Xinha._addClass(b,"entity");b.innerHTML=e;b.href="javascript:void(0)";Xinha._addClass(b,(f%2)?"light":"dark");b.onclick=function(){if(Xinha.is_ie){d.focusEditor()}d.insertHTML(e);return false};this.dialog.main.appendChild(b);b=null};CharacterMap.prototype.onGenerateOnce=function(){this._prepareDialog()};CharacterMap.prototype._prepareDialog=function(){var c=this;var b=this.editor;var e="<h1><l10n>Insert special character</l10n></h1>";this.dialog=new Xinha.Dialog(b,e,"CharacterMap",{width:300},{modal:false});Xinha._addClass(this.dialog.rootElem,"CharacterMap");if(b.config.CharacterMap&&b.config.CharacterMap.mode=="panel"){this.dialog.attachToPanel("right")}var a=["Ÿ","š","@",""","¡","¢","£","¤","¥","¦","§","¨","©","ª","«","¬","¯","°","±","²","³","´","µ","¶","·","¸","¹","º","»","¼","½","¾","¿","×","Ø","÷","ø","ƒ","ˆ","˜","–","—","‘","’","‚","“","”","„","†","‡","•","…","‰","‹","›","€","™","À","Á","Â","Ã","Ä","Å","Æ","Ç","È","É","Ê","Ë","Ì","Í","Î","Ï","Ð","Ñ","Ò","Ó","Ô","Õ","Ö","®","×","Ù","Ú","Û","Ü","Ý","Þ","ß","à","á","â","ã","ä","å","æ","ç","è","é","ê","ë","ì","í","î","ï","ð","ñ","ò","ó","ô","õ","ö","÷","ø","ù","ú","û","ü","ý","þ","ÿ","Œ","œ","Š"];for(var d=0;d<a.length;d++){this.addEntity(a[d],d)}this.ready=true};CharacterMap.prototype.show=function(){if(!this.ready){var a=this;window.setTimeout(function(){a.show()},100);return}this.dialog.toggle()};CharacterMap.prototype.hide=function(){this.dialog.hide()};
|
||||
// Character Map plugin for Xinha
|
||||
// Original Author - Bernhard Pfeifer novocaine@gmx.net
|
||||
Xinha.loadStyle( 'CharacterMap.css', 'CharacterMap' );
|
||||
|
||||
function CharacterMap( editor )
|
||||
{
|
||||
this.editor = editor;
|
||||
var cfg = editor.config;
|
||||
var self = this;
|
||||
cfg.registerButton(
|
||||
{
|
||||
id : 'insertcharacter',
|
||||
tooltip : Xinha._lc( 'Insert special character', 'CharacterMap' ),
|
||||
image : editor.imgURL('images/tango/16x16/apps/accessories-character-map.png'),
|
||||
textMode : false,
|
||||
action : function() { self.show(); }
|
||||
}
|
||||
);
|
||||
cfg.addToolbarElement('insertcharacter', 'createlink', -1);
|
||||
|
||||
}
|
||||
|
||||
// configuration mode : panel or popup
|
||||
Xinha.Config.prototype.CharacterMap =
|
||||
{
|
||||
'mode': 'popup' // configuration mode : panel or popup
|
||||
};
|
||||
|
||||
CharacterMap._pluginInfo =
|
||||
{
|
||||
name : "CharacterMap",
|
||||
version : "2.0",
|
||||
developer : "Laurent Vilday",
|
||||
developer_url : "http://www.mokhet.com/",
|
||||
c_owner : "Xinha community",
|
||||
sponsor : "",
|
||||
sponsor_url : "",
|
||||
license : "HTMLArea"
|
||||
};
|
||||
|
||||
CharacterMap._isActive = false;
|
||||
|
||||
|
||||
CharacterMap.prototype.addEntity = function ( entite, pos )
|
||||
{
|
||||
var editor = this.editor;
|
||||
var self = this;
|
||||
var a = document.createElement( 'a' );
|
||||
Xinha._addClass( a, 'entity' );
|
||||
a.innerHTML = entite;
|
||||
a.href = 'javascript:void(0)';
|
||||
Xinha._addClass(a, (pos%2)? 'light':'dark');
|
||||
a.onclick = function()
|
||||
{
|
||||
if (Xinha.is_ie) editor.focusEditor();
|
||||
editor.insertHTML( entite );
|
||||
//self._isActive = false;
|
||||
//editor.hidePanel( editor._CharacterMap );
|
||||
return false;
|
||||
};
|
||||
this.dialog.main.appendChild( a );
|
||||
a = null;
|
||||
};
|
||||
|
||||
CharacterMap.prototype.onGenerateOnce = function()
|
||||
{
|
||||
this._prepareDialog();
|
||||
};
|
||||
|
||||
CharacterMap.prototype._prepareDialog = function()
|
||||
{
|
||||
var self = this;
|
||||
var editor = this.editor;
|
||||
|
||||
var html = '<h1><l10n>Insert special character</l10n></h1>';
|
||||
|
||||
// Now we have everything we need, so we can build the dialog.
|
||||
this.dialog = new Xinha.Dialog(editor, html, 'CharacterMap',{width:300},{modal:false});
|
||||
Xinha._addClass( this.dialog.rootElem, 'CharacterMap' );
|
||||
|
||||
if (editor.config.CharacterMap && editor.config.CharacterMap.mode == 'panel') this.dialog.attachToPanel('right');
|
||||
|
||||
var entites =
|
||||
[
|
||||
'Ÿ', 'š', '@', '"', '¡', '¢', '£', '¤', '¥', '¦',
|
||||
'§', '¨', '©', 'ª', '«', '¬', '¯', '°', '±', '²',
|
||||
'³', '´', 'µ', '¶', '·', '¸', '¹', 'º', '»', '¼',
|
||||
'½', '¾', '¿', '×', 'Ø', '÷', 'ø', 'ƒ', 'ˆ',
|
||||
'˜', '–', '—', '‘', '’', '‚', '“', '”', '„',
|
||||
'†', '‡', '•', '…', '‰', '‹', '›', '€', '™',
|
||||
'À', 'Á', 'Â', 'Ã', 'Ä', 'Å', 'Æ', 'Ç', 'È',
|
||||
'É', 'Ê', 'Ë', 'Ì', 'Í', 'Î', 'Ï', 'Ð', 'Ñ',
|
||||
'Ò', 'Ó', 'Ô', 'Õ', 'Ö', '®', '×', 'Ù', 'Ú',
|
||||
'Û', 'Ü', 'Ý', 'Þ', 'ß', 'à', 'á', 'â', 'ã',
|
||||
'ä', 'å', 'æ', 'ç', 'è', 'é', 'ê', 'ë', 'ì',
|
||||
'í', 'î', 'ï', 'ð', 'ñ', 'ò', 'ó', 'ô', 'õ',
|
||||
'ö', '÷', 'ø', 'ù', 'ú', 'û', 'ü', 'ý', 'þ',
|
||||
'ÿ', 'Œ', 'œ', 'Š'
|
||||
];
|
||||
|
||||
for ( var i=0; i<entites.length; i++ )
|
||||
{
|
||||
this.addEntity( entites[i], i );
|
||||
}
|
||||
|
||||
this.ready = true;
|
||||
//this.hide();
|
||||
};
|
||||
|
||||
CharacterMap.prototype.show = function()
|
||||
{
|
||||
if(!this.ready) // if the user is too fast clicking the, we have to make them wait
|
||||
{
|
||||
var self = this;
|
||||
window.setTimeout(function() {self.show();},100);
|
||||
return;
|
||||
}
|
||||
this.dialog.toggle();
|
||||
};
|
||||
CharacterMap.prototype.hide = function()
|
||||
{
|
||||
this.dialog.hide();
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,66 @@
|
|||
// Double Click Plugin for Xinha
|
||||
// Implementation by Marijn Kampf http://www.marijn.org
|
||||
// Sponsored by http://www.smiling-faces.com
|
||||
//
|
||||
// (c) Marijn Kampf 2004.
|
||||
// Distributed under the same terms as HTMLArea itself.
|
||||
// This notice MUST stay intact for use (see license.txt).
|
||||
//
|
||||
// Cut-n-paste version of double click plugin.
|
||||
// Almost no original code used. Based on
|
||||
// Luis HTMLarea and Mihai Bazon Context Menu
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
DoubleClick._pluginInfo = {
|
||||
name : "DoubleClick",
|
||||
version : "1.0",
|
||||
developer : "Marijn Kampf",
|
||||
developer_url : "http://www.marijn.org",
|
||||
c_owner : "Marijn Kampf",
|
||||
sponsor : "smiling-faces.com",
|
||||
sponsor_url : "http://www.smiling-faces.com",
|
||||
license : "htmlArea"
|
||||
};
|
||||
|
||||
function DoubleClick(editor) {
|
||||
this.editor = editor;
|
||||
|
||||
// ADDING CUSTOM DOUBLE CLICK ACTIONS
|
||||
// format of the dblClickList elements is "TAGNAME: [ ACTION ]"
|
||||
// - TAGNAME: tagname of the tag that is double clicked
|
||||
// - ACTION: function that gets called when the button is clicked.
|
||||
// it has the following prototype:
|
||||
// function(editor, event)
|
||||
// - editor is the Xinha object that triggered the call
|
||||
// - target is the selected object
|
||||
this.editor.dblClickList = {
|
||||
// Edit Link dialog
|
||||
a: [ function(e) {e.config.btnList['createlink'][3](e); } ],
|
||||
// Follow link
|
||||
//a: [ function(editor, target) { window.location = target.href; properties(target); } ],
|
||||
|
||||
img: [ function(e) {e.execCommand("insertimage");} ],
|
||||
td: [ function(e) {e.execCommand("inserttable");} ]
|
||||
};
|
||||
}
|
||||
|
||||
DoubleClick.prototype.onGenerate = function() {
|
||||
var self = this;
|
||||
var doc = this.editordoc = this.editor._iframe.contentWindow.document;
|
||||
Xinha._addEvents(doc, ["dblclick"],
|
||||
function (event) {
|
||||
return self.onDoubleClick(Xinha.is_ie ? self.editor._iframe.contentWindow.event : event);
|
||||
});
|
||||
this.currentClick = null;
|
||||
};
|
||||
|
||||
DoubleClick.prototype.onDoubleClick = function(ev) {
|
||||
var target = Xinha.is_ie ? ev.srcElement : ev.target;
|
||||
var tagName = target.tagName.toLowerCase();
|
||||
|
||||
if (this.editor.dblClickList[tagName] != undefined) {
|
||||
this.editor.dblClickList[tagName][0](this.editor, target);
|
||||
}
|
||||
};
|
||||
|
|
@ -1,2 +1,237 @@
|
|||
/* This compressed file is part of Xinha. For uncompressed sources, forum, and bug reports, go to xinha.org */
|
||||
function DynamicCSS(c,e){this.editor=c;var a=c.config;var b=this;var g=null;var d=null;var f={id:"DynamicCSS-class",tooltip:this._lc("Choose stylesheet"),options:{"":""},action:function(h){b.onSelect(h,this)},refresh:function(h){b.updateValue(h,this)}};a.registerDropdown(f);a.addToolbarElement(["T[CSS]","DynamicCSS-class","separator"],"formatblock",-1)}DynamicCSS.parseStyleSheet=function(a){iframe=a._iframe.contentWindow.document;cssArray=DynamicCSS.cssArray;if(!cssArray){cssArray=new Array()}for(i=0;i<iframe.styleSheets.length;i++){if(iframe.styleSheets[i].title=="XinhaInternalCSS"){continue}if(Xinha.is_gecko){try{cssArray=DynamicCSS.applyCSSRule(iframe.styleSheets[i].cssRules,cssArray)}catch(b){}}else{try{if(iframe.styleSheets[i].rules){cssArray=DynamicCSS.applyCSSRule(iframe.styleSheets[i].rules,cssArray)}if(iframe.styleSheets[i].imports){for(j=0;j<iframe.styleSheets[i].imports.length;j++){cssArray=DynamicCSS.applyCSSRule(iframe.styleSheets[i].imports[j].rules,cssArray)}}}catch(b){}}}DynamicCSS.cssArray=cssArray};DynamicCSS.applyCSSRule=function(b,a){for(rule in b){if(typeof b[rule]=="function"){continue}if(b[rule].selectorText){if(b[rule].selectorText.search(/:+/)==-1){cssElements=b[rule].selectorText.split(",");for(k=0;k<cssElements.length;k++){cssElement=cssElements[k].split(".");tagName=cssElement[0].toLowerCase().trim();className=cssElement[1];if(!tagName){tagName="all"}if(!a[tagName]){a[tagName]=new Array()}if(className){if(tagName=="all"){cssName=className}else{cssName="<"+className+">"}}else{className="none";if(tagName=="all"){cssName=Xinha._lc("Default","DynamicCSS")}else{cssName="<"+Xinha._lc("Default","DynamicCSS")+">"}}a[tagName][className]=cssName;DynamicCSS.cssLength++}}}else{if(b[rule].styleSheet){a=DynamicCSS.applyCSSRule(b[rule].styleSheet.cssRules,a)}}}return a};DynamicCSS._pluginInfo={name:"DynamicCSS",version:"1.5.2",developer:"Holger Hees",developer_url:"http://www.systemconcept.de/",c_owner:"Holger Hees",sponsor:"System Concept GmbH",sponsor_url:"http://www.systemconcept.de/",license:"htmlArea"};DynamicCSS.prototype._lc=function(a){return Xinha._lc(a,"DynamicCSS")};DynamicCSS.prototype.onSelect=function(c,f){var e=c._toolbarObjects[f.id];var d=e.element.selectedIndex;var b=e.element.value;var a=c.getParentElement();if(b!="none"){a.className=b;DynamicCSS.lastClass=b}else{if(Xinha.is_gecko){a.removeAttribute("class")}else{a.removeAttribute("className")}}c.updateToolbar()};DynamicCSS.prototype.reparseTimer=function(b,c,a){if(DynamicCSS.parseCount<9){setTimeout(function(){DynamicCSS.cssLength=0;DynamicCSS.parseStyleSheet(b);if(DynamicCSS.cssOldLength!=DynamicCSS.cssLength){DynamicCSS.cssOldLength=DynamicCSS.cssLength;DynamicCSS.lastClass=null;a.updateValue(b,c)}a.reparseTimer(b,c,a)},DynamicCSS.parseCount*1000);DynamicCSS.parseCount=DynamicCSS.parseCount*2}};DynamicCSS.prototype.updateValue=function(b,e){cssArray=DynamicCSS.cssArray;if(!cssArray){DynamicCSS.cssLength=0;DynamicCSS.parseStyleSheet(b);cssArray=DynamicCSS.cssArray;DynamicCSS.cssOldLength=DynamicCSS.cssLength;DynamicCSS.parseCount=1;this.reparseTimer(b,e,this)}var h=b.getParentElement();var f=h.tagName.toLowerCase();var a=h.className;if(this.lastTag!=f||this.lastClass!=a){this.lastTag=f;this.lastClass=a;var l=b._toolbarObjects[e.id].element;while(l.length>0){l.options[l.length-1]=null}l.options[0]=new Option(this._lc("Default"),"none");if(cssArray){if(f!="body"||b.config.fullPage){if(cssArray[f]){for(cssClass in cssArray[f]){if(typeof cssArray[f][cssClass]!="string"){continue}if(cssClass=="none"){l.options[0]=new Option(cssArray[f][cssClass],cssClass)}else{l.options[l.length]=new Option(cssArray[f][cssClass],cssClass)}}}if(cssArray.all){for(cssClass in cssArray.all){if(typeof cssArray.all[cssClass]!="string"){continue}l.options[l.length]=new Option(cssArray.all[cssClass],cssClass)}}}else{if(cssArray[f]&&cssArray[f]["none"]){l.options[0]=new Option(cssArray[f]["none"],"none")}}}l.selectedIndex=0;if(typeof a!="undefined"&&/\S/.test(a)){var g=l.options;for(var d=g.length;--d>=0;){var c=g[d];if(a==c.value){l.selectedIndex=d;break}}if(l.selectedIndex==0){l.options[l.length]=new Option(this._lc("Undefined"),a);l.selectedIndex=l.length-1}}if(l.length>1){l.disabled=false}else{l.disabled=true}}};
|
||||
// Dynamic CSS (className) plugin for HTMLArea
|
||||
// Sponsored by http://www.systemconcept.de
|
||||
// Implementation by Holger Hees
|
||||
//
|
||||
// (c) systemconcept.de 2004
|
||||
// Distributed under the same terms as HTMLArea itself.
|
||||
// This notice MUST stay intact for use (see license.txt).
|
||||
|
||||
function DynamicCSS(editor, args) {
|
||||
this.editor = editor;
|
||||
var cfg = editor.config;
|
||||
var self = this;
|
||||
|
||||
/*var cssArray=null;
|
||||
var cssLength=0;*/
|
||||
var lastTag=null;
|
||||
var lastClass=null;
|
||||
|
||||
var css_class = {
|
||||
id : "DynamicCSS-class",
|
||||
tooltip : this._lc("Choose stylesheet"),
|
||||
options : {"":""},
|
||||
action : function(editor) { self.onSelect(editor, this); },
|
||||
refresh : function(editor) { self.updateValue(editor, this); }
|
||||
};
|
||||
cfg.registerDropdown(css_class);
|
||||
cfg.addToolbarElement(["T[CSS]", "DynamicCSS-class", "separator"] , "formatblock", -1);
|
||||
}
|
||||
|
||||
DynamicCSS.parseStyleSheet=function(editor){
|
||||
iframe = editor._iframe.contentWindow.document;
|
||||
|
||||
cssArray=DynamicCSS.cssArray;
|
||||
if(!cssArray) cssArray=new Array();
|
||||
|
||||
for(i=0;i<iframe.styleSheets.length;i++)
|
||||
{
|
||||
if(iframe.styleSheets[i].title == "XinhaInternalCSS") continue;
|
||||
|
||||
// Mozilla
|
||||
if(Xinha.is_gecko){
|
||||
try{
|
||||
cssArray=DynamicCSS.applyCSSRule(iframe.styleSheets[i].cssRules,cssArray);
|
||||
}
|
||||
catch(e){
|
||||
//alert(e);
|
||||
}
|
||||
}
|
||||
// IE
|
||||
else {
|
||||
try{
|
||||
if(iframe.styleSheets[i].rules){
|
||||
cssArray=DynamicCSS.applyCSSRule(iframe.styleSheets[i].rules,cssArray);
|
||||
}
|
||||
// @import StyleSheets (IE)
|
||||
if(iframe.styleSheets[i].imports){
|
||||
for(j=0;j<iframe.styleSheets[i].imports.length;j++){
|
||||
cssArray=DynamicCSS.applyCSSRule(iframe.styleSheets[i].imports[j].rules,cssArray);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(e){
|
||||
//alert(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
DynamicCSS.cssArray=cssArray;
|
||||
};
|
||||
|
||||
DynamicCSS.applyCSSRule=function(cssRules,cssArray){
|
||||
for(rule in cssRules){
|
||||
if(typeof cssRules[rule] == 'function') continue;
|
||||
// StyleRule
|
||||
if(cssRules[rule].selectorText){
|
||||
if(cssRules[rule].selectorText.search(/:+/)==-1){
|
||||
|
||||
// split equal Styles (Mozilla-specific) e.q. head, body {border:0px}
|
||||
// for ie not relevant. returns allways one element
|
||||
cssElements = cssRules[rule].selectorText.split(",");
|
||||
for(k=0;k<cssElements.length;k++){
|
||||
cssElement = cssElements[k].split(".");
|
||||
|
||||
tagName=cssElement[0].toLowerCase().trim();
|
||||
className=cssElement[1];
|
||||
|
||||
if(!tagName) tagName='all';
|
||||
if(!cssArray[tagName]) cssArray[tagName]=new Array();
|
||||
|
||||
if(className){
|
||||
if(tagName=='all') cssName=className;
|
||||
else cssName='<'+className+'>';
|
||||
}
|
||||
else{
|
||||
className='none';
|
||||
if(tagName=='all') cssName=Xinha._lc("Default", 'DynamicCSS');
|
||||
else cssName='<'+Xinha._lc("Default", 'DynamicCSS')+'>';
|
||||
}
|
||||
cssArray[tagName][className]=cssName;
|
||||
DynamicCSS.cssLength++;
|
||||
}
|
||||
}
|
||||
}
|
||||
// ImportRule (Mozilla)
|
||||
else if(cssRules[rule].styleSheet){
|
||||
cssArray=DynamicCSS.applyCSSRule(cssRules[rule].styleSheet.cssRules,cssArray);
|
||||
}
|
||||
}
|
||||
return cssArray;
|
||||
};
|
||||
|
||||
DynamicCSS._pluginInfo = {
|
||||
name : "DynamicCSS",
|
||||
version : "1.5.2",
|
||||
developer : "Holger Hees",
|
||||
developer_url : "http://www.systemconcept.de/",
|
||||
c_owner : "Holger Hees",
|
||||
sponsor : "System Concept GmbH",
|
||||
sponsor_url : "http://www.systemconcept.de/",
|
||||
license : "htmlArea"
|
||||
};
|
||||
|
||||
DynamicCSS.prototype._lc = function(string) {
|
||||
return Xinha._lc(string, 'DynamicCSS');
|
||||
};
|
||||
|
||||
DynamicCSS.prototype.onSelect = function(editor, obj) {
|
||||
var tbobj = editor._toolbarObjects[obj.id];
|
||||
var index = tbobj.element.selectedIndex;
|
||||
var className = tbobj.element.value;
|
||||
|
||||
var parent = editor.getParentElement();
|
||||
|
||||
if(className!='none'){
|
||||
parent.className=className;
|
||||
DynamicCSS.lastClass=className;
|
||||
}
|
||||
else{
|
||||
if(Xinha.is_gecko) parent.removeAttribute('class');
|
||||
else parent.removeAttribute('className');
|
||||
}
|
||||
editor.updateToolbar();
|
||||
};
|
||||
|
||||
/*DynamicCSS.prototype.onMode = function(mode) {
|
||||
if(mode=='wysiwyg'){
|
||||
// reparse possible changed css files
|
||||
DynamicCSS.cssArray=null;
|
||||
this.updateValue(this.editor,this.editor.config.customSelects["DynamicCSS-class"]);
|
||||
}
|
||||
}*/
|
||||
|
||||
DynamicCSS.prototype.reparseTimer = function(editor, obj, instance) {
|
||||
// new attempt of rescan stylesheets in 1,2,4 and 8 second (e.g. for external css-files with longer initialisation)
|
||||
if(DynamicCSS.parseCount<9){
|
||||
setTimeout(function () {
|
||||
DynamicCSS.cssLength=0;
|
||||
DynamicCSS.parseStyleSheet(editor);
|
||||
if(DynamicCSS.cssOldLength!=DynamicCSS.cssLength){
|
||||
DynamicCSS.cssOldLength=DynamicCSS.cssLength;
|
||||
DynamicCSS.lastClass=null;
|
||||
instance.updateValue(editor, obj);
|
||||
}
|
||||
instance.reparseTimer(editor, obj, instance);
|
||||
},DynamicCSS.parseCount*1000);
|
||||
DynamicCSS.parseCount=DynamicCSS.parseCount*2;
|
||||
}
|
||||
};
|
||||
|
||||
DynamicCSS.prototype.updateValue = function(editor, obj) {
|
||||
cssArray=DynamicCSS.cssArray;
|
||||
// initial style init
|
||||
if(!cssArray){
|
||||
DynamicCSS.cssLength=0;
|
||||
DynamicCSS.parseStyleSheet(editor);
|
||||
cssArray=DynamicCSS.cssArray;
|
||||
DynamicCSS.cssOldLength=DynamicCSS.cssLength;
|
||||
DynamicCSS.parseCount=1;
|
||||
this.reparseTimer(editor,obj,this);
|
||||
}
|
||||
|
||||
var parent = editor.getParentElement();
|
||||
var tagName = parent.tagName.toLowerCase();
|
||||
var className = parent.className;
|
||||
|
||||
if(this.lastTag!=tagName || this.lastClass!=className){
|
||||
this.lastTag=tagName;
|
||||
this.lastClass=className;
|
||||
|
||||
var select = editor._toolbarObjects[obj.id].element;
|
||||
|
||||
while(select.length>0){
|
||||
select.options[select.length-1] = null;
|
||||
}
|
||||
|
||||
select.options[0]=new Option(this._lc("Default"),'none');
|
||||
if(cssArray){
|
||||
// style class only allowed if parent tag is not body or editor is in fullpage mode
|
||||
if(tagName!='body' || editor.config.fullPage){
|
||||
if(cssArray[tagName]){
|
||||
for(cssClass in cssArray[tagName]){
|
||||
if(typeof cssArray[tagName][cssClass] != 'string') continue;
|
||||
if(cssClass=='none') select.options[0]=new Option(cssArray[tagName][cssClass],cssClass);
|
||||
else select.options[select.length]=new Option(cssArray[tagName][cssClass],cssClass);
|
||||
}
|
||||
}
|
||||
|
||||
if(cssArray['all']){
|
||||
for(cssClass in cssArray['all']){
|
||||
if(typeof cssArray['all'][cssClass] != 'string') continue;
|
||||
select.options[select.length]=new Option(cssArray['all'][cssClass],cssClass);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(cssArray[tagName] && cssArray[tagName]['none']) select.options[0]=new Option(cssArray[tagName]['none'],'none');
|
||||
}
|
||||
|
||||
select.selectedIndex = 0;
|
||||
|
||||
if (typeof className != "undefined" && /\S/.test(className)) {
|
||||
var options = select.options;
|
||||
for (var i = options.length; --i >= 0;) {
|
||||
var option = options[i];
|
||||
if (className == option.value) {
|
||||
select.selectedIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(select.selectedIndex == 0){
|
||||
select.options[select.length]=new Option(this._lc("Undefined"),className);
|
||||
select.selectedIndex=select.length-1;
|
||||
}
|
||||
}
|
||||
|
||||
if(select.length>1) select.disabled=false;
|
||||
else select.disabled=true;
|
||||
}
|
||||
};
|
||||
|
|
@ -1,2 +1,232 @@
|
|||
/* This compressed file is part of Xinha. For uncompressed sources, forum, and bug reports, go to xinha.org */
|
||||
function Equation(c){this.editor=c;var a=c.config;var b=this;a.registerButton({id:"equation",tooltip:this._lc("Formula Editor"),image:c.imgURL("equation.gif","Equation"),textMode:false,action:function(d,f){b.buttonPress(d,f)}});a.addToolbarElement("equation","inserthorizontalrule",-1);mathcolor=a.Equation.mathcolor;mathfontfamily=a.Equation.mathfontfamily;this.enabled=!Xinha.is_ie;if(this.enabled){this.onBeforeSubmit=this.onBeforeUnload=function(){b.unParse()}}if(typeof AMprocessNode!="function"){Xinha._loadback(Xinha.getPluginDir("Equation")+"/ASCIIMathML.js",function(){translate()})}}Xinha.Config.prototype.Equation={mathcolor:"black",mathfontfamily:"serif"};Equation._pluginInfo={name:"ASCIIMathML Formula Editor",version:"2.3 (2008-01-26)",developer:"Raimund Meyer",developer_url:"http://x-webservice.net",c_owner:"",sponsor:"",sponsor_url:"",license:"GNU/LGPL"};Equation.prototype._lc=function(a){return Xinha._lc(a,"Equation")};Equation.prototype.onGenerate=function(){this.parse()};Equation.prototype.onKeyPress=function(b){if(this.enabled){e=this.editor;var a=e._getFirstAncestor(e.getSelection(),["span"]);if(a&&a.className=="AM"){if(b.keyCode==8||b.keyCode==46||b.charCode){Xinha._stopEvent(b);return true}}}return false};Equation.prototype.onBeforeMode=function(a){if(this.enabled&&a=="textmode"){this.unParse()}};Equation.prototype.onMode=function(a){if(this.enabled&&a=="wysiwyg"){this.parse()}};Equation.prototype.parse=function(){if(this.enabled){var f=this.editor._doc;var b=f.getElementsByTagName("span");for(var a=0;a<b.length;a++){var c=b[a];if(c.className!="AM"){continue}if(c.innerHTML.indexOf(this.editor.cc)!=-1){c.innerHTML=c.innerHTML.replace(this.editor.cc,"");c.parentNode.insertBefore(f.createTextNode(this.editor.cc),c)}c.title=c.innerHTML;var g=c.cloneNode(true);try{document.adoptNode(g)}catch(d){}AMprocessNode(g,false);try{f.adoptNode(g)}catch(d){}c.parentNode.replaceChild(g,c);g.parentNode.insertBefore(f.createTextNode(String.fromCharCode(32)),g);g.parentNode.insertBefore(f.createTextNode(String.fromCharCode(32)),g.nextSibling)}}};Equation.prototype.unParse=function(){var f=this.editor._doc;var b=f.getElementsByTagName("span");for(var a=0;a<b.length;a++){var c=b[a];if(c.className.indexOf("AM")==-1||c.getElementsByTagName("math").length==0){continue}var d="`"+c.getElementsByTagName("math")[0].getAttribute("title")+"`";c.innerHTML=d;c.setAttribute("title",null)}};Equation.prototype.buttonPress=function(){var c=this;var b=this.editor;var d={};d.editor=b;var a=b._getFirstAncestor(b.getSelection(),["span"]);if(a){d.editedNode=a}Dialog(Xinha.getPluginDir("Equation")+"/popups/dialog.html",function(f){c.insert(f)},d)};Equation.prototype.insert=function(c){if(typeof c=="undefined"||c==null){return}if(typeof c.formula!="undefined"){var b=(c.formula!="")?c.formula.replace(/^`?(.*)`?$/m,"`$1`"):"";if(c.editedNode&&(c.editedNode.tagName.toLowerCase()=="span")){var a=c.editedNode;if(b!=""){a.innerHTML=b;if(this.enabled){a.title=b}}else{a.parentNode.removeChild(a)}}else{if(!c.editedNode&&b!=""){if(this.enabled){var a=document.createElement("span");a.className="AM";this.editor.insertNodeAtSelection(a);a.innerHTML=b;a.title=b}else{this.editor.insertHTML('<span class="AM">'+b+"</span>")}}}if(this.enabled){this.parse()}}};
|
||||
/*------------------------------------------*\
|
||||
AsciiMathML Formula Editor for Xinha
|
||||
_______________________
|
||||
|
||||
Based on AsciiMathML by Peter Jipsen http://www.chapman.edu/~jipsen
|
||||
|
||||
Including a table with math symbols for easy input modified from CharacterMap for ASCIIMathML by Peter Jipsen
|
||||
HTMLSource based on HTMLArea XTD 1.5 (http://mosforge.net/projects/htmlarea3xtd/) modified by Holger Hees
|
||||
Original Author - Bernhard Pfeifer novocaine@gmx.net
|
||||
|
||||
See readme.txt
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation; either version 2.1 of the License, or (at
|
||||
your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License (at http://www.gnu.org/licenses/lgpl.html)
|
||||
for more details.
|
||||
|
||||
Raimund Meyer 11/23/2006
|
||||
|
||||
\*------------------------------------------*/
|
||||
function Equation(editor) {
|
||||
this.editor = editor;
|
||||
|
||||
var cfg = editor.config;
|
||||
var self = this;
|
||||
|
||||
|
||||
// register the toolbar buttons provided by this plugin
|
||||
cfg.registerButton({
|
||||
id : "equation",
|
||||
tooltip : this._lc("Formula Editor"),
|
||||
image : editor.imgURL("equation.gif", "Equation"),
|
||||
textMode : false,
|
||||
action : function(editor, id) {
|
||||
self.buttonPress(editor, id);
|
||||
}
|
||||
});
|
||||
cfg.addToolbarElement("equation", "inserthorizontalrule", -1);
|
||||
|
||||
mathcolor = cfg.Equation.mathcolor; // change it to "" (to inherit) or any other color
|
||||
mathfontfamily = cfg.Equation.mathfontfamily;
|
||||
|
||||
this.enabled = !Xinha.is_ie;
|
||||
|
||||
if (this.enabled)
|
||||
{
|
||||
this.onBeforeSubmit = this.onBeforeUnload = function () {self.unParse();};
|
||||
}
|
||||
|
||||
if (typeof AMprocessNode != "function")
|
||||
{
|
||||
Xinha._loadback(Xinha.getPluginDir('Equation') + "/ASCIIMathML.js", function () { translate(); });
|
||||
}
|
||||
}
|
||||
|
||||
Xinha.Config.prototype.Equation =
|
||||
{
|
||||
"mathcolor" : "black", // change it to "" (to inherit) or any other color
|
||||
"mathfontfamily" : "serif" // change to "" to inherit (works in IE)
|
||||
// or another family (e.g. "arial")
|
||||
}
|
||||
|
||||
Equation._pluginInfo = {
|
||||
name : "ASCIIMathML Formula Editor",
|
||||
version : "2.3 (2008-01-26)",
|
||||
developer : "Raimund Meyer",
|
||||
developer_url : "http://x-webservice.net",
|
||||
c_owner : "",
|
||||
sponsor : "",
|
||||
sponsor_url : "",
|
||||
license : "GNU/LGPL"
|
||||
};
|
||||
|
||||
Equation.prototype._lc = function(string)
|
||||
{
|
||||
return Xinha._lc(string, 'Equation');
|
||||
};
|
||||
Equation.prototype.onGenerate = function()
|
||||
{
|
||||
this.parse();
|
||||
};
|
||||
|
||||
// avoid changing the formula in the editor
|
||||
Equation.prototype.onKeyPress = function(ev)
|
||||
{
|
||||
if (this.enabled)
|
||||
{
|
||||
e = this.editor;
|
||||
var span = e._getFirstAncestor(e.getSelection(),['span']);
|
||||
if ( span && span.className == "AM" )
|
||||
{
|
||||
if (
|
||||
ev.keyCode == 8 || // delete
|
||||
ev.keyCode == 46 ||// backspace
|
||||
ev.charCode // all character keys
|
||||
)
|
||||
{ // stop event
|
||||
Xinha._stopEvent(ev);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
Equation.prototype.onBeforeMode = function( mode )
|
||||
{
|
||||
if (this.enabled && mode == 'textmode')
|
||||
{
|
||||
this.unParse();
|
||||
}
|
||||
}
|
||||
Equation.prototype.onMode = function( mode )
|
||||
{
|
||||
if (this.enabled && mode == 'wysiwyg')
|
||||
{
|
||||
this.parse();
|
||||
}
|
||||
}
|
||||
|
||||
Equation.prototype.parse = function ()
|
||||
{
|
||||
if (this.enabled)
|
||||
{
|
||||
var doc = this.editor._doc;
|
||||
var spans = doc.getElementsByTagName("span");
|
||||
for (var i = 0;i<spans.length;i++)
|
||||
{
|
||||
var node = spans[i];
|
||||
if (node.className != 'AM') continue;
|
||||
if (node.innerHTML.indexOf(this.editor.cc) != -1) // avoid problems with source code position auxiliary character
|
||||
{
|
||||
node.innerHTML = node.innerHTML.replace(this.editor.cc,'');
|
||||
node.parentNode.insertBefore(doc.createTextNode(this.editor.cc), node);
|
||||
}
|
||||
node.title = node.innerHTML;
|
||||
// FF3 strict source document policy:
|
||||
// the span is taken from the editor document, processed in the plugin document, and put back in the editor
|
||||
var clone = node.cloneNode(true);
|
||||
try {
|
||||
document.adoptNode(clone);
|
||||
} catch (e) {}
|
||||
AMprocessNode(clone, false);
|
||||
try {
|
||||
doc.adoptNode(clone);
|
||||
} catch (e) {}
|
||||
node.parentNode.replaceChild(clone, node);
|
||||
// insert space before and after the protected node, otherwide one could get stuck
|
||||
clone.parentNode.insertBefore(doc.createTextNode(String.fromCharCode(32)),clone);
|
||||
clone.parentNode.insertBefore(doc.createTextNode(String.fromCharCode(32)),clone.nextSibling);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Equation.prototype.unParse = function ()
|
||||
{
|
||||
var doc = this.editor._doc;
|
||||
var spans = doc.getElementsByTagName("span");
|
||||
for (var i = 0;i<spans.length;i++)
|
||||
{
|
||||
var node = spans[i];
|
||||
if (node.className.indexOf ("AM") == -1 || node.getElementsByTagName("math").length == 0) continue;
|
||||
var formula = '`' + node.getElementsByTagName('math')[0].getAttribute('title') + '`';
|
||||
node.innerHTML = formula;
|
||||
node.setAttribute("title", null);
|
||||
}
|
||||
}
|
||||
|
||||
Equation.prototype.buttonPress = function()
|
||||
{
|
||||
var self = this;
|
||||
var editor = this.editor;
|
||||
var args = {};
|
||||
|
||||
args['editor'] = editor;
|
||||
|
||||
var parent = editor._getFirstAncestor(editor.getSelection(),['span']);
|
||||
if (parent)
|
||||
{
|
||||
args["editedNode"] = parent;
|
||||
}
|
||||
Dialog(Xinha.getPluginDir('Equation') + "/popups/dialog.html", function(params) {
|
||||
self.insert(params);
|
||||
}, args);
|
||||
};
|
||||
|
||||
Equation.prototype.insert = function (param)
|
||||
{
|
||||
if (typeof param == 'undefined' || param == null) return;
|
||||
|
||||
if (typeof param["formula"] != "undefined")
|
||||
{
|
||||
var formula = (param["formula"] != '') ? param["formula"].replace(/^`?(.*)`?$/m,"`$1`") : '';
|
||||
|
||||
if (param["editedNode"] && (param["editedNode"].tagName.toLowerCase() == 'span'))
|
||||
{
|
||||
var span = param["editedNode"];
|
||||
if (formula != '')
|
||||
{
|
||||
span.innerHTML = formula;
|
||||
if (this.enabled) span.title = formula;
|
||||
}
|
||||
else
|
||||
{
|
||||
span.parentNode.removeChild(span);
|
||||
}
|
||||
|
||||
}
|
||||
else if (!param["editedNode"] && formula != '')
|
||||
{
|
||||
if (this.enabled)
|
||||
{
|
||||
var span = document.createElement('span');
|
||||
span.className = 'AM';
|
||||
this.editor.insertNodeAtSelection(span);
|
||||
span.innerHTML = formula;
|
||||
span.title = formula;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.editor.insertHTML('<span class="AM">'+formula+'</span>');
|
||||
}
|
||||
}
|
||||
|
||||
if (this.enabled) this.parse();//AMprocessNode(this.editor._doc.body, false);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,819 @@
|
|||
<?php
|
||||
/**
|
||||
* ExtendedFileManager, list images, directories, and thumbnails.
|
||||
* Authors: Wei Zhuo, Afru, Krzysztof Kotowicz, Raimund Meyer
|
||||
* Version: Updated on 08-01-2005 by Afru
|
||||
* Version: Updated on 04-07-2006 by Krzysztof Kotowicz
|
||||
* Version: Updated on 29-10-2006 by Raimund Meyer
|
||||
* Package: ExtendedFileManager (EFM 1.1.3)
|
||||
* http://www.afrusoft.com/htmlarea
|
||||
*/
|
||||
|
||||
/**
|
||||
* We use classes from ImageManager to avoid code duplication
|
||||
*/
|
||||
require_once '../ImageManager/Classes/Files.php';
|
||||
|
||||
/**
|
||||
* ExtendedFileManager Class.
|
||||
* @author Wei Zhuo, Afru, Krzysztof Kotowicz, Raimund Meyer
|
||||
* @version $Id$
|
||||
*/
|
||||
class ExtendedFileManager
|
||||
{
|
||||
/**
|
||||
* Configuration array.
|
||||
*/
|
||||
var $config;
|
||||
|
||||
/**
|
||||
* Array of directory information.
|
||||
*/
|
||||
var $dirs;
|
||||
|
||||
/**
|
||||
* Manager mode - image | link
|
||||
*/
|
||||
var $mode;
|
||||
|
||||
/**
|
||||
* Constructor. Create a new Image Manager instance.
|
||||
* @param array $config configuration array, see config.inc.php
|
||||
*/
|
||||
function ExtendedFileManager($config, $mode = null)
|
||||
{
|
||||
$this->config = $config;
|
||||
|
||||
$this->mode = empty($mode) ? (empty($config['insert_mode']) ? 'image' : $config['insert_mode']): $mode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the base directory.
|
||||
* @return string base dir, see config.inc.php
|
||||
*/
|
||||
function getImagesDir()
|
||||
{
|
||||
if ($this->mode == 'link' && isset($this->config['files_dir']))
|
||||
Return $this->config['files_dir'];
|
||||
else Return $this->config['images_dir'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the base URL.
|
||||
* @return string base url, see config.inc.php
|
||||
*/
|
||||
function getImagesURL()
|
||||
{
|
||||
if ($this->mode == 'link' && isset($this->config['files_url']))
|
||||
Return $this->config['files_url'];
|
||||
else Return $this->config['images_url'];
|
||||
}
|
||||
|
||||
function isValidBase()
|
||||
{
|
||||
return is_dir($this->getImagesDir());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the tmp file prefix.
|
||||
* @return string tmp file prefix.
|
||||
*/
|
||||
function getTmpPrefix()
|
||||
{
|
||||
Return $this->config['tmp_prefix'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the sub directories in the base dir.
|
||||
* Each array element contain
|
||||
* the relative path (relative to the base dir) as key and the
|
||||
* full path as value.
|
||||
* @return array of sub directries
|
||||
* <code>array('path name' => 'full directory path', ...)</code>
|
||||
*/
|
||||
function getDirs()
|
||||
{
|
||||
if(is_null($this->dirs))
|
||||
{
|
||||
$dirs = $this->_dirs($this->getImagesDir(),'/');
|
||||
ksort($dirs);
|
||||
$this->dirs = $dirs;
|
||||
}
|
||||
return $this->dirs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Recursively travese the directories to get a list
|
||||
* of accessable directories.
|
||||
* @param string $base the full path to the current directory
|
||||
* @param string $path the relative path name
|
||||
* @return array of accessiable sub-directories
|
||||
* <code>array('path name' => 'full directory path', ...)</code>
|
||||
*/
|
||||
function _dirs($base, $path)
|
||||
{
|
||||
$base = Files::fixPath($base);
|
||||
$dirs = array();
|
||||
|
||||
if($this->isValidBase() == false)
|
||||
return $dirs;
|
||||
|
||||
$d = @dir($base);
|
||||
|
||||
while (false !== ($entry = $d->read()))
|
||||
{
|
||||
//If it is a directory, and it doesn't start with
|
||||
// a dot, and if is it not the thumbnail directory
|
||||
if(is_dir($base.$entry)
|
||||
&& substr($entry,0,1) != '.'
|
||||
&& $this->isThumbDir($entry) == false)
|
||||
{
|
||||
$relative = Files::fixPath($path.$entry);
|
||||
$fullpath = Files::fixPath($base.$entry);
|
||||
$dirs[$relative] = $fullpath;
|
||||
$dirs = array_merge($dirs, $this->_dirs($fullpath, $relative));
|
||||
}
|
||||
}
|
||||
$d->close();
|
||||
|
||||
Return $dirs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all the files and directories of a relative path.
|
||||
* @param string $path relative path to be base path.
|
||||
* @return array of file and path information.
|
||||
* <code>array(0=>array('relative'=>'fullpath',...), 1=>array('filename'=>fileinfo array(),...)</code>
|
||||
* fileinfo array: <code>array('url'=>'full url',
|
||||
* 'relative'=>'relative to base',
|
||||
* 'fullpath'=>'full file path',
|
||||
* 'image'=>imageInfo array() false if not image,
|
||||
* 'stat' => filestat)</code>
|
||||
*/
|
||||
function getFiles($path)
|
||||
{
|
||||
$files = array();
|
||||
$dirs = array();
|
||||
|
||||
$valid_extensions = $this->mode == 'image' ? $this->config['allowed_image_extensions'] : $this->config['allowed_link_extensions'];
|
||||
|
||||
if($this->isValidBase() == false)
|
||||
return array($files,$dirs);
|
||||
|
||||
$path = Files::fixPath($path);
|
||||
$base = Files::fixPath($this->getImagesDir());
|
||||
$fullpath = Files::makePath($base,$path);
|
||||
|
||||
|
||||
$d = @dir($fullpath);
|
||||
|
||||
while (false !== ($entry = $d->read()))
|
||||
{
|
||||
//not a dot file or directory
|
||||
if(substr($entry,0,1) != '.')
|
||||
{
|
||||
if(is_dir($fullpath.$entry)
|
||||
&& $this->isThumbDir($entry) == false)
|
||||
{
|
||||
$relative = Files::fixPath($path.$entry);
|
||||
$full = Files::fixPath($fullpath.$entry);
|
||||
$count = $this->countFiles($full);
|
||||
$dirs[$relative] = array('fullpath'=>$full,'entry'=>$entry,'count'=>$count, 'stat'=>stat($fullpath.$entry));
|
||||
}
|
||||
|
||||
else if(is_file($fullpath.$entry) && $this->isThumb($entry)==false && $this->isTmpFile($entry) == false)
|
||||
{
|
||||
$afruext = strtolower(substr(strrchr($entry, "."), 1));
|
||||
|
||||
if(in_array($afruext,$valid_extensions))
|
||||
{
|
||||
|
||||
$file['url'] = Files::makePath($this->config['base_url'],$path).$entry;
|
||||
$file['relative'] = $path.$entry;
|
||||
$file['fullpath'] = $fullpath.$entry;
|
||||
$img = $this->getImageInfo($fullpath.$entry);
|
||||
if(!is_array($img)) $img[0]=$img[1]=0;
|
||||
$file['image'] = $img;
|
||||
$file['stat'] = stat($fullpath.$entry);
|
||||
$file['ext'] = $afruext;
|
||||
$files[$entry] = $file;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
$d->close();
|
||||
ksort($dirs);
|
||||
ksort($files);
|
||||
|
||||
Return array($dirs, $files);
|
||||
}
|
||||
|
||||
/**
|
||||
* Count the number of files and directories in a given folder
|
||||
* minus the thumbnail folders and thumbnails.
|
||||
*/
|
||||
function countFiles($path)
|
||||
{
|
||||
$total = 0;
|
||||
|
||||
if(is_dir($path))
|
||||
{
|
||||
$d = @dir($path);
|
||||
|
||||
while (false !== ($entry = $d->read()))
|
||||
{
|
||||
//echo $entry."<br>";
|
||||
if(substr($entry,0,1) != '.'
|
||||
&& $this->isThumbDir($entry) == false
|
||||
&& $this->isTmpFile($entry) == false
|
||||
&& $this->isThumb($entry) == false)
|
||||
{
|
||||
$total++;
|
||||
}
|
||||
}
|
||||
$d->close();
|
||||
}
|
||||
return $total;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get image size information.
|
||||
* @param string $file the image file
|
||||
* @return array of getImageSize information,
|
||||
* false if the file is not an image.
|
||||
*/
|
||||
function getImageInfo($file)
|
||||
{
|
||||
Return @getImageSize($file);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the file contains the thumbnail prefix.
|
||||
* @param string $file filename to be checked
|
||||
* @return true if the file contains the thumbnail prefix, false otherwise.
|
||||
*/
|
||||
function isThumb($file)
|
||||
{
|
||||
$len = strlen($this->config['thumbnail_prefix']);
|
||||
if(substr($file,0,$len)==$this->config['thumbnail_prefix'])
|
||||
Return true;
|
||||
else
|
||||
Return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the given directory is a thumbnail directory.
|
||||
* @param string $entry directory name
|
||||
* @return true if it is a thumbnail directory, false otherwise
|
||||
*/
|
||||
function isThumbDir($entry)
|
||||
{
|
||||
if($this->config['thumbnail_dir'] == false
|
||||
|| strlen(trim($this->config['thumbnail_dir'])) == 0)
|
||||
Return false;
|
||||
else
|
||||
Return ($entry == $this->config['thumbnail_dir']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the given file is a tmp file.
|
||||
* @param string $file file name
|
||||
* @return boolean true if it is a tmp file, false otherwise
|
||||
*/
|
||||
function isTmpFile($file)
|
||||
{
|
||||
$len = strlen($this->config['tmp_prefix']);
|
||||
if(substr($file,0,$len)==$this->config['tmp_prefix'])
|
||||
Return true;
|
||||
else
|
||||
Return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* For a given image file, get the respective thumbnail filename
|
||||
* no file existence check is done.
|
||||
* @param string $fullpathfile the full path to the image file
|
||||
* @return string of the thumbnail file
|
||||
*/
|
||||
function getThumbName($fullpathfile)
|
||||
{
|
||||
$path_parts = pathinfo($fullpathfile);
|
||||
|
||||
$thumbnail = $this->config['thumbnail_prefix'].$path_parts['basename'];
|
||||
|
||||
if($this->config['safe_mode'] == true
|
||||
|| strlen(trim($this->config['thumbnail_dir'])) == 0)
|
||||
{
|
||||
Return Files::makeFile($path_parts['dirname'],$thumbnail);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(strlen(trim($this->config['thumbnail_dir'])) > 0)
|
||||
{
|
||||
$path = Files::makePath($path_parts['dirname'],$this->config['thumbnail_dir']);
|
||||
if(!is_dir($path))
|
||||
Files::createFolder($path);
|
||||
Return Files::makeFile($path,$thumbnail);
|
||||
}
|
||||
else //should this ever happen?
|
||||
{
|
||||
//error_log('ExtendedFileManager: Error in creating thumbnail name');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Similar to getThumbName, but returns the URL, base on the
|
||||
* given base_url in config.inc.php
|
||||
* @param string $relative the relative image file name,
|
||||
* relative to the base_dir path
|
||||
* @return string the url of the thumbnail
|
||||
*/
|
||||
function getThumbURL($relative)
|
||||
{
|
||||
$path_parts = pathinfo($relative);
|
||||
$thumbnail = $this->config['thumbnail_prefix'].$path_parts['basename'];
|
||||
if($path_parts['dirname']=='\\') $path_parts['dirname']='/';
|
||||
|
||||
if($this->config['safe_mode'] == true
|
||||
|| strlen(trim($this->config['thumbnail_dir'])) == 0)
|
||||
{
|
||||
Return Files::makeFile($this->getImagesURL(),$thumbnail);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(strlen(trim($this->config['thumbnail_dir'])) > 0)
|
||||
{
|
||||
$path = Files::makePath($path_parts['dirname'],$this->config['thumbnail_dir']);
|
||||
$url_path = Files::makePath($this->getImagesURL(), $path);
|
||||
Return Files::makeFile($url_path,$thumbnail);
|
||||
}
|
||||
else //should this ever happen?
|
||||
{
|
||||
//error_log('ExtendedFileManager: Error in creating thumbnail url');
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* For a given image file, get the respective resized filename
|
||||
* no file existence check is done.
|
||||
* @param string $fullpathfile the full path to the image file
|
||||
* @param integer $width the intended width
|
||||
* @param integer $height the intended height
|
||||
* @param boolean $mkDir whether to attempt to make the resized_dir if it doesn't exist
|
||||
* @return string of the resized filename
|
||||
*/
|
||||
function getResizedName($fullpathfile, $width, $height, $mkDir = TRUE)
|
||||
{
|
||||
$path_parts = pathinfo($fullpathfile);
|
||||
|
||||
$thumbnail = $this->config['resized_prefix']."_{$width}x{$height}_{$path_parts['basename']}";
|
||||
|
||||
if( strlen(trim($this->config['resized_dir'])) == 0 || $this->config['safe_mode'] == true )
|
||||
{
|
||||
Return Files::makeFile($path_parts['dirname'],$thumbnail);
|
||||
}
|
||||
else
|
||||
{
|
||||
$path = Files::makePath($path_parts['dirname'],$this->config['resized_dir']);
|
||||
if($mkDir && !is_dir($path))
|
||||
Files::createFolder($path);
|
||||
Return Files::makeFile($path,$thumbnail);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the given path is part of the subdirectories
|
||||
* under the base_dir.
|
||||
* @param string $path the relative path to be checked
|
||||
* @return boolean true if the path exists, false otherwise
|
||||
*/
|
||||
function validRelativePath($path)
|
||||
{
|
||||
$dirs = $this->getDirs();
|
||||
if($path == '/')
|
||||
Return true;
|
||||
//check the path given in the url against the
|
||||
//list of paths in the system.
|
||||
for($i = 0; $i < count($dirs); $i++)
|
||||
{
|
||||
$key = key($dirs);
|
||||
//we found the path
|
||||
if($key == $path)
|
||||
Return true;
|
||||
|
||||
next($dirs);
|
||||
}
|
||||
Return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Process uploaded files, assumes the file is in
|
||||
* $_FILES['upload'] and $_POST['dir'] is set.
|
||||
* The dir must be relative to the base_dir and exists.
|
||||
* @return null
|
||||
*/
|
||||
function processUploads()
|
||||
{
|
||||
if($this->isValidBase() == false)
|
||||
return;
|
||||
|
||||
$relative = null;
|
||||
|
||||
if(isset($_POST['dir']))
|
||||
$relative = rawurldecode($_POST['dir']);
|
||||
else
|
||||
return;
|
||||
|
||||
//check for the file, and must have valid relative path
|
||||
if(isset($_FILES['upload']) && $this->validRelativePath($relative))
|
||||
{
|
||||
Return $this->_processFiles($relative, $_FILES['upload']);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Process upload files. The file must be an
|
||||
* uploaded file. Any duplicate
|
||||
* file will be renamed. See Files::copyFile for details
|
||||
* on renaming.
|
||||
* @param string $relative the relative path where the file
|
||||
* should be copied to.
|
||||
* @param array $file the uploaded file from $_FILES
|
||||
* @return boolean true if the file was processed successfully,
|
||||
* false otherwise
|
||||
*/
|
||||
function _processFiles($relative, $file)
|
||||
{
|
||||
|
||||
if($file['error']!=0)
|
||||
{
|
||||
Return false;
|
||||
}
|
||||
|
||||
if(!is_uploaded_file($file['tmp_name']))
|
||||
{
|
||||
Files::delFile($file['tmp_name']);
|
||||
Return false;
|
||||
}
|
||||
|
||||
$valid_extensions = $this->mode == 'image' ? $this->config['allowed_image_extensions'] : $this->config['allowed_link_extensions'];
|
||||
$max_size = $this->mode == 'image' ? $this->config['max_filesize_kb_image'] : $this->config['max_filesize_kb_link'];
|
||||
$afruext = strtolower(substr(strrchr($file['name'], "."), 1));
|
||||
|
||||
if(!in_array($afruext, $valid_extensions))
|
||||
{
|
||||
Files::delFile($file['tmp_name']);
|
||||
Return 'Cannot upload $extension='.$afruext.'$ Files. Permission denied.';
|
||||
}
|
||||
|
||||
if($file['size']>($max_size*1024))
|
||||
{
|
||||
Files::delFile($file['tmp_name']);
|
||||
Return 'Unble to upload file. Maximum file size [$max_size='.$max_size.'$ KB] exceeded.';
|
||||
}
|
||||
|
||||
if(!empty($this->config['max_foldersize_mb']) && (Files::dirSize($this->getImagesDir()))+$file['size']> ($this->config['max_foldersize_mb']*1048576))
|
||||
{
|
||||
Files::delFile($file['tmp_name']);
|
||||
Return ("Cannot upload. Maximum folder size reached. Delete unwanted files and try again.");
|
||||
}
|
||||
|
||||
//now copy the file
|
||||
$path = Files::makePath($this->getImagesDir(),$relative);
|
||||
$result = Files::copyFile($file['tmp_name'], $path, $file['name']);
|
||||
|
||||
//no copy error
|
||||
if(!is_int($result))
|
||||
{
|
||||
Files::delFile($file['tmp_name']);
|
||||
Return 'File "$file='.$file['name'].'$" successfully uploaded.';
|
||||
}
|
||||
|
||||
//delete tmp files.
|
||||
Files::delFile($file['tmp_name']);
|
||||
Return false;
|
||||
|
||||
}
|
||||
|
||||
|
||||
function getDiskInfo()
|
||||
{
|
||||
if (empty($this->config['max_foldersize_mb']))
|
||||
return '';
|
||||
|
||||
$tmpFreeSize=($this->config['max_foldersize_mb']*1048576)-Files::dirSize($this->getImagesDir());
|
||||
|
||||
if(!is_numeric($tmpFreeSize) || $tmpFreeSize<0) $tmpFreeSize=0;
|
||||
|
||||
Return 'Total Size : $max_foldersize_mb='.$this->config['max_foldersize_mb'].'$ MB, Free Space: $free_space='.Files::formatSize($tmpFreeSize).'$';
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get the URL of the relative file.
|
||||
* basically appends the relative file to the
|
||||
* base_url given in config.inc.php
|
||||
* @param string $relative a file the relative to the base_dir
|
||||
* @return string the URL of the relative file.
|
||||
*/
|
||||
function getFileURL($relative)
|
||||
{
|
||||
Return Files::makeFile($this->getImagesURL(),$relative);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the fullpath to a relative file.
|
||||
* @param string $relative the relative file.
|
||||
* @return string the full path, .ie. the base_dir + relative.
|
||||
*/
|
||||
function getFullPath($relative)
|
||||
{
|
||||
Return Files::makeFile($this->getImagesDir(),$relative);;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the default thumbnail.
|
||||
* @return string default thumbnail, empty string if
|
||||
* the thumbnail doesn't exist.
|
||||
*/
|
||||
function getDefaultThumb()
|
||||
{
|
||||
if(is_file($this->config['default_thumbnail']))
|
||||
Return $this->config['default_thumbnail'];
|
||||
else
|
||||
Return '';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks image size. If the image size is less than default size
|
||||
* returns the original size else returns default size to display thumbnail
|
||||
*/
|
||||
function checkImageSize($relative)
|
||||
{
|
||||
$fullpath = Files::makeFile($this->getImagesDir(),$relative);
|
||||
|
||||
$afruext = strtolower(substr(strrchr($relative, "."), 1));
|
||||
|
||||
if(!in_array($afruext,$this->config['thumbnail_extensions']))
|
||||
{
|
||||
$imgInfo=array(0,0);
|
||||
Return $imgInfo;
|
||||
}
|
||||
else
|
||||
{
|
||||
$imgInfo = @getImageSize($fullpath);
|
||||
//not an image
|
||||
if(!is_array($imgInfo))
|
||||
{
|
||||
$imgInfo=array(0,0);
|
||||
Return $imgInfo;
|
||||
}
|
||||
else
|
||||
{
|
||||
if($imgInfo[0] > $this->config['thumbnail_width'])
|
||||
$imgInfo[0] = $this->config['thumbnail_width'];
|
||||
|
||||
if($imgInfo[1] > $this->config['thumbnail_height'])
|
||||
$imgInfo[1] = $this->config['thumbnail_height'];
|
||||
|
||||
Return $imgInfo;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the thumbnail url to be displayed.
|
||||
* If the thumbnail exists, and it is up-to-date
|
||||
* the thumbnail url will be returns. If the
|
||||
* file is not an image, a default image will be returned.
|
||||
* If it is an image file, and no thumbnail exists or
|
||||
* the thumbnail is out-of-date (i.e. the thumbnail
|
||||
* modified time is less than the original file)
|
||||
* then a thumbs.php?img=filename.jpg is returned.
|
||||
* The thumbs.php url will generate a new thumbnail
|
||||
* on the fly. If the image is less than the dimensions
|
||||
* of the thumbnails, the image will be display instead.
|
||||
* @param string $relative the relative image file.
|
||||
* @return string the url of the thumbnail, be it
|
||||
* actually thumbnail or a script to generate the
|
||||
* thumbnail on the fly.
|
||||
*/
|
||||
function getThumbnail($relative)
|
||||
{
|
||||
global $IMConfig;
|
||||
|
||||
$fullpath = Files::makeFile($this->getImagesDir(),$relative);
|
||||
|
||||
//not a file???
|
||||
if(!is_file($fullpath))
|
||||
Return $this->getDefaultThumb();
|
||||
|
||||
$afruext = strtolower(substr(strrchr($relative, "."), 1));
|
||||
|
||||
if(!in_array($afruext,$this->config['thumbnail_extensions']))
|
||||
{
|
||||
if(is_file('icons/'.$afruext.'.gif'))
|
||||
Return('icons/'.$afruext.'.gif');
|
||||
else
|
||||
Return $this->getDefaultThumb();
|
||||
}
|
||||
|
||||
$imgInfo = @getImageSize($fullpath);
|
||||
|
||||
//not an image
|
||||
if(!is_array($imgInfo))
|
||||
Return $this->getDefaultThumb();
|
||||
|
||||
|
||||
//Returning original image as thumbnail without Image Library by Afru
|
||||
if(!$this->config['img_library']) Return $this->getFileURL($relative);
|
||||
|
||||
|
||||
//the original image is smaller than thumbnails,
|
||||
//so just return the url to the original image.
|
||||
if ($imgInfo[0] <= $this->config['thumbnail_width']
|
||||
&& $imgInfo[1] <= $this->config['thumbnail_height'])
|
||||
Return $this->getFileURL($relative);
|
||||
|
||||
$thumbnail = $this->getThumbName($fullpath);
|
||||
|
||||
//check for thumbnails, if exists and
|
||||
// it is up-to-date, return the thumbnail url
|
||||
if(is_file($thumbnail))
|
||||
{
|
||||
if(filemtime($thumbnail) >= filemtime($fullpath))
|
||||
Return $this->getThumbURL($relative);
|
||||
}
|
||||
|
||||
//well, no thumbnail was found, so ask the thumbs.php
|
||||
//to generate the thumbnail on the fly.
|
||||
Return $IMConfig['backend_url'] . '__function=thumbs&img='.rawurlencode($relative)."&mode=$this->mode";
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete and specified files.
|
||||
* @return boolean true if delete, false otherwise
|
||||
*/
|
||||
function deleteFiles()
|
||||
{
|
||||
if(isset($_GET['delf']))
|
||||
return $this->_delFile(rawurldecode($_GET['delf']));
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete and specified directories.
|
||||
* @return boolean true if delete, false otherwise
|
||||
*/
|
||||
function deleteDirs()
|
||||
{
|
||||
if(isset($_GET['deld']))
|
||||
return $this->_delDir(rawurldecode($_GET['deld']));
|
||||
else
|
||||
Return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete the relative file, and any thumbnails.
|
||||
* @param string $relative the relative file.
|
||||
* @return boolean true if deleted, false otherwise.
|
||||
*/
|
||||
function _delFile($relative)
|
||||
{
|
||||
$fullpath = Files::makeFile($this->getImagesDir(),$relative);
|
||||
|
||||
$afruext = strtolower(substr(strrchr($relative, "."), 1));
|
||||
|
||||
$valid_extensions = $this->mode == 'image' ? $this->config['allowed_image_extensions'] : $this->config['allowed_link_extensions'];
|
||||
|
||||
if(!in_array($afruext,$valid_extensions))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//check that the file is an image
|
||||
if(is_array($this->getImageInfo($fullpath)))
|
||||
{
|
||||
$thumbnail = $this->getThumbName($fullpath);
|
||||
Files::delFile($thumbnail);
|
||||
}
|
||||
|
||||
Return Files::delFile($fullpath);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete directories recursively.
|
||||
* @param string $relative the relative path to be deleted.
|
||||
* @return boolean true if deleted, false otherwise.
|
||||
*/
|
||||
function _delDir($relative)
|
||||
{
|
||||
$fullpath = Files::makePath($this->getImagesDir(),$relative);
|
||||
// if($this->countFiles($fullpath) <= 0)
|
||||
return Files::delFolder($fullpath,true); //delete recursively.
|
||||
//else
|
||||
//Return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create new directories.
|
||||
* If in safe_mode, nothing happens.
|
||||
* @return boolean true if created, false otherwise.
|
||||
*/
|
||||
function processNewDir()
|
||||
{
|
||||
if($this->config['safe_mode'] == true)
|
||||
Return false;
|
||||
|
||||
if(isset($_GET['newDir']) && isset($_GET['dir']))
|
||||
{
|
||||
$newDir = rawurldecode($_GET['newDir']);
|
||||
$dir = rawurldecode($_GET['dir']);
|
||||
$path = Files::makePath($this->getImagesDir(),$dir);
|
||||
$fullpath = Files::makePath($path, Files::escape($newDir));
|
||||
if(is_dir($fullpath))
|
||||
Return false;
|
||||
|
||||
Return Files::createFolder($fullpath);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Renames files if certain GET variables are set
|
||||
* @return bool
|
||||
*/
|
||||
function processRenames()
|
||||
{
|
||||
if(!empty($_GET['rename']) && !empty($_GET['renameTo']))
|
||||
{
|
||||
// new file name (without path and extension)
|
||||
$newName = Files::escape(rawurldecode($_GET['renameTo']));
|
||||
$newName = str_replace('.', '', $newName);
|
||||
|
||||
// path to file (from base images directory)
|
||||
$oldName = rawurldecode($_GET['rename']);
|
||||
|
||||
// strip parent dir ("..") to avoid escaping from base directiory
|
||||
$oldName = preg_replace('#\.\.#', '', $oldName);
|
||||
|
||||
if (is_dir($oldPath = Files::makeFile($this->getImagesDir(), $_GET['dir'].$oldName)))
|
||||
{
|
||||
$newPath = Files::makeFile($this->getImagesDir(), $_GET['dir'].$newName);
|
||||
return Files::rename($oldPath,$newPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
// path to old file
|
||||
$oldPath = Files::makeFile($this->getImagesDir(), $oldName);
|
||||
|
||||
$ret = Files::renameFile($oldPath, $newName);
|
||||
if ($ret === true) {
|
||||
// delete old thumbnail
|
||||
Files::delFile($this->getThumbname($oldPath));
|
||||
}
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
function processPaste()
|
||||
{
|
||||
switch ($_GET['paste'])
|
||||
{
|
||||
case 'copyFile':
|
||||
$src = Files::makeFile($this->getImagesDir(), $_GET['srcdir'].$_GET['file']);
|
||||
$file = $_GET['file'];
|
||||
$dest = Files::makeFile($this->getImagesDir(), $_GET['dir']);
|
||||
return Files::copyFile($src,$dest,$file);
|
||||
break;
|
||||
case 'copyDir':
|
||||
$basePath = $this->getImagesDir();
|
||||
$src = $_GET['srcdir'].$_GET['file'];
|
||||
$dest = $_GET['dir'].$_GET['file'];
|
||||
return Files::copyDir($basePath,$src,$dest);
|
||||
break;
|
||||
case 'moveFile':
|
||||
$src = Files::makeFile($this->getImagesDir(), $_GET['srcdir'].$_GET['file']);
|
||||
$dest = Files::makeFile($this->getImagesDir(), $_GET['dir'].$_GET['file']);
|
||||
return Files::rename($src,$dest);
|
||||
break;
|
||||
case 'moveDir':
|
||||
$src = Files::makeFile($this->getImagesDir(), $_GET['srcdir'].$_GET['file']);
|
||||
$dest = Files::makeFile($this->getImagesDir(), $_GET['dir'].$_GET['file']);
|
||||
return Files::rename($src,$dest);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -0,0 +1,326 @@
|
|||
/**
|
||||
* ExtendedFileManager extended-file-manager.js file.
|
||||
* Authors: Wei Zhuo, Afru, Krzysztof Kotowicz, Raimund Meyer
|
||||
* Modified by: Krzysztof Kotowicz <koto@webworkers.pl>
|
||||
* Version: Updated on 08-01-2005 by Afru
|
||||
* Version: Modified on 20-06-2006 by Krzysztof Kotowicz
|
||||
* Version: Updated on 29-10-2006 by Raimund Meyer
|
||||
* Version: Updated on 20-01-2008 by Raimund Meyer
|
||||
* Package: ExtendedFileManager (EFM 1.4)
|
||||
*/
|
||||
|
||||
/**
|
||||
* For installation details see Readme.txt in the plugin folder
|
||||
*
|
||||
*/
|
||||
|
||||
function ExtendedFileManager(editor)
|
||||
{
|
||||
|
||||
this.editor = editor;
|
||||
|
||||
var cfg = editor.config;
|
||||
var toolbar = cfg.toolbar;
|
||||
var self = this;
|
||||
|
||||
if (cfg.ExtendedFileManager.use_linker) {
|
||||
cfg.registerButton({
|
||||
id : "linkfile",
|
||||
tooltip : Xinha._lc("Insert File Link",'ExtendedFileManager'),
|
||||
image : Xinha.getPluginDir('ExtendedFileManager') + '/img/ed_linkfile.gif',
|
||||
textMode : false,
|
||||
action : function(editor) {
|
||||
editor._linkFile();
|
||||
}
|
||||
});
|
||||
cfg.addToolbarElement("linkfile", "createlink", 1);
|
||||
};
|
||||
|
||||
var manager = editor.config.ExtendedFileManager.backend + '__function=manager';
|
||||
if(cfg.ExtendedFileManager.backend_config != null)
|
||||
{
|
||||
manager += '&backend_config='
|
||||
+ encodeURIComponent(cfg.ExtendedFileManager.backend_config);
|
||||
manager += '&backend_config_hash='
|
||||
+ encodeURIComponent(cfg.ExtendedFileManager.backend_config_hash);
|
||||
manager += '&backend_config_secret_key_location='
|
||||
+ encodeURIComponent(cfg.ExtendedFileManager.backend_config_secret_key_location);
|
||||
}
|
||||
|
||||
if(cfg.ExtendedFileManager.backend_data != null)
|
||||
{
|
||||
for ( var i in cfg.ExtendedFileManager.backend_data )
|
||||
{
|
||||
manager += '&' + i + '=' + encodeURIComponent(cfg.ExtendedFileManager.backend_data[i]);
|
||||
}
|
||||
}
|
||||
cfg.ExtendedFileManager.manager = manager;
|
||||
}
|
||||
|
||||
ExtendedFileManager._pluginInfo = {
|
||||
name : "ExtendedFileManager",
|
||||
version : "1.4",
|
||||
developer : "Afru, Krzysztof Kotowicz, Raimund Meyer",
|
||||
developer_url : "http://xinha.org",
|
||||
license : "htmlArea"
|
||||
};
|
||||
|
||||
Xinha.Config.prototype.ExtendedFileManager =
|
||||
{
|
||||
'use_linker': true,
|
||||
'backend' : Xinha.getPluginDir('ExtendedFileManager') + '/backend.php?__plugin=ExtendedFileManager&',
|
||||
'backend_data' : null,
|
||||
// deprecated keys, use passing data through e.g. xinha_pass_to_php_backend()
|
||||
'backend_config' : null,
|
||||
'backend_config_hash': null,
|
||||
'backend_config_secret_key_location': 'Xinha:ExtendedFileManager'
|
||||
};
|
||||
|
||||
// Over ride the _insertImage function in htmlarea.js.
|
||||
// Open up the ExtendedFileManger script instead.
|
||||
if(typeof ImageManager == 'undefined')
|
||||
{
|
||||
Xinha.prototype._insertImage = function(image) {
|
||||
|
||||
var editor = this; // for nested functions
|
||||
var outparam = {"editor" : this, param : null};
|
||||
|
||||
if (typeof image == "undefined") {
|
||||
image = this.getParentElement();
|
||||
if (image && !/^img$/i.test(image.tagName))
|
||||
image = null;
|
||||
}
|
||||
|
||||
if (image) {
|
||||
outparam.param = {
|
||||
f_url : Xinha.is_ie ? image.src : image.getAttribute("src"),
|
||||
f_alt : image.alt,
|
||||
f_title : image.title,
|
||||
f_border : image.style.borderWidth ? image.style.borderWidth : image.border,
|
||||
f_align : image.align,
|
||||
f_width : image.width,
|
||||
f_height : image.height,
|
||||
f_padding: image.style.padding,
|
||||
f_margin : image.style.margin,
|
||||
f_backgroundColor: image.style.backgroundColor,
|
||||
f_borderColor: image.style.borderColor,
|
||||
baseHref: editor.config.baseHref
|
||||
};
|
||||
|
||||
// compress 'top right bottom left' syntax into one value if possible
|
||||
outparam.param.f_border = shortSize(outparam.param.f_border);
|
||||
outparam.param.f_padding = shortSize(outparam.param.f_padding);
|
||||
outparam.param.f_margin = shortSize(outparam.param.f_margin);
|
||||
|
||||
// convert rgb() calls to rgb hex
|
||||
outparam.param.f_backgroundColor = convertToHex(outparam.param.f_backgroundColor);
|
||||
outparam.param.f_borderColor = convertToHex(outparam.param.f_borderColor);
|
||||
|
||||
}
|
||||
Dialog(this.config.ExtendedFileManager.manager, function(param){
|
||||
if (!param)
|
||||
{ // user must have pressed Cancel
|
||||
return false;
|
||||
}
|
||||
|
||||
var img = image;
|
||||
if (!img) {
|
||||
if ( !param.f_url ) return false;
|
||||
if (Xinha.is_ie) {
|
||||
var sel = editor.getSelection();
|
||||
var range = editor.createRange(sel);
|
||||
editor._doc.execCommand("insertimage", false, param.f_url);
|
||||
img = range.parentElement();
|
||||
// wonder if this works...
|
||||
if (img.tagName.toLowerCase() != "img") {
|
||||
img = img.previousSibling;
|
||||
}
|
||||
|
||||
} else {
|
||||
img = document.createElement('img');
|
||||
img.src = param.f_url;
|
||||
editor.insertNodeAtSelection(img);
|
||||
}
|
||||
|
||||
} else {
|
||||
if ( !param.f_url ) { // delete the image if empty url passed
|
||||
img.parentNode.removeChild(img);
|
||||
editor.updateToolbar();
|
||||
return false;
|
||||
} else {
|
||||
img.src = param.f_url;
|
||||
}
|
||||
}
|
||||
|
||||
img.alt = img.alt ? img.alt : '';
|
||||
|
||||
for (field in param)
|
||||
{
|
||||
var value = param[field];
|
||||
switch (field)
|
||||
{
|
||||
case "f_alt" : img.alt = value; break;
|
||||
case "f_title" : img.title = value; break;
|
||||
case "f_border" :
|
||||
if (value)
|
||||
{
|
||||
img.style.borderWidth = /[^0-9]/.test(value) ? value : (value != '') ? (parseInt(value) + 'px') : '';
|
||||
if(img.style.borderWidth && !img.style.borderStyle)
|
||||
{
|
||||
img.style.borderStyle = 'solid';
|
||||
}
|
||||
else if (!img.style.borderWidth)
|
||||
{
|
||||
img.style.border = '';
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "f_borderColor": img.style.borderColor = value; break;
|
||||
case "f_backgroundColor": img.style.backgroundColor = value; break;
|
||||
case "f_align" : img.align = value; break;
|
||||
case "f_width" :
|
||||
if ( parseInt( value ) > 0 )
|
||||
{
|
||||
img.width = parseInt(value);
|
||||
}
|
||||
break;
|
||||
case "f_height" :
|
||||
if ( parseInt( value ) > 0 )
|
||||
{
|
||||
img.height = parseInt(value);
|
||||
}
|
||||
break;
|
||||
case "f_padding": img.style.padding =
|
||||
/[^0-9]/.test(value) ? value : (value != '') ? (parseInt(value) + 'px') :''; break;
|
||||
case "f_margin": img.style.margin =
|
||||
/[^0-9]/.test(value) ? value : (value != '') ? (parseInt(value) + 'px') :''; break;
|
||||
}
|
||||
}
|
||||
|
||||
}, outparam);
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
Xinha.prototype._linkFile = function(link) {
|
||||
|
||||
var editor = this;
|
||||
var outparam = {"editor" : this, param : null};
|
||||
if (typeof link == "undefined") {
|
||||
link = this.getParentElement();
|
||||
if (link) {
|
||||
if (/^img$/i.test(link.tagName))
|
||||
link = link.parentNode;
|
||||
if (!/^a$/i.test(link.tagName))
|
||||
link = null;
|
||||
}
|
||||
}
|
||||
if (!link) {
|
||||
var sel = editor.getSelection();
|
||||
var range = editor.createRange(sel);
|
||||
var compare = 0;
|
||||
if (Xinha.is_ie) {
|
||||
if ( sel.type == "Control" )
|
||||
compare = range.length;
|
||||
else
|
||||
compare = range.compareEndPoints("StartToEnd", range);
|
||||
} else {
|
||||
compare = range.compareBoundaryPoints(range.START_TO_END, range);
|
||||
}
|
||||
if (compare == 0) {
|
||||
alert(Xinha._lc("You must select some text before making a new link.", 'ExtendedFileManager'));
|
||||
return;
|
||||
}
|
||||
outparam.param = {
|
||||
f_href : '',
|
||||
f_title : '',
|
||||
f_target : '',
|
||||
f_usetarget : editor.config.makeLinkShowsTarget,
|
||||
baseHref: editor.config.baseHref
|
||||
};
|
||||
} else
|
||||
outparam.param = {
|
||||
f_href : Xinha.is_ie ? link.href : link.getAttribute("href"),
|
||||
f_title : link.title,
|
||||
f_target : link.target,
|
||||
f_usetarget : editor.config.makeLinkShowsTarget,
|
||||
baseHref: editor.config.baseHref
|
||||
};
|
||||
|
||||
Dialog(this.config.ExtendedFileManager.manager+'&mode=link', function(param){
|
||||
if (!param)
|
||||
return false;
|
||||
var a = link;
|
||||
if (!a) try {
|
||||
editor._doc.execCommand("createlink", false, param.f_href);
|
||||
a = editor.getParentElement();
|
||||
var sel = editor.getSelection();
|
||||
var range = editor.createRange(sel);
|
||||
if (!Xinha.is_ie) {
|
||||
a = range.startContainer;
|
||||
if (!/^a$/i.test(a.tagName)) {
|
||||
a = a.nextSibling;
|
||||
if (a == null)
|
||||
a = range.startContainer.parentNode;
|
||||
}
|
||||
}
|
||||
} catch(e) {}
|
||||
else {
|
||||
var href = param.f_href.trim();
|
||||
editor.selectNodeContents(a);
|
||||
if (href == "") {
|
||||
editor._doc.execCommand("unlink", false, null);
|
||||
editor.updateToolbar();
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
a.href = href;
|
||||
}
|
||||
}
|
||||
if (!(a && /^a$/i.test(a.tagName)))
|
||||
return false;
|
||||
a.target = param.f_target.trim();
|
||||
a.title = param.f_title.trim();
|
||||
editor.selectNodeContents(a);
|
||||
editor.updateToolbar();
|
||||
}, outparam);
|
||||
};
|
||||
|
||||
function shortSize(cssSize)
|
||||
{
|
||||
if(/ /.test(cssSize))
|
||||
{
|
||||
var sizes = cssSize.split(' ');
|
||||
var useFirstSize = true;
|
||||
for(var i = 1; i < sizes.length; i++)
|
||||
{
|
||||
if(sizes[0] != sizes[i])
|
||||
{
|
||||
useFirstSize = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(useFirstSize) cssSize = sizes[0];
|
||||
}
|
||||
|
||||
return cssSize;
|
||||
}
|
||||
|
||||
function convertToHex(color) {
|
||||
|
||||
if (typeof color == "string" && /, /.test.color)
|
||||
color = color.replace(/, /, ','); // rgb(a, b) => rgb(a,b)
|
||||
|
||||
if (typeof color == "string" && / /.test.color) { // multiple values
|
||||
var colors = color.split(' ');
|
||||
var colorstring = '';
|
||||
for (var i = 0; i < colors.length; i++) {
|
||||
colorstring += Xinha._colorToRgb(colors[i]);
|
||||
if (i + 1 < colors.length)
|
||||
colorstring += " ";
|
||||
}
|
||||
return colorstring;
|
||||
}
|
||||
|
||||
return Xinha._colorToRgb(color);
|
||||
}
|
||||
|
|
@ -0,0 +1,111 @@
|
|||
Package : Extended File Manager EFM 1.1.1
|
||||
|
||||
Version 1.1 created from 1.0 beta by Krzysztof Kotowicz <koto@webworkers.pl>
|
||||
|
||||
Overview :
|
||||
----------
|
||||
|
||||
Extended File Manager is an advanced plugin for Xinha
|
||||
|
||||
It works in two different modes.
|
||||
1). Insert Image Mode and
|
||||
2). Insert File Link Mode.
|
||||
|
||||
In Insert Image Mode, it replaces the basic insert image functionality of Xinha with its advanced image manager.
|
||||
|
||||
If Insert File Link Mode is enabled, a new icon will be added to the toolbar with advanced file linking capability.
|
||||
|
||||
|
||||
|
||||
Complete Features :
|
||||
-------------------
|
||||
* Easy config.inc file that enables individual options for both modes.
|
||||
* Thumnail View
|
||||
* List View
|
||||
* Nice icons for both views
|
||||
* Create Folders
|
||||
* Vertical Scrolling
|
||||
* Allowed extensions to view or upload.
|
||||
* File Uploads
|
||||
* Max File upload limit
|
||||
* Max Upload Folder size (Including all subfolders and files. A must see option.)
|
||||
* Dynamic display of available free space in the Upload Folder
|
||||
* Dynamic Thumbnails using Image libraries or browser resize
|
||||
* Image Editor (Actually done by Wei...a great addon)
|
||||
* Can be used to insert images along with properties.
|
||||
* Can be used to insert link to non-image files like pdf or zip.
|
||||
* You can specify image margin / padding / background and border colors
|
||||
* You may edit Alt/title tags for inserted images
|
||||
|
||||
(Most of the features can be enabled/disabled as needed)
|
||||
|
||||
Installation :
|
||||
--------------
|
||||
|
||||
Installing involves extracting the archive to 'plugins' subdirectory of Xinha
|
||||
and selecting the plugin in appropriate xinha_plugins list.
|
||||
|
||||
Plugin may be configured via xinha_config.ExtendedFileManager object.
|
||||
Look into ImageManager plugin documentation as this plugin uses almost identical
|
||||
settings. All available options can be found in the file config.inc.php.
|
||||
|
||||
// only snippets of code from initializing file shown below
|
||||
|
||||
|
||||
xinha_plugins = xinha_plugins ? xinha_plugins :
|
||||
[
|
||||
'ContextMenu',
|
||||
'SuperClean',
|
||||
'CharacterMap',
|
||||
'GetHtml',
|
||||
'ExtendedFileManager',
|
||||
/*'ImageManager',*/ // replace image manager with EFM
|
||||
'Linker'
|
||||
];
|
||||
|
||||
...
|
||||
|
||||
//If you don't want to add a button for linking files and use only the advanced ImageManager
|
||||
xinha_config.ExtendedFileManager.use_linker = false;
|
||||
// pass the configuration to plugin
|
||||
if (xinha_config.ExtendedFileManager) {
|
||||
with (xinha_config.ExtendedFileManager)
|
||||
{
|
||||
<?php
|
||||
|
||||
// define backend configuration for the plugin
|
||||
$IMConfig = array();
|
||||
$IMConfig['images_dir'] = '<images dir>';
|
||||
$IMConfig['images_url'] = '<images url>';
|
||||
$IMConfig['files_dir'] = '<files dir>';
|
||||
$IMConfig['files_url'] = '<files url>';
|
||||
$IMConfig['thumbnail_prefix'] = 't_';
|
||||
$IMConfig['thumbnail_dir'] = 't';
|
||||
$IMConfig['resized_prefix'] = 'resized_';
|
||||
$IMConfig['resized_dir'] = '';
|
||||
$IMConfig['tmp_prefix'] = '_tmp';
|
||||
$IMConfig['max_filesize_kb_image'] = 2000;
|
||||
// maximum size for uploading files in 'insert image' mode (2000 kB here)
|
||||
|
||||
$IMConfig['max_filesize_kb_link'] = 5000;
|
||||
// maximum size for uploading files in 'insert link' mode (5000 kB here)
|
||||
|
||||
// Maximum upload folder size in Megabytes.
|
||||
// Use 0 to disable limit
|
||||
$IMConfig['max_foldersize_mb'] = 0;
|
||||
|
||||
$IMConfig['allowed_image_extensions'] = array("jpg","gif","png");
|
||||
$IMConfig['allowed_link_extensions'] = array("jpg","gif","pdf","ip","txt",
|
||||
"psd","png","html","swf",
|
||||
"xml","xls");
|
||||
|
||||
require_once '/path/to/xinha/contrib/php-xinha.php';
|
||||
xinha_pass_to_php_backend($IMConfig);
|
||||
|
||||
?>
|
||||
}
|
||||
}
|
||||
|
||||
=====
|
||||
afrusoft@gmail.com - author of EFM 1.0 beta
|
||||
koto@webworkers.pl - EFM 1.1 (most of the code taken from Xinha codebase)
|
||||
|
|
@ -0,0 +1,707 @@
|
|||
/**
|
||||
* ImageEditor Interface file.
|
||||
* Authors: Wei Zhuo, Afru, Krzysztof Kotowicz
|
||||
* Version: Updated on 08-01-2005 by Afru
|
||||
* Version: Updated on 20-06-2006 by Krzysztof Kotowicz
|
||||
* Version: Updated on 04-11-2007 by Raimund Meyer
|
||||
* Package: ExtendedFileManager (EFM 1.4)
|
||||
* http://www.afrusoft.com/htmlarea
|
||||
*/
|
||||
|
||||
function MM_findObj(n, d) { //v4.01
|
||||
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
|
||||
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
|
||||
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
|
||||
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
|
||||
if(!x && d.getElementById) x=d.getElementById(n); return x;
|
||||
}
|
||||
|
||||
var pic_x, pic_y;
|
||||
function P7_Snap() { //v2.62 by PVII
|
||||
var x,y,ox,bx,oy,p,tx,a,b,k,d,da,e,el,args=P7_Snap.arguments;a=parseInt(a);
|
||||
for (k=0; k<(args.length-3); k+=4)
|
||||
if ((g=MM_findObj(args[k]))!=null) {
|
||||
el=eval(MM_findObj(args[k+1]));
|
||||
a=parseInt(args[k+2]);b=parseInt(args[k+3]);
|
||||
x=0;y=0;ox=0;oy=0;p="";tx=1;da="document.all['"+args[k]+"']";
|
||||
if(document.getElementById) {
|
||||
d="document.getElementsByName('"+args[k]+"')[0]";
|
||||
if(!eval(d)) {d="document.getElementById('"+args[k]+"')";if(!eval(d)) {d=da;}}
|
||||
}else if(document.all) {d=da;}
|
||||
if (document.all || document.getElementById) {
|
||||
while (tx==1) {p+=".offsetParent";
|
||||
if(eval(d+p)) {x+=parseInt(eval(d+p+".offsetLeft"));y+=parseInt(eval(d+p+".offsetTop"));
|
||||
}else{tx=0;}}
|
||||
ox=parseInt(g.offsetLeft);oy=parseInt(g.offsetTop);var tw=x+ox+y+oy;
|
||||
if(tw==0 || (navigator.appVersion.indexOf("MSIE 4")>-1 && navigator.appVersion.indexOf("Mac")>-1)) {
|
||||
ox=0;oy=0;if(g.style.left){x=parseInt(g.style.left);y=parseInt(g.style.top);
|
||||
}else{var w1=parseInt(el.style.width);bx=(a<0)?-5-w1:-10;
|
||||
a=(Math.abs(a)<1000)?0:a;b=(Math.abs(b)<1000)?0:b;
|
||||
//alert(event.clientX);
|
||||
if (event == null) x=document.body.scrollLeft + bx;
|
||||
else x=document.body.scrollLeft + event.clientX + bx;
|
||||
if (event == null) y=document.body.scrollTop;
|
||||
else y=document.body.scrollTop + event.clientY;}}
|
||||
}else if (document.layers) {x=g.x;y=g.y;var q0=document.layers,dd="";
|
||||
for(var s=0;s<q0.length;s++) {dd='document.'+q0[s].name;
|
||||
if(eval(dd+'.document.'+args[k])) {x+=eval(dd+'.left');y+=eval(dd+'.top');break;}}}
|
||||
if(el) {e=(document.layers)?el:el.style;
|
||||
var xx=parseInt(x+ox+a),yy=parseInt(y+oy+b);
|
||||
if(navigator.appName=="Netscape" && parseInt(navigator.appVersion)>4){xx+="px";yy+="px";}
|
||||
if(navigator.appVersion.indexOf("MSIE 5")>-1 && navigator.appVersion.indexOf("Mac")>-1){
|
||||
xx+=parseInt(document.body.leftMargin);yy+=parseInt(document.body.topMargin);
|
||||
xx+="px";yy+="px";}e.left=xx;e.top=yy;}
|
||||
pic_x = parseInt(xx); pic_y = parseInt(yy);
|
||||
}
|
||||
}
|
||||
|
||||
var ie=document.all;
|
||||
var ns6=document.getElementById&&!document.all;
|
||||
|
||||
var dragapproved=false;
|
||||
var z,x,y,status, ant, canvas, content, pic_width, pic_height, image, resizeHandle, oa_w, oa_h, oa_x, oa_y, mx2, my2;
|
||||
|
||||
function init_resize()
|
||||
{
|
||||
//if(mode == "scale")
|
||||
//{
|
||||
P7_Snap('theImage','ant',0,0);
|
||||
|
||||
if (canvas == null)
|
||||
canvas = MM_findObj("imgCanvas");
|
||||
|
||||
if (pic_width == null || pic_height == null)
|
||||
{
|
||||
image = MM_findObj("theImage");
|
||||
pic_width = image.width;
|
||||
pic_height = image.height;
|
||||
}
|
||||
|
||||
if (ant == null)
|
||||
ant = MM_findObj("ant");
|
||||
|
||||
ant.style.left = pic_x; ant.style.top = pic_y;
|
||||
ant.style.width = pic_width; ant.style.height = pic_height;
|
||||
ant.style.visibility = "visible";
|
||||
|
||||
drawBoundHandle();
|
||||
jg_doc.paint();
|
||||
//}
|
||||
}
|
||||
|
||||
initEditor = function ()
|
||||
{
|
||||
init_crop();
|
||||
init_resize();
|
||||
var markerImg = MM_findObj('markerImg', window.top.document);
|
||||
|
||||
if (markerImg.src.indexOf("img/t_white.gif")>0)
|
||||
toggleMarker() ;
|
||||
var theImage = document.getElementById('theImage');
|
||||
theImage._width = theImage.width;
|
||||
theImage._height = theImage.height;
|
||||
}
|
||||
|
||||
function init_crop()
|
||||
{
|
||||
//if(mode == "crop") {
|
||||
P7_Snap('theImage','ant',0,0);
|
||||
//}
|
||||
}
|
||||
|
||||
function setMode(newMode)
|
||||
{
|
||||
mode = newMode;
|
||||
reset();
|
||||
}
|
||||
|
||||
function reset()
|
||||
{
|
||||
if (ant == null)
|
||||
ant = MM_findObj("ant");
|
||||
|
||||
ant.style.visibility = "hidden";
|
||||
ant.style.left = 0;
|
||||
ant.style.top = 0;
|
||||
ant.style.width = 0;
|
||||
ant.style.height = 0;
|
||||
|
||||
mx2 = null;
|
||||
my2 = null;
|
||||
|
||||
jg_doc.clear();
|
||||
if(mode != 'measure')
|
||||
showStatus();
|
||||
|
||||
if(mode == "scale") {
|
||||
init_resize();
|
||||
}
|
||||
|
||||
P7_Snap('theImage','ant',0,0);
|
||||
}
|
||||
|
||||
function toggleMarker()
|
||||
{
|
||||
if (ant == null)
|
||||
ant = MM_findObj("ant");
|
||||
|
||||
if(ant.className=="selection")
|
||||
ant.className="selectionWhite";
|
||||
else
|
||||
ant.className="selection";
|
||||
|
||||
if (jg_doc.getColor() == "#000000")
|
||||
jg_doc.setColor("#FFFFFF");
|
||||
else
|
||||
jg_doc.setColor("#000000");
|
||||
|
||||
drawBoundHandle
|
||||
jg_doc.paint();
|
||||
}
|
||||
|
||||
function move(e)
|
||||
{
|
||||
if (dragapproved)
|
||||
{
|
||||
var w = ns6? temp1+e.pageX - x : temp1+event.clientX + document.body.scrollLeft- x;
|
||||
var h = ns6? temp2+e.pageY - y : temp2+event.clientY + document.body.scrollTop - y;
|
||||
|
||||
if (ant != null)
|
||||
{
|
||||
if (w >= 0)
|
||||
{
|
||||
ant.style.left = x;
|
||||
ant.style.width = w;
|
||||
}
|
||||
else
|
||||
{
|
||||
ant.style.left = x+w;
|
||||
ant.style.width = -1*w;
|
||||
}
|
||||
|
||||
if (h >= 0)
|
||||
{
|
||||
ant.style.top = y;
|
||||
ant.style.height = h;
|
||||
}
|
||||
else
|
||||
{
|
||||
ant.style.top = y+h;
|
||||
ant.style.height = -1*h
|
||||
}
|
||||
}
|
||||
|
||||
showStatus();
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
function moveContent(e)
|
||||
{
|
||||
if (dragapproved)
|
||||
{
|
||||
|
||||
var dx =ns6? oa_x + e.clientX-x: oa_x + event.clientX-x
|
||||
var dy =ns6? oa_y + e.clientY-y : oa_y + event.clientY-y
|
||||
|
||||
ant.style.left = dx;
|
||||
ant.style.top = dy;
|
||||
|
||||
showStatus();
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//Code add for constraints by Frédéric Klee <fklee@isuisse.com>
|
||||
function moveHandle(e)
|
||||
{
|
||||
if (dragapproved)
|
||||
{
|
||||
var w = ns6? e.clientX - x : event.clientX - x;
|
||||
var h = ns6? e.clientY - y : event.clientY - y;
|
||||
|
||||
var constrained = MM_findObj('constProp', window.top.document);
|
||||
var orginal_height = document.theImage.height ;
|
||||
var orginal_width = document.theImage.width ;
|
||||
rapp = orginal_width/orginal_height ;
|
||||
rapp_inv = orginal_height / orginal_width ;
|
||||
|
||||
switch(resizeHandle)
|
||||
{
|
||||
|
||||
case "s-resize":
|
||||
if (oa_h + h >= 0)
|
||||
{
|
||||
ant.style.height = oa_h + h;
|
||||
if(constrained.checked)
|
||||
{
|
||||
ant.style.width = rapp * (oa_h + h) ;
|
||||
ant.style.left = oa_x - rapp * h/2;
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
case "e-resize":
|
||||
if(oa_w + w >= 0)
|
||||
{
|
||||
ant.style.width = oa_w + w;
|
||||
if(constrained.checked)
|
||||
{
|
||||
ant.style.height = rapp_inv * (oa_w + w) ;
|
||||
ant.style.top = oa_y - rapp_inv * w/2;
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
case "n-resize":
|
||||
if (oa_h - h >= 0)
|
||||
{
|
||||
ant.style.top = oa_y + h;
|
||||
ant.style.height = oa_h - h;
|
||||
if(constrained.checked)
|
||||
{
|
||||
ant.style.width = rapp * (oa_h - h) ;
|
||||
ant.style.left = oa_x + rapp * h/2;
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
case "w-resize":
|
||||
if(oa_w - w >= 0)
|
||||
{
|
||||
ant.style.left = oa_x + w;
|
||||
ant.style.width = oa_w - w;
|
||||
if(constrained.checked)
|
||||
{
|
||||
ant.style.height = rapp_inv * (oa_w - w) ;
|
||||
ant.style.top = oa_y + rapp_inv * w/2;
|
||||
}
|
||||
|
||||
}break;
|
||||
case "nw-resize":
|
||||
if(oa_h - h >= 0 && oa_w - w >= 0) {
|
||||
ant.style.left = oa_x + w;
|
||||
ant.style.width = oa_w - w;
|
||||
ant.style.top = oa_y + h;
|
||||
if(constrained.checked)
|
||||
ant.style.height = rapp_inv * (oa_w - w) ;
|
||||
else
|
||||
ant.style.height = oa_h - h;
|
||||
}
|
||||
break;
|
||||
case "ne-resize":
|
||||
if (oa_h - h >= 0 && oa_w + w >= 0){
|
||||
ant.style.top = oa_y + h;
|
||||
ant.style.width = oa_w + w;
|
||||
if(constrained.checked)
|
||||
ant.style.height = rapp_inv * (oa_w + w) ;
|
||||
else
|
||||
ant.style.height = oa_h - h;
|
||||
}
|
||||
break;
|
||||
case "se-resize":
|
||||
if (oa_h + h >= 0 && oa_w + w >= 0)
|
||||
{
|
||||
ant.style.width = oa_w + w;
|
||||
if(constrained.checked)
|
||||
ant.style.height = rapp_inv * (oa_w + w) ;
|
||||
else
|
||||
ant.style.height = oa_h + h;
|
||||
}
|
||||
break;
|
||||
case "sw-resize":
|
||||
if (oa_h + h >= 0 && oa_w - w >= 0)
|
||||
{
|
||||
ant.style.left = oa_x + w;
|
||||
ant.style.width = oa_w - w;
|
||||
if(constrained.checked)
|
||||
ant.style.height = rapp_inv * (oa_w - w) ;
|
||||
else
|
||||
ant.style.height = oa_h + h;
|
||||
}
|
||||
}
|
||||
|
||||
showStatus();
|
||||
return false;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function drags(e)
|
||||
{
|
||||
if (!ie&&!ns6)
|
||||
return
|
||||
|
||||
var firedobj=ns6? e.target : event.srcElement
|
||||
var topelement=ns6? "HTML" : "BODY"
|
||||
|
||||
while (firedobj.tagName!=topelement&&
|
||||
!(firedobj.className=="crop"
|
||||
|| firedobj.className=="handleBox"
|
||||
|| firedobj.className=="selection" || firedobj.className=="selectionWhite"))
|
||||
{
|
||||
firedobj=ns6? firedobj.parentNode : firedobj.parentElement
|
||||
}
|
||||
|
||||
if(firedobj.className=="handleBox") {
|
||||
|
||||
if(content != null) {
|
||||
if(content.width != null && content.height != null) {
|
||||
content.width = 0;
|
||||
content.height = 0;
|
||||
}
|
||||
}
|
||||
resizeHandle = firedobj.id;
|
||||
|
||||
x=ns6? e.clientX: event.clientX
|
||||
y=ns6? e.clientY: event.clientY
|
||||
|
||||
oa_w = parseInt(ant.style.width);
|
||||
oa_h = parseInt(ant.style.height);
|
||||
oa_x = parseInt(ant.style.left);
|
||||
oa_y = parseInt(ant.style.top);
|
||||
|
||||
dragapproved=true
|
||||
document.onmousemove=moveHandle;
|
||||
return false;
|
||||
}
|
||||
else
|
||||
if((firedobj.className == "selection" || firedobj.className=="selectionWhite")&& mode == "crop") {
|
||||
|
||||
x=ns6? e.clientX: event.clientX
|
||||
y=ns6? e.clientY: event.clientY
|
||||
|
||||
oa_x = parseInt(ant.style.left);
|
||||
oa_y = parseInt(ant.style.top);
|
||||
|
||||
dragapproved=true
|
||||
document.onmousemove=moveContent;
|
||||
return false;
|
||||
}
|
||||
else
|
||||
if (firedobj.className=="crop" && mode == "crop")
|
||||
{
|
||||
if(content != null) {
|
||||
if(content.width != null && content.height != null) {
|
||||
content.width = 0;
|
||||
content.height = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (status == null)
|
||||
status = MM_findObj("status");
|
||||
|
||||
if (ant == null)
|
||||
ant = MM_findObj("ant");
|
||||
|
||||
if (canvas == null)
|
||||
canvas = MM_findObj("imgCanvas");
|
||||
if(content == null) {
|
||||
content = MM_findObj("cropContent");
|
||||
}
|
||||
|
||||
if (pic_width == null || pic_height == null)
|
||||
{
|
||||
image = MM_findObj("theImage");
|
||||
pic_width = image.width;
|
||||
pic_height = image.height;
|
||||
}
|
||||
|
||||
ant.style.visibility = "visible";
|
||||
|
||||
obj = firedobj;
|
||||
dragapproved=true
|
||||
z=firedobj
|
||||
temp1=parseInt(z.style.left+0)
|
||||
temp2=parseInt(z.style.top+0)
|
||||
|
||||
x=ns6? e.pageX: event.clientX + document.body.scrollLeft
|
||||
y=ns6? e.pageY: event.clientY + document.body.scrollTop
|
||||
document.onmousemove=move
|
||||
return false
|
||||
}
|
||||
else if(firedobj.className=="crop" && mode == "measure") {
|
||||
|
||||
if (ant == null)
|
||||
ant = MM_findObj("ant");
|
||||
|
||||
if (canvas == null)
|
||||
canvas = MM_findObj("imgCanvas");
|
||||
|
||||
x=ns6? e.pageX: event.clientX + document.body.scrollLeft
|
||||
y=ns6? e.pageY: event.clientY + document.body.scrollTop
|
||||
|
||||
dragapproved=true
|
||||
document.onmousemove=measure
|
||||
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
function measure(e)
|
||||
{
|
||||
if (dragapproved)
|
||||
{
|
||||
mx2 = ns6? e.pageX : event.clientX + document.body.scrollLeft;
|
||||
my2 = ns6? e.pageY : event.clientY + document.body.scrollTop;
|
||||
|
||||
jg_doc.clear();
|
||||
jg_doc.setStroke(Stroke.DOTTED);
|
||||
jg_doc.drawLine(x,y,mx2,my2);
|
||||
jg_doc.paint();
|
||||
showStatus();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function setMarker(nx,ny,nw,nh)
|
||||
{
|
||||
if (isNaN(nx)) nx = 0;
|
||||
if (isNaN(ny)) ny = 0;
|
||||
if (isNaN(nw)) nw = 0;
|
||||
if (isNaN(nh)) nh = 0;
|
||||
|
||||
if (ant == null)
|
||||
ant = MM_findObj("ant");
|
||||
|
||||
if (canvas == null)
|
||||
canvas = MM_findObj("imgCanvas");
|
||||
if(content == null) {
|
||||
content = MM_findObj("cropContent");
|
||||
}
|
||||
|
||||
if (pic_width == null || pic_height == null)
|
||||
{
|
||||
image = MM_findObj("theImage");
|
||||
pic_width = image.width;
|
||||
pic_height = image.height;
|
||||
}
|
||||
|
||||
ant.style.visibility = "visible";
|
||||
|
||||
nx = pic_x + nx;
|
||||
ny = pic_y + ny;
|
||||
|
||||
if (nw >= 0)
|
||||
{
|
||||
ant.style.left = nx;
|
||||
ant.style.width = nw;
|
||||
}
|
||||
else
|
||||
{
|
||||
ant.style.left = nx+nw;
|
||||
ant.style.width = -1*nw;
|
||||
}
|
||||
|
||||
if (nh >= 0)
|
||||
{
|
||||
ant.style.top = ny;
|
||||
ant.style.height = nh;
|
||||
}
|
||||
else
|
||||
{
|
||||
ant.style.top = ny+nh;
|
||||
ant.style.height = -1*nh
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function max(x,y)
|
||||
{
|
||||
if(y > x)
|
||||
return x;
|
||||
else
|
||||
return y;
|
||||
}
|
||||
|
||||
function drawBoundHandle()
|
||||
{
|
||||
if(ant == null || ant.style == null)
|
||||
return false;
|
||||
|
||||
var ah = parseInt(ant.style.height);
|
||||
var aw = parseInt(ant.style.width);
|
||||
var ax = parseInt(ant.style.left);
|
||||
var ay = parseInt(ant.style.top);
|
||||
|
||||
jg_doc.drawHandle(ax-15,ay-15,30,30,"nw-resize"); //upper left
|
||||
jg_doc.drawHandle(ax-15,ay+ah-15,30,30,"sw-resize"); //lower left
|
||||
jg_doc.drawHandle(ax+aw-15,ay-15,30,30,"ne-resize"); //upper right
|
||||
jg_doc.drawHandle(ax+aw-15,ay+ah-15,30,30,"se-resize"); //lower right
|
||||
|
||||
jg_doc.drawHandle(ax+max(15,aw/10),ay-8,aw-2*max(15,aw/10),8,"n-resize"); //top middle
|
||||
jg_doc.drawHandle(ax+max(15,aw/10),ay+ah,aw-2*max(15,aw/10),8,"s-resize"); //bottom middle
|
||||
jg_doc.drawHandle(ax-8, ay+max(15,ah/10),8,ah-2*max(15,ah/10),"w-resize"); //left middle
|
||||
jg_doc.drawHandle(ax+aw, ay+max(15,ah/10),8,ah-2*max(15,ah/10),"e-resize"); //right middle
|
||||
|
||||
jg_doc.drawHandleBox(ax-4,ay-4,8,8,"nw-resize"); //upper left
|
||||
jg_doc.drawHandleBox(ax-4,ay+ah-4,8,8,"sw-resize"); //lower left
|
||||
jg_doc.drawHandleBox(ax+aw-4,ay-4,8,8,"ne-resize"); //upper right
|
||||
jg_doc.drawHandleBox(ax+aw-4,ay+ah-4,8,8,"se-resize"); //lower right
|
||||
|
||||
jg_doc.drawHandleBox(ax+aw/2-4,ay-4,8,8,"n-resize"); //top middle
|
||||
jg_doc.drawHandleBox(ax+aw/2-4,ay+ah-4,8,8,"s-resize"); //bottom middle
|
||||
jg_doc.drawHandleBox(ax-4, ay+ah/2-4,8,8,"w-resize"); //left middle
|
||||
jg_doc.drawHandleBox(ax+aw-4, ay+ah/2-4,8,8,"e-resize"); //right middle
|
||||
}
|
||||
|
||||
function showStatus()
|
||||
{
|
||||
if(ant == null || ant.style == null) {
|
||||
return false;
|
||||
}
|
||||
var zoom = 100 / parseInt( window.parent.document.getElementById('zoom').value, 10 );
|
||||
if(mode == "measure") {
|
||||
|
||||
mx1 = x - pic_x;
|
||||
my1 = y - pic_y;
|
||||
|
||||
mw = mx2 - x;
|
||||
mh = my2 - y;
|
||||
|
||||
md = parseInt(Math.sqrt(mw*mw + mh*mh)*100)/100;
|
||||
|
||||
ma = (Math.atan(-1*mh/mw)/Math.PI)*180;
|
||||
if(mw < 0 && mh < 0)
|
||||
ma = ma+180;
|
||||
|
||||
if (mw <0 && mh >0)
|
||||
ma = ma - 180;
|
||||
|
||||
ma = parseInt(ma*100)/100;
|
||||
|
||||
if (m_sx != null && !isNaN(mx1))
|
||||
m_sx.value = mx1 * zoom +"px";
|
||||
if (m_sy != null && !isNaN(my1))
|
||||
m_sy.value = my1 * zoom+"px";
|
||||
if(m_w != null && !isNaN(mw))
|
||||
m_w.value = mw * zoom + "px";
|
||||
if(m_h != null && !isNaN(mh))
|
||||
m_h.value = mh * zoom + "px";
|
||||
|
||||
if(m_d != null && !isNaN(md))
|
||||
m_d.value = md * zoom + "px";
|
||||
if(m_a != null && !isNaN(ma))
|
||||
m_a.value = ma + "";
|
||||
|
||||
if(r_ra != null &&!isNaN(ma))
|
||||
r_ra.value = ma;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
var ah = parseInt(ant.style.height);
|
||||
var aw = parseInt(ant.style.width);
|
||||
var ax = parseInt(ant.style.left);
|
||||
var ay = parseInt(ant.style.top);
|
||||
|
||||
var cx = ax-pic_x<0?0:ax-pic_x;
|
||||
var cy = ay-pic_y<0?0:ay-pic_y;
|
||||
cx = cx>pic_width?pic_width:cx;
|
||||
cy = cy>pic_height?pic_height:cy;
|
||||
|
||||
var cw = ax-pic_x>0?aw:aw-(pic_x-ax);
|
||||
var ch = ay-pic_y>0?ah:ah-(pic_y-ay);
|
||||
|
||||
ch = ay+ah<pic_y+pic_height?ch:ch-(ay+ah-pic_y-pic_height);
|
||||
cw = ax+aw<pic_x+pic_width?cw:cw-(ax+aw-pic_x-pic_width);
|
||||
|
||||
ch = ch<0?0:ch; cw = cw<0?0:cw;
|
||||
|
||||
if (ant.style.visibility == "hidden")
|
||||
{
|
||||
cx = ""; cy = ""; cw=""; ch="";
|
||||
}
|
||||
|
||||
if(mode == 'crop') {
|
||||
if(t_cx != null)
|
||||
t_cx.value = cx * zoom ;
|
||||
if (t_cy != null)
|
||||
t_cy.value = cy * zoom ;
|
||||
if(t_cw != null)
|
||||
t_cw.value = cw * zoom ;
|
||||
if (t_ch != null)
|
||||
t_ch.value = ch * zoom ;
|
||||
}
|
||||
else if(mode == 'scale') {
|
||||
|
||||
var sw = aw, sh = ah;
|
||||
|
||||
if (s_sw.value.indexOf('%')>0 && s_sh.value.indexOf('%')>0)
|
||||
{
|
||||
sw = cw/pic_width;
|
||||
sh = ch/pic_height;
|
||||
}
|
||||
if (s_sw != null)
|
||||
s_sw.value = sw * zoom ;
|
||||
if (s_sh != null)
|
||||
s_sh.value = sh * zoom ;
|
||||
}
|
||||
}
|
||||
|
||||
function dragStopped()
|
||||
{
|
||||
dragapproved=false;
|
||||
|
||||
if(ant == null || ant.style == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(mode == "measure") {
|
||||
jg_doc.drawLine(x-4,y,x+4,y);
|
||||
jg_doc.drawLine(x,y-4,x,y+4);
|
||||
jg_doc.drawLine(mx2-4,my2,mx2+4,my2);
|
||||
jg_doc.drawLine(mx2,my2-4,mx2,my2+4);
|
||||
|
||||
jg_doc.paint();
|
||||
showStatus();
|
||||
return false;
|
||||
}
|
||||
var ah = parseInt(ant.style.height);
|
||||
var aw = parseInt(ant.style.width);
|
||||
var ax = parseInt(ant.style.left);
|
||||
var ay = parseInt(ant.style.top);
|
||||
jg_doc.clear();
|
||||
|
||||
if(content != null) {
|
||||
if(content.width != null && content.height != null) {
|
||||
content.width = aw-1;
|
||||
content.height = ah-1;
|
||||
}
|
||||
}
|
||||
if(mode == "crop") {
|
||||
//alert(pic_y);
|
||||
jg_doc.fillRectPattern(pic_x,pic_y,pic_width,ay-pic_y,pattern);
|
||||
|
||||
var h1 = ah;
|
||||
var y1 = ay;
|
||||
if (ah+ay >= pic_height+pic_y)
|
||||
h1 = pic_height+pic_y-ay;
|
||||
else if (ay <= pic_y)
|
||||
{
|
||||
h1 = ay+ah-pic_y;
|
||||
y1 = pic_y;
|
||||
}
|
||||
jg_doc.fillRectPattern(pic_x,y1,ax-pic_x,h1,pattern);
|
||||
jg_doc.fillRectPattern(ax+aw,y1,pic_x+pic_width-ax-aw,h1,pattern);
|
||||
jg_doc.fillRectPattern(pic_x,ay+ah,pic_width,pic_height+pic_y-ay-ah,pattern);
|
||||
}
|
||||
else if(mode == "scale") {
|
||||
document.theImage.height = ah;
|
||||
document.theImage.width = aw;
|
||||
document.theImage.style.height = ah+" px";
|
||||
document.theImage.style.width = aw+" px";
|
||||
|
||||
P7_Snap('theImage','ant',0,0);
|
||||
}
|
||||
|
||||
drawBoundHandle();
|
||||
jg_doc.paint();
|
||||
|
||||
showStatus();
|
||||
return false;
|
||||
}
|
||||
|
||||
document.onmousedown=drags;
|
||||
document.onmouseup=dragStopped;
|
||||
|
|
@ -0,0 +1,76 @@
|
|||
.icons {
|
||||
font: 11px Tahoma,Verdana,sans-serif;
|
||||
color: #666699;
|
||||
text-align: center;
|
||||
text-decoration: none;
|
||||
border: 1px solid #EEEEFF;
|
||||
-Moz-Border-Radius: 6px 6px 6px 6px;
|
||||
}
|
||||
|
||||
body, td, p {
|
||||
font: 11px Tahoma,Verdana,sans-serif;
|
||||
}
|
||||
.iconsOver {
|
||||
font: 11px Tahoma,Verdana,sans-serif;
|
||||
color: #666699;
|
||||
text-align: center;
|
||||
text-decoration: none;
|
||||
background-color: #F9F9FF;
|
||||
border: 1px solid #666699;
|
||||
-Moz-Border-Radius: 6px 6px 6px 6px;
|
||||
}
|
||||
.topBar {
|
||||
font: 11px Tahoma,Verdana,sans-serif;
|
||||
color: #666699;
|
||||
}
|
||||
.iconsSel {
|
||||
font: 11px Tahoma,Verdana,sans-serif;
|
||||
color: #666699;
|
||||
text-align: center;
|
||||
text-decoration: none;
|
||||
border: 1px solid #666699;
|
||||
-Moz-Border-Radius: 6px 6px 6px 6px;
|
||||
}
|
||||
.iconText {
|
||||
font: 11px Tahoma,Verdana,sans-serif;
|
||||
color: #666699;
|
||||
text-decoration: none;
|
||||
text-align: center;
|
||||
}
|
||||
.measureStats{
|
||||
width: 50px;
|
||||
}
|
||||
|
||||
#slidercasing {
|
||||
/*border:1px solid #CCCCCC;
|
||||
background-color:#FFFFFF;*/
|
||||
width:100px;
|
||||
height:5px;
|
||||
position:relative;
|
||||
z-index:4;
|
||||
padding:10px;
|
||||
}
|
||||
|
||||
|
||||
#slidertrack {
|
||||
position:relative;
|
||||
border:1px solid #CCCCCC;
|
||||
background-color:#FFFFCC;
|
||||
z-index:5;
|
||||
height:5px;
|
||||
}
|
||||
|
||||
|
||||
#sliderbar {
|
||||
position:absolute;
|
||||
z-index:6;
|
||||
border:1px solid #CCCCCC;
|
||||
background-color:#DDDDDD;
|
||||
width:15px;
|
||||
padding:0px;
|
||||
height:20px;
|
||||
cursor: pointer;
|
||||
top:2px;
|
||||
}
|
||||
|
||||
select, input, button { font: 11px Tahoma,Verdana,sans-serif; }
|
||||
|
|
@ -0,0 +1,115 @@
|
|||
// Dialog v3.0 - Copyright (c) 2003-2004 interactivetools.com, inc.
|
||||
// This copyright notice MUST stay intact for use (see license.txt).
|
||||
//
|
||||
// Portions (c) dynarch.com, 2003-2004
|
||||
//
|
||||
// A free WYSIWYG editor replacement for <textarea> fields.
|
||||
// For full source code and docs, visit http://www.interactivetools.com/
|
||||
//
|
||||
// Version 3.0 developed by Mihai Bazon.
|
||||
// http://dynarch.com/mishoo
|
||||
//
|
||||
// $Id: dialog.js 1084 2008-10-12 17:42:42Z ray $
|
||||
|
||||
// Though "Dialog" looks like an object, it isn't really an object. Instead
|
||||
// it's just namespace for protecting global symbols.
|
||||
|
||||
function Dialog(url, action, init) {
|
||||
if (typeof init == "undefined") {
|
||||
init = window; // pass this window object by default
|
||||
}
|
||||
if (typeof window.showModalDialog == 'function')
|
||||
{
|
||||
Dialog._return = action;
|
||||
var r = window.showModalDialog(url, init, "dialogheight=10;dialogwidth=10;resizable=yes");
|
||||
}
|
||||
else
|
||||
{
|
||||
Dialog._geckoOpenModal(url, action, init);
|
||||
}
|
||||
}
|
||||
|
||||
Dialog._parentEvent = function(ev) {
|
||||
setTimeout( function() { if (Dialog._modal && !Dialog._modal.closed) { Dialog._modal.focus() } }, 50);
|
||||
if (Dialog._modal && !Dialog._modal.closed) {
|
||||
Dialog._stopEvent(ev);
|
||||
}
|
||||
};
|
||||
|
||||
// should be a function, the return handler of the currently opened dialog.
|
||||
Dialog._return = null;
|
||||
|
||||
// constant, the currently opened dialog
|
||||
Dialog._modal = null;
|
||||
|
||||
// the dialog will read it's args from this variable
|
||||
Dialog._arguments = null;
|
||||
|
||||
Dialog._geckoOpenModal = function(url, action, init) {
|
||||
//var urlLink = "hadialog"+url.toString();
|
||||
var myURL = "hadialog"+url;
|
||||
var regObj = /\W/g;
|
||||
myURL = myURL.replace(regObj,'_');
|
||||
var dlg = window.open(url, myURL,
|
||||
"toolbar=no,menubar=no,personalbar=no,width=10,height=10," +
|
||||
"scrollbars=no,resizable=yes,modal=yes,dependable=yes");
|
||||
Dialog._modal = dlg;
|
||||
Dialog._arguments = init;
|
||||
|
||||
// capture some window's events
|
||||
function capwin(w) {
|
||||
Dialog._addEvent(w, "click", Dialog._parentEvent);
|
||||
Dialog._addEvent(w, "mousedown", Dialog._parentEvent);
|
||||
Dialog._addEvent(w, "focus", Dialog._parentEvent);
|
||||
};
|
||||
// release the captured events
|
||||
function relwin(w) {
|
||||
Dialog._removeEvent(w, "click", Dialog._parentEvent);
|
||||
Dialog._removeEvent(w, "mousedown", Dialog._parentEvent);
|
||||
Dialog._removeEvent(w, "focus", Dialog._parentEvent);
|
||||
};
|
||||
capwin(window);
|
||||
// capture other frames
|
||||
for (var i = 0; i < window.frames.length; capwin(window.frames[i++]));
|
||||
// make up a function to be called when the Dialog ends.
|
||||
Dialog._return = function (val) {
|
||||
if (val && action) {
|
||||
action(val);
|
||||
}
|
||||
relwin(window);
|
||||
// capture other frames
|
||||
for (var i = 0; i < window.frames.length; relwin(window.frames[i++]));
|
||||
Dialog._modal = null;
|
||||
};
|
||||
};
|
||||
|
||||
// event handling
|
||||
|
||||
Dialog._addEvent = function(el, evname, func) {
|
||||
if (Dialog.is_ie) {
|
||||
el.attachEvent("on" + evname, func);
|
||||
} else {
|
||||
el.addEventListener(evname, func, true);
|
||||
}
|
||||
};
|
||||
|
||||
Dialog._removeEvent = function(el, evname, func) {
|
||||
if (Dialog.is_ie) {
|
||||
el.detachEvent("on" + evname, func);
|
||||
} else {
|
||||
el.removeEventListener(evname, func, true);
|
||||
}
|
||||
};
|
||||
|
||||
Dialog._stopEvent = function(ev) {
|
||||
if (Dialog.is_ie) {
|
||||
ev.cancelBubble = true;
|
||||
ev.returnValue = false;
|
||||
} else {
|
||||
ev.preventDefault();
|
||||
ev.stopPropagation();
|
||||
}
|
||||
};
|
||||
|
||||
Dialog.agt = navigator.userAgent.toLowerCase();
|
||||
Dialog.is_ie = ((Dialog.agt.indexOf("msie") != -1) && (Dialog.agt.indexOf("opera") == -1));
|
||||
|
|
@ -0,0 +1,131 @@
|
|||
/** makes the columns of a given table resizable with the mouse
|
||||
* @author Raimund Meyer
|
||||
* @param id {String} the id of the table
|
||||
*/
|
||||
function dragTableCols (id)
|
||||
{
|
||||
this.table = document.getElementById(id);
|
||||
var ths = this.table.rows[0].cells;
|
||||
this.ths = ths;
|
||||
var self = this;
|
||||
var c;
|
||||
for (var j = 0; j < this.table.rows.length; j++)
|
||||
{
|
||||
for (var i = 0; i < this.table.rows[j].cells.length; i++)
|
||||
{
|
||||
c = this.table.rows[j].cells[i];
|
||||
c._i = i;
|
||||
dragTableCols.addEvent(c, 'mousemove', function(e)
|
||||
{
|
||||
self.cellMouseMove(e);
|
||||
});
|
||||
dragTableCols.addEvent(c, 'mouseover', function(e)
|
||||
{
|
||||
e = e ? e : window.event;
|
||||
var t = e.target || e.srcElement;
|
||||
t._pos = dragTableCols.getElementTopLeft(t);
|
||||
});
|
||||
}
|
||||
}
|
||||
function deactivate ()
|
||||
{
|
||||
self.drag = false; self._col = null; document.body.style.cursor = '';
|
||||
}
|
||||
dragTableCols.addEvent(document.body, 'mousemove',function (e) { self.bodyMouseMove(e); });
|
||||
dragTableCols.addEvent(document.body, 'mouseup',deactivate);
|
||||
|
||||
|
||||
}
|
||||
dragTableCols.prototype.cellMouseMove = function (e)
|
||||
{
|
||||
e = e ? e : window.event;
|
||||
var t = e.target || e.srcElement;
|
||||
|
||||
if ( typeof dragTableCols == 'undefined' ) return;// sometimes happens, no idea why
|
||||
if (!t._pos)
|
||||
{
|
||||
t._pos = dragTableCols.getElementTopLeft(t);
|
||||
return;
|
||||
}
|
||||
|
||||
if (t.tagName.toLowerCase() != 'td' && t.tagName.toLowerCase() != 'th') return;
|
||||
var self = this;
|
||||
function activate (e)
|
||||
{
|
||||
e = e ? e : window.event;
|
||||
self.drag = true;
|
||||
self.startX = t._pos.left + t.offsetWidth;
|
||||
self._col = t;
|
||||
var offsetWidth = t.offsetWidth;
|
||||
self.startWidth = (t.width) ? parseInt(t.width, 10) : t.offsetWidth;
|
||||
t.style.width = self.startWidth + 'px';
|
||||
self.offset = t.offsetWidth - offsetWidth; //padding + border;
|
||||
t.style.width = self.startWidth - self.offset+ 'px';
|
||||
}
|
||||
// activate right side
|
||||
if (t._pos.left + t.offsetWidth - dragTableCols.getPageX (e) < 5 && t != t.parentNode.cells[t.parentNode.cells.length -1] )
|
||||
{
|
||||
t.style.cursor = 'e-resize';
|
||||
|
||||
dragTableCols.addEvent(t,'mousedown', activate);
|
||||
}
|
||||
else
|
||||
{
|
||||
t.style.cursor = '';
|
||||
dragTableCols.removeEvent(t,'mousedown', activate);
|
||||
}
|
||||
}
|
||||
dragTableCols.prototype.bodyMouseMove = function (e)
|
||||
{
|
||||
if (!this.drag) return true;
|
||||
e = e ? e : window.event;
|
||||
var mouseX = dragTableCols.getPageX (e);
|
||||
var delta = mouseX - this.startX;
|
||||
document.body.style.cursor = (delta < 0) ? 'e-resize' : 'w-resize';
|
||||
var newWidth = this.startWidth + delta - this.offset;
|
||||
this._col.style.width = ((newWidth > 10 ) ? newWidth : 10 ) + 'px';
|
||||
return true;
|
||||
}
|
||||
|
||||
dragTableCols.addEvent = function (obj, evType, fn)
|
||||
{
|
||||
if (obj.addEventListener) { obj.addEventListener(evType, fn, true); }
|
||||
else if (obj.attachEvent) { obj.attachEvent("on"+evType, fn);}
|
||||
else { return false; }
|
||||
}
|
||||
dragTableCols.removeEvent = function (obj, evType, fn)
|
||||
{
|
||||
if (obj.addEventListener) { obj.removeEventListener(evType, fn, true); }
|
||||
else if (obj.detachEvent) { obj.detachEvent("on"+evType, fn); }
|
||||
else { return false; }
|
||||
}
|
||||
dragTableCols.getElementTopLeft = function(element)
|
||||
{
|
||||
var curleft = 0;
|
||||
var curtop = 0;
|
||||
if (element.offsetParent)
|
||||
{
|
||||
curleft = element.offsetLeft
|
||||
curtop = element.offsetTop
|
||||
while (element = element.offsetParent)
|
||||
{
|
||||
curleft += element.offsetLeft
|
||||
curtop += element.offsetTop
|
||||
}
|
||||
}
|
||||
return { top:curtop, left:curleft };
|
||||
}
|
||||
dragTableCols.getPageX = function (e)
|
||||
{
|
||||
if ( e.pageX ) return e.pageX;
|
||||
else if (document.documentElement && document.documentElement.scrollTop)
|
||||
// Explorer 6 Strict
|
||||
{
|
||||
return document.documentElement.scrollLeft + e.clientX;
|
||||
|
||||
}
|
||||
else if (document.body) // all other Explorers
|
||||
{
|
||||
return document.body.scrollLeft + e.clientX;
|
||||
}
|
||||
}
|
||||
|
|
@ -7,12 +7,10 @@
|
|||
|
||||
#indicator
|
||||
{
|
||||
width: 25px;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
background-color: #eef;
|
||||
padding: 15px 20px;
|
||||
position: absolute;
|
||||
left: 0; top: 0;
|
||||
}
|
||||
* html #indicator
|
||||
{
|
||||
|
|
@ -20,41 +18,31 @@
|
|||
}
|
||||
#tools
|
||||
{
|
||||
width: 600px;
|
||||
height: 50px;
|
||||
background-color: #eef;
|
||||
padding: 0;
|
||||
position: absolute;
|
||||
left: 63px;
|
||||
border-left: 1px solid white;
|
||||
border-bottom: 1px solid white;
|
||||
}
|
||||
#toolbar
|
||||
{
|
||||
width: 53px;
|
||||
height: 435px;
|
||||
background-color: #eef;
|
||||
float: left;
|
||||
text-align: center;
|
||||
padding: 5px;
|
||||
position: absolute;
|
||||
top: 50px;
|
||||
border-top: 1px solid white;
|
||||
border-right: 1px solid white;
|
||||
vertical-align: top;
|
||||
width:50px;
|
||||
}
|
||||
|
||||
#contents
|
||||
{
|
||||
width: 600px;
|
||||
height: 445px;
|
||||
position: absolute;
|
||||
left: 64px; top: 51px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
#editor
|
||||
{
|
||||
width: 600px;
|
||||
height: 445px;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
#toolbar a
|
||||
|
|
@ -119,7 +107,7 @@
|
|||
{
|
||||
vertical-align: middle;
|
||||
}
|
||||
#tools #tool_inputs
|
||||
#tools .tool_inputs
|
||||
{
|
||||
padding-top: 10px;
|
||||
float: left;
|
||||
|
|
@ -192,3 +180,5 @@
|
|||
position: relative;
|
||||
top: 490px;
|
||||
}
|
||||
|
||||
#save_filename {width: 100px;}
|
||||
|
|
@ -0,0 +1,231 @@
|
|||
/**
|
||||
* Functions for the ImageEditor interface, used by editor.php only
|
||||
* Authors: Wei Zhuo, Afru, Krzysztof Kotowicz
|
||||
* Version: Updated on 08-01-2005 by Afru
|
||||
* Version: Updated on 20-06-2006 by Krzysztof Kotowicz
|
||||
* Version: Updated on 20-01-2008 by Raimund Meyer
|
||||
* Package: ExtendedFileManager (EFM 1.4)
|
||||
*/
|
||||
|
||||
var current_action = null;
|
||||
var actions = ['crop', 'scale', 'rotate', 'measure', 'save'];
|
||||
var orginal_width = null, orginal_height=null;
|
||||
function toggle(action)
|
||||
{
|
||||
if(current_action != action)
|
||||
{
|
||||
|
||||
for (var i in actions)
|
||||
{
|
||||
if(actions[i] != action)
|
||||
{
|
||||
var tools = document.getElementById('tools_'+actions[i]);
|
||||
tools.style.display = 'none';
|
||||
var icon = document.getElementById('icon_'+actions[i]);
|
||||
icon.className = '';
|
||||
}
|
||||
}
|
||||
|
||||
current_action = action;
|
||||
|
||||
var tools = document.getElementById('tools_'+action);
|
||||
tools.style.display = 'block';
|
||||
var icon = document.getElementById('icon_'+action);
|
||||
icon.className = 'iconActive';
|
||||
|
||||
var indicator = document.getElementById('indicator_image');
|
||||
indicator.src = 'img/'+action+'.gif';
|
||||
|
||||
editor.setMode(current_action);
|
||||
|
||||
//constraints on the scale,
|
||||
//code by Frédéric Klee <fklee@isuisse.com>
|
||||
if(action == 'scale')
|
||||
{
|
||||
var theImage = editor.window.document.getElementById('theImage');
|
||||
orginal_width = theImage._width ;
|
||||
orginal_height = theImage._height;
|
||||
|
||||
var w = document.getElementById('sw');
|
||||
w.value = orginal_width ;
|
||||
var h = document.getElementById('sh') ;
|
||||
h.value = orginal_height ;
|
||||
}
|
||||
if ( action == 'save' )
|
||||
{
|
||||
var formatSelect = document.getElementById('save_format');
|
||||
var format = document.getElementById('save_filename').value.match(/\.(gif|png|jpe?g)/i)[1].toLowerCase();
|
||||
switch ( format )
|
||||
{
|
||||
case 'png':
|
||||
formatSelect.selectedIndex = '3';
|
||||
break;
|
||||
case 'gif':
|
||||
formatSelect.selectedIndex = '4';
|
||||
break;
|
||||
default:
|
||||
formatSelect.selectedIndex = '0';
|
||||
break;
|
||||
}
|
||||
formatSelect.onchange();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function toggleMarker()
|
||||
{
|
||||
var marker = document.getElementById("markerImg");
|
||||
|
||||
if(marker != null && marker.src != null) {
|
||||
if(marker.src.indexOf("t_black.gif") >= 0)
|
||||
marker.src = "img/t_white.gif";
|
||||
else
|
||||
marker.src = "img/t_black.gif";
|
||||
|
||||
editor.toggleMarker();
|
||||
}
|
||||
}
|
||||
|
||||
//Togggle constraints, by Frédéric Klee <fklee@isuisse.com>
|
||||
function toggleConstraints()
|
||||
{
|
||||
var lock = document.getElementById("scaleConstImg");
|
||||
var checkbox = document.getElementById("constProp");
|
||||
|
||||
if(lock != null && lock.src != null) {
|
||||
if(lock.src.indexOf("unlocked2.gif") >= 0)
|
||||
{
|
||||
lock.src = "img/islocked2.gif";
|
||||
checkbox.checked = true;
|
||||
checkConstrains('width');
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
lock.src = "img/unlocked2.gif";
|
||||
checkbox.checked = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//check the constraints, by Frédéric Klee <fklee@isuisse.com>
|
||||
function checkConstrains(changed)
|
||||
{
|
||||
var constrained = document.getElementById('constProp');
|
||||
if(constrained.checked)
|
||||
{
|
||||
var w = document.getElementById('sw') ;
|
||||
var width = w.value ;
|
||||
var h = document.getElementById('sh') ;
|
||||
var height = h.value ;
|
||||
|
||||
if(orginal_width > 0 && orginal_height > 0)
|
||||
{
|
||||
if(changed == 'width' && width > 0)
|
||||
h.value = parseInt((width/orginal_width)*orginal_height);
|
||||
else if(changed == 'height' && height > 0)
|
||||
w.value = parseInt((height/orginal_height)*orginal_width);
|
||||
}
|
||||
}
|
||||
|
||||
updateMarker('scale') ;
|
||||
}
|
||||
|
||||
function updateMarker(mode)
|
||||
{
|
||||
if (mode == 'crop')
|
||||
{
|
||||
var t_cx = document.getElementById('cx');
|
||||
var t_cy = document.getElementById('cy');
|
||||
var t_cw = document.getElementById('cw');
|
||||
var t_ch = document.getElementById('ch');
|
||||
|
||||
editor.setMarker(parseInt(t_cx.value), parseInt(t_cy.value), parseInt(t_cw.value), parseInt(t_ch.value));
|
||||
}
|
||||
else if(mode == 'scale') {
|
||||
var s_sw = document.getElementById('sw');
|
||||
var s_sh = document.getElementById('sh');
|
||||
editor.setMarker(0, 0, parseInt(s_sw.value), parseInt(s_sh.value));
|
||||
}
|
||||
}
|
||||
|
||||
function rotateSubActionSelect(selection)
|
||||
{
|
||||
var value = selection.options[selection.selectedIndex].value;
|
||||
|
||||
var rotate_preset_select = document.getElementById('rotate_preset_select');
|
||||
var flip = document.getElementById('flip');
|
||||
var angle = document.getElementById('ra').parentNode;
|
||||
|
||||
switch (value)
|
||||
{
|
||||
case 'rotate':
|
||||
rotate_preset_select.style.display = '';
|
||||
flip.style.display = 'none';
|
||||
angle.style.display = '';
|
||||
break;
|
||||
case 'flip':
|
||||
rotate_preset_select.style.display = 'none';
|
||||
flip.style.display = '';
|
||||
angle.style.display = 'none';
|
||||
break;
|
||||
}
|
||||
}
|
||||
function rotatePreset(selection)
|
||||
{
|
||||
var value = selection.options[selection.selectedIndex].value;
|
||||
|
||||
if(value.length > 0 && parseInt(value) != 0) {
|
||||
var ra = document.getElementById('ra');
|
||||
ra.value = parseInt(value);
|
||||
}
|
||||
}
|
||||
|
||||
function updateFormat(selection)
|
||||
{
|
||||
var selected = selection.options[selection.selectedIndex].value;
|
||||
|
||||
var values = selected.split(",");
|
||||
if ( values[0] != 'jpeg' ) document.getElementById('slider').style.display = 'none';
|
||||
else document.getElementById('slider').style.display = 'inline';
|
||||
if(values.length >1) {
|
||||
updateSlider(parseInt(values[1]));
|
||||
}
|
||||
|
||||
}
|
||||
function zoom()
|
||||
{
|
||||
var theImage = editor.window.document.getElementById('theImage');
|
||||
var value = document.getElementById('zoom').value;
|
||||
theImage.width = theImage._width * parseInt( value, 10 ) / 100;
|
||||
theImage.height = theImage._height * parseInt( value, 10 )/ 100;
|
||||
editor.reset();
|
||||
editor.pic_width = null;
|
||||
editor.pic_height = null;
|
||||
}
|
||||
function addEvent(obj, evType, fn)
|
||||
{
|
||||
if (obj.addEventListener) { obj.addEventListener(evType, fn, true); return true; }
|
||||
else if (obj.attachEvent) { var r = obj.attachEvent("on"+evType, fn); return r; }
|
||||
else { return false; }
|
||||
}
|
||||
|
||||
var init = function()
|
||||
{
|
||||
if(window.opener)
|
||||
{
|
||||
__xinha_dlg_init();
|
||||
__dlg_translate('ExtendedFileManager');
|
||||
}
|
||||
addEvent(window, 'resize', winOnResize);
|
||||
try { window.moveTo(0,0); } catch (e) {}
|
||||
window.resizeTo(window.screen.availWidth,window.screen.availHeight);
|
||||
winOnResize();
|
||||
}
|
||||
function winOnResize ()
|
||||
{
|
||||
if ( typeof editor.reset == 'function' && typeof editor.ant != 'undefined' ) editor.reset();
|
||||
var win = Xinha.viewportSize(window);
|
||||
document.getElementById("contents").style.height = win.y - parseInt(document.getElementById("indicator").offsetHeight,10) - 5 + 'px';
|
||||
}
|
||||
Xinha.addOnloadHandler( init, window );
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
body { margin: 0; padding: 0; background-color: #eee; }
|
||||
table { width: 100%; }
|
||||
table td { text-align: center; }
|
||||
.crop{cursor:crosshair;}
|
||||
.selection { border: dotted 1px #000000; position:absolute; width: 0px; height: 1px; z-index:5; }
|
||||
.selectionWhite{ border: dotted 1px #FFFFFF; position:absolute; width: 0px; height: 1px; z-index:5; }
|
||||
.handleBox{ z-index:105; }
|
||||
.error { font-size:large; font-weight:bold; color:#c00; font-family: Helvetica, sans-serif; }
|
||||
|
||||
#n-resize {cursor: n-resize }
|
||||
#s-resize {cursor: s-resize }
|
||||
#w-resize {cursor: w-resize }
|
||||
#e-resize {cursor: e-resize }
|
||||
#nw-resize {cursor: nw-resize }
|
||||
#sw-resize {cursor: sw-resize }
|
||||
#ne-resize {cursor: ne-resize }
|
||||
#se-resize {cursor: se-resize }
|
||||
|
|
@ -0,0 +1,108 @@
|
|||
/**
|
||||
* Javascript used by the editorFrame.php, it basically initializes the frame.
|
||||
* Authors: Wei Zhuo, Afru, Krzysztof Kotowicz
|
||||
* Version: Updated on 08-01-2005 by Afru
|
||||
* Version: Updated on 20-06-2006 by Krzysztof Kotowicz
|
||||
* Version: Updated on 20-01-2008 by Raimund Meyer
|
||||
* Package: ExtendedFileManager (EFM 1.4)
|
||||
* http://www.afrusoft.com/htmlarea
|
||||
*/
|
||||
|
||||
var topDoc = window.top.document;
|
||||
|
||||
var t_cx = topDoc.getElementById('cx');
|
||||
var t_cy = topDoc.getElementById('cy');
|
||||
var t_cw = topDoc.getElementById('cw');
|
||||
var t_ch = topDoc.getElementById('ch');
|
||||
|
||||
var m_sx = topDoc.getElementById('sx');
|
||||
var m_sy = topDoc.getElementById('sy');
|
||||
var m_w = topDoc.getElementById('mw');
|
||||
var m_h = topDoc.getElementById('mh');
|
||||
var m_a = topDoc.getElementById('ma');
|
||||
var m_d = topDoc.getElementById('md');
|
||||
|
||||
var s_sw = topDoc.getElementById('sw');
|
||||
var s_sh = topDoc.getElementById('sh');
|
||||
|
||||
var r_ra = topDoc.getElementById('ra');
|
||||
|
||||
var pattern = "img/2x2.gif";
|
||||
|
||||
function doSubmit(action)
|
||||
{
|
||||
if (action == 'crop')
|
||||
{
|
||||
var url = _backend_url + "__function=editorFrame&img="+currentImageFile+"&action=crop¶ms="+parseInt(t_cx.value)+','+parseInt(t_cy.value)+','+ parseInt(t_cw.value)+','+parseInt(t_ch.value);
|
||||
|
||||
//alert(url);
|
||||
location.href = url;
|
||||
|
||||
//location.reload();
|
||||
}
|
||||
else if (action == 'scale')
|
||||
{
|
||||
var url = _backend_url + "__function=editorFrame&img="+currentImageFile+"&action=scale¶ms="+parseInt(s_sw.value)+','+parseInt(s_sh.value);
|
||||
//alert(url);
|
||||
location.href = url;
|
||||
|
||||
}
|
||||
else if (action == 'rotate')
|
||||
{
|
||||
var rotate_sub_action = topDoc.getElementById('rotate_sub_action');
|
||||
|
||||
if(rotate_sub_action.value == 'flip')
|
||||
location.href = _backend_url + "__function=editorFrame&img="+currentImageFile+"&action=flip¶ms="+topDoc.getElementById('flip').value;
|
||||
else if (isNaN(parseFloat(r_ra.value))==false)
|
||||
location.href = _backend_url + "__function=editorFrame&img="+currentImageFile+"&action=rotate¶ms="+parseFloat(r_ra.value);
|
||||
}
|
||||
else if(action == 'save') {
|
||||
var s_file = topDoc.getElementById('save_filename');
|
||||
var s_format = topDoc.getElementById('save_format');
|
||||
var s_quality = topDoc.getElementById('quality');
|
||||
|
||||
var format = s_format.value.split(",");
|
||||
if(s_file.value.length <= 0)
|
||||
{
|
||||
alert(i18n('Please enter a filename to save.'));
|
||||
}
|
||||
else
|
||||
{
|
||||
var filename = encodeURI(s_file.value);
|
||||
var quality = parseInt(s_quality.value);
|
||||
var format = s_format.value.split(",");
|
||||
var url = _backend_url + "__function=editorFrame&img="+currentImageFile+"&action=save¶ms="+format[0]+","+quality+"&file="+filename;
|
||||
location.href = url;
|
||||
}
|
||||
}
|
||||
else if (action == 'preview') {
|
||||
var s_format = topDoc.getElementById('save_format');
|
||||
var s_quality = topDoc.getElementById('quality');
|
||||
var quality = parseInt(s_quality.value);
|
||||
var format = s_format.value.split(",");
|
||||
var url = _backend_url + "__function=editorFrame&img="+currentImageFile+"&action=preview¶ms="+format[0]+","+quality+"&file="+filename;
|
||||
location.href = url;
|
||||
}
|
||||
}
|
||||
|
||||
function addEvent(obj, evType, fn)
|
||||
{
|
||||
if (obj.addEventListener) { obj.addEventListener(evType, fn, true); return true; }
|
||||
else if (obj.attachEvent) { var r = obj.attachEvent("on"+evType, fn); return r; }
|
||||
else { return false; }
|
||||
}
|
||||
|
||||
var jg_doc;
|
||||
|
||||
init = function()
|
||||
{
|
||||
jg_doc = new jsGraphics("imgCanvas"); // draw directly into document
|
||||
jg_doc.setColor("#000000"); // black
|
||||
|
||||
initEditor();
|
||||
if (window.parent.document.getElementById('zoom').value != '100') window.parent.zoom();
|
||||
reset();
|
||||
window.parent.document.getElementById('filesize').innerHTML = fileSize;
|
||||
};
|
||||
|
||||
addEvent(window, 'load', init);
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
<attach event="onmouseover" handler="hoverRollOver" />
|
||||
<attach event="onmouseout" handler="hoverRollOff" />
|
||||
<script type="text/javascript">
|
||||
//
|
||||
// Simple behaviour for IE5+ to emulate :hover CSS pseudo-class.
|
||||
// Experimental ver 0.1
|
||||
//
|
||||
// This is an experimental version! Handle with care!
|
||||
// Manual at: http://www.hszk.bme.hu/~hj130/css/list_menu/hover/
|
||||
//
|
||||
|
||||
function hoverRollOver() {
|
||||
|
||||
element.origClassName = element.className; // backup origonal className
|
||||
|
||||
var tempClassStr = element.className;
|
||||
|
||||
tempClassStr += "Hover"; // convert name+'Hover' the last class name to emulate tag.class:hover
|
||||
|
||||
tempClassStr = tempClassStr.replace(/\s/g,"Hover "); //convert name+'Hover' the others to emulate tag.class:hover
|
||||
|
||||
tempClassStr += " hover"; // add simple 'hover' class name to emulate tag:hover
|
||||
|
||||
element.className = element.className + " " + tempClassStr;
|
||||
|
||||
//alert(element.className);
|
||||
//window.status = element.className; // only for TEST
|
||||
}
|
||||
function hoverRollOff() {
|
||||
element.className = element.origClassName;
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
body { margin: 0; padding: 0;}
|
||||
.edit,.dir_holder .fileName, .thumb_holder .fileName { font-size: 8pt; font-family: small-caption, sans-serif; padding-top: 3px;}
|
||||
.edit a { border: none; padding: 0; text-decoration:none; }
|
||||
.edit a:hover { background-color: ButtonHighlight; }
|
||||
.edit a img { border: none; vertical-align: bottom; }
|
||||
.noResult { font-size:large; font-weight:bold; color:#ccc; font-family: Helvetica, sans-serif; text-align: center; padding-top: 60px; }
|
||||
.error { color:#c00; font-weight:bold; font-size: medium; font-family: Helvetica, sans-serif; text-align: center; padding-top: 65px;}
|
||||
|
||||
.dir_holder, .thumb_holder
|
||||
{
|
||||
width:106px; height:132px;
|
||||
float:left;
|
||||
margin:6px 4px;
|
||||
background-color:ButtonFace;
|
||||
border: 1px outset;
|
||||
}
|
||||
|
||||
.thumb_holder.active
|
||||
{
|
||||
background:Highlight;
|
||||
color:HighlightText;
|
||||
border:1px dashed Highlight;
|
||||
}
|
||||
|
||||
.dir_holder a.dir, .thumb_holder a.thumb
|
||||
{
|
||||
height:85px;
|
||||
display:block;
|
||||
text-align:center;
|
||||
padding:5px;
|
||||
text-decoration:none;
|
||||
overflow:hidden;
|
||||
}
|
||||
|
||||
.thumb_holder a.thumb img
|
||||
{
|
||||
border:1px solid black;
|
||||
}
|
||||
|
||||
.dir_holder a.dir img
|
||||
{
|
||||
border:none;
|
||||
}
|
||||
|
||||
.listview { width:100%; }
|
||||
.listview td, .listview th { text-align:left; font-size:small; }
|
||||
.listview td.actions { text-align: right;width:111px }
|
||||
.listview td.actions img { border:0; }
|
||||
|
||||
.listview thead th {background-color: ButtonFace; border: 1px solid threedface; border-color: ButtonHighlight ButtonShadow ButtonShadow ButtonHighlight; padding-top:2px; padding-bottom:2px; padding-left: 5px; padding-right: 5px; font-size: 9pt; font-family: "MS Sans Serif", "Bitstream Vera Sans", Geneva, Sans, sans-serif;font-weight:normal}
|
||||
.listview tbody td, .listview tbody th {overflow:hidden; padding-top:2px; padding-left: 3px; font-size: 9pt; font-family: "MS Sans Serif", "Bitstream Vera Sans", Geneva, Sans, sans-serif;}
|
||||
.listview tbody a, listview tbody a:visited { font-weight: normal; text-decoration: none; color: #000; border:0px; padding:2px;}
|
||||
.listview tbody a:hover { background-color:#0B256B; color:#fff;}
|
||||
|
||||
.listview tbody tr:hover {background-color: rgb(221,221,255)};
|
||||
|
|
@ -0,0 +1,313 @@
|
|||
/**
|
||||
* Functions for the image listing, used by images.php only
|
||||
* Authors: Wei Zhuo, Afru, Krzysztof Kotowicz, Raimund Meyer
|
||||
* Version: Updated on 08-01-2005 by Afru
|
||||
* Version: Updated on 04-07-2006 by Krzysztof Kotowicz
|
||||
* Version: Updated on 17-11-2006 by Raimund Meyer
|
||||
* Package: ExtendedFileManager (EFM 1.1.3)
|
||||
* http://www.afrusoft.com/htmlarea
|
||||
*/
|
||||
|
||||
function i18n(str) {
|
||||
return Xinha._lc(str, 'ExtendedFileManager');
|
||||
}
|
||||
|
||||
function changeDir(newDir)
|
||||
{
|
||||
showMessage('Loading');
|
||||
var mode=window.top.document.getElementById('manager_mode').value;
|
||||
var selection = window.top.document.getElementById('viewtype');
|
||||
var viewtype = selection.options[selection.selectedIndex].value;
|
||||
location.href = _backend_url + "__function=images&mode="+mode+"&dir="+newDir+"&viewtype="+viewtype;
|
||||
document.cookie = "EFMStartDir" + mode + "="+newDir;
|
||||
}
|
||||
|
||||
function newFolder(dir, newDir)
|
||||
{
|
||||
var mode=window.top.document.getElementById('manager_mode').value;
|
||||
var selection = window.top.document.getElementById('viewtype');
|
||||
var viewtype = selection.options[selection.selectedIndex].value;
|
||||
location.href = _backend_url + "__function=images&mode="+mode+"&dir="+dir+"&newDir="+newDir+"&viewtype="+viewtype;
|
||||
}
|
||||
|
||||
function renameFile(oldPath) {
|
||||
// strip directory and extension
|
||||
var oldName=oldPath.replace(/.*%2F/,'').replace(/\..*$/,'');
|
||||
|
||||
var rename = function (newName)
|
||||
{
|
||||
if(newName == '' || newName == null || newName == oldName)
|
||||
{
|
||||
alert(i18n('Cancelled rename.'));
|
||||
return false;
|
||||
}
|
||||
var mode=window.top.document.getElementById('manager_mode').value;
|
||||
var selection = window.top.document.getElementById('dirPath');
|
||||
var dir = selection.options[selection.selectedIndex].value;
|
||||
selection = window.top.document.getElementById('viewtype');
|
||||
var viewtype = selection.options[selection.selectedIndex].value;
|
||||
location.href = _backend_url + "__function=images&mode="+mode+"&dir="+dir+"&rename="+oldPath+"&renameTo="+newName+"&viewtype="+viewtype;
|
||||
}
|
||||
|
||||
// IE7 has crippled the prompt()
|
||||
if ( Xinha.ie_version > 6 )
|
||||
{
|
||||
popupPrompt(i18n("Please enter new name for this file..."), oldName, rename, i18n("Rename"));
|
||||
}
|
||||
else
|
||||
{
|
||||
var newName = prompt(i18n('Please enter new name for this file...'), oldName);
|
||||
rename(newName);
|
||||
}
|
||||
}
|
||||
function renameDir(oldName)
|
||||
{
|
||||
// strip directory and extension
|
||||
|
||||
function rename(newName)
|
||||
{
|
||||
if(newName == '' || newName == null || newName == oldName)
|
||||
{
|
||||
alert(i18n('Cancelled rename.'));
|
||||
return false;
|
||||
}
|
||||
var mode=window.top.document.getElementById('manager_mode').value;
|
||||
var selection = window.top.document.getElementById('dirPath');
|
||||
var dir = selection.options[selection.selectedIndex].value;
|
||||
selection = window.top.document.getElementById('viewtype');
|
||||
var viewtype = selection.options[selection.selectedIndex].value;
|
||||
location.href = _backend_url + "__function=images&mode="+mode+"&dir="+dir+"&rename="+oldName+"&renameTo="+newName+"&viewtype="+viewtype;
|
||||
}
|
||||
|
||||
// IE7 has crippled the prompt()
|
||||
if ( Xinha.ie_version > 6 )
|
||||
{
|
||||
popupPrompt(i18n('Please enter new name for this folder...'), oldName, rename, i18n("Rename"));
|
||||
}
|
||||
else
|
||||
{
|
||||
var newName = prompt(i18n('Please enter new name for this folder...'), oldName);
|
||||
rename(newName);
|
||||
}
|
||||
}
|
||||
function copyFile(file,action)
|
||||
{
|
||||
var selection = window.top.document.getElementById('dirPath');
|
||||
var dir = selection.options[selection.selectedIndex].value;
|
||||
window.top.pasteButton({'dir':dir,'file':file,'action':action+'File'});
|
||||
}
|
||||
function copyDir(dirToCopy,action)
|
||||
{
|
||||
var selection = window.top.document.getElementById('dirPath');
|
||||
var dir = selection.options[selection.selectedIndex].value;
|
||||
window.top.pasteButton({'dir':dir,'file':dirToCopy,'action':action+'Dir'});
|
||||
}
|
||||
function paste(action)
|
||||
{
|
||||
var mode=window.top.document.getElementById('manager_mode').value;
|
||||
var selection = window.top.document.getElementById('dirPath');
|
||||
var dir = selection.options[selection.selectedIndex].value;
|
||||
selection = window.top.document.getElementById('viewtype');
|
||||
var viewtype = selection.options[selection.selectedIndex].value;
|
||||
location.href = _backend_url + "__function=images&mode="+mode+"&dir="+dir+"&paste="+action.action+"&srcdir="+action.dir+"&file="+action.file+"&viewtype="+viewtype;
|
||||
}
|
||||
//update the dir list in the parent window.
|
||||
function updateDir(newDir)
|
||||
{
|
||||
var mode = window.top.document.getElementById('manager_mode').value;
|
||||
document.cookie = "EFMStartDir" + mode + "="+newDir;
|
||||
|
||||
var selection = window.top.document.getElementById('dirPath');
|
||||
if(selection)
|
||||
{
|
||||
for(var i = 0; i < selection.length; i++)
|
||||
{
|
||||
var thisDir = selection.options[i].text;
|
||||
if(thisDir == newDir)
|
||||
{
|
||||
selection.selectedIndex = i;
|
||||
showMessage('Loading');
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function emptyProperties()
|
||||
{
|
||||
toggleImageProperties(false);
|
||||
var topDoc = window.top.document;
|
||||
topDoc.getElementById('f_url').value = '';
|
||||
topDoc.getElementById('f_alt').value = '';
|
||||
topDoc.getElementById('f_title').value = '';
|
||||
topDoc.getElementById('f_width').value = '';
|
||||
topDoc.getElementById('f_margin').value = '';
|
||||
topDoc.getElementById('f_height').value = '';
|
||||
topDoc.getElementById('f_padding').value = '';
|
||||
topDoc.getElementById('f_border').value = '';
|
||||
topDoc.getElementById('f_borderColor').value = '';
|
||||
topDoc.getElementById('f_backgroundColor').value = '';
|
||||
}
|
||||
|
||||
function toggleImageProperties(val)
|
||||
{
|
||||
var topDoc = window.top.document;
|
||||
if(val==true)
|
||||
{
|
||||
topDoc.getElementById('f_width').value = '';
|
||||
topDoc.getElementById('f_margin').value = '';
|
||||
topDoc.getElementById('f_height').value = '';
|
||||
topDoc.getElementById('f_padding').value = '';
|
||||
topDoc.getElementById('f_border').value = '';
|
||||
topDoc.getElementById('f_borderColor').value = '';
|
||||
topDoc.getElementById('f_backgroundColor').value = '';
|
||||
}
|
||||
topDoc.getElementById('f_width').disabled = val;
|
||||
topDoc.getElementById('f_margin').disabled = val;
|
||||
topDoc.getElementById('f_height').disabled = val;
|
||||
topDoc.getElementById('f_padding').disabled = val;
|
||||
topDoc.getElementById('f_align').disabled = val;
|
||||
topDoc.getElementById('f_border').disabled = val;
|
||||
topDoc.getElementById('f_borderColor').value = '';
|
||||
topDoc.getElementById('f_backgroundColor').value = '';
|
||||
topDoc.getElementById('constrain_prop').disabled = val;
|
||||
}
|
||||
|
||||
function selectImage(filename, alt, width, height)
|
||||
{
|
||||
var topDoc = window.top.document;
|
||||
|
||||
if(topDoc.getElementById('manager_mode').value=="image")
|
||||
{
|
||||
var obj = topDoc.getElementById('f_url'); obj.value = filename;
|
||||
obj = topDoc.getElementById('f_alt'); obj.value = alt;
|
||||
obj = topDoc.getElementById('f_title'); obj.value = alt;
|
||||
|
||||
if(width==0 && height==0) toggleImageProperties(true);
|
||||
else
|
||||
{
|
||||
toggleImageProperties(false);
|
||||
var obj = topDoc.getElementById('f_width'); obj.value = width;
|
||||
var obj = topDoc.getElementById('f_height'); obj.value = height;
|
||||
var obj = topDoc.getElementById('orginal_width'); obj.value = width;
|
||||
var obj = topDoc.getElementById('orginal_height'); obj.value = height;
|
||||
update_selected();
|
||||
}
|
||||
}
|
||||
else if (topDoc.getElementById('manager_mode').value=="link")
|
||||
{
|
||||
var obj = topDoc.getElementById('f_href'); obj.value = filename;
|
||||
var obj = topDoc.getElementById('f_title'); obj.value = alt;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
var _current_selected = null;
|
||||
|
||||
function update_selected()
|
||||
{
|
||||
var topDoc = window.top.document;
|
||||
if(_current_selected)
|
||||
{
|
||||
_current_selected.className = _current_selected.className.replace(/(^| )active( |$)/, '$1$2');
|
||||
_current_selected = null;
|
||||
}
|
||||
// Grab the current file, and highlight it if we have it
|
||||
var c_file = topDoc.getElementById('f_url').value;
|
||||
var selection = topDoc.getElementById('dirPath');
|
||||
var currentDir = selection.options[selection.selectedIndex].text;
|
||||
var dRe = new RegExp('^(' + currentDir.replace(/([\/\^$*+?.()|{}[\]])/g, '\\$1') + ')([^/]*)$');
|
||||
if(dRe.test(c_file))
|
||||
{
|
||||
var holder = document.getElementById('holder_' + asc2hex(RegExp.$2));
|
||||
if(holder)
|
||||
{
|
||||
_current_selected = holder;
|
||||
holder.className += ' active';
|
||||
}
|
||||
}
|
||||
showPreview(c_file);
|
||||
}
|
||||
|
||||
function asc2hex(str)
|
||||
{
|
||||
var hexstr = '';
|
||||
for(var i = 0; i < str.length; i++)
|
||||
{
|
||||
var hex = (str.charCodeAt(i)).toString(16);
|
||||
if(hex.length == 1) hex = '0' + hex;
|
||||
hexstr += hex;
|
||||
}
|
||||
return hexstr;
|
||||
}
|
||||
|
||||
function showMessage(newMessage)
|
||||
{
|
||||
var topDoc = window.top.document;
|
||||
|
||||
var message = topDoc.getElementById('message');
|
||||
var messages = topDoc.getElementById('messages');
|
||||
if(message && messages)
|
||||
{
|
||||
if(message.firstChild)
|
||||
message.removeChild(message.firstChild);
|
||||
|
||||
message.appendChild(topDoc.createTextNode(i18n(newMessage)));
|
||||
|
||||
messages.style.display = "block";
|
||||
}
|
||||
}
|
||||
|
||||
function updateDiskMesg(newMessage)
|
||||
{
|
||||
var topDoc = window.top.document;
|
||||
|
||||
var diskmesg = topDoc.getElementById('diskmesg');
|
||||
if(diskmesg)
|
||||
{
|
||||
if(diskmesg.firstChild)
|
||||
diskmesg.removeChild(diskmesg.firstChild);
|
||||
|
||||
diskmesg.appendChild(topDoc.createTextNode(newMessage));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function addEvent(obj, evType, fn)
|
||||
{
|
||||
if (obj.addEventListener) { obj.addEventListener(evType, fn, true); return true; }
|
||||
else if (obj.attachEvent) { var r = obj.attachEvent("on"+evType, fn); return r; }
|
||||
else { return false; }
|
||||
}
|
||||
|
||||
function confirmDeleteFile(file)
|
||||
{
|
||||
if(confirm(i18n('Delete file "$file=' + file +'$"?')))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function confirmDeleteDir(dir, count)
|
||||
{
|
||||
/* if(count > 0)
|
||||
{
|
||||
alert(i18n("Folder is not empty. Please delete all Files and Subfolders inside."));
|
||||
return false;
|
||||
}*/
|
||||
|
||||
if(confirm(i18n('Delete folder "$dir=' + dir +'$"?')))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function showPreview(f_url)
|
||||
{
|
||||
window.parent.document.getElementById('f_preview').src =
|
||||
f_url ? window.parent._backend_url + '__function=thumbs&img=' + f_url :window.parent.opener.Xinha.getPluginDir('ExtendedFileManager')+'/img/1x1_transparent.gif';
|
||||
}
|
||||
|
||||
addEvent(window, 'load', init);
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
html, body, .dialog { background-color: ButtonFace; color: ButtonText; font: 11px Tahoma,Verdana,sans-serif; margin: 0; padding: 0;}
|
||||
body { padding: 5px; }
|
||||
fieldset { padding: 0;}
|
||||
.title { background-color: #ddf; color: #000; font-weight: bold; font-size: 120%; padding: 3px 10px; margin-bottom: 10px; border-bottom: 1px solid black; letter-spacing: 2px;}
|
||||
form { padding: 0px; margin: 0 auto; width: 100%;}
|
||||
/*.dirWidth { width: 60%; }*/
|
||||
a { padding: 5px; border: 1px solid ButtonFace; }
|
||||
a img { border: 0; }
|
||||
a:hover { border-color: ButtonHighlight ButtonShadow ButtonShadow ButtonHighlight; }
|
||||
.dirs { padding: 1em; }
|
||||
|
||||
.imageFrame { overflow-x:hidden; width: 100%; height: 155px; margin:0px; background-color: #fff;}
|
||||
.smallWidth{ width: 4em; }
|
||||
.largelWidth{ width: 30em; }
|
||||
.extralargelWidth{ width: 100%; }
|
||||
.inputTable { margin: 1em auto 1em 0;width:100%}
|
||||
select, input, button { font: 11px Tahoma,Verdana,sans-serif; }
|
||||
.buttons { width: 70px; text-align: center; }
|
||||
.clearboth{ clear: both; }
|
||||
#messages {opacity:0.8;filter:Alpha(opacity=85);position:relative;height:20px;margin-bottom:-30px;background-color: white; border: none; text-align: center; padding: 5px; }
|
||||
#message { font-size: 15px; font-weight: bold; color: #69c; }
|
||||
iframe { border:1px inset; border-right:none; border-left:none; border-bottom:none; }
|
||||
#controls {padding-bottom:10px;}
|
||||
table { margin-top:10px; }
|
||||
th, td { padding-right:3px; text-align:left; font-family:small-caption,helvetica,sans-serif; }
|
||||
.dirWidth {width: 59%}
|
||||
|
||||
.buttonColor {
|
||||
width :1em;
|
||||
margin-left: 2px;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.buttonColor .chooser, .buttonColor .nocolor {
|
||||
height: 0.6em;
|
||||
border: 1px solid;
|
||||
padding: 0px 1em;
|
||||
border-color: ButtonHighlight ButtonShadow ButtonShadow ButtonHighlight;
|
||||
}
|
||||
|
||||
.buttonColor .buttonClick {
|
||||
border-color: ButtonShadow ButtonHighlight ButtonHighlight ButtonShadow;
|
||||
}
|
||||
.buttonColor .buttonColor-hilite {
|
||||
border-color: ButtonShadow ButtonHighlight ButtonHighlight ButtonShadow;
|
||||
}
|
||||
|
||||
.buttonColor .nocolor { padding: 0px; }
|
||||
.buttonColor .nocolor-hilite { background-color: #fff; color: #f00; }
|
||||
|
|
@ -0,0 +1,554 @@
|
|||
/**
|
||||
* Functions for the ExtendedFileManager, used by manager.php only
|
||||
* Authors: Wei Zhuo, Afru, Krzysztof Kotowicz, Raimund Meyer
|
||||
* Version: Updated on 08-01-2005 by Afru
|
||||
* Version: Updated on 20-06-2006 by Krzysztof Kotowicz
|
||||
* Version: Updated on 17-11-2006 by Raimund Meyer
|
||||
* Version: Updated on 20-01-2008 by Raimund Meyer
|
||||
* Package: ExtendedFileManager (EFM 1.4)
|
||||
* http://www.afrusoft.com/htmlarea
|
||||
*/
|
||||
|
||||
function comboSelectValue(c, val) {
|
||||
var ops = c.getElementsByTagName("option");
|
||||
for (var i = ops.length; --i >= 0;) {
|
||||
var op = ops[i];
|
||||
op.selected = (op.value == val);
|
||||
}
|
||||
c.value = val;
|
||||
}
|
||||
|
||||
//Translation
|
||||
function i18n(str) {
|
||||
return Xinha._lc(str, 'ExtendedFileManager');
|
||||
}
|
||||
|
||||
//set the alignment options
|
||||
function setAlign(align)
|
||||
{
|
||||
var selection = document.getElementById('f_align');
|
||||
for(var i = 0; i < selection.length; i++)
|
||||
{
|
||||
if(selection.options[i].value == align)
|
||||
{
|
||||
selection.selectedIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function onTargetChanged() {
|
||||
var f = document.getElementById("f_other_target");
|
||||
if (this.value == "_other") {
|
||||
f.style.visibility = "visible";
|
||||
f.select();
|
||||
f.focus();
|
||||
} else f.style.visibility = "hidden";
|
||||
}
|
||||
|
||||
function init ()
|
||||
{
|
||||
if (typeof imgManager == 'undefined' )
|
||||
{
|
||||
setTimeout(init,10); // sometimes we are too hasty
|
||||
return;
|
||||
}
|
||||
|
||||
var w = 650;
|
||||
var h = 600;
|
||||
|
||||
window.resizeTo(w,h);
|
||||
var page = Xinha.pageSize(window);
|
||||
window.resizeTo(w,h);
|
||||
|
||||
var dim = Xinha.viewportSize(window);
|
||||
|
||||
window.resizeBy(0, page.y - dim.y + 5);
|
||||
|
||||
dim = Xinha.viewportSize(window);
|
||||
|
||||
if (!Xinha.is_ie)
|
||||
{
|
||||
var x = opener.screenX + (opener.outerWidth - dim.x) / 2;
|
||||
var y = opener.screenY + (opener.outerHeight - dim.x) / 2;
|
||||
}
|
||||
else
|
||||
{//IE does not have window.outer... , so center it on the screen at least
|
||||
var x = (self.screen.availWidth - dim.x) / 2;
|
||||
var y = (self.screen.availHeight - dim.y) / 2;
|
||||
}
|
||||
window.moveTo(x,y);
|
||||
|
||||
__xinha_dlg_init();
|
||||
__dlg_translate('ExtendedFileManager');
|
||||
|
||||
var uploadForm = document.getElementById('uploadForm');
|
||||
if(uploadForm) uploadForm.target = 'imgManager';
|
||||
|
||||
var editor = window.dialogArguments.editor;
|
||||
|
||||
var param = window.dialogArguments.param;
|
||||
var startDir = null;
|
||||
|
||||
if(manager_mode=="image" && param)
|
||||
{
|
||||
var absoluteURL = new RegExp('^https?://');
|
||||
|
||||
if (param.f_url.length > 0 && !absoluteURL.test(param.f_url) && typeof param.baseHref == "string") {
|
||||
// URL is not absolute, prepend baseHref
|
||||
param.f_url = param.baseHref + param.f_url;
|
||||
}
|
||||
|
||||
// strip base_url from url
|
||||
var image_regex = new RegExp( '(https?://[^/]*)?' + base_url.replace(/\/$/, '') );
|
||||
param.f_url = param.f_url.replace( image_regex, "" );
|
||||
|
||||
// The image URL may reference one of the automatically resized images
|
||||
// (when the user alters the dimensions in the picker), clean that up
|
||||
// so it looks right and we get back to a normal f_url
|
||||
var rd = (_resized_dir) ? _resized_dir.replace(Xinha.RE_Specials, '\\$1') + '/' : '';
|
||||
var rp = _resized_prefix.replace(Xinha.RE_Specials, '\\$1');
|
||||
var dreg = new RegExp('^(.*/)' + rd + rp + '_([0-9]+)x([0-9]+)_([^/]+)$');
|
||||
|
||||
var match = param.f_url.match(dreg);
|
||||
|
||||
if(dreg.test(param.f_url))
|
||||
{
|
||||
param.f_url = RegExp.$1 + RegExp.$4;
|
||||
param.f_width = RegExp.$2;
|
||||
param.f_height = RegExp.$3;
|
||||
}
|
||||
|
||||
document.getElementById("f_url").value = param["f_url"];
|
||||
document.getElementById("f_alt").value = param["f_alt"];
|
||||
document.getElementById("f_title").value = param["f_title"];
|
||||
document.getElementById("f_border").value = param["f_border"];
|
||||
document.getElementById("f_width").value = param["f_width"];
|
||||
document.getElementById("f_height").value = param["f_height"];
|
||||
document.getElementById("f_margin").value = param["f_margin"];
|
||||
document.getElementById("f_padding").value = param["f_padding"];
|
||||
document.getElementById("f_borderColor").value = param["f_borderColor"];
|
||||
document.getElementById("f_backgroundColor").value = param["f_backgroundColor"];
|
||||
|
||||
setAlign(param["f_align"]);
|
||||
|
||||
document.getElementById("f_url").focus();
|
||||
|
||||
document.getElementById("orginal_width").value = param["f_width"];
|
||||
document.getElementById("orginal_height").value = param["f_height"];
|
||||
|
||||
// Locate to the correct directory
|
||||
var dreg = new RegExp('^(.*/)([^/]+)$');
|
||||
if (dreg.test(param['f_url']))
|
||||
{
|
||||
startDir = RegExp.$1;
|
||||
}
|
||||
|
||||
document.getElementById('f_preview').src = _backend_url + '__function=thumbs&img=' + param.f_url;
|
||||
|
||||
}
|
||||
|
||||
else if(manager_mode=="link" && param)
|
||||
{
|
||||
var target_select = document.getElementById("f_target");
|
||||
var absoluteURL = new RegExp('^https?://');
|
||||
|
||||
if (param.f_href.length > 0 && !absoluteURL.test(param.f_href) && typeof param.baseHref == "string") {
|
||||
// URL is not absolute, prepend baseHref
|
||||
param.f_href = param.baseHref + param.f_href;
|
||||
}
|
||||
|
||||
// strip base_url from href
|
||||
var href_regex = new RegExp( '(https?://[^/]*)?' + base_url.replace(/\/$/, '') );
|
||||
param.f_href = param.f_href.replace( href_regex, "" );
|
||||
|
||||
// Locate to the correct directory
|
||||
var dreg = new RegExp('^(.*/)([^/]+)$');
|
||||
if (dreg.test(param['f_href']))
|
||||
{
|
||||
startDir = RegExp.$1;
|
||||
}
|
||||
else
|
||||
{
|
||||
startDir = document.cookie.match(/EFMStartDirlink=(.*?)(;|$)/);
|
||||
if (startDir) startDir = startDir[1];
|
||||
}
|
||||
|
||||
if (param)
|
||||
{
|
||||
if ( typeof param["f_href"] != "undefined" )
|
||||
{
|
||||
document.getElementById("f_href").value = param["f_href"];
|
||||
document.getElementById("f_title").value = param["f_title"];
|
||||
comboSelectValue(target_select, param["f_target"]);
|
||||
if (target_select.value != param.f_target)
|
||||
{
|
||||
var opt = document.createElement("option");
|
||||
opt.value = param.f_target;
|
||||
opt.innerHTML = opt.value;
|
||||
target_select.appendChild(opt);
|
||||
opt.selected = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( param["f_usetarget"] == false || manager_show_target != false)
|
||||
{
|
||||
document.getElementById("f_target_label").style.visibility = "hidden";
|
||||
document.getElementById("f_target").style.visibility = "hidden";
|
||||
document.getElementById("f_other_target").style.visibility = "hidden";
|
||||
}
|
||||
if (target_select && param["f_usetarget"] && manager_show_target != false)
|
||||
{
|
||||
var opt = document.createElement("option");
|
||||
opt.value = "_other";
|
||||
opt.innerHTML = i18n("Other");
|
||||
target_select.appendChild(opt);
|
||||
target_select.onchange = onTargetChanged;
|
||||
}
|
||||
|
||||
document.getElementById("f_href").focus();
|
||||
}
|
||||
else if (!param)
|
||||
{
|
||||
startDir = document.cookie.match(new RegExp ("EFMStartDir" + manager_mode + "=(.*?)(;|$)"));
|
||||
if (startDir)
|
||||
{
|
||||
startDir = startDir[1];
|
||||
}
|
||||
}
|
||||
if ( startDir )
|
||||
{
|
||||
iframeUrl += '&dir=' + startDir;
|
||||
var dirPath = document.getElementById('dirPath');
|
||||
for(var i = 0; i < dirPath.options.length; i++)
|
||||
{
|
||||
if(dirPath.options[i].value == encodeURIComponent(startDir))
|
||||
{
|
||||
dirPath.options[i].selected = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
imgManager.location.replace(iframeUrl);
|
||||
|
||||
if (manager_mode == 'image' && typeof Xinha.colorPicker != "undefined" && document.getElementById('f_backgroundColor') && document.getElementById('f_backgroundColor').type == 'text') {
|
||||
// Hookup color pickers
|
||||
|
||||
var pickerConfig = {
|
||||
cellsize:editor.config.colorPickerCellSize,
|
||||
granularity:editor.config.colorPickerGranularity,
|
||||
websafe:editor.config.colorPickerWebSafe,
|
||||
savecolors:editor.config.colorPickerSaveColors
|
||||
};
|
||||
|
||||
new Xinha.colorPicker.InputBinding(document.getElementById('f_backgroundColor'),pickerConfig);
|
||||
new Xinha.colorPicker.InputBinding(document.getElementById('f_borderColor'),pickerConfig);
|
||||
}
|
||||
setTimeout(function() { resize();addEvent(window, 'resize', resize); }, 500);
|
||||
}
|
||||
|
||||
function pasteButton(action)
|
||||
{
|
||||
var buttonHolder = document.getElementById('pasteBtn');
|
||||
if (!buttonHolder.firstChild)
|
||||
{
|
||||
var a = document.createElement('a');
|
||||
a.href = "javascript:void(0);";
|
||||
|
||||
var img = document.createElement('img');
|
||||
img.src = window.opener.Xinha.getPluginDir('ExtendedFileManager')+'/img/edit_paste.gif';
|
||||
img.alt = i18n('Paste');
|
||||
a.appendChild(img);
|
||||
buttonHolder.appendChild(a);
|
||||
}
|
||||
buttonHolder.onclick = function() {
|
||||
if(typeof imgManager != 'undefined') imgManager.paste(action);
|
||||
if (action.action == 'moveFile' || action.action == 'moveDir' )
|
||||
{
|
||||
this.onclick = null;
|
||||
this.removeChild(this.firstChild)
|
||||
}
|
||||
}
|
||||
switch (action.action)
|
||||
{
|
||||
case 'copyFile':
|
||||
buttonHolder.firstChild.title = i18n('Copy "$file='+action.file+'$" from "$dir='+decodeURIComponent(action.dir)+'$" here');
|
||||
break;
|
||||
case 'copyDir':
|
||||
buttonHolder.firstChild.title = i18n('Copy folder "$file='+action.file+'$" from "$dir='+decodeURIComponent(action.dir)+'$" here');
|
||||
break;
|
||||
case 'moveFile':
|
||||
buttonHolder.firstChild.title = i18n('Move "$file='+action.file+'$" from "$dir='+decodeURIComponent(action.dir)+'$" here');
|
||||
break;
|
||||
break;
|
||||
case 'moveDir':
|
||||
buttonHolder.firstChild.title = i18n('Move folder "$file='+action.file+'$" from "$dir='+decodeURIComponent(action.dir)+'$" here');
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
function onCancel()
|
||||
{
|
||||
__dlg_close(null);
|
||||
return false;
|
||||
}
|
||||
|
||||
function onOK()
|
||||
{
|
||||
if(manager_mode=="image")
|
||||
{
|
||||
// pass data back to the calling window
|
||||
var fields = ["f_url", "f_alt", "f_title", "f_align", "f_border", "f_margin", "f_padding", "f_height", "f_width", "f_borderColor", "f_backgroundColor"];
|
||||
var param = new Object();
|
||||
for (var i in fields)
|
||||
{
|
||||
var id = fields[i];
|
||||
var el = document.getElementById(id);
|
||||
if(id == "f_url" && el.value.indexOf('://') < 0 && el.value )
|
||||
param[id] = makeURL(base_url,el.value);
|
||||
else
|
||||
param[id] = el.value;
|
||||
}
|
||||
|
||||
// See if we need to resize the image
|
||||
var origsize =
|
||||
{
|
||||
w:document.getElementById('orginal_width').value,
|
||||
h:document.getElementById('orginal_height').value
|
||||
}
|
||||
|
||||
if( (origsize.w != param.f_width)
|
||||
|| (origsize.h != param.f_height) )
|
||||
{
|
||||
// Yup, need to resize
|
||||
var resized = Xinha._geturlcontent(window.opener.Xinha.getPluginDir('ExtendedFileManager') + '/' + _backend_url + '&__function=resizer&img=' + encodeURIComponent(document.getElementById('f_url').value) + '&width=' + param.f_width + '&height=' + param.f_height);
|
||||
|
||||
// alert(resized);
|
||||
resized = eval(resized);
|
||||
if(resized)
|
||||
{
|
||||
param.f_url = makeURL(base_url, resized);
|
||||
}
|
||||
}
|
||||
__dlg_close(param);
|
||||
return false;
|
||||
}
|
||||
else if(manager_mode=="link")
|
||||
{
|
||||
var required = {
|
||||
// f_href shouldn't be required or otherwise removing the link by entering an empty
|
||||
|
||||
// url isn't possible anymore.
|
||||
|
||||
// "f_href": i18n("You must enter the URL where this link points to")
|
||||
|
||||
};
|
||||
for (var i in required) {
|
||||
var el = document.getElementById(i);
|
||||
if (!el.value) {
|
||||
alert(required[i]);
|
||||
el.focus();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// pass data back to the calling window
|
||||
var fields = ["f_href", "f_title", "f_target" ];
|
||||
var param = new Object();
|
||||
for (var i in fields) {
|
||||
var id = fields[i];
|
||||
var el = document.getElementById(id);
|
||||
|
||||
if(id == "f_href" && el.value.indexOf('://') < 0 )
|
||||
param[id] = makeURL(base_url,el.value);
|
||||
else
|
||||
param[id] = el.value;
|
||||
|
||||
}
|
||||
if (param.f_target == "_other")
|
||||
param.f_target = document.getElementById("f_other_target").value;
|
||||
|
||||
// alert(param.f_target);
|
||||
__dlg_close(param);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//similar to the Files::makeFile() in Files.php
|
||||
function makeURL(pathA, pathB)
|
||||
{
|
||||
if(pathA.substring(pathA.length-1) != '/')
|
||||
pathA += '/';
|
||||
|
||||
if(pathB.charAt(0) == '/');
|
||||
pathB = pathB.substring(1);
|
||||
|
||||
return pathA+pathB;
|
||||
}
|
||||
|
||||
function updateDir(selection)
|
||||
{
|
||||
var newDir = selection.options[selection.selectedIndex].value;
|
||||
changeDir(newDir);
|
||||
}
|
||||
|
||||
function goUpDir()
|
||||
{
|
||||
var selection = document.getElementById('dirPath');
|
||||
var currentDir = selection.options[selection.selectedIndex].text;
|
||||
if(currentDir.length < 2)
|
||||
return false;
|
||||
var dirs = currentDir.split('/');
|
||||
|
||||
var search = '';
|
||||
|
||||
for(var i = 0; i < dirs.length - 2; i++)
|
||||
{
|
||||
search += dirs[i]+'/';
|
||||
}
|
||||
|
||||
for(var i = 0; i < selection.length; i++)
|
||||
{
|
||||
var thisDir = selection.options[i].text;
|
||||
if(thisDir == search)
|
||||
{
|
||||
selection.selectedIndex = i;
|
||||
var newDir = selection.options[i].value;
|
||||
changeDir(newDir);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function changeDir(newDir)
|
||||
{
|
||||
if(typeof imgManager != 'undefined')
|
||||
imgManager.changeDir(newDir);
|
||||
}
|
||||
|
||||
function updateView()
|
||||
{
|
||||
refresh();
|
||||
}
|
||||
|
||||
function toggleConstrains(constrains)
|
||||
{
|
||||
var lockImage = document.getElementById('imgLock');
|
||||
var constrains = document.getElementById('constrain_prop');
|
||||
|
||||
if(constrains.checked)
|
||||
{
|
||||
lockImage.src = "img/locked.gif";
|
||||
checkConstrains('width')
|
||||
}
|
||||
else
|
||||
{
|
||||
lockImage.src = "img/unlocked.gif";
|
||||
}
|
||||
}
|
||||
|
||||
function checkConstrains(changed)
|
||||
{
|
||||
//alert(document.form1.constrain_prop);
|
||||
var constrains = document.getElementById('constrain_prop');
|
||||
|
||||
if(constrains.checked)
|
||||
{
|
||||
var obj = document.getElementById('orginal_width');
|
||||
var orginal_width = parseInt(obj.value);
|
||||
var obj = document.getElementById('orginal_height');
|
||||
var orginal_height = parseInt(obj.value);
|
||||
|
||||
var widthObj = document.getElementById('f_width');
|
||||
var heightObj = document.getElementById('f_height');
|
||||
|
||||
var width = parseInt(widthObj.value);
|
||||
var height = parseInt(heightObj.value);
|
||||
|
||||
if(orginal_width > 0 && orginal_height > 0)
|
||||
{
|
||||
if(changed == 'width' && width > 0) {
|
||||
heightObj.value = parseInt((width/orginal_width)*orginal_height);
|
||||
}
|
||||
|
||||
if(changed == 'height' && height > 0) {
|
||||
widthObj.value = parseInt((height/orginal_height)*orginal_width);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function showMessage(newMessage)
|
||||
{
|
||||
var message = document.getElementById('message');
|
||||
var messages = document.getElementById('messages');
|
||||
if(message.firstChild)
|
||||
message.removeChild(message.firstChild);
|
||||
|
||||
message.appendChild(document.createTextNode(i18n(newMessage)));
|
||||
|
||||
messages.style.display = "block";
|
||||
}
|
||||
|
||||
function addEvent(obj, evType, fn)
|
||||
{
|
||||
if (obj.addEventListener) { obj.addEventListener(evType, fn, true); return true; }
|
||||
else if (obj.attachEvent) { var r = obj.attachEvent("on"+evType, fn); return r; }
|
||||
else { return false; }
|
||||
}
|
||||
|
||||
function doUpload()
|
||||
{
|
||||
var uploadForm = document.getElementById('uploadForm');
|
||||
if(uploadForm)
|
||||
showMessage('Uploading');
|
||||
}
|
||||
|
||||
function refresh()
|
||||
{
|
||||
var selection = document.getElementById('dirPath');
|
||||
updateDir(selection);
|
||||
}
|
||||
|
||||
function newFolder()
|
||||
{
|
||||
function createFolder(folder)
|
||||
{
|
||||
var selection = document.getElementById('dirPath');
|
||||
var dir = selection.options[selection.selectedIndex].value;
|
||||
|
||||
if(folder == thumbdir)
|
||||
{
|
||||
alert(i18n('Invalid folder name, please choose another folder name.'));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (folder && folder != '' && typeof imgManager != 'undefined')
|
||||
{
|
||||
imgManager.newFolder(dir, encodeURI(folder));
|
||||
}
|
||||
}
|
||||
// IE7 has crippled the prompt()
|
||||
if ( Xinha.ie_version > 6 )
|
||||
{
|
||||
popupPrompt(i18n('Please enter name for new folder...'), i18n('Untitled'), createFolder, i18n("New Folder"));
|
||||
}
|
||||
else
|
||||
{
|
||||
var folder = prompt(i18n('Please enter name for new folder...'), i18n('Untitled'));
|
||||
createFolder(folder);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function resize()
|
||||
{
|
||||
var win = Xinha.viewportSize(window);
|
||||
var m = document.getElementById('messages');
|
||||
var messagesHeight = (m && m.style.display != 'none' ) ? parseInt( document.getElementById('messages').offsetHeight, 10 ) : 0;
|
||||
document.getElementById('imgManager').style.height = parseInt( win.y - 130 - document.getElementById('controls').offsetHeight, 10 ) - messagesHeight + 'px';
|
||||
return true;
|
||||
}
|
||||
|
||||
Xinha.addOnloadHandler( init, window );
|
||||
|
|
@ -0,0 +1,87 @@
|
|||
// htmlArea v3.0 - Copyright (c) 2002, 2003 interactivetools.com, inc.
|
||||
// This copyright notice MUST stay intact for use (see license.txt).
|
||||
//
|
||||
// Portions (c) dynarch.com, 2003
|
||||
//
|
||||
// A free WYSIWYG editor replacement for <textarea> fields.
|
||||
// For full source code and docs, visit http://www.interactivetools.com/
|
||||
//
|
||||
// Version 3.0 developed by Mihai Bazon.
|
||||
// http://dynarch.com/mishoo
|
||||
//
|
||||
// $Id: popup.js 1084 2008-10-12 17:42:42Z ray $
|
||||
|
||||
function __dlg_onclose() {
|
||||
if(opener.Dialog._return)
|
||||
opener.Dialog._return(null);
|
||||
}
|
||||
function __dlg_init( bottom, win_dim ) {
|
||||
__xinha_dlg_init(win_dim);
|
||||
}
|
||||
|
||||
function __xinha_dlg_init( win_dim ) {
|
||||
if(window.__dlg_init_done) return true;
|
||||
|
||||
if(window.opener._editor_skin) {
|
||||
var head = document.getElementsByTagName("head")[0];
|
||||
var link = document.createElement("link");
|
||||
link.type = "text/css";
|
||||
link.href = window.opener._editor_url + 'skins/' + window.opener._editor_skin + '/skin.css';
|
||||
link.rel = "stylesheet";
|
||||
head.appendChild(link);
|
||||
}
|
||||
if (!window.dialogArguments && opener.Dialog._arguments)
|
||||
{
|
||||
window.dialogArguments = opener.Dialog._arguments;
|
||||
}
|
||||
|
||||
Xinha.addDom0Event(document.body, 'keypress', __dlg_close_on_esc);
|
||||
window.__dlg_init_done = true;
|
||||
}
|
||||
function __dlg_translate(context) {
|
||||
var types = ["span", "option", "td", "th", "button", "div", "label", "a","img", "legend"];
|
||||
for (var type = 0; type < types.length; type++) {
|
||||
var spans = document.getElementsByTagName(types[type]);
|
||||
for (var i = spans.length; --i >= 0;) {
|
||||
var span = spans[i];
|
||||
if (span.firstChild && span.firstChild.data) {
|
||||
var txt = Xinha._lc(span.firstChild.data, context);
|
||||
if (txt)
|
||||
span.firstChild.data = txt;
|
||||
}
|
||||
if (span.title) {
|
||||
var txt = Xinha._lc(span.title, context);
|
||||
if (txt)
|
||||
span.title = txt;
|
||||
}
|
||||
if (span.alt) {
|
||||
var txt = Xinha._lc(span.alt, context);
|
||||
if (txt)
|
||||
span.alt = txt;
|
||||
}
|
||||
}
|
||||
}
|
||||
document.title = Xinha._lc(document.title, context);
|
||||
}
|
||||
|
||||
// closes the dialog and passes the return info upper.
|
||||
function __dlg_close(val) {
|
||||
opener.Dialog._return(val);
|
||||
window.close();
|
||||
}
|
||||
|
||||
function popupPrompt( prompt, value, handler, title)
|
||||
{
|
||||
|
||||
Dialog("prompt.html", function(param)
|
||||
{
|
||||
if (!param) // user must have pressed Cancel
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
handler (param.value);
|
||||
}
|
||||
}, {prompt:prompt,value:value,title:title});
|
||||
}
|
||||
|
|
@ -0,0 +1,105 @@
|
|||
/**
|
||||
* ImageEditor slider file.
|
||||
* Authors: Wei Zhuo, Afru, Krzysztof Kotowicz
|
||||
* Version: Updated on 08-01-2005 by Afru
|
||||
* Version: Updated on 20-06-2006 by Krzysztof Kotowicz
|
||||
* Package: ExtendedFileManager (EFM 1.1.1)
|
||||
* http://www.afrusoft.com/htmlarea
|
||||
*/
|
||||
|
||||
var ie=document.all;
|
||||
var ns6=document.getElementById&&!document.all;
|
||||
|
||||
document.onmouseup = captureStop;
|
||||
|
||||
var currentSlider = null,sliderField = null;
|
||||
var rangeMin = null, rangeMax= null, sx = -1, sy = -1, initX=0;
|
||||
|
||||
function getMouseXY(e) {
|
||||
|
||||
//alert('hello');
|
||||
x = ns6? e.clientX: event.clientX
|
||||
y = ns6? e.clientY: event.clientY
|
||||
|
||||
if (sx < 0) sx = x; if (sy < 0) sy = y;
|
||||
|
||||
var dx = initX +(x-sx);
|
||||
|
||||
if (dx <= rangeMin)
|
||||
dx = rangeMin;
|
||||
else if (dx >= rangeMax)
|
||||
dx = rangeMax;
|
||||
|
||||
var range = (dx-rangeMin)/(rangeMax - rangeMin)*100;
|
||||
|
||||
if (currentSlider != null)
|
||||
currentSlider.style.left = dx+"px";
|
||||
|
||||
if (sliderField != null)
|
||||
{
|
||||
sliderField.value = parseInt(range);
|
||||
}
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
function initSlider()
|
||||
{
|
||||
if (currentSlider == null)
|
||||
currentSlider = document.getElementById('sliderbar');
|
||||
|
||||
if (sliderField == null)
|
||||
sliderField = document.getElementById('quality');
|
||||
|
||||
if (rangeMin == null)
|
||||
rangeMin = 3
|
||||
if (rangeMax == null)
|
||||
{
|
||||
var track = document.getElementById('slidertrack');
|
||||
rangeMax = parseInt(track.style.width);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function updateSlider(value)
|
||||
{
|
||||
initSlider();
|
||||
|
||||
var newValue = parseInt(value)/100*(rangeMax-rangeMin);
|
||||
|
||||
if (newValue <= rangeMin)
|
||||
newValue = rangeMin;
|
||||
else if (newValue >= rangeMax)
|
||||
newValue = rangeMax;
|
||||
|
||||
if (currentSlider != null)
|
||||
currentSlider.style.left = newValue+"px";
|
||||
|
||||
var range = newValue/(rangeMax - rangeMin)*100;
|
||||
|
||||
if (sliderField != null)
|
||||
sliderField.value = parseInt(range);
|
||||
}
|
||||
|
||||
function captureStart()
|
||||
{
|
||||
|
||||
initSlider();
|
||||
|
||||
initX = parseInt(currentSlider.style.left);
|
||||
if (initX > rangeMax)
|
||||
initX = rangeMax;
|
||||
else if (initX < rangeMin)
|
||||
initX = rangeMin;
|
||||
|
||||
document.onmousemove = getMouseXY;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function captureStop()
|
||||
{
|
||||
sx = -1; sy = -1;
|
||||
document.onmousemove = null;
|
||||
return false;
|
||||
}
|
||||
|
|
@ -0,0 +1,110 @@
|
|||
<?php
|
||||
/**
|
||||
* Unified backend for ExtendedFileManager - copied from ImageManager
|
||||
*
|
||||
* Image Manager was originally developed by:
|
||||
* Xiang Wei Zhuo, email: xiangweizhuo(at)hotmail.com Wei Shou.
|
||||
*
|
||||
* Unified backend sponsored by DTLink Software, http://www.dtlink.com
|
||||
* Implementation by Yermo Lamers, http://www.formvista.com
|
||||
*
|
||||
* (c) DTLink, LLC 2005.
|
||||
* Distributed under the same terms as Xinha itself.
|
||||
* This notice MUST stay intact for use (see license.txt).
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* Instead of using separate URL's for each function, ImageManager now
|
||||
* routes all requests to the server through this single, replaceable,
|
||||
* entry point. backend.php expects at least two URL variable parameters:
|
||||
*
|
||||
* __plugin=ImageManager for future expansion; identify the plugin being requested.
|
||||
* __function=thumbs|images|editorFrame|editor|manager function being called.
|
||||
*
|
||||
* Having a single entry point that strictly adheres to a defined interface will
|
||||
* make the backend code much easier to maintain and expand. It will make it easier
|
||||
* on integrators, not to mention it'll make it easier to have separate
|
||||
* implementations of the backend in different languages (Perl, Python, ASP, etc.)
|
||||
*
|
||||
* @see config.inc.php
|
||||
*/
|
||||
|
||||
/**
|
||||
* ImageManager configuration
|
||||
*/
|
||||
|
||||
require_once('config.inc.php');
|
||||
|
||||
|
||||
// Strip slashes if MQGPC is on
|
||||
set_magic_quotes_runtime(0);
|
||||
if(get_magic_quotes_gpc())
|
||||
{
|
||||
$to_clean = array(&$_GET, &$_POST, &$_REQUEST, &$_COOKIE);
|
||||
while(count($to_clean))
|
||||
{
|
||||
$cleaning =& $to_clean[array_pop($junk = array_keys($to_clean))];
|
||||
unset($to_clean[array_pop($junk = array_keys($to_clean))]);
|
||||
foreach(array_keys($cleaning) as $k)
|
||||
{
|
||||
if(is_array($cleaning[$k]))
|
||||
{
|
||||
$to_clean[] =& $cleaning[$k];
|
||||
}
|
||||
else
|
||||
{
|
||||
$cleaning[$k] = stripslashes($cleaning[$k]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* ImageManager configuration
|
||||
*/
|
||||
|
||||
$formVars = empty($_POST) ? $_GET : $_POST;
|
||||
|
||||
// make sure the request is for us (this gives us the ability to eventually organize
|
||||
// a backend event handler system) For an include file the return doesn't make alot of
|
||||
// sense but eventually we'll want to turn all of this into at least functions
|
||||
// separating out all the presentation HTML from the logic. (Right now all the HTML
|
||||
// used by ImageManager is in the same files as the PHP code ...)
|
||||
|
||||
if ( @$formVars[ "__plugin" ] != "ExtendedFileManager" )
|
||||
{
|
||||
// not for us.
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// so we don't have to re-engineer the entire thing right now, since it's probably
|
||||
// going to get rewritten anyway, we just include the correct file based on the
|
||||
// function request.
|
||||
|
||||
switch ( @$formVars[ "__function" ] )
|
||||
{
|
||||
|
||||
case "editor":
|
||||
case "editorFrame":
|
||||
case "manager":
|
||||
case "images":
|
||||
case "thumbs":
|
||||
case "resizer":
|
||||
|
||||
include_once $IMConfig['base_dir'] . '/' . $formVars['__function'] . '.php' ;
|
||||
exit();
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
break;
|
||||
|
||||
} // end of switch.
|
||||
|
||||
return false ;
|
||||
|
||||
// END
|
||||
|
||||
?>
|
||||
|
|
@ -0,0 +1,412 @@
|
|||
<?php
|
||||
/**
|
||||
* ExtendedFileManager configuration file.
|
||||
* Authors: Wei Zhuo, Afru
|
||||
* Version: Updated on 08-01-2005 by Afru
|
||||
* Version 1.1.2: Updated on 04-07-2006 by Krzysztof Kotowicz <koto@webworkers.pl>
|
||||
* Package: ExtendedFileManager
|
||||
* http://www.afrusoft.com/htmlarea
|
||||
*/
|
||||
|
||||
/* Configuration file usage:
|
||||
* There are two insertModes for this filemanager.
|
||||
* One is "image" and another is "link".
|
||||
* So you can assign config values as below
|
||||
*
|
||||
* if($insertMode=="image") $IMConfig['property']=somevalueforimagemode;
|
||||
* else if($insertMode=="link") $IMConfig['property']=somevalueforlinkmode;
|
||||
*
|
||||
* (or) you can directly as $IMConfig['property']=somevalueforbothmodes;
|
||||
*
|
||||
* Best of Luck :) Afru.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Getting the mode for further differentiation
|
||||
*/
|
||||
|
||||
if(isset($_REQUEST['mode'])) $insertMode=$_REQUEST['mode'];
|
||||
if(!isset($insertMode)) $insertMode="image";
|
||||
|
||||
/**
|
||||
* Default backend URL
|
||||
*
|
||||
* URL to use for unified backend.
|
||||
*
|
||||
* The ?__plugin=ExtendedFileManager& is required.
|
||||
*/
|
||||
|
||||
$IMConfig['backend_url'] = "backend.php?__plugin=ExtendedFileManager&";
|
||||
|
||||
/**
|
||||
* Backend Installation Directory
|
||||
*
|
||||
* location of backend install; these are used to link to css and js
|
||||
* assets because we may have the front end installed in a different
|
||||
* directory than the backend. (i.e. nothing assumes that the frontend
|
||||
* and the backend are in the same directory)
|
||||
*/
|
||||
$IMConfig['base_dir'] = getcwd();
|
||||
$IMConfig['base_url'] = '';
|
||||
|
||||
|
||||
/*
|
||||
File system path to the directory you want to manage the images
|
||||
for multiple user systems, set it dynamically.
|
||||
|
||||
NOTE: This directory requires write access by PHP. That is,
|
||||
PHP must be able to create files in this directory.
|
||||
Able to create directories is nice, but not necessary.
|
||||
*/
|
||||
$IMConfig['images_dir'] = 'demo_images';
|
||||
//You may set a different directory for the link mode; if you don't, the above setting will be used for both modes
|
||||
//$IMConfig['files_dir'] = 'demo_files';
|
||||
|
||||
/*
|
||||
The URL to the above path, the web browser needs to be able to see it.
|
||||
Please remove scripting capabilities in this directory
|
||||
for this directory (i.e. disable PHP, Perl, CGI; see .htaccess file in demo_images folder).
|
||||
*/
|
||||
$IMConfig['images_url'] = str_replace( array("backend.php","manager.php"), "", $_SERVER["PHP_SELF"] ) . $IMConfig['images_dir'];
|
||||
//$IMConfig['files_url'] = 'url/to/files_dir';
|
||||
|
||||
/*
|
||||
Format of the Date Modified in list view.
|
||||
It has to be a string understood by the PHP date() function (for possible values see http://http://php.net/manual/en/function.date.php)
|
||||
*/
|
||||
$IMConfig['date_format'] = "d.m.y H:i";
|
||||
/*
|
||||
Possible values: true, false
|
||||
|
||||
TRUE - If PHP on the web server is in safe mode, set this to true.
|
||||
SAFE MODE restrictions: directory creation will not be possible,
|
||||
only the GD library can be used, other libraries require
|
||||
Safe Mode to be off.
|
||||
|
||||
FALSE - Set to false if PHP on the web server is not in safe mode.
|
||||
*/
|
||||
$IMConfig['safe_mode'] = false;
|
||||
|
||||
/*
|
||||
This specifies whether any image library is available to resize and edit images.TRUE - Thumbnails will be resized by image libraries and if there is no library, default thumbnail will be shown.
|
||||
FALSE - Thumbnails will be resized by browser ignoring image libraries.
|
||||
*/
|
||||
$IMConfig['img_library'] = true;
|
||||
|
||||
|
||||
/*
|
||||
View type when the File manager is in insert image mode.
|
||||
Valid values are "thumbview" and "listview".
|
||||
*/
|
||||
|
||||
|
||||
if ($insertMode == 'image')
|
||||
$IMConfig['view_type'] = "thumbview";
|
||||
|
||||
else if($insertMode == "link")
|
||||
$IMConfig['view_type'] = "listview";
|
||||
|
||||
$IMConfig['insert_mode'] = $insertMode;
|
||||
|
||||
/*
|
||||
Possible values: 'GD', 'IM', or 'NetPBM'
|
||||
|
||||
The image manipulation library to use, either GD or ImageMagick or NetPBM.
|
||||
If you have safe mode ON, or don't have the binaries to other packages,
|
||||
your choice is 'GD' only. Other packages require Safe Mode to be off.
|
||||
*/
|
||||
define('IMAGE_CLASS', 'GD');
|
||||
|
||||
|
||||
/*
|
||||
After defining which library to use, if it is NetPBM or IM, you need to
|
||||
specify where the binary for the selected library are. And of course
|
||||
your server and PHP must be able to execute them (i.e. safe mode is OFF).
|
||||
GD does not require the following definition.
|
||||
*/
|
||||
define('IMAGE_TRANSFORM_LIB_PATH', '/usr/bin/');
|
||||
//define('IMAGE_TRANSFORM_LIB_PATH', 'C:/"Program Files"/ImageMagick-5.5.7-Q16/');
|
||||
|
||||
|
||||
/*
|
||||
The prefix for thumbnail files, something like .thumb will do. The
|
||||
thumbnails files will be named as "prefix_imagefile.ext", that is,
|
||||
prefix + orginal filename.
|
||||
*/
|
||||
$IMConfig['thumbnail_prefix'] = 't_';
|
||||
|
||||
|
||||
/*
|
||||
Thumbnail can also be stored in a directory, this directory
|
||||
will be created by PHP. If PHP is in safe mode, this parameter
|
||||
is ignored, you can not create directories.
|
||||
|
||||
If you do not want to store thumbnails in a directory, set this
|
||||
to false or empty string '';
|
||||
*/
|
||||
$IMConfig['thumbnail_dir'] = 't';
|
||||
|
||||
/**
|
||||
* Resize files, or not. If the dimensions for an image are changed
|
||||
* this will control if the image is actually resized.
|
||||
*
|
||||
* Usually you want this true, unless you are very disk space concious.
|
||||
*/
|
||||
|
||||
$IMConfig['resize_files'] = true;
|
||||
|
||||
/**
|
||||
* Resized prefix
|
||||
*
|
||||
* The prefix for resized files, something like .resized will do. The
|
||||
* resized files will be named <prefix>_<width>x<height>_<original>
|
||||
* resized files are created when one changes the dimensions of an image
|
||||
* in the image manager selection dialog - the image is scaled when the
|
||||
* user clicks the ok button.
|
||||
*/
|
||||
|
||||
$IMConfig['resized_prefix'] = '.resized';
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Resized Directory
|
||||
*
|
||||
* Resized images may also be stored in a directory, except in safe mode.
|
||||
*/
|
||||
|
||||
$IMConfig['resized_dir'] = '';
|
||||
|
||||
/*
|
||||
Possible values: true, false
|
||||
|
||||
TRUE - Allow the user to create new sub-directories in the
|
||||
$IMConfig['images_dir']/$IMConfig['files_dir'].
|
||||
|
||||
FALSE - No directory creation.
|
||||
|
||||
NOTE: If $IMConfig['safe_mode'] = true, this parameter
|
||||
is ignored, you can not create directories
|
||||
*/
|
||||
$IMConfig['allow_new_dir'] = true;
|
||||
|
||||
/*
|
||||
Possible values: true, false
|
||||
|
||||
TRUE - Allow the user to edit image by image editor.
|
||||
|
||||
FALSE - No edit icon will be displayed.
|
||||
|
||||
NOTE: If $IMConfig['img_library'] = false, this parameter
|
||||
is ignored, you can not edit images.
|
||||
*/
|
||||
$IMConfig['allow_edit_image'] = true;
|
||||
|
||||
/*
|
||||
Possible values: true, false
|
||||
|
||||
TRUE - Allow the user to rename files and folders.
|
||||
|
||||
FALSE - No rename icon will be displayed.
|
||||
|
||||
*/
|
||||
$IMConfig['allow_rename'] = true;
|
||||
|
||||
/*
|
||||
Possible values: true, false
|
||||
|
||||
TRUE - Allow the user to perform cut/copy/paste actions.
|
||||
|
||||
FALSE - No cut/copy/paste icons will be displayed.
|
||||
|
||||
*/
|
||||
$IMConfig['allow_cut_copy_paste'] = true;
|
||||
|
||||
/*
|
||||
Possible values: true, false
|
||||
|
||||
TRUE - Allow the user to delete files and folders.
|
||||
|
||||
FALSE - No delete icon will be displayed.
|
||||
|
||||
*/
|
||||
$IMConfig['allow_delete'] = true;
|
||||
|
||||
/*
|
||||
Possible values: true, false
|
||||
|
||||
TRUE - Display color pickers for image background / border colors
|
||||
|
||||
FALSE - Don't display color pickers
|
||||
*/
|
||||
$IMConfig['use_color_pickers'] = true;
|
||||
|
||||
/*
|
||||
Possible values: true, false
|
||||
|
||||
TRUE - Allow the user to set alt (alternative text) attribute.
|
||||
|
||||
FALSE - No input field for alt attribute will be displayed.
|
||||
|
||||
NOTE: The alt attribute is _obligatory_ for images, so <img alt="" /> will be inserted
|
||||
if 'images_enable_alt' is set to false
|
||||
*/
|
||||
$IMConfig['images_enable_alt'] = true;
|
||||
|
||||
/*
|
||||
Possible values: true, false
|
||||
|
||||
TRUE - Allow the user to set title attribute (usually displayed when mouse is over element).
|
||||
|
||||
FALSE - No input field for title attribute will be displayed.
|
||||
|
||||
*/
|
||||
$IMConfig['images_enable_title'] = false;
|
||||
|
||||
/*
|
||||
Possible values: true, false
|
||||
|
||||
TRUE - Allow the user to set align attribute.
|
||||
|
||||
FALSE - No selection box for align attribute will be displayed.
|
||||
|
||||
*/
|
||||
$IMConfig['images_enable_align'] = true;
|
||||
|
||||
/*
|
||||
Possible values: true, false
|
||||
|
||||
TRUE - Allow the user to set margin, padding, and border styles for the image
|
||||
|
||||
FALSE - No styling input fields will be displayed.
|
||||
|
||||
*/
|
||||
$IMConfig['images_enable_styling'] = true;
|
||||
|
||||
/*
|
||||
Possible values: true, false
|
||||
|
||||
TRUE - Allow the user to set target attribute for link (the window in which the link will be opened).
|
||||
|
||||
FALSE - No selection box for target attribute will be displayed.
|
||||
|
||||
*/
|
||||
$IMConfig['link_enable_target'] = true;
|
||||
/*
|
||||
Possible values: true, false
|
||||
|
||||
TRUE - Allow the user to upload files.
|
||||
|
||||
FALSE - No uploading allowed.
|
||||
*/
|
||||
$IMConfig['allow_upload'] = false;
|
||||
|
||||
/* Maximum upload file size
|
||||
|
||||
Possible values: number, "max"
|
||||
|
||||
number - maximum size in Kilobytes.
|
||||
|
||||
"max" - the maximum allowed by the server (the value is retrieved from the server configuration).
|
||||
*/
|
||||
$IMConfig['max_filesize_kb_image'] = 200;
|
||||
|
||||
$IMConfig['max_filesize_kb_link'] = 5000;
|
||||
|
||||
/* Maximum upload folder size in Megabytes. Use 0 to disable limit */
|
||||
$IMConfig['max_foldersize_mb'] = 0;
|
||||
|
||||
/*
|
||||
Allowed extensions that can be shown and allowed to upload.
|
||||
Available icons are for "doc,fla,gif,gz,html,jpg,js,mov,pdf,php,png,ppt,rar,txt,xls,zip"
|
||||
-Changed by AFRU.
|
||||
*/
|
||||
|
||||
$IMConfig['allowed_image_extensions'] = array("jpg","gif","png","bmp");
|
||||
$IMConfig['allowed_link_extensions'] = array("jpg","gif","js","php","pdf","zip","txt","psd","png","html","swf","xml","xls","doc");
|
||||
|
||||
|
||||
/*
|
||||
The default thumbnail and list view icon in case thumbnails are not created and the files are of unknown.
|
||||
*/
|
||||
$IMConfig['default_thumbnail'] = 'icons/def.gif';
|
||||
$IMConfig['default_listicon'] = 'icons/def_small.gif';
|
||||
|
||||
|
||||
/*
|
||||
Only files with these extensions will be shown as thumbnails. All other files will be shown as icons.
|
||||
*/
|
||||
$IMConfig['thumbnail_extensions'] = array("jpg", "gif", "png", "bmp");
|
||||
|
||||
/*
|
||||
Thumbnail dimensions.
|
||||
*/
|
||||
$IMConfig['thumbnail_width'] = 84;
|
||||
$IMConfig['thumbnail_height'] = 84;
|
||||
|
||||
/*
|
||||
Image Editor temporary filename prefix.
|
||||
*/
|
||||
$IMConfig['tmp_prefix'] = '.editor_';
|
||||
|
||||
|
||||
// Standard PHP Backend Data Passing
|
||||
// if data was passed using xinha_pass_to_php_backend() we merge the items
|
||||
// provided into the Config
|
||||
require_once(realpath(dirname(__FILE__) . '/../../contrib/php-xinha.php'));
|
||||
if($passed_data = xinha_read_passed_data())
|
||||
{
|
||||
$IMConfig = array_merge($IMConfig, $passed_data);
|
||||
$IMConfig['backend_url'] .= xinha_passed_data_querystring() . '&';
|
||||
}
|
||||
// Deprecated config passing, don't use this way any more!
|
||||
elseif(isset($_REQUEST['backend_config']))
|
||||
{
|
||||
if(get_magic_quotes_gpc()) {
|
||||
$_REQUEST['backend_config'] = stripslashes($_REQUEST['backend_config']);
|
||||
}
|
||||
|
||||
if($_REQUEST['backend_config_secret_key_location'] !== 'Xinha:ExtendedFileManager')
|
||||
{
|
||||
trigger_error('Programming Error - please contact the website administrator/programmer to alert them to this problem. A non-default backend key location is being used to pass backend data to Xinha, but the same key location is not being used to receive data. The special backend configuration has been ignored. To resolve this, you should edit plugins/ExtendedFileManager/config.php and change the default key location from "Xinha:ExtendedFileManager" to your desired non default. See: http://trac.xinha.org/ticket/1518', E_USER_ERROR);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Config specified from front end, check that it's valid
|
||||
session_start();
|
||||
if (!array_key_exists($_REQUEST['backend_config_secret_key_location'], $_SESSION))
|
||||
die("Backend security error.");
|
||||
|
||||
$secret = $_SESSION[$_REQUEST['backend_config_secret_key_location']];
|
||||
|
||||
if($_REQUEST['backend_config_hash'] !== sha1($_REQUEST['backend_config'] . $secret))
|
||||
{
|
||||
die("Backend security error.");
|
||||
}
|
||||
|
||||
$to_merge = unserialize($_REQUEST['backend_config']);
|
||||
if(!is_array($to_merge))
|
||||
{
|
||||
die("Backend config syntax error.");
|
||||
}
|
||||
|
||||
$IMConfig = array_merge($IMConfig, $to_merge);
|
||||
|
||||
// changed config settings keys in relation to ImageManager
|
||||
$IMConfig['backend_url'] .= "backend_config=" . rawurlencode($_REQUEST['backend_config']) . '&';
|
||||
$IMConfig['backend_url'] .= "backend_config_hash=" . rawurlencode($_REQUEST['backend_config_hash']) . '&';
|
||||
$IMConfig['backend_url'] .= "backend_config_secret_key_location=" . rawurlencode($_REQUEST['backend_config_secret_key_location']) . '&';
|
||||
}
|
||||
}
|
||||
if ($IMConfig['max_filesize_kb_link'] == "max")
|
||||
{
|
||||
$IMConfig['max_filesize_kb_link'] = upload_max_filesize_kb();
|
||||
}
|
||||
|
||||
if ($IMConfig['max_filesize_kb_image'] == "max")
|
||||
{
|
||||
$IMConfig['max_filesize_kb_image'] = upload_max_filesize_kb();
|
||||
}
|
||||
// END
|
||||
|
||||
?>
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
<IfModule mod_php.c>
|
||||
php_flag engine off
|
||||
</IfModule>
|
||||
AddType text/html .html .htm .shtml .php .php3 .php4 .php5 .php6 .php7 .php8 .phtml .phtm .pl .py .cgi
|
||||
RemoveHandler .php
|
||||
RemoveHandler .php8
|
||||
RemoveHandler .php7
|
||||
RemoveHandler .php6
|
||||
RemoveHandler .php5
|
||||
RemoveHandler .php4
|
||||
RemoveHandler .php3
|
||||
|
After Width: | Height: | Size: 27 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 8.3 KiB |
|
|
@ -0,0 +1,172 @@
|
|||
<?php
|
||||
/**
|
||||
* ExtendedFileManager editor.php file.
|
||||
* Authors: Wei Zhuo, Afru, Krzysztof Kotowicz
|
||||
* Version: Updated on 08-01-2005 by Afru
|
||||
* Version: Updated on 21-06-2006 by Krzysztof Kotowicz
|
||||
* Version: Updated on 20-01-2008 by Raimund Meyer
|
||||
* Package: ExtendedFileManager (EFM 1.4)
|
||||
* http://www.afrusoft.com/htmlarea
|
||||
*/
|
||||
if(isset($_REQUEST['mode'])) $insertMode=$_REQUEST['mode'];
|
||||
if(!isset($insertMode)) $insertMode="image";
|
||||
|
||||
require_once('config.inc.php');
|
||||
require_once('Classes/ExtendedFileManager.php');
|
||||
require_once('../ImageManager/Classes/ImageEditor.php');
|
||||
|
||||
$manager = new ExtendedFileManager($IMConfig,$insertMode);
|
||||
$editor = new ImageEditor($manager);
|
||||
|
||||
?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Xinha Image Editor</title>
|
||||
<link href="<?php print $IMConfig['base_url'];?>assets/editor.css" rel="stylesheet" type="text/css" />
|
||||
<script type="text/javascript" src="<?php print $IMConfig['base_url'];?>assets/slider.js"></script>
|
||||
<script type="text/javascript" src="../../popups/popup.js"></script>
|
||||
<script type="text/javascript" src="<?php print $IMConfig['base_url'];?>assets/popup.js"></script>
|
||||
<script type="text/javascript">
|
||||
/*<![CDATA[*/
|
||||
|
||||
var _backend_url = "<?php print $IMConfig['backend_url']."&mode=$insertMode"; ?>&";
|
||||
|
||||
if(window.opener)
|
||||
Xinha = window.opener.Xinha;
|
||||
/*]]>*/
|
||||
</script>
|
||||
<script type="text/javascript" src="<?php print $IMConfig['base_url'];?>assets/editor.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<table style="width:100%">
|
||||
<tr>
|
||||
<td id="indicator">
|
||||
<img src="<?php print $IMConfig['base_url'];?>img/spacer.gif" id="indicator_image" height="20" width="20" alt=""/>
|
||||
</td>
|
||||
<td id="tools">
|
||||
<div id="tools_crop" style="display:none;">
|
||||
<div class="tool_inputs">
|
||||
<label for="cx">Start X:</label><input type="text" id="cx" class="textInput" onchange="updateMarker('crop')"/>
|
||||
<label for="cy">Start Y:</label><input type="text" id="cy" class="textInput" onchange="updateMarker('crop')"/>
|
||||
<label for="cw">Width:</label><input type="text" id="cw" class="textInput" onchange="updateMarker('crop')"/>
|
||||
<label for="ch">Height:</label><input type="text" id="ch" class="textInput" onchange="updateMarker('crop')"/> <img src="<?php print $IMConfig['base_url'];?>img/div.gif" height="30" width="2" class="div" alt="|" />
|
||||
</div>
|
||||
<a href="javascript:void(0);" onclick="editor.doSubmit('crop');" class="buttons" title="OK"><img src="<?php print $IMConfig['base_url'];?>img/btn_ok.gif" height="30" width="30" alt="OK" /></a>
|
||||
<a href="javascript:void(0);" onclick="editor.reset();" class="buttons" title="Cancel"><img src="<?php print $IMConfig['base_url'];?>img/btn_cancel.gif" height="30" width="30" alt="Cancel" /></a>
|
||||
</div>
|
||||
<div id="tools_scale" style="display:none;">
|
||||
<div class="tool_inputs">
|
||||
<label for="sw">Width:</label><input type="text" id="sw" class="textInput" onchange="checkConstrains('width')"/>
|
||||
<a href="javascript:void(0);" onclick="toggleConstraints();" title="Lock"><img src="<?php print $IMConfig['base_url'];?>img/islocked2.gif" id="scaleConstImg" height="14" width="8" alt="Lock" class="div" /></a><label for="sh">Height:</label>
|
||||
<input type="text" id="sh" class="textInput" onchange="checkConstrains('height')"/>
|
||||
<input type="checkbox" id="constProp" value="1" checked="checked" onclick="toggleConstraints()"/>
|
||||
<label for="constProp">Constrain Proportions</label>
|
||||
<img src="<?php print $IMConfig['base_url'];?>img/div.gif" height="30" width="2" class="div" alt="|" />
|
||||
</div>
|
||||
<a href="javascript:void(0);" onclick="editor.doSubmit('scale');" class="buttons" title="OK"><img src="<?php print $IMConfig['base_url'];?>img/btn_ok.gif" height="30" width="30" alt="OK" /></a>
|
||||
<a href="javascript:void(0);" onclick="zoom();" class="buttons" title="Cancel"><img src="<?php print $IMConfig['base_url'];?>img/btn_cancel.gif" height="30" width="30" alt="Cancel" /></a>
|
||||
</div>
|
||||
<div id="tools_rotate" style="display:none;">
|
||||
<div class="tool_inputs">
|
||||
<select id="rotate_sub_action" name="rotate_sub_action" onchange="rotateSubActionSelect(this)" style="margin-left: 10px; vertical-align: middle;">
|
||||
<option selected="selected" value="rotate">Rotate Image</option>
|
||||
<option value="flip">Flip Image</option>
|
||||
</select>
|
||||
<select id="rotate_preset_select" name="rotate_preset_select" onchange="rotatePreset(this)" style="margin-left: 20px; vertical-align: middle;">
|
||||
<option>Preset</option>
|
||||
<option value="180">Rotate 180 °</option>
|
||||
<option value="90">Rotate 90 ° CW</option>
|
||||
<option value="-90">Rotate 90 ° CCW</option>
|
||||
</select>
|
||||
<select id="flip" name="flip" style="margin-left: 20px; vertical-align: middle;display:none">
|
||||
<option value="hoz">Flip Horizontal</option>
|
||||
<option value="ver">Flip Vertical</option>
|
||||
</select>
|
||||
<label for="ra">Angle:<input type="text" id="ra" class="textInput" /></label>
|
||||
<img src="<?php print $IMConfig['base_url'];?>img/div.gif" height="30" width="2" class="div" alt="|" />
|
||||
</div>
|
||||
<a href="javascript:void(0);" onclick="editor.doSubmit('rotate');" class="buttons" title="OK"><img src="<?php print $IMConfig['base_url'];?>img/btn_ok.gif" height="30" width="30" alt="OK" /></a>
|
||||
<a href="javascript:void(0);" onclick="editor.reset();" class="buttons" title="Cancel"><img src="<?php print $IMConfig['base_url'];?>img/btn_cancel.gif" height="30" width="30" alt="Cancel" /></a>
|
||||
</div>
|
||||
<div id="tools_measure" style="display:none;">
|
||||
<div class="tool_inputs">
|
||||
<label>X:</label><input type="text" class="measureStats" id="sx" />
|
||||
<label>Y:</label><input type="text" class="measureStats" id="sy" />
|
||||
<img src="<?php print $IMConfig['base_url'];?>img/div.gif" height="30" width="2" class="div" alt="|" />
|
||||
<label>W:</label><input type="text" class="measureStats" id="mw" />
|
||||
<label>H:</label><input type="text" class="measureStats" id="mh" />
|
||||
<img src="<?php print $IMConfig['base_url'];?>img/div.gif" height="30" width="2" class="div" alt="|" />
|
||||
<label>A:</label><input type="text" class="measureStats" id="ma" />
|
||||
<label>D:</label><input type="text" class="measureStats" id="md" />
|
||||
<img src="<?php print $IMConfig['base_url'];?>img/div.gif" height="30" width="2" class="div" alt="|" />
|
||||
<button type="button" onclick="editor.reset();" >Clear</button>
|
||||
</div>
|
||||
</div>
|
||||
<div id="tools_save" style="display:none;">
|
||||
<div class="tool_inputs">
|
||||
<label for="save_filename">Filename:</label><input type="text" id="save_filename" value="<?php echo $editor->getDefaultSaveFile();?>"/>
|
||||
<select name="format" id="save_format" style="margin-left: 10px; vertical-align: middle;" onchange="updateFormat(this)">
|
||||
<option value="jpeg,85">JPEG High</option>
|
||||
<option value="jpeg,60">JPEG Medium</option>
|
||||
<option value="jpeg,35">JPEG Low</option>
|
||||
<option value="png">PNG</option>
|
||||
<?php if($editor->isGDGIFAble() != -1) { ?>
|
||||
<option value="gif">GIF</option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
<div id="slider" style="display:inline">
|
||||
<label>Quality:</label>
|
||||
<table style="display: inline; vertical-align: middle;" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td>
|
||||
<div id="slidercasing">
|
||||
<div id="slidertrack" style="width:100px"><img src="<?php print $IMConfig['base_url'];?>img/spacer.gif" width="1" height="1" border="0" alt="track" /></div>
|
||||
<div id="sliderbar" style="left:85px" onmousedown="captureStart();"><img src="<?php print $IMConfig['base_url'];?>img/spacer.gif" width="1" height="1" border="0" alt="track" /></div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<input type="text" id="quality" onchange="updateSlider(this.value)" style="width: 2em;" value="85"/>
|
||||
</div>
|
||||
<img src="<?php print $IMConfig['base_url'];?>img/div.gif" height="30" width="2" class="div" alt="|" />
|
||||
<div style="display:inline;font-size:10px">
|
||||
<span>Filesize:</span> <span id="filesize"></span>
|
||||
</div>
|
||||
<img src="<?php print $IMConfig['base_url'];?>img/div.gif" height="30" width="2" class="div" alt="|" />
|
||||
</div>
|
||||
<button type="button" style="float:left;margin:17px 5px 0 ;" onclick="editor.doSubmit('preview')">Preview</button>
|
||||
<button type="button" style="float:left;margin-top:17px;" onclick="editor.doSubmit('save');">Save</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td id="toolbar">
|
||||
<a href="javascript:void(0);" onclick="toggle('crop')" id="icon_crop" title="Crop"><img src="<?php print $IMConfig['base_url'];?>img/crop.gif" height="20" width="20" alt="Crop" /><span>Crop</span></a>
|
||||
<a href="javascript:void(0);" onclick="toggle('scale')" id="icon_scale" title="Resize"><img src="<?php print $IMConfig['base_url'];?>img/scale.gif" height="20" width="20" alt="Resize" /><span>Resize</span></a>
|
||||
<a href="javascript:void(0);" onclick="toggle('rotate')" id="icon_rotate" title="Rotate"><img src="<?php print $IMConfig['base_url'];?>img/rotate.gif" height="20" width="20" alt="Rotate" /><span>Rotate</span></a>
|
||||
<a href="javascript:void(0);" onclick="toggle('measure')" id="icon_measure" title="Measure"><img src="<?php print $IMConfig['base_url'];?>img/measure.gif" height="20" width="20" alt="Measure" /><span>Measure</span></a>
|
||||
<a href="javascript:void(0);" onclick="toggleMarker();" title="Toggle marker color"><img id="markerImg" src="<?php print $IMConfig['base_url'];?>img/t_black.gif" height="20" width="20" alt="Marker" /><span>Marker</span></a>
|
||||
<a href="javascript:void(0);" onclick="toggle('save')" id="icon_save" title="Save"><img src="<?php print $IMConfig['base_url'];?>img/save.gif" height="20" width="20" alt="Save" /><span>Save</span></a>
|
||||
<div style="margin-top:10px">Zoom</div>
|
||||
<select id="zoom" onchange="zoom(this.value)">
|
||||
<option value="10">10%</option>
|
||||
<option value="25">25%</option>
|
||||
<option value="50">50%</option>
|
||||
<option value="75">75%</option>
|
||||
<option value="100" selected="selected">100%</option>
|
||||
<option value="200">200%</option>
|
||||
</select>
|
||||
</td>
|
||||
<td id="contents">
|
||||
<?php
|
||||
$iframe_src = $IMConfig['backend_url'].'__function=editorFrame&img='.((isset($_GET['img'])) ? rawurlencode($_GET['img']) : '').'&mode='. $insertMode;
|
||||
?>
|
||||
<iframe src="<?php print htmlspecialchars($iframe_src) ?>" name="editor" id="editor" scrolling="auto" title="Image Editor" frameborder="0"></iframe>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,84 @@
|
|||
<?php
|
||||
/**
|
||||
* ExtendedFileManager editorframe.php file.
|
||||
* Authors: Wei Zhuo, Afru, Krzysztof Kotowicz
|
||||
* Version: Updated on 08-01-2005 by Afru
|
||||
* Version: Updated on 21-06-2006 by Krzysztof Kotowicz
|
||||
* Version: Updated on 20-01-2008 by Raimund Meyer
|
||||
* Package: ExtendedFileManager (EFM 1.4)
|
||||
* http://www.afrusoft.com/htmlarea
|
||||
*/
|
||||
if(isset($_REQUEST['mode'])) $insertMode=$_REQUEST['mode'];
|
||||
if(!isset($insertMode)) $insertMode="image";
|
||||
|
||||
require_once('config.inc.php');
|
||||
require_once('Classes/ExtendedFileManager.php');
|
||||
require_once('../ImageManager/Classes/ImageEditor.php');
|
||||
|
||||
$manager = new ExtendedFileManager($IMConfig,$insertMode);
|
||||
$editor = new ImageEditor($manager);
|
||||
$imageInfo = $editor->processImage();
|
||||
|
||||
?>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title></title>
|
||||
<link href="<?php print $IMConfig['base_url'];?>assets/editorFrame.css" rel="stylesheet" type="text/css" />
|
||||
<script type="text/javascript" src="<?php print $IMConfig['base_url'];?>assets/wz_jsgraphics.js"></script>
|
||||
<script type="text/javascript" src="<?php print $IMConfig['base_url'];?>assets/EditorContent.js"></script>
|
||||
<script type="text/javascript">
|
||||
var _backend_url = "<?php print $IMConfig['backend_url']."&mode=$insertMode"; ?>&";
|
||||
|
||||
if(window.top)
|
||||
Xinha = window.top.Xinha;
|
||||
|
||||
function i18n(str) {
|
||||
return Xinha._lc(str, 'ImageManager');
|
||||
}
|
||||
|
||||
var mode = "<?php echo $editor->getAction(); ?>" //crop, scale, measure
|
||||
var currentImageFile = "<?php if(count($imageInfo)>0) echo rawurlencode($imageInfo['file']); ?>";
|
||||
var fileSize = "<?php echo (round($imageInfo['filesize'] / 1024,1)).' KB' ?>";
|
||||
|
||||
|
||||
<?php if ($editor->isFileSaved() == 1) { ?>
|
||||
alert(i18n('File saved.'));
|
||||
|
||||
window.parent.opener.parent.refresh();
|
||||
window.parent.opener.selectImage
|
||||
(
|
||||
'<?php echo $imageInfo['saveFile'] ?>',
|
||||
'<?php echo $imageInfo['saveFile'] ?>'.replace(/^.*\/?([^\/]*)$/, '$1'),
|
||||
<?php echo $imageInfo['width'] ?>,
|
||||
<?php echo $imageInfo['height'] ?>
|
||||
);
|
||||
window.parent.close();
|
||||
|
||||
<?php } else if ($editor->isFileSaved() == -1) { ?>
|
||||
alert(i18n('File was not saved.'));
|
||||
<?php } ?>
|
||||
|
||||
</script>
|
||||
<script type="text/javascript" src="<?php print $IMConfig['base_url'];?>assets/editorFrame.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="status"></div>
|
||||
<div id="ant" class="selection" style="visibility:hidden"><img src="<?php print $IMConfig['base_url'];?>img/spacer.gif" width="0" height="0" border="0" alt="" id="cropContent"></div>
|
||||
<?php if ($editor->isGDEditable() == -1) { ?>
|
||||
<div style="text-align:center; padding:10px;"><span class="error">GIF format is not supported, image editing not supported.</span></div>
|
||||
<?php } ?>
|
||||
<table height="100%" width="100%">
|
||||
<tr>
|
||||
<td>
|
||||
<?php if(count($imageInfo) > 0 && is_file($imageInfo['fullpath'])) { ?>
|
||||
<span id="imgCanvas" class="crop"><img src="<?php echo $imageInfo['src']; ?>" <?php echo $imageInfo['dimensions']; ?> alt="" id="theImage" name="theImage"></span>
|
||||
<?php } else { ?>
|
||||
<span class="error">No Image Available</span>
|
||||
<?php } ?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,164 @@
|
|||
/**
|
||||
* An input field File Picker utilising the Xinha ExtendedFileManager.
|
||||
*
|
||||
* Hijack the Xinha ExtendedFileManager plugin to provide a file URL picker
|
||||
* for any form input field in the form of a "Browse" button to the
|
||||
* right of the field, in the same manner as a file type input field
|
||||
* except it opens the familiar ExtendedFileManager dialog to upload/select
|
||||
* a file and returns the URL of the file to the field's value.
|
||||
*
|
||||
* Example Usage:
|
||||
*
|
||||
* <script type="text/javascript">_editor_url = '/url/to/xinha';</script>
|
||||
* <script type="text/javascript" src="file-picker.js" />
|
||||
* <script type="text/javascript">
|
||||
* <?php require_once('/path/to/xinha/contrib/php-xinha.php'); ?>
|
||||
* with(FilePicker.prototype)
|
||||
* {
|
||||
* <?php
|
||||
* $Conf = array
|
||||
* (
|
||||
* 'files_dir' => '/path/to/downloads',
|
||||
* 'files_url' => '/url/to/downloads',
|
||||
* 'show_full_options' => false, // Full options are not useful as a URL picker
|
||||
* // See ExtendedFileManager for more configuration options !
|
||||
* );
|
||||
* xinha_pass_to_php_backend($Conf);
|
||||
* ?>
|
||||
* }
|
||||
*
|
||||
* window.onload = function() { new FilePicker(document.getElementById('idOfTheInputField')); }
|
||||
* </script>
|
||||
*
|
||||
*
|
||||
* @author $Author$
|
||||
* @version $Id$
|
||||
* @package ImageManager
|
||||
*/
|
||||
|
||||
|
||||
function FilePicker(field)
|
||||
{
|
||||
this.field = field;
|
||||
var picker = this;
|
||||
|
||||
var but = document.createElement('input');
|
||||
but.type = 'button';
|
||||
but.value = 'Browse';
|
||||
but.onclick = function() { picker.popup_picker(); }
|
||||
|
||||
field.parentNode.insertBefore(but,field.nextSibling);
|
||||
field.size = '20';
|
||||
field.style.textAlign = 'right';
|
||||
};
|
||||
|
||||
FilePicker.prototype.backend = _editor_url + 'plugins/ExtendedFileManager/backend.php?__plugin=ExtendedFileManager&';
|
||||
FilePicker.prototype.backend_data = null;
|
||||
|
||||
FilePicker.prototype.append_query_string = true;
|
||||
|
||||
FilePicker.prototype.popup_picker = function()
|
||||
{
|
||||
var picker = this; // closure for later
|
||||
var outparam = null;
|
||||
if(picker.field.value)
|
||||
{
|
||||
outparam =
|
||||
{
|
||||
f_href : picker.field.value,
|
||||
f_title : '',
|
||||
f_target : '',
|
||||
f_usetarget : false,
|
||||
baseHref: null
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
var manager = this.backend + '__function=manager&mode=link';
|
||||
if(this.backend_config != null)
|
||||
{
|
||||
manager += '&backend_config='
|
||||
+ encodeURIComponent(this.backend_config);
|
||||
manager += '&backend_config_hash='
|
||||
+ encodeURIComponent(this.backend_config_hash);
|
||||
manager += '&backend_config_secret_key_location='
|
||||
+ encodeURIComponent(this.backend_config_secret_key_location);
|
||||
}
|
||||
|
||||
if(this.backend_data != null)
|
||||
{
|
||||
for ( var i in this.backend_data )
|
||||
{
|
||||
manager += '&' + i + '=' + encodeURIComponent(this.backend_data[i]);
|
||||
}
|
||||
}
|
||||
|
||||
Dialog(manager, function(param) {
|
||||
if (!param) { // user must have pressed Cancel
|
||||
return false;
|
||||
}
|
||||
|
||||
picker.field.value = param.f_href;
|
||||
|
||||
}, outparam);
|
||||
}
|
||||
|
||||
// Dialog is part of Xinha, but we'll provide it here incase Xinha's not being
|
||||
// loaded.
|
||||
if(typeof Dialog == 'undefined')
|
||||
{
|
||||
// htmlArea v3.0 - Copyright (c) 2003-2004 interactivetools.com, inc.
|
||||
// This copyright notice MUST stay intact for use (see license.txt).
|
||||
//
|
||||
// Portions (c) dynarch.com, 2003-2004
|
||||
//
|
||||
// A free WYSIWYG editor replacement for <textarea> fields.
|
||||
// For full source code and docs, visit http://www.interactivetools.com/
|
||||
//
|
||||
// Version 3.0 developed by Mihai Bazon.
|
||||
// http://dynarch.com/mishoo
|
||||
//
|
||||
// $Id: dialog.js 183 2005-05-20 06:11:44Z gogo $
|
||||
|
||||
// Though "Dialog" looks like an object, it isn't really an object. Instead
|
||||
// it's just namespace for protecting global symbols.
|
||||
|
||||
function Dialog(url, action, init) {
|
||||
if (typeof init == "undefined") {
|
||||
init = window; // pass this window object by default
|
||||
}
|
||||
var dlg = window.open(url, "hadialog",
|
||||
"toolbar=no,menubar=no,personalbar=no,width=10,height=10," +
|
||||
"scrollbars=yes,resizable=yes,modal=yes,dependable=yes");
|
||||
Dialog._modal = dlg;
|
||||
Dialog._arguments = init;
|
||||
|
||||
// make up a function to be called when the Dialog ends.
|
||||
Dialog._return = function (val)
|
||||
{
|
||||
if (val && action) {
|
||||
action(val);
|
||||
}
|
||||
|
||||
Dialog._modal = null;
|
||||
};
|
||||
Dialog._modal.focus();
|
||||
};
|
||||
|
||||
// should be a function, the return handler of the currently opened dialog.
|
||||
Dialog._return = null;
|
||||
|
||||
// constant, the currently opened dialog
|
||||
Dialog._modal = null;
|
||||
|
||||
// the dialog will read it's args from this variable
|
||||
Dialog._arguments = null;
|
||||
|
||||
}
|
||||
|
||||
// Deprecated method for passing config, use above instead!
|
||||
//---------------------------------------------------------
|
||||
FilePicker.prototype.backend_config = null;
|
||||
FilePicker.prototype.backend_config_hash = null;
|
||||
FilePicker.prototype.backend_config_secret_key_location = 'Xinha:ExtendedFileManager';
|
||||
//---------------------------------------------------------
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 291 B |
|
After Width: | Height: | Size: 479 B |
|
After Width: | Height: | Size: 140 B |
|
After Width: | Height: | Size: 321 B |
|
After Width: | Height: | Size: 250 B |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 226 B |
|
After Width: | Height: | Size: 119 B |
|
After Width: | Height: | Size: 2.1 KiB |
|
After Width: | Height: | Size: 612 B |
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 622 B |
|
After Width: | Height: | Size: 119 B |
|
After Width: | Height: | Size: 211 B |
|
After Width: | Height: | Size: 110 B |
|
After Width: | Height: | Size: 2.3 KiB |
|
After Width: | Height: | Size: 353 B |
|
After Width: | Height: | Size: 621 B |
|
After Width: | Height: | Size: 230 B |
|
After Width: | Height: | Size: 419 B |
|
After Width: | Height: | Size: 120 B |
|
After Width: | Height: | Size: 119 B |
|
After Width: | Height: | Size: 413 B |
|
After Width: | Height: | Size: 139 B |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 564 B |