Update of /cvsroot/phpslash/phpslash-dev/public_html/scripts/tinymce/jscripts/tiny_mce/plugins/advimage
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17564/phpslash-dev/public_html/scripts/tinymce/jscripts/tiny_mce/plugins/advimage
Added Files:
editor_plugin.js image.htm readme.txt
Log Message:
complete tinyMCE addition
--- NEW FILE: editor_plugin.js ---
/* Import theme specific language pack */
tinyMCE.importPluginLanguagePack('advimage', 'uk,se,de');
/**
* Insert image template function.
*/
function TinyMCE_advimage_getInsertImageTemplate() {
var template = new Array();
template['file'] = '../../plugins/advimage/image.htm';
template['width'] = 380;
template['height'] = 380;
// Language specific width and height addons
template['width'] += tinyMCE.getLang('lang_insert_image_delta_width', 0);
template['height'] += tinyMCE.getLang('lang_insert_image_delta_height', 0);
return template;
}
--- NEW FILE: image.htm ---
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<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">
<!--
function myRegexpReplace(in_str, reg_exp, replace_str, opts) {
if (typeof opts == "undefined")
opts = 'g';
var re = new RegExp(reg_exp, opts);
return in_str.replace(re, replace_str);
}
function insertImage() {
if (window.opener) {
var src = document.forms[0].src.value;
var alt = document.forms[0].alt.value;
var title = document.forms[0].title.value;
var border = document.forms[0].border.value;
var vspace = document.forms[0].vspace.value;
var hspace = document.forms[0].hspace.value;
var width = document.forms[0].width.value;
var height = document.forms[0].height.value;
var align = document.forms[0].align.options[document.forms[0].align.selectedIndex].value;
var onmouseover = document.forms[0].onmouseover.value;
var onmouseout = document.forms[0].onmouseout.value;
// added 2004-11-10 by Michael Keck (me...@mi...)
// supporting onmouse over / out for image swap ...
// only support the onmouse over/out if both values are given
if (onmouseover!='' && onmouseout!='' && document.forms[0].onmousemove.checked==true) {
onmouseover="this.src='" + onmouseover + "';";
onmouseout ="this.src='" + onmouseout + "';";
} else {
onmouseover="";
onmouseout ="";
}
window.opener.tinyMCE.insertImage(src, alt, border, hspace, vspace, width, height, align, title, onmouseover, onmouseout);
top.close();
}
}
function init() {
var formObj = document.forms[0];
var arrOnOver = new Array(), arrOnOut = new Array();
var strOnOver = "", strOnOut = "";
for (var i=0; i<document.forms[0].align.options.length; i++) {
if (document.forms[0].align.options[i].value == tinyMCE.getWindowArg('align'))
document.forms[0].align.options.selectedIndex = i;
}
formObj.src.value = tinyMCE.getWindowArg('src');
formObj.alt.value = tinyMCE.getWindowArg('alt');
formObj.title.value = tinyMCE.getWindowArg('title');
formObj.border.value = tinyMCE.getWindowArg('border');
formObj.vspace.value = tinyMCE.getWindowArg('vspace');
formObj.hspace.value = tinyMCE.getWindowArg('hspace');
formObj.width.value = tinyMCE.getWindowArg('width');
formObj.height.value = tinyMCE.getWindowArg('height');
formObj.height.value = tinyMCE.getWindowArg('height');
// added 2004-11-10 by Michael Keck (me...@mi...)
// supporting onmouse over / out for image swap ...
arrOnOver = tinyMCE.getWindowArg('onmouseover').split(';');
arrOnOut = tinyMCE.getWindowArg('onmouseout').split(';');
for (var i=0; i<arrOnOver.length; i++) {
if (arrOnOver[i].indexOf('this.src=\'')!=-1) {
strOnOver = arrOnOver[i];
break;
}
}
for (var i=0; i<arrOnOut.length; i++) {
if (arrOnOut[i].indexOf('this.src=\'')!=-1) {
strOnOut = arrOnOut[i];
break;
}
}
if (strOnOver!='') {
strOnOver = myRegexpReplace(strOnOver,"this.src='","","gi");
strOnOver = myRegexpReplace(strOnOver,"'","","gi");
strOnOver = myRegexpReplace(strOnOver,";","","gi");
}
if (strOnOut!='') {
strOnOut = myRegexpReplace(strOnOut,"this.src='","","gi");
strOnOut = myRegexpReplace(strOnOut,"'","","gi");
strOnOut = myRegexpReplace(strOnOut,";","","gi");
}
if (strOnOver!='' && strOnOut!='') {
setOnMouseInput('enabled');
formObj.onmousemove.checked = true;
formObj.onmouseover.value = strOnOver;
formObj.onmouseout.value = strOnOut;
} else {
setOnMouseInput('disabled');
formObj.onmousemove.checked = false;
formObj.onmouseover.value = '';
formObj.onmouseout.value = '';
}
window.focus();
}
// added 2004-11-10 by Michael Keck (me...@mi...)
// supporting onmouse over / out for image swap ...
// this function is needed for visual show, if onmouse over/out available
function setOnMouseInput(stat){
var formObj = document.forms[0];
if (stat=='enabled') {
formObj.onmouseover.disabled = false;
formObj.onmouseout.disabled = false;
if (document.getElementById) {
document.getElementById('showInput1').style.color="#000000";
document.getElementById('showInput2').style.color="#000000";
}
formObj.onmouseout.value = formObj.src.value;
} else {
formObj.onmouseover.disabled = true;
formObj.onmouseout.disabled =true;
if (document.getElementById) {
document.getElementById('showInput1').style.color="#666666";
document.getElementById('showInput2').style.color="#666666";
}
}
}
function cancelAction() {
top.close();
}
//-->
</script>
</head>
<body onload="window.focus();init();">
<form onsubmit="insertImage();return false;">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="center" valign="middle"><table border="0" cellpadding="4" cellspacing="0">
<tr>
<td colspan="2" class="title">{$lang_insert_image_title}</td>
</tr>
<tr>
<td align="right" nowrap="nowrap">{$lang_insert_image_src}:</td>
<td><input name="src" type="text" id="src" value="" style="width: 200px" /></td>
</tr>
<tr>
<td align="right" nowrap="nowrap">{$lang_insert_image_alt}:</td>
<td><input name="alt" type="text" id="alt" value="" style="width: 200px" onblur="if(document.forms[0].title.value==''){ document.forms[0].title.value=this.value; }" onfocus="if(document.forms[0].title.value==''){ document.forms[0].title.value=this.value; }" /></td>
</tr>
<tr>
<td align="right" nowrap="nowrap">{$lang_insert_image_alt2}:</td>
<td><input name="title" type="text" id="title" value="" style="width: 200px" /></td>
</tr>
<tr>
<td align="right" nowrap="nowrap">{$lang_insert_image_dimensions}:</td>
<td nowrap="nowrap">
<input name="width" type="text" id="width" value="" size="5" maxlength="5" style="vertical-align: middle; width: 50px; text-align: center;" /> x
<input name="height" type="text" id="height" value="" size="5" maxlength="5" style="vertical-align: middle; width: 50px; text-align: center;" /> px
</td>
</tr>
<tr>
<td align="right" nowrap="nowrap">{$lang_insert_image_border}:</td>
<td><input name="border" type="text" id="border" value="" size="3" maxlength="3" style="vertical-align: middle; width: 30px; text-align: center;" /></td>
</tr>
<tr>
<td align="right" nowrap="nowrap">{$lang_insert_image_align}:</td>
<td><select 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 align="right" nowrap="nowrap">{$lang_insert_image_vspace}:</td>
<td><input name="vspace" type="text" id="vspace" value="" size="3" maxlength="3" style="vertical-align: middle; width: 30px; text-align: center;" /></td>
</tr>
<tr>
<td align="right" nowrap="nowrap">{$lang_insert_image_hspace}:</td>
<td><input name="hspace" type="text" id="hspace" value="" size="3" maxlength="3" style="vertical-align: middle; width: 30px; text-align: center;" /></td>
</tr>
<tr>
<td colspan="2" nowrap="nowrap"><input type="checkbox" name="onmousemove" id="onmousemove" style="border: 1px none #000000; background-color: transparent; vertical-align: middle;" onclick="if(this.checked==true){ setOnMouseInput('enabled'); }else{ setOnMouseInput('enable'); }" /><label for="onmousemove"><b>{$lang_insert_image_onmousemove}</b>:</label></td>
</tr>
<tr>
<td align="right" nowrap="nowrap" id="showInput1">{$lang_insert_image_mouseover}:</td>
<td><input name="onmouseover" type="text" id="onmouseover" value="" style="width: 200px" /></td>
</tr>
<tr>
<td align="right" nowrap="nowrap" id="showInput2">{$lang_insert_image_mouseout}:</td>
<td><input name="onmouseout" type="text" id="onmouseout" value="" style="width: 200px" /></td>
</tr>
<tr>
<td><input type="button" name="insert" value="{$lang_insert}" onclick="insertImage();" id="insert" /></td>
<td align="right"><input type="button" name="cancel" value="{$lang_cancel}" onclick="cancelAction();" id="cancel" /></td>
</tr>
</table></td>
</tr>
</table>
</form>
</body>
</html>
--- NEW FILE: readme.txt ---
Advimage plugin for TinyMCE
-----------------------------
About:
This is a more advanced image dialog mostly based on code contributed by Michael Keck.
This one supports mouseover/out image swapping.
Installation instructions:
* Copy the advimage directory to the plugins directory of TinyMCE (/jscripts/tiny_mce/plugins).
* Add plugin to TinyMCE plugin option list example: plugins : "advimage".
* Add this "a[name|href|target|title|onclick]" to extended_valid_elements option.
Initialization example:
tinyMCE.init({
theme : "advanced",
mode : "textareas",
plugins : "preview",
extended_valid_elements : "a[name|href|target|title|onclick]"
});
|