Upgrade to Xinha 0.931. Xinha has been optimized for size and dozens of issues have been closed

out since the last upgrade . Add Firefox and Xinha buttons to main page to show our support.
This commit is contained in:
Chris Morgan
2007-05-31 22:43:05 +00:00
committed by WineHQ
parent ff46a4485d
commit 2d4b27530d
354 changed files with 19793 additions and 21419 deletions

View File

@@ -1,89 +1,87 @@
<?PHP
//this plugin only use the relativ webpath to the picturefolder
//default ~ /htmlarea/plugins/InsertPicture/demo_pictures/
//default ~ /Xinha/plugins/InsertPicture/demo_pictures/
strstr( PHP_OS, "WIN") ? $strPathSeparator = "\\" : $strPathSeparator = "/";
if (isset($_REQUEST['picturepath'])) {
$getRequest = true;
$PicturePath = 'http://'.$_SERVER['HTTP_HOST'].$_REQUEST['picturepath'];
//$LocalPicturePath = $_REQUEST['localpicturepath'];
$AInsertPicturePath = explode ('/', 'http://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']).'/demo_pictures/');
$ALocalInsertPicturePath = explode($strPathSeparator, dirname(__FILE__).$strPathSeparator.'demo_pictures');
$APicturePath = explode('/', 'http://'.$_SERVER['HTTP_HOST'].$_REQUEST['picturepath']);
$AtheFilePath = array_values (array_diff ($APicturePath, $AInsertPicturePath));
$theFilePath = implode($strPathSeparator, $AtheFilePath).$strPathSeparator;
$PicturePath = $_REQUEST['picturepath'];
$AInsertPicturePath = explode ('/', dirname($_SERVER['PHP_SELF']));
$ALocalInsertPicturePath = explode($strPathSeparator, dirname(__FILE__));
$AtheRootPath = array_values (array_diff ($ALocalInsertPicturePath, $AInsertPicturePath));
$theRootPath = implode($strPathSeparator, $AtheRootPath);
$RootPath = implode($strPathSeparator, $AtheRootPath);
$LocalPicturePath = $theRootPath.$strPathSeparator.$theFilePath.$strPathSeparator;
} else {
$getRequest = false;
$PicturePath = 'http://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']).'/demo_pictures/';
$LocalPicturePath = dirname(__FILE__).$strPathSeparator.'demo_pictures';
$LocalPicturePath = str_replace('http://'.$_SERVER['HTTP_HOST'], "", $PicturePath);
$LocalPicturePath = str_replace('/', $strPathSeparator, $LocalPicturePath);
$LocalPicturePath = $RootPath.$LocalPicturePath;
$LocalPicturePath = dirname(__FILE__).$strPathSeparator.'demo_pictures'.$strPathSeparator;
//$LocalPicturePath = realpath('../../../../images/content/').$strPathSeparator;
}
$limitedext = array(".gif",".jpg",".png",".jpeg"); //Extensions you want files uploaded limited to.
$limitedsize = "1000000"; //size limit in bytes
$message = "";
function formatSize($size)
{
if($size < 1024)
return $size.' bytes';
else if($size >= 1024 && $size < 1024*1024)
return sprintf('%01.2f',$size/1024.0).' Kb';
else
return sprintf('%01.2f',$size/(1024.0*1024)).' Mb';
}
function formatSize($size)
{
if($size < 1024)
return $size.' bytes';
else if($size >= 1024 && $size < 1024*1024)
return sprintf('%01.2f',$size/1024.0).' Kb';
else
return sprintf('%01.2f',$size/(1024.0*1024)).' Mb';
}
$DestFileName = "";
if (isset($_FILES['file'])) {
$file = $_FILES['file'];
$ext = strrchr($file['name'],'.');
if (!in_array($ext,$limitedext)) {
if (!in_array($ext,$limitedext))
$message = "The file you are uploading doesn't have the correct extension.";
} else if (file_exists($LocalPicturePath.'\\'.$file['name'])) {
else if (file_exists($LocalPicturePath.$file['name']))
$message = "The file you are uploading already exists.";
} else if ($file['size'] > $limitedsize) {
else if ($file['size'] > $limitedsize)
$message = "The file you are uploading is to big. The max Filesize is</span><span> ".formatSize($limitedsize).".";
} else {
copy($file['tmp_name'], $LocalPicturePath.$strPathSeparator.$file['name']);
}
else
copy($file['tmp_name'], $LocalPicturePath.$file['name']);
$DestFileName = $file['name'];
}
?>
<html>
<head>
<title>Insert Image</title>
<link rel="stylesheet" type="text/css" href="../../popups/popup.css" />
<script type="text/javascript" src="../../popups/popup.js"></script>
<script type="text/javascript">
var HTMLArea = window.opener.HTMLArea;
window.resizeTo(500, 490);
var Xinha = window.opener.Xinha;
function i18n(str) {
return (HTMLArea._lc(str, 'HTMLArea'));
return (Xinha._lc(str, 'Xinha'));
}
function Init() {
__dlg_translate("InsertPicture");
__dlg_init();
window.resizeTo(470, 490);
// Make sure the translated string appears in the drop down. (for gecko)
document.getElementById("f_align").selectedIndex = 1;
document.getElementById("f_align").selectedIndex = 5;
document.getElementById("f_align").selectedIndex = 0;
document.getElementById("f_align").selectedIndex = document.getElementById("f_align").selectedIndex;
var param = window.dialogArguments;
if (param) {
document.getElementById("f_url").value = param["f_url"];
document.getElementById("f_alt").value = param["f_alt"];
document.getElementById("f_border").value = param["f_border"];
document.getElementById("f_align").value = param["f_align"];
document.getElementById("f_vert").value = param["f_vert"];
document.getElementById("f_horiz").value = param["f_horiz"];
document.getElementById("f_vert").value = (param["f_vert"]!="-1") ? param["f_vert"] : "";
document.getElementById("f_horiz").value = (param["f_horiz"]!="-1") ? param["f_horiz"] : "";
document.getElementById("f_height").value = param["f_height"];
document.getElementById("f_width").value = param["f_width"];
window.ipreview.location.replace(param.f_url);
}
document.getElementById("f_url").focus();
document.getElementById("filelist").selectedIndex = document.getElementById("filelist").selectedIndex;
<?php If ($DestFileName<>"")
echo "CopyToURL(\"".$PicturePath.$DestFileName."\");"
?>
}
function onOK() {
@@ -99,8 +97,7 @@ function onOK() {
}
}
// pass data back to the calling window
var fields = ["f_url", "f_alt", "f_align", "f_border",
"f_horiz", "f_vert"];
var fields = ["f_url", "f_alt", "f_align", "f_border", "f_horiz", "f_vert", "f_width", "f_height"];
var param = new Object();
for (var i in fields) {
var id = fields[i];
@@ -123,8 +120,7 @@ function onUpload() {
return false;
}
}
submit();
return false;
return true;
}
function onCancel() {
@@ -148,45 +144,56 @@ function onPreview() {
return false;
}
var img = new Image();
function imgWait() {
waiting = window.setInterval("imgIsLoaded()", 1000)
}
function imgIsLoaded() {
if(img.width > 0) {
window.clearInterval(waiting)
document.getElementById("f_width").value = img.width;
document.getElementById("f_height").value = img.height;
}
}
function CopyToURL(imgName) {
document.getElementById("f_url").value = imgName;
onPreview();
img.src = imgName;
img.onLoad = imgWait()
}
function openFile() {
window.open(document.getElementById("f_url").value,'','');
}
</script>
</head>
<body class="dialog" onload="Init()">
<div class="title">Insert Image</div>
<table border="0" width="100%" style="padding: 0px; margin: 0px">
<tbody>
<tr>
<td>Images on the Server:<br>
<select value="" style="width:200" size="10" onClick="CopyToURL(this[this.selectedIndex].value);">
<td>Images on the Server:<?php /*echo $LocalPicturePath*/ ?><br>
<select id="filelist" name="filelist" style="width:200" size="10" onClick="CopyToURL(this[this.selectedIndex].value);">
<?php
$d = @dir($LocalPicturePath);
while (false !== ($entry = $d->read())) { //not a dot file or directory
if(substr($entry,0,1) != '.') {
echo '<OPTION value="' . $PicturePath.$entry. '">' . $entry . '(' . formatSize(filesize($LocalPicturePath.'\\'.$entry)) .')</OPTION>';
while (false !== ($entry = $d->read())) {
if(substr($entry,0,1) != '.') { //not a dot file or directory
if ($entry == $DestFileName)
echo '<OPTION value="' . $PicturePath.$entry. '" selected="selected">' . $entry . '(' . formatSize(filesize($LocalPicturePath.'\\'.$entry)) .')</OPTION>';
else
echo '<OPTION value="' . $PicturePath.$entry. '">' . $entry . '(' . formatSize(filesize($LocalPicturePath.'\\'.$entry)) .')</OPTION>';
}
}
$d->close();
?>
</select>
<?php
if ($getRequest == true) {
echo '<form method="post" action="'.$_SERVER['PHP_SELF'].'?picturepath='.$_REQUEST['picturepath'].'" enctype="multipart/form-data">';
} else {
echo '<form method="post" action="'.$_SERVER['PHP_SELF'].'" enctype="multipart/form-data">';
}
?>
<form method="post" action="" enctype="multipart/form-data">
<input type="hidden" name="localpicturepath" value="<?php echo $LocalPicturePath ?>">
<input type="hidden" name="picturepath" value="<?php echo $PicturePath ?>">
<input type="file" name="file" id="file" size="30"><br>
<button type="submit" name="ok" onclick="return onUpload();">Upload file</button><br>
<button type="submit" name="ok" onclick="onUpload();">Upload file</button><br>
<span><?php echo $message ?></span>
</form>
@@ -201,13 +208,15 @@ function openFile() {
</table>
<form action="" method="get">
<input type="hidden" name="localpicturepath" value="<?php echo $LocalPicturePath ?>">
<input type="hidden" name="picturepath" value="<?php echo $PicturePath ?>">
<table border="0" width="100%" style="padding: 0px; margin: 0px">
<tbody>
<tr>
<td style="width: 7em; text-align: right">Image URL:</td>
<td><input type="text" name="url" id="f_url" style="width:75%"
title="Enter the image URL here" />
title="Enter the image URL here" value="<?php echo $PicturePath.$DestFileName ?>"/>
<button name="preview" onclick="return onPreview();"
title="Preview the image in a new window">Preview</button>
</td>
@@ -228,7 +237,7 @@ function openFile() {
<div class="space"></div>
<div class="fl">Alignment:</div>
<div class="fl" style="width: 6em;">Alignment:</div>
<select size="1" name="align" id="f_align"
title="Positioning of this image">
<option value="" >Not set</option>
@@ -236,7 +245,7 @@ function openFile() {
<option value="right" >Right</option>
<option value="texttop" >Texttop</option>
<option value="absmiddle" >Absmiddle</option>
<option value="baseline" selected="1" >Baseline</option>
<option value="baseline" >Baseline</option>
<option value="absbottom" >Absbottom</option>
<option value="bottom" >Bottom</option>
<option value="middle" >Middle</option>
@@ -245,10 +254,23 @@ function openFile() {
<p />
<div class="fl">Border thickness:</div>
<input type="text" name="border" id="f_border" size="5"
title="Leave empty for no border" />
<div class="fl" style="width: 6em;">Border thickness:</div>
<input type="text" name="border" id="f_border" size="5" title="Leave empty for no border" />
<div class="space"></div>
</fieldset>
<fieldset style="float: left; margin-left: 5px;">
<legend>Size</legend>
<div class="space"></div>
<div class="fl" style="width: 5em;">Width:</div>
<input type="text" name="width" id="f_width" size="5" title="Leave empty for not defined" />
<p />
<div class="fl" style="width: 5em;">Height:</div>
<input type="text" name="height" id="f_height" size="5" title="Leave empty for not defined" />
<div class="space"></div>
</fieldset>
@@ -258,15 +280,12 @@ title="Leave empty for no border" />
<div class="space"></div>
<div class="fr">Horizontal:</div>
<input type="text" name="horiz" id="f_horiz" size="5"
title="Horizontal padding" />
<div class="fr" style="width: 5em;">Horizontal:</div>
<input type="text" name="horiz" id="f_horiz" size="5" title="Horizontal padding" />
<p />
<div class="fr">Vertical:</div>
<input type="text" name="vert" id="f_vert" size="5"
title="Vertical padding" />
<div class="fr" style="width: 5em;">Vertical:</div>
<input type="text" name="vert" id="f_vert" size="5" title="Vertical padding" />
<div class="space"></div>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 185 B

After

Width:  |  Height:  |  Size: 173 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@@ -1,93 +1,25 @@
// Insert Image plugin for HTMLArea
// Insert Image plugin for Xinha
// Original Author - Udo Schmal
//
// (c) www.Schaffrath-NeueMedien.de 2004
// Distributed under the same terms as HTMLArea itself.
// This notice MUST stay intact for use (see license.txt).
//Usage:
// if(typeof InsertPicture != 'undefined')
// { InsertPicture.PicturePath = [webpath to imagefolder];
// InsertPicture.LocalPicturePath = [local server path to imagefolder];
// }
// for Example:
// if(typeof InsertPicture != 'undefined')
// { InsertPicture.PicturePath = _editor_url + "plugins/insertPicture/demo_pictures/";
// InsertPicture.LocalPicturePath = "d:\\inetpub\\wwwroot\\xinha\\trunk\\plugins\\insertPicture\\demo_pictures";
// }
function InsertPicture(editor) {
// nothing to do
if ( typeof _editor_picturePath !== "string" )
_editor_picturePath = _editor_url + "plugins/InsertPicture/demo_pictures/";
InsertPicture.Scripting = "php"; //else "asp"
editor.config.URIs.insert_image = '../plugins/InsertPicture/InsertPicture.' + InsertPicture.Scripting + '?picturepath=' + _editor_picturePath;
}
InsertPicture._pluginInfo = {
name : "InsertPicture",
version : "1.0.1",
developer : "Udo Schmal",
developer_url : "http://www.Schaffrath-NeueMedien.de/",
sponsor : "L.N.Schaffrath NeueMedien",
sponsor_url : "http://www.schaffrath-neuemedien.de/",
c_owner : "Udo Schmal",
license : "htmlArea"
name : "InsertPicture",
version : "1.0.2",
developer : "Udo Schmal",
developer_url : "http://www.Schaffrath-NeueMedien.de/",
sponsor : "L.N.Schaffrath NeueMedien",
sponsor_url : "http://www.schaffrath-neuemedien.de/",
c_owner : "Udo Schmal",
license : "htmlArea"
};
HTMLArea.prototype._insertImage = function(image) {
var editor = this;
var outparam = null;
if (typeof image == "undefined") {
image = this.getParentElement();
if (image && !/^img$/i.test(image.tagName))
image = null;
}
if (image) outparam = {
f_url : HTMLArea.is_ie ? image.src : image.getAttribute("src"),
f_alt : image.alt,
f_border : image.border,
f_align : image.align,
f_vert : image.vspace,
f_horiz : image.hspace,
f_width : image.width,
f_height : image.height
};
var manager = _editor_url + 'plugins/InsertPicture/InsertPicture.php'
+ '?picturepath=' + InsertPicture.PicturePath;
Dialog(manager, function(param) {
if (!param) { // user must have pressed Cancel
return false;
}
if (!image) {
var sel = editor._getSelection();
var range = editor._createRange(sel);
editor._doc.execCommand("insertimage", false, param.f_url);
if (HTMLArea.is_ie) {
image = range.parentElement();
// wonder if this works...
if (image.tagName.toLowerCase() != "img") {
image = image.previousSibling;
}
} else {
image = range.startContainer.previousSibling;
}
} else {
image.src = param.f_url;
}
for (field in param) {
var value = param[field];
switch (field) {
case "f_alt" : image.alt = value; break;
case "f_border" : image.border = parseInt(value || "0"); break;
case "f_align" : image.align = value; break;
case "f_vert" : image.vspace = parseInt(value || "0"); break;
case "f_horiz" : image.hspace = parseInt(value || "0"); break;
case "f_width" : image.width = parseInt(value || "0"); break;
case "f_height" : image.height = parseInt(value || "0"); break;
}
}
}, outparam);
};

View File

@@ -1,6 +1,6 @@
// LANG: "de", ENCODING: UTF-8 | ISO-8859-1
// Sponsored by http://www.schaffrath-neuemedien.de
// Author: Udo Schmal (gocher), http://www.schaffrath-neuemedien.de/, udo.schmal@t-online.deUdo Schmal (gocher), <udo.schmal@t-online.de>
// Author: Udo Schmal (gocher), http://www.schaffrath-neuemedien.de/, udo.schmal@t-online.de
{
"The file you are uploading doesn't have the correct extension.": "Die hochgeladene Datei ist im falschen Format.",
"The file you are uploading already exists.": "Eine Datei mit diesem Namen existiert schon.",
@@ -8,5 +8,8 @@
"Images on the Server:": "Bilder auf dem Server:",
"Please select a file to upload.": "Wählen Sie eine Datei zum hochladen aus.",
"Upload file": "Datei hochladen",
"Open file in new window": "Datei in neuen Fenster anzeigen"
"Open file in new window": "Datei in neuen Fenster anzeigen",
"Size": "Größe",
"Width:": "Breite",
"Height:": "Höhe"
};

View File

@@ -0,0 +1,25 @@
// I18N constants
// LANG: "ja", ENCODING: UTF-8
{
"Insert Image": "画像の挿入",
"Image Preview:": "画像プレビュー:",
"Image URL:": "画像URL:",
"Preview": "表示",
"Alternate text:": "代替テキスト:",
"Layout": "レイアウト",
"Alignment:": "行揃え:",
"Border thickness:": "境界線の幅:",
"Spacing": "間隔",
"Horizontal:": "水平:",
"Vertical:": "垂直:",
"The file you are uploading doesn't have the correct extension.": "アップロード対象ファイルに正しい拡張子がありません。",
"The file you are uploading already exists.": "アップロード対象ファイルはすでに存在します。",
"The file you are uploading is to big. The max Filesize is": "アップロード対象ファイルは大きすぎます。ファイルサイズの上限:",
"Images on the Server:": "サーバ上の画像:",
"Please select a file to upload.": "アップロードするファイルを選択してください。",
"Upload file": "UPLOAD FILE",
"Open file in new window": "新しいウィンドウでファイルを開く",
"Size": "サイズ",
"Width:": "幅:",
"Height:": "高さ:"
};

View File

@@ -1,5 +1,4 @@
// LANG: "de", ENCODING: UTF-8 | ISO-8859-1
// Sponsored by http://www.schaffrath-neuemedien.de
// LANG: "nb", ENCODING: UTF-8 | ISO-8859-1
// translated: Kim Steinhaug, http://www.steinhaug.com/, kim@steinhaug.com
{
"Insert Image": "Sett inn bilde",
@@ -9,7 +8,7 @@
"Alternate text:": "Alternativ tekst",
"Layout": "Oppsett",
"Alignment:": "Plassering",
"Border thickness:": "Ramme tykkelse:",
"Border thickness:": "Rammetykkelse:",
"Spacing": "Luft rundt bildet",
"Horizontal:": "Horisontal:",
"Vertical:": "Vertikal:",
@@ -17,7 +16,7 @@
"The file you are uploading already exists.": "Bildet du prøver å laste opp eksisterer allerede på serveren",
"The file you are uploading is to big. The max Filesize is": "Bildet du laster opp er for stort, maks tillatt størrelse er",
"Images on the Server:": "Bilder på serveren:",
"Please select a file to upload.": "Velg bilde for opplastning til server",
"Please select a file to upload.": "Velg bilde du skal laste opp",
"Upload file": "Last opp bilde",
"Open file in new window": "Åpne bilde i nytt vindu"
};

View File

@@ -0,0 +1,35 @@
// I18N constants
// LANG: "sv", ENCODING: UTF-8
// Swedish version for rev. 477 (Mar 2006) by Thomas Loo <tloo@saltstorm.net>
{
"Insert Image": "Infoga bild",
"Image Preview:": "Förhandsgranskning:",
"Image URL:": "Bildens URL:",
"Preview": "Förhandsgranska",
"Alternate text:": "Alternativ text:",
"Layout": "Layout",
"Alignment:": "Placering:",
"Border thickness:": "Ramtjocklek:",
"Spacing": "Marginal",
"Horizontal:": "Horisontell:",
"Vertical:": "Vertikal:",
"The file you are uploading doesn't have the correct extension.": "Uppladdat bild har en ogiltig filändelse, uppladdning avbruten",
"The file you are uploading already exists.": "En fil med detta namn finns redan",
"The file you are uploading is to big. The max Filesize is": "Filen är för stor, maximal filstorlek är",
"Images on the Server:": "Bilder på servern:",
"Please select a file to upload.": "Välj bild att ladda upp",
"Upload file": "Ladda upp bild",
"Size": "Storlek",
"Width:": "Bredd:",
"Height:": "Höjd:",
// tooltips
"Enter the image URL here":"Bildens sökväg (URL)",
"Preview the image in a new window": "Öppna bild i nytt fönster",
"For browsers that don't support images":"Beskrivande text för webläsare som inte stödjer inbäddade bilder",
"Positioning of this image": "Bildens positionering",
"Leave empty for no border": "Lämna tomt för att undvika ram",
"Leave empty for not defined": "Lämna tomt för att låta webläsaren bestämma",
"Horizontal padding": "Horizontellt indrag på bild",
"Vertical padding": "Vertikalt indrag på bild"
};