added ability to insert attached images in HTML editor
parent
deb30262a7
commit
4315b0086b
@ -0,0 +1,20 @@
|
||||
|
||||
var rc_client = tinyMCEPopup.windowOpener.rcube_webmail_client;
|
||||
if (rc_client.gui_objects.attachmentlist)
|
||||
{
|
||||
var tinyMCEImageList = new Array();
|
||||
var attachElems = rc_client.gui_objects.attachmentlist.getElementsByTagName("li");
|
||||
for (i = 0; i < attachElems.length; i++)
|
||||
{
|
||||
var liElem = attachElems[i];
|
||||
var fname = attachElems[i].id;
|
||||
for (j = 0; j < liElem.childNodes.length; j++)
|
||||
{
|
||||
if (liElem.childNodes[j].nodeName == "#text")
|
||||
{
|
||||
fname = liElem.childNodes[j].nodeValue;
|
||||
}
|
||||
}
|
||||
tinyMCEImageList.push([fname, rc_client.env.comm_path+'&_action=display-attachment&_file='+attachElems[i].id]);
|
||||
}
|
||||
};
|
File diff suppressed because it is too large
Load Diff
@ -1,26 +1,26 @@
|
||||
.mceItemFlash, .mceItemShockWave, .mceItemQuickTime, .mceItemWindowsMedia, .mceItemRealMedia {
|
||||
border: 1px dotted #cc0000;
|
||||
background-position: center;
|
||||
background-repeat: no-repeat;
|
||||
background-color: #ffffcc;
|
||||
}
|
||||
|
||||
.mceItemShockWave {
|
||||
background-image: url('../images/shockwave.gif');
|
||||
}
|
||||
|
||||
.mceItemFlash {
|
||||
background-image: url('../images/flash.gif');
|
||||
}
|
||||
|
||||
.mceItemQuickTime {
|
||||
background-image: url('../images/quicktime.gif');
|
||||
}
|
||||
|
||||
.mceItemWindowsMedia {
|
||||
background-image: url('../images/windowsmedia.gif');
|
||||
}
|
||||
|
||||
.mceItemRealMedia {
|
||||
background-image: url('../images/realmedia.gif');
|
||||
}
|
||||
.mceItemFlash, .mceItemShockWave, .mceItemQuickTime, .mceItemWindowsMedia, .mceItemRealMedia {
|
||||
border: 1px dotted #cc0000;
|
||||
background-position: center;
|
||||
background-repeat: no-repeat;
|
||||
background-color: #ffffcc;
|
||||
}
|
||||
|
||||
.mceItemShockWave {
|
||||
background-image: url('../images/shockwave.gif');
|
||||
}
|
||||
|
||||
.mceItemFlash {
|
||||
background-image: url('../images/flash.gif');
|
||||
}
|
||||
|
||||
.mceItemQuickTime {
|
||||
background-image: url('../images/quicktime.gif');
|
||||
}
|
||||
|
||||
.mceItemWindowsMedia {
|
||||
background-image: url('../images/windowsmedia.gif');
|
||||
}
|
||||
|
||||
.mceItemRealMedia {
|
||||
background-image: url('../images/realmedia.gif');
|
||||
}
|
||||
|
@ -1,68 +1,68 @@
|
||||
#id, #name, #hspace, #vspace, #class_name, #align {
|
||||
width: 100px;
|
||||
}
|
||||
|
||||
#hspace, #vspace {
|
||||
width: 50px;
|
||||
}
|
||||
|
||||
#flash_quality, #flash_align, #flash_scale, #flash_salign, #flash_wmode {
|
||||
width: 100px;
|
||||
}
|
||||
|
||||
#flash_base, #flash_flashvars {
|
||||
width: 240px;
|
||||
}
|
||||
|
||||
#width, #height {
|
||||
width: 40px;
|
||||
}
|
||||
|
||||
#src, #media_type {
|
||||
width: 250px;
|
||||
}
|
||||
|
||||
#class {
|
||||
width: 120px;
|
||||
}
|
||||
|
||||
#prev {
|
||||
margin: 0;
|
||||
border: 1px solid black;
|
||||
width: 99%;
|
||||
height: 230px;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.panel_wrapper div.current {
|
||||
height: 390px;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
#flash_options, #shockwave_options, #qt_options, #wmp_options, #rmp_options {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.mceAddSelectValue {
|
||||
background-color: #DDDDDD;
|
||||
}
|
||||
|
||||
#qt_starttime, #qt_endtime, #qt_fov, #qt_href, #qt_moveid, #qt_moviename, #qt_node, #qt_pan, #qt_qtsrc, #qt_qtsrcchokespeed, #qt_target, #qt_tilt, #qt_urlsubstituten, #qt_volume {
|
||||
width: 70px;
|
||||
}
|
||||
|
||||
#wmp_balance, #wmp_baseurl, #wmp_captioningid, #wmp_currentmarker, #wmp_currentposition, #wmp_defaultframe, #wmp_playcount, #wmp_rate, #wmp_uimode, #wmp_volume {
|
||||
width: 70px;
|
||||
}
|
||||
|
||||
#rmp_console, #rmp_numloop, #rmp_controls, #rmp_scriptcallbacks {
|
||||
width: 70px;
|
||||
}
|
||||
|
||||
#shockwave_swvolume, #shockwave_swframe, #shockwave_swurl, #shockwave_swstretchvalign, #shockwave_swstretchhalign, #shockwave_swstretchstyle {
|
||||
width: 90px;
|
||||
}
|
||||
|
||||
#qt_qtsrc {
|
||||
width: 200px;
|
||||
}
|
||||
#id, #name, #hspace, #vspace, #class_name, #align {
|
||||
width: 100px;
|
||||
}
|
||||
|
||||
#hspace, #vspace {
|
||||
width: 50px;
|
||||
}
|
||||
|
||||
#flash_quality, #flash_align, #flash_scale, #flash_salign, #flash_wmode {
|
||||
width: 100px;
|
||||
}
|
||||
|
||||
#flash_base, #flash_flashvars {
|
||||
width: 240px;
|
||||
}
|
||||
|
||||
#width, #height {
|
||||
width: 40px;
|
||||
}
|
||||
|
||||
#src, #media_type {
|
||||
width: 250px;
|
||||
}
|
||||
|
||||
#class {
|
||||
width: 120px;
|
||||
}
|
||||
|
||||
#prev {
|
||||
margin: 0;
|
||||
border: 1px solid black;
|
||||
width: 99%;
|
||||
height: 230px;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.panel_wrapper div.current {
|
||||
height: 390px;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
#flash_options, #shockwave_options, #qt_options, #wmp_options, #rmp_options {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.mceAddSelectValue {
|
||||
background-color: #DDDDDD;
|
||||
}
|
||||
|
||||
#qt_starttime, #qt_endtime, #qt_fov, #qt_href, #qt_moveid, #qt_moviename, #qt_node, #qt_pan, #qt_qtsrc, #qt_qtsrcchokespeed, #qt_target, #qt_tilt, #qt_urlsubstituten, #qt_volume {
|
||||
width: 70px;
|
||||
}
|
||||
|
||||
#wmp_balance, #wmp_baseurl, #wmp_captioningid, #wmp_currentmarker, #wmp_currentposition, #wmp_defaultframe, #wmp_playcount, #wmp_rate, #wmp_uimode, #wmp_volume {
|
||||
width: 70px;
|
||||
}
|
||||
|
||||
#rmp_console, #rmp_numloop, #rmp_controls, #rmp_scriptcallbacks {
|
||||
width: 70px;
|
||||
}
|
||||
|
||||
#shockwave_swvolume, #shockwave_swframe, #shockwave_swurl, #shockwave_swstretchvalign, #shockwave_swstretchhalign, #shockwave_swstretchstyle {
|
||||
width: 90px;
|
||||
}
|
||||
|
||||
#qt_qtsrc {
|
||||
width: 200px;
|
||||
}
|
||||
|
@ -1,432 +1,432 @@
|
||||
/**
|
||||
* $Id: editor_plugin_src.js 296 2007-08-21 10:36:35Z spocke $
|
||||
*
|
||||
* @author Moxiecode
|
||||
* @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
|
||||
*/
|
||||
|
||||
/* Import plugin specific language pack */
|
||||
tinyMCE.importPluginLanguagePack('media');
|
||||
|
||||
var TinyMCE_MediaPlugin = {
|
||||
getInfo : function() {
|
||||
return {
|
||||
longname : 'Media',
|
||||
author : 'Moxiecode Systems AB',
|
||||
authorurl : 'http://tinymce.moxiecode.com',
|
||||
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/media',
|
||||
version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
|
||||
};
|
||||
},
|
||||
|
||||
initInstance : function(inst) {
|
||||
// Warn if user has flash plugin and media plugin at the same time
|
||||
if (inst.hasPlugin('flash') && !tinyMCE.flashWarn) {
|
||||
alert('Flash plugin is deprecated and should not be used together with the media plugin.');
|
||||
tinyMCE.flashWarn = true;
|
||||
}
|
||||
|
||||
if (!tinyMCE.settings['media_skip_plugin_css'])
|
||||
tinyMCE.importCSS(inst.getDoc(), tinyMCE.baseURL + "/plugins/media/css/content.css");
|
||||
},
|
||||
|
||||
getControlHTML : function(cn) {
|
||||
switch (cn) {
|
||||
case "media":
|
||||
return tinyMCE.getButtonHTML(cn, 'lang_media_desc', '{$pluginurl}/images/media.gif', 'mceMedia');
|
||||
}
|
||||
|
||||
return "";
|
||||
},
|
||||
|
||||
execCommand : function(editor_id, element, command, user_interface, value) {
|
||||
// Handle commands
|
||||
switch (command) {
|
||||
case "mceMedia":
|
||||
tinyMCE.openWindow({
|
||||
file : '../../plugins/media/media.htm',
|
||||
width : 430 + tinyMCE.getLang('lang_media_delta_width', 0),
|
||||
height : 470 + tinyMCE.getLang('lang_media_delta_height', 0)
|
||||
}, {
|
||||
editor_id : editor_id,
|
||||
inline : "yes"
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Pass to next handler in chain
|
||||
return false;
|
||||
},
|
||||
|
||||
cleanup : function(type, content, inst) {
|
||||
var nl, img, i, ne, d, s, ci;
|
||||
|
||||
switch (type) {
|
||||
case "insert_to_editor":
|
||||
img = tinyMCE.getParam("theme_href") + '/images/spacer.gif';
|
||||
content = content.replace(/<script[^>]*>\s*write(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)\(\{([^\)]*)\}\);\s*<\/script>/gi, '<img class="mceItem$1" title="$2" src="' + img + '" />');
|
||||
content = content.replace(/<object([^>]*)>/gi, '<div class="mceItemObject" $1>');
|
||||
content = content.replace(/<embed([^>]*)>/gi, '<div class="mceItemObjectEmbed" $1>');
|
||||
content = content.replace(/<\/(object|embed)([^>]*)>/gi, '</div>');
|
||||
content = content.replace(/<param([^>]*)>/gi, '<div $1 class="mceItemParam"></div>');
|
||||
content = content.replace(new RegExp('\\/ class="mceItemParam"><\\/div>', 'gi'), 'class="mceItemParam"></div>');
|
||||
break;
|
||||
|
||||
case "insert_to_editor_dom":
|
||||
d = inst.getDoc();
|
||||
nl = content.getElementsByTagName("img");
|
||||
for (i=0; i<nl.length; i++) {
|
||||
if (/mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(nl[i].className)) {
|
||||
nl[i].width = nl[i].title.replace(/.*width:[^0-9]?([0-9]+)%?.*/g, '$1');
|
||||
nl[i].height = nl[i].title.replace(/.*height:[^0-9]?([0-9]+)%?.*/g, '$1');
|
||||
//nl[i].align = nl[i].title.replace(/.*align:([a-z]+).*/gi, '$1');
|
||||
}
|
||||
}
|
||||
|
||||
nl = tinyMCE.selectElements(content, 'DIV', function (n) {return tinyMCE.hasCSSClass(n, 'mceItemObject');});
|
||||
for (i=0; i<nl.length; i++) {
|
||||
ci = tinyMCE.getAttrib(nl[i], "classid").toLowerCase().replace(/\s+/g, '');
|
||||
|
||||
switch (ci) {
|
||||
case 'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000':
|
||||
nl[i].parentNode.replaceChild(TinyMCE_MediaPlugin._createImg('mceItemFlash', d, nl[i]), nl[i]);
|
||||
break;
|
||||
|
||||
case 'clsid:166b1bca-3f9c-11cf-8075-444553540000':
|
||||
nl[i].parentNode.replaceChild(TinyMCE_MediaPlugin._createImg('mceItemShockWave', d, nl[i]), nl[i]);
|
||||
break;
|
||||
|
||||
case 'clsid:6bf52a52-394a-11d3-b153-00c04f79faa6':
|
||||
case 'clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95':
|
||||
case 'clsid:05589fa1-c356-11ce-bf01-00aa0055595a':
|
||||
nl[i].parentNode.replaceChild(TinyMCE_MediaPlugin._createImg('mceItemWindowsMedia', d, nl[i]), nl[i]);
|
||||
break;
|
||||
|
||||
case 'clsid:02bf25d5-8c17-4b23-bc80-d3488abddc6b':
|
||||
nl[i].parentNode.replaceChild(TinyMCE_MediaPlugin._createImg('mceItemQuickTime', d, nl[i]), nl[i]);
|
||||
break;
|
||||
|
||||
case 'clsid:cfcdaa03-8be4-11cf-b84b-0020afbbccfa':
|
||||
nl[i].parentNode.replaceChild(TinyMCE_MediaPlugin._createImg('mceItemRealMedia', d, nl[i]), nl[i]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Handle embed (if any)
|
||||
nl = tinyMCE.selectNodes(content, function (n) {return n.className == 'mceItemObjectEmbed';});
|
||||
for (i=0; i<nl.length; i++) {
|
||||
switch (tinyMCE.getAttrib(nl[i], 'type')) {
|
||||
case 'application/x-shockwave-flash':
|
||||
TinyMCE_MediaPlugin._createImgFromEmbed(nl[i], d, 'mceItemFlash');
|
||||
break;
|
||||
|
||||
case 'application/x-director':
|
||||
TinyMCE_MediaPlugin._createImgFromEmbed(nl[i], d, 'mceItemShockWave');
|
||||
break;
|
||||
|
||||
case 'application/x-mplayer2':
|
||||
TinyMCE_MediaPlugin._createImgFromEmbed(nl[i], d, 'mceItemWindowsMedia');
|
||||
break;
|
||||
|
||||
case 'video/quicktime':
|
||||
TinyMCE_MediaPlugin._createImgFromEmbed(nl[i], d, 'mceItemQuickTime');
|
||||
break;
|
||||
|
||||
case 'audio/x-pn-realaudio-plugin':
|
||||
TinyMCE_MediaPlugin._createImgFromEmbed(nl[i], d, 'mceItemRealMedia');
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case "get_from_editor":
|
||||
var startPos = -1, endPos, attribs, chunkBefore, chunkAfter, embedHTML, at, pl, cb, mt, ex;
|
||||
|
||||
while ((startPos = content.indexOf('<img', startPos+1)) != -1) {
|
||||
endPos = content.indexOf('/>', startPos);
|
||||
attribs = TinyMCE_MediaPlugin._parseAttributes(content.substring(startPos + 4, endPos));
|
||||
|
||||
// Is not flash, skip it
|
||||
if (!/mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(attribs['class']))
|
||||
continue;
|
||||
|
||||
endPos += 2;
|
||||
|
||||
// Parse attributes
|
||||
at = attribs['title'];
|
||||
if (at) {
|
||||
at = at.replace(/&(#39|apos);/g, "'");
|
||||
at = at.replace(/&#quot;/g, '"');
|
||||
|
||||
try {
|
||||
pl = eval('x={' + at + '};');
|
||||
} catch (ex) {
|
||||
pl = {};
|
||||
}
|
||||
}
|
||||
|
||||
// Use object/embed
|
||||
if (!tinyMCE.getParam('media_use_script', false)) {
|
||||
switch (attribs['class']) {
|
||||
case 'mceItemFlash':
|
||||
ci = 'd27cdb6e-ae6d-11cf-96b8-444553540000';
|
||||
cb = 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0';
|
||||
mt = 'application/x-shockwave-flash';
|
||||
break;
|
||||
|
||||
case 'mceItemShockWave':
|
||||
ci = '166B1BCA-3F9C-11CF-8075-444553540000';
|
||||
cb = 'http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0';
|
||||
mt = 'application/x-director';
|
||||
break;
|
||||
|
||||
case 'mceItemWindowsMedia':
|
||||
ci = tinyMCE.getParam('media_wmp6_compatible') ? '05589FA1-C356-11CE-BF01-00AA0055595A' : '6BF52A52-394A-11D3-B153-00C04F79FAA6';
|
||||
cb = 'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701';
|
||||
mt = 'application/x-mplayer2';
|
||||
break;
|
||||
|
||||
case 'mceItemQuickTime':
|
||||
ci = '02BF25D5-8C17-4B23-BC80-D3488ABDDC6B';
|
||||
cb = 'http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0';
|
||||
mt = 'video/quicktime';
|
||||
break;
|
||||
|
||||
case 'mceItemRealMedia':
|
||||
ci = 'CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA';
|
||||
cb = 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0';
|
||||
mt = 'audio/x-pn-realaudio-plugin';
|
||||
break;
|
||||
}
|
||||
|
||||
// Convert the URL
|
||||
pl.src = tinyMCE.convertURL(pl.src, null, true);
|
||||
|
||||
embedHTML = TinyMCE_MediaPlugin._getEmbed(ci, cb, mt, pl, attribs);
|
||||
} else {
|
||||
// Use script version
|
||||
switch (attribs['class']) {
|
||||
case 'mceItemFlash':
|
||||
s = 'writeFlash';
|
||||
break;
|
||||
|
||||
case 'mceItemShockWave':
|
||||
s = 'writeShockWave';
|
||||
break;
|
||||
|
||||
case 'mceItemWindowsMedia':
|
||||
s = 'writeWindowsMedia';
|
||||
break;
|
||||
|
||||
case 'mceItemQuickTime':
|
||||
s = 'writeQuickTime';
|
||||
break;
|
||||
|
||||
case 'mceItemRealMedia':
|
||||
s = 'writeRealMedia';
|
||||
break;
|
||||
}
|
||||
|
||||
if (attribs.width)
|
||||
at = at.replace(/width:[^0-9]?[0-9]+%?[^0-9]?/g, "width:'" + attribs.width + "'");
|
||||
|
||||
if (attribs.height)
|
||||
at = at.replace(/height:[^0-9]?[0-9]+%?[^0-9]?/g, "height:'" + attribs.height + "'");
|
||||
|
||||
// Force absolute URL
|
||||
pl.src = tinyMCE.convertURL(pl.src, null, true);
|
||||
at = at.replace(new RegExp("src:'[^']*'", "g"), "src:'" + pl.src + "'");
|
||||
|
||||
embedHTML = '<script type="text/javascript">' + s + '({' + at + '});</script>';
|
||||
}
|
||||
|
||||
// Insert embed/object chunk
|
||||
chunkBefore = content.substring(0, startPos);
|
||||
chunkAfter = content.substring(endPos);
|
||||
content = chunkBefore + embedHTML + chunkAfter;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return content;
|
||||
},
|
||||
|
||||
handleNodeChange : function(editor_id, node, undo_index, undo_levels, visual_aid, any_selection) {
|
||||
if (node == null)
|
||||
return;
|
||||
|
||||
do {
|
||||
if (node.nodeName == "IMG" && /mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(tinyMCE.getAttrib(node, 'class'))) {
|
||||
tinyMCE.switchClass(editor_id + '_media', 'mceButtonSelected');
|
||||
return true;
|
||||
}
|
||||
} while ((node = node.parentNode));
|
||||
|
||||
tinyMCE.switchClass(editor_id + '_media', 'mceButtonNormal');
|
||||
|
||||
return true;
|
||||
},
|
||||
|
||||
_createImgFromEmbed : function(n, d, cl) {
|
||||
var ne, at, i, ti = '', an;
|
||||
|
||||
ne = d.createElement('img');
|
||||
ne.src = tinyMCE.getParam("theme_href") + '/images/spacer.gif';
|
||||
ne.width = tinyMCE.getAttrib(n, 'width');
|
||||
ne.height = tinyMCE.getAttrib(n, 'height');
|
||||
ne.className = cl;
|
||||
|
||||
at = n.attributes;
|
||||
for (i=0; i<at.length; i++) {
|
||||
if (at[i].specified && at[i].nodeValue) {
|
||||
an = at[i].nodeName.toLowerCase();
|
||||
|
||||
if (an == 'src')
|
||||
continue;
|
||||
|
||||
if (an == 'mce_src')
|
||||
an = 'src';
|
||||
|
||||
if (an.indexOf('mce_') == -1 && !new RegExp('^(class|type)$').test(an))
|
||||
ti += an.toLowerCase() + ':\'' + at[i].nodeValue + "',";
|
||||
}
|
||||
}
|
||||
|
||||
ti = ti.length > 0 ? ti.substring(0, ti.length - 1) : ti;
|
||||
ne.title = ti;
|
||||
|
||||
n.parentNode.replaceChild(ne, n);
|
||||
},
|
||||
|
||||
_createImg : function(cl, d, n) {
|
||||
var i, nl, ti = "", an, av, al = new Array();
|
||||
|
||||
ne = d.createElement('img');
|
||||
ne.src = tinyMCE.getParam("theme_href") + '/images/spacer.gif';
|
||||
ne.width = tinyMCE.getAttrib(n, 'width');
|
||||
ne.height = tinyMCE.getAttrib(n, 'height');
|
||||
ne.className = cl;
|
||||
|
||||
al.id = tinyMCE.getAttrib(n, 'id');
|
||||
al.name = tinyMCE.getAttrib(n, 'name');
|
||||
al.width = tinyMCE.getAttrib(n, 'width');
|
||||
al.height = tinyMCE.getAttrib(n, 'height');
|
||||
al.bgcolor = tinyMCE.getAttrib(n, 'bgcolor');
|
||||
al.align = tinyMCE.getAttrib(n, 'align');
|
||||
al.class_name = tinyMCE.getAttrib(n, 'mce_class');
|
||||
|
||||
nl = n.getElementsByTagName('div');
|
||||
for (i=0; i<nl.length; i++) {
|
||||
av = tinyMCE.getAttrib(nl[i], 'value');
|
||||
av = av.replace(new RegExp('\\\\', 'g'), '\\\\');
|
||||
av = av.replace(new RegExp('"', 'g'), '\\"');
|
||||
av = av.replace(new RegExp("'", 'g'), "\\'");
|
||||
an = tinyMCE.getAttrib(nl[i], 'name');
|
||||
al[an] = av;
|
||||
}
|
||||
|
||||
if (al.movie) {
|
||||
al.src = al.movie;
|
||||
al.movie = null;
|
||||
}
|
||||
|
||||
for (an in al) {
|
||||
if (al[an] != null && typeof(al[an]) != "function" && al[an] != '')
|
||||
ti += an.toLowerCase() + ':\'' + al[an] + "',";
|
||||
}
|
||||
|
||||
ti = ti.length > 0 ? ti.substring(0, ti.length - 1) : ti;
|
||||
ne.title = ti;
|
||||
|
||||
return ne;
|
||||
},
|
||||
|
||||
_getEmbed : function(cls, cb, mt, p, at) {
|
||||
var h = '', n;
|
||||
|
||||
p.width = at.width ? at.width : p.width;
|
||||
p.height = at.height ? at.height : p.height;
|
||||
|
||||
h += '<object classid="clsid:' + cls + '" codebase="' + cb + '"';
|
||||
h += typeof(p.id) != "undefined" ? ' id="' + p.id + '"' : '';
|
||||
h += typeof(p.name) != "undefined" ? ' name="' + p.name + '"' : '';
|
||||
h += typeof(p.width) != "undefined" ? ' width="' + p.width + '"' : '';
|
||||
h += typeof(p.height) != "undefined" ? ' height="' + p.height + '"' : '';
|
||||
h += typeof(p.align) != "undefined" ? ' align="' + p.align + '"' : '';
|
||||
h += '>';
|
||||
|
||||
for (n in p) {
|
||||
if (typeof(p[n]) != "undefined" && typeof(p[n]) != "function") {
|
||||
h += '<param name="' + n + '" value="' + p[n] + '" />';
|
||||
|
||||
// Add extra url parameter if it's an absolute URL on WMP
|
||||
if (n == 'src' && p[n].indexOf('://') != -1 && mt == 'application/x-mplayer2')
|
||||
h += '<param name="url" value="' + p[n] + '" />';
|
||||
}
|
||||
}
|
||||
|
||||
h += '<embed type="' + mt + '"';
|
||||
|
||||
for (n in p) {
|
||||
if (typeof(p[n]) == "function")
|
||||
continue;
|
||||
|
||||
// Skip url parameter for embed tag on WMP
|
||||
if (!(n == 'url' && mt == 'application/x-mplayer2'))
|
||||
h += ' ' + n + '="' + p[n] + '"';
|
||||
}
|
||||
|
||||
h += '></embed></object>';
|
||||
|
||||
return h;
|
||||
},
|
||||
|
||||
_parseAttributes : function(attribute_string) {
|
||||
var attributeName = "", endChr = '"';
|
||||
var attributeValue = "";
|
||||
var withInName;
|
||||
var withInValue;
|
||||
var attributes = new Array();
|
||||
var whiteSpaceRegExp = new RegExp('^[ \n\r\t]+', 'g');
|
||||
|
||||
if (attribute_string == null || attribute_string.length < 2)
|
||||
return null;
|
||||
|
||||
withInName = withInValue = false;
|
||||
|
||||
for (var i=0; i<attribute_string.length; i++) {
|
||||
var chr = attribute_string.charAt(i);
|
||||
|
||||
if ((chr == '"' || chr == "'") && !withInValue) {
|
||||
withInValue = true;
|
||||
endChr = chr;
|
||||
} else if (chr == endChr && withInValue) {
|
||||
withInValue = false;
|
||||
|
||||
var pos = attributeName.lastIndexOf(' ');
|
||||
if (pos != -1)
|
||||
attributeName = attributeName.substring(pos+1);
|
||||
|
||||
attributes[attributeName.toLowerCase()] = attributeValue.substring(1);
|
||||
|
||||
attributeName = "";
|
||||
attributeValue = "";
|
||||
} else if (!whiteSpaceRegExp.test(chr) && !withInName && !withInValue)
|
||||
withInName = true;
|
||||
|
||||
if (chr == '=' && withInName)
|
||||
withInName = false;
|
||||
|
||||
if (withInName)
|
||||
attributeName += chr;
|
||||
|
||||
if (withInValue)
|
||||
attributeValue += chr;
|
||||
}
|
||||
|
||||
return attributes;
|
||||
}
|
||||
};
|
||||
|
||||
tinyMCE.addPlugin("media", TinyMCE_MediaPlugin);
|
||||
/**
|
||||
* $Id: editor_plugin_src.js 296 2007-08-21 10:36:35Z spocke $
|
||||
*
|
||||
* @author Moxiecode
|
||||
* @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
|
||||
*/
|
||||
|
||||
/* Import plugin specific language pack */
|
||||
tinyMCE.importPluginLanguagePack('media');
|
||||
|
||||
var TinyMCE_MediaPlugin = {
|
||||
getInfo : function() {
|
||||
return {
|
||||
longname : 'Media',
|
||||
author : 'Moxiecode Systems AB',
|
||||
authorurl : 'http://tinymce.moxiecode.com',
|
||||
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/media',
|
||||
version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
|
||||
};
|
||||
},
|
||||
|
||||
initInstance : function(inst) {
|
||||
// Warn if user has flash plugin and media plugin at the same time
|
||||
if (inst.hasPlugin('flash') && !tinyMCE.flashWarn) {
|
||||
alert('Flash plugin is deprecated and should not be used together with the media plugin.');
|
||||
tinyMCE.flashWarn = true;
|
||||
}
|
||||
|
||||
if (!tinyMCE.settings['media_skip_plugin_css'])
|
||||
tinyMCE.importCSS(inst.getDoc(), tinyMCE.baseURL + "/plugins/media/css/content.css");
|
||||
},
|
||||
|
||||
getControlHTML : function(cn) {
|
||||
switch (cn) {
|
||||
case "media":
|
||||
return tinyMCE.getButtonHTML(cn, 'lang_media_desc', '{$pluginurl}/images/media.gif', 'mceMedia');
|
||||
}
|
||||
|
||||
return "";
|
||||
},
|
||||
|
||||
execCommand : function(editor_id, element, command, user_interface, value) {
|
||||
// Handle commands
|
||||
switch (command) {
|
||||
case "mceMedia":
|
||||
tinyMCE.openWindow({
|
||||
file : '../../plugins/media/media.htm',
|
||||
width : 430 + tinyMCE.getLang('lang_media_delta_width', 0),
|
||||
height : 470 + tinyMCE.getLang('lang_media_delta_height', 0)
|
||||
}, {
|
||||
editor_id : editor_id,
|
||||
inline : "yes"
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Pass to next handler in chain
|
||||
return false;
|
||||
},
|
||||
|
||||
cleanup : function(type, content, inst) {
|
||||
var nl, img, i, ne, d, s, ci;
|
||||
|
||||
switch (type) {
|
||||
case "insert_to_editor":
|
||||
img = tinyMCE.getParam("theme_href") + '/images/spacer.gif';
|
||||
content = content.replace(/<script[^>]*>\s*write(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)\(\{([^\)]*)\}\);\s*<\/script>/gi, '<img class="mceItem$1" title="$2" src="' + img + '" />');
|
||||
content = content.replace(/<object([^>]*)>/gi, '<div class="mceItemObject" $1>');
|
||||
content = content.replace(/<embed([^>]*)>/gi, '<div class="mceItemObjectEmbed" $1>');
|
||||
content = content.replace(/<\/(object|embed)([^>]*)>/gi, '</div>');
|
||||
content = content.replace(/<param([^>]*)>/gi, '<div $1 class="mceItemParam"></div>');
|
||||
content = content.replace(new RegExp('\\/ class="mceItemParam"><\\/div>', 'gi'), 'class="mceItemParam"></div>');
|
||||
break;
|
||||
|
||||
case "insert_to_editor_dom":
|
||||
d = inst.getDoc();
|
||||
nl = content.getElementsByTagName("img");
|
||||
for (i=0; i<nl.length; i++) {
|
||||
if (/mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(nl[i].className)) {
|
||||
nl[i].width = nl[i].title.replace(/.*width:[^0-9]?([0-9]+)%?.*/g, '$1');
|
||||
nl[i].height = nl[i].title.replace(/.*height:[^0-9]?([0-9]+)%?.*/g, '$1');
|
||||
//nl[i].align = nl[i].title.replace(/.*align:([a-z]+).*/gi, '$1');
|
||||
}
|
||||
}
|
||||
|
||||
nl = tinyMCE.selectElements(content, 'DIV', function (n) {return tinyMCE.hasCSSClass(n, 'mceItemObject');});
|
||||
for (i=0; i<nl.length; i++) {
|
||||
ci = tinyMCE.getAttrib(nl[i], "classid").toLowerCase().replace(/\s+/g, '');
|
||||
|
||||
switch (ci) {
|
||||
case 'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000':
|
||||
nl[i].parentNode.replaceChild(TinyMCE_MediaPlugin._createImg('mceItemFlash', d, nl[i]), nl[i]);
|
||||
break;
|
||||
|
||||
case 'clsid:166b1bca-3f9c-11cf-8075-444553540000':
|
||||
nl[i].parentNode.replaceChild(TinyMCE_MediaPlugin._createImg('mceItemShockWave', d, nl[i]), nl[i]);
|
||||
break;
|
||||
|
||||
case 'clsid:6bf52a52-394a-11d3-b153-00c04f79faa6':
|
||||
case 'clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95':
|
||||
case 'clsid:05589fa1-c356-11ce-bf01-00aa0055595a':
|
||||
nl[i].parentNode.replaceChild(TinyMCE_MediaPlugin._createImg('mceItemWindowsMedia', d, nl[i]), nl[i]);
|
||||
break;
|
||||
|
||||
case 'clsid:02bf25d5-8c17-4b23-bc80-d3488abddc6b':
|
||||
nl[i].parentNode.replaceChild(TinyMCE_MediaPlugin._createImg('mceItemQuickTime', d, nl[i]), nl[i]);
|
||||
break;
|
||||
|
||||
case 'clsid:cfcdaa03-8be4-11cf-b84b-0020afbbccfa':
|
||||
nl[i].parentNode.replaceChild(TinyMCE_MediaPlugin._createImg('mceItemRealMedia', d, nl[i]), nl[i]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Handle embed (if any)
|
||||
nl = tinyMCE.selectNodes(content, function (n) {return n.className == 'mceItemObjectEmbed';});
|
||||
for (i=0; i<nl.length; i++) {
|
||||
switch (tinyMCE.getAttrib(nl[i], 'type')) {
|
||||
case 'application/x-shockwave-flash':
|
||||
TinyMCE_MediaPlugin._createImgFromEmbed(nl[i], d, 'mceItemFlash');
|
||||
break;
|
||||
|
||||
case 'application/x-director':
|
||||
TinyMCE_MediaPlugin._createImgFromEmbed(nl[i], d, 'mceItemShockWave');
|
||||
break;
|
||||
|
||||
case 'application/x-mplayer2':
|
||||
TinyMCE_MediaPlugin._createImgFromEmbed(nl[i], d, 'mceItemWindowsMedia');
|
||||
break;
|
||||
|
||||
case 'video/quicktime':
|
||||
TinyMCE_MediaPlugin._createImgFromEmbed(nl[i], d, 'mceItemQuickTime');
|
||||
break;
|
||||
|
||||
case 'audio/x-pn-realaudio-plugin':
|
||||
TinyMCE_MediaPlugin._createImgFromEmbed(nl[i], d, 'mceItemRealMedia');
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case "get_from_editor":
|
||||
var startPos = -1, endPos, attribs, chunkBefore, chunkAfter, embedHTML, at, pl, cb, mt, ex;
|
||||
|
||||
while ((startPos = content.indexOf('<img', startPos+1)) != -1) {
|
||||
endPos = content.indexOf('/>', startPos);
|
||||
attribs = TinyMCE_MediaPlugin._parseAttributes(content.substring(startPos + 4, endPos));
|
||||
|
||||
// Is not flash, skip it
|
||||
if (!/mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(attribs['class']))
|
||||
continue;
|
||||
|
||||
endPos += 2;
|
||||
|
||||
// Parse attributes
|
||||
at = attribs['title'];
|
||||
if (at) {
|
||||
at = at.replace(/&(#39|apos);/g, "'");
|
||||
at = at.replace(/&#quot;/g, '"');
|
||||
|
||||
try {
|
||||
pl = eval('x={' + at + '};');
|
||||
} catch (ex) {
|
||||
pl = {};
|
||||
}
|
||||
}
|
||||
|
||||
// Use object/embed
|
||||
if (!tinyMCE.getParam('media_use_script', false)) {
|
||||
switch (attribs['class']) {
|
||||
case 'mceItemFlash':
|
||||
ci = 'd27cdb6e-ae6d-11cf-96b8-444553540000';
|
||||
cb = 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0';
|
||||
mt = 'application/x-shockwave-flash';
|
||||
break;
|
||||
|
||||
case 'mceItemShockWave':
|
||||
ci = '166B1BCA-3F9C-11CF-8075-444553540000';
|
||||
cb = 'http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0';
|
||||
mt = 'application/x-director';
|
||||
break;
|
||||
|
||||
case 'mceItemWindowsMedia':
|
||||
ci = tinyMCE.getParam('media_wmp6_compatible') ? '05589FA1-C356-11CE-BF01-00AA0055595A' : '6BF52A52-394A-11D3-B153-00C04F79FAA6';
|
||||
cb = 'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701';
|
||||
mt = 'application/x-mplayer2';
|
||||
break;
|
||||
|
||||
case 'mceItemQuickTime':
|
||||
ci = '02BF25D5-8C17-4B23-BC80-D3488ABDDC6B';
|
||||
cb = 'http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0';
|
||||
mt = 'video/quicktime';
|
||||
break;
|
||||
|
||||
case 'mceItemRealMedia':
|
||||
ci = 'CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA';
|
||||
cb = 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0';
|
||||
mt = 'audio/x-pn-realaudio-plugin';
|
||||
break;
|
||||
}
|
||||
|
||||
// Convert the URL
|
||||
pl.src = tinyMCE.convertURL(pl.src, null, true);
|
||||
|
||||
embedHTML = TinyMCE_MediaPlugin._getEmbed(ci, cb, mt, pl, attribs);
|
||||
} else {
|
||||
// Use script version
|
||||
switch (attribs['class']) {
|
||||
case 'mceItemFlash':
|
||||
s = 'writeFlash';
|
||||
break;
|
||||
|
||||
case 'mceItemShockWave':
|
||||
s = 'writeShockWave';
|
||||
break;
|
||||
|
||||
case 'mceItemWindowsMedia':
|
||||
s = 'writeWindowsMedia';
|
||||
break;
|
||||
|
||||
case 'mceItemQuickTime':
|
||||
s = 'writeQuickTime';
|
||||
break;
|
||||
|
||||
case 'mceItemRealMedia':
|
||||
s = 'writeRealMedia';
|
||||
break;
|
||||
}
|
||||
|
||||
if (attribs.width)
|
||||
at = at.replace(/width:[^0-9]?[0-9]+%?[^0-9]?/g, "width:'" + attribs.width + "'");
|
||||
|
||||
if (attribs.height)
|
||||
at = at.replace(/height:[^0-9]?[0-9]+%?[^0-9]?/g, "height:'" + attribs.height + "'");
|
||||
|
||||
// Force absolute URL
|
||||
pl.src = tinyMCE.convertURL(pl.src, null, true);
|
||||
at = at.replace(new RegExp("src:'[^']*'", "g"), "src:'" + pl.src + "'");
|
||||
|
||||
embedHTML = '<script type="text/javascript">' + s + '({' + at + '});</script>';
|
||||
}
|
||||
|
||||
// Insert embed/object chunk
|
||||
chunkBefore = content.substring(0, startPos);
|
||||
chunkAfter = content.substring(endPos);
|
||||
content = chunkBefore + embedHTML + chunkAfter;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return content;
|
||||
},
|
||||
|
||||
handleNodeChange : function(editor_id, node, undo_index, undo_levels, visual_aid, any_selection) {
|
||||
if (node == null)
|
||||
return;
|
||||
|
||||
do {
|
||||
if (node.nodeName == "IMG" && /mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(tinyMCE.getAttrib(node, 'class'))) {
|
||||
tinyMCE.switchClass(editor_id + '_media', 'mceButtonSelected');
|
||||
return true;
|
||||
}
|
||||
} while ((node = node.parentNode));
|
||||
|
||||
tinyMCE.switchClass(editor_id + '_media', 'mceButtonNormal');
|
||||
|
||||
return true;
|
||||
},
|
||||
|
||||
_createImgFromEmbed : function(n, d, cl) {
|
||||
var ne, at, i, ti = '', an;
|
||||
|
||||
ne = d.createElement('img');
|
||||
ne.src = tinyMCE.getParam("theme_href") + '/images/spacer.gif';
|
||||
ne.width = tinyMCE.getAttrib(n, 'width');
|
||||
ne.height = tinyMCE.getAttrib(n, 'height');
|
||||
ne.className = cl;
|
||||
|
||||
at = n.attributes;
|
||||
for (i=0; i<at.length; i++) {
|
||||
if (at[i].specified && at[i].nodeValue) {
|
||||
an = at[i].nodeName.toLowerCase();
|
||||
|
||||
if (an == 'src')
|
||||
continue;
|
||||
|
||||
if (an == 'mce_src')
|
||||
an = 'src';
|
||||
|
||||
if (an.indexOf('mce_') == -1 && !new RegExp('^(class|type)$').test(an))
|
||||
ti += an.toLowerCase() + ':\'' + at[i].nodeValue + "',";
|
||||
}
|
||||
}
|
||||
|
||||
ti = ti.length > 0 ? ti.substring(0, ti.length - 1) : ti;
|
||||
ne.title = ti;
|
||||
|
||||
n.parentNode.replaceChild(ne, n);
|
||||
},
|
||||
|
||||
_createImg : function(cl, d, n) {
|
||||
var i, nl, ti = "", an, av, al = new Array();
|
||||
|
||||
ne = d.createElement('img');
|
||||
ne.src = tinyMCE.getParam("theme_href") + '/images/spacer.gif';
|
||||
ne.width = tinyMCE.getAttrib(n, 'width');
|
||||
ne.height = tinyMCE.getAttrib(n, 'height');
|
||||
ne.className = cl;
|
||||
|
||||
al.id = tinyMCE.getAttrib(n, 'id');
|
||||
al.name = tinyMCE.getAttrib(n, 'name');
|
||||
al.width = tinyMCE.getAttrib(n, 'width');
|
||||
al.height = tinyMCE.getAttrib(n, 'height');
|
||||
al.bgcolor = tinyMCE.getAttrib(n, 'bgcolor');
|
||||
al.align = tinyMCE.getAttrib(n, 'align');
|
||||
al.class_name = tinyMCE.getAttrib(n, 'mce_class');
|
||||
|
||||
nl = n.getElementsByTagName('div');
|
||||
for (i=0; i<nl.length; i++) {
|
||||
av = tinyMCE.getAttrib(nl[i], 'value');
|
||||
av = av.replace(new RegExp('\\\\', 'g'), '\\\\');
|
||||
av = av.replace(new RegExp('"', 'g'), '\\"');
|
||||
av = av.replace(new RegExp("'", 'g'), "\\'");
|
||||
an = tinyMCE.getAttrib(nl[i], 'name');
|
||||
al[an] = av;
|
||||
}
|
||||
|
||||
if (al.movie) {
|
||||
al.src = al.movie;
|
||||
al.movie = null;
|
||||
}
|
||||
|
||||
for (an in al) {
|
||||
if (al[an] != null && typeof(al[an]) != "function" && al[an] != '')
|
||||
ti += an.toLowerCase() + ':\'' + al[an] + "',";
|
||||
}
|
||||
|
||||
ti = ti.length > 0 ? ti.substring(0, ti.length - 1) : ti;
|
||||
ne.title = ti;
|
||||
|
||||
return ne;
|
||||
},
|
||||
|
||||
_getEmbed : function(cls, cb, mt, p, at) {
|
||||
var h = '', n;
|
||||
|
||||
p.width = at.width ? at.width : p.width;
|
||||
p.height = at.height ? at.height : p.height;
|
||||
|
||||
h += '<object classid="clsid:' + cls + '" codebase="' + cb + '"';
|
||||
h += typeof(p.id) != "undefined" ? ' id="' + p.id + '"' : '';
|
||||
h += typeof(p.name) != "undefined" ? ' name="' + p.name + '"' : '';
|
||||
h += typeof(p.width) != "undefined" ? ' width="' + p.width + '"' : '';
|
||||
h += typeof(p.height) != "undefined" ? ' height="' + p.height + '"' : '';
|
||||
h += typeof(p.align) != "undefined" ? ' align="' + p.align + '"' : '';
|
||||
h += '>';
|
||||
|
||||
for (n in p) {
|
||||
if (typeof(p[n]) != "undefined" && typeof(p[n]) != "function") {
|
||||
h += '<param name="' + n + '" value="' + p[n] + '" />';
|
||||
|
||||
// Add extra url parameter if it's an absolute URL on WMP
|
||||
if (n == 'src' && p[n].indexOf('://') != -1 && mt == 'application/x-mplayer2')
|
||||
h += '<param name="url" value="' + p[n] + '" />';
|
||||
}
|
||||
}
|
||||
|
||||
h += '<embed type="' + mt + '"';
|
||||
|
||||
for (n in p) {
|
||||
if (typeof(p[n]) == "function")
|
||||
continue;
|
||||
|
||||
// Skip url parameter for embed tag on WMP
|
||||
if (!(n == 'url' && mt == 'application/x-mplayer2'))
|
||||
h += ' ' + n + '="' + p[n] + '"';
|
||||
}
|
||||
|
||||
h += '></embed></object>';
|
||||
|
||||
return h;
|
||||
},
|
||||
|
||||
_parseAttributes : function(attribute_string) {
|
||||
var attributeName = "", endChr = '"';
|
||||
var attributeValue = "";
|
||||
var withInName;
|
||||
var withInValue;
|
||||
var attributes = new Array();
|
||||
var whiteSpaceRegExp = new RegExp('^[ \n\r\t]+', 'g');
|
||||
|
||||
if (attribute_string == null || attribute_string.length < 2)
|
||||
return null;
|
||||
|
||||
withInName = withInValue = false;
|
||||
|
||||
for (var i=0; i<attribute_string.length; i++) {
|
||||
var chr = attribute_string.charAt(i);
|
||||
|
||||
if ((chr == '"' || chr == "'") && !withInValue) {
|
||||
withInValue = true;
|
||||
endChr = chr;
|
||||
} else if (chr == endChr && withInValue) {
|
||||
withInValue = false;
|
||||
|
||||
var pos = attributeName.lastIndexOf(' ');
|
||||
if (pos != -1)
|
||||
attributeName = attributeName.substring(pos+1);
|
||||
|
||||
attributes[attributeName.toLowerCase()] = attributeValue.substring(1);
|
||||
|
||||
attributeName = "";
|
||||
attributeValue = "";
|
||||
} else if (!whiteSpaceRegExp.test(chr) && !withInName && !withInValue)
|
||||
withInName = true;
|
||||
|
||||
if (chr == '=' && withInName)
|
||||
withInName = false;
|
||||
|
||||
if (withInName)
|
||||
attributeName += chr;
|
||||
|
||||
if (withInValue)
|
||||
attributeValue += chr;
|
||||
}
|
||||
|
||||
return attributes;
|
||||
}
|
||||
};
|
||||
|
||||
tinyMCE.addPlugin("media", TinyMCE_MediaPlugin);
|
||||
|
@ -1,73 +1,73 @@
|
||||
/**
|
||||
* This script contains embed functions for common plugins. This scripts are complety free to use for any purpose.
|
||||
*/
|
||||
|
||||
function writeFlash(p) {
|
||||
writeEmbed(
|
||||
'D27CDB6E-AE6D-11cf-96B8-444553540000',
|
||||
'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0',
|
||||
'application/x-shockwave-flash',
|
||||
p
|
||||
);
|
||||
}
|
||||
|
||||
function writeShockWave(p) {
|
||||
writeEmbed(
|
||||
'166B1BCA-3F9C-11CF-8075-444553540000',
|
||||
'http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0',
|
||||
'application/x-director',
|
||||
p
|
||||
);
|
||||
}
|
||||
|
||||
function writeQuickTime(p) {
|
||||
writeEmbed(
|
||||
'02BF25D5-8C17-4B23-BC80-D3488ABDDC6B',
|
||||
'http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0',
|
||||
'video/quicktime',
|
||||
p
|
||||
);
|
||||
}
|
||||
|
||||
function writeRealMedia(p) {
|
||||
writeEmbed(
|
||||
'CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA',
|
||||
'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0',
|
||||
'audio/x-pn-realaudio-plugin',
|
||||
p
|
||||
);
|
||||
}
|
||||
|
||||
function writeWindowsMedia(p) {
|
||||
p.url = p.src;
|
||||
writeEmbed(
|
||||
'6BF52A52-394A-11D3-B153-00C04F79FAA6',
|
||||
'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701',
|
||||
'application/x-mplayer2',
|
||||
p
|
||||
);
|
||||
}
|
||||
|
||||
function writeEmbed(cls, cb, mt, p) {
|
||||
var h = '', n;
|
||||
|
||||
h += '<object classid="clsid:' + cls + '" codebase="' + cb + '"';
|
||||
h += typeof(p.id) != "undefined" ? 'id="' + p.id + '"' : '';
|
||||
h += typeof(p.name) != "undefined" ? 'name="' + p.name + '"' : '';
|
||||
h += typeof(p.width) != "undefined" ? 'width="' + p.width + '"' : '';
|
||||
h += typeof(p.height) != "undefined" ? 'height="' + p.height + '"' : '';
|
||||
h += typeof(p.align) != "undefined" ? 'align="' + p.align + '"' : '';
|
||||
h += '>';
|
||||
|
||||
for (n in p)
|
||||
h += '<param name="' + n + '" value="' + p[n] + '">';
|
||||
|
||||
h += '<embed type="' + mt + '"';
|
||||
|
||||
for (n in p)
|
||||
h += n + '="' + p[n] + '" ';
|
||||
|
||||
h += '></embed></object>';
|
||||
|
||||
document.write(h);
|
||||
}
|
||||
/**
|
||||
* This script contains embed functions for common plugins. This scripts are complety free to use for any purpose.
|
||||
*/
|
||||
|
||||
function writeFlash(p) {
|
||||
writeEmbed(
|
||||
'D27CDB6E-AE6D-11cf-96B8-444553540000',
|
||||
'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0',
|
||||
'application/x-shockwave-flash',
|
||||
p
|
||||
);
|
||||
}
|
||||
|
||||
function writeShockWave(p) {
|
||||
writeEmbed(
|
||||
'166B1BCA-3F9C-11CF-8075-444553540000',
|
||||
'http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0',
|
||||
'application/x-director',
|
||||
p
|
||||
);
|
||||
}
|
||||
|
||||
function writeQuickTime(p) {
|
||||
writeEmbed(
|
||||
'02BF25D5-8C17-4B23-BC80-D3488ABDDC6B',
|
||||
'http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0',
|
||||
'video/quicktime',
|
||||
p
|
||||
);
|
||||
}
|
||||
|
||||
function writeRealMedia(p) {
|
||||
writeEmbed(
|
||||
'CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA',
|
||||
'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0',
|
||||
'audio/x-pn-realaudio-plugin',
|
||||
p
|
||||
);
|
||||
}
|
||||
|
||||
function writeWindowsMedia(p) {
|
||||
p.url = p.src;
|
||||
writeEmbed(
|
||||
'6BF52A52-394A-11D3-B153-00C04F79FAA6',
|
||||
'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701',
|
||||
'application/x-mplayer2',
|
||||
p
|
||||
);
|
||||
}
|
||||
|
||||
function writeEmbed(cls, cb, mt, p) {
|
||||
var h = '', n;
|
||||
|
||||
h += '<object classid="clsid:' + cls + '" codebase="' + cb + '"';
|
||||
h += typeof(p.id) != "undefined" ? 'id="' + p.id + '"' : '';
|
||||
h += typeof(p.name) != "undefined" ? 'name="' + p.name + '"' : '';
|
||||
h += typeof(p.width) != "undefined" ? 'width="' + p.width + '"' : '';
|
||||
h += typeof(p.height) != "undefined" ? 'height="' + p.height + '"' : '';
|
||||
h += typeof(p.align) != "undefined" ? 'align="' + p.align + '"' : '';
|
||||
h += '>';
|
||||
|
||||
for (n in p)
|
||||
h += '<param name="' + n + '" value="' + p[n] + '">';
|
||||
|
||||
h += '<embed type="' + mt + '"';
|
||||
|
||||
for (n in p)
|
||||
h += n + '="' + p[n] + '" ';
|
||||
|
||||
h += '></embed></object>';
|
||||
|
||||
document.write(h);
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,94 +1,94 @@
|
||||
// UK lang variables
|
||||
|
||||
tinyMCE.addToLang('media',{
|
||||
title : 'Insert / edit embedded media',
|
||||
desc : 'Insert / edit embedded media',
|
||||
general : 'General',
|
||||
advanced : 'Advanced',
|
||||
file : 'File/URL',
|
||||
list : 'List',
|
||||
size : 'Dimensions',
|
||||
preview : 'Preview',
|
||||
constrain_proportions : 'Constrain proportions',
|
||||
type : 'Type',
|
||||
id : 'Id',
|
||||
name : 'Name',
|
||||
class_name : 'Class',
|
||||
vspace : 'V-Space',
|
||||
hspace : 'H-Space',
|
||||
play : 'Auto play',
|
||||
loop : 'Loop',
|
||||
menu : 'Show menu',
|
||||
quality : 'Quality',
|
||||
scale : 'Scale',
|
||||
align : 'Align',
|
||||
salign : 'SAlign',
|
||||
wmode : 'WMode',
|
||||
bgcolor : 'Background',
|
||||
base : 'Base',
|
||||
flashvars : 'Flashvars',
|
||||
liveconnect : 'SWLiveConnect',
|
||||
autohref : 'AutoHREF',
|
||||
cache : 'Cache',
|
||||
hidden : 'Hidden',
|
||||
controller : 'Controller',
|
||||
kioskmode : 'Kiosk mode',
|
||||
playeveryframe : 'Play every frame',
|
||||
targetcache : 'Target cache',
|
||||
correction : 'No correction',
|
||||
enablejavascript : 'Enable JavaScript',
|
||||
starttime : 'Start time',
|
||||
endtime : 'End time',
|
||||
href : 'Href',
|
||||
qtsrcchokespeed : 'Choke speed',
|
||||
target : 'Target',
|
||||
volume : 'Volume',
|
||||
autostart : 'Auto start',
|
||||
enabled : 'Enabled',
|
||||
fullscreen : 'Fullscreen',
|
||||
invokeurls : 'Invoke URLs',
|
||||
mute : 'Mute',
|
||||
stretchtofit : 'Stretch to fit',
|
||||
windowlessvideo : 'Windowless video',
|
||||
balance : 'Balance',
|
||||
baseurl : 'Base URL',
|
||||
captioningid : 'Captioning id',
|
||||
currentmarker : 'Current marker',
|
||||
currentposition : 'Current position',
|
||||
defaultframe : 'Default frame',
|
||||
playcount : 'Play count',
|
||||
rate : 'Rate',
|
||||
uimode : 'UI Mode',
|
||||
flash_options : 'Flash options',
|
||||
qt_options : 'Quicktime options',
|
||||
wmp_options : 'Windows media player options',
|
||||
rmp_options : 'Real media player options',
|
||||
shockwave_options : 'Shockwave options',
|
||||
autogotourl : 'Auto goto URL',
|
||||
center : 'Center',
|
||||
imagestatus : 'Image status',
|
||||
maintainaspect : 'Maintain aspect',
|
||||
nojava : 'No java',
|
||||
prefetch : 'Prefetch',
|
||||
shuffle : 'Shuffle',
|
||||
console : 'Console',
|
||||
numloop : 'Num loops',
|
||||
controls : 'Controls',
|
||||
scriptcallbacks : 'Script callbacks',
|
||||
swstretchstyle : 'Stretch style',
|
||||
swstretchhalign : 'Stretch H-Align',
|
||||
swstretchvalign : 'Stretch V-Align',
|
||||
sound : 'Sound',
|
||||
progress : 'Progress',
|
||||
qtsrc : 'QT Src',
|
||||
qt_stream_warn : 'Streamed rtsp resources should be added to the QT Src field under the advanced tab.\nYou should also add a non streamed version to the Src field..',
|
||||
align_top : 'Top',
|
||||
align_right : 'Right',
|
||||
align_bottom : 'Bottom',
|
||||
align_left : 'Left',
|
||||
align_center : 'Center',
|
||||
align_top_left : 'Top left',
|
||||
align_top_right : 'Top right',
|
||||
align_bottom_left : 'Bottom left',
|
||||
align_bottom_right : 'Bottom right'
|
||||
// UK lang variables
|
||||
|
||||
tinyMCE.addToLang('media',{
|
||||
title : 'Insert / edit embedded media',
|
||||
desc : 'Insert / edit embedded media',
|
||||
general : 'General',
|
||||
advanced : 'Advanced',
|
||||
file : 'File/URL',
|
||||
list : 'List',
|
||||
size : 'Dimensions',
|
||||
preview : 'Preview',
|
||||
constrain_proportions : 'Constrain proportions',
|
||||
type : 'Type',
|
||||
id : 'Id',
|
||||
name : 'Name',
|
||||
class_name : 'Class',
|
||||
vspace : 'V-Space',
|
||||
hspace : 'H-Space',
|
||||
play : 'Auto play',
|
||||
loop : 'Loop',
|
||||
menu : 'Show menu',
|
||||
quality : 'Quality',
|
||||
scale : 'Scale',
|
||||
align : 'Align',
|
||||
salign : 'SAlign',
|
||||
wmode : 'WMode',
|
||||
bgcolor : 'Background',
|
||||
base : 'Base',
|
||||
flashvars : 'Flashvars',
|
||||
liveconnect : 'SWLiveConnect',
|
||||
autohref : 'AutoHREF',
|
||||
cache : 'Cache',
|
||||
hidden : 'Hidden',
|
||||
controller : 'Controller',
|
||||
kioskmode : 'Kiosk mode',
|
||||
playeveryframe : 'Play every frame',
|
||||
targetcache : 'Target cache',
|
||||
correction : 'No correction',
|
||||
enablejavascript : 'Enable JavaScript',
|
||||
starttime : 'Start time',
|
||||
endtime : 'End time',
|
||||
href : 'Href',
|
||||
qtsrcchokespeed : 'Choke speed',
|
||||
target : 'Target',
|
||||
volume : 'Volume',
|
||||
autostart : 'Auto start',
|
||||
enabled : 'Enabled',
|
||||
fullscreen : 'Fullscreen',
|
||||
invokeurls : 'Invoke URLs',
|
||||
mute : 'Mute',
|
||||
stretchtofit : 'Stretch to fit',
|
||||
windowlessvideo : 'Windowless video',
|
||||
balance : 'Balance',
|
||||
baseurl : 'Base URL',
|
||||
captioningid : 'Captioning id',
|
||||
currentmarker : 'Current marker',
|
||||
currentposition : 'Current position',
|
||||
defaultframe : 'Default frame',
|
||||
playcount : 'Play count',
|
||||
rate : 'Rate',
|
||||
uimode : 'UI Mode',
|
||||
flash_options : 'Flash options',
|
||||
qt_options : 'Quicktime options',
|
||||
wmp_options : 'Windows media player options',
|
||||
rmp_options : 'Real media player options',
|
||||
shockwave_options : 'Shockwave options',
|
||||
autogotourl : 'Auto goto URL',
|
||||
center : 'Center',
|
||||
imagestatus : 'Image status',
|
||||
maintainaspect : 'Maintain aspect',
|
||||
nojava : 'No java',
|
||||
prefetch : 'Prefetch',
|
||||
shuffle : 'Shuffle',
|
||||
console : 'Console',
|
||||
numloop : 'Num loops',
|
||||
controls : 'Controls',
|
||||
scriptcallbacks : 'Script callbacks',
|
||||
swstretchstyle : 'Stretch style',
|
||||
swstretchhalign : 'Stretch H-Align',
|
||||
swstretchvalign : 'Stretch V-Align',
|
||||
sound : 'Sound',
|
||||
progress : 'Progress',
|
||||
qtsrc : 'QT Src',
|
||||
qt_stream_warn : 'Streamed rtsp resources should be added to the QT Src field under the advanced tab.\nYou should also add a non streamed version to the Src field..',
|
||||
align_top : 'Top',
|
||||
align_right : 'Right',
|
||||
align_bottom : 'Bottom',
|
||||
align_left : 'Left',
|
||||
align_center : 'Center',
|
||||
align_top_left : 'Top left',
|
||||
align_top_right : 'Top right',
|
||||
align_bottom_left : 'Bottom left',
|
||||
align_bottom_right : 'Bottom right'
|
||||
});
|
@ -1 +1 @@
|
||||
This is the location you place TinyMCE plugins.
|
||||
This is the location you place TinyMCE plugins.
|
||||
|
@ -1,17 +1,17 @@
|
||||
/* CSS file for cell dialog in the table plugin */
|
||||
|
||||
.panel_wrapper div.current {
|
||||
height: 200px;
|
||||
}
|
||||
|
||||
.advfield {
|
||||
width: 200px;
|
||||
}
|
||||
|
||||
#action {
|
||||
margin-bottom: 3px;
|
||||
}
|
||||
|
||||
#class {
|
||||
width: 150px;
|
||||
/* CSS file for cell dialog in the table plugin */
|
||||
|
||||
.panel_wrapper div.current {
|
||||
height: 200px;
|
||||
}
|
||||
|
||||
.advfield {
|
||||
width: 200px;
|
||||
}
|
||||
|
||||
#action {
|
||||
margin-bottom: 3px;
|
||||
}
|
||||
|
||||
#class {
|
||||
width: 150px;
|
||||
}
|
@ -1,25 +1,25 @@
|
||||
/* CSS file for row dialog in the table plugin */
|
||||
|
||||
.panel_wrapper div.current {
|
||||
height: 200px;
|
||||
}
|
||||
|
||||
.advfield {
|
||||
width: 200px;
|
||||
}
|
||||
|
||||
#action {
|
||||
margin-bottom: 3px;
|
||||
}
|
||||
|
||||
#rowtype,#align,#valign,#class,#height {
|
||||
width: 150px;
|
||||
}
|
||||
|
||||
#height {
|
||||
width: 50px;
|
||||
}
|
||||
|
||||
.col2 {
|
||||
padding-left: 20px;
|
||||
}
|
||||
/* CSS file for row dialog in the table plugin */
|
||||
|
||||
.panel_wrapper div.current {
|
||||
height: 200px;
|
||||
}
|
||||
|
||||
.advfield {
|
||||
width: 200px;
|
||||
}
|
||||
|
||||
#action {
|
||||
margin-bottom: 3px;
|
||||
}
|
||||
|
||||
#rowtype,#align,#valign,#class,#height {
|
||||
width: 150px;
|
||||
}
|
||||
|
||||
#height {
|
||||
width: 50px;
|
||||
}
|
||||
|
||||
.col2 {
|
||||
padding-left: 20px;
|
||||
}
|
||||
|
@ -1,13 +1,13 @@
|
||||
/* CSS file for table dialog in the table plugin */
|
||||
|
||||
.panel_wrapper div.current {
|
||||
height: 220px;
|
||||
}
|
||||
|
||||
.advfield {
|
||||
width: 200px;
|
||||
}
|
||||
|
||||
#class {
|
||||
width: 150px;
|
||||
}
|
||||
/* CSS file for table dialog in the table plugin */
|
||||
|
||||
.panel_wrapper div.current {
|
||||
height: 220px;
|
||||
}
|
||||
|
||||
.advfield {
|
||||
width: 200px;
|
||||
}
|
||||
|
||||
#class {
|
||||
width: 150px;
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,100 +1,100 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>{$lang_insert_image_title}</title>
|
||||
<script language="javascript" type="text/javascript" src="../../tiny_mce_popup.js"></script>
|
||||
<script language="javascript" type="text/javascript" src="../../utils/mctabs.js"></script>
|
||||
<script language="javascript" type="text/javascript" src="../../utils/form_utils.js"></script>
|
||||
<script language="javascript" type="text/javascript" src="jscripts/image.js"></script>
|
||||
<base target="_self" />
|
||||
</head>
|
||||
<body id="image" onload="tinyMCEPopup.executeOnLoad('init();');" style="display: none">
|
||||
<form onsubmit="insertImage();return false;" action="#">
|
||||
<div class="tabs">
|
||||
<ul>
|
||||
<li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{$lang_insert_image_title}</a></span></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="panel_wrapper">
|
||||
<div id="general_panel" class="panel current">
|
||||
<table border="0" cellpadding="4" cellspacing="0">
|
||||
<tr>
|
||||
<td nowrap="nowrap"><label for="src">{$lang_insert_image_src}</label></td>
|
||||
<td><table border="0" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td><input id="src" name="src" type="text" value="" style="width: 200px" onchange="getImageData();" /></td>
|
||||
<td id="srcbrowsercontainer"> </td>
|
||||
</tr>
|
||||
</table></td>
|
||||
</tr>
|
||||
<!-- Image list -->
|
||||
<script language="javascript">
|
||||
if (typeof(tinyMCEImageList) != "undefined" && tinyMCEImageList.length > 0) {
|
||||
var html = "";
|
||||
|
||||
html += '<tr><td><label for="image_list">{$lang_image_list}</label></td>';
|
||||
html += '<td><select id="image_list" name="image_list" style="width: 200px" onchange="this.form.src.value=this.options[this.selectedIndex].value;resetImageData();getImageData();">';
|
||||
html += '<option value="">---</option>';
|
||||
|
||||
for (var i=0; i<tinyMCEImageList.length; i++)
|
||||
html += '<option value="' + tinyMCEImageList[i][1] + '">' + tinyMCEImageList[i][0] + '</option>';
|
||||
|
||||
html += '</select></td></tr>';
|
||||
|
||||
document.write(html);
|
||||
}
|
||||
</script>
|
||||
<!-- /Image list -->
|
||||
<tr>
|
||||
<td nowrap="nowrap"><label for="alt">{$lang_insert_image_alt}</label></td>
|
||||
<td><input id="alt" name="alt" type="text" value="" style="width: 200px" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap="nowrap"><label for="align">{$lang_insert_image_align}</label></td>
|
||||
<td><select id="align" name="align">
|
||||
<option value="">{$lang_insert_image_align_default}</option>
|
||||
<option value="baseline">{$lang_insert_image_align_baseline}</option>
|
||||
<option value="top">{$lang_insert_image_align_top}</option>
|
||||
<option value="middle">{$lang_insert_image_align_middle}</option>
|
||||
<option value="bottom">{$lang_insert_image_align_bottom}</option>
|
||||
<option value="texttop">{$lang_insert_image_align_texttop}</option>
|
||||
<option value="absmiddle">{$lang_insert_image_align_absmiddle}</option>
|
||||
<option value="absbottom">{$lang_insert_image_align_absbottom}</option>
|
||||
<option value="left">{$lang_insert_image_align_left}</option>
|
||||
<option value="right">{$lang_insert_image_align_right}</option>
|
||||
</select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap="nowrap"><label for="width">{$lang_insert_image_dimensions}</label></td>
|
||||
<td><input id="width" name="width" type="text" value="" size="3" maxlength="5" />
|
||||
x
|
||||
<input id="height" name="height" type="text" value="" size="3" maxlength="5" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap="nowrap"><label for="border">{$lang_insert_image_border}</label></td>
|
||||
<td><input id="border" name="border" type="text" value="" size="3" maxlength="3" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap="nowrap"><label for="vspace">{$lang_insert_image_vspace}</label></td>
|
||||
<td><input id="vspace" name="vspace" type="text" value="" size="3" maxlength="3" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap="nowrap"><label for="hspace">{$lang_insert_image_hspace}</label></td>
|
||||
<td><input id="hspace" name="hspace" type="text" value="" size="3" maxlength="3" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mceActionPanel">
|
||||
<div style="float: left">
|
||||
<input type="button" id="insert" name="insert" value="{$lang_insert}" onclick="insertImage();" />
|
||||
</div>
|
||||
|
||||
<div style="float: right">
|
||||
<input type="button" id="cancel" name="cancel" value="{$lang_cancel}" onclick="tinyMCEPopup.close();" />
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>{$lang_insert_image_title}</title>
|
||||
<script language="javascript" type="text/javascript" src="../../tiny_mce_popup.js"></script>
|
||||
<script language="javascript" type="text/javascript" src="../../utils/mctabs.js"></script>
|
||||
<script language="javascript" type="text/javascript" src="../../utils/form_utils.js"></script>
|
||||
<script language="javascript" type="text/javascript" src="jscripts/image.js"></script>
|
||||
<base target="_self" />
|
||||
</head>
|
||||
<body id="image" onload="tinyMCEPopup.executeOnLoad('init();');" style="display: none">
|
||||
<form onsubmit="insertImage();return false;" action="#">
|
||||
<div class="tabs">
|
||||
<ul>
|
||||
<li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{$lang_insert_image_title}</a></span></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="panel_wrapper">
|
||||
<div id="general_panel" class="panel current">
|
||||
<table border="0" cellpadding="4" cellspacing="0">
|
||||
<tr>
|
||||
<td nowrap="nowrap"><label for="src">{$lang_insert_image_src}</label></td>
|
||||
<td><table border="0" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td><input id="src" name="src" type="text" value="" style="width: 200px" onchange="getImageData();" /></td>
|
||||
<td id="srcbrowsercontainer"> </td>
|
||||
</tr>
|
||||
</table></td>
|
||||
</tr>
|
||||
<!-- Image list -->
|
||||
<script language="javascript">
|
||||
if (typeof(tinyMCEImageList) != "undefined" && tinyMCEImageList.length > 0) {
|
||||
var html = "";
|
||||
|
||||
html += '<tr><td><label for="image_list">{$lang_image_list}</label></td>';
|
||||
html += '<td><select id="image_list" name="image_list" style="width: 200px" onchange="this.form.src.value=this.options[this.selectedIndex].value;resetImageData();getImageData();">';
|
||||
html += '<option value="">---</option>';
|
||||
|
||||
for (var i=0; i<tinyMCEImageList.length; i++)
|
||||
html += '<option value="' + tinyMCEImageList[i][1] + '">' + tinyMCEImageList[i][0] + '</option>';
|
||||
|
||||
html += '</select></td></tr>';
|
||||
|
||||
document.write(html);
|
||||
}
|
||||
</script>
|
||||
<!-- /Image list -->
|
||||
<tr>
|
||||
<td nowrap="nowrap"><label for="alt">{$lang_insert_image_alt}</label></td>
|
||||
<td><input id="alt" name="alt" type="text" value="" style="width: 200px" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap="nowrap"><label for="align">{$lang_insert_image_align}</label></td>
|
||||
<td><select id="align" name="align">
|
||||
<option value="">{$lang_insert_image_align_default}</option>
|
||||
<option value="baseline">{$lang_insert_image_align_baseline}</option>
|
||||
<option value="top">{$lang_insert_image_align_top}</option>
|
||||
<option value="middle">{$lang_insert_image_align_middle}</option>
|
||||
<option value="bottom">{$lang_insert_image_align_bottom}</option>
|
||||
<option value="texttop">{$lang_insert_image_align_texttop}</option>
|
||||
<option value="absmiddle">{$lang_insert_image_align_absmiddle}</option>
|
||||
<option value="absbottom">{$lang_insert_image_align_absbottom}</option>
|
||||
<option value="left">{$lang_insert_image_align_left}</option>
|
||||
<option value="right">{$lang_insert_image_align_right}</option>
|
||||
</select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap="nowrap"><label for="width">{$lang_insert_image_dimensions}</label></td>
|
||||
<td><input id="width" name="width" type="text" value="" size="3" maxlength="5" />
|
||||
x
|
||||
<input id="height" name="height" type="text" value="" size="3" maxlength="5" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap="nowrap"><label for="border">{$lang_insert_image_border}</label></td>
|
||||
<td><input id="border" name="border" type="text" value="" size="3" maxlength="3" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap="nowrap"><label for="vspace">{$lang_insert_image_vspace}</label></td>
|
||||
<td><input id="vspace" name="vspace" type="text" value="" size="3" maxlength="3" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap="nowrap"><label for="hspace">{$lang_insert_image_hspace}</label></td>
|
||||
<td><input id="hspace" name="hspace" type="text" value="" size="3" maxlength="3" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mceActionPanel">
|
||||
<div style="float: left">
|
||||
<input type="button" id="insert" name="insert" value="{$lang_insert}" onclick="insertImage();" />
|
||||
</div>
|
||||
|
||||
<div style="float: right">
|
||||
<input type="button" id="cancel" name="cancel" value="{$lang_cancel}" onclick="tinyMCEPopup.close();" />
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -1,294 +1,294 @@
|
||||
// Some global instances, this will be filled later
|
||||
var tinyMCE = null, tinyMCELang = null;
|
||||
|
||||
function TinyMCE_Popup() {
|
||||
};
|
||||
|
||||
TinyMCE_Popup.prototype = {
|
||||
findWin : function(w) {
|
||||
var c;
|
||||
|
||||
// Check parents
|
||||
c = w;
|
||||
while (c && (c = c.parent) != null) {
|
||||
if (typeof(c.tinyMCE) != "undefined")
|
||||
return c;
|
||||
}
|
||||
|
||||
// Check openers
|
||||
c = w;
|
||||
while (c && (c = c.opener) != null) {
|
||||
if (typeof(c.tinyMCE) != "undefined")
|
||||
return c;
|
||||
}
|
||||
|
||||
// Try top
|
||||
if (typeof(top.tinyMCE) != "undefined")
|
||||
return top;
|
||||
|
||||
return null;
|
||||
},
|
||||
|
||||
init : function() {
|
||||
var win = window.opener ? window.opener : window.dialogArguments, c;
|
||||
var inst, re, title, divElm;
|
||||
|
||||
if (!win)
|
||||
win = this.findWin(window);
|
||||
|
||||
if (!win) {
|
||||
alert("tinyMCE object reference not found from popup.");
|
||||
return;
|
||||
}
|
||||
|
||||
window.opener = win;
|
||||
this.windowOpener = win;
|
||||
this.onLoadEval = "";
|
||||
|
||||
// Setup parent references
|
||||
tinyMCE = win.tinyMCE;
|
||||
tinyMCELang = win.tinyMCELang;
|
||||
|
||||
inst = tinyMCE.selectedInstance;
|
||||
this.isWindow = tinyMCE.getWindowArg('mce_inside_iframe', false) == false;
|
||||
this.storeSelection = (tinyMCE.isRealIE) && !this.isWindow && tinyMCE.getWindowArg('mce_store_selection', true);
|
||||
|
||||
if (this.isWindow)
|
||||
window.focus();
|
||||
|
||||
// Store selection
|
||||
if (this.storeSelection)
|
||||
inst.selectionBookmark = inst.selection.getBookmark(true);
|
||||
|
||||
// Setup dir
|
||||
if (tinyMCELang.lang_dir)
|
||||
document.dir = tinyMCELang.lang_dir;
|
||||
|
||||
// Setup title
|
||||
re = new RegExp('{|\\\$|}', 'g');
|
||||
title = document.title.replace(re, "");
|
||||
if (typeof(tinyMCELang[title]) != "undefined") {
|
||||
divElm = document.createElement("div");
|
||||
divElm.innerHTML = tinyMCELang[title];
|
||||
document.title = divElm.innerHTML;
|
||||
|
||||
if (typeof(tinyMCE.setWindowTitle) != 'undefined')
|
||||
tinyMCE.setWindowTitle(window, divElm.innerHTML);
|
||||
}
|
||||
|
||||
// Output Popup CSS class
|
||||
document.write('<link href="' + tinyMCE.getParam("popups_css") + '" rel="stylesheet" type="text/css">');
|
||||
|
||||
if (tinyMCE.getParam("popups_css_add")) {
|
||||
c = tinyMCE.getParam("popups_css_add");
|
||||
|
||||
// Is relative
|
||||
if (c.indexOf('://') == -1 && c.charAt(0) != '/')
|
||||
c = tinyMCE.documentBasePath + "/" + c;
|
||||
|
||||
document.write('<link href="' + c + '" rel="stylesheet" type="text/css">');
|
||||
}
|
||||
|
||||
tinyMCE.addEvent(window, "load", this.onLoad);
|
||||
},
|
||||
|
||||
onLoad : function() {
|
||||
var dir, i, elms, body = document.body;
|
||||
|
||||
if (tinyMCE.getWindowArg('mce_replacevariables', true))
|
||||
body.innerHTML = tinyMCE.applyTemplate(body.innerHTML, tinyMCE.windowArgs);
|
||||
|
||||
dir = tinyMCE.selectedInstance.settings.directionality;
|
||||
if (dir == "rtl" && document.forms && document.forms.length > 0) {
|
||||
elms = document.forms[0].elements;
|
||||
for (i=0; i<elms.length; i++) {
|
||||
if ((elms[i].type == "text" || elms[i].type == "textarea") && elms[i].getAttribute("dir") != "ltr")
|
||||
elms[i].dir = dir;
|
||||
}
|
||||
}
|
||||
|
||||
if (body.style.display == 'none')
|
||||
body.style.display = 'block';
|
||||
|
||||
// Execute real onload (Opera fix)
|
||||
if (tinyMCEPopup.onLoadEval !== '')
|
||||
eval(tinyMCEPopup.onLoadEval);
|
||||
},
|
||||
|
||||
executeOnLoad : function(str) {
|
||||
if (tinyMCE.isOpera && parseFloat(opera.version()) < 9.5)
|
||||
this.onLoadEval = str;
|
||||
else
|
||||
eval(str);
|
||||
},
|
||||
|
||||
resizeToInnerSize : function() {
|
||||
var i, doc, body, oldMargin, wrapper, iframe, nodes, dx, dy;
|
||||
|
||||
// Netscape 7.1 workaround
|
||||
if (this.isWindow && tinyMCE.isNS71) {
|
||||
window.resizeBy(0, 10);
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.isWindow) {
|
||||
doc = document;
|
||||
body = doc.body;
|
||||
|
||||
if (body.style.display == 'none')
|
||||
body.style.display = 'block';
|
||||
|
||||
// Remove margin
|
||||
oldMargin = body.style.margin;
|
||||
body.style.margin = '0';
|
||||
|
||||
// Create wrapper
|
||||
wrapper = doc.createElement("div");
|
||||
wrapper.id = 'mcBodyWrapper';
|
||||
wrapper.style.display = 'none';
|
||||
wrapper.style.margin = '0';
|
||||
|
||||
// Wrap body elements
|
||||
nodes = doc.body.childNodes;
|
||||
for (i=nodes.length-1; i>=0; i--) {
|
||||
if (wrapper.hasChildNodes())
|
||||
wrapper.insertBefore(nodes[i].cloneNode(true), wrapper.firstChild);
|
||||
else
|
||||
wrapper.appendChild(nodes[i].cloneNode(true));
|
||||
|
||||
nodes[i].parentNode.removeChild(nodes[i]);
|
||||
}
|
||||
|
||||
// Add wrapper
|
||||
doc.body.appendChild(wrapper);
|
||||
|
||||
// Create iframe
|
||||
iframe = document.createElement("iframe");
|
||||
iframe.id = "mcWinIframe";
|
||||
iframe.src = document.location.href.toLowerCase().indexOf('https') == -1 ? "about:blank" : tinyMCE.settings.default_document;
|
||||
iframe.width = "100%";
|
||||
iframe.height = "100%";
|
||||
iframe.style.margin = '0';
|
||||
|
||||
// Add iframe
|
||||
doc.body.appendChild(iframe);
|
||||
|
||||
// Measure iframe
|
||||
iframe = document.getElementById('mcWinIframe');
|
||||
dx = tinyMCE.getWindowArg('mce_width') - iframe.clientWidth;
|
||||
dy = tinyMCE.getWindowArg('mce_height') - iframe.clientHeight;
|
||||
|
||||
// Resize window
|
||||
// tinyMCE.debug(tinyMCE.getWindowArg('mce_width') + "," + tinyMCE.getWindowArg('mce_height') + " - " + dx + "," + dy);
|
||||
window.resizeBy(dx, dy);
|
||||
|
||||
// Hide iframe and show wrapper
|
||||
body.style.margin = oldMargin;
|
||||
iframe.style.display = 'none';
|
||||
wrapper.style.display = 'block';
|
||||
}
|
||||
},
|
||||
|
||||
resizeToContent : function() {
|
||||
var isMSIE = (navigator.appName == "Microsoft Internet Explorer");
|
||||
var isOpera = (navigator.userAgent.indexOf("Opera") != -1);
|
||||
var elm, width, height, x, y, dx, dy;
|
||||
|
||||
if (isOpera)
|
||||
return;
|
||||
|
||||
if (isMSIE) {
|
||||
try { window.resizeTo(10, 10); } catch (e) {}
|
||||
|
||||
elm = document.body;
|
||||
width = elm.offsetWidth;
|
||||
height = elm.offsetHeight;
|
||||
dx = (elm.scrollWidth - width) + 4;
|
||||
dy = elm.scrollHeight - height;
|
||||
|
||||
try { window.resizeBy(dx, dy); } catch (e) {}
|
||||
} else {
|
||||
window.scrollBy(1000, 1000);
|
||||
if (window.scrollX > 0 || window.scrollY > 0) {
|
||||
window.resizeBy(window.innerWidth * 2, window.innerHeight * 2);
|
||||
window.sizeToContent();
|
||||
window.scrollTo(0, 0);
|
||||
x = parseInt(screen.width / 2.0) - (window.outerWidth / 2.0);
|
||||
y = parseInt(screen.height / 2.0) - (window.outerHeight / 2.0);
|
||||
window.moveTo(x, y);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
getWindowArg : function(name, default_value) {
|
||||
return tinyMCE.getWindowArg(name, default_value);
|
||||
},
|
||||
|
||||
restoreSelection : function() {
|
||||
var inst;
|
||||
|
||||
if (this.storeSelection) {
|
||||
inst = tinyMCE.selectedInstance;
|
||||
|
||||
inst.getWin().focus();
|
||||
|
||||
if (inst.selectionBookmark)
|
||||
inst.selection.moveToBookmark(inst.selectionBookmark);
|
||||
}
|
||||
},
|
||||
|
||||
execCommand : function(command, user_interface, value) {
|
||||
var inst = tinyMCE.selectedInstance;
|
||||
|
||||
this.restoreSelection();
|
||||
inst.execCommand(command, user_interface, value);
|
||||
|
||||
// Store selection
|
||||
if (this.storeSelection)
|
||||
inst.selectionBookmark = inst.selection.getBookmark(true);
|
||||
},
|
||||
|
||||
close : function() {
|
||||
tinyMCE.closeWindow(window);
|
||||
},
|
||||
|
||||
pickColor : function(e, element_id) {
|
||||
tinyMCE.selectedInstance.execCommand('mceColorPicker', true, {
|
||||
element_id : element_id,
|
||||
document : document,
|
||||
window : window,
|
||||
store_selection : false
|
||||
});
|
||||
},
|
||||
|
||||
openBrowser : function(element_id, type, option) {
|
||||
var cb = tinyMCE.getParam(option, tinyMCE.getParam("file_browser_callback"));
|
||||
var url = document.getElementById(element_id).value;
|
||||
|
||||
tinyMCE.setWindowArg("window", window);
|
||||
tinyMCE.setWindowArg("document", document);
|
||||
|
||||
// Call to external callback
|
||||
if (eval('typeof(tinyMCEPopup.windowOpener.' + cb + ')') == "undefined")
|
||||
alert("Callback function: " + cb + " could not be found.");
|
||||
else
|
||||
eval("tinyMCEPopup.windowOpener." + cb + "(element_id, url, type, window);");
|
||||
},
|
||||
|
||||
importClass : function(c) {
|
||||
var n;
|
||||
|
||||
window[c] = function() {};
|
||||
|
||||
for (n in window.opener[c].prototype)
|
||||
window[c].prototype[n] = window.opener[c].prototype[n];
|
||||
|
||||
window[c].constructor = window.opener[c].constructor;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Setup global instance
|
||||
var tinyMCEPopup = new TinyMCE_Popup();
|
||||
|
||||
tinyMCEPopup.init();
|
||||
// Some global instances, this will be filled later
|
||||
var tinyMCE = null, tinyMCELang = null;
|
||||
|
||||
function TinyMCE_Popup() {
|
||||
};
|
||||
|
||||
TinyMCE_Popup.prototype = {
|
||||
findWin : function(w) {
|
||||
var c;
|
||||
|
||||
// Check parents
|
||||
c = w;
|
||||
while (c && (c = c.parent) != null) {
|
||||
if (typeof(c.tinyMCE) != "undefined")
|
||||
return c;
|
||||
}
|
||||
|
||||
// Check openers
|
||||
c = w;
|
||||
while (c && (c = c.opener) != null) {
|
||||
if (typeof(c.tinyMCE) != "undefined")
|
||||
return c;
|
||||
}
|
||||
|
||||
// Try top
|
||||
if (typeof(top.tinyMCE) != "undefined")
|
||||
return top;
|
||||
|
||||
return null;
|
||||
},
|
||||
|
||||
init : function() {
|
||||
var win = window.opener ? window.opener : window.dialogArguments, c;
|
||||
var inst, re, title, divElm;
|
||||
|
||||
if (!win)
|
||||
win = this.findWin(window);
|
||||
|
||||
if (!win) {
|
||||
alert("tinyMCE object reference not found from popup.");
|
||||
return;
|
||||
}
|
||||
|
||||
window.opener = win;
|
||||
this.windowOpener = win;
|
||||
this.onLoadEval = "";
|
||||
|
||||
// Setup parent references
|
||||
tinyMCE = win.tinyMCE;
|
||||
tinyMCELang = win.tinyMCELang;
|
||||
|
||||
inst = tinyMCE.selectedInstance;
|
||||
this.isWindow = tinyMCE.getWindowArg('mce_inside_iframe', false) == false;
|
||||
this.storeSelection = (tinyMCE.isRealIE) && !this.isWindow && tinyMCE.getWindowArg('mce_store_selection', true);
|
||||
|
||||
if (this.isWindow)
|
||||
window.focus();
|
||||
|
||||
// Store selection
|
||||
if (this.storeSelection)
|
||||
inst.selectionBookmark = inst.selection.getBookmark(true);
|
||||
|
||||
// Setup dir
|
||||
if (tinyMCELang.lang_dir)
|
||||
document.dir = tinyMCELang.lang_dir;
|
||||
|
||||
// Setup title
|
||||
re = new RegExp('{|\\\$|}', 'g');
|
||||
title = document.title.replace(re, "");
|
||||
if (typeof(tinyMCELang[title]) != "undefined") {
|
||||
divElm = document.createElement("div");
|
||||
divElm.innerHTML = tinyMCELang[title];
|
||||
document.title = divElm.innerHTML;
|
||||
|
||||
if (typeof(tinyMCE.setWindowTitle) != 'undefined')
|
||||
tinyMCE.setWindowTitle(window, divElm.innerHTML);
|
||||
}
|
||||
|
||||
// Output Popup CSS class
|
||||
document.write('<link href="' + tinyMCE.getParam("popups_css") + '" rel="stylesheet" type="text/css">');
|
||||
|
||||
if (tinyMCE.getParam("popups_css_add")) {
|
||||
c = tinyMCE.getParam("popups_css_add");
|
||||
|
||||
// Is relative
|
||||
if (c.indexOf('://') == -1 && c.charAt(0) != '/')
|
||||
c = tinyMCE.documentBasePath + "/" + c;
|
||||
|
||||
document.write('<link href="' + c + '" rel="stylesheet" type="text/css">');
|
||||
}
|
||||
|
||||
tinyMCE.addEvent(window, "load", this.onLoad);
|
||||
},
|
||||
|
||||
onLoad : function() {
|
||||
var dir, i, elms, body = document.body;
|
||||
|
||||
if (tinyMCE.getWindowArg('mce_replacevariables', true))
|
||||
body.innerHTML = tinyMCE.applyTemplate(body.innerHTML, tinyMCE.windowArgs);
|
||||
|
||||
dir = tinyMCE.selectedInstance.settings.directionality;
|
||||
if (dir == "rtl" && document.forms && document.forms.length > 0) {
|
||||
elms = document.forms[0].elements;
|
||||
for (i=0; i<elms.length; i++) {
|
||||
if ((elms[i].type == "text" || elms[i].type == "textarea") && elms[i].getAttribute("dir") != "ltr")
|
||||
elms[i].dir = dir;
|
||||
}
|
||||
}
|
||||
|
||||
if (body.style.display == 'none')
|
||||
body.style.display = 'block';
|
||||
|
||||
// Execute real onload (Opera fix)
|
||||
if (tinyMCEPopup.onLoadEval !== '')
|
||||
eval(tinyMCEPopup.onLoadEval);
|
||||
},
|
||||
|
||||
executeOnLoad : function(str) {
|
||||
if (tinyMCE.isOpera && parseFloat(opera.version()) < 9.5)
|
||||
this.onLoadEval = str;
|
||||
else
|
||||
eval(str);
|
||||
},
|
||||
|
||||
resizeToInnerSize : function() {
|
||||
var i, doc, body, oldMargin, wrapper, iframe, nodes, dx, dy;
|
||||
|
||||
// Netscape 7.1 workaround
|
||||
if (this.isWindow && tinyMCE.isNS71) {
|
||||
window.resizeBy(0, 10);
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.isWindow) {
|
||||
doc = document;
|
||||
body = doc.body;
|
||||
|
||||
if (body.style.display == 'none')
|
||||
body.style.display = 'block';
|
||||
|
||||
// Remove margin
|
||||
oldMargin = body.style.margin;
|
||||
body.style.margin = '0';
|
||||
|
||||
// Create wrapper
|
||||
wrapper = doc.createElement("div");
|
||||
wrapper.id = 'mcBodyWrapper';
|
||||
wrapper.style.display = 'none';
|
||||
wrapper.style.margin = '0';
|
||||
|
||||
// Wrap body elements
|
||||
nodes = doc.body.childNodes;
|
||||
for (i=nodes.length-1; i>=0; i--) {
|
||||
if (wrapper.hasChildNodes())
|
||||
wrapper.insertBefore(nodes[i].cloneNode(true), wrapper.firstChild);
|
||||
else
|
||||
wrapper.appendChild(nodes[i].cloneNode(true));
|
||||
|
||||
nodes[i].parentNode.removeChild(nodes[i]);
|
||||
}
|
||||
|
||||
// Add wrapper
|
||||
doc.body.appendChild(wrapper);
|
||||
|
||||
// Create iframe
|
||||
iframe = document.createElement("iframe");
|
||||
iframe.id = "mcWinIframe";
|
||||
iframe.src = document.location.href.toLowerCase().indexOf('https') == -1 ? "about:blank" : tinyMCE.settings.default_document;
|
||||
iframe.width = "100%";
|
||||
iframe.height = "100%";
|
||||
iframe.style.margin = '0';
|
||||
|
||||
// Add iframe
|
||||
doc.body.appendChild(iframe);
|
||||
|
||||
// Measure iframe
|
||||
iframe = document.getElementById('mcWinIframe');
|
||||
dx = tinyMCE.getWindowArg('mce_width') - iframe.clientWidth;
|
||||
dy = tinyMCE.getWindowArg('mce_height') - iframe.clientHeight;
|
||||
|
||||
// Resize window
|
||||
// tinyMCE.debug(tinyMCE.getWindowArg('mce_width') + "," + tinyMCE.getWindowArg('mce_height') + " - " + dx + "," + dy);
|
||||
window.resizeBy(dx, dy);
|
||||
|
||||
// Hide iframe and show wrapper
|
||||
body.style.margin = oldMargin;
|
||||
iframe.style.display = 'none';
|
||||
wrapper.style.display = 'block';
|
||||
}
|
||||
},
|
||||
|
||||
resizeToContent : function() {
|
||||
var isMSIE = (navigator.appName == "Microsoft Internet Explorer");
|
||||
var isOpera = (navigator.userAgent.indexOf("Opera") != -1);
|
||||
var elm, width, height, x, y, dx, dy;
|
||||
|
||||
if (isOpera)
|
||||
return;
|
||||
|
||||
if (isMSIE) {
|
||||
try { window.resizeTo(10, 10); } catch (e) {}
|
||||
|
||||
elm = document.body;
|
||||
width = elm.offsetWidth;
|
||||
height = elm.offsetHeight;
|
||||
dx = (elm.scrollWidth - width) + 4;
|
||||
dy = elm.scrollHeight - height;
|
||||
|
||||
try { window.resizeBy(dx, dy); } catch (e) {}
|
||||
} else {
|
||||
window.scrollBy(1000, 1000);
|
||||
if (window.scrollX > 0 || window.scrollY > 0) {
|
||||
window.resizeBy(window.innerWidth * 2, window.innerHeight * 2);
|
||||
window.sizeToContent();
|
||||
window.scrollTo(0, 0);
|
||||
x = parseInt(screen.width / 2.0) - (window.outerWidth / 2.0);
|
||||
y = parseInt(screen.height / 2.0) - (window.outerHeight / 2.0);
|
||||
window.moveTo(x, y);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
getWindowArg : function(name, default_value) {
|
||||
return tinyMCE.getWindowArg(name, default_value);
|
||||
},
|
||||
|
||||
restoreSelection : function() {
|
||||
var inst;
|
||||
|
||||
if (this.storeSelection) {
|
||||
inst = tinyMCE.selectedInstance;
|
||||
|
||||
inst.getWin().focus();
|
||||
|
||||
if (inst.selectionBookmark)
|
||||
inst.selection.moveToBookmark(inst.selectionBookmark);
|
||||
}
|
||||
},
|
||||
|
||||
execCommand : function(command, user_interface, value) {
|
||||
var inst = tinyMCE.selectedInstance;
|
||||
|
||||
this.restoreSelection();
|
||||
inst.execCommand(command, user_interface, value);
|
||||
|
||||
// Store selection
|
||||
if (this.storeSelection)
|
||||
inst.selectionBookmark = inst.selection.getBookmark(true);
|
||||
},
|
||||
|
||||
close : function() {
|
||||
tinyMCE.closeWindow(window);
|
||||
},
|
||||
|
||||
pickColor : function(e, element_id) {
|
||||
tinyMCE.selectedInstance.execCommand('mceColorPicker', true, {
|
||||
element_id : element_id,
|
||||
document : document,
|
||||
window : window,
|
||||
store_selection : false
|
||||
});
|
||||
},
|
||||
|
||||
openBrowser : function(element_id, type, option) {
|
||||
var cb = tinyMCE.getParam(option, tinyMCE.getParam("file_browser_callback"));
|
||||
var url = document.getElementById(element_id).value;
|
||||
|
||||
tinyMCE.setWindowArg("window", window);
|
||||
tinyMCE.setWindowArg("document", document);
|
||||
|
||||
// Call to external callback
|
||||
if (eval('typeof(tinyMCEPopup.windowOpener.' + cb + ')') == "undefined")
|
||||
alert("Callback function: " + cb + " could not be found.");
|
||||
else
|
||||
eval("tinyMCEPopup.windowOpener." + cb + "(element_id, url, type, window);");
|
||||
},
|
||||
|
||||
importClass : function(c) {
|
||||
var n;
|
||||
|
||||
window[c] = function() {};
|
||||
|
||||
for (n in window.opener[c].prototype)
|
||||
window[c].prototype[n] = window.opener[c].prototype[n];
|
||||
|
||||
window[c].constructor = window.opener[c].constructor;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Setup global instance
|
||||
var tinyMCEPopup = new TinyMCE_Popup();
|
||||
|
||||
tinyMCEPopup.init();
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,61 +1,61 @@
|
||||
/**
|
||||
* $Id: editable_selects.js 162 2007-01-03 16:16:52Z spocke $
|
||||
*
|
||||
* Makes select boxes editable.
|
||||
*
|
||||
* @author Moxiecode
|
||||
* @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
|
||||
*/
|
||||
|
||||
var TinyMCE_EditableSelects = {
|
||||
editSelectElm : null,
|
||||
|
||||
init : function() {
|
||||
var nl = document.getElementsByTagName("select"), i, d = document, o;
|
||||
|
||||
for (i=0; i<nl.length; i++) {
|
||||
if (nl[i].className.indexOf('mceEditableSelect') != -1) {
|
||||
o = new Option('(value)', '__mce_add_custom__');
|
||||
|
||||
o.className = 'mceAddSelectValue';
|
||||
|
||||
nl[i].options[nl[i].options.length] = o;
|
||||
nl[i].setAttribute('onchange', 'TinyMCE_EditableSelects.onChangeEditableSelect(this);');
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
onChangeEditableSelect : function(se) {
|
||||
var d = document, ne;
|
||||
|
||||
if (se.options[se.selectedIndex].value == '__mce_add_custom__') {
|
||||
ne = d.createElement("input");
|
||||
ne.id = se.id + "_custom";
|
||||
ne.name = se.name + "_custom";
|
||||
ne.type = "text";
|
||||
|
||||
ne.style.width = se.clientWidth;
|
||||
se.parentNode.insertBefore(ne, se);
|
||||
se.style.display = 'none';
|
||||
ne.focus();
|
||||
ne.onblur = TinyMCE_EditableSelects.onBlurEditableSelectInput;
|
||||
TinyMCE_EditableSelects.editSelectElm = se;
|
||||
}
|
||||
},
|
||||
|
||||
onBlurEditableSelectInput : function() {
|
||||
var se = TinyMCE_EditableSelects.editSelectElm;
|
||||
|
||||
if (se) {
|
||||
if (se.previousSibling.value != '') {
|
||||
addSelectValue(document.forms[0], se.id, se.previousSibling.value, se.previousSibling.value);
|
||||
selectByValue(document.forms[0], se.id, se.previousSibling.value);
|
||||
} else
|
||||
selectByValue(document.forms[0], se.id, '');
|
||||
|
||||
se.style.display = 'inline';
|
||||
se.parentNode.removeChild(se.previousSibling);
|
||||
TinyMCE_EditableSelects.editSelectElm = null;
|
||||
}
|
||||
}
|
||||
};
|
||||
/**
|
||||
* $Id: editable_selects.js 162 2007-01-03 16:16:52Z spocke $
|
||||
*
|
||||
* Makes select boxes editable.
|
||||
*
|
||||
* @author Moxiecode
|
||||
* @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
|
||||
*/
|
||||
|
||||
var TinyMCE_EditableSelects = {
|
||||
editSelectElm : null,
|
||||
|
||||
init : function() {
|
||||
var nl = document.getElementsByTagName("select"), i, d = document, o;
|
||||
|
||||
for (i=0; i<nl.length; i++) {
|
||||
if (nl[i].className.indexOf('mceEditableSelect') != -1) {
|
||||
o = new Option('(value)', '__mce_add_custom__');
|
||||
|
||||
o.className = 'mceAddSelectValue';
|
||||
|
||||
nl[i].options[nl[i].options.length] = o;
|
||||
nl[i].setAttribute('onchange', 'TinyMCE_EditableSelects.onChangeEditableSelect(this);');
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
onChangeEditableSelect : function(se) {
|
||||
var d = document, ne;
|
||||
|
||||
if (se.options[se.selectedIndex].value == '__mce_add_custom__') {
|
||||
ne = d.createElement("input");
|
||||
ne.id = se.id + "_custom";
|
||||
ne.name = se.name + "_custom";
|
||||
ne.type = "text";
|
||||
|
||||
ne.style.width = se.clientWidth;
|
||||
se.parentNode.insertBefore(ne, se);
|
||||
se.style.display = 'none';
|
||||
ne.focus();
|
||||
ne.onblur = TinyMCE_EditableSelects.onBlurEditableSelectInput;
|
||||
TinyMCE_EditableSelects.editSelectElm = se;
|
||||
}
|
||||
},
|
||||
|
||||
onBlurEditableSelectInput : function() {
|
||||
var se = TinyMCE_EditableSelects.editSelectElm;
|
||||
|
||||
if (se) {
|
||||
if (se.previousSibling.value != '') {
|
||||
addSelectValue(document.forms[0], se.id, se.previousSibling.value, se.previousSibling.value);
|
||||
selectByValue(document.forms[0], se.id, se.previousSibling.value);
|
||||
} else
|
||||
selectByValue(document.forms[0], se.id, '');
|
||||
|
||||
se.style.display = 'inline';
|
||||
se.parentNode.removeChild(se.previousSibling);
|
||||
TinyMCE_EditableSelects.editSelectElm = null;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -1,210 +1,210 @@
|
||||
/**
|
||||
* $Id: form_utils.js 162 2007-01-03 16:16:52Z spocke $
|
||||
*
|
||||
* Various form utilitiy functions.
|
||||
*
|
||||
* @author Moxiecode
|
||||
* @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
|
||||
*/
|
||||
|
||||
var themeBaseURL = tinyMCE.baseURL + '/themes/' + tinyMCE.getParam("theme");
|
||||
|
||||
function getColorPickerHTML(id, target_form_element) {
|
||||
var h = "";
|
||||
|
||||
h += '<a id="' + id + '_link" href="javascript:void(0);" onkeydown="pickColor(event,\'' + target_form_element +'\');" onmousedown="pickColor(event,\'' + target_form_element +'\');return false;">';
|
||||
h += '<img id="' + id + '" src="' + themeBaseURL + '/images/color.gif"';
|
||||
h += ' onmouseover="this.className=\'mceButtonOver\'"';
|
||||
h += ' onmouseout="this.className=\'mceButtonNormal\'"';
|
||||
h += ' onmousedown="this.className=\'mceButtonDown\'"';
|
||||
h += ' width="20" height="16" border="0" title="' + tinyMCE.getLang('lang_browse') + '"';
|
||||
h += ' class="mceButtonNormal" alt="' + tinyMCE.getLang('lang_browse') + '" /></a>';
|
||||
|
||||
return h;
|
||||
}
|
||||
|
||||
function pickColor(e, target_form_element) {
|
||||
if ((e.keyCode == 32 || e.keyCode == 13) || e.type == "mousedown")
|
||||
tinyMCEPopup.pickColor(e, target_form_element);
|
||||
}
|
||||
|
||||
function updateColor(img_id, form_element_id) {
|
||||
document.getElementById(img_id).style.backgroundColor = document.forms[0].elements[form_element_id].value;
|
||||
}
|
||||
|
||||
function setBrowserDisabled(id, state) {
|
||||
var img = document.getElementById(id);
|
||||
var lnk = document.getElementById(id + "_link");
|
||||
|
||||
if (lnk) {
|
||||
if (state) {
|
||||
lnk.setAttribute("realhref", lnk.getAttribute("href"));
|
||||
lnk.removeAttribute("href");
|
||||
tinyMCE.switchClass(img, 'mceButtonDisabled', true);
|
||||
} else {
|
||||
lnk.setAttribute("href", lnk.getAttribute("realhref"));
|
||||
tinyMCE.switchClass(img, 'mceButtonNormal', false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getBrowserHTML(id, target_form_element, type, prefix) {
|
||||
var option = prefix + "_" + type + "_browser_callback";
|
||||
var cb = tinyMCE.getParam(option, tinyMCE.getParam("file_browser_callback"));
|
||||
if (cb == null)
|
||||
return "";
|
||||
|
||||
var html = "";
|
||||
|
||||
html += '<a id="' + id + '_link" href="javascript:openBrower(\'' + id + '\',\'' + target_form_element + '\', \'' + type + '\',\'' + option + '\');" onmousedown="return false;">';
|
||||
html += '<img id="' + id + '" src="' + themeBaseURL + '/images/browse.gif"';
|
||||
html += ' onmouseover="this.className=\'mceButtonOver\';"';
|
||||
html += ' onmouseout="this.className=\'mceButtonNormal\';"';
|
||||
html += ' onmousedown="this.className=\'mceButtonDown\';"';
|
||||
html += ' width="20" height="18" border="0" title="' + tinyMCE.getLang('lang_browse') + '"';
|
||||
html += ' class="mceButtonNormal" alt="' + tinyMCE.getLang('lang_browse') + '" /></a>';
|
||||
|
||||
return html;
|
||||
}
|
||||
|
||||
function openBrower(img_id, target_form_element, type, option) {
|
||||
var img = document.getElementById(img_id);
|
||||
|
||||
if (img.className != "mceButtonDisabled")
|
||||
tinyMCEPopup.openBrowser(target_form_element, type, option);
|
||||
}
|
||||
|
||||
function selectByValue(form_obj, field_name, value, add_custom, ignore_case) {
|
||||
if (!form_obj || !form_obj.elements[field_name])
|
||||
return;
|
||||
|
||||
var sel = form_obj.elements[field_name];
|
||||
|
||||
var found = false;
|
||||
for (var i=0; i<sel.options.length; i++) {
|
||||
var option = sel.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;
|
||||
sel.options[sel.options.length] = option;
|
||||
sel.selectedIndex = sel.options.length - 1;
|
||||
}
|
||||
|
||||
return found;
|
||||
}
|
||||
|
||||
function getSelectValue(form_obj, field_name) {
|
||||
var elm = form_obj.elements[field_name];
|
||||
|
||||
if (elm == null || elm.options == null)
|
||||
return "";
|
||||
|
||||
return elm.options[elm.selectedIndex].value;
|
||||
}
|
||||
|
||||
function addSelectValue(form_obj, field_name, name, value) {
|
||||
var s = form_obj.elements[field_name];
|
||||
var o = new Option(name, value);
|
||||
s.options[s.options.length] = o;
|
||||
}
|
||||
|
||||
function addClassesToList(list_id, specific_option) {
|
||||
// Setup class droplist
|
||||
var styleSelectElm = document.getElementById(list_id);
|
||||
var styles = tinyMCE.getParam('theme_advanced_styles', false);
|
||||
styles = tinyMCE.getParam(specific_option, styles);
|
||||
|
||||
if (styles) {
|
||||
var stylesAr = styles.split(';');
|
||||
|
||||
for (var i=0; i<stylesAr.length; i++) {
|
||||
if (stylesAr != "") {
|
||||
var key, value;
|
||||
|
||||
key = stylesAr[i].split('=')[0];
|
||||
value = stylesAr[i].split('=')[1];
|
||||
|
||||
styleSelectElm.options[styleSelectElm.length] = new Option(key, value);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Use auto impored classes
|
||||
var csses = tinyMCE.getCSSClasses(tinyMCE.getWindowArg('editor_id'));
|
||||
for (var i=0; i<csses.length; i++)
|
||||
styleSelectElm.options[styleSelectElm.length] = new Option(csses[i], csses[i]);
|
||||
}
|
||||
}
|
||||
|
||||
function isVisible(element_id) {
|
||||
var elm = document.getElementById(element_id);
|
||||
|
||||
return elm && elm.style.display != "none";
|
||||
}
|
||||
|
||||
function convertRGBToHex(col) {
|
||||
var re = new RegExp("rgb\\s*\\(\\s*([0-9]+).*,\\s*([0-9]+).*,\\s*([0-9]+).*\\)", "gi");
|
||||
|
||||
var rgb = col.replace(re, "$1,$2,$3").split(',');
|
||||
if (rgb.length == 3) {
|
||||
r = parseInt(rgb[0]).toString(16);
|
||||
g = parseInt(rgb[1]).toString(16);
|
||||
b = parseInt(rgb[2]).toString(16);
|
||||
|
||||
r = r.length == 1 ? '0' + r : r;
|
||||
g = g.length == 1 ? '0' + g : g;
|
||||
b = b.length == 1 ? '0' + b : b;
|
||||
|
||||
return "#" + r + g + b;
|
||||
}
|
||||
|
||||
return col;
|
||||
}
|
||||
|
||||
function convertHexToRGB(col) {
|
||||
if (col.indexOf('#') != -1) {
|
||||
col = col.replace(new RegExp('[^0-9A-F]', 'gi'), '');
|
||||
|
||||
r = parseInt(col.substring(0, 2), 16);
|
||||
g = parseInt(col.substring(2, 4), 16);
|
||||
b = parseInt(col.substring(4, 6), 16);
|
||||
|
||||
return "rgb(" + r + "," + g + "," + b + ")";
|
||||
}
|
||||
|
||||
return col;
|
||||
}
|
||||
|
||||
function trimSize(size) {
|
||||
return size.replace(new RegExp('[^0-9%]', 'gi'), '');
|
||||
}
|
||||
|
||||
function getCSSSize(size) {
|
||||
size = trimSize(size);
|
||||
|
||||
if (size == "")
|
||||
return "";
|
||||
|
||||
return size.indexOf('%') != -1 ? size : size + "px";
|
||||
}
|
||||
|
||||
function getStyle(elm, attrib, style) {
|
||||
var val = tinyMCE.getAttrib(elm, attrib);
|
||||
|
||||
if (val != '')
|
||||
return '' + val;
|
||||
|
||||
if (typeof(style) == 'undefined')
|
||||
style = attrib;
|
||||
|
||||
val = eval('elm.style.' + style);
|
||||
|
||||
return val == null ? '' : '' + val;
|
||||
}
|
||||
/**
|
||||
* $Id: form_utils.js 162 2007-01-03 16:16:52Z spocke $
|
||||
*
|
||||
* Various form utilitiy functions.
|
||||
*
|
||||
* @author Moxiecode
|
||||
* @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
|
||||
*/
|
||||
|
||||
var themeBaseURL = tinyMCE.baseURL + '/themes/' + tinyMCE.getParam("theme");
|
||||
|
||||
function getColorPickerHTML(id, target_form_element) {
|
||||
var h = "";
|
||||
|
||||
h += '<a id="' + id + '_link" href="javascript:void(0);" onkeydown="pickColor(event,\'' + target_form_element +'\');" onmousedown="pickColor(event,\'' + target_form_element +'\');return false;">';
|
||||
h += '<img id="' + id + '" src="' + themeBaseURL + '/images/color.gif"';
|
||||
h += ' onmouseover="this.className=\'mceButtonOver\'"';
|
||||
h += ' onmouseout="this.className=\'mceButtonNormal\'"';
|
||||
h += ' onmousedown="this.className=\'mceButtonDown\'"';
|
||||
h += ' width="20" height="16" border="0" title="' + tinyMCE.getLang('lang_browse') + '"';
|
||||
h += ' class="mceButtonNormal" alt="' + tinyMCE.getLang('lang_browse') + '" /></a>';
|
||||
|
||||
return h;
|
||||
}
|
||||
|
||||
function pickColor(e, target_form_element) {
|
||||
if ((e.keyCode == 32 || e.keyCode == 13) || e.type == "mousedown")
|
||||
tinyMCEPopup.pickColor(e, target_form_element);
|
||||
}
|
||||
|
||||
function updateColor(img_id, form_element_id) {
|
||||
document.getElementById(img_id).style.backgroundColor = document.forms[0].elements[form_element_id].value;
|
||||
}
|
||||
|
||||
function setBrowserDisabled(id, state) {
|
||||
var img = document.getElementById(id);
|
||||
var lnk = document.getElementById(id + "_link");
|
||||
|
||||
if (lnk) {
|
||||
if (state) {
|
||||
lnk.setAttribute("realhref", lnk.getAttribute("href"));
|
||||
lnk.removeAttribute("href");
|
||||
tinyMCE.switchClass(img, 'mceButtonDisabled', true);
|
||||
} else {
|
||||
lnk.setAttribute("href", lnk.getAttribute("realhref"));
|
||||
tinyMCE.switchClass(img, 'mceButtonNormal', false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getBrowserHTML(id, target_form_element, type, prefix) {
|
||||
var option = prefix + "_" + type + "_browser_callback";
|
||||
var cb = tinyMCE.getParam(option, tinyMCE.getParam("file_browser_callback"));
|
||||
if (cb == null)
|
||||
return "";
|
||||
|
||||
var html = "";
|
||||
|
||||
html += '<a id="' + id + '_link" href="javascript:openBrower(\'' + id + '\',\'' + target_form_element + '\', \'' + type + '\',\'' + option + '\');" onmousedown="return false;">';
|
||||
html += '<img id="' + id + '" src="' + themeBaseURL + '/images/browse.gif"';
|
||||
html += ' onmouseover="this.className=\'mceButtonOver\';"';
|
||||
html += ' onmouseout="this.className=\'mceButtonNormal\';"';
|
||||
html += ' onmousedown="this.className=\'mceButtonDown\';"';
|
||||
html += ' width="20" height="18" border="0" title="' + tinyMCE.getLang('lang_browse') + '"';
|
||||
html += ' class="mceButtonNormal" alt="' + tinyMCE.getLang('lang_browse') + '" /></a>';
|
||||
|
||||
return html;
|
||||
}
|
||||
|
||||
function openBrower(img_id, target_form_element, type, option) {
|
||||
var img = document.getElementById(img_id);
|
||||
|
||||
if (img.className != "mceButtonDisabled")
|
||||
tinyMCEPopup.openBrowser(target_form_element, type, option);
|
||||
}
|
||||
|
||||
function selectByValue(form_obj, field_name, value, add_custom, ignore_case) {
|
||||
if (!form_obj || !form_obj.elements[field_name])
|
||||
return;
|
||||
|
||||
var sel = form_obj.elements[field_name];
|
||||
|
||||
var found = false;
|
||||
for (var i=0; i<sel.options.length; i++) {
|
||||
var option = sel.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;
|
||||
sel.options[sel.options.length] = option;
|
||||
sel.selectedIndex = sel.options.length - 1;
|
||||
}
|
||||
|
||||
return found;
|
||||
}
|
||||
|
||||
function getSelectValue(form_obj, field_name) {
|
||||
var elm = form_obj.elements[field_name];
|
||||
|
||||
if (elm == null || elm.options == null)
|
||||
return "";
|
||||
|
||||
return elm.options[elm.selectedIndex].value;
|
||||
}
|
||||
|
||||
function addSelectValue(form_obj, field_name, name, value) {
|
||||
var s = form_obj.elements[field_name];
|
||||
var o = new Option(name, value);
|
||||
s.options[s.options.length] = o;
|
||||
}
|
||||
|
||||
function addClassesToList(list_id, specific_option) {
|
||||
// Setup class droplist
|
||||
var styleSelectElm = document.getElementById(list_id);
|
||||
var styles = tinyMCE.getParam('theme_advanced_styles', false);
|
||||
styles = tinyMCE.getParam(specific_option, styles);
|
||||
|
||||
if (styles) {
|
||||
var stylesAr = styles.split(';');
|
||||
|
||||
for (var i=0; i<stylesAr.length; i++) {
|
||||
if (stylesAr != "") {
|
||||
var key, value;
|
||||
|
||||
key = stylesAr[i].split('=')[0];
|
||||
value = stylesAr[i].split('=')[1];
|
||||
|
||||
styleSelectElm.options[styleSelectElm.length] = new Option(key, value);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Use auto impored classes
|
||||
var csses = tinyMCE.getCSSClasses(tinyMCE.getWindowArg('editor_id'));
|
||||
for (var i=0; i<csses.length; i++)
|
||||
styleSelectElm.options[styleSelectElm.length] = new Option(csses[i], csses[i]);
|
||||
}
|
||||
}
|
||||
|
||||
function isVisible(element_id) {
|
||||
var elm = document.getElementById(element_id);
|
||||
|
||||
return elm && elm.style.display != "none";
|
||||
}
|
||||
|
||||
function convertRGBToHex(col) {
|
||||
var re = new RegExp("rgb\\s*\\(\\s*([0-9]+).*,\\s*([0-9]+).*,\\s*([0-9]+).*\\)", "gi");
|
||||
|
||||
var rgb = col.replace(re, "$1,$2,$3").split(',');
|
||||
if (rgb.length == 3) {
|
||||
r = parseInt(rgb[0]).toString(16);
|
||||
g = parseInt(rgb[1]).toString(16);
|
||||
b = parseInt(rgb[2]).toString(16);
|
||||
|
||||
r = r.length == 1 ? '0' + r : r;
|
||||
g = g.length == 1 ? '0' + g : g;
|
||||
b = b.length == 1 ? '0' + b : b;
|
||||
|
||||
return "#" + r + g + b;
|
||||
}
|
||||
|
||||
return col;
|
||||
}
|
||||
|
||||
function convertHexToRGB(col) {
|
||||
if (col.indexOf('#') != -1) {
|
||||
col = col.replace(new RegExp('[^0-9A-F]', 'gi'), '');
|
||||
|
||||
r = parseInt(col.substring(0, 2), 16);
|
||||
g = parseInt(col.substring(2, 4), 16);
|
||||
b = parseInt(col.substring(4, 6), 16);
|
||||
|
||||
return "rgb(" + r + "," + g + "," + b + ")";
|
||||
}
|
||||
|
||||
return col;
|
||||
}
|
||||
|
||||
function trimSize(size) {
|
||||
return size.replace(new RegExp('[^0-9%]', 'gi'), '');
|
||||
}
|
||||
|
||||
function getCSSSize(size) {
|
||||
size = trimSize(size);
|
||||
|
||||
if (size == "")
|
||||
return "";
|
||||
|
||||
return size.indexOf('%') != -1 ? size : size + "px";
|
||||
}
|
||||
|
||||
function getStyle(elm, attrib, style) {
|
||||
var val = tinyMCE.getAttrib(elm, attrib);
|
||||
|
||||
if (val != '')
|
||||
return '' + val;
|
||||
|
||||
if (typeof(style) == 'undefined')
|
||||
style = attrib;
|
||||
|
||||
val = eval('elm.style.' + style);
|
||||
|
||||
return val == null ? '' : '' + val;
|
||||
}
|
||||
|
@ -1,210 +1,210 @@
|
||||
/**
|
||||
* $Id: mclayer.js 162 2007-01-03 16:16:52Z spocke $
|
||||
*
|
||||
* Moxiecode floating layer script.
|
||||
*
|
||||
* @author Moxiecode
|
||||
* @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
|
||||
*/
|
||||
|
||||
function MCLayer(id) {
|
||||
this.id = id;
|
||||
this.settings = new Array();
|
||||
this.blockerElement = null;
|
||||
this.isMSIE = navigator.appName == "Microsoft Internet Explorer";
|
||||
this.events = false;
|
||||
this.autoHideCallback = null;
|
||||
}
|
||||
|
||||
MCLayer.prototype = {
|
||||
moveRelativeTo : function(re, p, a) {
|
||||
var rep = this.getAbsPosition(re);
|
||||
var w = parseInt(re.offsetWidth);
|
||||
var h = parseInt(re.offsetHeight);
|
||||
var x, y;
|
||||
|
||||
switch (p) {
|
||||
case "tl":
|
||||
break;
|
||||
|
||||
case "tr":
|
||||
x = rep.absLeft + w;
|
||||
y = rep.absTop;
|
||||
break;
|
||||
|
||||
case "bl":
|
||||
break;
|
||||
|
||||
case "br":
|
||||
break;
|
||||
}
|
||||
|
||||
this.moveTo(x, y);
|
||||
},
|
||||
|
||||
moveBy : function(dx, dy) {
|
||||
var e = this.getElement();
|
||||
var x = parseInt(e.style.left);
|
||||
var y = parseInt(e.style.top);
|
||||
|
||||
e.style.left = (x + dx) + "px";
|
||||
e.style.top = (y + dy) + "px";
|
||||
|
||||
this.updateBlocker();
|
||||
},
|
||||
|
||||
moveTo : function(x, y) {
|
||||
var e = this.getElement();
|
||||
|
||||
e.style.left = x + "px";
|
||||
e.style.top = y + "px";
|
||||
|
||||
this.updateBlocker();
|
||||
},
|
||||
|
||||
show : function() {
|
||||
MCLayer.visibleLayer = this;
|
||||
|
||||
this.getElement().style.display = 'block';
|
||||
this.updateBlocker();
|
||||
},
|
||||
|
||||
hide : function() {
|
||||
this.getElement().style.display = 'none';
|
||||
this.updateBlocker();
|
||||
},
|
||||
|
||||
setAutoHide : function(s, cb) {
|
||||
this.autoHideCallback = cb;
|
||||
this.registerEventHandlers();
|
||||
},
|
||||
|
||||
getElement : function() {
|
||||
return document.getElementById(this.id);
|
||||
},
|
||||
|
||||
updateBlocker : function() {
|
||||
if (!this.isMSIE)
|
||||
return;
|
||||
|
||||
var e = this.getElement();
|
||||
var b = this.getBlocker();
|
||||
var x = this.parseInt(e.style.left);
|
||||
var y = this.parseInt(e.style.top);
|
||||
var w = this.parseInt(e.offsetWidth);
|
||||
var h = this.parseInt(e.offsetHeight);
|
||||
|
||||
b.style.left = x + 'px';
|
||||
b.style.top = y + 'px';
|
||||
b.style.width = w + 'px';
|
||||
b.style.height = h + 'px';
|
||||
b.style.display = e.style.display;
|
||||
},
|
||||
|
||||
getBlocker : function() {
|
||||
if (!this.blockerElement) {
|
||||
var d = document, b = d.createElement("iframe");
|
||||
|
||||
b.style.cssText = 'display: none; left: 0px; position: absolute; top: 0';
|
||||
b.src = 'javascript:false;';
|
||||
b.frameBorder = '0';
|
||||
b.scrolling = 'no';
|
||||
|
||||
d.body.appendChild(b);
|
||||
this.blockerElement = b;
|
||||
}
|
||||
|
||||
return this.blockerElement;
|
||||
},
|
||||
|
||||
getAbsPosition : function(n) {
|
||||
var p = {absLeft : 0, absTop : 0};
|
||||
|
||||
while (n) {
|
||||
p.absLeft += n.offsetLeft;
|
||||
p.absTop += n.offsetTop;
|
||||
n = n.offsetParent;
|
||||
}
|
||||
|
||||
return p;
|
||||
},
|
||||
|
||||
registerEventHandlers : function() {
|
||||
if (!this.events) {
|
||||
var d = document;
|
||||
|
||||
this.addEvent(d, 'mousedown', MCLayer.prototype.onMouseDown);
|
||||
|
||||
this.events = true;
|
||||
}
|
||||
},
|
||||
|
||||
addEvent : function(o, n, h) {
|
||||
if (o.attachEvent)
|
||||
o.attachEvent("on" + n, h);
|
||||
else
|
||||
o.addEventListener(n, h, false);
|
||||
},
|
||||
|
||||
onMouseDown : function(e) {
|
||||
e = typeof(e) == "undefined" ? window.event : e;
|
||||
var b = document.body;
|
||||
var l = MCLayer.visibleLayer;
|
||||
|
||||
if (l) {
|
||||
var mx = l.isMSIE ? e.clientX + b.scrollLeft : e.pageX;
|
||||
var my = l.isMSIE ? e.clientY + b.scrollTop : e.pageY;
|
||||
var el = l.getElement();
|
||||
var x = parseInt(el.style.left);
|
||||
var y = parseInt(el.style.top);
|
||||
var w = parseInt(el.offsetWidth);
|
||||
var h = parseInt(el.offsetHeight);
|
||||
|
||||
if (!(mx > x && mx < x + w && my > y && my < y + h)) {
|
||||
MCLayer.visibleLayer = null;
|
||||
|
||||
if (l.autoHideCallback && l.autoHideCallback(l, e, mx, my))
|
||||
return true;
|
||||
|
||||
l.hide();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
addCSSClass : function(e, c) {
|
||||
this.removeCSSClass(e, c);
|
||||
var a = this.explode(' ', e.className);
|
||||
a[a.length] = c;
|
||||
e.className = a.join(' ');
|
||||
},
|
||||
|
||||
removeCSSClass : function(e, c) {
|
||||
var a = this.explode(' ', e.className), i;
|
||||
|
||||
for (i=0; i<a.length; i++) {
|
||||
if (a[i] == c)
|
||||
a[i] = '';
|
||||
}
|
||||
|
||||
e.className = a.join(' ');
|
||||
},
|
||||
|
||||
explode : function(d, s) {
|
||||
var ar = s.split(d);
|
||||
var oar = new Array();
|
||||
|
||||
for (var i = 0; i<ar.length; i++) {
|
||||
if (ar[i] != "")
|
||||
oar[oar.length] = ar[i];
|
||||
}
|
||||
|
||||
return oar;
|
||||
},
|
||||
|
||||
parseInt : function(s) {
|
||||
if (s == null || s == '')
|
||||
return 0;
|
||||
|
||||
return parseInt(s);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* $Id: mclayer.js 162 2007-01-03 16:16:52Z spocke $
|
||||
*
|
||||
* Moxiecode floating layer script.
|
||||
*
|
||||
* @author Moxiecode
|
||||
* @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
|
||||
*/
|
||||
|
||||
function MCLayer(id) {
|
||||
this.id = id;
|
||||
this.settings = new Array();
|
||||
this.blockerElement = null;
|
||||
this.isMSIE = navigator.appName == "Microsoft Internet Explorer";
|
||||
this.events = false;
|
||||
this.autoHideCallback = null;
|
||||
}
|
||||
|
||||
MCLayer.prototype = {
|
||||
moveRelativeTo : function(re, p, a) {
|
||||
var rep = this.getAbsPosition(re);
|
||||
var w = parseInt(re.offsetWidth);
|
||||
var h = parseInt(re.offsetHeight);
|
||||
var x, y;
|
||||
|
||||
switch (p) {
|
||||
case "tl":
|
||||
break;
|
||||
|
||||
case "tr":
|
||||
x = rep.absLeft + w;
|
||||
y = rep.absTop;
|
||||
break;
|
||||
|
||||
case "bl":
|
||||
break;
|
||||
|
||||
case "br":
|
||||
break;
|
||||
}
|
||||
|
||||
this.moveTo(x, y);
|
||||
},
|
||||
|
||||
moveBy : function(dx, dy) {
|
||||
var e = this.getElement();
|
||||
var x = parseInt(e.style.left);
|
||||
var y = parseInt(e.style.top);
|
||||
|
||||
e.style.left = (x + dx) + "px";
|
||||
e.style.top = (y + dy) + "px";
|
||||
|
||||
this.updateBlocker();
|
||||
},
|
||||
|
||||
moveTo : function(x, y) {
|
||||
var e = this.getElement();
|
||||
|
||||
e.style.left = x + "px";
|
||||
e.style.top = y + "px";
|
||||
|
||||
this.updateBlocker();
|
||||
},
|
||||
|
||||
show : function() {
|
||||
MCLayer.visibleLayer = this;
|
||||
|
||||
this.getElement().style.display = 'block';
|
||||
this.updateBlocker();
|
||||
},
|
||||
|
||||
hide : function() {
|
||||
this.getElement().style.display = 'none';
|
||||
this.updateBlocker();
|
||||
},
|
||||
|
||||
setAutoHide : function(s, cb) {
|
||||
this.autoHideCallback = cb;
|
||||
this.registerEventHandlers();
|
||||
},
|
||||
|
||||
getElement : function() {
|
||||
return document.getElementById(this.id);
|
||||
},
|
||||
|
||||
updateBlocker : function() {
|
||||
if (!this.isMSIE)
|
||||
return;
|
||||
|
||||
var e = this.getElement();
|
||||
var b = this.getBlocker();
|
||||
var x = this.parseInt(e.style.left);
|
||||
var y = this.parseInt(e.style.top);
|
||||
var w = this.parseInt(e.offsetWidth);
|
||||
var h = this.parseInt(e.offsetHeight);
|
||||
|
||||
b.style.left = x + 'px';
|
||||
b.style.top = y + 'px';
|
||||
b.style.width = w + 'px';
|
||||
b.style.height = h + 'px';
|
||||
b.style.display = e.style.display;
|
||||
},
|
||||
|
||||
getBlocker : function() {
|
||||
if (!this.blockerElement) {
|
||||
var d = document, b = d.createElement("iframe");
|
||||
|
||||
b.style.cssText = 'display: none; left: 0px; position: absolute; top: 0';
|
||||
b.src = 'javascript:false;';
|
||||
b.frameBorder = '0';
|
||||
b.scrolling = 'no';
|
||||
|
||||
d.body.appendChild(b);
|
||||
this.blockerElement = b;
|
||||
}
|
||||
|
||||
return this.blockerElement;
|
||||
},
|
||||
|
||||
getAbsPosition : function(n) {
|
||||
var p = {absLeft : 0, absTop : 0};
|
||||
|
||||
while (n) {
|
||||
p.absLeft += n.offsetLeft;
|
||||
p.absTop += n.offsetTop;
|
||||
n = n.offsetParent;
|
||||
}
|
||||
|
||||
return p;
|
||||
},
|
||||
|
||||
registerEventHandlers : function() {
|
||||
if (!this.events) {
|
||||
var d = document;
|
||||
|
||||
this.addEvent(d, 'mousedown', MCLayer.prototype.onMouseDown);
|
||||
|
||||
this.events = true;
|
||||
}
|
||||
},
|
||||
|
||||
addEvent : function(o, n, h) {
|
||||
if (o.attachEvent)
|
||||
o.attachEvent("on" + n, h);
|
||||
else
|
||||
o.addEventListener(n, h, false);
|
||||
},
|
||||
|
||||
onMouseDown : function(e) {
|
||||
e = typeof(e) == "undefined" ? window.event : e;
|
||||
var b = document.body;
|
||||
var l = MCLayer.visibleLayer;
|
||||
|
||||
if (l) {
|
||||
var mx = l.isMSIE ? e.clientX + b.scrollLeft : e.pageX;
|
||||
var my = l.isMSIE ? e.clientY + b.scrollTop : e.pageY;
|
||||
var el = l.getElement();
|
||||
var x = parseInt(el.style.left);
|
||||
var y = parseInt(el.style.top);
|
||||
var w = parseInt(el.offsetWidth);
|
||||
var h = parseInt(el.offsetHeight);
|
||||
|
||||
if (!(mx > x && mx < x + w && my > y && my < y + h)) {
|
||||
MCLayer.visibleLayer = null;
|
||||
|
||||
if (l.autoHideCallback && l.autoHideCallback(l, e, mx, my))
|
||||
return true;
|
||||
|
||||
l.hide();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
addCSSClass : function(e, c) {
|
||||
this.removeCSSClass(e, c);
|
||||
var a = this.explode(' ', e.className);
|
||||
a[a.length] = c;
|
||||
e.className = a.join(' ');
|
||||
},
|
||||
|
||||
removeCSSClass : function(e, c) {
|
||||
var a = this.explode(' ', e.className), i;
|
||||
|
||||
for (i=0; i<a.length; i++) {
|
||||
if (a[i] == c)
|
||||
a[i] = '';
|
||||
}
|
||||
|
||||
e.className = a.join(' ');
|
||||
},
|
||||
|
||||
explode : function(d, s) {
|
||||
var ar = s.split(d);
|
||||
var oar = new Array();
|
||||
|
||||
for (var i = 0; i<ar.length; i++) {
|
||||
if (ar[i] != "")
|
||||
oar[oar.length] = ar[i];
|
||||
}
|
||||
|
||||
return oar;
|
||||
},
|
||||
|
||||
parseInt : function(s) {
|
||||
if (s == null || s == '')
|
||||
return 0;
|
||||
|
||||
return parseInt(s);
|
||||
}
|
||||
}
|
||||
|
@ -1,74 +1,74 @@
|
||||
/**
|
||||
* $Id: mctabs.js 162 2007-01-03 16:16:52Z spocke $
|
||||
*
|
||||
* Moxiecode DHTML Tabs script.
|
||||
*
|
||||
* @author Moxiecode
|
||||
* @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
|
||||
*/
|
||||
|
||||
function MCTabs() {
|
||||
this.settings = new Array();
|
||||
};
|
||||
|
||||
MCTabs.prototype.init = function(settings) {
|
||||
this.settings = settings;
|
||||
};
|
||||
|
||||
MCTabs.prototype.getParam = function(name, default_value) {
|
||||
var value = null;
|
||||
|
||||
value = (typeof(this.settings[name]) == "undefined") ? default_value : this.settings[name];
|
||||
|
||||
// Fix bool values
|
||||
if (value == "true" || value == "false")
|
||||
return (value == "true");
|
||||
|
||||
return value;
|
||||
};
|
||||
|
||||
MCTabs.prototype.displayTab = function(tab_id, panel_id) {
|
||||
var panelElm = document.getElementById(panel_id);
|
||||
var panelContainerElm = panelElm ? panelElm.parentNode : null;
|
||||
var tabElm = document.getElementById(tab_id);
|
||||
var tabContainerElm = tabElm ? tabElm.parentNode : null;
|
||||
var selectionClass = this.getParam('selection_class', 'current');
|
||||
|
||||
if (tabElm && tabContainerElm) {
|
||||
var nodes = tabContainerElm.childNodes;
|
||||
|
||||
// Hide all other tabs
|
||||
for (var i=0; i<nodes.length; i++) {
|
||||
if (nodes[i].nodeName == "LI")
|
||||
nodes[i].className = '';
|
||||
}
|
||||
|
||||
// Show selected tab
|
||||
tabElm.className = 'current';
|
||||
}
|
||||
|
||||
if (panelElm && panelContainerElm) {
|
||||
var nodes = panelContainerElm.childNodes;
|
||||
|
||||
// Hide all other panels
|
||||
for (var i=0; i<nodes.length; i++) {
|
||||
if (nodes[i].nodeName == "DIV")
|
||||
nodes[i].className = 'panel';
|
||||
}
|
||||
|
||||
// Show selected panel
|
||||
panelElm.className = 'current';
|
||||
}
|
||||
};
|
||||
|
||||
MCTabs.prototype.getAnchor = function() {
|
||||
var pos, url = document.location.href;
|
||||
|
||||
if ((pos = url.lastIndexOf('#')) != -1)
|
||||
return url.substring(pos + 1);
|
||||
|
||||
return "";
|
||||
};
|
||||
|
||||
// Global instance
|
||||
var mcTabs = new MCTabs();
|
||||
/**
|
||||
* $Id: mctabs.js 162 2007-01-03 16:16:52Z spocke $
|
||||
*
|
||||
* Moxiecode DHTML Tabs script.
|
||||
*
|
||||
* @author Moxiecode
|
||||
* @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
|
||||
*/
|
||||
|
||||
function MCTabs() {
|
||||
this.settings = new Array();
|
||||
};
|
||||
|
||||
MCTabs.prototype.init = function(settings) {
|
||||
this.settings = settings;
|
||||
};
|
||||
|
||||
MCTabs.prototype.getParam = function(name, default_value) {
|
||||
var value = null;
|
||||
|
||||
value = (typeof(this.settings[name]) == "undefined") ? default_value : this.settings[name];
|
||||
|
||||
// Fix bool values
|
||||
if (value == "true" || value == "false")
|
||||
return (value == "true");
|
||||
|
||||
return value;
|
||||
};
|
||||
|
||||
MCTabs.prototype.displayTab = function(tab_id, panel_id) {
|
||||
var panelElm = document.getElementById(panel_id);
|
||||
var panelContainerElm = panelElm ? panelElm.parentNode : null;
|
||||
var tabElm = document.getElementById(tab_id);
|
||||
var tabContainerElm = tabElm ? tabElm.parentNode : null;
|
||||
var selectionClass = this.getParam('selection_class', 'current');
|
||||
|
||||
if (tabElm && tabContainerElm) {
|
||||
var nodes = tabContainerElm.childNodes;
|
||||
|
||||
// Hide all other tabs
|
||||
for (var i=0; i<nodes.length; i++) {
|
||||
if (nodes[i].nodeName == "LI")
|
||||
nodes[i].className = '';
|
||||
}
|
||||
|
||||
// Show selected tab
|
||||
tabElm.className = 'current';
|
||||
}
|
||||
|
||||
if (panelElm && panelContainerElm) {
|
||||
var nodes = panelContainerElm.childNodes;
|
||||
|
||||
// Hide all other panels
|
||||
for (var i=0; i<nodes.length; i++) {
|
||||
if (nodes[i].nodeName == "DIV")
|
||||
nodes[i].className = 'panel';
|
||||
}
|
||||
|
||||
// Show selected panel
|
||||
panelElm.className = 'current';
|
||||
}
|
||||
};
|
||||
|
||||
MCTabs.prototype.getAnchor = function() {
|
||||
var pos, url = document.location.href;
|
||||
|
||||
if ((pos = url.lastIndexOf('#')) != -1)
|
||||
return url.substring(pos + 1);
|
||||
|
||||
return "";
|
||||
};
|
||||
|
||||
// Global instance
|
||||
var mcTabs = new MCTabs();
|
||||
|
@ -1,219 +1,219 @@
|
||||
/**
|
||||
* $Id: validate.js 162 2007-01-03 16:16:52Z spocke $
|
||||
*
|
||||
* Various form validation methods.
|
||||
*
|
||||
* @author Moxiecode
|
||||
* @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
|
||||
*/
|
||||
|
||||
/**
|
||||
// String validation:
|
||||
|
||||
if (!Validator.isEmail('myemail'))
|
||||
alert('Invalid email.');
|
||||
|
||||
// Form validation:
|
||||
|
||||
var f = document.forms['myform'];
|
||||
|
||||
if (!Validator.isEmail(f.myemail))
|
||||
alert('Invalid email.');
|
||||
*/
|
||||
|
||||
var Validator = {
|
||||
isEmail : function(s) {
|
||||
return this.test(s, '^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+@[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$');
|
||||
},
|
||||
|
||||
isAbsUrl : function(s) {
|
||||
return this.test(s, '^(news|telnet|nttp|file|http|ftp|https)://[-A-Za-z0-9\\.]+\\/?.*$');
|
||||
},
|
||||
|
||||
isSize : function(s) {
|
||||
return this.test(s, '^[0-9]+(px|%)?$');
|
||||
},
|
||||
|
||||
isId : function(s) {
|
||||
return this.test(s, '^[A-Za-z_]([A-Za-z0-9_])*$');
|
||||
},
|
||||
|
||||
isEmpty : function(s) {
|
||||
var nl, i;
|
||||
|
||||
if (s.nodeName == 'SELECT' && s.selectedIndex < 1)
|
||||
return true;
|
||||
|
||||
if (s.type == 'checkbox' && !s.checked)
|
||||
return true;
|
||||
|
||||
if (s.type == 'radio') {
|
||||
for (i=0, nl = s.form.elements; i<nl.length; i++) {
|
||||
if (nl[i].type == "radio" && nl[i].name == s.name && nl[i].checked)
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return new RegExp('^\\s*$').test(s.nodeType == 1 ? s.value : s);
|
||||
},
|
||||
|
||||
isNumber : function(s, d) {
|
||||
return !isNaN(s.nodeType == 1 ? s.value : s) && (!d || !this.test(s, '^-?[0-9]*\\.[0-9]*$'));
|
||||
},
|
||||
|
||||
test : function(s, p) {
|
||||
s = s.nodeType == 1 ? s.value : s;
|
||||
|
||||
return s == '' || new RegExp(p).test(s);
|
||||
}
|
||||
};
|
||||
|
||||
var AutoValidator = {
|
||||
settings : {
|
||||
id_cls : 'id',
|
||||
int_cls : 'int',
|
||||
url_cls : 'url',
|
||||
number_cls : 'number',
|
||||
email_cls : 'email',
|
||||
size_cls : 'size',
|
||||
required_cls : 'required',
|
||||
invalid_cls : 'invalid',
|
||||
min_cls : 'min',
|
||||
max_cls : 'max'
|
||||
},
|
||||
|
||||
init : function(s) {
|
||||
var n;
|
||||
|
||||
for (n in s)
|
||||
this.settings[n] = s[n];
|
||||
},
|
||||
|
||||
validate : function(f) {
|
||||
var i, nl, s = this.settings, c = 0;
|
||||
|
||||
nl = this.tags(f, 'label');
|
||||
for (i=0; i<nl.length; i++)
|
||||
this.removeClass(nl[i], s.invalid_cls);
|
||||
|
||||
c += this.validateElms(f, 'input');
|
||||
c += this.validateElms(f, 'select');
|
||||
c += this.validateElms(f, 'textarea');
|
||||
|
||||
return c == 3;
|
||||
},
|
||||
|
||||
invalidate : function(n) {
|
||||
this.mark(n.form, n);
|
||||
},
|
||||
|
||||
reset : function(e) {
|
||||
var t = new Array('label', 'input', 'select', 'textarea');
|
||||
var i, j, nl, s = this.settings;
|
||||
|
||||
if (e == null)
|
||||
return;
|
||||
|
||||
for (i=0; i<t.length; i++) {
|
||||
nl = this.tags(e.form ? e.form : e, t[i]);
|
||||
for (j=0; j<nl.length; j++)
|
||||
this.removeClass(nl[j], s.invalid_cls);
|
||||
}
|
||||
},
|
||||
|
||||
validateElms : function(f, e) {
|
||||
var nl, i, n, s = this.settings, st = true, va = Validator, v;
|
||||
|
||||
nl = this.tags(f, e);
|
||||
for (i=0; i<nl.length; i++) {
|
||||
n = nl[i];
|
||||
|
||||
this.removeClass(n, s.invalid_cls);
|
||||
|
||||
if (this.hasClass(n, s.required_cls) && va.isEmpty(n))
|
||||
st = this.mark(f, n);
|
||||
|
||||
if (this.hasClass(n, s.number_cls) && !va.isNumber(n))
|
||||
st = this.mark(f, n);
|
||||
|
||||
if (this.hasClass(n, s.int_cls) && !va.isNumber(n, true))
|
||||
st = this.mark(f, n);
|
||||
|
||||
if (this.hasClass(n, s.url_cls) && !va.isAbsUrl(n))
|
||||
st = this.mark(f, n);
|
||||
|
||||
if (this.hasClass(n, s.email_cls) && !va.isEmail(n))
|
||||
st = this.mark(f, n);
|
||||
|
||||
if (this.hasClass(n, s.size_cls) && !va.isSize(n))
|
||||
st = this.mark(f, n);
|
||||
|
||||
if (this.hasClass(n, s.id_cls) && !va.isId(n))
|
||||
st = this.mark(f, n);
|
||||
|
||||
if (this.hasClass(n, s.min_cls, true)) {
|
||||
v = this.getNum(n, s.min_cls);
|
||||
|
||||
if (isNaN(v) || parseInt(n.value) < parseInt(v))
|
||||
st = this.mark(f, n);
|
||||
}
|
||||
|
||||
if (this.hasClass(n, s.max_cls, true)) {
|
||||
v = this.getNum(n, s.max_cls);
|
||||
|
||||
if (isNaN(v) || parseInt(n.value) > parseInt(v))
|
||||
st = this.mark(f, n);
|
||||
}
|
||||
}
|
||||
|
||||
return st;
|
||||
},
|
||||
|
||||
hasClass : function(n, c, d) {
|
||||
return new RegExp('\\b' + c + (d ? '[0-9]+' : '') + '\\b', 'g').test(n.className);
|
||||
},
|
||||
|
||||
getNum : function(n, c) {
|
||||
c = n.className.match(new RegExp('\\b' + c + '([0-9]+)\\b', 'g'))[0];
|
||||
c = c.replace(/[^0-9]/g, '');
|
||||
|
||||
return c;
|
||||
},
|
||||
|
||||
addClass : function(n, c, b) {
|
||||
var o = this.removeClass(n, c);
|
||||
n.className = b ? c + (o != '' ? (' ' + o) : '') : (o != '' ? (o + ' ') : '') + c;
|
||||
},
|
||||
|
||||
removeClass : function(n, c) {
|
||||
c = n.className.replace(new RegExp("(^|\\s+)" + c + "(\\s+|$)"), ' ');
|
||||
return n.className = c != ' ' ? c : '';
|
||||
},
|
||||
|
||||
tags : function(f, s) {
|
||||
return f.getElementsByTagName(s);
|
||||
},
|
||||
|
||||
mark : function(f, n) {
|
||||
var s = this.settings;
|
||||
|
||||
this.addClass(n, s.invalid_cls);
|
||||
this.markLabels(f, n, s.invalid_cls);
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
markLabels : function(f, n, ic) {
|
||||
var nl, i;
|
||||
|
||||
nl = this.tags(f, "label");
|
||||
for (i=0; i<nl.length; i++) {
|
||||
if (nl[i].getAttribute("for") == n.id || nl[i].htmlFor == n.id)
|
||||
this.addClass(nl[i], ic);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
};
|
||||
/**
|
||||
* $Id: validate.js 162 2007-01-03 16:16:52Z spocke $
|
||||
*
|
||||
* Various form validation methods.
|
||||
*
|
||||
* @author Moxiecode
|
||||
* @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
|
||||
*/
|
||||
|
||||
/**
|
||||
// String validation:
|
||||
|
||||
if (!Validator.isEmail('myemail'))
|
||||
alert('Invalid email.');
|
||||
|
||||
// Form validation:
|
||||
|
||||
var f = document.forms['myform'];
|
||||
|
||||
if (!Validator.isEmail(f.myemail))
|
||||
alert('Invalid email.');
|
||||
*/
|
||||
|
||||
var Validator = {
|
||||
isEmail : function(s) {
|
||||
return this.test(s, '^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+@[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$');
|
||||
},
|
||||
|
||||
isAbsUrl : function(s) {
|
||||
return this.test(s, '^(news|telnet|nttp|file|http|ftp|https)://[-A-Za-z0-9\\.]+\\/?.*$');
|
||||
},
|
||||
|
||||
isSize : function(s) {
|
||||
return this.test(s, '^[0-9]+(px|%)?$');
|
||||
},
|
||||
|
||||
isId : function(s) {
|
||||
return this.test(s, '^[A-Za-z_]([A-Za-z0-9_])*$');
|
||||
},
|
||||
|
||||
isEmpty : function(s) {
|
||||
var nl, i;
|
||||
|
||||
if (s.nodeName == 'SELECT' && s.selectedIndex < 1)
|
||||
return true;
|
||||
|
||||
if (s.type == 'checkbox' && !s.checked)
|
||||
return true;
|
||||
|
||||
if (s.type == 'radio') {
|
||||
for (i=0, nl = s.form.elements; i<nl.length; i++) {
|
||||
if (nl[i].type == "radio" && nl[i].name == s.name && nl[i].checked)
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return new RegExp('^\\s*$').test(s.nodeType == 1 ? s.value : s);
|
||||
},
|
||||
|
||||
isNumber : function(s, d) {
|
||||
return !isNaN(s.nodeType == 1 ? s.value : s) && (!d || !this.test(s, '^-?[0-9]*\\.[0-9]*$'));
|
||||
},
|
||||
|
||||
test : function(s, p) {
|
||||
s = s.nodeType == 1 ? s.value : s;
|
||||
|
||||
return s == '' || new RegExp(p).test(s);
|
||||
}
|
||||
};
|
||||
|
||||
var AutoValidator = {
|
||||
settings : {
|
||||
id_cls : 'id',
|
||||
int_cls : 'int',
|
||||
url_cls : 'url',
|
||||
number_cls : 'number',
|
||||
email_cls : 'email',
|
||||
size_cls : 'size',
|
||||
required_cls : 'required',
|
||||
invalid_cls : 'invalid',
|
||||
min_cls : 'min',
|
||||
max_cls : 'max'
|
||||
},
|
||||
|
||||
init : function(s) {
|
||||
var n;
|
||||
|
||||
for (n in s)
|
||||
this.settings[n] = s[n];
|
||||
},
|
||||
|
||||
validate : function(f) {
|
||||
var i, nl, s = this.settings, c = 0;
|
||||
|
||||
nl = this.tags(f, 'label');
|
||||
for (i=0; i<nl.length; i++)
|
||||
this.removeClass(nl[i], s.invalid_cls);
|
||||
|
||||
c += this.validateElms(f, 'input');
|
||||
c += this.validateElms(f, 'select');
|
||||
c += this.validateElms(f, 'textarea');
|
||||
|
||||
return c == 3;
|
||||
},
|
||||
|
||||
invalidate : function(n) {
|
||||
this.mark(n.form, n);
|
||||
},
|
||||
|
||||
reset : function(e) {
|
||||
var t = new Array('label', 'input', 'select', 'textarea');
|
||||
var i, j, nl, s = this.settings;
|
||||
|
||||
if (e == null)
|
||||
return;
|
||||
|
||||
for (i=0; i<t.length; i++) {
|
||||
nl = this.tags(e.form ? e.form : e, t[i]);
|
||||
for (j=0; j<nl.length; j++)
|
||||
this.removeClass(nl[j], s.invalid_cls);
|
||||
}
|
||||
},
|
||||
|
||||
validateElms : function(f, e) {
|
||||
var nl, i, n, s = this.settings, st = true, va = Validator, v;
|
||||
|
||||
nl = this.tags(f, e);
|
||||
for (i=0; i<nl.length; i++) {
|
||||
n = nl[i];
|
||||
|
||||
this.removeClass(n, s.invalid_cls);
|
||||
|
||||
if (this.hasClass(n, s.required_cls) && va.isEmpty(n))
|
||||
st = this.mark(f, n);
|
||||
|
||||
if (this.hasClass(n, s.number_cls) && !va.isNumber(n))
|
||||
st = this.mark(f, n);
|
||||
|
||||
if (this.hasClass(n, s.int_cls) && !va.isNumber(n, true))
|
||||
st = this.mark(f, n);
|
||||
|
||||
if (this.hasClass(n, s.url_cls) && !va.isAbsUrl(n))
|
||||
st = this.mark(f, n);
|
||||
|
||||
if (this.hasClass(n, s.email_cls) && !va.isEmail(n))
|
||||
st = this.mark(f, n);
|
||||
|
||||
if (this.hasClass(n, s.size_cls) && !va.isSize(n))
|
||||
st = this.mark(f, n);
|
||||
|
||||
if (this.hasClass(n, s.id_cls) && !va.isId(n))
|
||||
st = this.mark(f, n);
|
||||
|
||||
if (this.hasClass(n, s.min_cls, true)) {
|
||||
v = this.getNum(n, s.min_cls);
|
||||
|
||||
if (isNaN(v) || parseInt(n.value) < parseInt(v))
|
||||
st = this.mark(f, n);
|
||||
}
|
||||
|
||||
if (this.hasClass(n, s.max_cls, true)) {
|
||||
v = this.getNum(n, s.max_cls);
|
||||
|
||||
if (isNaN(v) || parseInt(n.value) > parseInt(v))
|
||||
st = this.mark(f, n);
|
||||
}
|
||||
}
|
||||
|
||||
return st;
|
||||
},
|
||||
|
||||
hasClass : function(n, c, d) {
|
||||
return new RegExp('\\b' + c + (d ? '[0-9]+' : '') + '\\b', 'g').test(n.className);
|
||||
},
|
||||
|
||||
getNum : function(n, c) {
|
||||
c = n.className.match(new RegExp('\\b' + c + '([0-9]+)\\b', 'g'))[0];
|
||||
c = c.replace(/[^0-9]/g, '');
|
||||
|
||||
return c;
|
||||
},
|
||||
|
||||
addClass : function(n, c, b) {
|
||||
var o = this.removeClass(n, c);
|
||||
n.className = b ? c + (o != '' ? (' ' + o) : '') : (o != '' ? (o + ' ') : '') + c;
|
||||
},
|
||||
|
||||
removeClass : function(n, c) {
|
||||
c = n.className.replace(new RegExp("(^|\\s+)" + c + "(\\s+|$)"), ' ');
|
||||
return n.className = c != ' ' ? c : '';
|
||||
},
|
||||
|
||||
tags : function(f, s) {
|
||||
return f.getElementsByTagName(s);
|
||||
},
|
||||
|
||||
mark : function(f, n) {
|
||||
var s = this.settings;
|
||||
|
||||
this.addClass(n, s.invalid_cls);
|
||||
this.markLabels(f, n, s.invalid_cls);
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
markLabels : function(f, n, ic) {
|
||||
var nl, i;
|
||||
|
||||
nl = this.tags(f, "label");
|
||||
for (i=0; i<nl.length; i++) {
|
||||
if (nl[i].getAttribute("for") == n.id || nl[i].htmlFor == n.id)
|
||||
this.addClass(nl[i], ic);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue