added ability to insert attached images in HTML editor

release-0.6
svncommit 17 years ago
parent deb30262a7
commit 4315b0086b

@ -4,6 +4,7 @@ CHANGELOG RoundCube Webmail
2007/12/10 (estadtherr)
----------
- Upgrade to TinyMCE 2.1.3
- Allow inserting image attachments into HTML messages while composing
2007/12/10 (thomasb)
----------

@ -283,7 +283,7 @@ if ($_task=='mail')
if ($_action=='upload')
include('program/steps/mail/upload.inc');
if ($_action=='compose' || $_action=='remove-attachment')
if ($_action=='compose' || $_action=='remove-attachment' || $_action=='display-attachment')
include('program/steps/mail/compose.inc');
if ($_action=='addcontact')

@ -830,7 +830,7 @@ function rcube_webmail()
if (!this.check_compose_input())
break;
// Reset the auto-save timer
self.clearTimeout(this.save_timer);
@ -1884,7 +1884,6 @@ function rcube_webmail()
// upload attachment file
this.upload_file = function(form)
{
if (!form)
return false;

@ -29,8 +29,8 @@ function rcmail_editor_init(skin_path)
theme_advanced_toolbar_align : 'left',
extended_valid_elements : 'font[face|size|color|style],span[id|class|align|style]',
content_css : skin_path + '/editor_content.css',
popups_css : skin_path + '/editor_popup.css',
editor_css : skin_path + '/editor_ui.css'
editor_css : skin_path + '/editor_ui.css',
external_image_list_url : 'program/js/editor_images.js'
});
}

@ -0,0 +1,20 @@
var rc_client = tinyMCEPopup.windowOpener.rcube_webmail_client;
if (rc_client.gui_objects.attachmentlist)
{
var tinyMCEImageList = new Array();
var attachElems = rc_client.gui_objects.attachmentlist.getElementsByTagName("li");
for (i = 0; i < attachElems.length; i++)
{
var liElem = attachElems[i];
var fname = attachElems[i].id;
for (j = 0; j < liElem.childNodes.length; j++)
{
if (liElem.childNodes[j].nodeName == "#text")
{
fname = liElem.childNodes[j].nodeValue;
}
}
tinyMCEImageList.push([fname, rc_client.env.comm_path+'&_action=display-attachment&_file='+attachElems[i].id]);
}
};

File diff suppressed because it is too large Load Diff

@ -1,26 +1,26 @@
.mceItemFlash, .mceItemShockWave, .mceItemQuickTime, .mceItemWindowsMedia, .mceItemRealMedia {
border: 1px dotted #cc0000;
background-position: center;
background-repeat: no-repeat;
background-color: #ffffcc;
}
.mceItemShockWave {
background-image: url('../images/shockwave.gif');
}
.mceItemFlash {
background-image: url('../images/flash.gif');
}
.mceItemQuickTime {
background-image: url('../images/quicktime.gif');
}
.mceItemWindowsMedia {
background-image: url('../images/windowsmedia.gif');
}
.mceItemRealMedia {
background-image: url('../images/realmedia.gif');
}
.mceItemFlash, .mceItemShockWave, .mceItemQuickTime, .mceItemWindowsMedia, .mceItemRealMedia {
border: 1px dotted #cc0000;
background-position: center;
background-repeat: no-repeat;
background-color: #ffffcc;
}
.mceItemShockWave {
background-image: url('../images/shockwave.gif');
}
.mceItemFlash {
background-image: url('../images/flash.gif');
}
.mceItemQuickTime {
background-image: url('../images/quicktime.gif');
}
.mceItemWindowsMedia {
background-image: url('../images/windowsmedia.gif');
}
.mceItemRealMedia {
background-image: url('../images/realmedia.gif');
}

@ -1,68 +1,68 @@
#id, #name, #hspace, #vspace, #class_name, #align {
width: 100px;
}
#hspace, #vspace {
width: 50px;
}
#flash_quality, #flash_align, #flash_scale, #flash_salign, #flash_wmode {
width: 100px;
}
#flash_base, #flash_flashvars {
width: 240px;
}
#width, #height {
width: 40px;
}
#src, #media_type {
width: 250px;
}
#class {
width: 120px;
}
#prev {
margin: 0;
border: 1px solid black;
width: 99%;
height: 230px;
overflow: auto;
}
.panel_wrapper div.current {
height: 390px;
overflow: auto;
}
#flash_options, #shockwave_options, #qt_options, #wmp_options, #rmp_options {
display: none;
}
.mceAddSelectValue {
background-color: #DDDDDD;
}
#qt_starttime, #qt_endtime, #qt_fov, #qt_href, #qt_moveid, #qt_moviename, #qt_node, #qt_pan, #qt_qtsrc, #qt_qtsrcchokespeed, #qt_target, #qt_tilt, #qt_urlsubstituten, #qt_volume {
width: 70px;
}
#wmp_balance, #wmp_baseurl, #wmp_captioningid, #wmp_currentmarker, #wmp_currentposition, #wmp_defaultframe, #wmp_playcount, #wmp_rate, #wmp_uimode, #wmp_volume {
width: 70px;
}
#rmp_console, #rmp_numloop, #rmp_controls, #rmp_scriptcallbacks {
width: 70px;
}
#shockwave_swvolume, #shockwave_swframe, #shockwave_swurl, #shockwave_swstretchvalign, #shockwave_swstretchhalign, #shockwave_swstretchstyle {
width: 90px;
}
#qt_qtsrc {
width: 200px;
}
#id, #name, #hspace, #vspace, #class_name, #align {
width: 100px;
}
#hspace, #vspace {
width: 50px;
}
#flash_quality, #flash_align, #flash_scale, #flash_salign, #flash_wmode {
width: 100px;
}
#flash_base, #flash_flashvars {
width: 240px;
}
#width, #height {
width: 40px;
}
#src, #media_type {
width: 250px;
}
#class {
width: 120px;
}
#prev {
margin: 0;
border: 1px solid black;
width: 99%;
height: 230px;
overflow: auto;
}
.panel_wrapper div.current {
height: 390px;
overflow: auto;
}
#flash_options, #shockwave_options, #qt_options, #wmp_options, #rmp_options {
display: none;
}
.mceAddSelectValue {
background-color: #DDDDDD;
}
#qt_starttime, #qt_endtime, #qt_fov, #qt_href, #qt_moveid, #qt_moviename, #qt_node, #qt_pan, #qt_qtsrc, #qt_qtsrcchokespeed, #qt_target, #qt_tilt, #qt_urlsubstituten, #qt_volume {
width: 70px;
}
#wmp_balance, #wmp_baseurl, #wmp_captioningid, #wmp_currentmarker, #wmp_currentposition, #wmp_defaultframe, #wmp_playcount, #wmp_rate, #wmp_uimode, #wmp_volume {
width: 70px;
}
#rmp_console, #rmp_numloop, #rmp_controls, #rmp_scriptcallbacks {
width: 70px;
}
#shockwave_swvolume, #shockwave_swframe, #shockwave_swurl, #shockwave_swstretchvalign, #shockwave_swstretchhalign, #shockwave_swstretchstyle {
width: 90px;
}
#qt_qtsrc {
width: 200px;
}

@ -1,432 +1,432 @@
/**
* $Id: editor_plugin_src.js 296 2007-08-21 10:36:35Z spocke $
*
* @author Moxiecode
* @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
*/
/* Import plugin specific language pack */
tinyMCE.importPluginLanguagePack('media');
var TinyMCE_MediaPlugin = {
getInfo : function() {
return {
longname : 'Media',
author : 'Moxiecode Systems AB',
authorurl : 'http://tinymce.moxiecode.com',
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/media',
version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
};
},
initInstance : function(inst) {
// Warn if user has flash plugin and media plugin at the same time
if (inst.hasPlugin('flash') && !tinyMCE.flashWarn) {
alert('Flash plugin is deprecated and should not be used together with the media plugin.');
tinyMCE.flashWarn = true;
}
if (!tinyMCE.settings['media_skip_plugin_css'])
tinyMCE.importCSS(inst.getDoc(), tinyMCE.baseURL + "/plugins/media/css/content.css");
},
getControlHTML : function(cn) {
switch (cn) {
case "media":
return tinyMCE.getButtonHTML(cn, 'lang_media_desc', '{$pluginurl}/images/media.gif', 'mceMedia');
}
return "";
},
execCommand : function(editor_id, element, command, user_interface, value) {
// Handle commands
switch (command) {
case "mceMedia":
tinyMCE.openWindow({
file : '../../plugins/media/media.htm',
width : 430 + tinyMCE.getLang('lang_media_delta_width', 0),
height : 470 + tinyMCE.getLang('lang_media_delta_height', 0)
}, {
editor_id : editor_id,
inline : "yes"
});
return true;
}
// Pass to next handler in chain
return false;
},
cleanup : function(type, content, inst) {
var nl, img, i, ne, d, s, ci;
switch (type) {
case "insert_to_editor":
img = tinyMCE.getParam("theme_href") + '/images/spacer.gif';
content = content.replace(/<script[^>]*>\s*write(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)\(\{([^\)]*)\}\);\s*<\/script>/gi, '<img class="mceItem$1" title="$2" src="' + img + '" />');
content = content.replace(/<object([^>]*)>/gi, '<div class="mceItemObject" $1>');
content = content.replace(/<embed([^>]*)>/gi, '<div class="mceItemObjectEmbed" $1>');
content = content.replace(/<\/(object|embed)([^>]*)>/gi, '</div>');
content = content.replace(/<param([^>]*)>/gi, '<div $1 class="mceItemParam"></div>');
content = content.replace(new RegExp('\\/ class="mceItemParam"><\\/div>', 'gi'), 'class="mceItemParam"></div>');
break;
case "insert_to_editor_dom":
d = inst.getDoc();
nl = content.getElementsByTagName("img");
for (i=0; i<nl.length; i++) {
if (/mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(nl[i].className)) {
nl[i].width = nl[i].title.replace(/.*width:[^0-9]?([0-9]+)%?.*/g, '$1');
nl[i].height = nl[i].title.replace(/.*height:[^0-9]?([0-9]+)%?.*/g, '$1');
//nl[i].align = nl[i].title.replace(/.*align:([a-z]+).*/gi, '$1');
}
}
nl = tinyMCE.selectElements(content, 'DIV', function (n) {return tinyMCE.hasCSSClass(n, 'mceItemObject');});
for (i=0; i<nl.length; i++) {
ci = tinyMCE.getAttrib(nl[i], "classid").toLowerCase().replace(/\s+/g, '');
switch (ci) {
case 'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000':
nl[i].parentNode.replaceChild(TinyMCE_MediaPlugin._createImg('mceItemFlash', d, nl[i]), nl[i]);
break;
case 'clsid:166b1bca-3f9c-11cf-8075-444553540000':
nl[i].parentNode.replaceChild(TinyMCE_MediaPlugin._createImg('mceItemShockWave', d, nl[i]), nl[i]);
break;
case 'clsid:6bf52a52-394a-11d3-b153-00c04f79faa6':
case 'clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95':
case 'clsid:05589fa1-c356-11ce-bf01-00aa0055595a':
nl[i].parentNode.replaceChild(TinyMCE_MediaPlugin._createImg('mceItemWindowsMedia', d, nl[i]), nl[i]);
break;
case 'clsid:02bf25d5-8c17-4b23-bc80-d3488abddc6b':
nl[i].parentNode.replaceChild(TinyMCE_MediaPlugin._createImg('mceItemQuickTime', d, nl[i]), nl[i]);
break;
case 'clsid:cfcdaa03-8be4-11cf-b84b-0020afbbccfa':
nl[i].parentNode.replaceChild(TinyMCE_MediaPlugin._createImg('mceItemRealMedia', d, nl[i]), nl[i]);
break;
}
}
// Handle embed (if any)
nl = tinyMCE.selectNodes(content, function (n) {return n.className == 'mceItemObjectEmbed';});
for (i=0; i<nl.length; i++) {
switch (tinyMCE.getAttrib(nl[i], 'type')) {
case 'application/x-shockwave-flash':
TinyMCE_MediaPlugin._createImgFromEmbed(nl[i], d, 'mceItemFlash');
break;
case 'application/x-director':
TinyMCE_MediaPlugin._createImgFromEmbed(nl[i], d, 'mceItemShockWave');
break;
case 'application/x-mplayer2':
TinyMCE_MediaPlugin._createImgFromEmbed(nl[i], d, 'mceItemWindowsMedia');
break;
case 'video/quicktime':
TinyMCE_MediaPlugin._createImgFromEmbed(nl[i], d, 'mceItemQuickTime');
break;
case 'audio/x-pn-realaudio-plugin':
TinyMCE_MediaPlugin._createImgFromEmbed(nl[i], d, 'mceItemRealMedia');
break;
}
}
break;
case "get_from_editor":
var startPos = -1, endPos, attribs, chunkBefore, chunkAfter, embedHTML, at, pl, cb, mt, ex;
while ((startPos = content.indexOf('<img', startPos+1)) != -1) {
endPos = content.indexOf('/>', startPos);
attribs = TinyMCE_MediaPlugin._parseAttributes(content.substring(startPos + 4, endPos));
// Is not flash, skip it
if (!/mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(attribs['class']))
continue;
endPos += 2;
// Parse attributes
at = attribs['title'];
if (at) {
at = at.replace(/&(#39|apos);/g, "'");
at = at.replace(/&#quot;/g, '"');
try {
pl = eval('x={' + at + '};');
} catch (ex) {
pl = {};
}
}
// Use object/embed
if (!tinyMCE.getParam('media_use_script', false)) {
switch (attribs['class']) {
case 'mceItemFlash':
ci = 'd27cdb6e-ae6d-11cf-96b8-444553540000';
cb = 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0';
mt = 'application/x-shockwave-flash';
break;
case 'mceItemShockWave':
ci = '166B1BCA-3F9C-11CF-8075-444553540000';
cb = 'http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0';
mt = 'application/x-director';
break;
case 'mceItemWindowsMedia':
ci = tinyMCE.getParam('media_wmp6_compatible') ? '05589FA1-C356-11CE-BF01-00AA0055595A' : '6BF52A52-394A-11D3-B153-00C04F79FAA6';
cb = 'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701';
mt = 'application/x-mplayer2';
break;
case 'mceItemQuickTime':
ci = '02BF25D5-8C17-4B23-BC80-D3488ABDDC6B';
cb = 'http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0';
mt = 'video/quicktime';
break;
case 'mceItemRealMedia':
ci = 'CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA';
cb = 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0';
mt = 'audio/x-pn-realaudio-plugin';
break;
}
// Convert the URL
pl.src = tinyMCE.convertURL(pl.src, null, true);
embedHTML = TinyMCE_MediaPlugin._getEmbed(ci, cb, mt, pl, attribs);
} else {
// Use script version
switch (attribs['class']) {
case 'mceItemFlash':
s = 'writeFlash';
break;
case 'mceItemShockWave':
s = 'writeShockWave';
break;
case 'mceItemWindowsMedia':
s = 'writeWindowsMedia';
break;
case 'mceItemQuickTime':
s = 'writeQuickTime';
break;
case 'mceItemRealMedia':
s = 'writeRealMedia';
break;
}
if (attribs.width)
at = at.replace(/width:[^0-9]?[0-9]+%?[^0-9]?/g, "width:'" + attribs.width + "'");
if (attribs.height)
at = at.replace(/height:[^0-9]?[0-9]+%?[^0-9]?/g, "height:'" + attribs.height + "'");
// Force absolute URL
pl.src = tinyMCE.convertURL(pl.src, null, true);
at = at.replace(new RegExp("src:'[^']*'", "g"), "src:'" + pl.src + "'");
embedHTML = '<script type="text/javascript">' + s + '({' + at + '});</script>';
}
// Insert embed/object chunk
chunkBefore = content.substring(0, startPos);
chunkAfter = content.substring(endPos);
content = chunkBefore + embedHTML + chunkAfter;
}
break;
}
return content;
},
handleNodeChange : function(editor_id, node, undo_index, undo_levels, visual_aid, any_selection) {
if (node == null)
return;
do {
if (node.nodeName == "IMG" && /mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(tinyMCE.getAttrib(node, 'class'))) {
tinyMCE.switchClass(editor_id + '_media', 'mceButtonSelected');
return true;
}
} while ((node = node.parentNode));
tinyMCE.switchClass(editor_id + '_media', 'mceButtonNormal');
return true;
},
_createImgFromEmbed : function(n, d, cl) {
var ne, at, i, ti = '', an;
ne = d.createElement('img');
ne.src = tinyMCE.getParam("theme_href") + '/images/spacer.gif';
ne.width = tinyMCE.getAttrib(n, 'width');
ne.height = tinyMCE.getAttrib(n, 'height');
ne.className = cl;
at = n.attributes;
for (i=0; i<at.length; i++) {
if (at[i].specified && at[i].nodeValue) {
an = at[i].nodeName.toLowerCase();
if (an == 'src')
continue;
if (an == 'mce_src')
an = 'src';
if (an.indexOf('mce_') == -1 && !new RegExp('^(class|type)$').test(an))
ti += an.toLowerCase() + ':\'' + at[i].nodeValue + "',";
}
}
ti = ti.length > 0 ? ti.substring(0, ti.length - 1) : ti;
ne.title = ti;
n.parentNode.replaceChild(ne, n);
},
_createImg : function(cl, d, n) {
var i, nl, ti = "", an, av, al = new Array();
ne = d.createElement('img');
ne.src = tinyMCE.getParam("theme_href") + '/images/spacer.gif';
ne.width = tinyMCE.getAttrib(n, 'width');
ne.height = tinyMCE.getAttrib(n, 'height');
ne.className = cl;
al.id = tinyMCE.getAttrib(n, 'id');
al.name = tinyMCE.getAttrib(n, 'name');
al.width = tinyMCE.getAttrib(n, 'width');
al.height = tinyMCE.getAttrib(n, 'height');
al.bgcolor = tinyMCE.getAttrib(n, 'bgcolor');
al.align = tinyMCE.getAttrib(n, 'align');
al.class_name = tinyMCE.getAttrib(n, 'mce_class');
nl = n.getElementsByTagName('div');
for (i=0; i<nl.length; i++) {
av = tinyMCE.getAttrib(nl[i], 'value');
av = av.replace(new RegExp('\\\\', 'g'), '\\\\');
av = av.replace(new RegExp('"', 'g'), '\\"');
av = av.replace(new RegExp("'", 'g'), "\\'");
an = tinyMCE.getAttrib(nl[i], 'name');
al[an] = av;
}
if (al.movie) {
al.src = al.movie;
al.movie = null;
}
for (an in al) {
if (al[an] != null && typeof(al[an]) != "function" && al[an] != '')
ti += an.toLowerCase() + ':\'' + al[an] + "',";
}
ti = ti.length > 0 ? ti.substring(0, ti.length - 1) : ti;
ne.title = ti;
return ne;
},
_getEmbed : function(cls, cb, mt, p, at) {
var h = '', n;
p.width = at.width ? at.width : p.width;
p.height = at.height ? at.height : p.height;
h += '<object classid="clsid:' + cls + '" codebase="' + cb + '"';
h += typeof(p.id) != "undefined" ? ' id="' + p.id + '"' : '';
h += typeof(p.name) != "undefined" ? ' name="' + p.name + '"' : '';
h += typeof(p.width) != "undefined" ? ' width="' + p.width + '"' : '';
h += typeof(p.height) != "undefined" ? ' height="' + p.height + '"' : '';
h += typeof(p.align) != "undefined" ? ' align="' + p.align + '"' : '';
h += '>';
for (n in p) {
if (typeof(p[n]) != "undefined" && typeof(p[n]) != "function") {
h += '<param name="' + n + '" value="' + p[n] + '" />';
// Add extra url parameter if it's an absolute URL on WMP
if (n == 'src' && p[n].indexOf('://') != -1 && mt == 'application/x-mplayer2')
h += '<param name="url" value="' + p[n] + '" />';
}
}
h += '<embed type="' + mt + '"';
for (n in p) {
if (typeof(p[n]) == "function")
continue;
// Skip url parameter for embed tag on WMP
if (!(n == 'url' && mt == 'application/x-mplayer2'))
h += ' ' + n + '="' + p[n] + '"';
}
h += '></embed></object>';
return h;
},
_parseAttributes : function(attribute_string) {
var attributeName = "", endChr = '"';
var attributeValue = "";
var withInName;
var withInValue;
var attributes = new Array();
var whiteSpaceRegExp = new RegExp('^[ \n\r\t]+', 'g');
if (attribute_string == null || attribute_string.length < 2)
return null;
withInName = withInValue = false;
for (var i=0; i<attribute_string.length; i++) {
var chr = attribute_string.charAt(i);
if ((chr == '"' || chr == "'") && !withInValue) {
withInValue = true;
endChr = chr;
} else if (chr == endChr && withInValue) {
withInValue = false;
var pos = attributeName.lastIndexOf(' ');
if (pos != -1)
attributeName = attributeName.substring(pos+1);
attributes[attributeName.toLowerCase()] = attributeValue.substring(1);
attributeName = "";
attributeValue = "";
} else if (!whiteSpaceRegExp.test(chr) && !withInName && !withInValue)
withInName = true;
if (chr == '=' && withInName)
withInName = false;
if (withInName)
attributeName += chr;
if (withInValue)
attributeValue += chr;
}
return attributes;
}
};
tinyMCE.addPlugin("media", TinyMCE_MediaPlugin);
/**
* $Id: editor_plugin_src.js 296 2007-08-21 10:36:35Z spocke $
*
* @author Moxiecode
* @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
*/
/* Import plugin specific language pack */
tinyMCE.importPluginLanguagePack('media');
var TinyMCE_MediaPlugin = {
getInfo : function() {
return {
longname : 'Media',
author : 'Moxiecode Systems AB',
authorurl : 'http://tinymce.moxiecode.com',
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/media',
version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
};
},
initInstance : function(inst) {
// Warn if user has flash plugin and media plugin at the same time
if (inst.hasPlugin('flash') && !tinyMCE.flashWarn) {
alert('Flash plugin is deprecated and should not be used together with the media plugin.');
tinyMCE.flashWarn = true;
}
if (!tinyMCE.settings['media_skip_plugin_css'])
tinyMCE.importCSS(inst.getDoc(), tinyMCE.baseURL + "/plugins/media/css/content.css");
},
getControlHTML : function(cn) {
switch (cn) {
case "media":
return tinyMCE.getButtonHTML(cn, 'lang_media_desc', '{$pluginurl}/images/media.gif', 'mceMedia');
}
return "";
},
execCommand : function(editor_id, element, command, user_interface, value) {
// Handle commands
switch (command) {
case "mceMedia":
tinyMCE.openWindow({
file : '../../plugins/media/media.htm',
width : 430 + tinyMCE.getLang('lang_media_delta_width', 0),
height : 470 + tinyMCE.getLang('lang_media_delta_height', 0)
}, {
editor_id : editor_id,
inline : "yes"
});
return true;
}
// Pass to next handler in chain
return false;
},
cleanup : function(type, content, inst) {
var nl, img, i, ne, d, s, ci;
switch (type) {
case "insert_to_editor":
img = tinyMCE.getParam("theme_href") + '/images/spacer.gif';
content = content.replace(/<script[^>]*>\s*write(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)\(\{([^\)]*)\}\);\s*<\/script>/gi, '<img class="mceItem$1" title="$2" src="' + img + '" />');
content = content.replace(/<object([^>]*)>/gi, '<div class="mceItemObject" $1>');
content = content.replace(/<embed([^>]*)>/gi, '<div class="mceItemObjectEmbed" $1>');
content = content.replace(/<\/(object|embed)([^>]*)>/gi, '</div>');
content = content.replace(/<param([^>]*)>/gi, '<div $1 class="mceItemParam"></div>');
content = content.replace(new RegExp('\\/ class="mceItemParam"><\\/div>', 'gi'), 'class="mceItemParam"></div>');
break;
case "insert_to_editor_dom":
d = inst.getDoc();
nl = content.getElementsByTagName("img");
for (i=0; i<nl.length; i++) {
if (/mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(nl[i].className)) {
nl[i].width = nl[i].title.replace(/.*width:[^0-9]?([0-9]+)%?.*/g, '$1');
nl[i].height = nl[i].title.replace(/.*height:[^0-9]?([0-9]+)%?.*/g, '$1');
//nl[i].align = nl[i].title.replace(/.*align:([a-z]+).*/gi, '$1');
}
}
nl = tinyMCE.selectElements(content, 'DIV', function (n) {return tinyMCE.hasCSSClass(n, 'mceItemObject');});
for (i=0; i<nl.length; i++) {
ci = tinyMCE.getAttrib(nl[i], "classid").toLowerCase().replace(/\s+/g, '');
switch (ci) {
case 'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000':
nl[i].parentNode.replaceChild(TinyMCE_MediaPlugin._createImg('mceItemFlash', d, nl[i]), nl[i]);
break;
case 'clsid:166b1bca-3f9c-11cf-8075-444553540000':
nl[i].parentNode.replaceChild(TinyMCE_MediaPlugin._createImg('mceItemShockWave', d, nl[i]), nl[i]);
break;
case 'clsid:6bf52a52-394a-11d3-b153-00c04f79faa6':
case 'clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95':
case 'clsid:05589fa1-c356-11ce-bf01-00aa0055595a':
nl[i].parentNode.replaceChild(TinyMCE_MediaPlugin._createImg('mceItemWindowsMedia', d, nl[i]), nl[i]);
break;
case 'clsid:02bf25d5-8c17-4b23-bc80-d3488abddc6b':
nl[i].parentNode.replaceChild(TinyMCE_MediaPlugin._createImg('mceItemQuickTime', d, nl[i]), nl[i]);
break;
case 'clsid:cfcdaa03-8be4-11cf-b84b-0020afbbccfa':
nl[i].parentNode.replaceChild(TinyMCE_MediaPlugin._createImg('mceItemRealMedia', d, nl[i]), nl[i]);
break;
}
}
// Handle embed (if any)
nl = tinyMCE.selectNodes(content, function (n) {return n.className == 'mceItemObjectEmbed';});
for (i=0; i<nl.length; i++) {
switch (tinyMCE.getAttrib(nl[i], 'type')) {
case 'application/x-shockwave-flash':
TinyMCE_MediaPlugin._createImgFromEmbed(nl[i], d, 'mceItemFlash');
break;
case 'application/x-director':
TinyMCE_MediaPlugin._createImgFromEmbed(nl[i], d, 'mceItemShockWave');
break;
case 'application/x-mplayer2':
TinyMCE_MediaPlugin._createImgFromEmbed(nl[i], d, 'mceItemWindowsMedia');
break;
case 'video/quicktime':
TinyMCE_MediaPlugin._createImgFromEmbed(nl[i], d, 'mceItemQuickTime');
break;
case 'audio/x-pn-realaudio-plugin':
TinyMCE_MediaPlugin._createImgFromEmbed(nl[i], d, 'mceItemRealMedia');
break;
}
}
break;
case "get_from_editor":
var startPos = -1, endPos, attribs, chunkBefore, chunkAfter, embedHTML, at, pl, cb, mt, ex;
while ((startPos = content.indexOf('<img', startPos+1)) != -1) {
endPos = content.indexOf('/>', startPos);
attribs = TinyMCE_MediaPlugin._parseAttributes(content.substring(startPos + 4, endPos));
// Is not flash, skip it
if (!/mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(attribs['class']))
continue;
endPos += 2;
// Parse attributes
at = attribs['title'];
if (at) {
at = at.replace(/&(#39|apos);/g, "'");
at = at.replace(/&#quot;/g, '"');
try {
pl = eval('x={' + at + '};');
} catch (ex) {
pl = {};
}
}
// Use object/embed
if (!tinyMCE.getParam('media_use_script', false)) {
switch (attribs['class']) {
case 'mceItemFlash':
ci = 'd27cdb6e-ae6d-11cf-96b8-444553540000';
cb = 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0';
mt = 'application/x-shockwave-flash';
break;
case 'mceItemShockWave':
ci = '166B1BCA-3F9C-11CF-8075-444553540000';
cb = 'http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0';
mt = 'application/x-director';
break;
case 'mceItemWindowsMedia':
ci = tinyMCE.getParam('media_wmp6_compatible') ? '05589FA1-C356-11CE-BF01-00AA0055595A' : '6BF52A52-394A-11D3-B153-00C04F79FAA6';
cb = 'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701';
mt = 'application/x-mplayer2';
break;
case 'mceItemQuickTime':
ci = '02BF25D5-8C17-4B23-BC80-D3488ABDDC6B';
cb = 'http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0';
mt = 'video/quicktime';
break;
case 'mceItemRealMedia':
ci = 'CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA';
cb = 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0';
mt = 'audio/x-pn-realaudio-plugin';
break;
}
// Convert the URL
pl.src = tinyMCE.convertURL(pl.src, null, true);
embedHTML = TinyMCE_MediaPlugin._getEmbed(ci, cb, mt, pl, attribs);
} else {
// Use script version
switch (attribs['class']) {
case 'mceItemFlash':
s = 'writeFlash';
break;
case 'mceItemShockWave':
s = 'writeShockWave';
break;
case 'mceItemWindowsMedia':
s = 'writeWindowsMedia';
break;
case 'mceItemQuickTime':
s = 'writeQuickTime';
break;
case 'mceItemRealMedia':
s = 'writeRealMedia';
break;
}
if (attribs.width)
at = at.replace(/width:[^0-9]?[0-9]+%?[^0-9]?/g, "width:'" + attribs.width + "'");
if (attribs.height)
at = at.replace(/height:[^0-9]?[0-9]+%?[^0-9]?/g, "height:'" + attribs.height + "'");
// Force absolute URL
pl.src = tinyMCE.convertURL(pl.src, null, true);
at = at.replace(new RegExp("src:'[^']*'", "g"), "src:'" + pl.src + "'");
embedHTML = '<script type="text/javascript">' + s + '({' + at + '});</script>';
}
// Insert embed/object chunk
chunkBefore = content.substring(0, startPos);
chunkAfter = content.substring(endPos);
content = chunkBefore + embedHTML + chunkAfter;
}
break;
}
return content;
},
handleNodeChange : function(editor_id, node, undo_index, undo_levels, visual_aid, any_selection) {
if (node == null)
return;
do {
if (node.nodeName == "IMG" && /mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(tinyMCE.getAttrib(node, 'class'))) {
tinyMCE.switchClass(editor_id + '_media', 'mceButtonSelected');
return true;
}
} while ((node = node.parentNode));
tinyMCE.switchClass(editor_id + '_media', 'mceButtonNormal');
return true;
},
_createImgFromEmbed : function(n, d, cl) {
var ne, at, i, ti = '', an;
ne = d.createElement('img');
ne.src = tinyMCE.getParam("theme_href") + '/images/spacer.gif';
ne.width = tinyMCE.getAttrib(n, 'width');
ne.height = tinyMCE.getAttrib(n, 'height');
ne.className = cl;
at = n.attributes;
for (i=0; i<at.length; i++) {
if (at[i].specified && at[i].nodeValue) {
an = at[i].nodeName.toLowerCase();
if (an == 'src')
continue;
if (an == 'mce_src')
an = 'src';
if (an.indexOf('mce_') == -1 && !new RegExp('^(class|type)$').test(an))
ti += an.toLowerCase() + ':\'' + at[i].nodeValue + "',";
}
}
ti = ti.length > 0 ? ti.substring(0, ti.length - 1) : ti;
ne.title = ti;
n.parentNode.replaceChild(ne, n);
},
_createImg : function(cl, d, n) {
var i, nl, ti = "", an, av, al = new Array();
ne = d.createElement('img');
ne.src = tinyMCE.getParam("theme_href") + '/images/spacer.gif';
ne.width = tinyMCE.getAttrib(n, 'width');
ne.height = tinyMCE.getAttrib(n, 'height');
ne.className = cl;
al.id = tinyMCE.getAttrib(n, 'id');
al.name = tinyMCE.getAttrib(n, 'name');
al.width = tinyMCE.getAttrib(n, 'width');
al.height = tinyMCE.getAttrib(n, 'height');
al.bgcolor = tinyMCE.getAttrib(n, 'bgcolor');
al.align = tinyMCE.getAttrib(n, 'align');
al.class_name = tinyMCE.getAttrib(n, 'mce_class');
nl = n.getElementsByTagName('div');
for (i=0; i<nl.length; i++) {
av = tinyMCE.getAttrib(nl[i], 'value');
av = av.replace(new RegExp('\\\\', 'g'), '\\\\');
av = av.replace(new RegExp('"', 'g'), '\\"');
av = av.replace(new RegExp("'", 'g'), "\\'");
an = tinyMCE.getAttrib(nl[i], 'name');
al[an] = av;
}
if (al.movie) {
al.src = al.movie;
al.movie = null;
}
for (an in al) {
if (al[an] != null && typeof(al[an]) != "function" && al[an] != '')
ti += an.toLowerCase() + ':\'' + al[an] + "',";
}
ti = ti.length > 0 ? ti.substring(0, ti.length - 1) : ti;
ne.title = ti;
return ne;
},
_getEmbed : function(cls, cb, mt, p, at) {
var h = '', n;
p.width = at.width ? at.width : p.width;
p.height = at.height ? at.height : p.height;
h += '<object classid="clsid:' + cls + '" codebase="' + cb + '"';
h += typeof(p.id) != "undefined" ? ' id="' + p.id + '"' : '';
h += typeof(p.name) != "undefined" ? ' name="' + p.name + '"' : '';
h += typeof(p.width) != "undefined" ? ' width="' + p.width + '"' : '';
h += typeof(p.height) != "undefined" ? ' height="' + p.height + '"' : '';
h += typeof(p.align) != "undefined" ? ' align="' + p.align + '"' : '';
h += '>';
for (n in p) {
if (typeof(p[n]) != "undefined" && typeof(p[n]) != "function") {
h += '<param name="' + n + '" value="' + p[n] + '" />';
// Add extra url parameter if it's an absolute URL on WMP
if (n == 'src' && p[n].indexOf('://') != -1 && mt == 'application/x-mplayer2')
h += '<param name="url" value="' + p[n] + '" />';
}
}
h += '<embed type="' + mt + '"';
for (n in p) {
if (typeof(p[n]) == "function")
continue;
// Skip url parameter for embed tag on WMP
if (!(n == 'url' && mt == 'application/x-mplayer2'))
h += ' ' + n + '="' + p[n] + '"';
}
h += '></embed></object>';
return h;
},
_parseAttributes : function(attribute_string) {
var attributeName = "", endChr = '"';
var attributeValue = "";
var withInName;
var withInValue;
var attributes = new Array();
var whiteSpaceRegExp = new RegExp('^[ \n\r\t]+', 'g');
if (attribute_string == null || attribute_string.length < 2)
return null;
withInName = withInValue = false;
for (var i=0; i<attribute_string.length; i++) {
var chr = attribute_string.charAt(i);
if ((chr == '"' || chr == "'") && !withInValue) {
withInValue = true;
endChr = chr;
} else if (chr == endChr && withInValue) {
withInValue = false;
var pos = attributeName.lastIndexOf(' ');
if (pos != -1)
attributeName = attributeName.substring(pos+1);
attributes[attributeName.toLowerCase()] = attributeValue.substring(1);
attributeName = "";
attributeValue = "";
} else if (!whiteSpaceRegExp.test(chr) && !withInName && !withInValue)
withInName = true;
if (chr == '=' && withInName)
withInName = false;
if (withInName)
attributeName += chr;
if (withInValue)
attributeValue += chr;
}
return attributes;
}
};
tinyMCE.addPlugin("media", TinyMCE_MediaPlugin);

@ -1,73 +1,73 @@
/**
* This script contains embed functions for common plugins. This scripts are complety free to use for any purpose.
*/
function writeFlash(p) {
writeEmbed(
'D27CDB6E-AE6D-11cf-96B8-444553540000',
'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0',
'application/x-shockwave-flash',
p
);
}
function writeShockWave(p) {
writeEmbed(
'166B1BCA-3F9C-11CF-8075-444553540000',
'http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0',
'application/x-director',
p
);
}
function writeQuickTime(p) {
writeEmbed(
'02BF25D5-8C17-4B23-BC80-D3488ABDDC6B',
'http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0',
'video/quicktime',
p
);
}
function writeRealMedia(p) {
writeEmbed(
'CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA',
'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0',
'audio/x-pn-realaudio-plugin',
p
);
}
function writeWindowsMedia(p) {
p.url = p.src;
writeEmbed(
'6BF52A52-394A-11D3-B153-00C04F79FAA6',
'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701',
'application/x-mplayer2',
p
);
}
function writeEmbed(cls, cb, mt, p) {
var h = '', n;
h += '<object classid="clsid:' + cls + '" codebase="' + cb + '"';
h += typeof(p.id) != "undefined" ? 'id="' + p.id + '"' : '';
h += typeof(p.name) != "undefined" ? 'name="' + p.name + '"' : '';
h += typeof(p.width) != "undefined" ? 'width="' + p.width + '"' : '';
h += typeof(p.height) != "undefined" ? 'height="' + p.height + '"' : '';
h += typeof(p.align) != "undefined" ? 'align="' + p.align + '"' : '';
h += '>';
for (n in p)
h += '<param name="' + n + '" value="' + p[n] + '">';
h += '<embed type="' + mt + '"';
for (n in p)
h += n + '="' + p[n] + '" ';
h += '></embed></object>';
document.write(h);
}
/**
* This script contains embed functions for common plugins. This scripts are complety free to use for any purpose.
*/
function writeFlash(p) {
writeEmbed(
'D27CDB6E-AE6D-11cf-96B8-444553540000',
'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0',
'application/x-shockwave-flash',
p
);
}
function writeShockWave(p) {
writeEmbed(
'166B1BCA-3F9C-11CF-8075-444553540000',
'http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0',
'application/x-director',
p
);
}
function writeQuickTime(p) {
writeEmbed(
'02BF25D5-8C17-4B23-BC80-D3488ABDDC6B',
'http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0',
'video/quicktime',
p
);
}
function writeRealMedia(p) {
writeEmbed(
'CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA',
'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0',
'audio/x-pn-realaudio-plugin',
p
);
}
function writeWindowsMedia(p) {
p.url = p.src;
writeEmbed(
'6BF52A52-394A-11D3-B153-00C04F79FAA6',
'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701',
'application/x-mplayer2',
p
);
}
function writeEmbed(cls, cb, mt, p) {
var h = '', n;
h += '<object classid="clsid:' + cls + '" codebase="' + cb + '"';
h += typeof(p.id) != "undefined" ? 'id="' + p.id + '"' : '';
h += typeof(p.name) != "undefined" ? 'name="' + p.name + '"' : '';
h += typeof(p.width) != "undefined" ? 'width="' + p.width + '"' : '';
h += typeof(p.height) != "undefined" ? 'height="' + p.height + '"' : '';
h += typeof(p.align) != "undefined" ? 'align="' + p.align + '"' : '';
h += '>';
for (n in p)
h += '<param name="' + n + '" value="' + p[n] + '">';
h += '<embed type="' + mt + '"';
for (n in p)
h += n + '="' + p[n] + '" ';
h += '></embed></object>';
document.write(h);
}

File diff suppressed because it is too large Load Diff

@ -1,94 +1,94 @@
// UK lang variables
tinyMCE.addToLang('media',{
title : 'Insert / edit embedded media',
desc : 'Insert / edit embedded media',
general : 'General',
advanced : 'Advanced',
file : 'File/URL',
list : 'List',
size : 'Dimensions',
preview : 'Preview',
constrain_proportions : 'Constrain proportions',
type : 'Type',
id : 'Id',
name : 'Name',
class_name : 'Class',
vspace : 'V-Space',
hspace : 'H-Space',
play : 'Auto play',
loop : 'Loop',
menu : 'Show menu',
quality : 'Quality',
scale : 'Scale',
align : 'Align',
salign : 'SAlign',
wmode : 'WMode',
bgcolor : 'Background',
base : 'Base',
flashvars : 'Flashvars',
liveconnect : 'SWLiveConnect',
autohref : 'AutoHREF',
cache : 'Cache',
hidden : 'Hidden',
controller : 'Controller',
kioskmode : 'Kiosk mode',
playeveryframe : 'Play every frame',
targetcache : 'Target cache',
correction : 'No correction',
enablejavascript : 'Enable JavaScript',
starttime : 'Start time',
endtime : 'End time',
href : 'Href',
qtsrcchokespeed : 'Choke speed',
target : 'Target',
volume : 'Volume',
autostart : 'Auto start',
enabled : 'Enabled',
fullscreen : 'Fullscreen',
invokeurls : 'Invoke URLs',
mute : 'Mute',
stretchtofit : 'Stretch to fit',
windowlessvideo : 'Windowless video',
balance : 'Balance',
baseurl : 'Base URL',
captioningid : 'Captioning id',
currentmarker : 'Current marker',
currentposition : 'Current position',
defaultframe : 'Default frame',
playcount : 'Play count',
rate : 'Rate',
uimode : 'UI Mode',
flash_options : 'Flash options',
qt_options : 'Quicktime options',
wmp_options : 'Windows media player options',
rmp_options : 'Real media player options',
shockwave_options : 'Shockwave options',
autogotourl : 'Auto goto URL',
center : 'Center',
imagestatus : 'Image status',
maintainaspect : 'Maintain aspect',
nojava : 'No java',
prefetch : 'Prefetch',
shuffle : 'Shuffle',
console : 'Console',
numloop : 'Num loops',
controls : 'Controls',
scriptcallbacks : 'Script callbacks',
swstretchstyle : 'Stretch style',
swstretchhalign : 'Stretch H-Align',
swstretchvalign : 'Stretch V-Align',
sound : 'Sound',
progress : 'Progress',
qtsrc : 'QT Src',
qt_stream_warn : 'Streamed rtsp resources should be added to the QT Src field under the advanced tab.\nYou should also add a non streamed version to the Src field..',
align_top : 'Top',
align_right : 'Right',
align_bottom : 'Bottom',
align_left : 'Left',
align_center : 'Center',
align_top_left : 'Top left',
align_top_right : 'Top right',
align_bottom_left : 'Bottom left',
align_bottom_right : 'Bottom right'
// UK lang variables
tinyMCE.addToLang('media',{
title : 'Insert / edit embedded media',
desc : 'Insert / edit embedded media',
general : 'General',
advanced : 'Advanced',
file : 'File/URL',
list : 'List',
size : 'Dimensions',
preview : 'Preview',
constrain_proportions : 'Constrain proportions',
type : 'Type',
id : 'Id',
name : 'Name',
class_name : 'Class',
vspace : 'V-Space',
hspace : 'H-Space',
play : 'Auto play',
loop : 'Loop',
menu : 'Show menu',
quality : 'Quality',
scale : 'Scale',
align : 'Align',
salign : 'SAlign',
wmode : 'WMode',
bgcolor : 'Background',
base : 'Base',
flashvars : 'Flashvars',
liveconnect : 'SWLiveConnect',
autohref : 'AutoHREF',
cache : 'Cache',
hidden : 'Hidden',
controller : 'Controller',
kioskmode : 'Kiosk mode',
playeveryframe : 'Play every frame',
targetcache : 'Target cache',
correction : 'No correction',
enablejavascript : 'Enable JavaScript',
starttime : 'Start time',
endtime : 'End time',
href : 'Href',
qtsrcchokespeed : 'Choke speed',
target : 'Target',
volume : 'Volume',
autostart : 'Auto start',
enabled : 'Enabled',
fullscreen : 'Fullscreen',
invokeurls : 'Invoke URLs',
mute : 'Mute',
stretchtofit : 'Stretch to fit',
windowlessvideo : 'Windowless video',
balance : 'Balance',
baseurl : 'Base URL',
captioningid : 'Captioning id',
currentmarker : 'Current marker',
currentposition : 'Current position',
defaultframe : 'Default frame',
playcount : 'Play count',
rate : 'Rate',
uimode : 'UI Mode',
flash_options : 'Flash options',
qt_options : 'Quicktime options',
wmp_options : 'Windows media player options',
rmp_options : 'Real media player options',
shockwave_options : 'Shockwave options',
autogotourl : 'Auto goto URL',
center : 'Center',
imagestatus : 'Image status',
maintainaspect : 'Maintain aspect',
nojava : 'No java',
prefetch : 'Prefetch',
shuffle : 'Shuffle',
console : 'Console',
numloop : 'Num loops',
controls : 'Controls',
scriptcallbacks : 'Script callbacks',
swstretchstyle : 'Stretch style',
swstretchhalign : 'Stretch H-Align',
swstretchvalign : 'Stretch V-Align',
sound : 'Sound',
progress : 'Progress',
qtsrc : 'QT Src',
qt_stream_warn : 'Streamed rtsp resources should be added to the QT Src field under the advanced tab.\nYou should also add a non streamed version to the Src field..',
align_top : 'Top',
align_right : 'Right',
align_bottom : 'Bottom',
align_left : 'Left',
align_center : 'Center',
align_top_left : 'Top left',
align_top_right : 'Top right',
align_bottom_left : 'Bottom left',
align_bottom_right : 'Bottom right'
});

@ -1 +1 @@
This is the location you place TinyMCE plugins.
This is the location you place TinyMCE plugins.

@ -1,17 +1,17 @@
/* CSS file for cell dialog in the table plugin */
.panel_wrapper div.current {
height: 200px;
}
.advfield {
width: 200px;
}
#action {
margin-bottom: 3px;
}
#class {
width: 150px;
/* CSS file for cell dialog in the table plugin */
.panel_wrapper div.current {
height: 200px;
}
.advfield {
width: 200px;
}
#action {
margin-bottom: 3px;
}
#class {
width: 150px;
}

@ -1,25 +1,25 @@
/* CSS file for row dialog in the table plugin */
.panel_wrapper div.current {
height: 200px;
}
.advfield {
width: 200px;
}
#action {
margin-bottom: 3px;
}
#rowtype,#align,#valign,#class,#height {
width: 150px;
}
#height {
width: 50px;
}
.col2 {
padding-left: 20px;
}
/* CSS file for row dialog in the table plugin */
.panel_wrapper div.current {
height: 200px;
}
.advfield {
width: 200px;
}
#action {
margin-bottom: 3px;
}
#rowtype,#align,#valign,#class,#height {
width: 150px;
}
#height {
width: 50px;
}
.col2 {
padding-left: 20px;
}

@ -1,13 +1,13 @@
/* CSS file for table dialog in the table plugin */
.panel_wrapper div.current {
height: 220px;
}
.advfield {
width: 200px;
}
#class {
width: 150px;
}
/* CSS file for table dialog in the table plugin */
.panel_wrapper div.current {
height: 220px;
}
.advfield {
width: 200px;
}
#class {
width: 150px;
}

File diff suppressed because it is too large Load Diff

@ -1,100 +1,100 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>{$lang_insert_image_title}</title>
<script language="javascript" type="text/javascript" src="../../tiny_mce_popup.js"></script>
<script language="javascript" type="text/javascript" src="../../utils/mctabs.js"></script>
<script language="javascript" type="text/javascript" src="../../utils/form_utils.js"></script>
<script language="javascript" type="text/javascript" src="jscripts/image.js"></script>
<base target="_self" />
</head>
<body id="image" onload="tinyMCEPopup.executeOnLoad('init();');" style="display: none">
<form onsubmit="insertImage();return false;" action="#">
<div class="tabs">
<ul>
<li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{$lang_insert_image_title}</a></span></li>
</ul>
</div>
<div class="panel_wrapper">
<div id="general_panel" class="panel current">
<table border="0" cellpadding="4" cellspacing="0">
<tr>
<td nowrap="nowrap"><label for="src">{$lang_insert_image_src}</label></td>
<td><table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><input id="src" name="src" type="text" value="" style="width: 200px" onchange="getImageData();" /></td>
<td id="srcbrowsercontainer">&nbsp;</td>
</tr>
</table></td>
</tr>
<!-- Image list -->
<script language="javascript">
if (typeof(tinyMCEImageList) != "undefined" && tinyMCEImageList.length > 0) {
var html = "";
html += '<tr><td><label for="image_list">{$lang_image_list}</label></td>';
html += '<td><select id="image_list" name="image_list" style="width: 200px" onchange="this.form.src.value=this.options[this.selectedIndex].value;resetImageData();getImageData();">';
html += '<option value="">---</option>';
for (var i=0; i<tinyMCEImageList.length; i++)
html += '<option value="' + tinyMCEImageList[i][1] + '">' + tinyMCEImageList[i][0] + '</option>';
html += '</select></td></tr>';
document.write(html);
}
</script>
<!-- /Image list -->
<tr>
<td nowrap="nowrap"><label for="alt">{$lang_insert_image_alt}</label></td>
<td><input id="alt" name="alt" type="text" value="" style="width: 200px" /></td>
</tr>
<tr>
<td nowrap="nowrap"><label for="align">{$lang_insert_image_align}</label></td>
<td><select id="align" name="align">
<option value="">{$lang_insert_image_align_default}</option>
<option value="baseline">{$lang_insert_image_align_baseline}</option>
<option value="top">{$lang_insert_image_align_top}</option>
<option value="middle">{$lang_insert_image_align_middle}</option>
<option value="bottom">{$lang_insert_image_align_bottom}</option>
<option value="texttop">{$lang_insert_image_align_texttop}</option>
<option value="absmiddle">{$lang_insert_image_align_absmiddle}</option>
<option value="absbottom">{$lang_insert_image_align_absbottom}</option>
<option value="left">{$lang_insert_image_align_left}</option>
<option value="right">{$lang_insert_image_align_right}</option>
</select></td>
</tr>
<tr>
<td nowrap="nowrap"><label for="width">{$lang_insert_image_dimensions}</label></td>
<td><input id="width" name="width" type="text" value="" size="3" maxlength="5" />
x
<input id="height" name="height" type="text" value="" size="3" maxlength="5" /></td>
</tr>
<tr>
<td nowrap="nowrap"><label for="border">{$lang_insert_image_border}</label></td>
<td><input id="border" name="border" type="text" value="" size="3" maxlength="3" /></td>
</tr>
<tr>
<td nowrap="nowrap"><label for="vspace">{$lang_insert_image_vspace}</label></td>
<td><input id="vspace" name="vspace" type="text" value="" size="3" maxlength="3" /></td>
</tr>
<tr>
<td nowrap="nowrap"><label for="hspace">{$lang_insert_image_hspace}</label></td>
<td><input id="hspace" name="hspace" type="text" value="" size="3" maxlength="3" /></td>
</tr>
</table>
</div>
</div>
<div class="mceActionPanel">
<div style="float: left">
<input type="button" id="insert" name="insert" value="{$lang_insert}" onclick="insertImage();" />
</div>
<div style="float: right">
<input type="button" id="cancel" name="cancel" value="{$lang_cancel}" onclick="tinyMCEPopup.close();" />
</div>
</div>
</form>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>{$lang_insert_image_title}</title>
<script language="javascript" type="text/javascript" src="../../tiny_mce_popup.js"></script>
<script language="javascript" type="text/javascript" src="../../utils/mctabs.js"></script>
<script language="javascript" type="text/javascript" src="../../utils/form_utils.js"></script>
<script language="javascript" type="text/javascript" src="jscripts/image.js"></script>
<base target="_self" />
</head>
<body id="image" onload="tinyMCEPopup.executeOnLoad('init();');" style="display: none">
<form onsubmit="insertImage();return false;" action="#">
<div class="tabs">
<ul>
<li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{$lang_insert_image_title}</a></span></li>
</ul>
</div>
<div class="panel_wrapper">
<div id="general_panel" class="panel current">
<table border="0" cellpadding="4" cellspacing="0">
<tr>
<td nowrap="nowrap"><label for="src">{$lang_insert_image_src}</label></td>
<td><table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><input id="src" name="src" type="text" value="" style="width: 200px" onchange="getImageData();" /></td>
<td id="srcbrowsercontainer">&nbsp;</td>
</tr>
</table></td>
</tr>
<!-- Image list -->
<script language="javascript">
if (typeof(tinyMCEImageList) != "undefined" && tinyMCEImageList.length > 0) {
var html = "";
html += '<tr><td><label for="image_list">{$lang_image_list}</label></td>';
html += '<td><select id="image_list" name="image_list" style="width: 200px" onchange="this.form.src.value=this.options[this.selectedIndex].value;resetImageData();getImageData();">';
html += '<option value="">---</option>';
for (var i=0; i<tinyMCEImageList.length; i++)
html += '<option value="' + tinyMCEImageList[i][1] + '">' + tinyMCEImageList[i][0] + '</option>';
html += '</select></td></tr>';
document.write(html);
}
</script>
<!-- /Image list -->
<tr>
<td nowrap="nowrap"><label for="alt">{$lang_insert_image_alt}</label></td>
<td><input id="alt" name="alt" type="text" value="" style="width: 200px" /></td>
</tr>
<tr>
<td nowrap="nowrap"><label for="align">{$lang_insert_image_align}</label></td>
<td><select id="align" name="align">
<option value="">{$lang_insert_image_align_default}</option>
<option value="baseline">{$lang_insert_image_align_baseline}</option>
<option value="top">{$lang_insert_image_align_top}</option>
<option value="middle">{$lang_insert_image_align_middle}</option>
<option value="bottom">{$lang_insert_image_align_bottom}</option>
<option value="texttop">{$lang_insert_image_align_texttop}</option>
<option value="absmiddle">{$lang_insert_image_align_absmiddle}</option>
<option value="absbottom">{$lang_insert_image_align_absbottom}</option>
<option value="left">{$lang_insert_image_align_left}</option>
<option value="right">{$lang_insert_image_align_right}</option>
</select></td>
</tr>
<tr>
<td nowrap="nowrap"><label for="width">{$lang_insert_image_dimensions}</label></td>
<td><input id="width" name="width" type="text" value="" size="3" maxlength="5" />
x
<input id="height" name="height" type="text" value="" size="3" maxlength="5" /></td>
</tr>
<tr>
<td nowrap="nowrap"><label for="border">{$lang_insert_image_border}</label></td>
<td><input id="border" name="border" type="text" value="" size="3" maxlength="3" /></td>
</tr>
<tr>
<td nowrap="nowrap"><label for="vspace">{$lang_insert_image_vspace}</label></td>
<td><input id="vspace" name="vspace" type="text" value="" size="3" maxlength="3" /></td>
</tr>
<tr>
<td nowrap="nowrap"><label for="hspace">{$lang_insert_image_hspace}</label></td>
<td><input id="hspace" name="hspace" type="text" value="" size="3" maxlength="3" /></td>
</tr>
</table>
</div>
</div>
<div class="mceActionPanel">
<div style="float: left">
<input type="button" id="insert" name="insert" value="{$lang_insert}" onclick="insertImage();" />
</div>
<div style="float: right">
<input type="button" id="cancel" name="cancel" value="{$lang_cancel}" onclick="tinyMCEPopup.close();" />
</div>
</div>
</form>
</body>
</html>

@ -1,294 +1,294 @@
// Some global instances, this will be filled later
var tinyMCE = null, tinyMCELang = null;
function TinyMCE_Popup() {
};
TinyMCE_Popup.prototype = {
findWin : function(w) {
var c;
// Check parents
c = w;
while (c && (c = c.parent) != null) {
if (typeof(c.tinyMCE) != "undefined")
return c;
}
// Check openers
c = w;
while (c && (c = c.opener) != null) {
if (typeof(c.tinyMCE) != "undefined")
return c;
}
// Try top
if (typeof(top.tinyMCE) != "undefined")
return top;
return null;
},
init : function() {
var win = window.opener ? window.opener : window.dialogArguments, c;
var inst, re, title, divElm;
if (!win)
win = this.findWin(window);
if (!win) {
alert("tinyMCE object reference not found from popup.");
return;
}
window.opener = win;
this.windowOpener = win;
this.onLoadEval = "";
// Setup parent references
tinyMCE = win.tinyMCE;
tinyMCELang = win.tinyMCELang;
inst = tinyMCE.selectedInstance;
this.isWindow = tinyMCE.getWindowArg('mce_inside_iframe', false) == false;
this.storeSelection = (tinyMCE.isRealIE) && !this.isWindow && tinyMCE.getWindowArg('mce_store_selection', true);
if (this.isWindow)
window.focus();
// Store selection
if (this.storeSelection)
inst.selectionBookmark = inst.selection.getBookmark(true);
// Setup dir
if (tinyMCELang.lang_dir)
document.dir = tinyMCELang.lang_dir;
// Setup title
re = new RegExp('{|\\\$|}', 'g');
title = document.title.replace(re, "");
if (typeof(tinyMCELang[title]) != "undefined") {
divElm = document.createElement("div");
divElm.innerHTML = tinyMCELang[title];
document.title = divElm.innerHTML;
if (typeof(tinyMCE.setWindowTitle) != 'undefined')
tinyMCE.setWindowTitle(window, divElm.innerHTML);
}
// Output Popup CSS class
document.write('<link href="' + tinyMCE.getParam("popups_css") + '" rel="stylesheet" type="text/css">');
if (tinyMCE.getParam("popups_css_add")) {
c = tinyMCE.getParam("popups_css_add");
// Is relative
if (c.indexOf('://') == -1 && c.charAt(0) != '/')
c = tinyMCE.documentBasePath + "/" + c;
document.write('<link href="' + c + '" rel="stylesheet" type="text/css">');
}
tinyMCE.addEvent(window, "load", this.onLoad);
},
onLoad : function() {
var dir, i, elms, body = document.body;
if (tinyMCE.getWindowArg('mce_replacevariables', true))
body.innerHTML = tinyMCE.applyTemplate(body.innerHTML, tinyMCE.windowArgs);
dir = tinyMCE.selectedInstance.settings.directionality;
if (dir == "rtl" && document.forms && document.forms.length > 0) {
elms = document.forms[0].elements;
for (i=0; i<elms.length; i++) {
if ((elms[i].type == "text" || elms[i].type == "textarea") && elms[i].getAttribute("dir") != "ltr")
elms[i].dir = dir;
}
}
if (body.style.display == 'none')
body.style.display = 'block';
// Execute real onload (Opera fix)
if (tinyMCEPopup.onLoadEval !== '')
eval(tinyMCEPopup.onLoadEval);
},
executeOnLoad : function(str) {
if (tinyMCE.isOpera && parseFloat(opera.version()) < 9.5)
this.onLoadEval = str;
else
eval(str);
},
resizeToInnerSize : function() {
var i, doc, body, oldMargin, wrapper, iframe, nodes, dx, dy;
// Netscape 7.1 workaround
if (this.isWindow && tinyMCE.isNS71) {
window.resizeBy(0, 10);
return;
}
if (this.isWindow) {
doc = document;
body = doc.body;
if (body.style.display == 'none')
body.style.display = 'block';
// Remove margin
oldMargin = body.style.margin;
body.style.margin = '0';
// Create wrapper
wrapper = doc.createElement("div");
wrapper.id = 'mcBodyWrapper';
wrapper.style.display = 'none';
wrapper.style.margin = '0';
// Wrap body elements
nodes = doc.body.childNodes;
for (i=nodes.length-1; i>=0; i--) {
if (wrapper.hasChildNodes())
wrapper.insertBefore(nodes[i].cloneNode(true), wrapper.firstChild);
else
wrapper.appendChild(nodes[i].cloneNode(true));
nodes[i].parentNode.removeChild(nodes[i]);
}
// Add wrapper
doc.body.appendChild(wrapper);
// Create iframe
iframe = document.createElement("iframe");
iframe.id = "mcWinIframe";
iframe.src = document.location.href.toLowerCase().indexOf('https') == -1 ? "about:blank" : tinyMCE.settings.default_document;
iframe.width = "100%";
iframe.height = "100%";
iframe.style.margin = '0';
// Add iframe
doc.body.appendChild(iframe);
// Measure iframe
iframe = document.getElementById('mcWinIframe');
dx = tinyMCE.getWindowArg('mce_width') - iframe.clientWidth;
dy = tinyMCE.getWindowArg('mce_height') - iframe.clientHeight;
// Resize window
// tinyMCE.debug(tinyMCE.getWindowArg('mce_width') + "," + tinyMCE.getWindowArg('mce_height') + " - " + dx + "," + dy);
window.resizeBy(dx, dy);
// Hide iframe and show wrapper
body.style.margin = oldMargin;
iframe.style.display = 'none';
wrapper.style.display = 'block';
}
},
resizeToContent : function() {
var isMSIE = (navigator.appName == "Microsoft Internet Explorer");
var isOpera = (navigator.userAgent.indexOf("Opera") != -1);
var elm, width, height, x, y, dx, dy;
if (isOpera)
return;
if (isMSIE) {
try { window.resizeTo(10, 10); } catch (e) {}
elm = document.body;
width = elm.offsetWidth;
height = elm.offsetHeight;
dx = (elm.scrollWidth - width) + 4;
dy = elm.scrollHeight - height;
try { window.resizeBy(dx, dy); } catch (e) {}
} else {
window.scrollBy(1000, 1000);
if (window.scrollX > 0 || window.scrollY > 0) {
window.resizeBy(window.innerWidth * 2, window.innerHeight * 2);
window.sizeToContent();
window.scrollTo(0, 0);
x = parseInt(screen.width / 2.0) - (window.outerWidth / 2.0);
y = parseInt(screen.height / 2.0) - (window.outerHeight / 2.0);
window.moveTo(x, y);
}
}
},
getWindowArg : function(name, default_value) {
return tinyMCE.getWindowArg(name, default_value);
},
restoreSelection : function() {
var inst;
if (this.storeSelection) {
inst = tinyMCE.selectedInstance;
inst.getWin().focus();
if (inst.selectionBookmark)
inst.selection.moveToBookmark(inst.selectionBookmark);
}
},
execCommand : function(command, user_interface, value) {
var inst = tinyMCE.selectedInstance;
this.restoreSelection();
inst.execCommand(command, user_interface, value);
// Store selection
if (this.storeSelection)
inst.selectionBookmark = inst.selection.getBookmark(true);
},
close : function() {
tinyMCE.closeWindow(window);
},
pickColor : function(e, element_id) {
tinyMCE.selectedInstance.execCommand('mceColorPicker', true, {
element_id : element_id,
document : document,
window : window,
store_selection : false
});
},
openBrowser : function(element_id, type, option) {
var cb = tinyMCE.getParam(option, tinyMCE.getParam("file_browser_callback"));
var url = document.getElementById(element_id).value;
tinyMCE.setWindowArg("window", window);
tinyMCE.setWindowArg("document", document);
// Call to external callback
if (eval('typeof(tinyMCEPopup.windowOpener.' + cb + ')') == "undefined")
alert("Callback function: " + cb + " could not be found.");
else
eval("tinyMCEPopup.windowOpener." + cb + "(element_id, url, type, window);");
},
importClass : function(c) {
var n;
window[c] = function() {};
for (n in window.opener[c].prototype)
window[c].prototype[n] = window.opener[c].prototype[n];
window[c].constructor = window.opener[c].constructor;
}
};
// Setup global instance
var tinyMCEPopup = new TinyMCE_Popup();
tinyMCEPopup.init();
// Some global instances, this will be filled later
var tinyMCE = null, tinyMCELang = null;
function TinyMCE_Popup() {
};
TinyMCE_Popup.prototype = {
findWin : function(w) {
var c;
// Check parents
c = w;
while (c && (c = c.parent) != null) {
if (typeof(c.tinyMCE) != "undefined")
return c;
}
// Check openers
c = w;
while (c && (c = c.opener) != null) {
if (typeof(c.tinyMCE) != "undefined")
return c;
}
// Try top
if (typeof(top.tinyMCE) != "undefined")
return top;
return null;
},
init : function() {
var win = window.opener ? window.opener : window.dialogArguments, c;
var inst, re, title, divElm;
if (!win)
win = this.findWin(window);
if (!win) {
alert("tinyMCE object reference not found from popup.");
return;
}
window.opener = win;
this.windowOpener = win;
this.onLoadEval = "";
// Setup parent references
tinyMCE = win.tinyMCE;
tinyMCELang = win.tinyMCELang;
inst = tinyMCE.selectedInstance;
this.isWindow = tinyMCE.getWindowArg('mce_inside_iframe', false) == false;
this.storeSelection = (tinyMCE.isRealIE) && !this.isWindow && tinyMCE.getWindowArg('mce_store_selection', true);
if (this.isWindow)
window.focus();
// Store selection
if (this.storeSelection)
inst.selectionBookmark = inst.selection.getBookmark(true);
// Setup dir
if (tinyMCELang.lang_dir)
document.dir = tinyMCELang.lang_dir;
// Setup title
re = new RegExp('{|\\\$|}', 'g');
title = document.title.replace(re, "");
if (typeof(tinyMCELang[title]) != "undefined") {
divElm = document.createElement("div");
divElm.innerHTML = tinyMCELang[title];
document.title = divElm.innerHTML;
if (typeof(tinyMCE.setWindowTitle) != 'undefined')
tinyMCE.setWindowTitle(window, divElm.innerHTML);
}
// Output Popup CSS class
document.write('<link href="' + tinyMCE.getParam("popups_css") + '" rel="stylesheet" type="text/css">');
if (tinyMCE.getParam("popups_css_add")) {
c = tinyMCE.getParam("popups_css_add");
// Is relative
if (c.indexOf('://') == -1 && c.charAt(0) != '/')
c = tinyMCE.documentBasePath + "/" + c;
document.write('<link href="' + c + '" rel="stylesheet" type="text/css">');
}
tinyMCE.addEvent(window, "load", this.onLoad);
},
onLoad : function() {
var dir, i, elms, body = document.body;
if (tinyMCE.getWindowArg('mce_replacevariables', true))
body.innerHTML = tinyMCE.applyTemplate(body.innerHTML, tinyMCE.windowArgs);
dir = tinyMCE.selectedInstance.settings.directionality;
if (dir == "rtl" && document.forms && document.forms.length > 0) {
elms = document.forms[0].elements;
for (i=0; i<elms.length; i++) {
if ((elms[i].type == "text" || elms[i].type == "textarea") && elms[i].getAttribute("dir") != "ltr")
elms[i].dir = dir;
}
}
if (body.style.display == 'none')
body.style.display = 'block';
// Execute real onload (Opera fix)
if (tinyMCEPopup.onLoadEval !== '')
eval(tinyMCEPopup.onLoadEval);
},
executeOnLoad : function(str) {
if (tinyMCE.isOpera && parseFloat(opera.version()) < 9.5)
this.onLoadEval = str;
else
eval(str);
},
resizeToInnerSize : function() {
var i, doc, body, oldMargin, wrapper, iframe, nodes, dx, dy;
// Netscape 7.1 workaround
if (this.isWindow && tinyMCE.isNS71) {
window.resizeBy(0, 10);
return;
}
if (this.isWindow) {
doc = document;
body = doc.body;
if (body.style.display == 'none')
body.style.display = 'block';
// Remove margin
oldMargin = body.style.margin;
body.style.margin = '0';
// Create wrapper
wrapper = doc.createElement("div");
wrapper.id = 'mcBodyWrapper';
wrapper.style.display = 'none';
wrapper.style.margin = '0';
// Wrap body elements
nodes = doc.body.childNodes;
for (i=nodes.length-1; i>=0; i--) {
if (wrapper.hasChildNodes())
wrapper.insertBefore(nodes[i].cloneNode(true), wrapper.firstChild);
else
wrapper.appendChild(nodes[i].cloneNode(true));
nodes[i].parentNode.removeChild(nodes[i]);
}
// Add wrapper
doc.body.appendChild(wrapper);
// Create iframe
iframe = document.createElement("iframe");
iframe.id = "mcWinIframe";
iframe.src = document.location.href.toLowerCase().indexOf('https') == -1 ? "about:blank" : tinyMCE.settings.default_document;
iframe.width = "100%";
iframe.height = "100%";
iframe.style.margin = '0';
// Add iframe
doc.body.appendChild(iframe);
// Measure iframe
iframe = document.getElementById('mcWinIframe');
dx = tinyMCE.getWindowArg('mce_width') - iframe.clientWidth;
dy = tinyMCE.getWindowArg('mce_height') - iframe.clientHeight;
// Resize window
// tinyMCE.debug(tinyMCE.getWindowArg('mce_width') + "," + tinyMCE.getWindowArg('mce_height') + " - " + dx + "," + dy);
window.resizeBy(dx, dy);
// Hide iframe and show wrapper
body.style.margin = oldMargin;
iframe.style.display = 'none';
wrapper.style.display = 'block';
}
},
resizeToContent : function() {
var isMSIE = (navigator.appName == "Microsoft Internet Explorer");
var isOpera = (navigator.userAgent.indexOf("Opera") != -1);
var elm, width, height, x, y, dx, dy;
if (isOpera)
return;
if (isMSIE) {
try { window.resizeTo(10, 10); } catch (e) {}
elm = document.body;
width = elm.offsetWidth;
height = elm.offsetHeight;
dx = (elm.scrollWidth - width) + 4;
dy = elm.scrollHeight - height;
try { window.resizeBy(dx, dy); } catch (e) {}
} else {
window.scrollBy(1000, 1000);
if (window.scrollX > 0 || window.scrollY > 0) {
window.resizeBy(window.innerWidth * 2, window.innerHeight * 2);
window.sizeToContent();
window.scrollTo(0, 0);
x = parseInt(screen.width / 2.0) - (window.outerWidth / 2.0);
y = parseInt(screen.height / 2.0) - (window.outerHeight / 2.0);
window.moveTo(x, y);
}
}
},
getWindowArg : function(name, default_value) {
return tinyMCE.getWindowArg(name, default_value);
},
restoreSelection : function() {
var inst;
if (this.storeSelection) {
inst = tinyMCE.selectedInstance;
inst.getWin().focus();
if (inst.selectionBookmark)
inst.selection.moveToBookmark(inst.selectionBookmark);
}
},
execCommand : function(command, user_interface, value) {
var inst = tinyMCE.selectedInstance;
this.restoreSelection();
inst.execCommand(command, user_interface, value);
// Store selection
if (this.storeSelection)
inst.selectionBookmark = inst.selection.getBookmark(true);
},
close : function() {
tinyMCE.closeWindow(window);
},
pickColor : function(e, element_id) {
tinyMCE.selectedInstance.execCommand('mceColorPicker', true, {
element_id : element_id,
document : document,
window : window,
store_selection : false
});
},
openBrowser : function(element_id, type, option) {
var cb = tinyMCE.getParam(option, tinyMCE.getParam("file_browser_callback"));
var url = document.getElementById(element_id).value;
tinyMCE.setWindowArg("window", window);
tinyMCE.setWindowArg("document", document);
// Call to external callback
if (eval('typeof(tinyMCEPopup.windowOpener.' + cb + ')') == "undefined")
alert("Callback function: " + cb + " could not be found.");
else
eval("tinyMCEPopup.windowOpener." + cb + "(element_id, url, type, window);");
},
importClass : function(c) {
var n;
window[c] = function() {};
for (n in window.opener[c].prototype)
window[c].prototype[n] = window.opener[c].prototype[n];
window[c].constructor = window.opener[c].constructor;
}
};
// Setup global instance
var tinyMCEPopup = new TinyMCE_Popup();
tinyMCEPopup.init();

File diff suppressed because it is too large Load Diff

@ -1,61 +1,61 @@
/**
* $Id: editable_selects.js 162 2007-01-03 16:16:52Z spocke $
*
* Makes select boxes editable.
*
* @author Moxiecode
* @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
*/
var TinyMCE_EditableSelects = {
editSelectElm : null,
init : function() {
var nl = document.getElementsByTagName("select"), i, d = document, o;
for (i=0; i<nl.length; i++) {
if (nl[i].className.indexOf('mceEditableSelect') != -1) {
o = new Option('(value)', '__mce_add_custom__');
o.className = 'mceAddSelectValue';
nl[i].options[nl[i].options.length] = o;
nl[i].setAttribute('onchange', 'TinyMCE_EditableSelects.onChangeEditableSelect(this);');
}
}
},
onChangeEditableSelect : function(se) {
var d = document, ne;
if (se.options[se.selectedIndex].value == '__mce_add_custom__') {
ne = d.createElement("input");
ne.id = se.id + "_custom";
ne.name = se.name + "_custom";
ne.type = "text";
ne.style.width = se.clientWidth;
se.parentNode.insertBefore(ne, se);
se.style.display = 'none';
ne.focus();
ne.onblur = TinyMCE_EditableSelects.onBlurEditableSelectInput;
TinyMCE_EditableSelects.editSelectElm = se;
}
},
onBlurEditableSelectInput : function() {
var se = TinyMCE_EditableSelects.editSelectElm;
if (se) {
if (se.previousSibling.value != '') {
addSelectValue(document.forms[0], se.id, se.previousSibling.value, se.previousSibling.value);
selectByValue(document.forms[0], se.id, se.previousSibling.value);
} else
selectByValue(document.forms[0], se.id, '');
se.style.display = 'inline';
se.parentNode.removeChild(se.previousSibling);
TinyMCE_EditableSelects.editSelectElm = null;
}
}
};
/**
* $Id: editable_selects.js 162 2007-01-03 16:16:52Z spocke $
*
* Makes select boxes editable.
*
* @author Moxiecode
* @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
*/
var TinyMCE_EditableSelects = {
editSelectElm : null,
init : function() {
var nl = document.getElementsByTagName("select"), i, d = document, o;
for (i=0; i<nl.length; i++) {
if (nl[i].className.indexOf('mceEditableSelect') != -1) {
o = new Option('(value)', '__mce_add_custom__');
o.className = 'mceAddSelectValue';
nl[i].options[nl[i].options.length] = o;
nl[i].setAttribute('onchange', 'TinyMCE_EditableSelects.onChangeEditableSelect(this);');
}
}
},
onChangeEditableSelect : function(se) {
var d = document, ne;
if (se.options[se.selectedIndex].value == '__mce_add_custom__') {
ne = d.createElement("input");
ne.id = se.id + "_custom";
ne.name = se.name + "_custom";
ne.type = "text";
ne.style.width = se.clientWidth;
se.parentNode.insertBefore(ne, se);
se.style.display = 'none';
ne.focus();
ne.onblur = TinyMCE_EditableSelects.onBlurEditableSelectInput;
TinyMCE_EditableSelects.editSelectElm = se;
}
},
onBlurEditableSelectInput : function() {
var se = TinyMCE_EditableSelects.editSelectElm;
if (se) {
if (se.previousSibling.value != '') {
addSelectValue(document.forms[0], se.id, se.previousSibling.value, se.previousSibling.value);
selectByValue(document.forms[0], se.id, se.previousSibling.value);
} else
selectByValue(document.forms[0], se.id, '');
se.style.display = 'inline';
se.parentNode.removeChild(se.previousSibling);
TinyMCE_EditableSelects.editSelectElm = null;
}
}
};

@ -1,210 +1,210 @@
/**
* $Id: form_utils.js 162 2007-01-03 16:16:52Z spocke $
*
* Various form utilitiy functions.
*
* @author Moxiecode
* @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
*/
var themeBaseURL = tinyMCE.baseURL + '/themes/' + tinyMCE.getParam("theme");
function getColorPickerHTML(id, target_form_element) {
var h = "";
h += '<a id="' + id + '_link" href="javascript:void(0);" onkeydown="pickColor(event,\'' + target_form_element +'\');" onmousedown="pickColor(event,\'' + target_form_element +'\');return false;">';
h += '<img id="' + id + '" src="' + themeBaseURL + '/images/color.gif"';
h += ' onmouseover="this.className=\'mceButtonOver\'"';
h += ' onmouseout="this.className=\'mceButtonNormal\'"';
h += ' onmousedown="this.className=\'mceButtonDown\'"';
h += ' width="20" height="16" border="0" title="' + tinyMCE.getLang('lang_browse') + '"';
h += ' class="mceButtonNormal" alt="' + tinyMCE.getLang('lang_browse') + '" /></a>';
return h;
}
function pickColor(e, target_form_element) {
if ((e.keyCode == 32 || e.keyCode == 13) || e.type == "mousedown")
tinyMCEPopup.pickColor(e, target_form_element);
}
function updateColor(img_id, form_element_id) {
document.getElementById(img_id).style.backgroundColor = document.forms[0].elements[form_element_id].value;
}
function setBrowserDisabled(id, state) {
var img = document.getElementById(id);
var lnk = document.getElementById(id + "_link");
if (lnk) {
if (state) {
lnk.setAttribute("realhref", lnk.getAttribute("href"));
lnk.removeAttribute("href");
tinyMCE.switchClass(img, 'mceButtonDisabled', true);
} else {
lnk.setAttribute("href", lnk.getAttribute("realhref"));
tinyMCE.switchClass(img, 'mceButtonNormal', false);
}
}
}
function getBrowserHTML(id, target_form_element, type, prefix) {
var option = prefix + "_" + type + "_browser_callback";
var cb = tinyMCE.getParam(option, tinyMCE.getParam("file_browser_callback"));
if (cb == null)
return "";
var html = "";
html += '<a id="' + id + '_link" href="javascript:openBrower(\'' + id + '\',\'' + target_form_element + '\', \'' + type + '\',\'' + option + '\');" onmousedown="return false;">';
html += '<img id="' + id + '" src="' + themeBaseURL + '/images/browse.gif"';
html += ' onmouseover="this.className=\'mceButtonOver\';"';
html += ' onmouseout="this.className=\'mceButtonNormal\';"';
html += ' onmousedown="this.className=\'mceButtonDown\';"';
html += ' width="20" height="18" border="0" title="' + tinyMCE.getLang('lang_browse') + '"';
html += ' class="mceButtonNormal" alt="' + tinyMCE.getLang('lang_browse') + '" /></a>';
return html;
}
function openBrower(img_id, target_form_element, type, option) {
var img = document.getElementById(img_id);
if (img.className != "mceButtonDisabled")
tinyMCEPopup.openBrowser(target_form_element, type, option);
}
function selectByValue(form_obj, field_name, value, add_custom, ignore_case) {
if (!form_obj || !form_obj.elements[field_name])
return;
var sel = form_obj.elements[field_name];
var found = false;
for (var i=0; i<sel.options.length; i++) {
var option = sel.options[i];
if (option.value == value || (ignore_case && option.value.toLowerCase() == value.toLowerCase())) {
option.selected = true;
found = true;
} else
option.selected = false;
}
if (!found && add_custom && value != '') {
var option = new Option(value, value);
option.selected = true;
sel.options[sel.options.length] = option;
sel.selectedIndex = sel.options.length - 1;
}
return found;
}
function getSelectValue(form_obj, field_name) {
var elm = form_obj.elements[field_name];
if (elm == null || elm.options == null)
return "";
return elm.options[elm.selectedIndex].value;
}
function addSelectValue(form_obj, field_name, name, value) {
var s = form_obj.elements[field_name];
var o = new Option(name, value);
s.options[s.options.length] = o;
}
function addClassesToList(list_id, specific_option) {
// Setup class droplist
var styleSelectElm = document.getElementById(list_id);
var styles = tinyMCE.getParam('theme_advanced_styles', false);
styles = tinyMCE.getParam(specific_option, styles);
if (styles) {
var stylesAr = styles.split(';');
for (var i=0; i<stylesAr.length; i++) {
if (stylesAr != "") {
var key, value;
key = stylesAr[i].split('=')[0];
value = stylesAr[i].split('=')[1];
styleSelectElm.options[styleSelectElm.length] = new Option(key, value);
}
}
} else {
// Use auto impored classes
var csses = tinyMCE.getCSSClasses(tinyMCE.getWindowArg('editor_id'));
for (var i=0; i<csses.length; i++)
styleSelectElm.options[styleSelectElm.length] = new Option(csses[i], csses[i]);
}
}
function isVisible(element_id) {
var elm = document.getElementById(element_id);
return elm && elm.style.display != "none";
}
function convertRGBToHex(col) {
var re = new RegExp("rgb\\s*\\(\\s*([0-9]+).*,\\s*([0-9]+).*,\\s*([0-9]+).*\\)", "gi");
var rgb = col.replace(re, "$1,$2,$3").split(',');
if (rgb.length == 3) {
r = parseInt(rgb[0]).toString(16);
g = parseInt(rgb[1]).toString(16);
b = parseInt(rgb[2]).toString(16);
r = r.length == 1 ? '0' + r : r;
g = g.length == 1 ? '0' + g : g;
b = b.length == 1 ? '0' + b : b;
return "#" + r + g + b;
}
return col;
}
function convertHexToRGB(col) {
if (col.indexOf('#') != -1) {
col = col.replace(new RegExp('[^0-9A-F]', 'gi'), '');
r = parseInt(col.substring(0, 2), 16);
g = parseInt(col.substring(2, 4), 16);
b = parseInt(col.substring(4, 6), 16);
return "rgb(" + r + "," + g + "," + b + ")";
}
return col;
}
function trimSize(size) {
return size.replace(new RegExp('[^0-9%]', 'gi'), '');
}
function getCSSSize(size) {
size = trimSize(size);
if (size == "")
return "";
return size.indexOf('%') != -1 ? size : size + "px";
}
function getStyle(elm, attrib, style) {
var val = tinyMCE.getAttrib(elm, attrib);
if (val != '')
return '' + val;
if (typeof(style) == 'undefined')
style = attrib;
val = eval('elm.style.' + style);
return val == null ? '' : '' + val;
}
/**
* $Id: form_utils.js 162 2007-01-03 16:16:52Z spocke $
*
* Various form utilitiy functions.
*
* @author Moxiecode
* @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
*/
var themeBaseURL = tinyMCE.baseURL + '/themes/' + tinyMCE.getParam("theme");
function getColorPickerHTML(id, target_form_element) {
var h = "";
h += '<a id="' + id + '_link" href="javascript:void(0);" onkeydown="pickColor(event,\'' + target_form_element +'\');" onmousedown="pickColor(event,\'' + target_form_element +'\');return false;">';
h += '<img id="' + id + '" src="' + themeBaseURL + '/images/color.gif"';
h += ' onmouseover="this.className=\'mceButtonOver\'"';
h += ' onmouseout="this.className=\'mceButtonNormal\'"';
h += ' onmousedown="this.className=\'mceButtonDown\'"';
h += ' width="20" height="16" border="0" title="' + tinyMCE.getLang('lang_browse') + '"';
h += ' class="mceButtonNormal" alt="' + tinyMCE.getLang('lang_browse') + '" /></a>';
return h;
}
function pickColor(e, target_form_element) {
if ((e.keyCode == 32 || e.keyCode == 13) || e.type == "mousedown")
tinyMCEPopup.pickColor(e, target_form_element);
}
function updateColor(img_id, form_element_id) {
document.getElementById(img_id).style.backgroundColor = document.forms[0].elements[form_element_id].value;
}
function setBrowserDisabled(id, state) {
var img = document.getElementById(id);
var lnk = document.getElementById(id + "_link");
if (lnk) {
if (state) {
lnk.setAttribute("realhref", lnk.getAttribute("href"));
lnk.removeAttribute("href");
tinyMCE.switchClass(img, 'mceButtonDisabled', true);
} else {
lnk.setAttribute("href", lnk.getAttribute("realhref"));
tinyMCE.switchClass(img, 'mceButtonNormal', false);
}
}
}
function getBrowserHTML(id, target_form_element, type, prefix) {
var option = prefix + "_" + type + "_browser_callback";
var cb = tinyMCE.getParam(option, tinyMCE.getParam("file_browser_callback"));
if (cb == null)
return "";
var html = "";
html += '<a id="' + id + '_link" href="javascript:openBrower(\'' + id + '\',\'' + target_form_element + '\', \'' + type + '\',\'' + option + '\');" onmousedown="return false;">';
html += '<img id="' + id + '" src="' + themeBaseURL + '/images/browse.gif"';
html += ' onmouseover="this.className=\'mceButtonOver\';"';
html += ' onmouseout="this.className=\'mceButtonNormal\';"';
html += ' onmousedown="this.className=\'mceButtonDown\';"';
html += ' width="20" height="18" border="0" title="' + tinyMCE.getLang('lang_browse') + '"';
html += ' class="mceButtonNormal" alt="' + tinyMCE.getLang('lang_browse') + '" /></a>';
return html;
}
function openBrower(img_id, target_form_element, type, option) {
var img = document.getElementById(img_id);
if (img.className != "mceButtonDisabled")
tinyMCEPopup.openBrowser(target_form_element, type, option);
}
function selectByValue(form_obj, field_name, value, add_custom, ignore_case) {
if (!form_obj || !form_obj.elements[field_name])
return;
var sel = form_obj.elements[field_name];
var found = false;
for (var i=0; i<sel.options.length; i++) {
var option = sel.options[i];
if (option.value == value || (ignore_case && option.value.toLowerCase() == value.toLowerCase())) {
option.selected = true;
found = true;
} else
option.selected = false;
}
if (!found && add_custom && value != '') {
var option = new Option(value, value);
option.selected = true;
sel.options[sel.options.length] = option;
sel.selectedIndex = sel.options.length - 1;
}
return found;
}
function getSelectValue(form_obj, field_name) {
var elm = form_obj.elements[field_name];
if (elm == null || elm.options == null)
return "";
return elm.options[elm.selectedIndex].value;
}
function addSelectValue(form_obj, field_name, name, value) {
var s = form_obj.elements[field_name];
var o = new Option(name, value);
s.options[s.options.length] = o;
}
function addClassesToList(list_id, specific_option) {
// Setup class droplist
var styleSelectElm = document.getElementById(list_id);
var styles = tinyMCE.getParam('theme_advanced_styles', false);
styles = tinyMCE.getParam(specific_option, styles);
if (styles) {
var stylesAr = styles.split(';');
for (var i=0; i<stylesAr.length; i++) {
if (stylesAr != "") {
var key, value;
key = stylesAr[i].split('=')[0];
value = stylesAr[i].split('=')[1];
styleSelectElm.options[styleSelectElm.length] = new Option(key, value);
}
}
} else {
// Use auto impored classes
var csses = tinyMCE.getCSSClasses(tinyMCE.getWindowArg('editor_id'));
for (var i=0; i<csses.length; i++)
styleSelectElm.options[styleSelectElm.length] = new Option(csses[i], csses[i]);
}
}
function isVisible(element_id) {
var elm = document.getElementById(element_id);
return elm && elm.style.display != "none";
}
function convertRGBToHex(col) {
var re = new RegExp("rgb\\s*\\(\\s*([0-9]+).*,\\s*([0-9]+).*,\\s*([0-9]+).*\\)", "gi");
var rgb = col.replace(re, "$1,$2,$3").split(',');
if (rgb.length == 3) {
r = parseInt(rgb[0]).toString(16);
g = parseInt(rgb[1]).toString(16);
b = parseInt(rgb[2]).toString(16);
r = r.length == 1 ? '0' + r : r;
g = g.length == 1 ? '0' + g : g;
b = b.length == 1 ? '0' + b : b;
return "#" + r + g + b;
}
return col;
}
function convertHexToRGB(col) {
if (col.indexOf('#') != -1) {
col = col.replace(new RegExp('[^0-9A-F]', 'gi'), '');
r = parseInt(col.substring(0, 2), 16);
g = parseInt(col.substring(2, 4), 16);
b = parseInt(col.substring(4, 6), 16);
return "rgb(" + r + "," + g + "," + b + ")";
}
return col;
}
function trimSize(size) {
return size.replace(new RegExp('[^0-9%]', 'gi'), '');
}
function getCSSSize(size) {
size = trimSize(size);
if (size == "")
return "";
return size.indexOf('%') != -1 ? size : size + "px";
}
function getStyle(elm, attrib, style) {
var val = tinyMCE.getAttrib(elm, attrib);
if (val != '')
return '' + val;
if (typeof(style) == 'undefined')
style = attrib;
val = eval('elm.style.' + style);
return val == null ? '' : '' + val;
}

@ -1,210 +1,210 @@
/**
* $Id: mclayer.js 162 2007-01-03 16:16:52Z spocke $
*
* Moxiecode floating layer script.
*
* @author Moxiecode
* @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
*/
function MCLayer(id) {
this.id = id;
this.settings = new Array();
this.blockerElement = null;
this.isMSIE = navigator.appName == "Microsoft Internet Explorer";
this.events = false;
this.autoHideCallback = null;
}
MCLayer.prototype = {
moveRelativeTo : function(re, p, a) {
var rep = this.getAbsPosition(re);
var w = parseInt(re.offsetWidth);
var h = parseInt(re.offsetHeight);
var x, y;
switch (p) {
case "tl":
break;
case "tr":
x = rep.absLeft + w;
y = rep.absTop;
break;
case "bl":
break;
case "br":
break;
}
this.moveTo(x, y);
},
moveBy : function(dx, dy) {
var e = this.getElement();
var x = parseInt(e.style.left);
var y = parseInt(e.style.top);
e.style.left = (x + dx) + "px";
e.style.top = (y + dy) + "px";
this.updateBlocker();
},
moveTo : function(x, y) {
var e = this.getElement();
e.style.left = x + "px";
e.style.top = y + "px";
this.updateBlocker();
},
show : function() {
MCLayer.visibleLayer = this;
this.getElement().style.display = 'block';
this.updateBlocker();
},
hide : function() {
this.getElement().style.display = 'none';
this.updateBlocker();
},
setAutoHide : function(s, cb) {
this.autoHideCallback = cb;
this.registerEventHandlers();
},
getElement : function() {
return document.getElementById(this.id);
},
updateBlocker : function() {
if (!this.isMSIE)
return;
var e = this.getElement();
var b = this.getBlocker();
var x = this.parseInt(e.style.left);
var y = this.parseInt(e.style.top);
var w = this.parseInt(e.offsetWidth);
var h = this.parseInt(e.offsetHeight);
b.style.left = x + 'px';
b.style.top = y + 'px';
b.style.width = w + 'px';
b.style.height = h + 'px';
b.style.display = e.style.display;
},
getBlocker : function() {
if (!this.blockerElement) {
var d = document, b = d.createElement("iframe");
b.style.cssText = 'display: none; left: 0px; position: absolute; top: 0';
b.src = 'javascript:false;';
b.frameBorder = '0';
b.scrolling = 'no';
d.body.appendChild(b);
this.blockerElement = b;
}
return this.blockerElement;
},
getAbsPosition : function(n) {
var p = {absLeft : 0, absTop : 0};
while (n) {
p.absLeft += n.offsetLeft;
p.absTop += n.offsetTop;
n = n.offsetParent;
}
return p;
},
registerEventHandlers : function() {
if (!this.events) {
var d = document;
this.addEvent(d, 'mousedown', MCLayer.prototype.onMouseDown);
this.events = true;
}
},
addEvent : function(o, n, h) {
if (o.attachEvent)
o.attachEvent("on" + n, h);
else
o.addEventListener(n, h, false);
},
onMouseDown : function(e) {
e = typeof(e) == "undefined" ? window.event : e;
var b = document.body;
var l = MCLayer.visibleLayer;
if (l) {
var mx = l.isMSIE ? e.clientX + b.scrollLeft : e.pageX;
var my = l.isMSIE ? e.clientY + b.scrollTop : e.pageY;
var el = l.getElement();
var x = parseInt(el.style.left);
var y = parseInt(el.style.top);
var w = parseInt(el.offsetWidth);
var h = parseInt(el.offsetHeight);
if (!(mx > x && mx < x + w && my > y && my < y + h)) {
MCLayer.visibleLayer = null;
if (l.autoHideCallback && l.autoHideCallback(l, e, mx, my))
return true;
l.hide();
}
}
},
addCSSClass : function(e, c) {
this.removeCSSClass(e, c);
var a = this.explode(' ', e.className);
a[a.length] = c;
e.className = a.join(' ');
},
removeCSSClass : function(e, c) {
var a = this.explode(' ', e.className), i;
for (i=0; i<a.length; i++) {
if (a[i] == c)
a[i] = '';
}
e.className = a.join(' ');
},
explode : function(d, s) {
var ar = s.split(d);
var oar = new Array();
for (var i = 0; i<ar.length; i++) {
if (ar[i] != "")
oar[oar.length] = ar[i];
}
return oar;
},
parseInt : function(s) {
if (s == null || s == '')
return 0;
return parseInt(s);
}
}
/**
* $Id: mclayer.js 162 2007-01-03 16:16:52Z spocke $
*
* Moxiecode floating layer script.
*
* @author Moxiecode
* @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
*/
function MCLayer(id) {
this.id = id;
this.settings = new Array();
this.blockerElement = null;
this.isMSIE = navigator.appName == "Microsoft Internet Explorer";
this.events = false;
this.autoHideCallback = null;
}
MCLayer.prototype = {
moveRelativeTo : function(re, p, a) {
var rep = this.getAbsPosition(re);
var w = parseInt(re.offsetWidth);
var h = parseInt(re.offsetHeight);
var x, y;
switch (p) {
case "tl":
break;
case "tr":
x = rep.absLeft + w;
y = rep.absTop;
break;
case "bl":
break;
case "br":
break;
}
this.moveTo(x, y);
},
moveBy : function(dx, dy) {
var e = this.getElement();
var x = parseInt(e.style.left);
var y = parseInt(e.style.top);
e.style.left = (x + dx) + "px";
e.style.top = (y + dy) + "px";
this.updateBlocker();
},
moveTo : function(x, y) {
var e = this.getElement();
e.style.left = x + "px";
e.style.top = y + "px";
this.updateBlocker();
},
show : function() {
MCLayer.visibleLayer = this;
this.getElement().style.display = 'block';
this.updateBlocker();
},
hide : function() {
this.getElement().style.display = 'none';
this.updateBlocker();
},
setAutoHide : function(s, cb) {
this.autoHideCallback = cb;
this.registerEventHandlers();
},
getElement : function() {
return document.getElementById(this.id);
},
updateBlocker : function() {
if (!this.isMSIE)
return;
var e = this.getElement();
var b = this.getBlocker();
var x = this.parseInt(e.style.left);
var y = this.parseInt(e.style.top);
var w = this.parseInt(e.offsetWidth);
var h = this.parseInt(e.offsetHeight);
b.style.left = x + 'px';
b.style.top = y + 'px';
b.style.width = w + 'px';
b.style.height = h + 'px';
b.style.display = e.style.display;
},
getBlocker : function() {
if (!this.blockerElement) {
var d = document, b = d.createElement("iframe");
b.style.cssText = 'display: none; left: 0px; position: absolute; top: 0';
b.src = 'javascript:false;';
b.frameBorder = '0';
b.scrolling = 'no';
d.body.appendChild(b);
this.blockerElement = b;
}
return this.blockerElement;
},
getAbsPosition : function(n) {
var p = {absLeft : 0, absTop : 0};
while (n) {
p.absLeft += n.offsetLeft;
p.absTop += n.offsetTop;
n = n.offsetParent;
}
return p;
},
registerEventHandlers : function() {
if (!this.events) {
var d = document;
this.addEvent(d, 'mousedown', MCLayer.prototype.onMouseDown);
this.events = true;
}
},
addEvent : function(o, n, h) {
if (o.attachEvent)
o.attachEvent("on" + n, h);
else
o.addEventListener(n, h, false);
},
onMouseDown : function(e) {
e = typeof(e) == "undefined" ? window.event : e;
var b = document.body;
var l = MCLayer.visibleLayer;
if (l) {
var mx = l.isMSIE ? e.clientX + b.scrollLeft : e.pageX;
var my = l.isMSIE ? e.clientY + b.scrollTop : e.pageY;
var el = l.getElement();
var x = parseInt(el.style.left);
var y = parseInt(el.style.top);
var w = parseInt(el.offsetWidth);
var h = parseInt(el.offsetHeight);
if (!(mx > x && mx < x + w && my > y && my < y + h)) {
MCLayer.visibleLayer = null;
if (l.autoHideCallback && l.autoHideCallback(l, e, mx, my))
return true;
l.hide();
}
}
},
addCSSClass : function(e, c) {
this.removeCSSClass(e, c);
var a = this.explode(' ', e.className);
a[a.length] = c;
e.className = a.join(' ');
},
removeCSSClass : function(e, c) {
var a = this.explode(' ', e.className), i;
for (i=0; i<a.length; i++) {
if (a[i] == c)
a[i] = '';
}
e.className = a.join(' ');
},
explode : function(d, s) {
var ar = s.split(d);
var oar = new Array();
for (var i = 0; i<ar.length; i++) {
if (ar[i] != "")
oar[oar.length] = ar[i];
}
return oar;
},
parseInt : function(s) {
if (s == null || s == '')
return 0;
return parseInt(s);
}
}

@ -1,74 +1,74 @@
/**
* $Id: mctabs.js 162 2007-01-03 16:16:52Z spocke $
*
* Moxiecode DHTML Tabs script.
*
* @author Moxiecode
* @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
*/
function MCTabs() {
this.settings = new Array();
};
MCTabs.prototype.init = function(settings) {
this.settings = settings;
};
MCTabs.prototype.getParam = function(name, default_value) {
var value = null;
value = (typeof(this.settings[name]) == "undefined") ? default_value : this.settings[name];
// Fix bool values
if (value == "true" || value == "false")
return (value == "true");
return value;
};
MCTabs.prototype.displayTab = function(tab_id, panel_id) {
var panelElm = document.getElementById(panel_id);
var panelContainerElm = panelElm ? panelElm.parentNode : null;
var tabElm = document.getElementById(tab_id);
var tabContainerElm = tabElm ? tabElm.parentNode : null;
var selectionClass = this.getParam('selection_class', 'current');
if (tabElm && tabContainerElm) {
var nodes = tabContainerElm.childNodes;
// Hide all other tabs
for (var i=0; i<nodes.length; i++) {
if (nodes[i].nodeName == "LI")
nodes[i].className = '';
}
// Show selected tab
tabElm.className = 'current';
}
if (panelElm && panelContainerElm) {
var nodes = panelContainerElm.childNodes;
// Hide all other panels
for (var i=0; i<nodes.length; i++) {
if (nodes[i].nodeName == "DIV")
nodes[i].className = 'panel';
}
// Show selected panel
panelElm.className = 'current';
}
};
MCTabs.prototype.getAnchor = function() {
var pos, url = document.location.href;
if ((pos = url.lastIndexOf('#')) != -1)
return url.substring(pos + 1);
return "";
};
// Global instance
var mcTabs = new MCTabs();
/**
* $Id: mctabs.js 162 2007-01-03 16:16:52Z spocke $
*
* Moxiecode DHTML Tabs script.
*
* @author Moxiecode
* @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
*/
function MCTabs() {
this.settings = new Array();
};
MCTabs.prototype.init = function(settings) {
this.settings = settings;
};
MCTabs.prototype.getParam = function(name, default_value) {
var value = null;
value = (typeof(this.settings[name]) == "undefined") ? default_value : this.settings[name];
// Fix bool values
if (value == "true" || value == "false")
return (value == "true");
return value;
};
MCTabs.prototype.displayTab = function(tab_id, panel_id) {
var panelElm = document.getElementById(panel_id);
var panelContainerElm = panelElm ? panelElm.parentNode : null;
var tabElm = document.getElementById(tab_id);
var tabContainerElm = tabElm ? tabElm.parentNode : null;
var selectionClass = this.getParam('selection_class', 'current');
if (tabElm && tabContainerElm) {
var nodes = tabContainerElm.childNodes;
// Hide all other tabs
for (var i=0; i<nodes.length; i++) {
if (nodes[i].nodeName == "LI")
nodes[i].className = '';
}
// Show selected tab
tabElm.className = 'current';
}
if (panelElm && panelContainerElm) {
var nodes = panelContainerElm.childNodes;
// Hide all other panels
for (var i=0; i<nodes.length; i++) {
if (nodes[i].nodeName == "DIV")
nodes[i].className = 'panel';
}
// Show selected panel
panelElm.className = 'current';
}
};
MCTabs.prototype.getAnchor = function() {
var pos, url = document.location.href;
if ((pos = url.lastIndexOf('#')) != -1)
return url.substring(pos + 1);
return "";
};
// Global instance
var mcTabs = new MCTabs();

@ -1,219 +1,219 @@
/**
* $Id: validate.js 162 2007-01-03 16:16:52Z spocke $
*
* Various form validation methods.
*
* @author Moxiecode
* @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
*/
/**
// String validation:
if (!Validator.isEmail('myemail'))
alert('Invalid email.');
// Form validation:
var f = document.forms['myform'];
if (!Validator.isEmail(f.myemail))
alert('Invalid email.');
*/
var Validator = {
isEmail : function(s) {
return this.test(s, '^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+@[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$');
},
isAbsUrl : function(s) {
return this.test(s, '^(news|telnet|nttp|file|http|ftp|https)://[-A-Za-z0-9\\.]+\\/?.*$');
},
isSize : function(s) {
return this.test(s, '^[0-9]+(px|%)?$');
},
isId : function(s) {
return this.test(s, '^[A-Za-z_]([A-Za-z0-9_])*$');
},
isEmpty : function(s) {
var nl, i;
if (s.nodeName == 'SELECT' && s.selectedIndex < 1)
return true;
if (s.type == 'checkbox' && !s.checked)
return true;
if (s.type == 'radio') {
for (i=0, nl = s.form.elements; i<nl.length; i++) {
if (nl[i].type == "radio" && nl[i].name == s.name && nl[i].checked)
return false;
}
return true;
}
return new RegExp('^\\s*$').test(s.nodeType == 1 ? s.value : s);
},
isNumber : function(s, d) {
return !isNaN(s.nodeType == 1 ? s.value : s) && (!d || !this.test(s, '^-?[0-9]*\\.[0-9]*$'));
},
test : function(s, p) {
s = s.nodeType == 1 ? s.value : s;
return s == '' || new RegExp(p).test(s);
}
};
var AutoValidator = {
settings : {
id_cls : 'id',
int_cls : 'int',
url_cls : 'url',
number_cls : 'number',
email_cls : 'email',
size_cls : 'size',
required_cls : 'required',
invalid_cls : 'invalid',
min_cls : 'min',
max_cls : 'max'
},
init : function(s) {
var n;
for (n in s)
this.settings[n] = s[n];
},
validate : function(f) {
var i, nl, s = this.settings, c = 0;
nl = this.tags(f, 'label');
for (i=0; i<nl.length; i++)
this.removeClass(nl[i], s.invalid_cls);
c += this.validateElms(f, 'input');
c += this.validateElms(f, 'select');
c += this.validateElms(f, 'textarea');
return c == 3;
},
invalidate : function(n) {
this.mark(n.form, n);
},
reset : function(e) {
var t = new Array('label', 'input', 'select', 'textarea');
var i, j, nl, s = this.settings;
if (e == null)
return;
for (i=0; i<t.length; i++) {
nl = this.tags(e.form ? e.form : e, t[i]);
for (j=0; j<nl.length; j++)
this.removeClass(nl[j], s.invalid_cls);
}
},
validateElms : function(f, e) {
var nl, i, n, s = this.settings, st = true, va = Validator, v;
nl = this.tags(f, e);
for (i=0; i<nl.length; i++) {
n = nl[i];
this.removeClass(n, s.invalid_cls);
if (this.hasClass(n, s.required_cls) && va.isEmpty(n))
st = this.mark(f, n);
if (this.hasClass(n, s.number_cls) && !va.isNumber(n))
st = this.mark(f, n);
if (this.hasClass(n, s.int_cls) && !va.isNumber(n, true))
st = this.mark(f, n);
if (this.hasClass(n, s.url_cls) && !va.isAbsUrl(n))
st = this.mark(f, n);
if (this.hasClass(n, s.email_cls) && !va.isEmail(n))
st = this.mark(f, n);
if (this.hasClass(n, s.size_cls) && !va.isSize(n))
st = this.mark(f, n);
if (this.hasClass(n, s.id_cls) && !va.isId(n))
st = this.mark(f, n);
if (this.hasClass(n, s.min_cls, true)) {
v = this.getNum(n, s.min_cls);
if (isNaN(v) || parseInt(n.value) < parseInt(v))
st = this.mark(f, n);
}
if (this.hasClass(n, s.max_cls, true)) {
v = this.getNum(n, s.max_cls);
if (isNaN(v) || parseInt(n.value) > parseInt(v))
st = this.mark(f, n);
}
}
return st;
},
hasClass : function(n, c, d) {
return new RegExp('\\b' + c + (d ? '[0-9]+' : '') + '\\b', 'g').test(n.className);
},
getNum : function(n, c) {
c = n.className.match(new RegExp('\\b' + c + '([0-9]+)\\b', 'g'))[0];
c = c.replace(/[^0-9]/g, '');
return c;
},
addClass : function(n, c, b) {
var o = this.removeClass(n, c);
n.className = b ? c + (o != '' ? (' ' + o) : '') : (o != '' ? (o + ' ') : '') + c;
},
removeClass : function(n, c) {
c = n.className.replace(new RegExp("(^|\\s+)" + c + "(\\s+|$)"), ' ');
return n.className = c != ' ' ? c : '';
},
tags : function(f, s) {
return f.getElementsByTagName(s);
},
mark : function(f, n) {
var s = this.settings;
this.addClass(n, s.invalid_cls);
this.markLabels(f, n, s.invalid_cls);
return false;
},
markLabels : function(f, n, ic) {
var nl, i;
nl = this.tags(f, "label");
for (i=0; i<nl.length; i++) {
if (nl[i].getAttribute("for") == n.id || nl[i].htmlFor == n.id)
this.addClass(nl[i], ic);
}
return null;
}
};
/**
* $Id: validate.js 162 2007-01-03 16:16:52Z spocke $
*
* Various form validation methods.
*
* @author Moxiecode
* @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
*/
/**
// String validation:
if (!Validator.isEmail('myemail'))
alert('Invalid email.');
// Form validation:
var f = document.forms['myform'];
if (!Validator.isEmail(f.myemail))
alert('Invalid email.');
*/
var Validator = {
isEmail : function(s) {
return this.test(s, '^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+@[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$');
},
isAbsUrl : function(s) {
return this.test(s, '^(news|telnet|nttp|file|http|ftp|https)://[-A-Za-z0-9\\.]+\\/?.*$');
},
isSize : function(s) {
return this.test(s, '^[0-9]+(px|%)?$');
},
isId : function(s) {
return this.test(s, '^[A-Za-z_]([A-Za-z0-9_])*$');
},
isEmpty : function(s) {
var nl, i;
if (s.nodeName == 'SELECT' && s.selectedIndex < 1)
return true;
if (s.type == 'checkbox' && !s.checked)
return true;
if (s.type == 'radio') {
for (i=0, nl = s.form.elements; i<nl.length; i++) {
if (nl[i].type == "radio" && nl[i].name == s.name && nl[i].checked)
return false;
}
return true;
}
return new RegExp('^\\s*$').test(s.nodeType == 1 ? s.value : s);
},
isNumber : function(s, d) {
return !isNaN(s.nodeType == 1 ? s.value : s) && (!d || !this.test(s, '^-?[0-9]*\\.[0-9]*$'));
},
test : function(s, p) {
s = s.nodeType == 1 ? s.value : s;
return s == '' || new RegExp(p).test(s);
}
};
var AutoValidator = {
settings : {
id_cls : 'id',
int_cls : 'int',
url_cls : 'url',
number_cls : 'number',
email_cls : 'email',
size_cls : 'size',
required_cls : 'required',
invalid_cls : 'invalid',
min_cls : 'min',
max_cls : 'max'
},
init : function(s) {
var n;
for (n in s)
this.settings[n] = s[n];
},
validate : function(f) {
var i, nl, s = this.settings, c = 0;
nl = this.tags(f, 'label');
for (i=0; i<nl.length; i++)
this.removeClass(nl[i], s.invalid_cls);
c += this.validateElms(f, 'input');
c += this.validateElms(f, 'select');
c += this.validateElms(f, 'textarea');
return c == 3;
},
invalidate : function(n) {
this.mark(n.form, n);
},
reset : function(e) {
var t = new Array('label', 'input', 'select', 'textarea');
var i, j, nl, s = this.settings;
if (e == null)
return;
for (i=0; i<t.length; i++) {
nl = this.tags(e.form ? e.form : e, t[i]);
for (j=0; j<nl.length; j++)
this.removeClass(nl[j], s.invalid_cls);
}
},
validateElms : function(f, e) {
var nl, i, n, s = this.settings, st = true, va = Validator, v;
nl = this.tags(f, e);
for (i=0; i<nl.length; i++) {
n = nl[i];
this.removeClass(n, s.invalid_cls);
if (this.hasClass(n, s.required_cls) && va.isEmpty(n))
st = this.mark(f, n);
if (this.hasClass(n, s.number_cls) && !va.isNumber(n))
st = this.mark(f, n);
if (this.hasClass(n, s.int_cls) && !va.isNumber(n, true))
st = this.mark(f, n);
if (this.hasClass(n, s.url_cls) && !va.isAbsUrl(n))
st = this.mark(f, n);
if (this.hasClass(n, s.email_cls) && !va.isEmail(n))
st = this.mark(f, n);
if (this.hasClass(n, s.size_cls) && !va.isSize(n))
st = this.mark(f, n);
if (this.hasClass(n, s.id_cls) && !va.isId(n))
st = this.mark(f, n);
if (this.hasClass(n, s.min_cls, true)) {
v = this.getNum(n, s.min_cls);
if (isNaN(v) || parseInt(n.value) < parseInt(v))
st = this.mark(f, n);
}
if (this.hasClass(n, s.max_cls, true)) {
v = this.getNum(n, s.max_cls);
if (isNaN(v) || parseInt(n.value) > parseInt(v))
st = this.mark(f, n);
}
}
return st;
},
hasClass : function(n, c, d) {
return new RegExp('\\b' + c + (d ? '[0-9]+' : '') + '\\b', 'g').test(n.className);
},
getNum : function(n, c) {
c = n.className.match(new RegExp('\\b' + c + '([0-9]+)\\b', 'g'))[0];
c = c.replace(/[^0-9]/g, '');
return c;
},
addClass : function(n, c, b) {
var o = this.removeClass(n, c);
n.className = b ? c + (o != '' ? (' ' + o) : '') : (o != '' ? (o + ' ') : '') + c;
},
removeClass : function(n, c) {
c = n.className.replace(new RegExp("(^|\\s+)" + c + "(\\s+|$)"), ' ');
return n.className = c != ' ' ? c : '';
},
tags : function(f, s) {
return f.getElementsByTagName(s);
},
mark : function(f, n) {
var s = this.settings;
this.addClass(n, s.invalid_cls);
this.markLabels(f, n, s.invalid_cls);
return false;
},
markLabels : function(f, n, ic) {
var nl, i;
nl = this.tags(f, "label");
for (i=0; i<nl.length; i++) {
if (nl[i].getAttribute("for") == n.id || nl[i].htmlFor == n.id)
this.addClass(nl[i], ic);
}
return null;
}
};

@ -30,18 +30,30 @@ define('RCUBE_COMPOSE_DRAFT', 0x0108);
// remove an attachment
if ($_action=='remove-attachment' && preg_match('/^rcmfile([0-9]+)$/', $_POST['_file'], $regs))
{
{
$id = $regs[1];
if (is_array($_SESSION['compose']['attachments'][$id]))
{
{
@unlink($_SESSION['compose']['attachments'][$id]['path']);
$_SESSION['compose']['attachments'][$id] = NULL;
$OUTPUT->command('remove_from_attachment_list', "rcmfile$id");
$OUTPUT->send();
exit;
}
}
}
if ($_action=='display-attachment' && preg_match('/^rcmfile([0-9]+)$/', $_GET['_file'], $regs))
{
$id = $regs[1];
if (is_array($_SESSION['compose']['attachments'][$id]))
{
$apath = $_SESSION['compose']['attachments'][$id]['path'];
header('Content-Type: ' . $_SESSION['compose']['attachments'][$id]['mimetype']);
header('Content-Length: ' . filesize($apath));
readfile($apath);
}
exit;
}
$MESSAGE_FORM = NULL;
$MESSAGE = NULL;
@ -52,10 +64,10 @@ $MESSAGE = NULL;
// compose when a "new/forward/reply/draft" is called - otherwise the old session attachments will appear
if (!is_array($_SESSION['compose']) || $_SESSION['compose']['id'] != get_input_value('_id', RCUBE_INPUT_GET))
{
{
rcmail_compose_cleanup();
$_SESSION['compose'] = array('id' => uniqid(rand()));
}
}
// add some labels to client
rcube_add_label('nosubject', 'norecipientwarning', 'nosubjectwarning', 'nobodywarning', 'notsentwarning', 'savingmessage', 'sendingmessage', 'messagesaved', 'converting');
@ -74,7 +86,7 @@ else if ($msg_uid = get_input_value('_draft_uid', RCUBE_INPUT_GET))
if (!empty($msg_uid))
{
{
// similar as in program/steps/mail/show.inc
$MESSAGE = array('UID' => $msg_uid);
$MESSAGE['headers'] = &$IMAP->get_headers($msg_uid);
@ -83,30 +95,29 @@ if (!empty($msg_uid))
$MESSAGE['parts'] = $IMAP->get_mime_numbers($MESSAGE['structure']);
if ($compose_mode == RCUBE_COMPOSE_REPLY)
{
{
$_SESSION['compose']['reply_uid'] = $msg_uid;
$_SESSION['compose']['reply_msgid'] = $MESSAGE['headers']->messageID;
$_SESSION['compose']['references'] = trim($MESSAGE['headers']->references . " " . $MESSAGE['headers']->messageID);
if (!empty($_GET['_all']))
$MESSAGE['reply_all'] = 1;
}
}
else if ($compose_mode == RCUBE_COMPOSE_FORWARD)
{
{
$_SESSION['compose']['forward_uid'] = $msg_uid;
}
}
else if ($compose_mode == RCUBE_COMPOSE_DRAFT)
{
{
$_SESSION['compose']['draft_uid'] = $msg_uid;
}
}
}
/****** compose mode functions ********/
function rcmail_compose_headers($attrib)
{
{
global $IMAP, $MESSAGE, $DB, $compose_mode;
static $sa_recipients = array();
@ -116,7 +127,7 @@ function rcmail_compose_headers($attrib)
$part = strtolower($attrib['part']);
switch ($part)
{
{
case 'from':
return rcmail_compose_header_from($attrib);
@ -132,16 +143,16 @@ function rcmail_compose_headers($attrib)
case 'cc':
if (!$fname)
{
{
$fname = '_cc';
$header = 'cc';
}
}
case 'bcc':
if (!$fname)
{
{
$fname = '_bcc';
$header = 'bcc';
}
}
$allow_attrib = array('id', 'class', 'style', 'cols', 'rows', 'tabindex');
$field_type = 'textarea';
@ -152,15 +163,14 @@ function rcmail_compose_headers($attrib)
$fname = '_replyto';
$allow_attrib = array('id', 'class', 'style', 'size', 'tabindex');
$field_type = 'textfield';
break;
}
break;
}
if ($fname && !empty($_POST[$fname]))
$fvalue = get_input_value($fname, RCUBE_INPUT_POST, TRUE);
else if ($header && $compose_mode == RCUBE_COMPOSE_REPLY)
{
{
// get recipent address(es) out of the message headers
if ($header=='to' && !empty($MESSAGE['headers']->replyto))
$fvalue = $MESSAGE['headers']->replyto;
@ -170,31 +180,31 @@ function rcmail_compose_headers($attrib)
// add recipent of original message if reply to all
else if ($header=='cc' && !empty($MESSAGE['reply_all']))
{
{
if ($v = $MESSAGE['headers']->to)
$fvalue .= $v;
if ($v = $MESSAGE['headers']->cc)
$fvalue .= (!empty($fvalue) ? ', ' : '') . $v;
}
}
// split recipients and put them back together in a unique way
if (!empty($fvalue))
{
{
$to_addresses = $IMAP->decode_address_list($fvalue);
$fvalue = '';
foreach ($to_addresses as $addr_part)
{
{
if (!empty($addr_part['mailto']) && !in_array($addr_part['mailto'], $sa_recipients) && (!$MESSAGE['FROM'] || !in_array($addr_part['mailto'], $MESSAGE['FROM'])))
{
{
$fvalue .= (strlen($fvalue) ? ', ':'').$addr_part['string'];
$sa_recipients[] = $addr_part['mailto'];
}
}
}
}
}
else if ($header && $compose_mode == RCUBE_COMPOSE_DRAFT)
{
{
// get drafted headers
if ($header=='to' && !empty($MESSAGE['headers']->to))
$fvalue = $IMAP->decode_header($MESSAGE['headers']->to);
@ -204,11 +214,11 @@ function rcmail_compose_headers($attrib)
if ($header=='bcc' && !empty($MESSAGE['headers']->bcc))
$fvalue = $IMAP->decode_header($MESSAGE['headers']->bcc);
}
}
if ($fname && $field_type)
{
{
// pass the following attributes to the form class
$field_attrib = array('name' => $fname);
foreach ($attrib as $attr => $value)
@ -218,18 +228,18 @@ function rcmail_compose_headers($attrib)
// create teaxtarea object
$input = new $field_type($field_attrib);
$out = $input->show($fvalue);
}
}
if ($form_start)
$out = $form_start.$out;
return $out;
}
}
function rcmail_compose_header_from($attrib)
{
{
global $IMAP, $MESSAGE, $DB, $USER, $OUTPUT, $compose_mode;
// pass the following attributes to the form class
@ -241,32 +251,32 @@ function rcmail_compose_header_from($attrib)
// extract all recipients of the reply-message
$a_recipients = array();
if ($compose_mode == RCUBE_COMPOSE_REPLY && is_object($MESSAGE['headers']))
{
{
$MESSAGE['FROM'] = array();
$a_to = $IMAP->decode_address_list($MESSAGE['headers']->to);
foreach ($a_to as $addr)
{
{
if (!empty($addr['mailto']))
$a_recipients[] = $addr['mailto'];
}
}
if (!empty($MESSAGE['headers']->cc))
{
{
$a_cc = $IMAP->decode_address_list($MESSAGE['headers']->cc);
foreach ($a_cc as $addr)
{
{
if (!empty($addr['mailto']))
$a_recipients[] = $addr['mailto'];
}
}
}
}
// get this user's identities
$sql_result = $USER->list_identities();
if ($DB->num_rows($sql_result))
{
{
$from_id = 0;
$a_signatures = array();
@ -274,22 +284,22 @@ function rcmail_compose_header_from($attrib)
$select_from = new select($field_attrib);
while ($sql_arr = $DB->fetch_assoc($sql_result))
{
{
$identity_id = $sql_arr['identity_id'];
$select_from->add(format_email_recipient($sql_arr['email'], $sql_arr['name']), $identity_id);
// add signature to array
if (!empty($sql_arr['signature']))
{
{
$a_signatures[$identity_id]['text'] = $sql_arr['signature'];
$a_signatures[$identity_id]['is_html'] = ($sql_arr['html_signature'] == 1) ? true : false;
if ($a_signatures[$identity_id]['is_html'])
{
{
$h2t = new html2text($a_signatures[$identity_id]['text'], false, false);
$plainTextPart = $h2t->get_text();
$a_signatures[$identity_id]['plain_text'] = trim($plainTextPart);
}
}
}
// set identity if it's one of the reply-message recipients
if (in_array($sql_arr['email'], $a_recipients))
@ -300,7 +310,7 @@ function rcmail_compose_header_from($attrib)
if ($compose_mode == RCUBE_COMPOSE_DRAFT && strstr($MESSAGE['headers']->from, $sql_arr['email']))
$from_id = $sql_arr['identity_id'];
}
}
// overwrite identity selection with post parameter
if (isset($_POST['_from']))
@ -310,23 +320,22 @@ function rcmail_compose_header_from($attrib)
// add signatures to client
$OUTPUT->set_env('signatures', $a_signatures);
}
}
else
{
{
$input_from = new textfield($field_attrib);
$out = $input_from->show($_POST['_from']);
}
}
if ($form_start)
$out = $form_start.$out;
return $out;
}
}
function rcmail_compose_body($attrib)
{
{
global $CONFIG, $OUTPUT, $MESSAGE, $compose_mode;
list($form_start, $form_end) = get_form_tags($attrib);
@ -457,11 +466,11 @@ function rcmail_compose_body($attrib)
$out .= "\n".'<iframe name="savetarget" src="program/blank.gif" style="width:0;height:0;visibility:hidden;"></iframe>';
return $out;
}
}
function rcmail_create_reply_body($body, $bodyIsHtml)
{
{
global $IMAP, $MESSAGE;
if (! $bodyIsHtml)
@ -474,12 +483,12 @@ function rcmail_create_reply_body($body, $bodyIsHtml)
// add > to each line
for($n=0; $n<sizeof($a_lines); $n++)
{
{
if (strpos($a_lines[$n], '>')===0)
$a_lines[$n] = '>'.$a_lines[$n];
else
$a_lines[$n] = '> '.$a_lines[$n];
}
}
$body = join("\n", $a_lines);
@ -498,21 +507,21 @@ function rcmail_create_reply_body($body, $bodyIsHtml)
}
else
{
$prefix = sprintf("<br><br>On %s, %s wrote:<br><blockquote type=\"cite\" " .
"style=\"padding-left: 5px; border-left: #1010ff 2px solid; " .
"margin-left: 5px; width: 100%%\">",
$MESSAGE['headers']->date,
$IMAP->decode_header($MESSAGE['headers']->from));
$prefix = sprintf("<br><br>On %s, %s wrote:<br><blockquote type=\"cite\" " .
"style=\"padding-left: 5px; border-left: #1010ff 2px solid; " .
"margin-left: 5px; width: 100%%\">",
$MESSAGE['headers']->date,
$IMAP->decode_header($MESSAGE['headers']->from));
$suffix = "</blockquote>";
$suffix = "</blockquote>";
}
return $prefix.$body.$suffix;
}
}
function rcmail_create_forward_body($body, $bodyIsHtml)
{
{
global $IMAP, $MESSAGE;
if (! $bodyIsHtml)
@ -528,7 +537,7 @@ function rcmail_create_forward_body($body, $bodyIsHtml)
}
else
{
$prefix = sprintf(
$prefix = sprintf(
"<br><br>-------- Original Message --------" .
"<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tbody>" .
"<tr><th align=\"right\" nowrap=\"nowrap\" valign=\"baseline\">Subject: </th><td>%s</td></tr>" .
@ -547,11 +556,11 @@ function rcmail_create_forward_body($body, $bodyIsHtml)
rcmail_write_compose_attachments($MESSAGE);
return $prefix.$body;
}
}
function rcmail_create_draft_body($body, $bodyIsHtml)
{
{
global $IMAP, $MESSAGE;
// add attachments
@ -560,11 +569,11 @@ function rcmail_create_draft_body($body, $bodyIsHtml)
rcmail_write_compose_attachments($MESSAGE);
return $body;
}
}
function rcmail_write_compose_attachments(&$message)
{
{
global $IMAP, $CONFIG;
$temp_dir = unslashify($CONFIG['temp_dir']);
@ -573,14 +582,14 @@ function rcmail_write_compose_attachments(&$message)
$_SESSION['compose']['attachments'] = array();
foreach ($message['parts'] as $pid => $part)
{
{
if ($part->ctype_primary != 'message' && $part->ctype_primary != 'text' &&
($part->disposition=='attachment' || $part->disposition=='inline' || $part->headers['content-id'] ||
(empty($part->disposition) && $part->filename)))
{
{
$tmp_path = tempnam($temp_dir, 'rcmAttmnt');
if ($fp = fopen($tmp_path, 'w'))
{
{
fwrite($fp, $IMAP->get_message_part($message['UID'], $pid, $part->encoding));
fclose($fp);
@ -589,16 +598,16 @@ function rcmail_write_compose_attachments(&$message)
'name' => $part->filename,
'path' => $tmp_path
);
}
}
}
}
$_SESSION['compose']['forward_attachments'] = TRUE;
}
}
function rcmail_compose_subject($attrib)
{
{
global $CONFIG, $MESSAGE, $compose_mode;
list($form_start, $form_end) = get_form_tags($attrib);
@ -615,21 +624,21 @@ function rcmail_compose_subject($attrib)
// create a reply-subject
else if ($compose_mode == RCUBE_COMPOSE_REPLY)
{
{
if (eregi('^re:', $MESSAGE['subject']))
$subject = $MESSAGE['subject'];
else
$subject = 'Re: '.$MESSAGE['subject'];
}
}
// create a forward-subject
else if ($compose_mode == RCUBE_COMPOSE_FORWARD)
{
{
if (eregi('^fwd:', $MESSAGE['subject']))
$subject = $MESSAGE['subject'];
else
$subject = 'Fwd: '.$MESSAGE['subject'];
}
}
// creeate a draft-subject
else if ($compose_mode == RCUBE_COMPOSE_DRAFT)
@ -640,11 +649,11 @@ function rcmail_compose_subject($attrib)
$out .= $form_end ? "\n$form_end" : '';
return $out;
}
}
function rcmail_compose_attachment_list($attrib)
{
{
global $OUTPUT, $CONFIG;
// add ID if not given
@ -657,7 +666,7 @@ function rcmail_compose_attachment_list($attrib)
$out = '<ul'. $attrib_str . ">\n";
if (is_array($_SESSION['compose']['attachments']))
{
{
if ($attrib['deleteicon'])
$button = sprintf('<img src="%s%s" alt="%s" border="0" style="padding-right:2px;vertical-align:middle" />',
$CONFIG['skin_path'],
@ -674,18 +683,17 @@ function rcmail_compose_attachment_list($attrib)
Q(rcube_label('delete')),
$button,
Q($a_prop['name']));
}
}
$OUTPUT->add_gui_object('attachmentlist', $attrib['id']);
$out .= '</ul>';
return $out;
}
}
function rcmail_compose_attachment_form($attrib)
{
{
global $OUTPUT, $SESS_HIDDEN_FIELD;
// add ID if not given
@ -713,21 +721,21 @@ EOF;
$OUTPUT->add_gui_object('uploadbox', $attrib['id']);
return $out;
}
}
function rcmail_compose_attachment_field($attrib)
{
{
// allow the following attributes to be added to the <input> tag
$attrib_str = create_attrib_string($attrib, array('id', 'class', 'style', 'size'));
$out = '<input type="file" name="_attachments[]"'. $attrib_str . " />";
return $out;
}
}
function rcmail_priority_selector($attrib)
{
{
list($form_start, $form_end) = get_form_tags($attrib);
unset($attrib['form']);
@ -748,11 +756,11 @@ function rcmail_priority_selector($attrib)
$out .= $form_end ? "\n$form_end" : '';
return $out;
}
}
function rcmail_receipt_checkbox($attrib)
{
{
list($form_start, $form_end) = get_form_tags($attrib);
unset($attrib['form']);
@ -768,7 +776,7 @@ function rcmail_receipt_checkbox($attrib)
$out .= $form_end ? "\n$form_end" : '';
return $out;
}
}
function rcmail_editor_selector($attrib)
@ -789,17 +797,17 @@ function rcmail_editor_selector($attrib)
if ($compose_mode == RCUBE_COMPOSE_REPLY ||
$compose_mode == RCUBE_COMPOSE_FORWARD ||
$compose_mode == RCUBE_COMPOSE_DRAFT)
{
{
$hasHtml = rcmail_has_html_part($MESSAGE['parts']);
$useHtml = ($hasHtml && $CONFIG['htmleditor']);
}
}
$selector = '';
$attrib['name'] = '_editorSelect';
$attrib['onchange'] = 'return rcmail_toggle_editor(this)';
foreach ($choices as $value => $text)
{
{
$checked = '';
if ((($value == 'html') && $useHtml) ||
(($value != 'html') && !$useHtml))
@ -813,26 +821,26 @@ function rcmail_editor_selector($attrib)
$rb->show($value),
$attrib['id'],
rcube_label($text));
}
}
return $selector;
}
function get_form_tags($attrib)
{
{
global $CONFIG, $OUTPUT, $MESSAGE_FORM, $SESS_HIDDEN_FIELD;
$form_start = '';
if (!strlen($MESSAGE_FORM))
{
{
$hiddenfields = new hiddenfield(array('name' => '_task', 'value' => $GLOBALS['_task']));
$hiddenfields->add(array('name' => '_action', 'value' => 'send'));
$form_start = empty($attrib['form']) ? '<form name="form" action="./" method="post">' : '';
$form_start .= "\n$SESS_HIDDEN_FIELD\n";
$form_start .= $hiddenfields->show();
}
}
$form_end = (strlen($MESSAGE_FORM) && !strlen($attrib['form'])) ? '</form>' : '';
$form_name = !empty($attrib['form']) ? $attrib['form'] : 'form';
@ -843,7 +851,7 @@ function get_form_tags($attrib)
$MESSAGE_FORM = $form_name;
return array($form_start, $form_end);
}
}
// register UI objects
@ -859,7 +867,6 @@ $OUTPUT->add_handlers(array(
'receiptcheckbox' => 'rcmail_receipt_checkbox',
));
/****** get contacts for this user and add them to client scripts ********/
require_once('include/rcube_contacts.inc');
@ -868,15 +875,14 @@ $CONTACTS = new rcube_contacts($DB, $USER->ID);
$CONTACTS->set_pagesize(1000);
if ($result = $CONTACTS->list_records())
{
{
$a_contacts = array();
while ($sql_arr = $result->iterate())
if ($sql_arr['email'])
$a_contacts[] = format_email_recipient($sql_arr['email'], JQ($sql_arr['name']));
$OUTPUT->set_env('contacts', $a_contacts);
}
}
parse_template('compose');
?>

@ -248,8 +248,21 @@ else
// add stored attachments, if any
if (is_array($_SESSION['compose']['attachments']))
foreach ($_SESSION['compose']['attachments'] as $attachment)
$MAIL_MIME->addAttachment($attachment['path'], $attachment['mimetype'], $attachment['name'], true, 'base64', 'attachment', $message_charset);
foreach ($_SESSION['compose']['attachments'] as $id => $attachment)
{
$dispurl = '/\ssrc\s*=\s*[\'"]?\S+display-attachment\S+file=rcmfile' . $id . '[\'"]?/';
$match = preg_match($dispurl, $message_body);
if ($isHtml && ($match > 0))
{
$message_body = preg_replace($dispurl, ' src="'.$attachment['name'].'"', $message_body);
$MAIL_MIME->setHTMLBody($message_body);
$MAIL_MIME->addHTMLImage($attachment['path'], $attachment['mimetype'], $attachment['name']);
}
else
{
$MAIL_MIME->addAttachment($attachment['path'], $attachment['mimetype'], $attachment['name'], true, 'base64', 'attachment', $message_charset);
}
}
// add submitted attachments
if (is_array($_FILES['_attachments']['tmp_name']))
@ -382,5 +395,4 @@ else
$OUTPUT->send('iframe');
}
?>

@ -43,7 +43,6 @@ function rcube_identity_form($attrib)
$OUTPUT->add_script("tinyMCE.init({ mode : 'specific_textareas'," .
"apply_source_formatting : true," .
"content_css : '\$__skin_path' + '/editor_content.css'," .
"popups_css : '\$__skin_path' + '/editor_popups.css'," .
"editor_css : '\$__skin_path' + '/editor_ui.css'," .
"theme : 'advanced'," .
"theme_advanced_toolbar_location : 'top'," .

Loading…
Cancel
Save