init import from old mailr project (http://svn.littlegreen.org/mailr/trunk)

This commit is contained in:
Eugene Korbut 2009-01-08 05:27:12 +10:00
commit 51b79e7298
640 changed files with 34651 additions and 0 deletions

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,225 @@
/* Import plugin specific language pack */
tinyMCE.importPluginLanguagePack('flash', 'en,de,sv,zh_cn,cs,fa,fr_ca,fr,pl,pt_br');
function TinyMCE_flash_initInstance(inst) {
if (!tinyMCE.settings['flash_skip_plugin_css'])
tinyMCE.importCSS(inst.getDoc(), tinyMCE.baseURL + "/plugins/flash/flash.css");
}
function TinyMCE_flash_getControlHTML(control_name) {
switch (control_name) {
case "flash":
return '<img id="{$editor_id}_flash" src="{$pluginurl}/images/flash.gif" title="{$lang_insert_flash}" width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceFlash\');" />';
}
return "";
}
function TinyMCE_flash_parseAttributes(attribute_string) {
var attributeName = "";
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;
else if ((chr == '"' || chr == "'") && withInValue) {
withInValue = false;
var pos = attributeName.lastIndexOf(' ');
if (pos != -1)
attributeName = attributeName.substring(pos+1);
attributes[attributeName.toLowerCase()] = attributeValue.substring(1).toLowerCase();
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;
}
function TinyMCE_flash_execCommand(editor_id, element, command, user_interface, value) {
function getAttrib(elm, name) {
return elm.getAttribute(name) ? elm.getAttribute(name) : "";
}
// Handle commands
switch (command) {
case "mceFlash":
var name = "", swffile = "", swfwidth = "", swfheight = "", action = "insert";
var template = new Array();
var inst = tinyMCE.getInstanceById(editor_id);
var focusElm = inst.getFocusElement();
template['file'] = '../../plugins/flash/flash.htm'; // Relative to theme
template['width'] = 400;
template['height'] = 195;
// Is selection a image
if (focusElm != null && focusElm.nodeName.toLowerCase() == "img") {
name = getAttrib(focusElm, 'name');
if (name != 'mce_plugin_flash') // Not a Flash
return true;
// Get rest of Flash items
swffile = getAttrib(focusElm, 'alt');
swffile = eval(tinyMCE.settings['urlconverter_callback'] + "(swffile, null, true);");
swfwidth = getAttrib(focusElm, 'width');
swfheight = getAttrib(focusElm, 'height');
action = "update";
}
tinyMCE.openWindow(template, {editor_id : editor_id, swffile : swffile, swfwidth : swfwidth, swfheight : swfheight, action : action});
return true;
}
// Pass to next handler in chain
return false;
}
function TinyMCE_flash_cleanup(type, content) {
switch (type) {
case "insert_to_editor_dom":
var imgs = content.getElementsByTagName("img");
for (var i=0; i<imgs.length; i++) {
if (tinyMCE.getAttrib(imgs[i], "name") == "mce_plugin_flash") {
var src = tinyMCE.getAttrib(imgs[i], "alt");
src = tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'], src);
imgs[i].setAttribute('alt', src);
}
}
break;
case "get_from_editor_dom":
var imgs = content.getElementsByTagName("img");
for (var i=0; i<imgs.length; i++) {
if (tinyMCE.getAttrib(imgs[i], "name") == "mce_plugin_flash") {
var src = tinyMCE.getAttrib(imgs[i], "alt");
src = eval(tinyMCE.settings['urlconverter_callback'] + "(src, null, true);");
imgs[i].setAttribute('alt', src);
}
}
break;
case "insert_to_editor":
var startPos = 0;
var embedList = new Array();
// Fix the embed and object elements
content = content.replace(new RegExp('<[ ]*embed','gi'),'<embed');
content = content.replace(new RegExp('<[ ]*/embed[ ]*>','gi'),'</embed>');
content = content.replace(new RegExp('<[ ]*object','gi'),'<object');
content = content.replace(new RegExp('<[ ]*/object[ ]*>','gi'),'</object>');
// Parse all embed tags
while ((startPos = content.indexOf('<embed', startPos+1)) != -1) {
var endPos = content.indexOf('>', startPos);
var attribs = TinyMCE_flash_parseAttributes(content.substring(startPos + 6, endPos));
embedList[embedList.length] = attribs;
}
// Parse all object tags and replace them with images from the embed data
var index = 0;
while ((startPos = content.indexOf('<object', startPos)) != -1) {
if (index >= embedList.length)
break;
var attribs = embedList[index];
// Find end of object
endPos = content.indexOf('</object>', startPos);
endPos += 9;
// Insert image
var contentAfter = content.substring(endPos);
content = content.substring(0, startPos);
content += '<img name="mce_plugin_flash" width="' + attribs["width"] + '" height="' + attribs["height"] + '"';
content += ' src="' + (tinyMCE.getParam("theme_href") + '/images/spacer.gif') + '" title="' + attribs["src"] + '"';
content += ' alt="' + attribs["src"] + '" class="mce_plugin_flash" />' + content.substring(endPos);
content += contentAfter;
index++;
startPos++;
}
break;
case "get_from_editor":
// Parse all img tags and replace them with object+embed
var startPos = -1;
while ((startPos = content.indexOf('<img', startPos+1)) != -1) {
var endPos = content.indexOf('/>', startPos);
var attribs = TinyMCE_flash_parseAttributes(content.substring(startPos + 4, endPos));
// Is not flash, skip it
if (attribs['name'] != "mce_plugin_flash")
continue;
endPos += 2;
var embedHTML = '';
// Insert object + embed
embedHTML += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"';
embedHTML += ' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0"';
embedHTML += ' width="' + attribs["width"] + '" height="' + attribs["height"] + '">';
embedHTML += '<param name="movie" value="' + attribs["title"] + '" />';
embedHTML += '<param name="quality" value="high" />';
embedHTML += '<param name="menu" value="false" />';
embedHTML += '<embed src="' + attribs["title"] + '" quality="high" menu="false" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="' + attribs["width"] + '" height="' + attribs["height"] + '"></embed></object>';
// Insert embed/object chunk
chunkBefore = content.substring(0, startPos);
chunkAfter = content.substring(endPos);
content = chunkBefore + embedHTML + chunkAfter;
}
break;
}
// Pass through to next handler in chain
return content;
}
function TinyMCE_flash_handleNodeChange(editor_id, node, undo_index, undo_levels, visual_aid, any_selection) {
function getAttrib(elm, name) {
return elm.getAttribute(name) ? elm.getAttribute(name) : "";
}
tinyMCE.switchClassSticky(editor_id + '_flash', 'mceButtonNormal');
if (node == null)
return;
do {
if (node.nodeName.toLowerCase() == "img" && getAttrib(node, 'name').indexOf('mce_plugin_flash') == 0)
tinyMCE.switchClassSticky(editor_id + '_flash', 'mceButtonSelected');
} while ((node = node.parentNode));
return true;
}

View file

@ -0,0 +1,7 @@
.mce_plugin_flash {
border: 1px dotted #cc0000;
background-image: url(images/flash.gif);
background-position: center;
background-repeat: no-repeat;
background-color: #ffffcc;
}

182
public/tiny_mce/plugins/flash/flash.htm vendored Normal file
View file

@ -0,0 +1,182 @@
<html>
<head>
<title>{$lang_insert_flash}</title>
<script language="javascript" type="text/javascript" src="../../tiny_mce_popup.js"></script>
<script language="javascript">
var url = tinyMCE.getParam("flash_external_list_url");
if (url != null) {
// Fix relative
if (url.charAt(0) != '/')
url = tinyMCE.documentBasePath + "/" + url;
document.write('<sc'+'ript language="javascript" type="text/javascript" src="' + url + '"></sc'+'ript>');
}
</script>
<script language="javascript" type="text/javascript">
<!--
function init() {
// modified 2004-11-10 by Michael Keck (me@michaelkeck.de)
// supporting onclick event to open pop windows
var formObj = document.forms[0];
var swffile = tinyMCE.getWindowArg('swffile');
var swfwidth = '' + tinyMCE.getWindowArg('swfwidth');
var swfheight = '' + tinyMCE.getWindowArg('swfheight');
if (swfwidth.indexOf('%')!=-1) {
formObj.width2.value = "%";
formObj.width.value = swfwidth.substring(0,swfwidth.length-1);
} else {
formObj.width2.value = "px";
formObj.width.value = swfwidth;
}
if (swfheight.indexOf('%')!=-1) {
formObj.height2.value = "%";
formObj.height.value = swfheight.substring(0,swfheight.length-1);
} else {
formObj.height2.value = "px";
formObj.height.value = swfheight;
}
formObj.file.value = swffile;
formObj.insert.value = tinyMCE.getLang('lang_' + tinyMCE.getWindowArg('action'), 'Insert', true);
// Handle file browser
if (tinyMCE.getParam("file_browser_callback") != null) {
document.getElementById('file').style.width = '230px';
var html = '';
html += '<img id="browserBtn" src="../../themes/advanced/images/browse.gif"';
html += ' onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');"';
html += ' onmouseout="tinyMCE.restoreClass(this);"';
html += ' onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');"';
html += ' onclick="javascript:tinyMCE.openFileBrowser(\'file\',document.forms[0].file.value,\'flash\',window);"';
html += ' width="20" height="18" border="0" title="' + tinyMCE.getLang('lang_browse') + '"';
html += ' class="mceButtonNormal" alt="' + tinyMCE.getLang('lang_browse') + '" />';
document.getElementById('browser').innerHTML = html;
}
// Auto select flash in list
if (typeof(tinyMCEFlashList) != "undefined" && tinyMCEFlashList.length > 0) {
for (var i=0; i<formObj.link_list.length; i++) {
if (formObj.link_list.options[i].value == tinyMCE.getWindowArg('swffile'))
formObj.link_list.options[i].selected = true;
}
}
}
function insertFlash() {
var formObj = document.forms[0];
if (window.opener) {
var html = '';
var file = formObj.file.value;
var width = formObj.width.value;
var height = formObj.height.value;
if (formObj.width2.value=='%') {
width = width + '%';
}
if (formObj.height2.value=='%') {
height = height + '%';
}
if (width == "")
width = 100;
if (height == "")
height = 100;
html += ''
+ '<img src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" '
+ 'width="' + width + '" height="' + height + '" '
+ 'border="0" alt="' + file + '" title="' + file + '" class="mce_plugin_flash" name="mce_plugin_flash" />';
tinyMCE.execCommand("mceInsertContent",true,html);
tinyMCE.selectedInstance.repaint();
// Close the dialog
tinyMCE.closeDialog();
}
}
function cancelAction() {
// Close the dialog
tinyMCE.closeDialog();
}
//-->
</script>
<style type="text/css">
<!--
input.radio {
border: 1px none #000000;
background-color: transparent;
vertical-align: middle;
}
-->
</style>
</head>
<body onload="init();">
<form onsubmit="insertFlash();return false;">
<table border="0" cellpadding="0" cellspacing="4" width="350">
<tr>
<td class="title">{$lang_insert_flash}</td>
</tr>
<tr>
<td><hr size="1" noshade="noshade" /></td>
</tr>
<tr>
<td align="center" valign="middle"><table border="0" cellpadding="4" cellspacing="0">
<tr>
<td align="right" nowrap="nowrap">{$lang_insert_flash_file}:</td>
<td nowrap="nowrap">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><input name="file" type="text" id="file" value="" onfocus="this.select();" style="width: 250px; vertical-align: middle;" /></td>
<td id="browser"></td>
</tr>
</table>
</td>
</tr>
<!-- Link list -->
<script language="javascript">
if (typeof(tinyMCEFlashList) != "undefined" && tinyMCEFlashList.length > 0) {
var html = "";
html += '<tr><td align="right">{$lang_insert_flash_list}:</td>';
html += '<td><select name="link_list" style="width: 250px" onchange="this.form.file.value=this.options[this.selectedIndex].value;">';
html += '<option value="">---</option>';
for (var i=0; i<tinyMCEFlashList.length; i++)
html += '<option value="' + tinyMCEFlashList[i][1] + '">' + tinyMCEFlashList[i][0] + '</option>';
html += '</select></td></tr>';
document.write(html);
}
</script>
<!-- /Link list -->
<tr>
<td align="right" nowrap="nowrap">{$lang_insert_flash_size}:</td>
<td nowrap="nowrap">
<input name="width" type="text" id="width" value="" onfocus="this.select();" style="width: 50px; vertical-align: middle;" />
<select name="width2" id="width2" style="width: 50px; vertical-align: middle;">
<option value="">px</option>
<option value="%">%</option>
</select>&nbsp;x&nbsp;<input name="height" type="text" id="height" value="" onfocus="this.select();" style="width: 50px; vertical-align: middle;" />
<select name="height2" id="height2" style="width: 50px; vertical-align: middle;">
<option value="">px</option>
<option value="%">%</option>
</select>
</td>
</tr>
</table></td>
<tr>
<td><hr size="1" noshade="noshade" /></td>
</tr>
<tr>
<td nowrap="nowrap" align="left">
<input style="float:left" type="button" name="insert" value="{$lang_insert}" onclick="insertFlash();" id="insert" /><input style="float:right" type="button" name="cancel" value="{$lang_cancel}" onclick="cancelAction();" id="cancel" />
</td>
</tr>
</table>
</form>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 664 B

View file

@ -0,0 +1,7 @@
// CS lang variables
tinyMCELang['lang_insert_flash'] = 'Vložit/editovat Flash Movie';
tinyMCELang['lang_insert_flash_file'] = 'Flash soubor (.swf)';
tinyMCELang['lang_insert_flash_size'] = 'Velikost';
tinyMCELang['lang_insert_flash_list'] = 'Seznam';
tinyMCELang['lang_flash_props'] = 'Vlastnosti Flash';

View file

@ -0,0 +1,7 @@
// DE lang variables
tinyMCELang['lang_insert_flash'] = 'Flash Movie einf&uuml;gen / bearbeiten';
tinyMCELang['lang_insert_flash_file'] = 'Flash-Datei';
tinyMCELang['lang_insert_flash_size'] = 'Gr&ouml;&szlig;e';
tinyMCELang['lang_insert_flash_list'] = 'Flash Dateien';
tinyMCELang['lang_flash_props'] = 'Flash properties';

View file

@ -0,0 +1,7 @@
// UK lang variables
tinyMCELang['lang_insert_flash'] = 'Insert / edit Flash Movie';
tinyMCELang['lang_insert_flash_file'] = 'Flash-File (.swf)';
tinyMCELang['lang_insert_flash_size'] = 'Size';
tinyMCELang['lang_insert_flash_list'] = 'Flash files';
tinyMCELang['lang_flash_props'] = 'Flash properties';

View file

@ -0,0 +1,11 @@
// IR lang variables
// Persian (Farsi) language pack (for IRAN)
// By: Morteza Zafari
// Lost@LostLord.com
// http://www.LostLord.com
tinyMCELang['lang_dir'] = 'rtl';
tinyMCELang['lang_insert_flash'] = '?????? ? ?????? ???? ???';
tinyMCELang['lang_insert_flash_file'] = '???? ??? (.swf)';
tinyMCELang['lang_insert_flash_size'] = '?????';
tinyMCELang['lang_flash_props'] = 'Flash properties';

View file

@ -0,0 +1,7 @@
// French lang variables by Laurent Dran
tinyMCELang['lang_insert_flash'] = 'Ins&eacute;rer / &eacute;diter une animation Flash';
tinyMCELang['lang_insert_flash_file'] = 'Fichier-Flash (.swf)';
tinyMCELang['lang_insert_flash_size'] = 'Taille';
tinyMCELang['lang_insert_flash_list'] = 'Fichiers Flash';
tinyMCELang['lang_flash_props'] = 'Flash properties';

View file

@ -0,0 +1,6 @@
// CA_FR lang variables
tinyMCELang['lang_insert_flash'] = 'Insérer / Modifier une animation Flash';
tinyMCELang['lang_insert_flash_file'] = 'Fichier Flash (.swf)';
tinyMCELang['lang_insert_flash_size'] = 'Dimension';
tinyMCELang['lang_flash_props'] = 'Flash properties';

View file

@ -0,0 +1,7 @@
// PL lang variables
tinyMCELang['lang_insert_flash'] = 'Wstaw/Edytuj animację Flash';
tinyMCELang['lang_insert_flash_file'] = 'Plik Flash (.swf)';
tinyMCELang['lang_insert_flash_size'] = 'Rozmiar';
tinyMCELang['lang_insert_flash_list'] = 'Pliki Flash';
tinyMCELang['lang_flash_props'] = 'Właściwości animacji Flash';

View file

@ -0,0 +1,7 @@
// pt_BR lang variables
tinyMCELang['lang_insert_flash'] = 'Inserir / editar Arquivo Flash';
tinyMCELang['lang_insert_flash_file'] = 'Arquivo Flash (.swf)';
tinyMCELang['lang_insert_flash_size'] = 'Tamanho';
tinyMCELang['lang_insert_flash_list'] = 'Lista de arquivos Flash';
tinyMCELang['lang_flash_props'] = 'Propriedades Flash';

View file

@ -0,0 +1,7 @@
// SE lang variables
tinyMCELang['lang_insert_flash'] = 'Skapa/uppdatera flash-film';
tinyMCELang['lang_insert_flash_file'] = 'Flash-film (.swf)';
tinyMCELang['lang_insert_flash_size'] = 'Storlek';
tinyMCELang['lang_insert_flash_list'] = 'Flash-filer';
tinyMCELang['lang_flash_props'] = 'Flash egenskaper';

View file

@ -0,0 +1,8 @@
// Simplified Chinese lang variables contributed by cube316 (cube316@gmail.com)
//请访问 http://www.cube316.net/ 以获取TinyMCE的中文支持
tinyMCELang['lang_insert_flash'] = '插入/编辑 Flash电影';
tinyMCELang['lang_insert_flash_file'] = 'Flash文件(.swf)';
tinyMCELang['lang_insert_flash_size'] = '尺寸';
tinyMCELang['lang_insert_flash_list'] = 'Flash文件列表';
tinyMCELang['lang_flash_props'] = 'Flash属性';

View file

@ -0,0 +1,48 @@
FLASH plugin for TinyMCE
-----------------------------
About:
This is the INSERT FLASH Dialog contributed by Michael Keck.
This one supports popup windows and targets.
Note:
The placeholder for Flash is called 'mce_plugin_flash' and needs a class 'mce_plugin_flash' in the 'css_-style'.
Do not name another image 'name="mce_plugin_flash"!
Installation instructions:
* Copy the flash directory to the plugins directory of TinyMCE (/jscripts/tiny_mce/plugins).
* Add plugin to TinyMCE plugin option list example: plugins : "flash".
* Add this "img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name]" to extended_valid_elements option.
Initialization example:
tinyMCE.init({
theme : "advanced",
mode : "textareas",
plugins : "flash",
extended_valid_elements : "img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name]"
flash_external_list_url : "example_flash_list.js" // Optional URL to a list of Flash movies
});
----------------------------------------------------------------
ADDITIONAL NOTE:
The flash plugin has been heavily modified (the original is editor_plugin_original.js) since the original did not play nicely with html content that
already contained existing flash tags and in fact stripped out the object
tags for existing flash html. The rewrite corrects this as well attempts
to preserve the existing flash tags where possible. The tinyMCE.init call
should be be something like:
Initialization example:
tinyMCE.init({
theme : "advanced",
mode : "textareas",
plugins : "flash",
extended_valid_elements : "img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name|obj|param|embed]"
});
Note the extra obj,param,embed attributes for the img tag. These attributes
are used to serialize data from existing flash tags so that they can be
properly restored. Editing a flash tag with the plugin will cause this
information to be lost (sorry !) but still produces a working flash nevertheless.