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