forked from extern/egroupware
add new UploadImage plugin by Pim Snel ;)
This commit is contained in:
parent
c3cf8d5151
commit
60ec7792c9
BIN
phpgwapi/js/htmlarea/plugins/UploadImage/img/up_image.gif
Executable file
BIN
phpgwapi/js/htmlarea/plugins/UploadImage/img/up_image.gif
Executable file
Binary file not shown.
After Width: | Height: | Size: 148 B |
25
phpgwapi/js/htmlarea/plugins/UploadImage/lang/en.js
Executable file
25
phpgwapi/js/htmlarea/plugins/UploadImage/lang/en.js
Executable file
@ -0,0 +1,25 @@
|
||||
// I18N for the FullPage plugin
|
||||
|
||||
// LANG: "en", ENCODING: UTF-8 | ISO-8859-1
|
||||
// Author: Mihai Bazon, http://dynarch.com/mishoo
|
||||
|
||||
// FOR TRANSLATORS:
|
||||
//
|
||||
// 1. PLEASE PUT YOUR CONTACT INFO IN THE ABOVE LINE
|
||||
// (at least a valid email address)
|
||||
//
|
||||
// 2. PLEASE TRY TO USE UTF-8 FOR ENCODING;
|
||||
// (if this is not possible, please include a comment
|
||||
// that states what encoding is necessary.)
|
||||
|
||||
UploadImage.I18N = {
|
||||
"Alternate style-sheet:": "Alternate style-sheet:",
|
||||
"Background color:": "Background color:",
|
||||
"Cancel": "Cancel",
|
||||
"DOCTYPE:": "DOCTYPE:",
|
||||
"Document properties": "Document properties",
|
||||
"Document title:": "Document title:",
|
||||
"OK": "OK",
|
||||
"Primary style-sheet:": "Primary style-sheet:",
|
||||
"Text color:": "Text color:"
|
||||
};
|
25
phpgwapi/js/htmlarea/plugins/UploadImage/lang/nl.js
Normal file
25
phpgwapi/js/htmlarea/plugins/UploadImage/lang/nl.js
Normal file
@ -0,0 +1,25 @@
|
||||
// I18N for the FullPage plugin
|
||||
|
||||
// LANG: "en", ENCODING: UTF-8 | ISO-8859-1
|
||||
// Author: Mihai Bazon, http://dynarch.com/mishoo
|
||||
|
||||
// FOR TRANSLATORS:
|
||||
//
|
||||
// 1. PLEASE PUT YOUR CONTACT INFO IN THE ABOVE LINE
|
||||
// (at least a valid email address)
|
||||
//
|
||||
// 2. PLEASE TRY TO USE UTF-8 FOR ENCODING;
|
||||
// (if this is not possible, please include a comment
|
||||
// that states what encoding is necessary.)
|
||||
|
||||
UploadImage.I18N = {
|
||||
"Alternate style-sheet:": "Alternatieve style-sheet:",
|
||||
"Background color:": "Achtergrondkleur:",
|
||||
"Cancel": "Annuleren",
|
||||
"DOCTYPE:": "DOCTYPE:",
|
||||
"Document properties": "Documenteigenschappen ",
|
||||
"Document title:": "Documenttitel:",
|
||||
"OK": "Oké",
|
||||
"Primary style-sheet:": "Primaire style-sheet:",
|
||||
"Text color:": "Tekstkleur:"
|
||||
};
|
131
phpgwapi/js/htmlarea/plugins/UploadImage/popups/docprop.html
Executable file
131
phpgwapi/js/htmlarea/plugins/UploadImage/popups/docprop.html
Executable file
@ -0,0 +1,131 @@
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>Document properties</title>
|
||||
|
||||
<script type="text/javascript" src="../../../popups/popup.js"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
FullPage = window.opener.FullPage; // load the FullPage plugin and lang file ;-)
|
||||
window.resizeTo(400, 100);
|
||||
|
||||
var accepted = {
|
||||
f_doctype : true,
|
||||
f_title : true,
|
||||
f_body_bgcolor : true,
|
||||
f_body_fgcolor : true,
|
||||
f_base_style : true,
|
||||
f_alt_style : true
|
||||
};
|
||||
|
||||
var editor = null;
|
||||
function Init() {
|
||||
__dlg_translate(FullPage.I18N);
|
||||
__dlg_init();
|
||||
var params = window.dialogArguments;
|
||||
for (var i in params) {
|
||||
if (i in accepted) {
|
||||
var el = document.getElementById(i);
|
||||
el.value = params[i];
|
||||
}
|
||||
}
|
||||
editor = params.editor;
|
||||
document.getElementById("f_title").focus();
|
||||
document.getElementById("f_title").select();
|
||||
};
|
||||
|
||||
function onOK() {
|
||||
var required = {
|
||||
};
|
||||
for (var i in required) {
|
||||
var el = document.getElementById(i);
|
||||
if (!el.value) {
|
||||
alert(required[i]);
|
||||
el.focus();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
var param = {};
|
||||
for (var i in accepted) {
|
||||
var el = document.getElementById(i);
|
||||
param[i] = el.value;
|
||||
}
|
||||
__dlg_close(param);
|
||||
return false;
|
||||
};
|
||||
|
||||
function onCancel() {
|
||||
__dlg_close(null);
|
||||
return false;
|
||||
};
|
||||
|
||||
</script>
|
||||
|
||||
<style type="text/css">
|
||||
html, body {
|
||||
background: ButtonFace;
|
||||
color: ButtonText;
|
||||
font: 11px Tahoma,Verdana,sans-serif;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
}
|
||||
body { padding: 5px; }
|
||||
table {
|
||||
font: 11px Tahoma,Verdana,sans-serif;
|
||||
}
|
||||
select, input, button { font: 11px Tahoma,Verdana,sans-serif; }
|
||||
button { width: 70px; }
|
||||
table .label { text-align: right; width: 12em; }
|
||||
|
||||
.title { background: #ddf; color: #000; font-weight: bold; font-size: 120%; padding: 3px 10px; margin-bottom: 10px;
|
||||
border-bottom: 1px solid black; letter-spacing: 2px;
|
||||
}
|
||||
|
||||
#buttons {
|
||||
margin-top: 1em; border-top: 1px solid #999;
|
||||
padding: 2px; text-align: right;
|
||||
}
|
||||
</style>
|
||||
|
||||
</head>
|
||||
|
||||
<body onload="Init()">
|
||||
|
||||
<div class="title"><span>Document properties</span></div>
|
||||
|
||||
<table style="width: 100%">
|
||||
<tr>
|
||||
<td class="label"><span>Document title:</span></td>
|
||||
<td><input type="text" id="f_title" style="width: 100%" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label"><span>DOCTYPE:</span></td>
|
||||
<td><input type="text" id="f_doctype" style="width: 100%" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label"><span>Primary style-sheet:</span></td>
|
||||
<td><input type="text" id="f_base_style" style="width: 100%" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label"><span>Alternate style-sheet:</span></td>
|
||||
<td><input type="text" id="f_alt_style" style="width: 100%" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label"><span>Background color:</span></td>
|
||||
<td><input type="text" id="f_body_bgcolor" size="7" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label"><span>Text color:</span></td>
|
||||
<td><input type="text" id="f_body_fgcolor" size="7" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<div id="buttons">
|
||||
<button type="button" name="ok" onclick="return onOK();"><span>OK</span></button>
|
||||
<button type="button" name="cancel" onclick="return onCancel();"><span>Cancel</span></button>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
447
phpgwapi/js/htmlarea/plugins/UploadImage/popups/insert_image.php
Executable file
447
phpgwapi/js/htmlarea/plugins/UploadImage/popups/insert_image.php
Executable file
@ -0,0 +1,447 @@
|
||||
<?php
|
||||
/***********************************************************************
|
||||
** Title.........: Image Manager for HTMLArea 3.0 Alpha, PHP Version
|
||||
** Version.......: 1.01
|
||||
** Author........: Xiang Wei ZHUO <wei@zhuo.org>
|
||||
** Filename......: insert_image.php
|
||||
** Last changed..: 8 Mar 2003
|
||||
** Notes.........: Configuration in config.inc.php
|
||||
|
||||
- Only compatible with IE 5.5+
|
||||
|
||||
***********************************************************************/
|
||||
|
||||
include 'ImageManager/config.inc.php';
|
||||
$no_dir = false;
|
||||
if(!is_dir($BASE_DIR.$BASE_ROOT)) {
|
||||
$no_dir = true;
|
||||
}
|
||||
?>
|
||||
<html style="width: 580; height: 440;">
|
||||
<head>
|
||||
<title>Insert Image</title>
|
||||
<script type="text/javascript" src="popup.js"></script>
|
||||
<script type="text/javascript" src="../../../dialog.js"></script>
|
||||
<script type="text/javascript">
|
||||
var preview_window = null;
|
||||
|
||||
|
||||
|
||||
function Init() {
|
||||
|
||||
__dlg_init();
|
||||
var doc = MM_findObj("f_url");
|
||||
|
||||
if(doc != null) {
|
||||
doc.focus();
|
||||
}
|
||||
};
|
||||
|
||||
function onOK() {
|
||||
var required = {
|
||||
"f_url": "You must enter the URL",
|
||||
"f_alt": "Please enter the alternate text"
|
||||
};
|
||||
for (var i in required) {
|
||||
var el = MM_findObj(i);
|
||||
if (!el.value) {
|
||||
alert(required[i]);
|
||||
el.focus();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// pass data back to the calling window
|
||||
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];
|
||||
var el = MM_findObj(id);
|
||||
if(id == "f_url")
|
||||
param[id] = "<? echo 'http://'.$_SERVER['SERVER_NAME']; ?>" + el.value;
|
||||
else
|
||||
param[id] = el.value;
|
||||
}
|
||||
if (preview_window) {
|
||||
preview_window.close();
|
||||
}
|
||||
//alert(param);
|
||||
__dlg_close(param);
|
||||
return false;
|
||||
};
|
||||
|
||||
function onCancel() {
|
||||
if (preview_window) {
|
||||
preview_window.close();
|
||||
}
|
||||
__dlg_close(null);
|
||||
return false;
|
||||
};
|
||||
|
||||
</script>
|
||||
<style type="text/css">
|
||||
html, body {
|
||||
background: ButtonFace;
|
||||
color: ButtonText;
|
||||
font: 11px Tahoma,Verdana,sans-serif;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
}
|
||||
body { padding: 5px; }
|
||||
table {
|
||||
font: 11px Tahoma,Verdana,sans-serif;
|
||||
}
|
||||
form p {
|
||||
margin-top: 5px;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
.fl { width: 9em; float: left; padding: 2px 5px; text-align: right; }
|
||||
.fr { width: 6em; float: left; padding: 2px 5px; text-align: right; }
|
||||
fieldset { padding: 0px 10px 5px 5px; }
|
||||
select, input, button { font: 11px Tahoma,Verdana,sans-serif; }
|
||||
button { width: 70px; }
|
||||
.space { padding: 2px; }
|
||||
|
||||
.title { background: #ddf; color: #000; font-weight: bold; font-size: 120%; padding: 3px 10px; margin-bottom: 10px;
|
||||
border-bottom: 1px solid black; letter-spacing: 2px;
|
||||
}
|
||||
form { padding: 0px; margin: 0px; }
|
||||
</style>
|
||||
<style type="text/css">
|
||||
<!--
|
||||
.buttonHover {
|
||||
border: 1px solid;
|
||||
border-color: ButtonHighlight ButtonShadow ButtonShadow ButtonHighlight;
|
||||
cursor: hand;
|
||||
}
|
||||
.buttonOut
|
||||
{
|
||||
border: 1px solid ButtonFace;
|
||||
}
|
||||
|
||||
.separator {
|
||||
position: relative;
|
||||
margin: 3px;
|
||||
border-left: 1px solid ButtonShadow;
|
||||
border-right: 1px solid ButtonHighlight;
|
||||
width: 0px;
|
||||
height: 16px;
|
||||
padding: 0px;
|
||||
}
|
||||
.manager
|
||||
{
|
||||
}
|
||||
.statusLayer
|
||||
{
|
||||
background:#FFFFFF;
|
||||
border: 1px solid #CCCCCC;
|
||||
}
|
||||
.statusText {
|
||||
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||
font-size: 15px;
|
||||
font-weight: bold;
|
||||
color: #6699CC;
|
||||
text-decoration: none;
|
||||
}
|
||||
-->
|
||||
</style>
|
||||
<script language="JavaScript" type="text/JavaScript">
|
||||
<!--
|
||||
function pviiClassNew(obj, new_style) { //v2.6 by PVII
|
||||
obj.className=new_style;
|
||||
}
|
||||
function goUpDir()
|
||||
{
|
||||
var selection = document.forms[0].dirPath;
|
||||
var dir = selection.options[selection.selectedIndex].value;
|
||||
if(dir != '/')
|
||||
{
|
||||
imgManager.goUp();
|
||||
changeLoadingStatus('load');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function updateDir(selection)
|
||||
{
|
||||
var newDir = selection.options[selection.selectedIndex].value;
|
||||
imgManager.changeDir(newDir);
|
||||
changeLoadingStatus('load');
|
||||
}
|
||||
|
||||
function newFolder()
|
||||
{
|
||||
var selection = document.forms[0].dirPath;
|
||||
var dir = selection.options[selection.selectedIndex].value;
|
||||
Dialog("ImageManager/newFolder.html", function(param) {
|
||||
if (!param) { // user must have pressed Cancel
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
var folder = param['f_foldername'];
|
||||
if (folder && folder != '') {
|
||||
imgManager.newFolder(dir,folder);
|
||||
}
|
||||
}
|
||||
}, null);
|
||||
}
|
||||
|
||||
function toggleConstrains(constrains)
|
||||
{
|
||||
if(constrains.checked)
|
||||
{
|
||||
document.locked_img.src = "ImageManager/locked.gif";
|
||||
checkConstrains('width')
|
||||
}
|
||||
else
|
||||
{
|
||||
document.locked_img.src = "ImageManager/unlocked.gif";
|
||||
}
|
||||
}
|
||||
|
||||
function checkConstrains(changed)
|
||||
{
|
||||
//alert(document.form1.constrain_prop);
|
||||
var constrained = document.form1.constrain_prop.checked;
|
||||
|
||||
if(constrained)
|
||||
{
|
||||
var orginal_width = parseInt(document.form1.orginal_width.value);
|
||||
var orginal_height = parseInt(document.form1.orginal_height.value);
|
||||
|
||||
var width = parseInt(document.form1.f_width.value);
|
||||
var height = parseInt(document.form1.f_height.value);
|
||||
|
||||
if(orginal_width > 0 && orginal_height > 0)
|
||||
{
|
||||
if(changed == 'width' && width > 0) {
|
||||
document.form1.f_height.value = parseInt((width/orginal_width)*orginal_height);
|
||||
}
|
||||
|
||||
if(changed == 'height' && height > 0) {
|
||||
document.form1.f_width.value = parseInt((height/orginal_height)*orginal_width);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function MM_findObj(n, d) { //v4.01
|
||||
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
|
||||
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
|
||||
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
|
||||
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
|
||||
if(!x && d.getElementById) x=d.getElementById(n); return x;
|
||||
}
|
||||
|
||||
function P7_Snap() { //v2.62 by PVII
|
||||
var x,y,ox,bx,oy,p,tx,a,b,k,d,da,e,el,args=P7_Snap.arguments;a=parseInt(a);
|
||||
for (k=0; k<(args.length-3); k+=4)
|
||||
if ((g=MM_findObj(args[k]))!=null) {
|
||||
el=eval(MM_findObj(args[k+1]));
|
||||
a=parseInt(args[k+2]);b=parseInt(args[k+3]);
|
||||
x=0;y=0;ox=0;oy=0;p="";tx=1;da="document.all['"+args[k]+"']";
|
||||
if(document.getElementById) {
|
||||
d="document.getElementsByName('"+args[k]+"')[0]";
|
||||
if(!eval(d)) {d="document.getElementById('"+args[k]+"')";if(!eval(d)) {d=da;}}
|
||||
}else if(document.all) {d=da;}
|
||||
if (document.all || document.getElementById) {
|
||||
while (tx==1) {p+=".offsetParent";
|
||||
if(eval(d+p)) {x+=parseInt(eval(d+p+".offsetLeft"));y+=parseInt(eval(d+p+".offsetTop"));
|
||||
}else{tx=0;}}
|
||||
ox=parseInt(g.offsetLeft);oy=parseInt(g.offsetTop);var tw=x+ox+y+oy;
|
||||
if(tw==0 || (navigator.appVersion.indexOf("MSIE 4")>-1 && navigator.appVersion.indexOf("Mac")>-1)) {
|
||||
ox=0;oy=0;if(g.style.left){x=parseInt(g.style.left);y=parseInt(g.style.top);
|
||||
}else{var w1=parseInt(el.style.width);bx=(a<0)?-5-w1:-10;
|
||||
a=(Math.abs(a)<1000)?0:a;b=(Math.abs(b)<1000)?0:b;
|
||||
x=document.body.scrollLeft + event.clientX + bx;
|
||||
y=document.body.scrollTop + event.clientY;}}
|
||||
}else if (document.layers) {x=g.x;y=g.y;var q0=document.layers,dd="";
|
||||
for(var s=0;s<q0.length;s++) {dd='document.'+q0[s].name;
|
||||
if(eval(dd+'.document.'+args[k])) {x+=eval(dd+'.left');y+=eval(dd+'.top');break;}}}
|
||||
if(el) {e=(document.layers)?el:el.style;
|
||||
var xx=parseInt(x+ox+a),yy=parseInt(y+oy+b);
|
||||
if(navigator.appName=="Netscape" && parseInt(navigator.appVersion)>4){xx+="px";yy+="px";}
|
||||
if(navigator.appVersion.indexOf("MSIE 5")>-1 && navigator.appVersion.indexOf("Mac")>-1){
|
||||
xx+=parseInt(document.body.leftMargin);yy+=parseInt(document.body.topMargin);
|
||||
xx+="px";yy+="px";}e.left=xx;e.top=yy;}}
|
||||
}
|
||||
|
||||
function MM_showHideLayers() { //v6.0
|
||||
var i,p,v,obj,args=MM_showHideLayers.arguments;
|
||||
for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
|
||||
if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
|
||||
obj.visibility=v; }
|
||||
}
|
||||
|
||||
function changeLoadingStatus(state)
|
||||
{
|
||||
var statusText = null;
|
||||
if(state == 'load') {
|
||||
statusText = 'Loading Images';
|
||||
}
|
||||
else if(state == 'upload') {
|
||||
statusText = 'Uploading Files';
|
||||
}
|
||||
if(statusText != null) {
|
||||
var obj = MM_findObj('loadingStatus');
|
||||
if (obj != null && obj.innerHTML != null)
|
||||
obj.innerHTML = statusText;
|
||||
MM_showHideLayers('loading','','show')
|
||||
}
|
||||
}
|
||||
|
||||
function refresh()
|
||||
{
|
||||
var selection = document.forms[0].dirPath;
|
||||
updateDir(selection);
|
||||
}
|
||||
|
||||
|
||||
//-->
|
||||
</script>
|
||||
</head>
|
||||
<body onload="Init(); P7_Snap('dirPath','loading',120,70);">
|
||||
<div class="title">Insert Image</div>
|
||||
<form action="ImageManager/images.php" name="form1" method="post" target="imgManager" enctype="multipart/form-data">
|
||||
<div id="loading" style="position:absolute; left:200px; top:130px; width:184px; height:48px; z-index:1" class="statusLayer">
|
||||
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><div align="center"><span id="loadingStatus" class="statusText">Loading Images</span><img src="ImageManager/dots.gif" width="22" height="12"></div></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<table width="100%" border="0" align="center" cellspacing="2" cellpadding="2">
|
||||
<tr>
|
||||
<td align="center"> <fieldset>
|
||||
<legend>Image Manager</legend>
|
||||
<table width="99%" align="center" border="0" cellspacing="2" cellpadding="2">
|
||||
<tr>
|
||||
<td><table border="0" cellspacing="1" cellpadding="3">
|
||||
<tr>
|
||||
<td>Directory</td>
|
||||
<td>
|
||||
<select name="dirPath" id="dirPath" style="width:30em" onChange="updateDir(this)">
|
||||
<option value="/">/</option>
|
||||
<?
|
||||
|
||||
|
||||
function dirs($dir,$abs_path)
|
||||
{
|
||||
$d = dir($dir);
|
||||
$dirs = array();
|
||||
while (false !== ($entry = $d->read())) {
|
||||
if(is_dir($dir.'/'.$entry) && substr($entry,0,1) != '.')
|
||||
{
|
||||
$path['path'] = $dir.'/'.$entry;
|
||||
$path['name'] = $entry;
|
||||
$dirs[$entry] = $path;
|
||||
}
|
||||
}
|
||||
$d->close();
|
||||
|
||||
ksort($dirs);
|
||||
for($i=0; $i<count($dirs); $i++)
|
||||
{
|
||||
$name = key($dirs);
|
||||
$current_dir = $abs_path.'/'.$dirs[$name]['name'];
|
||||
echo "<option value=\"$current_dir\">$current_dir</option>\n";
|
||||
dirs($dirs[$name]['path'],$current_dir);
|
||||
next($dirs);
|
||||
}
|
||||
}
|
||||
|
||||
if($no_dir == false) {
|
||||
dirs($BASE_DIR.$BASE_ROOT,'');
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</td>
|
||||
<td class="buttonOut" onMouseOver="pviiClassNew(this,'buttonHover')" onMouseOut="pviiClassNew(this,'buttonOut')">
|
||||
<a href="#" onClick="javascript:goUpDir();"><img src="ImageManager/btnFolderUp.gif" width="15" height="15" border="0" alt="Up"></a></td>
|
||||
<? if ($SAFE_MODE == false) { ?>
|
||||
<td><div class="separator"></div></td>
|
||||
<td class="buttonOut" onMouseOver="pviiClassNew(this,'buttonHover')" onMouseOut="pviiClassNew(this,'buttonOut')">
|
||||
<a href="#" onClick="javascript:newFolder();"><img src="ImageManager/btnFolderNew.gif" width="15" height="15" border="0" alt="New Folder"></a></td>
|
||||
<? } ?>
|
||||
</tr>
|
||||
</table></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center" bgcolor="white"><div name="manager" class="manager">
|
||||
<iframe src="ImageManager/images.php" name="imgManager" id="imgManager" width="520" height="150" marginwidth="0" marginheight="0" align="top" scrolling="auto" frameborder="0" hspace="0" vspace="0" background="white"></iframe>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><table border="0" align="center" cellpadding="2" cellspacing="2">
|
||||
<tr>
|
||||
<td nowrap><div align="right">Image File </div></td>
|
||||
<td><input name="url" id="f_url" type="text" style="width:20em" size="30"></td>
|
||||
<td rowspan="3"> </td>
|
||||
<td><div align="right">Width </div></td>
|
||||
<td><input name="width" id="f_width" type="text" size="5" style="width:4em" onChange="javascript:checkConstrains('width');"></td>
|
||||
<td rowspan="2"><img src="ImageManager/locked.gif" name="locked_img" width="25" height="32" id="locked_img" alt="Locked"></td>
|
||||
<td rowspan="3"> </td>
|
||||
<td><div align="right">V Space</div></td>
|
||||
<td><input name="vert" id="f_vert" type="text" size="5" style="width:4em"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap><div align="right">Alt </div></td>
|
||||
<td><input type="text" style="width:20em" name="alt" id="f_alt"></td>
|
||||
<td><div align="right">Height </div></td>
|
||||
<td><input name="height" id="f_height" type="text" size="5" style="width:4em" onChange="javascript:checkConstrains('height');"></td>
|
||||
<td><div align="right">H Space</div></td>
|
||||
<td><input name="horiz" id="f_horiz" type="text" size="5" style="width:4em"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><div align="right">Upload </div></td>
|
||||
<td><input type="file" name="upload" id="upload">
|
||||
<input type="submit" style="width:5em" value="Upload" onClick="javascript:changeLoadingStatus('upload');" />
|
||||
</td>
|
||||
<td><div align="right">Align</div></td>
|
||||
<td colspan="2"><select name="align" ID="f_align" style="width:7em">
|
||||
<OPTION id="optNotSet" value=""> Not set </OPTION>
|
||||
<OPTION id="optLeft" value="left"> Left </OPTION>
|
||||
<OPTION id="optRight" value="right"> Right </OPTION>
|
||||
<OPTION id="optTexttop" value="textTop"> Texttop </OPTION>
|
||||
<OPTION id="optAbsMiddle" value="absMiddle"> Absmiddle </OPTION>
|
||||
<OPTION id="optBaseline" value="baseline" SELECTED> Baseline </OPTION>
|
||||
<OPTION id="optAbsBottom" value="absBottom"> Absbottom </OPTION>
|
||||
<OPTION id="optBottom" value="bottom"> Bottom </OPTION>
|
||||
<OPTION id="optMiddle" value="middle"> Middle </OPTION>
|
||||
<OPTION id="optTop" value="top"> Top </OPTION>
|
||||
</select></td>
|
||||
<td><div align="right">Border</div></td>
|
||||
<td><input name="border" id="f_border" type="text" size="5" style="width:4em"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3"> </td>
|
||||
<td><div align="right">
|
||||
<input type="hidden" name="orginal_width" id="orginal_width">
|
||||
<input type="hidden" name="orginal_height" id="orginal_height">
|
||||
<input type="checkbox" name="constrain_prop" id="constrain_prop" checked onClick="javascript:toggleConstrains(this);">
|
||||
</div></td>
|
||||
<td colspan="5">Constrain Proportions</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><div style="text-align: right;">
|
||||
<hr />
|
||||
<button type="button" name="ok" onclick="return refresh();">Refresh</button>
|
||||
<button type="button" name="ok" onclick="return onOK();">OK</button>
|
||||
<button type="button" name="cancel" onclick="return onCancel();">Cancel</button>
|
||||
</div></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
216
phpgwapi/js/htmlarea/plugins/UploadImage/popups/insert_image2.html
Executable file
216
phpgwapi/js/htmlarea/plugins/UploadImage/popups/insert_image2.html
Executable file
@ -0,0 +1,216 @@
|
||||
<html style="width: 398; height: 218">
|
||||
|
||||
<head>
|
||||
<title>Insert Image</title>
|
||||
|
||||
<script type="text/javascript" src="popup.js"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
var preview_window = null;
|
||||
|
||||
function Init() {
|
||||
__dlg_init();
|
||||
document.getElementById("f_url").focus();
|
||||
};
|
||||
|
||||
function onOK() {
|
||||
var required = {
|
||||
"f_url": "You must enter the URL",
|
||||
"f_alt": "Please enter the alternate text"
|
||||
};
|
||||
for (var i in required) {
|
||||
var el = document.getElementById(i);
|
||||
if (!el.value) {
|
||||
alert(required[i]);
|
||||
el.focus();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// pass data back to the calling window
|
||||
var fields = ["f_url", "f_alt", "f_align", "f_border",
|
||||
"f_horiz", "f_vert"];
|
||||
var param = new Object();
|
||||
for (var i in fields) {
|
||||
var id = fields[i];
|
||||
var el = document.getElementById(id);
|
||||
param[id] = el.value;
|
||||
}
|
||||
if (preview_window) {
|
||||
preview_window.close();
|
||||
}
|
||||
__dlg_close(param);
|
||||
return false;
|
||||
};
|
||||
|
||||
function onCancel() {
|
||||
if (preview_window) {
|
||||
preview_window.close();
|
||||
}
|
||||
__dlg_close(null);
|
||||
return false;
|
||||
};
|
||||
|
||||
function onPreview() {
|
||||
alert("FIXME: preview needs rewritten:\n show the image inside this window instead of opening a new one.");
|
||||
var f_url = document.getElementById("f_url");
|
||||
var url = f_url.value;
|
||||
if (!url) {
|
||||
alert("You have to enter an URL first");
|
||||
f_url.focus();
|
||||
return false;
|
||||
}
|
||||
var img = new Image();
|
||||
img.src = url;
|
||||
var win = null;
|
||||
if (!document.all) {
|
||||
win = window.open("about:blank", "ha_imgpreview", "toolbar=no,menubar=no,personalbar=no,innerWidth=100,innerHeight=100,scrollbars=no,resizable=yes");
|
||||
} else {
|
||||
win = window.open("about:blank", "ha_imgpreview", "channelmode=no,directories=no,height=100,width=100,location=no,menubar=no,resizable=yes,scrollbars=no,toolbar=no");
|
||||
}
|
||||
preview_window = win;
|
||||
var doc = win.document;
|
||||
var body = doc.body;
|
||||
if (body) {
|
||||
body.innerHTML = "";
|
||||
body.style.padding = "0px";
|
||||
body.style.margin = "0px";
|
||||
var el = doc.createElement("img");
|
||||
el.src = url;
|
||||
|
||||
var table = doc.createElement("table");
|
||||
body.appendChild(table);
|
||||
table.style.width = "100%";
|
||||
table.style.height = "100%";
|
||||
var tbody = doc.createElement("tbody");
|
||||
table.appendChild(tbody);
|
||||
var tr = doc.createElement("tr");
|
||||
tbody.appendChild(tr);
|
||||
var td = doc.createElement("td");
|
||||
tr.appendChild(td);
|
||||
td.style.textAlign = "center";
|
||||
|
||||
td.appendChild(el);
|
||||
win.resizeTo(el.offsetWidth + 30, el.offsetHeight + 30);
|
||||
}
|
||||
win.focus();
|
||||
return false;
|
||||
};
|
||||
</script>
|
||||
|
||||
<style type="text/css">
|
||||
html, body {
|
||||
background: ButtonFace;
|
||||
color: ButtonText;
|
||||
font: 11px Tahoma,Verdana,sans-serif;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
}
|
||||
body { padding: 5px; }
|
||||
table {
|
||||
font: 11px Tahoma,Verdana,sans-serif;
|
||||
}
|
||||
form p {
|
||||
margin-top: 5px;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
.fl { width: 9em; float: left; padding: 2px 5px; text-align: right; }
|
||||
.fr { width: 6em; float: left; padding: 2px 5px; text-align: right; }
|
||||
fieldset { padding: 0px 10px 5px 5px; }
|
||||
select, input, button { font: 11px Tahoma,Verdana,sans-serif; }
|
||||
button { width: 70px; }
|
||||
.space { padding: 2px; }
|
||||
|
||||
.title { background: #ddf; color: #000; font-weight: bold; font-size: 120%; padding: 3px 10px; margin-bottom: 10px;
|
||||
border-bottom: 1px solid black; letter-spacing: 2px;
|
||||
}
|
||||
form { padding: 0px; margin: 0px; }
|
||||
</style>
|
||||
|
||||
</head>
|
||||
|
||||
<body onload="Init()">
|
||||
|
||||
<div class="title">Insert Image</div>
|
||||
|
||||
<form action="" method="get">
|
||||
<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" />
|
||||
<button name="preview" onclick="return onPreview();"
|
||||
title="Preview the image in a new window">Preview</button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width: 7em; text-align: right">Alternate text:</td>
|
||||
<td><input type="text" name="alt" id="f_alt" style="width:100%"
|
||||
title="For browsers that don't support images" /></td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<p />
|
||||
|
||||
<fieldset style="float: left; margin-left: 5px;">
|
||||
<legend>Layout</legend>
|
||||
|
||||
<div class="space"></div>
|
||||
|
||||
<div class="fl">Alignment:</div>
|
||||
<select size="1" name="align" id="f_align"
|
||||
title="Positioning of this image">
|
||||
<option value="" >Not set</option>
|
||||
<option value="left" >Left</option>
|
||||
<option value="right" >Right</option>
|
||||
<option value="texttop" >Texttop</option>
|
||||
<option value="absmiddle" >Absmiddle</option>
|
||||
<option value="baseline" selected="1" >Baseline</option>
|
||||
<option value="absbottom" >Absbottom</option>
|
||||
<option value="bottom" >Bottom</option>
|
||||
<option value="middle" >Middle</option>
|
||||
<option value="top" >Top</option>
|
||||
</select>
|
||||
|
||||
<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="space"></div>
|
||||
|
||||
</fieldset>
|
||||
|
||||
<fieldset style="float:right; margin-right: 5px;">
|
||||
<legend>Spacing</legend>
|
||||
|
||||
<div class="space"></div>
|
||||
|
||||
<div class="fr">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="space"></div>
|
||||
|
||||
</fieldset>
|
||||
|
||||
<div style="margin-top: 85px; text-align: right;">
|
||||
<hr />
|
||||
<button type="button" name="ok" onclick="return onOK();">OK</button>
|
||||
<button type="button" name="cancel" onclick="return onCancel();">Cancel</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
</body>
|
||||
</html>
|
50
phpgwapi/js/htmlarea/plugins/UploadImage/popups/popup.js
Executable file
50
phpgwapi/js/htmlarea/plugins/UploadImage/popups/popup.js
Executable file
@ -0,0 +1,50 @@
|
||||
function __dlg_onclose() {
|
||||
if (!document.all) {
|
||||
opener.Dialog._return(null);
|
||||
}
|
||||
};
|
||||
|
||||
function __dlg_init() {
|
||||
|
||||
if (!document.all) {
|
||||
// init dialogArguments, as IE gets it
|
||||
window.dialogArguments = opener.Dialog._arguments;
|
||||
window.sizeToContent();
|
||||
window.sizeToContent(); // for reasons beyond understanding,
|
||||
// only if we call it twice we get the
|
||||
// correct size.
|
||||
window.addEventListener("unload", __dlg_onclose, true);
|
||||
/*
|
||||
// center on parent
|
||||
var px1 = opener.screenX;
|
||||
var px2 = opener.screenX + opener.outerWidth;
|
||||
var py1 = opener.screenY;
|
||||
var py2 = opener.screenY + opener.outerHeight;
|
||||
var x = (px2 - px1 - window.outerWidth) / 2;
|
||||
var y = (py2 - py1 - window.outerHeight) / 2; */
|
||||
|
||||
//centre on screen instead
|
||||
|
||||
var x = (screen.width - window.outerWidth) / 2;
|
||||
var y = (screen.height - window.outerHeight) / 2;
|
||||
|
||||
window.moveTo(x, y);
|
||||
var body = document.body;
|
||||
window.innerHeight = body.offsetHeight;
|
||||
window.innerWidth = body.offsetWidth;
|
||||
} else {
|
||||
var body = document.body;
|
||||
window.dialogHeight = body.offsetHeight + 50 + "px";
|
||||
window.dialogWidth = body.offsetWidth + "px";
|
||||
}
|
||||
};
|
||||
|
||||
// closes the dialog and passes the return info upper.
|
||||
function __dlg_close(val) {
|
||||
if (document.all) { // IE
|
||||
window.returnValue = val;
|
||||
} else {
|
||||
opener.Dialog._return(val);
|
||||
}
|
||||
window.close();
|
||||
};
|
153
phpgwapi/js/htmlarea/plugins/UploadImage/upload-image.js
Executable file
153
phpgwapi/js/htmlarea/plugins/UploadImage/upload-image.js
Executable file
@ -0,0 +1,153 @@
|
||||
// UploadImage Plugin for HTMLArea-3.0
|
||||
// Implementation by Mihai Bazon. Sponsored by http://thycotic.com
|
||||
//
|
||||
// htmlArea v3.0 - Copyright (c) 2002 interactivetools.com, inc.
|
||||
// This notice MUST stay intact for use (see license.txt).
|
||||
//
|
||||
// A free WYSIWYG editor replacement for <textarea> fields.
|
||||
// For full source code and docs, visit http://www.interactivetools.com/
|
||||
//
|
||||
// Version 3.0 developed by Mihai Bazon for InteractiveTools.
|
||||
// http://dynarch.com/mishoo
|
||||
//
|
||||
// $Id$
|
||||
|
||||
function UploadImage(editor) {
|
||||
this.editor = editor;
|
||||
|
||||
var cfg = editor.config;
|
||||
cfg.fullPage = true;
|
||||
var tt = UploadImage.I18N;
|
||||
var self = this;
|
||||
|
||||
cfg.registerButton("FP-docprop", tt["Document properties"], editor.imgURL("up_image.gif", "UploadImage"), false,
|
||||
function(editor, id) {
|
||||
self.buttonPress(editor, id);
|
||||
});
|
||||
|
||||
// add a new line in the toolbar
|
||||
cfg.toolbar[0].splice(0, 0, "separator");
|
||||
cfg.toolbar[0].splice(0, 0, "FP-docprop");
|
||||
};
|
||||
|
||||
UploadImage._pluginInfo = {
|
||||
name : "UploadImage",
|
||||
version : "1.0",
|
||||
developer : "Pim Snel",
|
||||
developer_url : "http://lingewoud.com",
|
||||
c_owner : "Mihai Bazon",
|
||||
sponsor : "Lingewoud b.v. - Netherlands",
|
||||
sponsor_url : "http://lingewoud.com",
|
||||
license : "GPL"
|
||||
};
|
||||
|
||||
UploadImage.prototype.buttonPress = function(editor, id)
|
||||
{
|
||||
var self = this;
|
||||
switch (id)
|
||||
{
|
||||
case "FP-docprop":
|
||||
var doc = editor._doc;
|
||||
var links = doc.getElementsByTagName("link");
|
||||
var style1 = '';
|
||||
var style2 = '';
|
||||
for (var i = links.length; --i >= 0;)
|
||||
{
|
||||
var link = links[i];
|
||||
if (/stylesheet/i.test(link.rel))
|
||||
{
|
||||
if (/alternate/i.test(link.rel))
|
||||
style2 = link.href;
|
||||
else
|
||||
style1 = link.href;
|
||||
}
|
||||
}
|
||||
var title = doc.getElementsByTagName("title")[0];
|
||||
title = title ? title.innerHTML : '';
|
||||
var init =
|
||||
{
|
||||
f_doctype : editor.doctype,
|
||||
f_title : title,
|
||||
f_body_bgcolor : HTMLArea._colorToRgb(doc.body.style.backgroundColor),
|
||||
f_body_fgcolor : HTMLArea._colorToRgb(doc.body.style.color),
|
||||
f_base_style : style1,
|
||||
f_alt_style : style2,
|
||||
|
||||
editor : editor
|
||||
};
|
||||
Dialog(_editor_url+"plugins/UploadImage/popups/insert_image.php", function(params)
|
||||
{
|
||||
self.setDocProp(params);
|
||||
}, init);
|
||||
|
||||
/* editor._popupDialog("plugin://UploadImage/insert_image.php", function(params) {
|
||||
self.setDocProp(params);
|
||||
}, init);*/
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
UploadImage.prototype.setDocProp = function(params) {
|
||||
var txt = "";
|
||||
var doc = this.editor._doc;
|
||||
var head = doc.getElementsByTagName("head")[0];
|
||||
var links = doc.getElementsByTagName("link");
|
||||
var style1 = null;
|
||||
var style2 = null;
|
||||
for (var i = links.length; --i >= 0;) {
|
||||
var link = links[i];
|
||||
if (/stylesheet/i.test(link.rel)) {
|
||||
if (/alternate/i.test(link.rel))
|
||||
style2 = link;
|
||||
else
|
||||
style1 = link;
|
||||
}
|
||||
}
|
||||
function createLink(alt) {
|
||||
var link = doc.createElement("link");
|
||||
link.rel = alt ? "alternate stylesheet" : "stylesheet";
|
||||
head.appendChild(link);
|
||||
return link;
|
||||
};
|
||||
|
||||
if (!style1 && params.f_base_style)
|
||||
style1 = createLink(false);
|
||||
if (params.f_base_style)
|
||||
style1.href = params.f_base_style;
|
||||
else if (style1)
|
||||
head.removeChild(style1);
|
||||
|
||||
if (!style2 && params.f_alt_style)
|
||||
style2 = createLink(true);
|
||||
if (params.f_alt_style)
|
||||
style2.href = params.f_alt_style;
|
||||
else if (style2)
|
||||
head.removeChild(style2);
|
||||
|
||||
for (var i in params) {
|
||||
var val = params[i];
|
||||
switch (i) {
|
||||
case "f_title":
|
||||
var title = doc.getElementsByTagName("title")[0];
|
||||
if (!title) {
|
||||
title = doc.createElement("title");
|
||||
head.appendChild(title);
|
||||
} else while (node = title.lastChild)
|
||||
title.removeChild(node);
|
||||
if (!HTMLArea.is_ie)
|
||||
title.appendChild(doc.createTextNode(val));
|
||||
else
|
||||
doc.title = val;
|
||||
break;
|
||||
case "f_doctype":
|
||||
this.editor.setDoctype(val);
|
||||
break;
|
||||
case "f_body_bgcolor":
|
||||
doc.body.style.backgroundColor = val;
|
||||
break;
|
||||
case "f_body_fgcolor":
|
||||
doc.body.style.color = val;
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
Loading…
Reference in New Issue
Block a user