添加到 trunk
+YUCHENG HU+ git-svn-id: https://svn.code.sf.net/p/hawebs/svn@190 a2543c7e-f6e9-4f8a-8bff-1ffc34733512
This commit is contained in:
+7
@@ -0,0 +1,7 @@
|
||||
.mceItemFlash {
|
||||
border: 1px dotted #cc0000;
|
||||
background-image: url('../images/flash.gif');
|
||||
background-position: center;
|
||||
background-repeat: no-repeat;
|
||||
background-color: #ffffcc;
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
.panel_wrapper div.current {
|
||||
height: 100px;
|
||||
}
|
||||
|
||||
#width, #height {
|
||||
width: 50px;
|
||||
}
|
||||
|
||||
#file {
|
||||
width: 250px;
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
+1
File diff suppressed because one or more lines are too long
Vendored
+285
@@ -0,0 +1,285 @@
|
||||
/**
|
||||
* $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $
|
||||
*
|
||||
* @author Moxiecode
|
||||
* @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
|
||||
*/
|
||||
|
||||
/* Import plugin specific language pack */
|
||||
tinyMCE.importPluginLanguagePack('flash');
|
||||
|
||||
var TinyMCE_FlashPlugin = {
|
||||
getInfo : function() {
|
||||
return {
|
||||
longname : 'Flash',
|
||||
author : 'Moxiecode Systems AB',
|
||||
authorurl : 'http://tinymce.moxiecode.com',
|
||||
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/flash',
|
||||
version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
|
||||
};
|
||||
},
|
||||
|
||||
initInstance : function(inst) {
|
||||
if (!tinyMCE.settings['flash_skip_plugin_css'])
|
||||
tinyMCE.importCSS(inst.getDoc(), tinyMCE.baseURL + "/plugins/flash/css/content.css");
|
||||
},
|
||||
|
||||
getControlHTML : function(cn) {
|
||||
switch (cn) {
|
||||
case "flash":
|
||||
return tinyMCE.getButtonHTML(cn, 'lang_flash_desc', '{$pluginurl}/images/flash.gif', 'mceFlash');
|
||||
}
|
||||
|
||||
return "";
|
||||
},
|
||||
|
||||
execCommand : function(editor_id, element, command, user_interface, value) {
|
||||
// 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'] = 430;
|
||||
template['height'] = 175;
|
||||
|
||||
template['width'] += tinyMCE.getLang('lang_flash_delta_width', 0);
|
||||
template['height'] += tinyMCE.getLang('lang_flash_delta_height', 0);
|
||||
|
||||
// Is selection a image
|
||||
if (focusElm != null && focusElm.nodeName.toLowerCase() == "img") {
|
||||
name = tinyMCE.getAttrib(focusElm, 'class');
|
||||
|
||||
if (name.indexOf('mceItemFlash') == -1) // Not a Flash
|
||||
return true;
|
||||
|
||||
// Get rest of Flash items
|
||||
swffile = tinyMCE.getAttrib(focusElm, 'alt');
|
||||
|
||||
if (tinyMCE.getParam('convert_urls'))
|
||||
swffile = eval(tinyMCE.settings['urlconverter_callback'] + "(swffile, null, true);");
|
||||
|
||||
swfwidth = tinyMCE.getAttrib(focusElm, 'width');
|
||||
swfheight = tinyMCE.getAttrib(focusElm, 'height');
|
||||
action = "update";
|
||||
}
|
||||
|
||||
tinyMCE.openWindow(template, {editor_id : editor_id, inline : "yes", swffile : swffile, swfwidth : swfwidth, swfheight : swfheight, action : action});
|
||||
return true;
|
||||
}
|
||||
|
||||
// Pass to next handler in chain
|
||||
return false;
|
||||
},
|
||||
|
||||
cleanup : function(type, content) {
|
||||
switch (type) {
|
||||
case "insert_to_editor_dom":
|
||||
// Force relative/absolute
|
||||
if (tinyMCE.getParam('convert_urls')) {
|
||||
var imgs = content.getElementsByTagName("img");
|
||||
for (var i=0; i<imgs.length; i++) {
|
||||
if (tinyMCE.getAttrib(imgs[i], "class") == "mceItemFlash") {
|
||||
var src = tinyMCE.getAttrib(imgs[i], "alt");
|
||||
|
||||
if (tinyMCE.getParam('convert_urls'))
|
||||
src = eval(tinyMCE.settings['urlconverter_callback'] + "(src, null, true);");
|
||||
|
||||
imgs[i].setAttribute('alt', src);
|
||||
imgs[i].setAttribute('title', 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], "class") == "mceItemFlash") {
|
||||
var src = tinyMCE.getAttrib(imgs[i], "alt");
|
||||
|
||||
if (tinyMCE.getParam('convert_urls'))
|
||||
src = eval(tinyMCE.settings['urlconverter_callback'] + "(src, null, true);");
|
||||
|
||||
imgs[i].setAttribute('alt', src);
|
||||
imgs[i].setAttribute('title', 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_FlashPlugin._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 width="' + attribs["width"] + '" height="' + attribs["height"] + '"';
|
||||
content += ' src="' + (tinyMCE.getParam("theme_href") + '/images/spacer.gif') + '" title="' + attribs["src"] + '"';
|
||||
content += ' alt="' + attribs["src"] + '" class="mceItemFlash" />' + content.substring(endPos);
|
||||
content += contentAfter;
|
||||
index++;
|
||||
|
||||
startPos++;
|
||||
}
|
||||
|
||||
// Parse all embed tags and replace them with images from the embed data
|
||||
var index = 0;
|
||||
while ((startPos = content.indexOf('<embed', startPos)) != -1) {
|
||||
if (index >= embedList.length)
|
||||
break;
|
||||
|
||||
var attribs = embedList[index];
|
||||
|
||||
// Find end of embed
|
||||
endPos = content.indexOf('>', startPos);
|
||||
endPos += 9;
|
||||
|
||||
// Insert image
|
||||
var contentAfter = content.substring(endPos);
|
||||
content = content.substring(0, startPos);
|
||||
content += '<img width="' + attribs["width"] + '" height="' + attribs["height"] + '"';
|
||||
content += ' src="' + (tinyMCE.getParam("theme_href") + '/images/spacer.gif') + '" title="' + attribs["src"] + '"';
|
||||
content += ' alt="' + attribs["src"] + '" class="mceItemFlash" />' + 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_FlashPlugin._parseAttributes(content.substring(startPos + 4, endPos));
|
||||
|
||||
// Is not flash, skip it
|
||||
if (attribs['class'] != "mceItemFlash")
|
||||
continue;
|
||||
|
||||
endPos += 2;
|
||||
|
||||
var embedHTML = '';
|
||||
var wmode = tinyMCE.getParam("flash_wmode", "");
|
||||
var quality = tinyMCE.getParam("flash_quality", "high");
|
||||
var menu = tinyMCE.getParam("flash_menu", "false");
|
||||
|
||||
// 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="' + quality + '" />';
|
||||
embedHTML += '<param name="menu" value="' + menu + '" />';
|
||||
embedHTML += '<param name="wmode" value="' + wmode + '" />';
|
||||
embedHTML += '<embed src="' + attribs["title"] + '" wmode="' + wmode + '" quality="' + quality + '" menu="' + menu + '" 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;
|
||||
},
|
||||
|
||||
handleNodeChange : function(editor_id, node, undo_index, undo_levels, visual_aid, any_selection) {
|
||||
if (node == null)
|
||||
return;
|
||||
|
||||
do {
|
||||
if (node.nodeName == "IMG" && tinyMCE.getAttrib(node, 'class').indexOf('mceItemFlash') == 0) {
|
||||
tinyMCE.switchClass(editor_id + '_flash', 'mceButtonSelected');
|
||||
return true;
|
||||
}
|
||||
} while ((node = node.parentNode));
|
||||
|
||||
tinyMCE.switchClass(editor_id + '_flash', 'mceButtonNormal');
|
||||
|
||||
return true;
|
||||
},
|
||||
|
||||
// Private plugin internal functions
|
||||
|
||||
_parseAttributes : function(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);
|
||||
|
||||
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("flash", TinyMCE_FlashPlugin);
|
||||
+70
@@ -0,0 +1,70 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>{$lang_flash_title}</title>
|
||||
<script language="javascript" type="text/javascript" src="../../tiny_mce_popup.js"></script>
|
||||
<script language="javascript" type="text/javascript" src="jscripts/flash.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>
|
||||
<link href="css/flash.css" rel="stylesheet" type="text/css" />
|
||||
<base target="_self" />
|
||||
</head>
|
||||
<body onload="tinyMCEPopup.executeOnLoad('init();');" style="display: none">
|
||||
<form onsubmit="insertFlash();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_flash_general}</a></span></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="panel_wrapper">
|
||||
<div id="general_panel" class="panel current">
|
||||
<fieldset>
|
||||
<legend>{$lang_flash_general}</legend>
|
||||
|
||||
<table border="0" cellpadding="4" cellspacing="0">
|
||||
<tr>
|
||||
<td nowrap="nowrap"><label for="file">{$lang_flash_file}</label></td>
|
||||
<td nowrap="nowrap">
|
||||
<table border="0" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td><input id="file" name="file" type="text" value="" onfocus="this.select();" /></td>
|
||||
<td id="filebrowsercontainer"> </td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="linklistrow">
|
||||
<td><label for="linklist">{$lang_flash_list}</label></td>
|
||||
<td id="linklistcontainer"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap="nowrap"><label>{$lang_flash_size}</label></td>
|
||||
<td nowrap="nowrap">
|
||||
<input type="text" id="width" name="width" value="" onfocus="this.select();" />
|
||||
<select name="width2" id="width2" style="width: 50px">
|
||||
<option value="">px</option>
|
||||
<option value="%">%</option>
|
||||
</select> x <input id="height" name="height" type="text" value="" onfocus="this.select();" />
|
||||
<select name="height2" id="height2" style="width: 50px">
|
||||
<option value="">px</option>
|
||||
<option value="%">%</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mceActionPanel">
|
||||
<div style="float: left">
|
||||
<input type="button" id="insert" name="insert" value="{$lang_insert}" onclick="insertFlash();" />
|
||||
</div>
|
||||
|
||||
<div style="float: right">
|
||||
<input type="button" id="cancel" name="cancel" value="{$lang_cancel}" onclick="tinyMCEPopup.close();" />
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
BIN
Binary file not shown.
|
After Width: | Height: | Size: 241 B |
+1
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
+1
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
+107
@@ -0,0 +1,107 @@
|
||||
var url = tinyMCE.getParam("flash_external_list_url");
|
||||
if (url != null) {
|
||||
// Fix relative
|
||||
if (url.charAt(0) != '/' && url.indexOf('://') == -1)
|
||||
url = tinyMCE.documentBasePath + "/" + url;
|
||||
|
||||
document.write('<sc'+'ript language="javascript" type="text/javascript" src="' + url + '"></sc'+'ript>');
|
||||
}
|
||||
|
||||
function init() {
|
||||
tinyMCEPopup.resizeToInnerSize();
|
||||
|
||||
document.getElementById("filebrowsercontainer").innerHTML = getBrowserHTML('filebrowser','file','flash','flash');
|
||||
|
||||
// Image list outsrc
|
||||
var html = getFlashListHTML('filebrowser','file','flash','flash');
|
||||
if (html == "")
|
||||
document.getElementById("linklistrow").style.display = 'none';
|
||||
else
|
||||
document.getElementById("linklistcontainer").innerHTML = html;
|
||||
|
||||
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);
|
||||
|
||||
selectByValue(formObj, 'linklist', swffile);
|
||||
|
||||
// Handle file browser
|
||||
if (isVisible('filebrowser'))
|
||||
document.getElementById('file').style.width = '230px';
|
||||
|
||||
// Auto select flash in list
|
||||
if (typeof(tinyMCEFlashList) != "undefined" && tinyMCEFlashList.length > 0) {
|
||||
for (var i=0; i<formObj.linklist.length; i++) {
|
||||
if (formObj.linklist.options[i].value == tinyMCE.getWindowArg('swffile'))
|
||||
formObj.linklist.options[i].selected = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getFlashListHTML() {
|
||||
if (typeof(tinyMCEFlashList) != "undefined" && tinyMCEFlashList.length > 0) {
|
||||
var html = "";
|
||||
|
||||
html += '<select id="linklist" name="linklist" style="width: 250px" onfocus="tinyMCE.addSelectAccessibility(event, this, window);" 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>';
|
||||
|
||||
return html;
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
function insertFlash() {
|
||||
var formObj = document.forms[0];
|
||||
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") + '" mce_src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" '
|
||||
+ 'width="' + width + '" height="' + height + '" '
|
||||
+ 'border="0" alt="' + file + '" title="' + file + '" class="mceItemFlash" />';
|
||||
|
||||
tinyMCEPopup.execCommand("mceInsertContent", true, html);
|
||||
tinyMCE.selectedInstance.repaint();
|
||||
|
||||
tinyMCEPopup.close();
|
||||
}
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// UK lang variables
|
||||
|
||||
tinyMCE.addToLang('flash',{
|
||||
title : 'Insert / edit Flash Movie',
|
||||
desc : 'Insert / edit Flash Movie',
|
||||
file : 'Flash-File (.swf)',
|
||||
size : 'Size',
|
||||
list : 'Flash files',
|
||||
props : 'Flash properties',
|
||||
general : 'General'
|
||||
});
|
||||
+1
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
Reference in New Issue
Block a user