first re-commit.
1
sn_templates/editor_stuff/plugin/snstuff/css/content.css
Normal file
@@ -0,0 +1 @@
|
||||
.snVideo{border:1px dotted #cc0000; background-position:center; background-repeat:no-repeat; background-color:#ffffcc;background-image:url(../images/video.png);}
|
14
sn_templates/editor_stuff/plugin/snstuff/css/default.css
Normal file
@@ -0,0 +1,14 @@
|
||||
#src_list, #over_list, #out_list {width:280px;}
|
||||
#video{display:none;}
|
||||
.mceActionPanel {margin-top:7px;}
|
||||
.alignPreview {border:1px solid #000; width:140px; height:140px; overflow:hidden; padding:5px;}
|
||||
.checkbox {border:0;}
|
||||
.panel_wrapper div.current {height:470px;}
|
||||
#prev, #prev2 {margin:0; border:1px solid #000; width:428px; height:260px; overflow:auto;}
|
||||
#align, #classlist {width:150px;}
|
||||
#width, #height {vertical-align:middle; width:50px; text-align:center;}
|
||||
#vspace, #hspace, #border {vertical-align:middle; width:30px; text-align:center;}
|
||||
#class_list {width:180px;}
|
||||
/* input {width: 100px;} */
|
||||
#constrain, #onmousemovecheck {width:auto;}
|
||||
#id, #dir, #lang, #usemap, #longdesc {width:200px;}
|
618
sn_templates/editor_stuff/plugin/snstuff/editor_plugin.js
Normal file
@@ -0,0 +1,618 @@
|
||||
(function() {
|
||||
|
||||
tinymce.create('tinymce.plugins.SNStuff', {
|
||||
|
||||
//// ImageUpload
|
||||
init : function(ed, url) {
|
||||
ed.onInit.add(function() {
|
||||
if (ed.settings.content_css !== false)
|
||||
ed.dom.loadCSS(url + "/css/content.css");
|
||||
});
|
||||
|
||||
ed.addCommand('mceSNImages', function() {
|
||||
ed.windowManager.open({
|
||||
file : url + '/html/image.html',
|
||||
width : 490,
|
||||
height : 550,
|
||||
inline : 1
|
||||
}, {
|
||||
plugin_url : url
|
||||
});
|
||||
});
|
||||
|
||||
ed.addButton('snimages', {
|
||||
title : 'snstuff.img_desc',
|
||||
cmd : 'mceSNImages',
|
||||
image : url + '/images/insert-image.png'
|
||||
});
|
||||
|
||||
ed.onNodeChange.add(function(ed, cm, n) {
|
||||
cm.setActive('snimages', n.nodeName == 'IMG');
|
||||
});
|
||||
|
||||
|
||||
/// Link
|
||||
ed.addCommand('mceSNLink', function() {
|
||||
ed.windowManager.open({
|
||||
file : url + '/html/link.html',
|
||||
width : 500 + parseInt(ed.getLang('snstuff.snlink_delta_width', 0)),
|
||||
height : 180 + parseInt(ed.getLang('snstuff.snlink_delta_height', 0)),
|
||||
inline : 1
|
||||
}, {
|
||||
plugin_url : url
|
||||
});
|
||||
});
|
||||
|
||||
ed.addButton('snlink', {title : 'snstuff.lnk_desc', cmd : 'mceSNLink', image: url+'/images/insert-link.png'});
|
||||
|
||||
ed.onNodeChange.add(function(ed, cm, n) {
|
||||
cm.setActive('snlink', false);
|
||||
var node = n;
|
||||
while(node != null){
|
||||
if(node.nodeName == 'A'){
|
||||
cm.setActive('snlink', true);
|
||||
break;
|
||||
}
|
||||
node = node.parentNode;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/// Code
|
||||
ed.addCommand('mceSNCode', function() {
|
||||
|
||||
handleSNCode(ed,url);
|
||||
|
||||
});
|
||||
ed.addButton('sncode', {title : 'snstuff.code_desc', cmd : 'mceSNCode', image: url+'/images/code-context.png'});
|
||||
|
||||
ed.onNodeChange.add(function(ed, cm, n) {
|
||||
cm.setActive('sncode', n.nodeName == 'CODE');
|
||||
});
|
||||
|
||||
/// Infobox
|
||||
ed.addCommand('mceSNInfoBox', function() { handleSNInfoBox(ed, url)});
|
||||
ed.addCommand('mceSNInfoBoxHead', function() { handleSNInfoBoxHead(ed, url) });
|
||||
|
||||
|
||||
ed.addButton('sninfobox', {title : 'snstuff.infobox_desc', cmd : 'mceSNInfoBox', image: url+'/images/textinfo.png'});
|
||||
ed.addButton('sninfoboxhead', {title : 'snstuff.infoboxhead_desc', cmd : 'mceSNInfoBoxHead', image: url+'/images/textinfo_head.png'});
|
||||
|
||||
|
||||
ed.onNodeChange.add(function(ed, cm, n) {
|
||||
var scas = ed.dom.getParent(ed.selection.getStart(), function(n) {return ed.dom.hasClass(n, "snInfoBox");}) != null;
|
||||
var scae = ed.dom.getParent(ed.selection.getEnd(), function(n) {return ed.dom.hasClass(n, "snInfoBox");}) != null;
|
||||
var sca = scas && scae;
|
||||
var scbs = ed.dom.getParent(ed.selection.getStart(), function(n) {return ed.dom.hasClass(n, "snInfoBoxHead");}) != null;
|
||||
var scbe = ed.dom.getParent(ed.selection.getStart(), function(n) {return ed.dom.hasClass(n, "snInfoBoxHead");}) != null;
|
||||
var scb = scbs && scbe;
|
||||
|
||||
var cs = ed.selection.getContent().length > 0;
|
||||
cm.setDisabled('sninfobox', scae != scas);
|
||||
cm.setDisabled('sninfoboxhead', (!((sca && cs) || scb) || scae != scas));
|
||||
cm.setActive('sninfobox', sca);
|
||||
cm.setActive('sninfoboxhead', scb);
|
||||
});
|
||||
|
||||
/// Quote
|
||||
ed.addCommand('mceSNQuote', function() {
|
||||
|
||||
handleSNQuote(ed,url);
|
||||
|
||||
});
|
||||
ed.addButton('snquote', {title : 'snstuff.quote_desc', cmd : 'mceSNQuote', image: url+'/images/quote.png'});
|
||||
|
||||
ed.onNodeChange.add(function(ed, cm, n) {
|
||||
|
||||
cm.setActive('snquote', n.nodeName == 'BLOCKQUOTE');
|
||||
});
|
||||
|
||||
/// LinkVorschlag
|
||||
Proposals.url = url;
|
||||
ed.addCommand('mceSNProposals', function(ui,v) {
|
||||
Proposals.findWordAll(ed);
|
||||
});
|
||||
ed.onKeyUp.add(
|
||||
function(ed,e){
|
||||
var an = ed.dom.getParent(ed.selection.getNode(),function(n){return n.nodeName == 'A'});
|
||||
if(an == null && e.keyCode == 32){
|
||||
var cm = ed.selection.getBookmark();
|
||||
var ps = ed.dom.get(cm.id+'_start').previousSibling;
|
||||
var pos = ps.nodeValue.length;
|
||||
ed.selection.moveToBookmark(cm);
|
||||
Proposals.findWord(ed,ps,pos);
|
||||
}else{
|
||||
Proposals.closeWin();
|
||||
}
|
||||
}
|
||||
);
|
||||
ed.addButton('snproposals', {title : 'snstuff.proposals_desc', cmd : 'mceSNProposals', image: url+'/images/proposals.png'});
|
||||
|
||||
ed.onLoadContent.add( SNStuffContentCounter.counter );
|
||||
ed.onChange.add( SNStuffContentCounter.counter );
|
||||
ed.onUndo.add( SNStuffContentCounter.counter );
|
||||
ed.onRedo.add( SNStuffContentCounter.counter );
|
||||
|
||||
ed.onKeyPress.add( SNStuffContentCounter.counter );
|
||||
|
||||
|
||||
}, // init
|
||||
|
||||
|
||||
///////////////////////////////////////
|
||||
|
||||
getInfo : function() {
|
||||
return {
|
||||
longname : 'SN-Stuff (ImageUpload, Quote, Code, Link, etc.)',
|
||||
author : 'Member from .de',
|
||||
authorurl : 'http://www..de',
|
||||
infourl : 'http://www..de',
|
||||
version : "1.0"
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
tinymce.PluginManager.add('snstuff', tinymce.plugins.SNStuff);
|
||||
})();
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
var Proposals = {
|
||||
url: '',
|
||||
// ajaxBlock: tinyMCE.activeEditor.getParam("snstuff_proposals_ajax_block"),
|
||||
// ajaxLink: tinyMCE.activeEditor.getParam("snstuff_proposals_ajax_link"),
|
||||
|
||||
// ajaxBlock: "/ajax_block",
|
||||
// ajaxLink: "/ajax_link",
|
||||
proposalsFrame: undefined,
|
||||
proposalsFrameBody: undefined,
|
||||
proposalsFrameId: Math.round(Math.random()*1000),
|
||||
|
||||
running: false,
|
||||
cancel: function(){
|
||||
if(this.running){
|
||||
this.running = false;
|
||||
}
|
||||
},
|
||||
|
||||
findWord: function(ed, node,pos){
|
||||
running = true;
|
||||
var ntn = node;
|
||||
var word;
|
||||
var txt = node.nodeValue.substr(0,pos);
|
||||
word = txt.replace(/ $/,'').split(/ /).pop();
|
||||
if(word.length > 0){
|
||||
this.getProposals(ed,ntn, word, pos, false);
|
||||
}
|
||||
},// find word
|
||||
|
||||
findWordAll: function(ed){
|
||||
running = true;
|
||||
var wl = new Array();
|
||||
this._getContentWordList(ed.getBody(),wl);
|
||||
this.getProposals(ed,null,wl.join('+'),-1,true);
|
||||
},
|
||||
|
||||
getProposals: function(ed,node, word, pos, block){
|
||||
var po = this;
|
||||
if(!running){return;}
|
||||
|
||||
tinymce.util.XHR.send({
|
||||
url : block ? tinyMCE.activeEditor.getParam("snstuff_proposals_ajax_block", "/ajax_block")
|
||||
: tinyMCE.activeEditor.getParam("snstuff_proposals_ajax_link","/ajax_link"),
|
||||
content_type : "application/json",
|
||||
type : "POST",
|
||||
data : block ? "sn_msgbody="+escape(word) : "sn_key="+escape(word),
|
||||
async : true,
|
||||
scope : po,
|
||||
|
||||
success : function( data, req, o ) {
|
||||
var obj = tinymce.util.JSON.parse(data);
|
||||
po.showProposals(obj, ed, node, pos, block);
|
||||
},
|
||||
|
||||
error : function( type, req, o ){ alert("ERROR:"+type+"\n"+req+" - "+o);}
|
||||
});
|
||||
},
|
||||
|
||||
closeWin: function(){
|
||||
this.cancel();
|
||||
if(this.proposalsFrame && this.proposalsFrame.style.display != 'none'){
|
||||
this.proposalsFrame.style.display = 'none';
|
||||
}
|
||||
},
|
||||
showProposals:function(obj, ed, node, pos, block){
|
||||
if(!running){return;}
|
||||
// remove used Lnk
|
||||
tinymce.grep(ed.dom.select("a"), function(n) {
|
||||
var h = n.getAttributeNode('href');
|
||||
if(h != null){
|
||||
var v = h.nodeValue;
|
||||
for(var e in obj){
|
||||
if(v == obj[e].Link){
|
||||
delete obj[e];
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if(!this.proposalsFrame){this._buildFrame();}
|
||||
|
||||
var pf = this.proposalsFrameBody;
|
||||
while(pf.hasChildNodes()){
|
||||
pf.removeChild(pf.firstChild);
|
||||
}
|
||||
if(!obj){return;}
|
||||
for(var i = 0; i < obj.length; i++){
|
||||
if(!obj[i]){continue;}
|
||||
|
||||
var o = obj[i];
|
||||
var bgColor = (i%2 == 0) ? "#FFFAB3":"#FFFE9A";
|
||||
var root = this._buildHTMLElement("DIV","lnkBody_"+i,"border-bottom:black 1px solid;background-color:"+bgColor);
|
||||
var lnk = this._buildHTMLElement("IMG","lnkLnk_"+i,"float:right;cursor:pointer");
|
||||
var desc = this._buildHTMLElement("DIV", "lnkDesc_"+i, "",o.Comment);
|
||||
var prevLnk = this._buildHTMLElement("A","lnkPrevLnk_"+i,"", o.Link);
|
||||
var keyword = this._buildHTMLElement("DIV","lnkKeyWord_"+i, "font-weight:bold", o.Key);
|
||||
var small = this._buildHTMLElement("SMALL","lnkSmall_"+i);
|
||||
small.appendChild(prevLnk);
|
||||
lnk.src = this.url+"/images/add.png";
|
||||
lnk.alt = "Link einfügen";
|
||||
lnk.title = "Das Wort \""+o.Key+"\" im Text verlinken";
|
||||
prevLnk.href = o.Link;
|
||||
prevLnk.target = "blank";
|
||||
|
||||
root.appendChild(keyword); keyword.appendChild(lnk); root.appendChild(desc);root.appendChild(small);
|
||||
this._setOnclickEvent(lnk, {obj:o,block:block,ed:ed,node:node,pos:pos});
|
||||
pf.appendChild(root);
|
||||
}
|
||||
if(this.proposalsFrameBody.hasChildNodes()){
|
||||
this.proposalsFrame.style.display = "block";
|
||||
}
|
||||
},
|
||||
_setOnclickEvent:function(lnk, o){
|
||||
var p = this;
|
||||
lnk.onclick = function(){p._insertAction(o,this)};
|
||||
},
|
||||
_insertAction:function(o,fn){
|
||||
if(!o.block){
|
||||
this._insertLink(o);
|
||||
this.closeWin();
|
||||
}else{
|
||||
var fw = this._findWord(o.ed.getBody(),o.obj.Key);
|
||||
if(fw){
|
||||
this._insertLink(fw.node,fw.pos,o.obj.Link,o.ed);
|
||||
var pe = fn.parentNode.parentNode;
|
||||
pe.parentNode.removeChild(pe);
|
||||
if(!this.proposalsFrameBody.hasChildNodes()){
|
||||
this.proposalsFrame.style.display = "none";
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
_insertLink: function(o){
|
||||
var node = o.node; var pos = o.pos; var lnk = o.obj.Link; var ed = o.ed;
|
||||
|
||||
var nv = node.nodeValue;
|
||||
var pre = nv.substring(0,pos).replace(/ $/,'').split(/ /);
|
||||
var post = " "+nv.substr(pos);
|
||||
var w = pre.pop();
|
||||
var a = ed.getDoc().createElement('A');
|
||||
var ha = ed.getDoc().createAttribute("href");
|
||||
var tit = ed.getDoc().createAttribute("title");
|
||||
|
||||
tit.nodeValue=o.obj.Comment;
|
||||
ha.nodeValue = lnk;
|
||||
a.setAttributeNode(ha);
|
||||
a.setAttributeNode(tit);
|
||||
a.appendChild(ed.getDoc().createTextNode(w));
|
||||
|
||||
var pnode = node.parentNode;
|
||||
|
||||
tinyMCE.execCommand("mceBeginUndoLevel");
|
||||
pnode.insertBefore(ed.getDoc().createTextNode(pre.join(' ')+' '),node);
|
||||
pnode.insertBefore(a,node);
|
||||
pnode.insertBefore(ed.getDoc().createTextNode(post),node);
|
||||
pnode.removeChild(node);
|
||||
tinyMCE.execCommand("mceEndUndoLevel");
|
||||
ed.focus();
|
||||
ed.selection.select(a);
|
||||
ed.selection.collapse();
|
||||
},
|
||||
|
||||
_findWord: function(doc, word){
|
||||
var node = doc;
|
||||
var w;
|
||||
while(node != null){
|
||||
if(node.nodeType == 1 && node.nodeName != "A"){
|
||||
w = this._findWord(node.firstChild,word);
|
||||
if(w){ return w;}
|
||||
}
|
||||
|
||||
if(node.nodeType == 3){
|
||||
var txt = node.nodeValue.toLowerCase();
|
||||
var p = txt.indexOf(word.toLowerCase());
|
||||
if(p != -1){
|
||||
return {pos:p+word.length, node: node};
|
||||
}
|
||||
}
|
||||
node = node.nextSibling;
|
||||
}
|
||||
return w;
|
||||
},
|
||||
|
||||
_getContentWordList: function(doc, wlist){
|
||||
var node = doc;
|
||||
|
||||
while(node != null){
|
||||
if(node.nodeType == 1 && node.nodeName != "A"){
|
||||
this._getContentWordList(node.firstChild, wlist);
|
||||
}
|
||||
|
||||
if(node.nodeType == 3){
|
||||
var lst = node.nodeValue.split(/ /);
|
||||
while(lst.length > 0){
|
||||
var s = lst.pop().replace(/\s/g,"");
|
||||
if(s != ""){
|
||||
wlist.push(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
node = node.nextSibling;
|
||||
}
|
||||
},
|
||||
///////////////////////
|
||||
_buildFrame: function(){
|
||||
var container = tinyMCE.activeEditor.getContentAreaContainer();
|
||||
var ot = container.offsetTop;
|
||||
var ol = container.offsetLeft + container.offsetWidth;
|
||||
|
||||
if(document.getElementsByTagName("body")[0].offsetWidth < ol+355){
|
||||
ol = document.getElementsByTagName("body")[0].offsetWidth - 360;
|
||||
}
|
||||
|
||||
var pa = (document.all) ? "absolute":"fixed";
|
||||
|
||||
var p = this._buildHTMLElement("DIV", "proposalsFrame","position:"+pa+";width:350px;left:"+ol+"px;top:"+ot+"px;padding:5px;background-color:#FFFE9A;border:solid black 1px;");
|
||||
var h = this._buildHTMLElement("DIV", "proposalsFrameHead","border-bottom:black 1px solid;font-weight:bold;background-color:#FFF27A;cursor:pointer;padding:2px;","Tipps zum Thema");
|
||||
var b = this._buildHTMLElement("DIV", "proposalsFrameBody","min-height:100px;max-height:300px;overflow:auto;padding:5px;");
|
||||
var c = this._buildHTMLElement("IMG", "proposalsFrameClose","float:right");
|
||||
|
||||
|
||||
h.onmousedown = function(){
|
||||
var p = this.parentNode;
|
||||
var ox,oy;
|
||||
this.onmouseup = function(){p.onmousemove = function(){}; p.onmouseout = function(){}}
|
||||
var m = function(ev){
|
||||
var px = (!ev) ? window.event.clientX : ev.pageX;var py = (!ev) ? window.event.clientY : ev.pageY;
|
||||
if(!ox){oy = py - parseInt(this.style.top); ox = px - parseInt(this.style.left); }
|
||||
this.style.left = (px-ox)+"px"; this.style.top = (py-oy)+"px";
|
||||
return false;
|
||||
}
|
||||
p.onmousemove = m;p.onmouseout = m;
|
||||
return false;
|
||||
}
|
||||
|
||||
var me = this;
|
||||
c.onclick = function(){me.closeWin()};
|
||||
|
||||
c.alt = "X";
|
||||
c.src = this.url+'/images/close.png';
|
||||
c.alt = "Fenster schlissen";
|
||||
c.title = "Fenster schliessen";
|
||||
|
||||
h.insertBefore(c,h.firstChild);
|
||||
p.appendChild(h); p.appendChild(b)
|
||||
|
||||
this.proposalsFrame = p;
|
||||
this.proposalsFrameBody = b;
|
||||
|
||||
document.getElementsByTagName("body")[0].appendChild(p);
|
||||
},
|
||||
|
||||
_buildHTMLElement: function(n, id, style, txt){
|
||||
var e = document.createElement(n);
|
||||
var an = document.createAttribute("id");
|
||||
an.nodeValue = id+"_"+this.proposalsFrameId;
|
||||
var clazz = document.createAttribute("class");
|
||||
clazz.nodeValue = id;
|
||||
e.setAttributeNode(clazz);
|
||||
e.setAttributeNode(an);
|
||||
|
||||
e.style.cssText = style;
|
||||
if(txt){ e.appendChild( document.createTextNode(txt)); }
|
||||
return e;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
function handleSNCode(ed, url){
|
||||
var enode = ed.selection.getNode();
|
||||
var sel = ed.selection.getContent();
|
||||
var isBlock = (enode != null && enode.nodeName == 'CODE');
|
||||
|
||||
if(isBlock){
|
||||
|
||||
// Remove element
|
||||
if(enode.nodeName == 'CODE'){
|
||||
tinyMCE.execCommand("mceBeginUndoLevel");
|
||||
i = ed.selection.getBookmark();
|
||||
ed.dom.remove(enode, 1);
|
||||
ed.selection.moveToBookmark(i);
|
||||
tinyMCE.execCommand("mceEndUndoLevel");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
tinyMCE.execCommand("mceBeginUndoLevel");
|
||||
|
||||
if(sel.length == 0 ){
|
||||
|
||||
ed.windowManager.open({
|
||||
file : url + '/html/code.html',
|
||||
width : 410 + parseInt(ed.getLang('snstuff.snlink_delta_width', 0)),
|
||||
height : 480 + parseInt(ed.getLang('snstuff.snlink_delta_height', 0)),
|
||||
inline : 1
|
||||
}, {
|
||||
plugin_url : url
|
||||
});
|
||||
}else{
|
||||
ed.execCommand('mceInsertContent', false, '<code>'+ed.selection.getContent()+'</code>', {skip_undo : 1});
|
||||
}
|
||||
tinyMCE.execCommand("mceEndUndoLevel");
|
||||
|
||||
}
|
||||
|
||||
function handleSNQuote(ed, url){
|
||||
var enode = ed.selection.getNode();
|
||||
var sel = ed.selection.getContent();
|
||||
var isBlock = (enode != null && enode.nodeName == 'BLOCKQUOTE');
|
||||
|
||||
if(isBlock){
|
||||
|
||||
// Remove element
|
||||
if(enode.nodeName == 'BLOCKQUOTE'){
|
||||
tinyMCE.execCommand("mceBeginUndoLevel");
|
||||
i = ed.selection.getBookmark();
|
||||
ed.dom.remove(enode, 1);
|
||||
ed.selection.moveToBookmark(i);
|
||||
tinyMCE.execCommand("mceEndUndoLevel");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
tinyMCE.execCommand("mceBeginUndoLevel");
|
||||
|
||||
if(sel.length == 0 ){
|
||||
|
||||
ed.windowManager.open({
|
||||
file : url + '/html/quote.html',
|
||||
width : 410 + parseInt(ed.getLang('snstuff.snquote_delta_width', 0)),
|
||||
height : 480 + parseInt(ed.getLang('snstuff.snquote_delta_height', 0)),
|
||||
inline : 1
|
||||
}, {
|
||||
plugin_url : url
|
||||
});
|
||||
}else{
|
||||
ed.execCommand('mceInsertContent', false, '<blockquote>'+ed.selection.getContent()+'</blockquote>', {skip_undo : 1});
|
||||
}
|
||||
tinyMCE.execCommand("mceEndUndoLevel");
|
||||
|
||||
}
|
||||
|
||||
|
||||
function handleSNInfoBox(ed, url){
|
||||
var enode = ed.selection.getNode();
|
||||
var sel = ed.selection.getContent();
|
||||
|
||||
ed.windowManager.open({
|
||||
file : url + '/html/infobox.html',
|
||||
width : 250+ parseInt(ed.getLang('snstuff.snquote_delta_width', 0)),
|
||||
height : 100 + parseInt(ed.getLang('snstuff.snquote_delta_height', 0)),
|
||||
inline : 1
|
||||
}, {
|
||||
node: enode,
|
||||
plugin_url : url
|
||||
});
|
||||
}
|
||||
|
||||
function handleSNInfoBoxHead(ed, url){
|
||||
var enode = ed.dom.getParent(ed.selection.getNode(), function(n) {return ed.dom.hasClass(n, "snInfoBoxHead");})
|
||||
var sel = ed.selection.getContent();
|
||||
|
||||
tinyMCE.execCommand("mceBeginUndoLevel");
|
||||
if(sel.length > 0){
|
||||
ed.execCommand('mceInsertRawHTML', false, '<span id="__snInfoBoxHeadTmp">'+ed.selection.getContent()+'</span>',{skip_undo : 1});
|
||||
ed.dom.setAttribs('__snInfoBoxHeadTmp', {style:"", class:"snInfoBoxHead"});
|
||||
ed.dom.setAttrib('__snInfoBoxHeadTmp', 'id', '');
|
||||
}else{
|
||||
i = ed.selection.getBookmark();
|
||||
ed.dom.remove(enode, 1);
|
||||
ed.selection.moveToBookmark(i);
|
||||
}
|
||||
tinyMCE.execCommand("mceEndUndoLevel");
|
||||
}
|
||||
/////////////////////////////////////////////////
|
||||
|
||||
SNStuffContentCounter = {
|
||||
elm: Array(),
|
||||
|
||||
isInit:false,
|
||||
init: function(ed){
|
||||
|
||||
var elm = ed.getParam("snstuff_contentcounter","").replace(/ /g,"").split(",");
|
||||
for(var e = 0; e < elm.length; e++){
|
||||
var l = new Object();
|
||||
|
||||
var cv = ed.getParam("snstuff_charcolor_"+elm[e],"none").replace(/ /g,"");
|
||||
|
||||
if(cv != "none"){
|
||||
var a = new Array();
|
||||
cc = cv.split(",");
|
||||
for(var cci = 0; cci < cc.length; cci++){
|
||||
var v = cc[cci].split(":");
|
||||
a.push({v:v[0],c:v[1]});
|
||||
}
|
||||
l.c = a.sort(function(a,b){return a.v-b.v});
|
||||
}
|
||||
|
||||
var wv = ed.getParam("snstuff_wordcolor_"+elm[e],"none").replace(/ /g,"");
|
||||
|
||||
if(wv != "none"){
|
||||
var a = new Array();
|
||||
wc = wv.split(",");
|
||||
for(var wci = 0; wci < wc.length; wci++){
|
||||
var v = wc[wci].split(":");
|
||||
a.push({v:v[0],c:v[1]});
|
||||
}
|
||||
l.w = a.sort(function(a,b){return a.v-b.v});
|
||||
}
|
||||
|
||||
this.elm[elm[e]] = l;
|
||||
|
||||
}
|
||||
|
||||
this.isInit = true;
|
||||
},
|
||||
|
||||
counter : function(ed,e){
|
||||
if(!SNStuffContentCounter.isInit){
|
||||
SNStuffContentCounter.init(ed);
|
||||
}
|
||||
if(SNStuffContentCounter.elm[ed.id]){
|
||||
var c = ed.getContent().replace(/<br \/>/g," ").replace(/<.+?>/g,"").replace(/ {1,}/g," ").replace(/^ | $/g,"");
|
||||
var cl = c.length;
|
||||
var wl = c.split(" ").length;
|
||||
var p = tinymce.DOM.get(ed.id + '_path_row');
|
||||
html = "";
|
||||
|
||||
var cvl = SNStuffContentCounter.elm[ed.id];
|
||||
if(cvl.c){
|
||||
var col = "";
|
||||
for(var i = 0; i < cvl.c.length; i++){
|
||||
if(cl > cvl.c[i].v){
|
||||
col = "color:"+cvl.c[i].c;
|
||||
}
|
||||
}
|
||||
html += ' <span style="'+col+'"> Zeichen:'+cl+' </span> ';
|
||||
}
|
||||
|
||||
if(cvl.w){
|
||||
|
||||
var col = "";
|
||||
for(var i = 0; i < cvl.w.length; i++){
|
||||
if(wl > cvl.w[i].v){
|
||||
col = "color:"+cvl.w[i].c;
|
||||
}
|
||||
}
|
||||
html += ' <span style="'+col+'"> Wörter:'+wl+' </span> ';
|
||||
}
|
||||
tinymce.DOM.setHTML(p,html);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
618
sn_templates/editor_stuff/plugin/snstuff/editor_plugin_src.js
Normal file
@@ -0,0 +1,618 @@
|
||||
(function() {
|
||||
|
||||
tinymce.create('tinymce.plugins.SNStuff', {
|
||||
|
||||
//// ImageUpload
|
||||
init : function(ed, url) {
|
||||
ed.onInit.add(function() {
|
||||
if (ed.settings.content_css !== false)
|
||||
ed.dom.loadCSS(url + "/css/content.css");
|
||||
});
|
||||
|
||||
ed.addCommand('mceSNImages', function() {
|
||||
ed.windowManager.open({
|
||||
file : url + '/html/image.html',
|
||||
width : 490,
|
||||
height : 550,
|
||||
inline : 1
|
||||
}, {
|
||||
plugin_url : url
|
||||
});
|
||||
});
|
||||
|
||||
ed.addButton('snimages', {
|
||||
title : 'snstuff.img_desc',
|
||||
cmd : 'mceSNImages',
|
||||
image : url + '/images/insert-image.png'
|
||||
});
|
||||
|
||||
ed.onNodeChange.add(function(ed, cm, n) {
|
||||
cm.setActive('snimages', n.nodeName == 'IMG');
|
||||
});
|
||||
|
||||
|
||||
/// Link
|
||||
ed.addCommand('mceSNLink', function() {
|
||||
ed.windowManager.open({
|
||||
file : url + '/html/link.html',
|
||||
width : 500 + parseInt(ed.getLang('snstuff.snlink_delta_width', 0)),
|
||||
height : 180 + parseInt(ed.getLang('snstuff.snlink_delta_height', 0)),
|
||||
inline : 1
|
||||
}, {
|
||||
plugin_url : url
|
||||
});
|
||||
});
|
||||
|
||||
ed.addButton('snlink', {title : 'snstuff.lnk_desc', cmd : 'mceSNLink', image: url+'/images/insert-link.png'});
|
||||
|
||||
ed.onNodeChange.add(function(ed, cm, n) {
|
||||
cm.setActive('snlink', false);
|
||||
var node = n;
|
||||
while(node != null){
|
||||
if(node.nodeName == 'A'){
|
||||
cm.setActive('snlink', true);
|
||||
break;
|
||||
}
|
||||
node = node.parentNode;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/// Code
|
||||
ed.addCommand('mceSNCode', function() {
|
||||
|
||||
handleSNCode(ed,url);
|
||||
|
||||
});
|
||||
ed.addButton('sncode', {title : 'snstuff.code_desc', cmd : 'mceSNCode', image: url+'/images/code-context.png'});
|
||||
|
||||
ed.onNodeChange.add(function(ed, cm, n) {
|
||||
cm.setActive('sncode', n.nodeName == 'CODE');
|
||||
});
|
||||
|
||||
/// Infobox
|
||||
ed.addCommand('mceSNInfoBox', function() { handleSNInfoBox(ed, url)});
|
||||
ed.addCommand('mceSNInfoBoxHead', function() { handleSNInfoBoxHead(ed, url) });
|
||||
|
||||
|
||||
ed.addButton('sninfobox', {title : 'snstuff.infobox_desc', cmd : 'mceSNInfoBox', image: url+'/images/textinfo.png'});
|
||||
ed.addButton('sninfoboxhead', {title : 'snstuff.infoboxhead_desc', cmd : 'mceSNInfoBoxHead', image: url+'/images/textinfo_head.png'});
|
||||
|
||||
|
||||
ed.onNodeChange.add(function(ed, cm, n) {
|
||||
var scas = ed.dom.getParent(ed.selection.getStart(), function(n) {return ed.dom.hasClass(n, "snInfoBox");}) != null;
|
||||
var scae = ed.dom.getParent(ed.selection.getEnd(), function(n) {return ed.dom.hasClass(n, "snInfoBox");}) != null;
|
||||
var sca = scas && scae;
|
||||
var scbs = ed.dom.getParent(ed.selection.getStart(), function(n) {return ed.dom.hasClass(n, "snInfoBoxHead");}) != null;
|
||||
var scbe = ed.dom.getParent(ed.selection.getStart(), function(n) {return ed.dom.hasClass(n, "snInfoBoxHead");}) != null;
|
||||
var scb = scbs && scbe;
|
||||
|
||||
var cs = ed.selection.getContent().length > 0;
|
||||
cm.setDisabled('sninfobox', scae != scas);
|
||||
cm.setDisabled('sninfoboxhead', (!((sca && cs) || scb) || scae != scas));
|
||||
cm.setActive('sninfobox', sca);
|
||||
cm.setActive('sninfoboxhead', scb);
|
||||
});
|
||||
|
||||
/// Quote
|
||||
ed.addCommand('mceSNQuote', function() {
|
||||
|
||||
handleSNQuote(ed,url);
|
||||
|
||||
});
|
||||
ed.addButton('snquote', {title : 'snstuff.quote_desc', cmd : 'mceSNQuote', image: url+'/images/quote.png'});
|
||||
|
||||
ed.onNodeChange.add(function(ed, cm, n) {
|
||||
|
||||
cm.setActive('snquote', n.nodeName == 'BLOCKQUOTE');
|
||||
});
|
||||
|
||||
/// LinkVorschlag
|
||||
Proposals.url = url;
|
||||
ed.addCommand('mceSNProposals', function(ui,v) {
|
||||
Proposals.findWordAll(ed);
|
||||
});
|
||||
ed.onKeyUp.add(
|
||||
function(ed,e){
|
||||
var an = ed.dom.getParent(ed.selection.getNode(),function(n){return n.nodeName == 'A'});
|
||||
if(an == null && e.keyCode == 32){
|
||||
var cm = ed.selection.getBookmark();
|
||||
var ps = ed.dom.get(cm.id+'_start').previousSibling;
|
||||
var pos = ps.nodeValue.length;
|
||||
ed.selection.moveToBookmark(cm);
|
||||
Proposals.findWord(ed,ps,pos);
|
||||
}else{
|
||||
Proposals.closeWin();
|
||||
}
|
||||
}
|
||||
);
|
||||
ed.addButton('snproposals', {title : 'snstuff.proposals_desc', cmd : 'mceSNProposals', image: url+'/images/proposals.png'});
|
||||
|
||||
ed.onLoadContent.add( SNStuffContentCounter.counter );
|
||||
ed.onChange.add( SNStuffContentCounter.counter );
|
||||
ed.onUndo.add( SNStuffContentCounter.counter );
|
||||
ed.onRedo.add( SNStuffContentCounter.counter );
|
||||
|
||||
ed.onKeyPress.add( SNStuffContentCounter.counter );
|
||||
|
||||
|
||||
}, // init
|
||||
|
||||
|
||||
///////////////////////////////////////
|
||||
|
||||
getInfo : function() {
|
||||
return {
|
||||
longname : 'SN-Stuff (ImageUpload, Quote, Code, Link, etc.)',
|
||||
author : 'Member from .de',
|
||||
authorurl : 'http://www..de',
|
||||
infourl : 'http://www..de',
|
||||
version : "1.0"
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
tinymce.PluginManager.add('snstuff', tinymce.plugins.SNStuff);
|
||||
})();
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
var Proposals = {
|
||||
url: '',
|
||||
// ajaxBlock: tinyMCE.activeEditor.getParam("snstuff_proposals_ajax_block"),
|
||||
// ajaxLink: tinyMCE.activeEditor.getParam("snstuff_proposals_ajax_link"),
|
||||
|
||||
// ajaxBlock: "/ajax_block",
|
||||
// ajaxLink: "/ajax_link",
|
||||
proposalsFrame: undefined,
|
||||
proposalsFrameBody: undefined,
|
||||
proposalsFrameId: Math.round(Math.random()*1000),
|
||||
|
||||
running: false,
|
||||
cancel: function(){
|
||||
if(this.running){
|
||||
this.running = false;
|
||||
}
|
||||
},
|
||||
|
||||
findWord: function(ed, node,pos){
|
||||
running = true;
|
||||
var ntn = node;
|
||||
var word;
|
||||
var txt = node.nodeValue.substr(0,pos);
|
||||
word = txt.replace(/ $/,'').split(/ /).pop();
|
||||
if(word.length > 0){
|
||||
this.getProposals(ed,ntn, word, pos, false);
|
||||
}
|
||||
},// find word
|
||||
|
||||
findWordAll: function(ed){
|
||||
running = true;
|
||||
var wl = new Array();
|
||||
this._getContentWordList(ed.getBody(),wl);
|
||||
this.getProposals(ed,null,wl.join('+'),-1,true);
|
||||
},
|
||||
|
||||
getProposals: function(ed,node, word, pos, block){
|
||||
var po = this;
|
||||
if(!running){return;}
|
||||
|
||||
tinymce.util.XHR.send({
|
||||
url : block ? tinyMCE.activeEditor.getParam("snstuff_proposals_ajax_block", "/ajax_block")
|
||||
: tinyMCE.activeEditor.getParam("snstuff_proposals_ajax_link","/ajax_link"),
|
||||
content_type : "application/json",
|
||||
type : "POST",
|
||||
data : block ? "sn_msgbody="+escape(word) : "sn_key="+escape(word),
|
||||
async : true,
|
||||
scope : po,
|
||||
|
||||
success : function( data, req, o ) {
|
||||
var obj = tinymce.util.JSON.parse(data);
|
||||
po.showProposals(obj, ed, node, pos, block);
|
||||
},
|
||||
|
||||
error : function( type, req, o ){ alert("ERROR:"+type+"\n"+req+" - "+o);}
|
||||
});
|
||||
},
|
||||
|
||||
closeWin: function(){
|
||||
this.cancel();
|
||||
if(this.proposalsFrame && this.proposalsFrame.style.display != 'none'){
|
||||
this.proposalsFrame.style.display = 'none';
|
||||
}
|
||||
},
|
||||
showProposals:function(obj, ed, node, pos, block){
|
||||
if(!running){return;}
|
||||
// remove used Lnk
|
||||
tinymce.grep(ed.dom.select("a"), function(n) {
|
||||
var h = n.getAttributeNode('href');
|
||||
if(h != null){
|
||||
var v = h.nodeValue;
|
||||
for(var e in obj){
|
||||
if(v == obj[e].Link){
|
||||
delete obj[e];
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if(!this.proposalsFrame){this._buildFrame();}
|
||||
|
||||
var pf = this.proposalsFrameBody;
|
||||
while(pf.hasChildNodes()){
|
||||
pf.removeChild(pf.firstChild);
|
||||
}
|
||||
if(!obj){return;}
|
||||
for(var i = 0; i < obj.length; i++){
|
||||
if(!obj[i]){continue;}
|
||||
|
||||
var o = obj[i];
|
||||
var bgColor = (i%2 == 0) ? "#FFFAB3":"#FFFE9A";
|
||||
var root = this._buildHTMLElement("DIV","lnkBody_"+i,"border-bottom:black 1px solid;background-color:"+bgColor);
|
||||
var lnk = this._buildHTMLElement("IMG","lnkLnk_"+i,"float:right;cursor:pointer");
|
||||
var desc = this._buildHTMLElement("DIV", "lnkDesc_"+i, "",o.Comment);
|
||||
var prevLnk = this._buildHTMLElement("A","lnkPrevLnk_"+i,"", o.Link);
|
||||
var keyword = this._buildHTMLElement("DIV","lnkKeyWord_"+i, "font-weight:bold", o.Key);
|
||||
var small = this._buildHTMLElement("SMALL","lnkSmall_"+i);
|
||||
small.appendChild(prevLnk);
|
||||
lnk.src = this.url+"/images/add.png";
|
||||
lnk.alt = "Link einfügen";
|
||||
lnk.title = "Das Wort \""+o.Key+"\" im Text verlinken";
|
||||
prevLnk.href = o.Link;
|
||||
prevLnk.target = "blank";
|
||||
|
||||
root.appendChild(keyword); keyword.appendChild(lnk); root.appendChild(desc);root.appendChild(small);
|
||||
this._setOnclickEvent(lnk, {obj:o,block:block,ed:ed,node:node,pos:pos});
|
||||
pf.appendChild(root);
|
||||
}
|
||||
if(this.proposalsFrameBody.hasChildNodes()){
|
||||
this.proposalsFrame.style.display = "block";
|
||||
}
|
||||
},
|
||||
_setOnclickEvent:function(lnk, o){
|
||||
var p = this;
|
||||
lnk.onclick = function(){p._insertAction(o,this)};
|
||||
},
|
||||
_insertAction:function(o,fn){
|
||||
if(!o.block){
|
||||
this._insertLink(o);
|
||||
this.closeWin();
|
||||
}else{
|
||||
var fw = this._findWord(o.ed.getBody(),o.obj.Key);
|
||||
if(fw){
|
||||
this._insertLink(fw.node,fw.pos,o.obj.Link,o.ed);
|
||||
var pe = fn.parentNode.parentNode;
|
||||
pe.parentNode.removeChild(pe);
|
||||
if(!this.proposalsFrameBody.hasChildNodes()){
|
||||
this.proposalsFrame.style.display = "none";
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
_insertLink: function(o){
|
||||
var node = o.node; var pos = o.pos; var lnk = o.obj.Link; var ed = o.ed;
|
||||
|
||||
var nv = node.nodeValue;
|
||||
var pre = nv.substring(0,pos).replace(/ $/,'').split(/ /);
|
||||
var post = " "+nv.substr(pos);
|
||||
var w = pre.pop();
|
||||
var a = ed.getDoc().createElement('A');
|
||||
var ha = ed.getDoc().createAttribute("href");
|
||||
var tit = ed.getDoc().createAttribute("title");
|
||||
|
||||
tit.nodeValue=o.obj.Comment;
|
||||
ha.nodeValue = lnk;
|
||||
a.setAttributeNode(ha);
|
||||
a.setAttributeNode(tit);
|
||||
a.appendChild(ed.getDoc().createTextNode(w));
|
||||
|
||||
var pnode = node.parentNode;
|
||||
|
||||
tinyMCE.execCommand("mceBeginUndoLevel");
|
||||
pnode.insertBefore(ed.getDoc().createTextNode(pre.join(' ')+' '),node);
|
||||
pnode.insertBefore(a,node);
|
||||
pnode.insertBefore(ed.getDoc().createTextNode(post),node);
|
||||
pnode.removeChild(node);
|
||||
tinyMCE.execCommand("mceEndUndoLevel");
|
||||
ed.focus();
|
||||
ed.selection.select(a);
|
||||
ed.selection.collapse();
|
||||
},
|
||||
|
||||
_findWord: function(doc, word){
|
||||
var node = doc;
|
||||
var w;
|
||||
while(node != null){
|
||||
if(node.nodeType == 1 && node.nodeName != "A"){
|
||||
w = this._findWord(node.firstChild,word);
|
||||
if(w){ return w;}
|
||||
}
|
||||
|
||||
if(node.nodeType == 3){
|
||||
var txt = node.nodeValue.toLowerCase();
|
||||
var p = txt.indexOf(word.toLowerCase());
|
||||
if(p != -1){
|
||||
return {pos:p+word.length, node: node};
|
||||
}
|
||||
}
|
||||
node = node.nextSibling;
|
||||
}
|
||||
return w;
|
||||
},
|
||||
|
||||
_getContentWordList: function(doc, wlist){
|
||||
var node = doc;
|
||||
|
||||
while(node != null){
|
||||
if(node.nodeType == 1 && node.nodeName != "A"){
|
||||
this._getContentWordList(node.firstChild, wlist);
|
||||
}
|
||||
|
||||
if(node.nodeType == 3){
|
||||
var lst = node.nodeValue.split(/ /);
|
||||
while(lst.length > 0){
|
||||
var s = lst.pop().replace(/\s/g,"");
|
||||
if(s != ""){
|
||||
wlist.push(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
node = node.nextSibling;
|
||||
}
|
||||
},
|
||||
///////////////////////
|
||||
_buildFrame: function(){
|
||||
var container = tinyMCE.activeEditor.getContentAreaContainer();
|
||||
var ot = container.offsetTop;
|
||||
var ol = container.offsetLeft + container.offsetWidth;
|
||||
|
||||
if(document.getElementsByTagName("body")[0].offsetWidth < ol+355){
|
||||
ol = document.getElementsByTagName("body")[0].offsetWidth - 360;
|
||||
}
|
||||
|
||||
var pa = (document.all) ? "absolute":"fixed";
|
||||
|
||||
var p = this._buildHTMLElement("DIV", "proposalsFrame","position:"+pa+";width:350px;left:"+ol+"px;top:"+ot+"px;padding:5px;background-color:#FFFE9A;border:solid black 1px;");
|
||||
var h = this._buildHTMLElement("DIV", "proposalsFrameHead","border-bottom:black 1px solid;font-weight:bold;background-color:#FFF27A;cursor:pointer;padding:2px;","Tipps zum Thema");
|
||||
var b = this._buildHTMLElement("DIV", "proposalsFrameBody","min-height:100px;max-height:300px;overflow:auto;padding:5px;");
|
||||
var c = this._buildHTMLElement("IMG", "proposalsFrameClose","float:right");
|
||||
|
||||
|
||||
h.onmousedown = function(){
|
||||
var p = this.parentNode;
|
||||
var ox,oy;
|
||||
this.onmouseup = function(){p.onmousemove = function(){}; p.onmouseout = function(){}}
|
||||
var m = function(ev){
|
||||
var px = (!ev) ? window.event.clientX : ev.pageX;var py = (!ev) ? window.event.clientY : ev.pageY;
|
||||
if(!ox){oy = py - parseInt(this.style.top); ox = px - parseInt(this.style.left); }
|
||||
this.style.left = (px-ox)+"px"; this.style.top = (py-oy)+"px";
|
||||
return false;
|
||||
}
|
||||
p.onmousemove = m;p.onmouseout = m;
|
||||
return false;
|
||||
}
|
||||
|
||||
var me = this;
|
||||
c.onclick = function(){me.closeWin()};
|
||||
|
||||
c.alt = "X";
|
||||
c.src = this.url+'/images/close.png';
|
||||
c.alt = "Fenster schlissen";
|
||||
c.title = "Fenster schliessen";
|
||||
|
||||
h.insertBefore(c,h.firstChild);
|
||||
p.appendChild(h); p.appendChild(b)
|
||||
|
||||
this.proposalsFrame = p;
|
||||
this.proposalsFrameBody = b;
|
||||
|
||||
document.getElementsByTagName("body")[0].appendChild(p);
|
||||
},
|
||||
|
||||
_buildHTMLElement: function(n, id, style, txt){
|
||||
var e = document.createElement(n);
|
||||
var an = document.createAttribute("id");
|
||||
an.nodeValue = id+"_"+this.proposalsFrameId;
|
||||
var clazz = document.createAttribute("class");
|
||||
clazz.nodeValue = id;
|
||||
e.setAttributeNode(clazz);
|
||||
e.setAttributeNode(an);
|
||||
|
||||
e.style.cssText = style;
|
||||
if(txt){ e.appendChild( document.createTextNode(txt)); }
|
||||
return e;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
function handleSNCode(ed, url){
|
||||
var enode = ed.selection.getNode();
|
||||
var sel = ed.selection.getContent();
|
||||
var isBlock = (enode != null && enode.nodeName == 'CODE');
|
||||
|
||||
if(isBlock){
|
||||
|
||||
// Remove element
|
||||
if(enode.nodeName == 'CODE'){
|
||||
tinyMCE.execCommand("mceBeginUndoLevel");
|
||||
i = ed.selection.getBookmark();
|
||||
ed.dom.remove(enode, 1);
|
||||
ed.selection.moveToBookmark(i);
|
||||
tinyMCE.execCommand("mceEndUndoLevel");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
tinyMCE.execCommand("mceBeginUndoLevel");
|
||||
|
||||
if(sel.length == 0 ){
|
||||
|
||||
ed.windowManager.open({
|
||||
file : url + '/html/code.html',
|
||||
width : 410 + parseInt(ed.getLang('snstuff.snlink_delta_width', 0)),
|
||||
height : 480 + parseInt(ed.getLang('snstuff.snlink_delta_height', 0)),
|
||||
inline : 1
|
||||
}, {
|
||||
plugin_url : url
|
||||
});
|
||||
}else{
|
||||
ed.execCommand('mceInsertContent', false, '<code>'+ed.selection.getContent()+'</code>', {skip_undo : 1});
|
||||
}
|
||||
tinyMCE.execCommand("mceEndUndoLevel");
|
||||
|
||||
}
|
||||
|
||||
function handleSNQuote(ed, url){
|
||||
var enode = ed.selection.getNode();
|
||||
var sel = ed.selection.getContent();
|
||||
var isBlock = (enode != null && enode.nodeName == 'BLOCKQUOTE');
|
||||
|
||||
if(isBlock){
|
||||
|
||||
// Remove element
|
||||
if(enode.nodeName == 'BLOCKQUOTE'){
|
||||
tinyMCE.execCommand("mceBeginUndoLevel");
|
||||
i = ed.selection.getBookmark();
|
||||
ed.dom.remove(enode, 1);
|
||||
ed.selection.moveToBookmark(i);
|
||||
tinyMCE.execCommand("mceEndUndoLevel");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
tinyMCE.execCommand("mceBeginUndoLevel");
|
||||
|
||||
if(sel.length == 0 ){
|
||||
|
||||
ed.windowManager.open({
|
||||
file : url + '/html/quote.html',
|
||||
width : 410 + parseInt(ed.getLang('snstuff.snquote_delta_width', 0)),
|
||||
height : 450 + parseInt(ed.getLang('snstuff.snquote_delta_height', 0)),
|
||||
inline : 1
|
||||
}, {
|
||||
plugin_url : url
|
||||
});
|
||||
}else{
|
||||
ed.execCommand('mceInsertContent', false, '<blockquote>'+ed.selection.getContent()+'</blockquote>', {skip_undo : 1});
|
||||
}
|
||||
tinyMCE.execCommand("mceEndUndoLevel");
|
||||
|
||||
}
|
||||
|
||||
|
||||
function handleSNInfoBox(ed, url){
|
||||
var enode = ed.selection.getNode();
|
||||
var sel = ed.selection.getContent();
|
||||
|
||||
ed.windowManager.open({
|
||||
file : url + '/html/infobox.html',
|
||||
width : 250+ parseInt(ed.getLang('snstuff.snquote_delta_width', 0)),
|
||||
height : 100 + parseInt(ed.getLang('snstuff.snquote_delta_height', 0)),
|
||||
inline : 1
|
||||
}, {
|
||||
node: enode,
|
||||
plugin_url : url
|
||||
});
|
||||
}
|
||||
|
||||
function handleSNInfoBoxHead(ed, url){
|
||||
var enode = ed.dom.getParent(ed.selection.getNode(), function(n) {return ed.dom.hasClass(n, "snInfoBoxHead");})
|
||||
var sel = ed.selection.getContent();
|
||||
|
||||
tinyMCE.execCommand("mceBeginUndoLevel");
|
||||
if(sel.length > 0){
|
||||
ed.execCommand('mceInsertRawHTML', false, '<span id="__snInfoBoxHeadTmp">'+ed.selection.getContent()+'</span>',{skip_undo : 1});
|
||||
ed.dom.setAttribs('__snInfoBoxHeadTmp', {style:"", class:"snInfoBoxHead"});
|
||||
ed.dom.setAttrib('__snInfoBoxHeadTmp', 'id', '');
|
||||
}else{
|
||||
i = ed.selection.getBookmark();
|
||||
ed.dom.remove(enode, 1);
|
||||
ed.selection.moveToBookmark(i);
|
||||
}
|
||||
tinyMCE.execCommand("mceEndUndoLevel");
|
||||
}
|
||||
/////////////////////////////////////////////////
|
||||
|
||||
SNStuffContentCounter = {
|
||||
elm: Array(),
|
||||
|
||||
isInit:false,
|
||||
init: function(ed){
|
||||
|
||||
var elm = ed.getParam("snstuff_contentcounter","").replace(/ /g,"").split(",");
|
||||
for(var e = 0; e < elm.length; e++){
|
||||
var l = new Object();
|
||||
|
||||
var cv = ed.getParam("snstuff_charcolor_"+elm[e],"none").replace(/ /g,"");
|
||||
|
||||
if(cv != "none"){
|
||||
var a = new Array();
|
||||
cc = cv.split(",");
|
||||
for(var cci = 0; cci < cc.length; cci++){
|
||||
var v = cc[cci].split(":");
|
||||
a.push({v:v[0],c:v[1]});
|
||||
}
|
||||
l.c = a.sort(function(a,b){return a.v-b.v});
|
||||
}
|
||||
|
||||
var wv = ed.getParam("snstuff_wordcolor_"+elm[e],"none").replace(/ /g,"");
|
||||
|
||||
if(wv != "none"){
|
||||
var a = new Array();
|
||||
wc = wv.split(",");
|
||||
for(var wci = 0; wci < wc.length; wci++){
|
||||
var v = wc[wci].split(":");
|
||||
a.push({v:v[0],c:v[1]});
|
||||
}
|
||||
l.w = a.sort(function(a,b){return a.v-b.v});
|
||||
}
|
||||
|
||||
this.elm[elm[e]] = l;
|
||||
|
||||
}
|
||||
|
||||
this.isInit = true;
|
||||
},
|
||||
|
||||
counter : function(ed,e){
|
||||
if(!SNStuffContentCounter.isInit){
|
||||
SNStuffContentCounter.init(ed);
|
||||
}
|
||||
if(SNStuffContentCounter.elm[ed.id]){
|
||||
var c = ed.getContent().replace(/<br \/>/g," ").replace(/<.+?>/g,"").replace(/ {1,}/g," ").replace(/^ | $/g,"");
|
||||
var cl = c.length;
|
||||
var wl = c.split(" ").length;
|
||||
var p = tinymce.DOM.get(ed.id + '_path_row');
|
||||
html = "";
|
||||
|
||||
var cvl = SNStuffContentCounter.elm[ed.id];
|
||||
if(cvl.c){
|
||||
var col = "";
|
||||
for(var i = 0; i < cvl.c.length; i++){
|
||||
if(cl > cvl.c[i].v){
|
||||
col = "color:"+cvl.c[i].c;
|
||||
}
|
||||
}
|
||||
html += ' <span style="'+col+'"> Zeichen:'+cl+' </span> ';
|
||||
}
|
||||
|
||||
if(cvl.w){
|
||||
|
||||
var col = "";
|
||||
for(var i = 0; i < cvl.w.length; i++){
|
||||
if(wl > cvl.w[i].v){
|
||||
col = "color:"+cvl.w[i].c;
|
||||
}
|
||||
}
|
||||
html += ' <span style="'+col+'"> Wörter:'+wl+' </span> ';
|
||||
}
|
||||
tinymce.DOM.setHTML(p,html);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
32
sn_templates/editor_stuff/plugin/snstuff/html/code.html
Normal file
@@ -0,0 +1,32 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>{#snstuff_dlg.code_title}</title>
|
||||
<script type="text/javascript" src="../../../tiny_mce_popup.js"></script>
|
||||
<!-- <script type="text/javascript" src="../../../utils/mctabs.js"></script> -->
|
||||
<script type="text/javascript" src="../../../utils/form_utils.js"></script>
|
||||
<script type="text/javascript" src="../../../utils/validate.js"></script>
|
||||
<script type="text/javascript" src="../js/sncode.js"></script>
|
||||
<!-- <link href="css/snlink.css" rel="stylesheet" type="text/css" /> -->
|
||||
</head>
|
||||
<body id="advlink" style="display: none">
|
||||
<form onsubmit="insertAction();return false;" action="#">
|
||||
<div class="panel">
|
||||
<fieldset>
|
||||
<legend>{#snstuff_dlg.code_general_props}</legend>
|
||||
|
||||
<textarea id="text" rows="30" cols="60"></textarea>
|
||||
</fieldset>
|
||||
</div>
|
||||
<div class="mceActionPanel">
|
||||
<div style="float: left">
|
||||
<input type="submit" id="insert" name="insert" value="{#insert}" />
|
||||
</div>
|
||||
|
||||
<div style="float: right">
|
||||
<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
117
sn_templates/editor_stuff/plugin/snstuff/html/image.html
Normal file
@@ -0,0 +1,117 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>{#snstuff_dlg.img_dialog_title}</title>
|
||||
<script type="text/javascript" src="../../../tiny_mce_popup.js"></script>
|
||||
<!-- <script type="text/javascript" src="../../../utils/mctabs.js"></script> -->
|
||||
<script type="text/javascript" src="../../../utils/form_utils.js"></script>
|
||||
<!-- <script type="text/javascript" src="../../../utils/validate.js"></script> -->
|
||||
<script type="text/javascript" src="../../../utils/editable_selects.js"></script>
|
||||
|
||||
<script type="text/javascript" src="../js/config.js"></script>
|
||||
<script type="text/javascript" src="../js/image.js"></script>
|
||||
|
||||
<link href="../css/default.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body id="snimages" style="display: none">
|
||||
|
||||
<div class="panel_wrapper">
|
||||
|
||||
<iframe id="actionTarget" name="actionTarget" style="width:1px; height:1px; visibility:hidden" onload="ImageDialog.actionStop()"></iframe>
|
||||
<div id="general_panel" class="panel current">
|
||||
|
||||
<form id="uploadForm" name="uploadForm" enctype="multipart/form-data" action="" method="post" target="actionTarget" onsubmit="ImageDialog.uploadStart()">
|
||||
<fieldset>
|
||||
<legend>{#snstuff_dlg.img_tab_upload}</legend>
|
||||
|
||||
<img id="waitImg" src="../images/wait.gif" style="float:right; visibility:hidden">
|
||||
|
||||
<table border="0" cellpadding="4" cellspacing="0">
|
||||
<tr>
|
||||
<td><lable for="input_filed">{#snstuff_dlg.img_imagefile_select}</lable>
|
||||
<input id="fileField" name="sn_filename" type="file">
|
||||
</td>
|
||||
<td>
|
||||
<input id="uploadSubmit" type="submit" value="{#snstuff_dlg.img_imagefile_sndbtn}">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
</fieldset>
|
||||
</form>
|
||||
<br>
|
||||
<fieldset>
|
||||
<legend>{#snstuff_dlg.img_general}</legend>
|
||||
|
||||
<table class="properties">
|
||||
<!-- <tr rowspan="2">
|
||||
<td class="column1"><label id="srclabel" for="src">{#snstuff_dlg.src}</label></td>
|
||||
<td>
|
||||
<table border="0" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td><input name="src" disabled type="text" id="src" value="" class="mceFocus" onchange="ImageDialog.showPreviewImage(this.value);" /></td>
|
||||
<td id="srcbrowsercontainer"> </td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>-->
|
||||
<tr>
|
||||
<td colspan="2"><label for="src_list">{#snstuff_dlg.img_image_list}</label></td>
|
||||
<td colspan="2"><select id="src_list" name="src_list" onchange="ImageDialog.srcListAction( this.value );"><option value="">Lade Medienliste...</option></select></td>
|
||||
</tr>
|
||||
<tr id="pic">
|
||||
<td colspan="2">
|
||||
<label id="l_src_list_size" for="src_list_size">{#snstuff_dlg.img_pic_select}</label>
|
||||
<label id="l_src_list_vpic" for="src_list_vid_pic">{#snstuff_dlg.img_vpic_select}</label>
|
||||
</td>
|
||||
<td colspan="2">
|
||||
<span id="src_list_size_elm">{#snstuff_dlg.img_pic_show}<select id="src_list_size" name="src_list_size" onchange="ImageDialog.media1Action(this.value)"><option value=""></option></select></span>
|
||||
<span id="src_list_size_full_elm">{#snstuff_dlg.img_pic_show_full}<select id="src_list_size_full" name="src_list_size_full" onchange="ImageDialog.media2Action( this.value)"><option value=""></option></select></span>
|
||||
<span id="src_list_vid_pic_elm">
|
||||
{#snstuff_dlg.img_video_pic}<select id="src_list_vid_pic" name="src_list_vid_pic" onchange="ImageDialog.media1Action(this.value)"><option value=""></option></select>
|
||||
{#snstuff_dlg.img_width} <input id="video_width" name="video_width" type="text" size="4">
|
||||
{#snstuff_dlg.img_height} <input id="video_height" name="video_height" type="text" size="4">
|
||||
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" class="column1"><label id="alignlabel" for="align">{#snstuff_dlg.img_align}</label></td>
|
||||
<td>
|
||||
<select id="align" name="align" onchange="">
|
||||
<option value="none">{#snstuff_dlg.img_align_none}</option>
|
||||
<option value="left">{#snstuff_dlg.img_align_left}</option>
|
||||
<option value="right">{#snstuff_dlg.img_align_right}</option>
|
||||
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
<input id="imgDelBtn" type="button" value="{#snstuff_dlg.img_imagedelete}" onclick="ImageDialog.doDeleteImg()" disabled>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</fieldset>
|
||||
<br>
|
||||
<fieldset>
|
||||
<legend>{#snstuff_dlg.img_preview}</legend>
|
||||
<div id="prev"></div>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="mceActionPanel">
|
||||
<div style="float: left">
|
||||
<input type="button" id="insert" name="insert" value="{#insert}" onclick="ImageDialog.insert();" />
|
||||
</div>
|
||||
|
||||
<div style="float: right">
|
||||
<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
|
||||
</div>
|
||||
</div>
|
||||
<!-- </form> -->
|
||||
<iframe name="upload_target" style="position:absolute;top:-999; left-999;border: 0;width: 0px;height: 0px;" onload=""></iframe>
|
||||
</body>
|
||||
</html>
|
108
sn_templates/editor_stuff/plugin/snstuff/html/image_bk.html
Normal file
@@ -0,0 +1,108 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>{#snstuff_dlg.img_dialog_title}</title>
|
||||
<script type="text/javascript" src="../../../tiny_mce_popup.js"></script>
|
||||
<!-- <script type="text/javascript" src="../../../utils/mctabs.js"></script> -->
|
||||
<script type="text/javascript" src="../../../utils/form_utils.js"></script>
|
||||
<script type="text/javascript" src="../../../utils/validate.js"></script>
|
||||
<script type="text/javascript" src="../../../utils/editable_selects.js"></script>
|
||||
|
||||
<script type="text/javascript" src="../js/config.js"></script>
|
||||
<script type="text/javascript" src="../js/image.js"></script>
|
||||
|
||||
<link href="../css/default.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body id="snimages" style="display: none">
|
||||
|
||||
<div class="panel_wrapper">
|
||||
|
||||
<iframe id="actionTarget" name="actionTarget" style="width:1px; height:1px; visibility:hidden" onload="ImageDialog.actionStop()"></iframe>
|
||||
<div id="general_panel" class="panel current">
|
||||
|
||||
<form id="uploadForm" name="uploadForm" enctype="multipart/form-data" action="" method="post" target="actionTarget" onsubmit="ImageDialog.uploadStart()">
|
||||
<fieldset>
|
||||
<legend>{#snstuff_dlg.img_tab_upload}</legend>
|
||||
|
||||
<img id="waitImg" src="../images/wait.gif" style="float:right; visibility:hidden">
|
||||
|
||||
<table border="0" cellpadding="4" cellspacing="0">
|
||||
<tr>
|
||||
<td><lable for="input_filed">{#snstuff_dlg.img_imagefile_select}</lable>
|
||||
<input id="fileField" name="sn_filename" type="file">
|
||||
</td>
|
||||
<td>
|
||||
<input id="uploadSubmit" type="submit" value="{#snstuff_dlg.img_imagefile_sndbtn}">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
</fieldset>
|
||||
</form>
|
||||
<br>
|
||||
<fieldset>
|
||||
<legend>{#snstuff_dlg.img_general}</legend>
|
||||
|
||||
<table class="properties">
|
||||
<!-- <tr rowspan="2">
|
||||
<td class="column1"><label id="srclabel" for="src">{#snstuff_dlg.src}</label></td>
|
||||
<td>
|
||||
<table border="0" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td><input name="src" disabled type="text" id="src" value="" class="mceFocus" onchange="ImageDialog.showPreviewImage(this.value);" /></td>
|
||||
<td id="srcbrowsercontainer"> </td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>-->
|
||||
<tr>
|
||||
<td colspan="2"><label for="src_list">{#snstuff_dlg.img_image_list}</label></td>
|
||||
<td colspan="2"><select id="src_list" name="src_list" onchange="ImageDialog.showImageSizeList(this);"><option value=""></option></select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2"><label for="src_list_size">Size{#snstuff_dlg.img_image_list}</label></td>
|
||||
<td colspan="2">
|
||||
<select id="src_list_size" name="src_list_size" onchange="ImageDialog.showSelectedImage(this)"><option value=""></option></select>
|
||||
<select id="src_list_size_full" name="src_list_size_full" onchange=""><option value=""></option></select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" class="column1"><label id="alignlabel" for="align">{#snstuff_dlg.img_align}</label></td>
|
||||
<td>
|
||||
<select id="align" name="align" onchange="ImageDialog.updateStyle('align');ImageDialog.changeAppearance();">
|
||||
<option value="">{#snstuff_dlg.img_align_none}</option>
|
||||
<option value="left">{#snstuff_dlg.img_align_left}</option>
|
||||
<option value="right">{#snstuff_dlg.img_align_right}</option>
|
||||
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
<input id="imgDelBtn" type="button" value="{#snstuff_dlg.img_imagedelete}" onclick="ImageDialog.doDeleteImg()" disabled>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</fieldset>
|
||||
<br>
|
||||
<fieldset>
|
||||
<legend>{#snstuff_dlg.img_preview}</legend>
|
||||
<div id="prev"></div>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="mceActionPanel">
|
||||
<div style="float: left">
|
||||
<input type="button" id="insert" name="insert" value="{#insert}" onclick="ImageDialog.insert();" />
|
||||
</div>
|
||||
|
||||
<div style="float: right">
|
||||
<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
|
||||
</div>
|
||||
</div>
|
||||
<!-- </form> -->
|
||||
<iframe name="upload_target" style="position:absolute;top:-999; left-999;border: 0;width: 0px;height: 0px;" onload=""></iframe>
|
||||
</body>
|
||||
</html>
|
41
sn_templates/editor_stuff/plugin/snstuff/html/infobox.html
Normal file
@@ -0,0 +1,41 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>{#snstuff_dlg.ibox_title}</title>
|
||||
<script type="text/javascript" src="../../../tiny_mce_popup.js"></script>
|
||||
<!-- <script type="text/javascript" src="../../../utils/mctabs.js"></script> -->
|
||||
<script type="text/javascript" src="../../../utils/form_utils.js"></script>
|
||||
<script type="text/javascript" src="../../../utils/validate.js"></script>
|
||||
<script type="text/javascript" src="../js/infobox.js"></script>
|
||||
<!-- <link href="css/snlink.css" rel="stylesheet" type="text/css" /> -->
|
||||
</head>
|
||||
<body style="display: none">
|
||||
<form onsubmit="insertAction();return false;" action="#">
|
||||
<div class="panel">
|
||||
<fieldset>
|
||||
<legend>{#snstuff_dlg.ibox_general_props}</legend>
|
||||
|
||||
<table border="0" cellpadding="4" cellspacing="0">
|
||||
<tr><td>{#snstuff_dlg.ibox_input_size}<input type="text" name="size" size="5" value="100">px</td>
|
||||
<td>{#snstuff_dlg.ibox_input_float}
|
||||
<select name="float">
|
||||
<option value="left">{#snstuff_dlg.ibox_fopt_left}</option>
|
||||
<option value="right">{#snstuff_dlg.ibox_fopt_right}</option>
|
||||
</select>
|
||||
</td></tr>
|
||||
|
||||
</table>
|
||||
</fieldset>
|
||||
</div>
|
||||
<div class="mceActionPanel">
|
||||
<div style="float: left">
|
||||
<input type="submit" id="insert" name="insert" value="{#insert}" />
|
||||
</div>
|
||||
|
||||
<div style="float: right">
|
||||
<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
36
sn_templates/editor_stuff/plugin/snstuff/html/link.html
Normal file
@@ -0,0 +1,36 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>{#snstuff_dlg.lnk_title}</title>
|
||||
<script type="text/javascript" src="../../../tiny_mce_popup.js"></script>
|
||||
<!-- <script type="text/javascript" src="../../../utils/mctabs.js"></script> -->
|
||||
<script type="text/javascript" src="../../../utils/form_utils.js"></script>
|
||||
<script type="text/javascript" src="../../../utils/validate.js"></script>
|
||||
<script type="text/javascript" src="../js/snlink.js"></script>
|
||||
<!-- <link href="css/snlink.css" rel="stylesheet" type="text/css" /> -->
|
||||
</head>
|
||||
<body id="advlink" style="display: none">
|
||||
<form onsubmit="insertAction();return false;" action="#">
|
||||
<div class="panel">
|
||||
<fieldset>
|
||||
<legend>{#snstuff_dlg.lnk_general_props}</legend>
|
||||
|
||||
<table border="0" cellpadding="4" cellspacing="0">
|
||||
<tr style="float: right"><td>{#snstuff_dlg.lnk_field_url}</td><td><input id="urlField" type="text" size="45"></td></tr>
|
||||
<tr id="urlName" style="float: right"><td>{#snstuff_dlg.lnk_field_name}</td><td><input id="nameField" type="text" size="45"></td></tr>
|
||||
<tr id="urlDescription" style="float: right"><td>{#snstuff_dlg.lnk_field_desc}</td><td><input id="descField" type="text" size="45"></td></tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
</div>
|
||||
<div class="mceActionPanel">
|
||||
<div style="float: left">
|
||||
<input type="submit" id="insert" name="insert" value="{#insert}" />
|
||||
</div>
|
||||
|
||||
<div style="float: right">
|
||||
<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
32
sn_templates/editor_stuff/plugin/snstuff/html/quote.html
Normal file
@@ -0,0 +1,32 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>{#snstuff_dlg.quote_title}</title>
|
||||
<script type="text/javascript" src="../../../tiny_mce_popup.js"></script>
|
||||
<!-- <script type="text/javascript" src="../../../utils/mctabs.js"></script> -->
|
||||
<script type="text/javascript" src="../../../utils/form_utils.js"></script>
|
||||
<script type="text/javascript" src="../../../utils/validate.js"></script>
|
||||
<script type="text/javascript" src="../js/snquote.js"></script>
|
||||
<!-- <link href="css/snlink.css" rel="stylesheet" type="text/css" /> -->
|
||||
</head>
|
||||
<body id="advlink" style="display: none">
|
||||
<form onsubmit="insertAction();return false;" action="#">
|
||||
<div class="panel">
|
||||
<fieldset>
|
||||
<legend>{#snstuff_dlg.qoute_general_props}</legend>
|
||||
|
||||
<textarea id="text" rows="30" cols="60"></textarea>
|
||||
</fieldset>
|
||||
</div>
|
||||
<div class="mceActionPanel">
|
||||
<div style="float: left">
|
||||
<input type="submit" id="insert" name="insert" value="{#insert}" />
|
||||
</div>
|
||||
|
||||
<div style="float: right">
|
||||
<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
BIN
sn_templates/editor_stuff/plugin/snstuff/images/add.png
Normal file
After Width: | Height: | Size: 907 B |
BIN
sn_templates/editor_stuff/plugin/snstuff/images/close.png
Normal file
After Width: | Height: | Size: 842 B |
BIN
sn_templates/editor_stuff/plugin/snstuff/images/code-context.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
sn_templates/editor_stuff/plugin/snstuff/images/insert-image.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
sn_templates/editor_stuff/plugin/snstuff/images/insert-link.png
Normal file
After Width: | Height: | Size: 5.3 KiB |
BIN
sn_templates/editor_stuff/plugin/snstuff/images/player.png
Normal file
After Width: | Height: | Size: 2.1 KiB |
BIN
sn_templates/editor_stuff/plugin/snstuff/images/proposals.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
sn_templates/editor_stuff/plugin/snstuff/images/quote.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
sn_templates/editor_stuff/plugin/snstuff/images/textinfo.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
BIN
sn_templates/editor_stuff/plugin/snstuff/images/trans.gif
Normal file
After Width: | Height: | Size: 43 B |
BIN
sn_templates/editor_stuff/plugin/snstuff/images/video.png
Normal file
After Width: | Height: | Size: 2.5 KiB |
BIN
sn_templates/editor_stuff/plugin/snstuff/images/wait.gif
Normal file
After Width: | Height: | Size: 6.6 KiB |
BIN
sn_templates/editor_stuff/plugin/snstuff/images/window-new.png
Normal file
After Width: | Height: | Size: 680 B |
69
sn_templates/editor_stuff/plugin/snstuff/js/code.js
Normal file
@@ -0,0 +1,69 @@
|
||||
/* Functions for the advlink plugin popup */
|
||||
|
||||
tinyMCEPopup.requireLangPack();
|
||||
|
||||
function preinit() {
|
||||
var url;
|
||||
|
||||
if (url = tinyMCEPopup.getParam("external_link_list_url"))
|
||||
document.write('<script language="javascript" type="text/javascript" src="' + tinyMCEPopup.editor.documentBaseURI.toAbsolute(url) + '"></script>');
|
||||
}
|
||||
|
||||
function init() {
|
||||
|
||||
var formObj = document.forms[0];
|
||||
var ed = tinyMCEPopup.editor;
|
||||
var node = ed.selection.getNode();
|
||||
|
||||
node = ed.dom.getParent(node, "A");
|
||||
|
||||
if(node != null && typeof node != 'undefined' && node.nodeName == 'A'){
|
||||
formObj.insert.value = tinyMCEPopup.getLang('update', 'Insert', true);
|
||||
|
||||
var url = ed.dom.getAttrib(node,"href");
|
||||
var txt = node.firstChild.nodeValue;
|
||||
|
||||
formObj.urlField.value = url;
|
||||
formObj.descField.value = txt;
|
||||
}else{
|
||||
var selTxt = ed.selection.getContent();
|
||||
|
||||
if(isURL(selTxt)){
|
||||
formObj.urlField.value = selTxt.replace(/^\s*/,"");
|
||||
}
|
||||
if(selTxt.length > 0){
|
||||
document.getElementById("urlDescription").style.visibility = "hidden";
|
||||
}
|
||||
formObj.descField.value = selTxt;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
function insertAction() {
|
||||
var formObj = document.forms[0];
|
||||
var ed = tinyMCEPopup.editor;
|
||||
var node = ed.selection.getNode()
|
||||
|
||||
if (node && node.nodeName == 'A') {
|
||||
ed.dom.setAttrib(node, "href", document.getElementById("urlField").value);
|
||||
node.firstChild.nodeValue = document.getElementById("descField").value;
|
||||
}else {
|
||||
ed.execCommand('mceInsertContent', false, '<a href="'+formObj.urlField.value+'">'+formObj.descField.value+'</a>', {skip_undo : 1});
|
||||
ed.undoManager.add();
|
||||
}
|
||||
|
||||
tinyMCEPopup.close();
|
||||
}
|
||||
|
||||
function isURL(str){
|
||||
if(str.match(/^http(s){0,1}:\/\//) || str.match(/^\s*www.*\..+/)){
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// While loading
|
||||
preinit();
|
||||
tinyMCEPopup.onInit.add(init);
|
52
sn_templates/editor_stuff/plugin/snstuff/js/config.js
Normal file
@@ -0,0 +1,52 @@
|
||||
var Config = {
|
||||
|
||||
imageListUrl : "" ,
|
||||
uploadUrl : "" ,
|
||||
deleteUrl : "" ,
|
||||
imageUrl : "",
|
||||
artikelid : null ,
|
||||
pagetype : null,
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
getImageListUrl : function(){
|
||||
|
||||
var url = Config._replace( Config.imageListUrl );
|
||||
|
||||
return tinyMCEPopup.editor.documentBaseURI.toAbsolute(url);
|
||||
},
|
||||
|
||||
getUploadUrl : function(){
|
||||
|
||||
var url = Config._replace( Config.uploadUrl );
|
||||
|
||||
return tinyMCEPopup.editor.documentBaseURI.toAbsolute(url);
|
||||
},
|
||||
|
||||
getDeleteUrl : function(imgname){
|
||||
|
||||
var url = Config._replace( Config.deleteUrl );
|
||||
|
||||
url = url.replace(/\{imgname\}/g,imgname);
|
||||
return tinyMCEPopup.editor.documentBaseURI.toAbsolute(url);
|
||||
},
|
||||
|
||||
getImageUrl : function(imgname,nofull){
|
||||
|
||||
var url = Config._replace( Config.imageUrl );
|
||||
|
||||
url = url.replace(/\{imgname\}/g,imgname);
|
||||
return (nofull)?url:tinyMCEPopup.editor.documentBaseURI.toAbsolute(url);
|
||||
},
|
||||
|
||||
_replace : function(url){
|
||||
|
||||
if(Config.artikelid != null && typeof Config.artikelid != 'undefined'){
|
||||
url = url.replace(/\{artikelid\}/g,Config.artikelid);
|
||||
}
|
||||
if(Config.pagetype != null && typeof Config.pagetype != 'undefined'){
|
||||
url = url.replace(/\{pagetype\}/g,Config.pagetype);
|
||||
}
|
||||
return url;
|
||||
}
|
||||
|
||||
}
|
445
sn_templates/editor_stuff/plugin/snstuff/js/image.js
Normal file
@@ -0,0 +1,445 @@
|
||||
var ImageDialog = {
|
||||
preInit : function() {
|
||||
var url;
|
||||
|
||||
tinyMCEPopup.requireLangPack();
|
||||
|
||||
Config.artikelid = parent.entryid;
|
||||
Config.pagetype = parent.pagetype;
|
||||
//Config.imageListUrl = tinyMCEPopup.getParam("snstuff_img_url_list") || "/admin_list_pictures_json/{artikelid}";
|
||||
Config.imageListUrl = tinyMCEPopup.getParam("snstuff_img_url_list") || "{pagetype}?sx_action=on_image_list&id={artikelid}";
|
||||
//Config.uploadUrl = tinyMCEPopup.getParam("snstuff_img_url_upload") || "/{pagetype}/{artikelid}?sx_action=on_user_upload";
|
||||
Config.uploadUrl = tinyMCEPopup.getParam("snstuff_img_url_upload") || "{pagetype}?sx_action=on_image_upload&id={artikelid}";
|
||||
Config.deleteUrl = tinyMCEPopup.getParam("snstuff_img_url_delete") || "/admin_kill_picture?name=articleimage/sn_computer/{artikelid}/{imgname}&id={artikelid}";
|
||||
Config.imageUrl = tinyMCEPopup.getParam("snstuff_img_url_image") || "/on_image_preview/{artikelid}/{imgname}";
|
||||
|
||||
},
|
||||
|
||||
srcData:{},
|
||||
|
||||
selectedData:'',
|
||||
|
||||
srcMedia:'',
|
||||
media1:'',
|
||||
media2:'',
|
||||
|
||||
selM1:'',
|
||||
selM2:'',
|
||||
|
||||
videoW:undefined,
|
||||
videoH:undefined,
|
||||
|
||||
selBigges: true,
|
||||
isUploading: false,
|
||||
isDeleting: false,
|
||||
|
||||
init : function(ed) {
|
||||
|
||||
tinyMCEPopup.dom.get("uploadForm").action = Config.getUploadUrl();
|
||||
tinyMCEPopup.dom.get("src_list_vid_pic_elm").style.display = 'none';
|
||||
tinyMCEPopup.dom.get("l_src_list_size").style.display = 'none';
|
||||
tinyMCEPopup.dom.get("l_src_list_vpic").style.display = 'none';
|
||||
|
||||
var ed = tinyMCEPopup.editor, dom = ed.dom, n = ed.selection.getNode();
|
||||
|
||||
tinyMCEPopup.resizeToInnerSize();
|
||||
|
||||
TinyMCE_EditableSelects.init();
|
||||
|
||||
if ( n != null && typeof n != 'undefined' && n.nodeName == 'IMG') {
|
||||
this.selBigges = false;
|
||||
document.getElementById("insert").value = ed.getLang('update');
|
||||
var imgURL = dom.getAttrib(n, 'src');
|
||||
if(n.className == 'snVideo'){
|
||||
this.selM2 = dom.getAttrib(n, 'alt');
|
||||
this.videoW = dom.getAttrib(n, 'width');
|
||||
this.videoH = dom.getAttrib(n, 'height');
|
||||
this.selM1 = dom.getAttrib(n, 'title');
|
||||
}else{
|
||||
|
||||
this.selM2 = dom.getAttrib(n, 'alt')
|
||||
this.selM1 = imgURL.split('/').pop();
|
||||
|
||||
var a = 'none';
|
||||
if (ed.settings.inline_styles) {
|
||||
if (!(a = dom.getStyle(n, 'float'))){
|
||||
a = dom.getStyle(n, 'vertical-align')
|
||||
}
|
||||
}
|
||||
if(!a){
|
||||
a = dom.getAttrib(n, 'align');
|
||||
}
|
||||
var al = tinyMCEPopup.dom.get("align");
|
||||
a = a.replace(/ /g,'');
|
||||
for(var i = 0; i < al.length; i++){
|
||||
if(al.options[i].value == a)
|
||||
al.selectedIndex = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tinyMCEPopup.dom.get("video_width").value = this.videoW;
|
||||
tinyMCEPopup.dom.get("video_height").value = this.videoH;
|
||||
this.loadData();
|
||||
},
|
||||
|
||||
srcListAction: function(v){
|
||||
this.srcMedia = v;
|
||||
tinyMCEPopup.dom.get("src_list_size_elm").style.display = 'none';
|
||||
tinyMCEPopup.dom.get("src_list_size_full_elm").style.display = 'none';
|
||||
tinyMCEPopup.dom.get("src_list_vid_pic_elm").style.display = 'none';
|
||||
tinyMCEPopup.dom.get("l_src_list_size").style.display = 'none';
|
||||
tinyMCEPopup.dom.get("l_src_list_vpic").style.display = 'none';
|
||||
tinyMCEPopup.dom.get("align").disabled = true;
|
||||
|
||||
if(this.srcMedia.indexOf(':') == -1){
|
||||
this.previewData();
|
||||
return;
|
||||
}
|
||||
var on = this.srcMedia.split(':');
|
||||
|
||||
var lst = tinyMCEPopup.dom.get("src_list_size");
|
||||
var lst2 = tinyMCEPopup.dom.get("src_list_size_full");
|
||||
var lstv = tinyMCEPopup.dom.get("src_list_vid_pic");
|
||||
|
||||
lst.options.length = 0;lst2.options.length = 0; lstv.options.length = 0;
|
||||
|
||||
|
||||
|
||||
if(on[0] == 'pic'){
|
||||
tinyMCEPopup.dom.get("src_list_size_elm").style.display = 'inline';
|
||||
tinyMCEPopup.dom.get("src_list_size_full_elm").style.display = 'inline';
|
||||
tinyMCEPopup.dom.get("l_src_list_size").style.display = 'inline';
|
||||
|
||||
tinyMCEPopup.dom.get("align").disabled = false;
|
||||
var obj = this.srcData.pic[on[1]];
|
||||
var m = undefined, m2 = undefined;
|
||||
for(var i = 0; i < obj.subpic.length; i++){
|
||||
obj.subpic[i].width = parseInt(obj.subpic[i].width);
|
||||
obj.subpic[i].height = parseInt(obj.subpic[i].height);
|
||||
|
||||
|
||||
var fname = obj.subpic[i].name;
|
||||
var wh = obj.subpic[i].width + ' X '+ obj.subpic[i].height;
|
||||
if( obj.subpic[i].isOrig ){
|
||||
wh += '*';
|
||||
}
|
||||
|
||||
lst.options[lst.options.length] = new Option(wh, v+':'+i);
|
||||
lst2.options[lst2.options.length] = new Option(wh, v+':'+i);
|
||||
if(fname == this.selM1){lst.selectedIndex = lst.options.length-1;}
|
||||
if(fname == this.selM2){lst2.selectedIndex = lst2.options.length-1;}
|
||||
|
||||
if(this.selBigges){
|
||||
if(!m || m && (obj.subpic[i].width < m.width && obj.subpic[i].height < m.height)){
|
||||
lst.selectedIndex = lst.options.length-1;
|
||||
m = obj.subpic[i];
|
||||
}
|
||||
if(!m2 || m2 && (obj.subpic[i].width > m2.width && obj.subpic[i].height > m2.height)){
|
||||
lst2.selectedIndex = lst2.options.length-1;
|
||||
m2 = obj.subpic[i];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
this.selBigges = true;
|
||||
|
||||
lst.onchange();lst2.onchange();
|
||||
}
|
||||
if(on[0] == 'vid'){
|
||||
var obj = this.srcData.video[on[1]];
|
||||
tinyMCEPopup.dom.get("src_list_vid_pic_elm").style.display = 'inline';
|
||||
tinyMCEPopup.dom.get("video_width").value = this.videoW ? this.videoW:obj.width;
|
||||
tinyMCEPopup.dom.get("video_height").value = this.videoH ? this.videoH:obj.height;
|
||||
tinyMCEPopup.dom.get("l_src_list_vpic").style.display = 'inline';
|
||||
|
||||
for(var e in this.srcData.pic){
|
||||
var pl = this.srcData.pic[e].subpic;
|
||||
lstv.options[lstv.options.length] = new Option('','');
|
||||
for(var i = 0; i < pl.length; i++){
|
||||
lstv.options[lstv.options.length] = new Option(pl[i].name,'pic:'+e+':'+i);
|
||||
if(pl[i].name == this.selM2){lstv.selectedIndex = lstv.options.length-1;}
|
||||
}
|
||||
}
|
||||
lstv.onchange();
|
||||
}
|
||||
},
|
||||
|
||||
media1Action: function(v){
|
||||
this.media1 = v;
|
||||
this.previewData();
|
||||
},
|
||||
|
||||
media2Action: function(v){
|
||||
this.media2 = v;
|
||||
},
|
||||
|
||||
|
||||
previewData : function() {
|
||||
if (!this.srcMedia) {
|
||||
tinyMCEPopup.dom.setHTML('prev', '');
|
||||
document.getElementById("imgDelBtn").disabled = true;
|
||||
return;
|
||||
}
|
||||
var on;
|
||||
if(this.srcMedia.indexOf("vid:") != -1){
|
||||
on = this.srcMedia.split(':');
|
||||
}else{
|
||||
on = this.media1.split(':');
|
||||
}
|
||||
|
||||
var u; var html = '';
|
||||
if(on[0] == 'pic'){
|
||||
var p = this.srcData.pic[on[1]].subpic[on[2]];
|
||||
u = tinyMCEPopup.editor.documentBaseURI.toAbsolute(Config.getImageUrl(p.name,true));
|
||||
html = '<img id="previewImg" src="' + u + '" border="0" />';
|
||||
|
||||
}else{
|
||||
var o = this.srcData.video[on[1]];
|
||||
var fvars = "file="+Config.getImageUrl(o.name,true);
|
||||
if(this.media1 && this.media1.indexOf(':') != -1){
|
||||
var m2 = this.media1.split(':');
|
||||
fvars += "&image="+Config.getImageUrl(this.srcData.pic[m2[1]].subpic[m2[2]].name,true);
|
||||
}
|
||||
fvars +="&autoload=false";
|
||||
html = "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' width='350' height='280' id='"+o.name+"' name='"+o.name+"'>"
|
||||
+"<param name='movie' value='/video/player-viral.swf'><param name='allowfullscreen' value='false'><param name='play' value='false'>"
|
||||
+"<param name='flashvars' value='"+fvars+"'>"
|
||||
+"<embed type='application/x-shockwave-flash' id='"+o.name+"' name='"+o.name+"' src='/video/player-viral.swf' width='400' height='250' "
|
||||
+"allowscriptaccess='always' allowfullscreen='false' flashvars='"+fvars+"'/>"
|
||||
+"</object>";
|
||||
}
|
||||
document.getElementById("imgDelBtn").disabled = false
|
||||
tinyMCEPopup.dom.setHTML('prev', html);
|
||||
},
|
||||
|
||||
|
||||
insert:function(){
|
||||
var ed = tinyMCEPopup.editor, t = this
|
||||
if (!this.srcMedia) {
|
||||
if (ed.selection.getNode().nodeName == 'IMG') {
|
||||
ed.dom.remove(ed.selection.getNode());
|
||||
ed.execCommand('mceRepaint');
|
||||
}
|
||||
|
||||
tinyMCEPopup.close();
|
||||
return;
|
||||
}
|
||||
////// insert/update
|
||||
|
||||
tinyMCEPopup.restoreSelection();
|
||||
|
||||
// Fixes crash in Safari
|
||||
if (tinymce.isWebKit){ ed.getWin().focus();}
|
||||
|
||||
|
||||
|
||||
var args;
|
||||
var clazzName = 'noresize';
|
||||
if(this.srcMedia && this.srcMedia.indexOf('pic:') != -1){
|
||||
var m1 = this.media1.split(':');
|
||||
var m2 = this.media2.split(':');
|
||||
|
||||
args = {'class':'noresize',
|
||||
'align': tinyMCEPopup.dom.get("align").value,
|
||||
'src': Config.getImageUrl(this.srcData.pic[m1[1]].subpic[m1[2]].name,true),
|
||||
'alt': this.srcData.pic[m2[1]].subpic[m2[2]].name,
|
||||
'style': "float:"+tinyMCEPopup.dom.get("align").value+";"
|
||||
};
|
||||
}
|
||||
|
||||
if(this.srcMedia && this.srcMedia.indexOf('vid:') != -1){
|
||||
var sm = this.srcMedia.split(':');
|
||||
var o = this.srcData.video[sm[1]];
|
||||
this.videoW = parseInt(tinyMCEPopup.dom.get("video_width").value);
|
||||
this.videoH = parseInt(tinyMCEPopup.dom.get("video_height").value);
|
||||
|
||||
if(!this.videoH || this.videoH < 0){
|
||||
this.videoH = o.height;
|
||||
}
|
||||
if(!this.videoW || this.videoW < 0){
|
||||
this.videoW = o.width;
|
||||
}
|
||||
|
||||
|
||||
clazzName = 'snVideo';
|
||||
args = {'class':'snVideo',
|
||||
'align': tinyMCEPopup.dom.get("align").value,
|
||||
'src': tinyMCEPopup.getWindowArg("plugin_url")+'/images/trans.gif',
|
||||
'title': o.name,
|
||||
'width':this.videoW,
|
||||
'height':this.videoH
|
||||
}
|
||||
if(this.media1 && this.media1.indexOf(':') != -1){
|
||||
var m1 = this.media1.split(':');
|
||||
args.alt = this.srcData.pic[m1[1]].subpic[m1[2]].name;
|
||||
}
|
||||
}
|
||||
|
||||
el = ed.selection.getNode();
|
||||
tinyMCEPopup.execCommand("mceBeginUndoLevel");
|
||||
if (el && el.nodeName == 'IMG') {
|
||||
ed.dom.remove(ed.selection.getNode());
|
||||
}
|
||||
if(args){
|
||||
ed.execCommand('mceInsertContent', false, '<img id="__mce_tmp" />', {skip_undo : 1});
|
||||
// ed.dom.get('__mce_tmp').className = clazzName;
|
||||
ed.dom.setAttribs('__mce_tmp', args);
|
||||
ed.dom.setAttrib('__mce_tmp', 'id', '');
|
||||
}
|
||||
ed.undoManager.add();
|
||||
tinyMCEPopup.execCommand("mceEndUndoLevel");
|
||||
tinyMCEPopup.close();
|
||||
},
|
||||
//////////////////////////////// Helper ////////////////////////////
|
||||
|
||||
loadData: function(){
|
||||
var lst = tinyMCEPopup.dom.get("src_list");
|
||||
lst.options.length = 0;
|
||||
lst.options[lst.options.length] = new Option('Lade Medienliste...','');
|
||||
lst.disabled = true;
|
||||
var xmlHttp = this.getXMLHttpRequest();
|
||||
if(xmlHttp){
|
||||
xmlHttp.open('GET', Config.getImageListUrl(), true);
|
||||
xmlHttp.onreadystatechange = function () {
|
||||
|
||||
if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {
|
||||
ImageDialog.parseAndSet(xmlHttp.responseText);
|
||||
}
|
||||
};
|
||||
xmlHttp.send(null);
|
||||
}
|
||||
},
|
||||
|
||||
deleteData: function(url){
|
||||
var xmlHttp = this.getXMLHttpRequest();
|
||||
if(xmlHttp){
|
||||
xmlHttp.open('GET', url, true);
|
||||
xmlHttp.onreadystatechange = function () {
|
||||
|
||||
if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {
|
||||
ImageDialog.actionStop();
|
||||
}
|
||||
};
|
||||
xmlHttp.send(null);
|
||||
}
|
||||
},
|
||||
|
||||
doDeleteImg : function(){
|
||||
var dl = "";
|
||||
if(this.srcMedia.indexOf("pic:") != -1){
|
||||
var m = this.media1.split(':');
|
||||
dl = Config.getDeleteUrl(this.srcData.pic[m[1]].subpic[m[2]].name);
|
||||
}else{
|
||||
var m = this.srcMedia.split(':');
|
||||
dl = Config.getDeleteUrl(this.srcData.video[m[1]].name);
|
||||
}
|
||||
document.getElementById("imgDelBtn").disabled = true;
|
||||
document.getElementById("waitImg").style.visibility = "visible";
|
||||
ImageDialog.isDeleting = true;
|
||||
ImageDialog.deleteData(dl);
|
||||
|
||||
},
|
||||
|
||||
getXMLHttpRequest: function(){
|
||||
var xmlHttp = null;
|
||||
// Mozilla, Opera, Safari sowie Internet Explorer (ab v7)
|
||||
if (typeof XMLHttpRequest != 'undefined') {
|
||||
xmlHttp = new XMLHttpRequest();
|
||||
}
|
||||
if (!xmlHttp) {
|
||||
// Internet Explorer 6 und älter
|
||||
try {
|
||||
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
|
||||
} catch(e) {
|
||||
try {
|
||||
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
|
||||
} catch(e) {
|
||||
xmlHttp = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
return xmlHttp;
|
||||
},
|
||||
|
||||
parseAndSet: function(xml){
|
||||
var obj = eval( '('+xml+')');
|
||||
|
||||
this.srcData = obj;
|
||||
|
||||
// parse loaded JSON object & create new object
|
||||
|
||||
var lst = tinyMCEPopup.dom.get("src_list");
|
||||
lst.options.length = 0;
|
||||
lst.options[lst.options.length] = new Option('','');
|
||||
if(obj.pic){
|
||||
|
||||
lst.options[lst.options.length] = new Option('------ Bilder -----','');
|
||||
for(var e in obj.pic){
|
||||
if(obj.pic[e].name && obj.pic[e].name.length > 0){
|
||||
var p = obj.pic[e];
|
||||
obj.pic[e].subpic.push({name:p.name,width:p.width,height:p.height,isOrig:true});
|
||||
}
|
||||
lst.options[lst.options.length] = new Option(e,'pic:'+e);
|
||||
if(this.selM1 && this.selM1.toLowerCase().indexOf(e.toLowerCase()) != -1){lst.selectedIndex = lst.options.length-1;}
|
||||
}
|
||||
}
|
||||
|
||||
if(obj.video && obj.video.length > 0){
|
||||
lst.options[lst.options.length] = new Option('------ Videos -----','');
|
||||
for(var i = 0; i < obj.video.length; i++){
|
||||
lst.options[lst.options.length] = new Option(obj.video[i].name,'vid:'+i);
|
||||
if(this.selM1 == obj.video[i].name){lst.selectedIndex = lst.options.length-1;}
|
||||
}
|
||||
}
|
||||
tinyMCEPopup.dom.get("src_list").disabled = false;
|
||||
lst.onchange();
|
||||
},
|
||||
|
||||
uploadStart : function(){
|
||||
ImageDialog.isUploading = true;
|
||||
document.getElementById("waitImg").style.visibility = "visible";
|
||||
document.getElementById("uploadSubmit").disabled = true;
|
||||
},
|
||||
|
||||
actionStop : function(){
|
||||
|
||||
|
||||
if(ImageDialog.isUploading){
|
||||
|
||||
document.getElementById("waitImg").style.visibility = "hidden";
|
||||
document.getElementById("uploadSubmit").disabled = false;
|
||||
document.getElementById("fileField").disabled = false;
|
||||
document.getElementById("fileField").value = "";
|
||||
this.loadData();
|
||||
ImageDialog.isUploading = false;
|
||||
}
|
||||
|
||||
if(ImageDialog.isDeleting){
|
||||
document.getElementById("waitImg").style.visibility = "hidden";
|
||||
document.getElementById("imgDelBtn").disabled = false;
|
||||
|
||||
this.loadData();
|
||||
|
||||
ImageDialog.isDeleting = false;
|
||||
}
|
||||
|
||||
// var http_status=507;
|
||||
// var http_message='507 Insufficient Storage';
|
||||
// var error_message='Upload zu gross, bitte maximal 2 MB hochladen.';
|
||||
|
||||
var iFrame = document.getElementById('actionTarget').contentWindow;
|
||||
|
||||
if(typeof iFrame.error_message != 'undefined'){
|
||||
alert(iFrame.error_message);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
ImageDialog.preInit();
|
||||
tinyMCEPopup.onInit.add(ImageDialog.init, ImageDialog);
|
638
sn_templates/editor_stuff/plugin/snstuff/js/image_bk.js
Normal file
@@ -0,0 +1,638 @@
|
||||
var ImageDialog = {
|
||||
preInit : function() {
|
||||
var url;
|
||||
|
||||
tinyMCEPopup.requireLangPack();
|
||||
|
||||
Config.artikelid = parent.entryid;
|
||||
Config.pagetype = parent.pagetpye;
|
||||
Config.imageListUrl = tinyMCEPopup.getParam("snstuff_img_url_list") || "/admin_list_pictures_json/{artikelid}";
|
||||
Config.uploadUrl = tinyMCEPopup.getParam("snstuff_img_url_upload") || "/{pagetype}/{artikelid}?sx_action=on_user_upload";
|
||||
Config.deleteUrl = tinyMCEPopup.getParam("snstuff_img_url_delete") || "/admin_kill_picture?name=articleimage/sn_computer/{artikelid}/{imgname}&id={artikelid}";
|
||||
Config.imageUrl = tinyMCEPopup.getParam("snstuff_img_url_image") || "/articleimage/{artikelid}/{imgname}";
|
||||
|
||||
},
|
||||
|
||||
imgURL: "",
|
||||
imgAlign:"",
|
||||
|
||||
init : function(ed) {
|
||||
ImageDialog.ImageList = new ImageData();
|
||||
|
||||
document.forms["uploadForm"].action = Config.getUploadUrl();
|
||||
|
||||
var ed = tinyMCEPopup.editor, dom = ed.dom, n = ed.selection.getNode();
|
||||
|
||||
tinyMCEPopup.resizeToInnerSize();
|
||||
|
||||
TinyMCE_EditableSelects.init();
|
||||
|
||||
if ( n != null && typeof n != 'undefined' && n.nodeName == 'IMG') {
|
||||
this.imgURL = dom.getAttrib(n, 'src');
|
||||
this.selectByValue(document.getElementById('align'), this.getAttrib(n, 'align'));
|
||||
document.getElementById("insert").value = ed.getLang('update');
|
||||
this.imgAlign = dom.getAttrib(n, 'style');
|
||||
|
||||
if (ed.settings.inline_styles) {
|
||||
// Move attribs to styles
|
||||
if (dom.getAttrib(n, 'align'))
|
||||
this.updateStyle('align');
|
||||
|
||||
if (dom.getAttrib(n, 'hspace'))
|
||||
this.updateStyle('hspace');
|
||||
|
||||
if (dom.getAttrib(n, 'border'))
|
||||
this.updateStyle('border');
|
||||
|
||||
if (dom.getAttrib(n, 'vspace'))
|
||||
this.updateStyle('vspace');
|
||||
}
|
||||
}
|
||||
|
||||
this.changeAppearance();
|
||||
this.showPreviewImage(this.imgURL, 1);
|
||||
this.loadImages();
|
||||
},
|
||||
|
||||
|
||||
selectOptions : function(){
|
||||
var n = tinyMCEPopup.editor.selection.getNode(), ed = tinyMCEPopup.editor, dom = ed.dom, n = ed.selection.getNode();
|
||||
|
||||
if(n.nodeName != 'IMG')
|
||||
return;
|
||||
|
||||
var srcLstSize = tinyMCEPopup.dom.get("src_list_size").options;
|
||||
var imgurl = this.imgURL;
|
||||
var imgname = imgurl.split("/").pop();
|
||||
|
||||
// select image in selectbox
|
||||
var oname = ImageDialog.ImageList.getOrigNameOf(imgname);
|
||||
var slist = tinyMCEPopup.dom.get("src_list_size");
|
||||
slist.options.length = 0;
|
||||
|
||||
ImageDialog.showImageSizeList({value:oname});
|
||||
|
||||
this.selectInList(tinyMCEPopup.dom.get("src_list"),oname);
|
||||
this.selectInList(tinyMCEPopup.dom.get("src_list_size"),imgurl);
|
||||
this.showSelectedImage(tinyMCEPopup.dom.get("src_list_size"));
|
||||
this.selectInList(tinyMCEPopup.dom.get("src_list_size_full"),dom.getAttrib(n, 'href'));
|
||||
},
|
||||
|
||||
showSelectedImage : function(obj){
|
||||
|
||||
this.imgURL = obj.options[obj.selectedIndex].value;
|
||||
this.showPreviewImage(this.imgURL);
|
||||
},
|
||||
|
||||
insert : function(file, title) {
|
||||
var ed = tinyMCEPopup.editor, t = this;
|
||||
|
||||
if (this.imgURL === '') {
|
||||
if (ed.selection.getNode().nodeName == 'IMG') {
|
||||
ed.dom.remove(ed.selection.getNode());
|
||||
ed.execCommand('mceRepaint');
|
||||
}
|
||||
|
||||
tinyMCEPopup.close();
|
||||
return;
|
||||
}
|
||||
|
||||
t.insertAndClose();
|
||||
|
||||
},
|
||||
|
||||
insertAndClose : function() {
|
||||
var ed = tinyMCEPopup.editor, v, args = {}, el;
|
||||
|
||||
tinyMCEPopup.restoreSelection();
|
||||
|
||||
// Fixes crash in Safari
|
||||
if (tinymce.isWebKit)
|
||||
ed.getWin().focus();
|
||||
|
||||
if (!ed.settings.inline_styles) {
|
||||
args = {
|
||||
vspace : document.getElementById("vspace").value,
|
||||
hspace : document.getElementById("hspace").value,
|
||||
border : document.getElementById("border").value,
|
||||
align : document.getElementById("align").value
|
||||
};
|
||||
} else {
|
||||
// Remove deprecated values
|
||||
args = {
|
||||
vspace : '',
|
||||
hspace : '',
|
||||
border : '',
|
||||
align : ''
|
||||
};
|
||||
}
|
||||
var lnk = document.getElementById("src_list_size_full").value;
|
||||
if(lnk == "auto."){
|
||||
lnk = ImageDialog.ImageList.getBiggest(document.getElementById("src_list").value)
|
||||
}
|
||||
tinymce.extend(args, {
|
||||
src : this.imgURL,
|
||||
alt : lnk,
|
||||
style : this.imgAlign,
|
||||
href : lnk
|
||||
});
|
||||
|
||||
el = ed.selection.getNode();
|
||||
|
||||
tinyMCEPopup.execCommand("mceBeginUndoLevel");
|
||||
// entfernen und neu einfuegen. Weil das das advimagescale plugin sonst unerwuenschten nebeneffekt erzeugt
|
||||
if (el && el.nodeName == 'IMG') {
|
||||
ed.dom.remove(ed.selection.getNode());
|
||||
// ed.dom.setAttribs(el, args);
|
||||
} //else {
|
||||
|
||||
ed.execCommand('mceInsertContent', false, '<img id="__mce_tmp" />', {skip_undo : 1});
|
||||
ed.dom.setAttribs('__mce_tmp', args);
|
||||
ed.dom.setAttrib('__mce_tmp', 'id', '');
|
||||
ed.undoManager.add();
|
||||
// }
|
||||
|
||||
// ed.execCommand('mceRepaint');
|
||||
tinyMCEPopup.execCommand("mceEndUndoLevel");
|
||||
tinyMCEPopup.close();
|
||||
},
|
||||
|
||||
getAttrib : function(e, at) {
|
||||
var ed = tinyMCEPopup.editor, dom = ed.dom, v, v2;
|
||||
|
||||
if (ed.settings.inline_styles) {
|
||||
switch (at) {
|
||||
case 'align':
|
||||
if (v = dom.getStyle(e, 'float'))
|
||||
return v;
|
||||
|
||||
if (v = dom.getStyle(e, 'vertical-align'))
|
||||
return v;
|
||||
|
||||
break;
|
||||
|
||||
case 'hspace':
|
||||
v = dom.getStyle(e, 'margin-left')
|
||||
v2 = dom.getStyle(e, 'margin-right');
|
||||
|
||||
if (v && v == v2)
|
||||
return parseInt(v.replace(/[^0-9]/g, ''));
|
||||
|
||||
break;
|
||||
|
||||
case 'vspace':
|
||||
v = dom.getStyle(e, 'margin-top')
|
||||
v2 = dom.getStyle(e, 'margin-bottom');
|
||||
if (v && v == v2)
|
||||
return parseInt(v.replace(/[^0-9]/g, ''));
|
||||
|
||||
break;
|
||||
|
||||
case 'border':
|
||||
v = 0;
|
||||
|
||||
tinymce.each(['top', 'right', 'bottom', 'left'], function(sv) {
|
||||
sv = dom.getStyle(e, 'border-' + sv + '-width');
|
||||
|
||||
// False or not the same as prev
|
||||
if (!sv || (sv != v && v !== 0)) {
|
||||
v = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (sv)
|
||||
v = sv;
|
||||
});
|
||||
|
||||
if (v)
|
||||
return parseInt(v.replace(/[^0-9]/g, ''));
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (v = dom.getAttrib(e, at))
|
||||
return v;
|
||||
|
||||
return '';
|
||||
},
|
||||
|
||||
|
||||
fillSelectList : function() {
|
||||
|
||||
var dom = tinyMCEPopup.dom, lst = dom.get("src_list");
|
||||
|
||||
lst.options.length = 0;
|
||||
|
||||
lst.options[lst.options.length] = new Option('', '');
|
||||
ImageDialog.ImageList.fillListWithNames(lst);
|
||||
|
||||
},
|
||||
|
||||
showImageSizeList : function(obj){
|
||||
var dom = tinyMCEPopup.dom;
|
||||
var lst = dom.get("src_list_size");
|
||||
var lst2 = dom.get("src_list_size_full");
|
||||
|
||||
if(obj.selectedIndex == 0){
|
||||
this.imgURL = "";
|
||||
lst.options.length = 0;
|
||||
lst2.options.length = 0;
|
||||
this.showPreviewImage();
|
||||
}else{
|
||||
|
||||
lst.options.length = 0;
|
||||
ImageDialog.ImageList.fillListWithSizeOf(lst,obj.value);
|
||||
|
||||
|
||||
lst2.options.length = 0;
|
||||
lst2.options[lst2.options.length] = new Option("auto.","auto.");
|
||||
ImageDialog.ImageList.fillListWithSizeOf(lst2,obj.value);
|
||||
|
||||
ImageDialog.showSelectedImage(document.getElementById("src_list_size"));
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
|
||||
resetImageData : function() {
|
||||
// document.getElementById("width").value = document.getElementById("height").value = '';
|
||||
},
|
||||
|
||||
|
||||
updateImageData : function(img, st) {
|
||||
|
||||
this.preloadImg = img;
|
||||
},
|
||||
|
||||
changeAppearance : function() {
|
||||
var ed = tinyMCEPopup.editor, img = document.getElementById('alignSampleImg');
|
||||
|
||||
if (img) {
|
||||
if (ed.getParam('inline_styles')) {
|
||||
ed.dom.setAttrib(img, 'style', ImageDialog.imgAlign);
|
||||
} else {
|
||||
img.align = document.getElementById("align").value;
|
||||
img.border = document.getElementById("border").value;
|
||||
img.hspace = document.getElementById("hspace").value;
|
||||
img.vspace = document.getElementById("vspace").value;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
updateStyle : function(ty) {
|
||||
var dom = tinyMCEPopup.dom, st, v, img = dom.create('img', {style : ImageDialog.imgAlign});
|
||||
|
||||
if (tinyMCEPopup.editor.settings.inline_styles) {
|
||||
// Handle align
|
||||
if (ty == 'align') {
|
||||
dom.setStyle(img, 'float', '');
|
||||
dom.setStyle(img, 'vertical-align', '');
|
||||
|
||||
v = document.getElementById("align").value;
|
||||
if (v) {
|
||||
if (v == 'left' || v == 'right')
|
||||
dom.setStyle(img, 'float', v);
|
||||
else
|
||||
img.style.verticalAlign = v;
|
||||
}
|
||||
}
|
||||
|
||||
// Handle border
|
||||
if (ty == 'border') {
|
||||
dom.setStyle(img, 'border', '');
|
||||
|
||||
v = document.getElementById("border").value;
|
||||
if (v || v == '0') {
|
||||
if (v == '0')
|
||||
img.style.border = '0';
|
||||
else
|
||||
img.style.border = v + 'px solid black';
|
||||
}
|
||||
}
|
||||
|
||||
// Handle hspace
|
||||
if (ty == 'hspace') {
|
||||
dom.setStyle(img, 'marginLeft', '');
|
||||
dom.setStyle(img, 'marginRight', '');
|
||||
|
||||
v = document.getElementById("hspace").value;
|
||||
if (v) {
|
||||
img.style.marginLeft = v + 'px';
|
||||
img.style.marginRight = v + 'px';
|
||||
}
|
||||
}
|
||||
|
||||
// Handle vspace
|
||||
if (ty == 'vspace') {
|
||||
dom.setStyle(img, 'marginTop', '');
|
||||
dom.setStyle(img, 'marginBottom', '');
|
||||
|
||||
v = document.getElementById("vspace").value;
|
||||
if (v) {
|
||||
img.style.marginTop = v + 'px';
|
||||
img.style.marginBottom = v + 'px';
|
||||
}
|
||||
}
|
||||
|
||||
// Merge
|
||||
ImageDialog.imgAlign = dom.serializeStyle(dom.parseStyle(img.style.cssText));
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
showPreviewImage : function(u, st) {
|
||||
|
||||
if (!u) {
|
||||
tinyMCEPopup.dom.setHTML('prev', '');
|
||||
document.getElementById("imgDelBtn").disabled = true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!st && tinyMCEPopup.getParam("advimage_update_dimensions_onchange", true))
|
||||
this.resetImageData();
|
||||
|
||||
u = tinyMCEPopup.editor.documentBaseURI.toAbsolute(u);
|
||||
document.getElementById("imgDelBtn").disabled = false
|
||||
|
||||
if (!st)
|
||||
tinyMCEPopup.dom.setHTML('prev', '<img id="previewImg" src="' + u + '" border="0" onload="ImageDialog.updateImageData(this);" onerror="ImageDialog.resetImageData();" />');
|
||||
else
|
||||
tinyMCEPopup.dom.setHTML('prev', '<img id="previewImg" src="' + u + '" border="0" onload="ImageDialog.updateImageData(this, 1);" />');
|
||||
},
|
||||
|
||||
|
||||
selectInList : function(list, val){
|
||||
|
||||
var lst = list.options;
|
||||
var vimg = val.split("/").pop();
|
||||
|
||||
for(var i = 0; i < lst.length; i++){
|
||||
var oimg = lst[i].value.split("/").pop();
|
||||
|
||||
if(oimg == vimg){
|
||||
list.selectedIndex = i;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
//////////////////////////////// Helper ////////////////////////////
|
||||
|
||||
loadImages: function(){
|
||||
var xmlHttp = this.getXMLHttpRequest();
|
||||
if(xmlHttp){
|
||||
xmlHttp.open('GET', Config.getImageListUrl(), true);
|
||||
xmlHttp.onreadystatechange = function () {
|
||||
|
||||
if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {
|
||||
ImageDialog.parseAndSet(xmlHttp.responseText);
|
||||
}
|
||||
};
|
||||
xmlHttp.send(null);
|
||||
}
|
||||
},
|
||||
|
||||
deleteImage: function(url){
|
||||
var xmlHttp = this.getXMLHttpRequest();
|
||||
if(xmlHttp){
|
||||
xmlHttp.open('GET', url, true);
|
||||
xmlHttp.onreadystatechange = function () {
|
||||
|
||||
if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {
|
||||
ImageDialog.actionStop();
|
||||
}
|
||||
};
|
||||
xmlHttp.send(null);
|
||||
}
|
||||
},
|
||||
|
||||
getXMLHttpRequest: function(){
|
||||
var xmlHttp = null;
|
||||
// Mozilla, Opera, Safari sowie Internet Explorer (ab v7)
|
||||
if (typeof XMLHttpRequest != 'undefined') {
|
||||
xmlHttp = new XMLHttpRequest();
|
||||
}
|
||||
if (!xmlHttp) {
|
||||
// Internet Explorer 6 und älter
|
||||
try {
|
||||
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
|
||||
} catch(e) {
|
||||
try {
|
||||
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
|
||||
} catch(e) {
|
||||
xmlHttp = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
return xmlHttp;
|
||||
},
|
||||
|
||||
ImageList: null,
|
||||
|
||||
parseAndSet: function(xml){
|
||||
var obj = eval('(' + xml + ')');
|
||||
|
||||
ImageDialog.ImageList.clear()
|
||||
|
||||
// parse loaded JSON object & create new object
|
||||
for(var i = 0; i < obj.length; i++){
|
||||
var size = obj[i].Size;
|
||||
var lnk = obj[i].Link;
|
||||
var imgnameFull = lnk.split("/").pop();
|
||||
|
||||
imgname = imgnameFull.replace("_"+size,"");
|
||||
|
||||
var lnk_test = lnk.split("/");
|
||||
|
||||
if(lnk_test.length == 1 &&lnk_test.shift() != "http:"){
|
||||
lnk = Config.getImageUrl(lnk);
|
||||
}
|
||||
|
||||
if(size == 0)
|
||||
size = "Orig.";
|
||||
|
||||
ImageDialog.ImageList.add(imgname, lnk, size, imgnameFull);
|
||||
}
|
||||
|
||||
|
||||
this.fillSelectList();
|
||||
this.selectOptions();
|
||||
},
|
||||
|
||||
selectByValue: function (obj, value, add_custom, ignore_case) {
|
||||
if (!obj)
|
||||
return;
|
||||
|
||||
var found = false;
|
||||
for (var i=0; i<obj.options.length; i++) {
|
||||
var option = obj.options[i];
|
||||
|
||||
if (option.value == value || (ignore_case && option.value.toLowerCase() == value.toLowerCase())) {
|
||||
option.selected = true;
|
||||
found = true;
|
||||
} else{
|
||||
option.selected = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found && add_custom && value != '') {
|
||||
var option = new Option(value, value);
|
||||
option.selected = true;
|
||||
obj.options[sel.options.length] = option;
|
||||
obj.selectedIndex = obj.options.length - 1;
|
||||
}
|
||||
|
||||
return found;
|
||||
},
|
||||
|
||||
doDeleteImg : function(){
|
||||
var img = document.getElementById("src_list_size").value.split("/").pop();
|
||||
|
||||
document.getElementById("imgDelBtn").disabled = true;
|
||||
document.getElementById("waitImg").style.visibility = "visible";
|
||||
ImageDialog.isDeleting = true;
|
||||
ImageDialog.deleteImage(Config.getDeleteUrl(img));
|
||||
|
||||
},
|
||||
|
||||
isUploading : false,
|
||||
isDeleting : false,
|
||||
|
||||
uploadStart : function(){
|
||||
ImageDialog.isUploading = true;
|
||||
document.getElementById("waitImg").style.visibility = "visible";
|
||||
document.getElementById("uploadSubmit").disabled = true;
|
||||
},
|
||||
|
||||
actionStop : function(){
|
||||
|
||||
|
||||
if(ImageDialog.isUploading){
|
||||
|
||||
document.getElementById("waitImg").style.visibility = "hidden";
|
||||
document.getElementById("uploadSubmit").disabled = false;
|
||||
document.getElementById("fileField").disabled = false;
|
||||
document.getElementById("fileField").value = "";
|
||||
this.loadImages();
|
||||
ImageDialog.isUploading = false;
|
||||
}
|
||||
|
||||
if(ImageDialog.isDeleting){
|
||||
document.getElementById("waitImg").style.visibility = "hidden";
|
||||
document.getElementById("imgDelBtn").disabled = false;
|
||||
|
||||
this.loadImages();
|
||||
|
||||
ImageDialog.isDeleting = false;
|
||||
}
|
||||
|
||||
// var http_status=507;
|
||||
// var http_message='507 Insufficient Storage';
|
||||
// var error_message='Upload zu gross, bitte maximal 2 MB hochladen.';
|
||||
|
||||
var iFrame = document.getElementById('actionTarget').contentWindow;
|
||||
|
||||
if(typeof iFrame.error_message != 'undefined'){
|
||||
alert(iFrame.error_message);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
function ImageData(){
|
||||
this.list = new Array();
|
||||
}
|
||||
|
||||
ImageData.prototype.add = function(n,u,s ,fn){
|
||||
if(typeof this.list[n] == 'undefined'){
|
||||
this.list[n] = new Array();
|
||||
}
|
||||
|
||||
this.list[n][this.list[n].length] = {url:u, size:s, fullname:fn};
|
||||
|
||||
}
|
||||
ImageData.prototype.clear = function(){
|
||||
this.list = new Array();
|
||||
}
|
||||
ImageData.prototype.getBiggest = function(n){
|
||||
|
||||
if(typeof this.list[n] == 'undefined')
|
||||
return;
|
||||
|
||||
var lst = this.list[n];
|
||||
var b = "";
|
||||
var s = -1;
|
||||
for(var i = 0; i < lst.length; i++){
|
||||
|
||||
if(lst[i].size == "Orig."){
|
||||
return lst[i].url;
|
||||
}
|
||||
|
||||
if( parseInt(lst[i].size) > parseInt(s) ){
|
||||
s = lst[i].size;
|
||||
b = lst[i].url;
|
||||
}
|
||||
}
|
||||
return b;
|
||||
}
|
||||
|
||||
ImageData.prototype.getUrlOf = function(img){
|
||||
for(n in this.list){
|
||||
var lst = this.list[n];
|
||||
for(var i = 0; i < lst.length; i++){
|
||||
if(lst[i].fn == img){
|
||||
return lst[i].url;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ImageData.prototype.getOrigNameOf = function(img){
|
||||
|
||||
for(n in this.list){
|
||||
var lst = this.list[n];
|
||||
for(var i = 0; i < lst.length; i++){
|
||||
|
||||
if(lst[i].fullname == img){
|
||||
return n;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ImageData.prototype.fillListWithNames = function(list){
|
||||
for(n in this.list){
|
||||
list.options[list.options.length] = new Option(n, n);
|
||||
}
|
||||
}
|
||||
|
||||
ImageData.prototype.fillListWithSizeOf = function(list, img){
|
||||
|
||||
var lst = this.list[img];
|
||||
for(var i = 0; i < lst.length; i++){
|
||||
list.options[list.options.length] = new Option(lst[i].size, lst[i].url);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
ImageData.prototype.fillList = function(l){
|
||||
|
||||
for(n in this.list){
|
||||
var lst = this.list[n];
|
||||
// if(list.options.length > 0){
|
||||
l.options[l.options.length] = new Option("","");
|
||||
// }
|
||||
|
||||
for(var i = 0; i < lst.length; i++){
|
||||
l.options[l.options.length] = new Option(lst[i].fullname, lst[i].url);
|
||||
}
|
||||
}
|
||||
}
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
ImageDialog.preInit();
|
||||
tinyMCEPopup.onInit.add(ImageDialog.init, ImageDialog);
|
565
sn_templates/editor_stuff/plugin/snstuff/js/image_old.js
Normal file
@@ -0,0 +1,565 @@
|
||||
var ImageDialog = {
|
||||
preInit : function() {
|
||||
var url;
|
||||
|
||||
tinyMCEPopup.requireLangPack();
|
||||
|
||||
Config.artikelid = parent.entryid;
|
||||
Config.pagetype = parent.pagetpye;
|
||||
Config.imageListUrl = tinyMCEPopup.getParam("snstuff_img_url_list") || "/admin_list_pictures_json/{artikelid}";
|
||||
Config.uploadUrl = tinyMCEPopup.getParam("snstuff_img_url_upload") || "/{pagetype}/{artikelid}?sx_action=on_user_upload";
|
||||
Config.deleteUrl = tinyMCEPopup.getParam("snstuff_img_url_delete") || "/admin_kill_picture?name=articleimage/sn_computer/{artikelid}/{imgname}&id={artikelid}";
|
||||
Config.imageUrl = tinyMCEPopup.getParam("snstuff_img_url_image") || "/articleimage/{artikelid}/{imgname}";
|
||||
|
||||
},
|
||||
|
||||
|
||||
objData:{a:{},c:{},t:'',l:''},
|
||||
|
||||
activeDataName:'',
|
||||
activeDataFullname:'',
|
||||
activeClickPic:'',
|
||||
isUploading: false,
|
||||
isDeleting : false,
|
||||
|
||||
srcData: {},
|
||||
isVideo: false,
|
||||
|
||||
srcList:'',
|
||||
srcListSize:'',
|
||||
srcListSizeFull:'',
|
||||
|
||||
selData: {},
|
||||
imgAlign:"",
|
||||
|
||||
tsrcData:'',
|
||||
tsrcDataName:'',
|
||||
tpicShow:'',
|
||||
tpicShowFull:'',
|
||||
tvideoPic:'',
|
||||
|
||||
init : function(ed) {
|
||||
|
||||
this.watch('tsrcDataName',this.tsrcDataNameAction);
|
||||
this.watch('tsrcData',this.tsrcDataAction);
|
||||
this.watch('tpicShow',this.tpicShowAction);
|
||||
|
||||
document.forms["uploadForm"].action = Config.getUploadUrl();
|
||||
|
||||
var ed = tinyMCEPopup.editor, dom = ed.dom, n = ed.selection.getNode();
|
||||
|
||||
tinyMCEPopup.resizeToInnerSize();
|
||||
|
||||
TinyMCE_EditableSelects.init();
|
||||
|
||||
if ( n != null && typeof n != 'undefined' && n.nodeName == 'IMG') {
|
||||
this.objData.t = 'pic';
|
||||
this.imgURL = dom.getAttrib(n, 'src');
|
||||
this.objData.a['click'] = dom.getAttrib(n, 'alt');
|
||||
this.selectByValue(document.getElementById('align'), this.getAttrib(n, 'align'));
|
||||
document.getElementById("insert").value = ed.getLang('update');
|
||||
this.imgAlign = dom.getAttrib(n, 'style');
|
||||
|
||||
if (ed.settings.inline_styles) {
|
||||
// Move attribs to styles
|
||||
if (dom.getAttrib(n, 'align'))
|
||||
this.updateStyle('align');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
// this.changeAppearance();
|
||||
this.loadData();
|
||||
},
|
||||
|
||||
////////////////////////////
|
||||
tsrcDataNameAction: function(p,o,n){
|
||||
this.tsrcData = this.srcData.o[n]
|
||||
},
|
||||
|
||||
tpicShowAction: function(p,o,n){
|
||||
this.previewData();
|
||||
},
|
||||
|
||||
tpicShowFullAction: function(p,o,n){},
|
||||
|
||||
|
||||
tsrcDataAction: function(p,o,n){
|
||||
|
||||
var lst = tinyMCEPopup.dom.get("src_list_size");
|
||||
var lst2 = tinyMCEPopup.dom.get("src_list_size_full");
|
||||
var lstv = tinyMCEPopup.dom.get("src_list_vid_pic");
|
||||
lstv.options.length = 0;
|
||||
lst.options.length = 0;
|
||||
lst2.options.length = 0;
|
||||
var sp = 0; var sp2 = 0;
|
||||
|
||||
if(typeof(this.tsrcData) != 'undefined'){
|
||||
var dl = this.tsrcData.l;
|
||||
|
||||
tinyMCEPopup.dom.get("src_list_size").style.display = 'inline';
|
||||
tinyMCEPopup.dom.get("src_list_size_full").style.display = 'inline';
|
||||
tinyMCEPopup.dom.get("src_list_vid_pic").style.display = 'none';
|
||||
tinyMCEPopup.dom.get("align").disabled = false;
|
||||
|
||||
for(var i = 0; i < dl.length; i++){
|
||||
var o = this.tsrcData.o[dl[i]];
|
||||
if(o.fullName == this.activeDataFullname){sp = i;}
|
||||
if(o.fullName == this.activeClickPic){sp2 = i;}
|
||||
lst.options[lst.options.length] = new Option(o.size, o.fullName);
|
||||
lst2.options[lst2.options.length] = new Option(o.size, o.fullName);
|
||||
}
|
||||
|
||||
if(!this.activeClickPic){
|
||||
var sd = -1;
|
||||
for(var i = 0; i < lst2.options.length;i++){
|
||||
var txt = lst2.options[i].text;
|
||||
var s = (txt == 'Orig.')?9999999:parseInt(txt);
|
||||
if(s > sd ){
|
||||
sd = s;
|
||||
sp2 = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
lst2.selectedIndex = sp2;
|
||||
lst.selectedIndex = sp;
|
||||
|
||||
lst.onchange();lst2.onchange();
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
/////////////////////////////
|
||||
|
||||
// changeAppearance : function() {
|
||||
// var ed = tinyMCEPopup.editor, img = document.getElementById('alignSampleImg');
|
||||
//
|
||||
// if (img) {
|
||||
// if (ed.getParam('inline_styles')) {
|
||||
// ed.dom.setAttrib(img, 'style', ImageDialog.imgAlign);
|
||||
// } else {
|
||||
// img.align = document.getElementById("align").value;
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
insert : function(file, title) {
|
||||
var ed = tinyMCEPopup.editor, t = this;
|
||||
|
||||
if (!this.srcList) {
|
||||
if (ed.selection.getNode().nodeName == 'IMG') {
|
||||
ed.dom.remove(ed.selection.getNode());
|
||||
ed.execCommand('mceRepaint');
|
||||
}
|
||||
|
||||
tinyMCEPopup.close();
|
||||
return;
|
||||
}
|
||||
|
||||
t.insertPicAndClose();
|
||||
|
||||
},
|
||||
insertPicAndClose : function() {
|
||||
var ed = tinyMCEPopup.editor, v, args = {}, el;
|
||||
|
||||
tinyMCEPopup.restoreSelection();
|
||||
|
||||
// Fixes crash in Safari
|
||||
if (tinymce.isWebKit)
|
||||
ed.getWin().focus();
|
||||
|
||||
tinyMCEPopup.execCommand("mceBeginUndoLevel");
|
||||
|
||||
// if (!ed.settings.inline_styles) {
|
||||
args = {
|
||||
align : document.getElementById("align").value
|
||||
};
|
||||
// } else {
|
||||
// // Remove deprecated values
|
||||
// args = {
|
||||
// align : ''
|
||||
// };
|
||||
// }
|
||||
|
||||
tinymce.extend(args, {
|
||||
src : this.selData.lnk,
|
||||
alt : this.srcListSizeFull,
|
||||
style : this.imgAlign,
|
||||
href : this.selData.lnk
|
||||
});
|
||||
|
||||
el = ed.selection.getNode();
|
||||
|
||||
|
||||
// entfernen und neu einfuegen. Weil das advimagescale plugin sonst unerwuenschten nebeneffekt erzeugt
|
||||
if (el && el.nodeName == 'IMG') {
|
||||
ed.dom.remove(ed.selection.getNode());
|
||||
// ed.dom.setAttribs(el, args);
|
||||
} //else {
|
||||
// if(this.srcList){
|
||||
ed.execCommand('mceInsertContent', false, '<img class="noresize" id="__mce_tmp" />', {skip_undo : 1});
|
||||
ed.dom.setAttribs('__mce_tmp', args);
|
||||
ed.dom.setAttrib('__mce_tmp', 'id', '');
|
||||
ed.undoManager.add();
|
||||
// }
|
||||
// }
|
||||
|
||||
// ed.execCommand('mceRepaint');
|
||||
tinyMCEPopup.execCommand("mceEndUndoLevel");
|
||||
tinyMCEPopup.close();
|
||||
},
|
||||
|
||||
insertVideoAndClose: function(){
|
||||
var html = "";
|
||||
},
|
||||
|
||||
updateStyle : function(ty) {
|
||||
var dom = tinyMCEPopup.dom, st, v, img = dom.create('img', {style : ImageDialog.imgAlign});
|
||||
|
||||
if (tinyMCEPopup.editor.settings.inline_styles) {
|
||||
// Handle align
|
||||
if (ty == 'align') {
|
||||
dom.setStyle(img, 'float', '');
|
||||
dom.setStyle(img, 'vertical-align', '');
|
||||
|
||||
v = document.getElementById("align").value;
|
||||
if (v) {
|
||||
if (v == 'left' || v == 'right')
|
||||
dom.setStyle(img, 'float', v);
|
||||
else
|
||||
img.style.verticalAlign = v;
|
||||
}
|
||||
}
|
||||
// Merge
|
||||
ImageDialog.imgAlign = dom.serializeStyle(dom.parseStyle(img.style.cssText));
|
||||
}
|
||||
},
|
||||
|
||||
selectByValue: function (obj, value, add_custom, ignore_case) {
|
||||
if (!obj)
|
||||
return;
|
||||
|
||||
var found = false;
|
||||
for (var i=0; i<obj.options.length; i++) {
|
||||
var option = obj.options[i];
|
||||
|
||||
if (option.value == value || (ignore_case && option.value.toLowerCase() == value.toLowerCase())) {
|
||||
option.selected = true;
|
||||
found = true;
|
||||
} else{
|
||||
option.selected = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found && add_custom && value != '') {
|
||||
var option = new Option(value, value);
|
||||
option.selected = true;
|
||||
obj.options[sel.options.length] = option;
|
||||
obj.selectedIndex = obj.options.length - 1;
|
||||
}
|
||||
|
||||
return found;
|
||||
},
|
||||
|
||||
getAttrib : function(e, at) {
|
||||
var ed = tinyMCEPopup.editor, dom = ed.dom, v, v2;
|
||||
|
||||
if (ed.settings.inline_styles) {
|
||||
switch (at) {
|
||||
case 'align':
|
||||
if (v = dom.getStyle(e, 'float'))
|
||||
return v;
|
||||
|
||||
if (v = dom.getStyle(e, 'vertical-align'))
|
||||
return v;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (v = dom.getAttrib(e, at))
|
||||
return v;
|
||||
|
||||
return '';
|
||||
},
|
||||
srcListAction: function(v){
|
||||
|
||||
this.srcList = v;
|
||||
var lst = tinyMCEPopup.dom.get("src_list_size");
|
||||
var lst2 = tinyMCEPopup.dom.get("src_list_size_full");
|
||||
var lstv = tinyMCEPopup.dom.get("src_list_vid_pic");
|
||||
lstv.options.length = 0;
|
||||
lst.options.length = 0;
|
||||
lst2.options.length = 0;
|
||||
var sp = 0; var sp2 = 0;
|
||||
|
||||
if(this.srcData.data[v]){
|
||||
if(this.srcData.data[v].type == 'pic'){
|
||||
tinyMCEPopup.dom.get("src_list_size").style.display = 'inline';
|
||||
tinyMCEPopup.dom.get("src_list_size_full").style.display = 'inline';
|
||||
tinyMCEPopup.dom.get("src_list_vid_pic").style.display = 'none';
|
||||
tinyMCEPopup.dom.get("align").disabled = false;
|
||||
var d = this.srcData.data[v].lst;
|
||||
|
||||
for(var i = 0; i < d.length; i++){
|
||||
if(d[i].fullName == this.activeDataFullname){sp = i;}
|
||||
if(d[i].fullName == this.activeClickPic){sp2 = i;}
|
||||
|
||||
lst.options[lst.options.length] = new Option(d[i].size, d[i].fullName);
|
||||
lst2.options[lst2.options.length] = new Option(d[i].size, d[i].fullName);
|
||||
}
|
||||
|
||||
if(!this.activeClickPic){
|
||||
var sd = -1;
|
||||
for(var i = 0; i < lst2.options.length;i++){
|
||||
var txt = lst2.options[i].text;
|
||||
var s = (txt == 'Orig.')?9999999:parseInt(txt);
|
||||
if(s > sd ){
|
||||
sd = s;
|
||||
sp2 = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
lst2.selectedIndex = sp2;
|
||||
lst.selectedIndex = sp;
|
||||
|
||||
|
||||
this.srcListSize = lst.options[lst.selectedIndex].value;
|
||||
this.srcListSizeFull = lst2.options[lst2.selectedIndex].value;
|
||||
lst.onchange();
|
||||
}else{
|
||||
tinyMCEPopup.dom.get("src_list_size").style.display = 'none';
|
||||
tinyMCEPopup.dom.get("src_list_size_full").style.display = 'none';
|
||||
tinyMCEPopup.dom.get("src_list_vid_pic").style.display = 'inline';
|
||||
tinyMCEPopup.dom.get("align").disabled = true;
|
||||
|
||||
this.selData = this.srcData.data[v].lst[0];
|
||||
|
||||
var d = this.srcData;
|
||||
for(var i = 0; i < d.imgLst.length; i++){
|
||||
if(this.srcData.data[d.imgLst[i]].type != 'pic'){continue;}
|
||||
var pl = this.srcData.data[d.imgLst[i]].lst;
|
||||
lstv.options[lstv.options.length] = new Option('','');
|
||||
for(var j = 0; j < pl.length; j++){
|
||||
if(pl[j].fullName == this.srcListSize){ sp = lst.options.length};
|
||||
lstv.options[lstv.options.length] = new Option(pl[j].fullName,pl[j].fullName);
|
||||
}
|
||||
}
|
||||
lstv.selectedIndex = sp;
|
||||
lstv.onchange();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
|
||||
picSizeAction:function(v){
|
||||
this.srcListSize = v;
|
||||
this.selData = {};
|
||||
if(this.srcData.data[this.srcList]){
|
||||
var lst = this.srcData.data[this.srcList].lst;
|
||||
for(var i = 0; i < lst.length; i++){
|
||||
if(lst[i].fullName == v){
|
||||
this.selData = lst[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
this.previewData(this.selData);
|
||||
},
|
||||
|
||||
videoPicAction: function(v){
|
||||
this.srcListSize = v;
|
||||
},
|
||||
|
||||
picSizeFullAction:function(v){
|
||||
this.srcListSizeFull = v;
|
||||
},
|
||||
|
||||
previewData : function() {
|
||||
|
||||
if (!this.tsrcData) {
|
||||
tinyMCEPopup.dom.setHTML('prev', '');
|
||||
document.getElementById("imgDelBtn").disabled = true;
|
||||
return;
|
||||
}
|
||||
|
||||
// if (tinyMCEPopup.getParam("advimage_update_dimensions_onchange", true))
|
||||
// this.resetImageData();
|
||||
var o = this.tsrcData.o[this.tpicShow];
|
||||
var u = tinyMCEPopup.editor.documentBaseURI.toAbsolute(o.lnk);
|
||||
document.getElementById("imgDelBtn").disabled = false
|
||||
|
||||
// if (!st)
|
||||
// tinyMCEPopup.dom.setHTML('prev', '<img id="previewImg" src="' + u + '" border="0" onload="ImageDialog.updateImageData(this);" onerror="ImageDialog.resetImageData();" />');
|
||||
// else
|
||||
// tinyMCEPopup.dom.setHTML('prev', '<img id="previewImg" src="' + u + '" border="0" onload="ImageDialog.updateImageData(this, 1);" />');
|
||||
tinyMCEPopup.dom.setHTML('prev', '<img id="previewImg" src="' + u + '" border="0" onload="" />');
|
||||
},
|
||||
//////////////////////////////// Helper ////////////////////////////
|
||||
|
||||
loadData: function(){
|
||||
var xmlHttp = this.getXMLHttpRequest();
|
||||
if(xmlHttp){
|
||||
xmlHttp.open('GET', Config.getImageListUrl(), true);
|
||||
xmlHttp.onreadystatechange = function () {
|
||||
|
||||
if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {
|
||||
ImageDialog.parseAndSet(xmlHttp.responseText);
|
||||
}
|
||||
};
|
||||
xmlHttp.send(null);
|
||||
}
|
||||
},
|
||||
|
||||
deleteData: function(url){
|
||||
var xmlHttp = this.getXMLHttpRequest();
|
||||
if(xmlHttp){
|
||||
xmlHttp.open('GET', url, true);
|
||||
xmlHttp.onreadystatechange = function () {
|
||||
|
||||
if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {
|
||||
ImageDialog.actionStop();
|
||||
}
|
||||
};
|
||||
xmlHttp.send(null);
|
||||
}
|
||||
},
|
||||
|
||||
doDeleteImg : function(){
|
||||
var img = this.srcListSize;;
|
||||
|
||||
document.getElementById("imgDelBtn").disabled = true;
|
||||
document.getElementById("waitImg").style.visibility = "visible";
|
||||
ImageDialog.isDeleting = true;
|
||||
ImageDialog.deleteData(Config.getDeleteUrl(img));
|
||||
|
||||
},
|
||||
|
||||
getXMLHttpRequest: function(){
|
||||
var xmlHttp = null;
|
||||
// Mozilla, Opera, Safari sowie Internet Explorer (ab v7)
|
||||
if (typeof XMLHttpRequest != 'undefined') {
|
||||
xmlHttp = new XMLHttpRequest();
|
||||
}
|
||||
if (!xmlHttp) {
|
||||
// Internet Explorer 6 und älter
|
||||
try {
|
||||
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
|
||||
} catch(e) {
|
||||
try {
|
||||
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
|
||||
} catch(e) {
|
||||
xmlHttp = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
return xmlHttp;
|
||||
},
|
||||
|
||||
parseAndSet: function(xml){
|
||||
var obj = eval('(' + xml + ')');
|
||||
|
||||
this.srcData = {'l':[],'o':{},'t':''};
|
||||
|
||||
var id = 0;
|
||||
// parse loaded JSON object & create new object
|
||||
|
||||
this.activeDataFullname = (this.imgURL)?this.imgURL.split('/').pop():undefined;
|
||||
|
||||
for(var i = 0; i < obj.length; i++){
|
||||
var size = obj[i].Size;
|
||||
var lnk = obj[i].Link;
|
||||
var imgnameFull = lnk.split("/").pop();
|
||||
|
||||
imgname = imgnameFull.replace("_"+size,"");
|
||||
|
||||
var lnk_test = lnk.split("/");
|
||||
|
||||
if(lnk_test.length == 1 &&lnk_test.shift() != "http:"){
|
||||
lnk = Config.getImageUrl(lnk);
|
||||
}
|
||||
|
||||
if(size == 0)
|
||||
size = "Orig.";
|
||||
|
||||
if(typeof(this.srcData.o[imgname]) == 'undefined'){
|
||||
this.srcData.l.push(imgname);
|
||||
this.srcData.o[imgname] = {'l':[],'o':{},'t':''};
|
||||
this.srcData.o[imgname]['t'] = obj[i].Type;
|
||||
}
|
||||
|
||||
|
||||
this.srcData.o[imgname].o[imgnameFull] = {'name':imgname, 'fullName':imgnameFull, 'size':size,'lnk':lnk};
|
||||
this.srcData.o[imgname].l.push(imgnameFull);
|
||||
|
||||
|
||||
if(imgnameFull == this.activeDataFullname){ this.activeDataName = imgname;}
|
||||
}
|
||||
////////////
|
||||
|
||||
var lst = tinyMCEPopup.dom.get("src_list");
|
||||
|
||||
lst.options.length = 0;
|
||||
|
||||
lst.options[lst.options.length] = new Option('', '');
|
||||
var d = this.srcData;
|
||||
var sp = 0;
|
||||
for(var i = 0; i < d.l.length; i++){
|
||||
if(d.l[i] == this.activeDataName){
|
||||
sp = i+1;
|
||||
}
|
||||
lst.options[lst.options.length] = new Option(d.l[i], d.l[i]);
|
||||
}
|
||||
lst.selectedIndex = sp;
|
||||
lst.onchange();
|
||||
},
|
||||
|
||||
uploadStart : function(){
|
||||
ImageDialog.isUploading = true;
|
||||
document.getElementById("waitImg").style.visibility = "visible";
|
||||
document.getElementById("uploadSubmit").disabled = true;
|
||||
},
|
||||
|
||||
actionStop : function(){
|
||||
|
||||
|
||||
if(ImageDialog.isUploading){
|
||||
|
||||
document.getElementById("waitImg").style.visibility = "hidden";
|
||||
document.getElementById("uploadSubmit").disabled = false;
|
||||
document.getElementById("fileField").disabled = false;
|
||||
document.getElementById("fileField").value = "";
|
||||
this.loadData();
|
||||
ImageDialog.isUploading = false;
|
||||
}
|
||||
|
||||
if(ImageDialog.isDeleting){
|
||||
document.getElementById("waitImg").style.visibility = "hidden";
|
||||
document.getElementById("imgDelBtn").disabled = false;
|
||||
|
||||
this.loadData();
|
||||
|
||||
ImageDialog.isDeleting = false;
|
||||
}
|
||||
|
||||
// var http_status=507;
|
||||
// var http_message='507 Insufficient Storage';
|
||||
// var error_message='Upload zu gross, bitte maximal 2 MB hochladen.';
|
||||
|
||||
var iFrame = document.getElementById('actionTarget').contentWindow;
|
||||
|
||||
if(typeof iFrame.error_message != 'undefined'){
|
||||
alert(iFrame.error_message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
ImageDialog.preInit();
|
||||
tinyMCEPopup.onInit.add(ImageDialog.init, ImageDialog);
|
63
sn_templates/editor_stuff/plugin/snstuff/js/infobox.js
Normal file
@@ -0,0 +1,63 @@
|
||||
/* Functions for the advlink plugin popup */
|
||||
|
||||
tinyMCEPopup.requireLangPack();
|
||||
|
||||
function preinit() {
|
||||
var url;
|
||||
if (url = tinyMCEPopup.getParam("external_link_list_url"))
|
||||
document.write('<script language="javascript" type="text/javascript" src="' + tinyMCEPopup.editor.documentBaseURI.toAbsolute(url) + '"></script>');
|
||||
}
|
||||
|
||||
function init() {
|
||||
var formObj = document.forms[0];
|
||||
var ed = tinyMCEPopup.editor;
|
||||
var node = ed.selection.getNode()
|
||||
var sel = ed.selection.getContent();
|
||||
var pnode = ed.dom.getParent(node, function(n) {return ed.dom.hasClass(n, "snInfoBox");});
|
||||
|
||||
if(pnode){
|
||||
formObj.insert.value = tinyMCEPopup.getLang('update', 'Insert', true);
|
||||
var _pwv = parseInt(pnode.style.width);
|
||||
formObj.size.value = isNaN(_pwv) ? 100: _pwv;
|
||||
var f = pnode.style.cssText.indexOf("float: left") != -1 ? "left":"right"; // workroung becouse pnode.style.float return undefined
|
||||
var o = formObj.float.options;
|
||||
for(var i = 0; i < o.length;i++){
|
||||
if(o[i].value == f){
|
||||
o.selectedIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function insertAction() {
|
||||
var formObj = document.forms[0];
|
||||
var ed = tinyMCEPopup.editor;
|
||||
var node = ed.selection.getNode()
|
||||
var sel = ed.selection.getContent();
|
||||
var pnode = ed.dom.getParent(node, function(n) {return ed.dom.hasClass(n, "snInfoBox");});
|
||||
|
||||
var s = parseInt(formObj.size.value);
|
||||
var f = formObj.float.value;
|
||||
var args = {style: "width:"+s+"px; float:"+f+";", class:"snInfoBox"};
|
||||
|
||||
if(!pnode && sel.length == 0){ sel = tinyMCEPopup.getLang('snstuff_dlg.ibox_defaulttext', 'Text....', true);}
|
||||
|
||||
tinyMCEPopup.execCommand("mceBeginUndoLevel");
|
||||
if(sel.length > 0){
|
||||
ed.execCommand('mceInsertRawHTML', false, '<span id="__snInfoBoxTmp" >'+sel+'</span>', {skip_undo : 1});
|
||||
ed.dom.setAttribs('__snInfoBoxTmp', args);
|
||||
ed.dom.setAttrib('__snInfoBoxTmp', 'id', '');
|
||||
ed.undoManager.add();
|
||||
}else{
|
||||
ed.dom.setAttribs(pnode, args);
|
||||
}
|
||||
tinyMCEPopup.execCommand("mceEndUndoLevel");
|
||||
ed.execCommand('mceRepaint');
|
||||
tinyMCEPopup.close();
|
||||
}
|
||||
|
||||
// While loading
|
||||
preinit();
|
||||
tinyMCEPopup.onInit.add(init);
|
||||
|
32
sn_templates/editor_stuff/plugin/snstuff/js/sncode.js
Normal file
@@ -0,0 +1,32 @@
|
||||
/* Functions for the advlink plugin popup */
|
||||
|
||||
tinyMCEPopup.requireLangPack();
|
||||
|
||||
function preinit() {
|
||||
var url;
|
||||
|
||||
if (url = tinyMCEPopup.getParam("external_link_list_url"))
|
||||
document.write('<script language="javascript" type="text/javascript" src="' + tinyMCEPopup.editor.documentBaseURI.toAbsolute(url) + '"></script>');
|
||||
}
|
||||
|
||||
function init() {
|
||||
}
|
||||
function insertAction() {
|
||||
var formObj = document.forms[0];
|
||||
var ed = tinyMCEPopup.editor;
|
||||
var node = ed.selection.getNode()
|
||||
|
||||
// if (node && node.nodeName == 'CODE') {
|
||||
// node.firstChild.nodeValue = document.getElementById("text").value;
|
||||
// }else {
|
||||
ed.execCommand('mceInsertContent', false, '<code>'+formObj.text.value.replace(/\n/g,"<br />")+'</code>', {skip_undo : 1});
|
||||
ed.undoManager.add();
|
||||
// }
|
||||
|
||||
tinyMCEPopup.close();
|
||||
}
|
||||
|
||||
// While loading
|
||||
preinit();
|
||||
tinyMCEPopup.onInit.add(init);
|
||||
|
112
sn_templates/editor_stuff/plugin/snstuff/js/snlink.js
Normal file
@@ -0,0 +1,112 @@
|
||||
/* Functions for the advlink plugin popup */
|
||||
|
||||
tinyMCEPopup.requireLangPack();
|
||||
|
||||
function preinit() {
|
||||
/* var url;
|
||||
|
||||
if (url = tinyMCEPopup.getParam("external_link_list_url"))
|
||||
document.write('<script language="javascript" type="text/javascript" src="' + tinyMCEPopup.editor.documentBaseURI.toAbsolute(url) + '"></script>');*/
|
||||
}
|
||||
|
||||
|
||||
function init() {
|
||||
|
||||
var formObj = document.forms[0];
|
||||
var ed = tinyMCEPopup.editor;
|
||||
var enode = ed.selection.getNode();
|
||||
|
||||
var node = ed.dom.getParent(enode, "A");
|
||||
var selTxt = ed.selection.getContent();
|
||||
|
||||
if(enode.nodeName == 'IMG'){
|
||||
document.getElementById("urlName").style.visibility = "hidden";
|
||||
}
|
||||
|
||||
if(node != null && typeof node != 'undefined' && node.nodeName == 'A'){
|
||||
formObj.insert.value = tinyMCEPopup.getLang('update', 'Insert', true);
|
||||
|
||||
var url = ed.dom.getAttrib(node,"href");
|
||||
var txt = node.firstChild.nodeValue;
|
||||
var desc = ed.dom.getAttrib(node,"title");
|
||||
formObj.urlField.value = url;
|
||||
formObj.nameField.value = txt;
|
||||
formObj.descField.value = desc;
|
||||
|
||||
}else{
|
||||
|
||||
if(isURL(selTxt)){
|
||||
formObj.urlField.value = selTxt.replace(/^\s*/,"");
|
||||
}
|
||||
if(enode.nodeName != 'IMG'){
|
||||
formObj.nameField.value = selTxt;
|
||||
}
|
||||
if(selTxt.length > 0){
|
||||
document.getElementById("urlName").style.visibility = "hidden";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function insertAction() {
|
||||
var formObj = document.forms[0];
|
||||
var ed = tinyMCEPopup.editor;
|
||||
var enode = ed.selection.getNode();
|
||||
|
||||
var node = ed.dom.getParent(enode, "A");
|
||||
|
||||
// Remove element if there is no href
|
||||
if (!formObj.urlField.value) {
|
||||
tinyMCEPopup.execCommand("mceBeginUndoLevel");
|
||||
i = ed.selection.getBookmark();
|
||||
ed.dom.remove(node, 1);
|
||||
ed.selection.moveToBookmark(i);
|
||||
tinyMCEPopup.execCommand("mceEndUndoLevel");
|
||||
tinyMCEPopup.close();
|
||||
return;
|
||||
}
|
||||
tinyMCEPopup.execCommand("mceBeginUndoLevel");
|
||||
|
||||
var lnk = formObj.urlField.value;//ed.baseURI.toAbsolute(formObj.urlField.value);
|
||||
var title = formObj.descField.value;
|
||||
if(!title || title.length == 0){
|
||||
title = lnk;
|
||||
}
|
||||
if (node && node.nodeName == 'A') {
|
||||
ed.dom.setAttrib(node, "href", lnk);
|
||||
ed.dom.setAttrib(node, "title", title);
|
||||
node.firstChild.nodeValue = formObj.nameField.value;
|
||||
|
||||
}else {
|
||||
// if(ed.selection.getContent().length > 0){
|
||||
// ed.getDoc().execCommand("unlink", false, null);
|
||||
// tinyMCEPopup.execCommand("CreateLink", false, "#mce_temp_url#", {skip_undo : 1});
|
||||
//
|
||||
// elementArray = tinymce.grep(ed.dom.select("a"), function(n) {return ed.dom.getAttrib(n, 'href') == '#mce_temp_url#';});
|
||||
// for (i=0; i<elementArray.length; i++){
|
||||
// var elm = elementArray[i];
|
||||
// ed.dom.setAttrib(elm, "href", formObj.urlField.value);
|
||||
// }
|
||||
// }else{
|
||||
ed.execCommand('mceInsertContent', false, '<a href="'+lnk+'" title="'+title+'">'+formObj.nameField.value+'</a>', {skip_undo : 1});
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
tinyMCEPopup.execCommand("mceEndUndoLevel");
|
||||
tinyMCEPopup.close();
|
||||
|
||||
}
|
||||
|
||||
|
||||
function isURL(str){
|
||||
if(str.match(/^http(s){0,1}:\/\//) || str.match(/^\s*www.*\..+/)){
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// While loading
|
||||
preinit();
|
||||
tinyMCEPopup.onInit.add(init);
|
31
sn_templates/editor_stuff/plugin/snstuff/js/snquote.js
Normal file
@@ -0,0 +1,31 @@
|
||||
/* Functions for the advlink plugin popup */
|
||||
|
||||
tinyMCEPopup.requireLangPack();
|
||||
|
||||
function preinit() {
|
||||
var url;
|
||||
|
||||
if (url = tinyMCEPopup.getParam("external_link_list_url"))
|
||||
document.write('<script language="javascript" type="text/javascript" src="' + tinyMCEPopup.editor.documentBaseURI.toAbsolute(url) + '"></script>');
|
||||
}
|
||||
|
||||
function init() {
|
||||
}
|
||||
function insertAction() {
|
||||
var formObj = document.forms[0];
|
||||
var ed = tinyMCEPopup.editor;
|
||||
var node = ed.selection.getNode()
|
||||
|
||||
// if (node && node.nodeName == 'BLOCKQUOTE') {
|
||||
// node.firstChild.nodeValue = document.getElementById("text").value;
|
||||
// }else {
|
||||
ed.execCommand('mceInsertRawHTML', false, '<blockquote>'+formObj.text.value.replace(/\n/g,"<br />")+'</blockquote>', {skip_undo : 1});
|
||||
ed.undoManager.add();
|
||||
// }
|
||||
|
||||
tinyMCEPopup.close();
|
||||
}
|
||||
|
||||
// While loading
|
||||
preinit();
|
||||
tinyMCEPopup.onInit.add(init);
|
70
sn_templates/editor_stuff/plugin/snstuff/langs/de_dlg.js
Normal file
@@ -0,0 +1,70 @@
|
||||
tinyMCE.addI18n('de.snstuff_dlg',{
|
||||
img_tab_upload: "Bilder Hochladen",
|
||||
img_general:"Allgemein",
|
||||
img_title:"Title",
|
||||
img_preview:"Vorschau",
|
||||
img_style:"Style",
|
||||
img_classes:"Classes",
|
||||
img_ltr:"Links nach Rechts",
|
||||
img_rtl:"Rechts nach Links",
|
||||
img_id:"Id",
|
||||
img_map:"Bilderliste",
|
||||
img_dialog_title:"Bilder/Videos Einf\u00FCgen/Bearbeiten",
|
||||
img_list:"Medienliste",
|
||||
img_align:"Ausrichtung",
|
||||
img_align_top:"Oben",
|
||||
img_align_middle:"Mittig",
|
||||
img_align_bottom:"Unten",
|
||||
img_align_texttop:"Text oben",
|
||||
img_align_textbottom:"Text unten",
|
||||
img_align_left:"Links",
|
||||
img_align_right:"Reschts",
|
||||
img_align_none:"Keine",
|
||||
img_image_list:"Medienliste",
|
||||
img_image_delete:"Löschen",
|
||||
img_upload:"Bild/Video hochladen",
|
||||
img_imagefile_select:"Bild/Video:",
|
||||
img_imagefile_sndbtn: "Hochladen",
|
||||
img_imagefile_uploadnotify:"Bildvorschau",
|
||||
img_imagedelete:"Gewähltes Bild/Video löschen",
|
||||
img_imgsize_40height : "40 Pixel Höhe",
|
||||
img_imgsize_80height : "80 Pixel Höhe",
|
||||
img_imgsize_200width : "200 Pixel Breite",
|
||||
img_imgsize_470width : "470 Pixel Breite",
|
||||
img_width:"Breite",
|
||||
img_height:"Höhe",
|
||||
img_pic_select : "Bild größe",
|
||||
img_vpic_select : "Vorschaubild",
|
||||
img_video_pic : " ",
|
||||
img_pic_show : " ",
|
||||
img_pic_show_full : " Vollbild ",
|
||||
|
||||
|
||||
lnk_title: "Link Einf\u00FCgen/Bearbeiten",
|
||||
lnk_general_props: "Link bearbeiten",
|
||||
lnk_desc:"Link",
|
||||
lnk_field_url:"URL",
|
||||
lnk_field_desc:"Title (Opt.)",
|
||||
lnk_field_name:"Text",
|
||||
|
||||
|
||||
quote_desc:"Zitat",
|
||||
qoute_general_props: "Zitat",
|
||||
quote_title:"Zitat einf\u00FCgen",
|
||||
|
||||
code_desc:"Quelltext",
|
||||
code_general_props: "Quelltext",
|
||||
code_title:"Quelltext einf\u00FCgen",
|
||||
|
||||
ibox_title: "InfoBox Einf\u00FCgen/Bearbeiten",
|
||||
ibox_general_props:"InfoBox",
|
||||
ibox_input_titel:"Titel:",
|
||||
ibox_input_size:"Breite:",
|
||||
ibox_input_float:"Position:",
|
||||
ibox_fopt_none:"keine",
|
||||
ibox_fopt_right:"Rechts",
|
||||
ibox_fopt_left:"Links",
|
||||
ibox_defaulttext:"Bitte text eingeben..",
|
||||
////
|
||||
last:""
|
||||
});
|
83
sn_templates/editor_stuff/plugin/snstuff/langs/en_dlg.js
Normal file
@@ -0,0 +1,83 @@
|
||||
tinyMCE.addI18n('en.snimages_dlg',{
|
||||
tab_general:"General",
|
||||
tab_appearance:"Appearance",
|
||||
tab_advanced:"Advanced",
|
||||
tab_upload: "Image Upload",
|
||||
general:"General",
|
||||
title:"Title",
|
||||
preview:"Preview",
|
||||
constrain_proportions:"Constrain proportions",
|
||||
langdir:"Language direction",
|
||||
langcode:"Language code",
|
||||
long_desc:"Long description link",
|
||||
style:"Style",
|
||||
classes:"Classes",
|
||||
ltr:"Left to right",
|
||||
rtl:"Right to left",
|
||||
id:"Id",
|
||||
map:"Image map",
|
||||
swap_image:"Swap image",
|
||||
alt_image:"Alternative image",
|
||||
mouseover:"for mouse over",
|
||||
mouseout:"for mouse out",
|
||||
misc:"Miscellaneous",
|
||||
example_img:"Appearance preview image",
|
||||
missing_alt:"Are you sure you want to continue without including an Image Description? Without it the image may not be accessible to some users with disabilities, or to those using a text browser, or browsing the Web with images turned off.",
|
||||
dialog_title:"1Insert/edit image",
|
||||
src:"Image URL",
|
||||
alt:"Image description",
|
||||
list:"Image list",
|
||||
border:"Border",
|
||||
dimensions:"Dimensions",
|
||||
vspace:"Vertical space",
|
||||
hspace:"Horizontal space",
|
||||
align:"Alignment",
|
||||
align_baseline:"Baseline",
|
||||
align_top:"Top",
|
||||
align_middle:"Middle",
|
||||
align_bottom:"Bottom",
|
||||
align_texttop:"Text top",
|
||||
align_textbottom:"Text bottom",
|
||||
align_left:"Left",
|
||||
align_right:"Right",
|
||||
align_none:"None",
|
||||
image_list:"Image list",
|
||||
image_delete:"Delete",
|
||||
upload:"Image Upload",
|
||||
imagefile_select:"Select Image",
|
||||
imagefile_sndbtn: "Upload",
|
||||
imagefile_uploadnotify:"Image Preview",
|
||||
imagedelete:"Delete selected Image",
|
||||
imgsize_40height : "40 Pixel height",
|
||||
imgsize_80height : "80 Pixel height",
|
||||
imgsize_200width : "200 Pixel width",
|
||||
imgsize_470width : "470 Pixel width",
|
||||
|
||||
|
||||
lnk_title: "Insert/Edit link",
|
||||
lnk_general_props: "Edit Link",
|
||||
lnk_desc:"Link",
|
||||
lnk_field_url:"URL",
|
||||
lnk_field_desc:"Description",
|
||||
|
||||
quote_desc:"Quote",
|
||||
qoute_general_props: "Quote",
|
||||
quote_title:"Insert Quote",
|
||||
|
||||
code_desc:"Code",
|
||||
code_general_props: "Code",
|
||||
code_title:"Insert Code",
|
||||
|
||||
ibox_titel:"Insert/Edit InfoBox",
|
||||
ibox_general_props:"InfoBox",
|
||||
ibox_input_titel:"Titel:",
|
||||
ibox_input_size:"Width:",
|
||||
ibox_input_float:"Position:",
|
||||
ibox_fopt_none:"none",
|
||||
ibox_fopt_right:"Right",
|
||||
ibox_fopt_left:"Left",
|
||||
ibox_defaulttext:"Enter text here...",
|
||||
////
|
||||
last:""
|
||||
|
||||
});
|