a nice filemanager for tinymce
489
phpgwapi/js/tinymce/jscripts/tiny_mce/plugins/filemanager/InsertFile/GD.php
vendored
Normal file
@ -0,0 +1,489 @@
|
||||
<?php
|
||||
/***********************************************************************
|
||||
** Title.........: GD Driver
|
||||
** Version.......: 1.0
|
||||
** Author........: Xiang Wei ZHUO <wei@zhuo.org>
|
||||
** Filename......: GD.php
|
||||
** Last changed..: 30 Aug 2003
|
||||
** Notes.........: Orginal is from PEAR
|
||||
**/
|
||||
// +----------------------------------------------------------------------+
|
||||
// | PHP Version 4 |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 1997-2002 The PHP Group |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | This source file is subject to version 2.02 of the PHP license, |
|
||||
// | that is bundled with this package in the file LICENSE, and is |
|
||||
// | available at through the world-wide-web at |
|
||||
// | http://www.php.net/license/2_02.txt. |
|
||||
// | If you did not receive a copy of the PHP license and are unable to |
|
||||
// | obtain it through the world-wide-web, please send a note to |
|
||||
// | license@php.net so we can mail you a copy immediately. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Authors: Peter Bowyer <peter@mapledesign.co.uk> |
|
||||
// | Alan Knowles <alan@akbkhome.com> |
|
||||
// +----------------------------------------------------------------------+
|
||||
//
|
||||
// Usage :
|
||||
// $img = new Image_Transform_GD();
|
||||
// $angle = -78;
|
||||
// $img->load('magick.png');
|
||||
//
|
||||
// if($img->rotate($angle,array('autoresize'=>true,'color_mask'=>array(255,0,0)))){
|
||||
// $img->addText(array('text'=>"Rotation $angle",'x'=>0,'y'=>100,'font'=>'/usr/share/fonts/default/TrueType/cogb____.ttf'));
|
||||
// $img->display();
|
||||
// } else {
|
||||
// echo "Error";
|
||||
// }
|
||||
//
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
// Image Transformation interface using the GD library
|
||||
//
|
||||
|
||||
require_once "Transform.php";
|
||||
|
||||
Class Image_Transform_Driver_GD extends Image_Transform
|
||||
{
|
||||
/**
|
||||
* Holds the image file for manipulation
|
||||
*/
|
||||
var $imageHandle = '';
|
||||
|
||||
/**
|
||||
* Holds the original image file
|
||||
*/
|
||||
var $old_image = '';
|
||||
|
||||
/**
|
||||
* Check settings
|
||||
*
|
||||
* @return mixed true or or a PEAR error object on error
|
||||
*
|
||||
* @see PEAR::isError()
|
||||
*/
|
||||
function Image_Transform_GD()
|
||||
{
|
||||
return;
|
||||
} // End function Image
|
||||
|
||||
/**
|
||||
* Load image
|
||||
*
|
||||
* @param string filename
|
||||
*
|
||||
* @return mixed none or a PEAR error object on error
|
||||
* @see PEAR::isError()
|
||||
*/
|
||||
function load($image)
|
||||
{
|
||||
$this->uid = md5($_SERVER['REMOTE_ADDR']);
|
||||
$this->image = $image;
|
||||
$this->_get_image_details($image);
|
||||
$functionName = 'ImageCreateFrom' . $this->type;
|
||||
$this->imageHandle = $functionName($this->image);
|
||||
} // End load
|
||||
|
||||
/**
|
||||
* addText
|
||||
*
|
||||
* @param array options Array contains options
|
||||
* array(
|
||||
* 'text' The string to draw
|
||||
* 'x' Horizontal position
|
||||
* 'y' Vertical Position
|
||||
* 'Color' Font color
|
||||
* 'font' Font to be used
|
||||
* 'size' Size of the fonts in pixel
|
||||
* 'resize_first' Tell if the image has to be resized
|
||||
* before drawing the text
|
||||
* )
|
||||
*
|
||||
* @return none
|
||||
* @see PEAR::isError()
|
||||
*/
|
||||
function addText($params)
|
||||
{
|
||||
$default_params = array(
|
||||
'text' => 'This is Text',
|
||||
'x' => 10,
|
||||
'y' => 20,
|
||||
'color' => array(255,0,0),
|
||||
'font' => 'Arial.ttf',
|
||||
'size' => '12',
|
||||
'angle' => 0,
|
||||
'resize_first' => false // Carry out the scaling of the image before annotation? Not used for GD
|
||||
);
|
||||
$params = array_merge($default_params, $params);
|
||||
extract($params);
|
||||
|
||||
if( !is_array($color) ){
|
||||
if ($color[0]=='#'){
|
||||
$this->colorhex2colorarray( $color );
|
||||
} else {
|
||||
include_once('Image/Transform/Driver/ColorsDefs.php');
|
||||
$color = isset($colornames[$color])?$colornames[$color]:false;
|
||||
}
|
||||
}
|
||||
|
||||
$c = imagecolorresolve ($this->imageHandle, $color[0], $color[1], $color[2]);
|
||||
|
||||
if ('ttf' == substr($font, -3)) {
|
||||
ImageTTFText($this->imageHandle, $size, $angle, $x, $y, $c, $font, $text);
|
||||
} else {
|
||||
ImagePSText($this->imageHandle, $size, $angle, $x, $y, $c, $font, $text);
|
||||
}
|
||||
return true;
|
||||
} // End addText
|
||||
|
||||
|
||||
/**
|
||||
* Rotate image by the given angle
|
||||
* Uses a fast rotation algorythm for custom angles
|
||||
* or lines copy for multiple of 90 degrees
|
||||
*
|
||||
* @param int $angle Rotation angle
|
||||
* @param array $options array( 'autoresize'=>true|false,
|
||||
* 'color_mask'=>array(r,g,b), named color or #rrggbb
|
||||
* )
|
||||
* @author Pierre-Alain Joye
|
||||
* @return mixed none or a PEAR error object on error
|
||||
* @see PEAR::isError()
|
||||
*/
|
||||
function rotate($angle, $options=null)
|
||||
{
|
||||
if(function_exists('imagerotate')) {
|
||||
$white = imagecolorallocate ($this->imageHandle, 255, 255, 255);
|
||||
$this->imageHandle = imagerotate($this->imageHandle, $angle, $white);
|
||||
return true;
|
||||
}
|
||||
|
||||
if ( $options==null ){
|
||||
$autoresize = true;
|
||||
$color_mask = array(255,255,0);
|
||||
} else {
|
||||
extract( $options );
|
||||
}
|
||||
|
||||
while ($angle <= -45) {
|
||||
$angle += 360;
|
||||
}
|
||||
while ($angle > 270) {
|
||||
$angle -= 360;
|
||||
}
|
||||
|
||||
$t = deg2rad($angle);
|
||||
|
||||
if( !is_array($color_mask) ){
|
||||
if ($color[0]=='#'){
|
||||
$this->colorhex2colorarray( $color_mask );
|
||||
} else {
|
||||
include_once('Image/Transform/Driver/ColorDefs.php');
|
||||
$color = isset($colornames[$color_mask])?$colornames[$color_mask]:false;
|
||||
}
|
||||
}
|
||||
|
||||
// Do not round it, too much lost of quality
|
||||
$cosT = cos($t);
|
||||
$sinT = sin($t);
|
||||
|
||||
$img =& $this->imageHandle;
|
||||
|
||||
$width = $max_x = $this->img_x;
|
||||
$height = $max_y = $this->img_y;
|
||||
$min_y = 0;
|
||||
$min_x = 0;
|
||||
|
||||
$x1 = round($max_x/2,0);
|
||||
$y1 = round($max_y/2,0);
|
||||
|
||||
if ( $autoresize ){
|
||||
$t = abs($t);
|
||||
$a = round($angle,0);
|
||||
switch((int)($angle)){
|
||||
case 0:
|
||||
$width2 = $width;
|
||||
$height2 = $height;
|
||||
break;
|
||||
case 90:
|
||||
$width2 = $height;
|
||||
$height2 = $width;
|
||||
break;
|
||||
case 180:
|
||||
$width2 = $width;
|
||||
$height2 = $height;
|
||||
break;
|
||||
case 270:
|
||||
$width2 = $height;
|
||||
$height2 = $width;
|
||||
break;
|
||||
default:
|
||||
$width2 = (int)(abs(sin($t) * $height + cos($t) * $width));
|
||||
$height2 = (int)(abs(cos($t) * $height+sin($t) * $width));
|
||||
}
|
||||
|
||||
$width2 -= $width2%2;
|
||||
$height2 -= $height2%2;
|
||||
|
||||
$d_width = abs($width - $width2);
|
||||
$d_height = abs($height - $height2);
|
||||
$x_offset = $d_width/2;
|
||||
$y_offset = $d_height/2;
|
||||
$min_x2 = -abs($x_offset);
|
||||
$min_y2 = -abs($y_offset);
|
||||
$max_x2 = $width2;
|
||||
$max_y2 = $height2;
|
||||
}
|
||||
|
||||
$img2 = @imagecreate($width2,$height2);
|
||||
|
||||
if ( !is_resource($img2) ){
|
||||
return false;/*PEAR::raiseError('Cannot create buffer for the rotataion.',
|
||||
null, PEAR_ERROR_TRIGGER, E_USER_NOTICE);*/
|
||||
}
|
||||
|
||||
$this->img_x = $width2;
|
||||
$this->img_y = $height2;
|
||||
|
||||
|
||||
imagepalettecopy($img2,$img);
|
||||
|
||||
$mask = imagecolorresolve($img2,$color_mask[0],$color_mask[1],$color_mask[2]);
|
||||
|
||||
// use simple lines copy for axes angles
|
||||
switch((int)($angle)){
|
||||
case 0:
|
||||
imagefill ($img2, 0, 0,$mask);
|
||||
for ($y=0; $y < $max_y; $y++) {
|
||||
for ($x = $min_x; $x < $max_x; $x++){
|
||||
$c = @imagecolorat ( $img, $x, $y);
|
||||
imagesetpixel($img2,$x+$x_offset,$y+$y_offset,$c);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 90:
|
||||
imagefill ($img2, 0, 0,$mask);
|
||||
for ($x = $min_x; $x < $max_x; $x++){
|
||||
for ($y=$min_y; $y < $max_y; $y++) {
|
||||
$c = imagecolorat ( $img, $x, $y);
|
||||
imagesetpixel($img2,$max_y-$y-1,$x,$c);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 180:
|
||||
imagefill ($img2, 0, 0,$mask);
|
||||
for ($y=0; $y < $max_y; $y++) {
|
||||
for ($x = $min_x; $x < $max_x; $x++){
|
||||
$c = @imagecolorat ( $img, $x, $y);
|
||||
imagesetpixel($img2, $max_x2-$x-1, $max_y2-$y-1, $c);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 270:
|
||||
imagefill ($img2, 0, 0,$mask);
|
||||
for ($y=0; $y < $max_y; $y++) {
|
||||
for ($x = $max_x; $x >= $min_x; $x--){
|
||||
$c = @imagecolorat ( $img, $x, $y);
|
||||
imagesetpixel($img2,$y,$max_x-$x-1,$c);
|
||||
}
|
||||
}
|
||||
break;
|
||||
// simple reverse rotation algo
|
||||
default:
|
||||
$i=0;
|
||||
for ($y = $min_y2; $y < $max_y2; $y++){
|
||||
|
||||
// Algebra :)
|
||||
$x2 = round((($min_x2-$x1) * $cosT) + (($y-$y1) * $sinT + $x1),0);
|
||||
$y2 = round((($y-$y1) * $cosT - ($min_x2-$x1) * $sinT + $y1),0);
|
||||
|
||||
for ($x = $min_x2; $x < $max_x2; $x++){
|
||||
|
||||
// Check if we are out of original bounces, if we are
|
||||
// use the default color mask
|
||||
if ( $x2>=0 && $x2<$max_x && $y2>=0 && $y2<$max_y ){
|
||||
$c = imagecolorat ( $img, $x2, $y2);
|
||||
} else {
|
||||
$c = $mask;
|
||||
}
|
||||
imagesetpixel($img2,$x+$x_offset,$y+$y_offset,$c);
|
||||
|
||||
// round verboten!
|
||||
$x2 += $cosT;
|
||||
$y2 -= $sinT;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
$this->old_image = $this->imageHandle;
|
||||
$this->imageHandle = $img2;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Resize Action
|
||||
*
|
||||
* For GD 2.01+ the new copyresampled function is used
|
||||
* It uses a bicubic interpolation algorithm to get far
|
||||
* better result.
|
||||
*
|
||||
* @param $new_x int new width
|
||||
* @param $new_y int new height
|
||||
*
|
||||
* @return true on success or pear error
|
||||
* @see PEAR::isError()
|
||||
*/
|
||||
function _resize($new_x, $new_y) {
|
||||
if ($this->resized === true) {
|
||||
return false; /*PEAR::raiseError('You have already resized the image without saving it. Your previous resizing will be overwritten', null, PEAR_ERROR_TRIGGER, E_USER_NOTICE);*/
|
||||
}
|
||||
if(function_exists('ImageCreateTrueColor')){
|
||||
$new_img =ImageCreateTrueColor($new_x,$new_y);
|
||||
} else {
|
||||
$new_img =ImageCreate($new_x,$new_y);
|
||||
}
|
||||
if(function_exists('ImageCopyResampled')){
|
||||
ImageCopyResampled($new_img, $this->imageHandle, 0, 0, 0, 0, $new_x, $new_y, $this->img_x, $this->img_y);
|
||||
} else {
|
||||
ImageCopyResized($new_img, $this->imageHandle, 0, 0, 0, 0, $new_x, $new_y, $this->img_x, $this->img_y);
|
||||
}
|
||||
$this->old_image = $this->imageHandle;
|
||||
$this->imageHandle = $new_img;
|
||||
$this->resized = true;
|
||||
|
||||
$this->new_x = $new_x;
|
||||
$this->new_y = $new_y;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Crop the image
|
||||
*
|
||||
* @param int $crop_x left column of the image
|
||||
* @param int $crop_y top row of the image
|
||||
* @param int $crop_width new cropped image width
|
||||
* @param int $crop_height new cropped image height
|
||||
*/
|
||||
function crop($new_x, $new_y, $new_width, $new_height)
|
||||
{
|
||||
if(function_exists('ImageCreateTrueColor')){
|
||||
$new_img =ImageCreateTrueColor($new_width,$new_height);
|
||||
} else {
|
||||
$new_img =ImageCreate($new_width,$new_height);
|
||||
}
|
||||
if(function_exists('ImageCopyResampled')){
|
||||
ImageCopyResampled($new_img, $this->imageHandle, 0, 0, $new_x, $new_y,$new_width,$new_height,$new_width,$new_height);
|
||||
} else {
|
||||
ImageCopyResized($new_img, $this->imageHandle, 0, 0, $new_x, $new_y, $new_width,$new_height,$new_width,$new_height);
|
||||
}
|
||||
$this->old_image = $this->imageHandle;
|
||||
$this->imageHandle = $new_img;
|
||||
$this->resized = true;
|
||||
|
||||
$this->new_x = $new_x;
|
||||
$this->new_y = $new_y;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Flip the image horizontally or vertically
|
||||
*
|
||||
* @param boolean $horizontal true if horizontal flip, vertical otherwise
|
||||
*/
|
||||
function flip($horizontal)
|
||||
{
|
||||
if(!$horizontal) {
|
||||
$this->rotate(180);
|
||||
}
|
||||
|
||||
$width = imagesx($this->imageHandle);
|
||||
$height = imagesy($this->imageHandle);
|
||||
|
||||
for ($j = 0; $j < $height; $j++) {
|
||||
$left = 0;
|
||||
$right = $width-1;
|
||||
|
||||
|
||||
while ($left < $right) {
|
||||
//echo " j:".$j." l:".$left." r:".$right."\n<br>";
|
||||
$t = imagecolorat($this->imageHandle, $left, $j);
|
||||
imagesetpixel($this->imageHandle, $left, $j, imagecolorat($this->imageHandle, $right, $j));
|
||||
imagesetpixel($this->imageHandle, $right, $j, $t);
|
||||
$left++; $right--;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adjust the image gamma
|
||||
*
|
||||
* @param float $outputgamma
|
||||
*
|
||||
* @return none
|
||||
*/
|
||||
function gamma($outputgamma=1.0) {
|
||||
ImageGammaCorrect($this->imageHandle, 1.0, $outputgamma);
|
||||
}
|
||||
|
||||
/**
|
||||
* Save the image file
|
||||
*
|
||||
* @param $filename string the name of the file to write to
|
||||
* @param $quality int output DPI, default is 85
|
||||
* @param $types string define the output format, default
|
||||
* is the current used format
|
||||
*
|
||||
* @return none
|
||||
*/
|
||||
function save($filename, $type = '', $quality = 85)
|
||||
{
|
||||
$type = $type==''? $this->type : $type;
|
||||
$functionName = 'image' . $type;
|
||||
$this->old_image = $this->imageHandle;
|
||||
$functionName($this->imageHandle, $filename) ;
|
||||
$this->imageHandle = $this->old_image;
|
||||
$this->resized = false;
|
||||
} // End save
|
||||
|
||||
|
||||
/**
|
||||
* Display image without saving and lose changes
|
||||
*
|
||||
* @param string type (JPG,PNG...);
|
||||
* @param int quality 75
|
||||
*
|
||||
* @return none
|
||||
*/
|
||||
function display($type = '', $quality = 75)
|
||||
{
|
||||
if ($type != '') {
|
||||
$this->type = $type;
|
||||
}
|
||||
$functionName = 'Image' . $this->type;
|
||||
header('Content-type: image/' . strtolower($this->type));
|
||||
$functionName($this->imageHandle, '', $quality);
|
||||
$this->imageHandle = $this->old_image;
|
||||
$this->resized = false;
|
||||
ImageDestroy($this->old_image);
|
||||
$this->free();
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy image handle
|
||||
*
|
||||
* @return none
|
||||
*/
|
||||
function free()
|
||||
{
|
||||
if ($this->imageHandle){
|
||||
ImageDestroy($this->imageHandle);
|
||||
}
|
||||
}
|
||||
|
||||
} // End class ImageGD
|
||||
?>
|
569
phpgwapi/js/tinymce/jscripts/tiny_mce/plugins/filemanager/InsertFile/Transform.php
vendored
Normal file
@ -0,0 +1,569 @@
|
||||
<?php
|
||||
/***********************************************************************
|
||||
** Title.........: Image Transformation Interface
|
||||
** Version.......: 1.0
|
||||
** Author........: Xiang Wei ZHUO <wei@zhuo.org>
|
||||
** Filename......: Transform.php
|
||||
** Last changed..: 30 Aug 2003
|
||||
** Notes.........: Orginal is from PEAR
|
||||
|
||||
Added a few extra,
|
||||
- create unique filename in a particular directory,
|
||||
used for temp image files.
|
||||
- added cropping to GD, NetPBM, ImageMagick
|
||||
**/
|
||||
|
||||
// +----------------------------------------------------------------------+
|
||||
// | PHP Version 4 |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 1997-2002 The PHP Group |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | This source file is subject to version 2.02 of the PHP license, |
|
||||
// | that is bundled with this package in the file LICENSE, and is |
|
||||
// | available at through the world-wide-web at |
|
||||
// | http://www.php.net/license/2_02.txt. |
|
||||
// | If you did not receive a copy of the PHP license and are unable to |
|
||||
// | obtain it through the world-wide-web, please send a note to |
|
||||
// | license@php.net so we can mail you a copy immediately. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Authors: Peter Bowyer <peter@mapledesign.co.uk> |
|
||||
// | Alan Knowles <alan@akbkhome.com> |
|
||||
// | Vincent Oostindie <vincent@sunlight.tmfweb.nl> |
|
||||
// +----------------------------------------------------------------------+
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
// Image Transformation interface
|
||||
//
|
||||
|
||||
|
||||
/**
|
||||
* The main "Image_Resize" class is a container and base class which
|
||||
* provides the static methods for creating Image objects as well as
|
||||
* some utility functions (maths) common to all parts of Image Resize.
|
||||
*
|
||||
* The object model of DB is as follows (indentation means inheritance):
|
||||
*
|
||||
* Image_Resize The base for each Image implementation. Provides default
|
||||
* | implementations (in OO lingo virtual methods) for
|
||||
* | the actual Image implementations as well as a bunch of
|
||||
* | maths methods.
|
||||
* |
|
||||
* +-Image_GD The Image implementation for the PHP GD extension . Inherits
|
||||
* Image_Resize
|
||||
* When calling DB::setup for GD images the object returned is an
|
||||
* instance of this class.
|
||||
*
|
||||
* @package Image Resize
|
||||
* @version 1.00
|
||||
* @author Peter Bowyer <peter@mapledesign.co.uk>
|
||||
* @since PHP 4.0
|
||||
**/
|
||||
class Image_Transform
|
||||
{
|
||||
/**
|
||||
* Name of the image file
|
||||
* @var string
|
||||
*/
|
||||
var $image = '';
|
||||
/**
|
||||
* Type of the image file (eg. jpg, gif png ...)
|
||||
* @var string
|
||||
*/
|
||||
var $type = '';
|
||||
/**
|
||||
* Original image width in x direction
|
||||
* @var int
|
||||
*/
|
||||
var $img_x = '';
|
||||
/**
|
||||
* Original image width in y direction
|
||||
* @var int
|
||||
*/
|
||||
var $img_y = '';
|
||||
/**
|
||||
* New image width in x direction
|
||||
* @var int
|
||||
*/
|
||||
var $new_x = '';
|
||||
/**
|
||||
* New image width in y direction
|
||||
* @var int
|
||||
*/
|
||||
var $new_y = '';
|
||||
/**
|
||||
* Path the the library used
|
||||
* e.g. /usr/local/ImageMagick/bin/ or
|
||||
* /usr/local/netpbm/
|
||||
*/
|
||||
var $lib_path = '';
|
||||
/**
|
||||
* Flag to warn if image has been resized more than once before displaying
|
||||
* or saving.
|
||||
*/
|
||||
var $resized = false;
|
||||
|
||||
|
||||
var $uid = '';
|
||||
|
||||
var $lapse_time =900; //15 mins
|
||||
|
||||
/**
|
||||
* Create a new Image_resize object
|
||||
*
|
||||
* @param string $driver name of driver class to initialize
|
||||
*
|
||||
* @return mixed a newly created Image_Transform object, or a PEAR
|
||||
* error object on error
|
||||
*
|
||||
* @see PEAR::isError()
|
||||
* @see Image_Transform::setOption()
|
||||
*/
|
||||
function &factory($driver)
|
||||
{
|
||||
if ('' == $driver) {
|
||||
die("No image library specified... aborting. You must call ::factory() with one parameter, the library to load.");
|
||||
|
||||
}
|
||||
// $this->uid = md5($_SERVER['REMOTE_ADDR']);
|
||||
|
||||
include_once "$driver.php";
|
||||
|
||||
$classname = "Image_Transform_Driver_{$driver}";
|
||||
$obj =& new $classname;
|
||||
return $obj;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Resize the Image in the X and/or Y direction
|
||||
* If either is 0 it will be scaled proportionally
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @param mixed $new_x (0, number, percentage 10% or 0.1)
|
||||
* @param mixed $new_y (0, number, percentage 10% or 0.1)
|
||||
*
|
||||
* @return mixed none or PEAR_error
|
||||
*/
|
||||
function resize($new_x = 0, $new_y = 0)
|
||||
{
|
||||
// 0 means keep original size
|
||||
$new_x = (0 == $new_x) ? $this->img_x : $this->_parse_size($new_x, $this->img_x);
|
||||
$new_y = (0 == $new_y) ? $this->img_y : $this->_parse_size($new_y, $this->img_y);
|
||||
// Now do the library specific resizing.
|
||||
return $this->_resize($new_x, $new_y);
|
||||
} // End resize
|
||||
|
||||
|
||||
/**
|
||||
* Scale the image to have the max x dimension specified.
|
||||
*
|
||||
* @param int $new_x Size to scale X-dimension to
|
||||
* @return none
|
||||
*/
|
||||
function scaleMaxX($new_x)
|
||||
{
|
||||
$new_y = round(($new_x / $this->img_x) * $this->img_y, 0);
|
||||
return $this->_resize($new_x, $new_y);
|
||||
} // End resizeX
|
||||
|
||||
/**
|
||||
* Scale the image to have the max y dimension specified.
|
||||
*
|
||||
* @access public
|
||||
* @param int $new_y Size to scale Y-dimension to
|
||||
* @return none
|
||||
*/
|
||||
function scaleMaxY($new_y)
|
||||
{
|
||||
$new_x = round(($new_y / $this->img_y) * $this->img_x, 0);
|
||||
return $this->_resize($new_x, $new_y);
|
||||
} // End resizeY
|
||||
|
||||
/**
|
||||
* Scale Image to a maximum or percentage
|
||||
*
|
||||
* @access public
|
||||
* @param mixed (number, percentage 10% or 0.1)
|
||||
* @return mixed none or PEAR_error
|
||||
*/
|
||||
function scale($size)
|
||||
{
|
||||
if ((strlen($size) > 1) && (substr($size,-1) == '%')) {
|
||||
return $this->scaleByPercentage(substr($size, 0, -1));
|
||||
} elseif ($size < 1) {
|
||||
return $this->scaleByFactor($size);
|
||||
} else {
|
||||
return $this->scaleByLength($size);
|
||||
}
|
||||
} // End scale
|
||||
|
||||
/**
|
||||
* Scales an image to a percentage of its original size. For example, if
|
||||
* my image was 640x480 and I called scaleByPercentage(10) then the image
|
||||
* would be resized to 64x48
|
||||
*
|
||||
* @access public
|
||||
* @param int $size Percentage of original size to scale to
|
||||
* @return none
|
||||
*/
|
||||
function scaleByPercentage($size)
|
||||
{
|
||||
return $this->scaleByFactor($size / 100);
|
||||
} // End scaleByPercentage
|
||||
|
||||
/**
|
||||
* Scales an image to a factor of its original size. For example, if
|
||||
* my image was 640x480 and I called scaleByFactor(0.5) then the image
|
||||
* would be resized to 320x240.
|
||||
*
|
||||
* @access public
|
||||
* @param float $size Factor of original size to scale to
|
||||
* @return none
|
||||
*/
|
||||
function scaleByFactor($size)
|
||||
{
|
||||
$new_x = round($size * $this->img_x, 0);
|
||||
$new_y = round($size * $this->img_y, 0);
|
||||
return $this->_resize($new_x, $new_y);
|
||||
} // End scaleByFactor
|
||||
|
||||
/**
|
||||
* Scales an image so that the longest side has this dimension.
|
||||
*
|
||||
* @access public
|
||||
* @param int $size Max dimension in pixels
|
||||
* @return none
|
||||
*/
|
||||
function scaleByLength($size)
|
||||
{
|
||||
if ($this->img_x >= $this->img_y) {
|
||||
$new_x = $size;
|
||||
$new_y = round(($new_x / $this->img_x) * $this->img_y, 0);
|
||||
} else {
|
||||
$new_y = $size;
|
||||
$new_x = round(($new_y / $this->img_y) * $this->img_x, 0);
|
||||
}
|
||||
return $this->_resize($new_x, $new_y);
|
||||
} // End scaleByLength
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function _get_image_details($image)
|
||||
{
|
||||
//echo $image;
|
||||
$data = @GetImageSize($image);
|
||||
#1 = GIF, 2 = JPG, 3 = PNG, 4 = SWF, 5 = PSD, 6 = BMP, 7 = TIFF(intel byte order), 8 = TIFF(motorola byte order,
|
||||
# 9 = JPC, 10 = JP2, 11 = JPX, 12 = JB2, 13 = SWC
|
||||
if (is_array($data)){
|
||||
switch($data[2]){
|
||||
case 1:
|
||||
$type = 'gif';
|
||||
break;
|
||||
case 2:
|
||||
$type = 'jpeg';
|
||||
break;
|
||||
case 3:
|
||||
$type = 'png';
|
||||
break;
|
||||
case 4:
|
||||
$type = 'swf';
|
||||
break;
|
||||
case 5:
|
||||
$type = 'psd';
|
||||
case 6:
|
||||
$type = 'bmp';
|
||||
case 7:
|
||||
case 8:
|
||||
$type = 'tiff';
|
||||
default:
|
||||
echo("We do not recognize this image format");
|
||||
}
|
||||
$this->img_x = $data[0];
|
||||
$this->img_y = $data[1];
|
||||
$this->type = $type;
|
||||
|
||||
return true;
|
||||
} else {
|
||||
echo("Cannot fetch image or images details.");
|
||||
return null;
|
||||
}
|
||||
/*
|
||||
$output = array(
|
||||
'width' => $data[0],
|
||||
'height' => $data[1],
|
||||
'type' => $type
|
||||
);
|
||||
return $output;
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Parse input and convert
|
||||
* If either is 0 it will be scaled proportionally
|
||||
*
|
||||
* @access private
|
||||
*
|
||||
* @param mixed $new_size (0, number, percentage 10% or 0.1)
|
||||
* @param int $old_size
|
||||
*
|
||||
* @return mixed none or PEAR_error
|
||||
*/
|
||||
function _parse_size($new_size, $old_size)
|
||||
{
|
||||
if ('%' == $new_size) {
|
||||
$new_size = str_replace('%','',$new_size);
|
||||
$new_size = $new_size / 100;
|
||||
}
|
||||
if ($new_size > 1) {
|
||||
return (int) $new_size;
|
||||
} elseif ($new_size == 0) {
|
||||
return (int) $old_size;
|
||||
} else {
|
||||
return (int) round($new_size * $old_size, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function uniqueStr()
|
||||
{
|
||||
return substr(md5(microtime()),0,6);
|
||||
}
|
||||
|
||||
//delete old tmp files, and allow only 1 file per remote host.
|
||||
function cleanUp($id, $dir)
|
||||
{
|
||||
$d = dir($dir);
|
||||
$id_length = strlen($id);
|
||||
|
||||
while (false !== ($entry = $d->read())) {
|
||||
if (is_file($dir.'/'.$entry) && substr($entry,0,1) == '.' && !ereg($entry, $this->image))
|
||||
{
|
||||
//echo filemtime($this->directory.'/'.$entry)."<br>";
|
||||
//echo time();
|
||||
|
||||
if (filemtime($dir.'/'.$entry) + $this->lapse_time < time())
|
||||
unlink($dir.'/'.$entry);
|
||||
|
||||
if (substr($entry, 1, $id_length) == $id)
|
||||
{
|
||||
if (is_file($dir.'/'.$entry))
|
||||
unlink($dir.'/'.$entry);
|
||||
}
|
||||
}
|
||||
}
|
||||
$d->close();
|
||||
}
|
||||
|
||||
|
||||
function createUnique($dir)
|
||||
{
|
||||
$unique_str = '.'.$this->uid.'_'.$this->uniqueStr().".".$this->type;
|
||||
|
||||
//make sure the the unique temp file does not exists
|
||||
while (file_exists($dir.$unique_str))
|
||||
{
|
||||
$unique_str = '.'.$this->uid.'_'.$this->uniqueStr().".".$this->type;
|
||||
}
|
||||
|
||||
$this->cleanUp($this->uid, $dir);
|
||||
|
||||
return $unique_str;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the image width
|
||||
* @param int $size dimension to set
|
||||
* @since 29/05/02 13:36:31
|
||||
* @return
|
||||
*/
|
||||
function _set_img_x($size)
|
||||
{
|
||||
$this->img_x = $size;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the image height
|
||||
* @param int $size dimension to set
|
||||
* @since 29/05/02 13:36:31
|
||||
* @return
|
||||
*/
|
||||
function _set_img_y($size)
|
||||
{
|
||||
$this->img_y = $size;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the image width
|
||||
* @param int $size dimension to set
|
||||
* @since 29/05/02 13:36:31
|
||||
* @return
|
||||
*/
|
||||
function _set_new_x($size)
|
||||
{
|
||||
$this->new_x = $size;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the image height
|
||||
* @param int $size dimension to set
|
||||
* @since 29/05/02 13:36:31
|
||||
* @return
|
||||
*/
|
||||
function _set_new_y($size)
|
||||
{
|
||||
$this->new_y = $size;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the type of the image being manipulated
|
||||
*
|
||||
* @return string $this->type the image type
|
||||
*/
|
||||
function getImageType()
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @access public
|
||||
* @return string web-safe image type
|
||||
*/
|
||||
function getWebSafeFormat()
|
||||
{
|
||||
switch($this->type){
|
||||
case 'gif':
|
||||
case 'png':
|
||||
return 'png';
|
||||
break;
|
||||
default:
|
||||
return 'jpeg';
|
||||
} // switch
|
||||
}
|
||||
|
||||
/**
|
||||
* Place holder for the real resize method
|
||||
* used by extended methods to do the resizing
|
||||
*
|
||||
* @access private
|
||||
* @return PEAR_error
|
||||
*/
|
||||
function _resize() {
|
||||
return null; //PEAR::raiseError("No Resize method exists", true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Place holder for the real load method
|
||||
* used by extended methods to do the resizing
|
||||
*
|
||||
* @access public
|
||||
* @return PEAR_error
|
||||
*/
|
||||
function load($filename) {
|
||||
return null; //PEAR::raiseError("No Load method exists", true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Place holder for the real display method
|
||||
* used by extended methods to do the resizing
|
||||
*
|
||||
* @access public
|
||||
* @param string filename
|
||||
* @return PEAR_error
|
||||
*/
|
||||
function display($type, $quality) {
|
||||
return null; //PEAR::raiseError("No Display method exists", true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Place holder for the real save method
|
||||
* used by extended methods to do the resizing
|
||||
*
|
||||
* @access public
|
||||
* @param string filename
|
||||
* @return PEAR_error
|
||||
*/
|
||||
function save($filename, $type, $quality) {
|
||||
return null; //PEAR::raiseError("No Save method exists", true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Place holder for the real free method
|
||||
* used by extended methods to do the resizing
|
||||
*
|
||||
* @access public
|
||||
* @return PEAR_error
|
||||
*/
|
||||
function free() {
|
||||
return null; //PEAR::raiseError("No Free method exists", true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse of rgb2colorname.
|
||||
*
|
||||
* @access public
|
||||
* @return PEAR_error
|
||||
*
|
||||
* @see rgb2colorname
|
||||
*/
|
||||
function colorhex2colorarray($colorhex) {
|
||||
$r = hexdec(substr($colorhex, 1, 2));
|
||||
$g = hexdec(substr($colorhex, 3, 2));
|
||||
$b = hexdec(substr($colorhex, 4, 2));
|
||||
return array($r,$g,$b);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse of rgb2colorname.
|
||||
*
|
||||
* @access public
|
||||
* @return PEAR_error
|
||||
*
|
||||
* @see rgb2colorname
|
||||
*/
|
||||
function colorarray2colorhex($color) {
|
||||
$color = '#'.dechex($color[0]).dechex($color[1]).dechex($color[2]);
|
||||
return strlen($color)>6?false:$color;
|
||||
}
|
||||
|
||||
|
||||
/* Methods to add to the driver classes in the future */
|
||||
function addText()
|
||||
{
|
||||
return null; //PEAR::raiseError("No addText method exists", true);
|
||||
}
|
||||
|
||||
function addDropShadow()
|
||||
{
|
||||
return null; //PEAR::raiseError("No AddDropShadow method exists", true);
|
||||
}
|
||||
|
||||
function addBorder()
|
||||
{
|
||||
return null; //PEAR::raiseError("No addBorder method exists", true);
|
||||
}
|
||||
|
||||
function crop()
|
||||
{
|
||||
return null; //PEAR::raiseError("No crop method exists", true);
|
||||
}
|
||||
|
||||
function flip()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
function gamma()
|
||||
{
|
||||
return null; //PEAR::raiseError("No gamma method exists", true);
|
||||
}
|
||||
}
|
||||
?>
|
191
phpgwapi/js/tinymce/jscripts/tiny_mce/plugins/filemanager/InsertFile/config.inc.php
vendored
Normal file
@ -0,0 +1,191 @@
|
||||
<?php
|
||||
/**************************************************************************\
|
||||
* eGroupWare - Insert File Dialog, File Manager -plugin for tinymce *
|
||||
* http://www.eGroupWare.org *
|
||||
* Authors Al Rashid <alrashid@klokan.sk> *
|
||||
* and Xiang Wei ZHUO <wei@zhuo.org> *
|
||||
* Version.......: 1.1 *
|
||||
* Modified for eGW by Cornelius Weiss <egw@von-und-zu-weiss.de> *
|
||||
* -------------------------------------------- *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU General Public License as published by the *
|
||||
* Free Software Foundation; version 2 of the License. *
|
||||
\**************************************************************************/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
/**
|
||||
* USAGE: If you like to use this plugin, insinde the eGW framework, you have to do two things
|
||||
* 1. Add 'plugins : "filemanager",theme_advanced_buttons3_add : "filemanager"' to the $plugins variable on tinymce call
|
||||
* 2. supply an array in the session with like this example shows:
|
||||
* $UploadImage = array(
|
||||
* 'app' => 'news_admin',
|
||||
* 'upload_dir' => $GLOBALS['phpgw_info']['user']['preferences']['news_admin']['uploaddir'],
|
||||
* 'admin_method' => $GLOBALS['phpgw']->link('/index.php', 'menuaction=app.file.method');;
|
||||
* $GLOBALS['phpgw']->session->appsession('UploadImage','phpgwapi',$UploadImage);
|
||||
*
|
||||
**/
|
||||
|
||||
$phpgw_flags = Array(
|
||||
'currentapp' => 'home',
|
||||
'noheader' => True,
|
||||
'nonavbar' => True,
|
||||
'noappheader' => True,
|
||||
'noappfooter' => True,
|
||||
'nofooter' => True
|
||||
);
|
||||
|
||||
$GLOBALS['phpgw_info']['flags'] = $phpgw_flags;
|
||||
|
||||
if(!is_object($GLOBALS['egw']))
|
||||
{
|
||||
if(@include('../../../../../../../../header.inc.php'))
|
||||
{
|
||||
// I know this is very ugly
|
||||
}
|
||||
else
|
||||
{
|
||||
@include('../../../../../../../../../header.inc.php');
|
||||
}
|
||||
}
|
||||
|
||||
$sessdata = $GLOBALS['phpgw']->session->appsession('UploadImage','phpgwapi');
|
||||
if(is_writeable($sessdata['upload_dir']))
|
||||
{
|
||||
$MY_DOCUMENT_ROOT = $BASE_DIR = $sessdata['upload_dir'];
|
||||
$MY_BASE_URL = $MY_URL_TO_OPEN_FILE = str_replace($GLOBALS['_SERVER']['DOCUMENT_ROOT'],'',$sessdata['upload_dir']);
|
||||
$BASE_URL = '/'.$MY_BASE_URL;
|
||||
}
|
||||
else
|
||||
{
|
||||
echo '<p><b>Error</b></p>';
|
||||
echo '<p>Upload directory does not exist, or is not writeable by webserver</p>';
|
||||
echo $GLOBALS['egw_info']['user']['apps']['admin'] ?
|
||||
'<a href="'. $sessdata['admin_method']. '">Choose an other directory</a><br>
|
||||
or make "'. $sessdata['upload_dir']. '" writeable by webserver' :
|
||||
'Notify your Administrator to correct this Situation';
|
||||
die();
|
||||
}
|
||||
|
||||
define('IMAGE_CLASS', 'GD');
|
||||
/* MY_ALLOW_CREATE Boolean (false or true) whether creating folders is allowed or not. */
|
||||
$MY_ALLOW_CREATE = true;
|
||||
/* $MY_ALLOW_DELETE Boolean (false or true) whether deleting files and folders is allowed or not. */
|
||||
$MY_ALLOW_DELETE = true;
|
||||
/* $MY_ALLOW_RENAME Boolean (false or true) whether renaming files and folders is allowed or not. */
|
||||
$MY_ALLOW_RENAME = ture;
|
||||
/* $MY_ALLOW_MOVE Boolean (false or true) whether moving files and folders is allowed or not. */
|
||||
$MY_ALLOW_MOVE = true;
|
||||
/* $MY_ALLOW_UPLOAD Boolean (false or true) whether uploading files is allowed or not. */
|
||||
$MY_ALLOW_UPLOAD = true;
|
||||
/* MY_LIST_EXTENSIONS This array specifies which files are listed in dialog. Setting to null causes that all files are listed,case insensitive. */
|
||||
$MY_LIST_EXTENSIONS = array('html', 'doc', 'xls', 'txt', 'gif', 'jpeg', 'jpg', 'png', 'pdf', 'zip', 'pdf');
|
||||
/*
|
||||
MY_ALLOW_EXTENSIONS
|
||||
MY_DENY_EXTENSIONS
|
||||
MY_ALLOW_EXTENSIONS and MY_DENY_EXTENSIONS arrays specify which file types can be uploaded.
|
||||
Setting to null skips this check. The scheme is:
|
||||
1) If MY_DENY_EXTENSIONS is not null check if it does _not_ contain file extension of the file to be uploaded.
|
||||
If it does skip the upload procedure.
|
||||
2) If MY_ALLOW_EXTENSIONS is not null check if it _does_ contain file extension of the file to be uploaded.
|
||||
If it doesn't skip the upload procedure.
|
||||
3) Upload file.
|
||||
NOTE: File extensions arrays are case insensitive.
|
||||
You should always include server side executable file types in MY_DENY_EXTENSIONS !!!
|
||||
*/
|
||||
$MY_ALLOW_EXTENSIONS = array('html', 'doc', 'xls', 'txt', 'gif', 'jpeg', 'jpg', 'png', 'pdf', 'zip', 'pdf');
|
||||
$MY_DENY_EXTENSIONS = array('php', 'php3', 'php4', 'phtml', 'shtml', 'cgi', 'pl');
|
||||
/*
|
||||
$MY_ALLOW_UPLOAD
|
||||
Maximum allowed size for uploaded files (in bytes).
|
||||
NOTE2: see also upload_max_filesize setting in your php.ini file
|
||||
NOTE: 2*1024*1024 means 2 MB (megabytes) which is the default php.ini setting
|
||||
*/
|
||||
$MY_MAX_FILE_SIZE = 2*1024*1024;
|
||||
|
||||
/*
|
||||
$MY_LANG
|
||||
Interface language. See the lang directory for translation files.
|
||||
NOTE: You should set appropriately MY_CHARSET and $MY_DATETIME_FORMAT variables
|
||||
*/
|
||||
$MY_LANG = 'en';
|
||||
|
||||
/*
|
||||
$MY_CHARSET
|
||||
Character encoding for all Insert File dialogs.
|
||||
WARNING: For non english and non iso-8859-1 / utf8 users mostly !!!
|
||||
This setting affect also how the name of folder you create via Insert File Dialog
|
||||
and the name of file uploaded via Insert File Dialog will be encoded on your remote
|
||||
server filesystem. Note also the difference between how file names in multipart/data
|
||||
form are encoded by Internet Explorer (plain text depending on the webpage charset)
|
||||
and Mozilla (encoded according to RFC 1738).
|
||||
This should be fixed in next versions. Any help is VERY appreciated.
|
||||
*/
|
||||
$MY_CHARSET = 'iso-8859-1';
|
||||
|
||||
/*
|
||||
MY_DATETIME_FORMAT
|
||||
Datetime format for displaying file modification time in Insert File Dialog and in inserted link, see MY_LINK_FORMAT
|
||||
*/
|
||||
$MY_DATETIME_FORMAT = "d.m.Y H:i";
|
||||
|
||||
/*
|
||||
MY_LINK_FORMAT
|
||||
The string to be inserted into textarea.
|
||||
This is the most crucial setting. I apologize for not using the DOM functions any more,
|
||||
but inserting raw string allow more customization for everyone.
|
||||
The following strings are replaced by corresponding values of selected files/folders:
|
||||
_editor_url the url of htmlarea root folder - you should set it in your document (see htmlarea help)
|
||||
IF_ICON file type icon filename (see plugins/InsertFile/images/ext directory)
|
||||
IF_URL relative path to file relative to $MY_DOCUMENT_ROOT
|
||||
IF_CAPTION file/folder name
|
||||
IF_SIZE file size in (B, kB, or MB)
|
||||
IF_DATE last modification time acording to $MY_DATETIME_FORMAT format
|
||||
*/
|
||||
// $MY_LINK_FORMAT = '<span class="filelink"><img src="editor_url/plugins/filemanager/InsertFile/IF_ICON" alt="IF_URL" border="0"> <a href="IF_URL">IF_CAPTION</a> <span style="font-size:70%">IF_SIZE IF_DATE</span></span> ';
|
||||
|
||||
/* parse_icon function please insert additional file types (extensions) and theis corresponding icons in switch statement */
|
||||
function parse_icon($ext) {
|
||||
switch (strtolower($ext)) {
|
||||
case 'doc': return 'doc_small.gif';
|
||||
case 'rtf': return 'doc_small.gif';
|
||||
case 'txt': return 'txt_small.gif';
|
||||
case 'xls': return 'xls_small.gif';
|
||||
case 'csv': return 'xls_small.gif';
|
||||
case 'ppt': return 'ppt_small.gif';
|
||||
case 'html': return 'html_small.gif';
|
||||
case 'htm': return 'html_small.gif';
|
||||
case 'php': return 'script_small.gif';
|
||||
case 'php3': return 'script_small.gif';
|
||||
case 'cgi': return 'script_small.gif';
|
||||
case 'pdf': return 'pdf_small.gif';
|
||||
case 'rar': return 'rar_small.gif';
|
||||
case 'zip': return 'zip_small.gif';
|
||||
case 'gz': return 'gz_small.gif';
|
||||
case 'jpg': return 'jpg_small.gif';
|
||||
case 'gif': return 'gif_small.gif';
|
||||
case 'png': return 'png_small.gif';
|
||||
case 'bmp': return 'image_small.gif';
|
||||
case 'exe': return 'binary_small.gif';
|
||||
case 'bin': return 'binary_small.gif';
|
||||
case 'avi': return 'mov_small.gif';
|
||||
case 'mpg': return 'mov_small.gif';
|
||||
case 'moc': return 'mov_small.gif';
|
||||
case 'asf': return 'mov_small.gif';
|
||||
case 'mp3': return 'sound_small.gif';
|
||||
case 'wav': return 'sound_small.gif';
|
||||
case 'org': return 'sound_small.gif';
|
||||
default:
|
||||
return 'def_small.gif';
|
||||
}
|
||||
}
|
||||
|
||||
// DO NOT EDIT BELOW
|
||||
$MY_NAME = 'insertfiledialog';
|
||||
$lang_file = 'lang/lang-'.$MY_LANG.'.php';
|
||||
if (is_file($lang_file)) require($lang_file);
|
||||
else require('lang/lang-en.php');
|
||||
$MY_PATH = '/';
|
||||
$MY_UP_PATH = '/';
|
||||
|
||||
?>
|
375
phpgwapi/js/tinymce/jscripts/tiny_mce/plugins/filemanager/InsertFile/css/selectableelements.js
vendored
Normal file
@ -0,0 +1,375 @@
|
||||
/*----------------------------------------------------------------------------\
|
||||
| Selectable Elements 1.02 |
|
||||
|-----------------------------------------------------------------------------|
|
||||
| Created by Erik Arvidsson |
|
||||
| (http://webfx.eae.net/contact.html#erik) |
|
||||
| For WebFX (http://webfx.eae.net/) |
|
||||
|-----------------------------------------------------------------------------|
|
||||
| A script that allows children of any element to be selected |
|
||||
|-----------------------------------------------------------------------------|
|
||||
| Copyright (c) 1999 - 2004 Erik Arvidsson |
|
||||
|-----------------------------------------------------------------------------|
|
||||
| This software is provided "as is", without warranty of any kind, express or |
|
||||
| implied, including but not limited to the warranties of merchantability, |
|
||||
| fitness for a particular purpose and noninfringement. In no event shall the |
|
||||
| authors or copyright holders be liable for any claim, damages or other |
|
||||
| liability, whether in an action of contract, tort or otherwise, arising |
|
||||
| from, out of or in connection with the software or the use or other |
|
||||
| dealings in the software. |
|
||||
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
||||
| This software is available under the three different licenses mentioned |
|
||||
| below. To use this software you must chose, and qualify, for one of those. |
|
||||
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
||||
| The WebFX Non-Commercial License http://webfx.eae.net/license.html |
|
||||
| Permits anyone the right to use the software in a non-commercial context |
|
||||
| free of charge. |
|
||||
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
||||
| The WebFX Commercial license http://webfx.eae.net/commercial.html |
|
||||
| Permits the license holder the right to use the software in a commercial |
|
||||
| context. Such license must be specifically obtained, however it's valid for |
|
||||
| any number of implementations of the licensed software. |
|
||||
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
||||
| GPL - The GNU General Public License http://www.gnu.org/licenses/gpl.txt |
|
||||
| Permits anyone the right to use and modify the software without limitations |
|
||||
| as long as proper credits are given and the original and modified source |
|
||||
| code are included. Requires that the final product, software derivate from |
|
||||
| the original source or any software utilizing a GPL component, such as |
|
||||
| this, is also licensed under the GPL license. |
|
||||
|-----------------------------------------------------------------------------|
|
||||
| 2002-09-19 | Original Version Posted. |
|
||||
| 2002-09-27 | Fixed a bug in IE when mouse down and up occured on different |
|
||||
| | rows. |
|
||||
| 2003-02-11 | Minor problem with addClassName and removeClassName that |
|
||||
| | triggered a bug in Opera 7. Added destroy method |
|
||||
|-----------------------------------------------------------------------------|
|
||||
| Created 2002-09-04 | All changes are in the log above. | Updated 2003-02-11 |
|
||||
\----------------------------------------------------------------------------*/
|
||||
|
||||
function SelectableElements(oElement, bMultiple) {
|
||||
if (oElement == null)
|
||||
return;
|
||||
|
||||
this._htmlElement = oElement;
|
||||
this._multiple = Boolean(bMultiple);
|
||||
|
||||
this._selectedItems = [];
|
||||
this._fireChange = true;
|
||||
|
||||
var oThis = this;
|
||||
this._onclick = function (e) {
|
||||
if (e == null) e = oElement.ownerDocument.parentWindow.event;
|
||||
oThis.click(e);
|
||||
};
|
||||
|
||||
if (oElement.addEventListener)
|
||||
oElement.addEventListener("click", this._onclick, false);
|
||||
else if (oElement.attachEvent)
|
||||
oElement.attachEvent("onclick", this._onclick);
|
||||
}
|
||||
|
||||
SelectableElements.prototype.setItemSelected = function (oEl, bSelected) {
|
||||
if (!this._multiple) {
|
||||
if (bSelected) {
|
||||
var old = this._selectedItems[0]
|
||||
if (oEl == old)
|
||||
return;
|
||||
if (old != null)
|
||||
this.setItemSelectedUi(old, false);
|
||||
this.setItemSelectedUi(oEl, true);
|
||||
this._selectedItems = [oEl];
|
||||
this.fireChange();
|
||||
}
|
||||
else {
|
||||
if (this._selectedItems[0] == oEl) {
|
||||
this.setItemSelectedUi(oEl, false);
|
||||
this._selectedItems = [];
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (Boolean(oEl._selected) == Boolean(bSelected))
|
||||
return;
|
||||
|
||||
this.setItemSelectedUi(oEl, bSelected);
|
||||
|
||||
if (bSelected)
|
||||
this._selectedItems[this._selectedItems.length] = oEl;
|
||||
else {
|
||||
// remove
|
||||
var tmp = [];
|
||||
var j = 0;
|
||||
for (var i = 0; i < this._selectedItems.length; i++) {
|
||||
if (this._selectedItems[i] != oEl)
|
||||
tmp[j++] = this._selectedItems[i];
|
||||
}
|
||||
this._selectedItems = tmp;
|
||||
}
|
||||
this.fireChange();
|
||||
}
|
||||
};
|
||||
|
||||
// This method updates the UI of the item
|
||||
SelectableElements.prototype.setItemSelectedUi = function (oEl, bSelected) {
|
||||
if (bSelected)
|
||||
addClassName(oEl, "selected");
|
||||
else
|
||||
removeClassName(oEl, "selected");
|
||||
|
||||
oEl._selected = bSelected;
|
||||
};
|
||||
|
||||
SelectableElements.prototype.getItemSelected = function (oEl) {
|
||||
return Boolean(oEl._selected);
|
||||
};
|
||||
|
||||
SelectableElements.prototype.fireChange = function () {
|
||||
if (!this._fireChange)
|
||||
return;
|
||||
if (typeof this.onchange == "string")
|
||||
this.onchange = new Function(this.onchange);
|
||||
if (typeof this.onchange == "function")
|
||||
this.onchange();
|
||||
};
|
||||
|
||||
|
||||
SelectableElements.prototype.click = function (e) {
|
||||
var oldFireChange = this._fireChange;
|
||||
this._fireChange = false;
|
||||
|
||||
// create a copy to compare with after changes
|
||||
var selectedBefore = this.getSelectedItems(); // is a cloned array
|
||||
|
||||
// find row
|
||||
var el = e.target != null ? e.target : e.srcElement;
|
||||
while (el != null && !this.isItem(el))
|
||||
el = el.parentNode;
|
||||
|
||||
if (el == null) { // happens in IE when down and up occur on different items
|
||||
this._fireChange = oldFireChange;
|
||||
return;
|
||||
}
|
||||
|
||||
var rIndex = el;
|
||||
var aIndex = this._anchorIndex;
|
||||
|
||||
// test whether the current row should be the anchor
|
||||
if (this._selectedItems.length == 0 || (e.ctrlKey && !e.shiftKey && this._multiple)) {
|
||||
aIndex = this._anchorIndex = rIndex;
|
||||
}
|
||||
|
||||
if (!e.ctrlKey && !e.shiftKey || !this._multiple) {
|
||||
// deselect all
|
||||
var items = this._selectedItems;
|
||||
for (var i = items.length - 1; i >= 0; i--) {
|
||||
if (items[i]._selected && items[i] != el)
|
||||
this.setItemSelectedUi(items[i], false);
|
||||
}
|
||||
this._anchorIndex = rIndex;
|
||||
if (!el._selected) {
|
||||
this.setItemSelectedUi(el, true);
|
||||
}
|
||||
this._selectedItems = [el];
|
||||
}
|
||||
|
||||
// ctrl
|
||||
else if (this._multiple && e.ctrlKey && !e.shiftKey) {
|
||||
this.setItemSelected(el, !el._selected);
|
||||
this._anchorIndex = rIndex;
|
||||
}
|
||||
|
||||
// ctrl + shift
|
||||
else if (this._multiple && e.ctrlKey && e.shiftKey) {
|
||||
// up or down?
|
||||
var dirUp = this.isBefore(rIndex, aIndex);
|
||||
|
||||
var item = aIndex;
|
||||
while (item != null && item != rIndex) {
|
||||
if (!item._selected && item != el)
|
||||
this.setItemSelected(item, true);
|
||||
item = dirUp ? this.getPrevious(item) : this.getNext(item);
|
||||
}
|
||||
|
||||
if (!el._selected)
|
||||
this.setItemSelected(el, true);
|
||||
}
|
||||
|
||||
// shift
|
||||
else if (this._multiple && !e.ctrlKey && e.shiftKey) {
|
||||
// up or down?
|
||||
var dirUp = this.isBefore(rIndex, aIndex);
|
||||
|
||||
// deselect all
|
||||
var items = this._selectedItems;
|
||||
for (var i = items.length - 1; i >= 0; i--)
|
||||
this.setItemSelectedUi(items[i], false);
|
||||
this._selectedItems = [];
|
||||
|
||||
// select items in range
|
||||
var item = aIndex;
|
||||
while (item != null) {
|
||||
this.setItemSelected(item, true);
|
||||
if (item == rIndex)
|
||||
break;
|
||||
item = dirUp ? this.getPrevious(item) : this.getNext(item);
|
||||
}
|
||||
}
|
||||
|
||||
// find change!!!
|
||||
var found;
|
||||
var changed = selectedBefore.length != this._selectedItems.length;
|
||||
if (!changed) {
|
||||
for (var i = 0; i < selectedBefore.length; i++) {
|
||||
found = false;
|
||||
for (var j = 0; j < this._selectedItems.length; j++) {
|
||||
if (selectedBefore[i] == this._selectedItems[j]) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
changed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this._fireChange = oldFireChange;
|
||||
if (changed && this._fireChange)
|
||||
this.fireChange();
|
||||
};
|
||||
|
||||
SelectableElements.prototype.getSelectedItems = function () {
|
||||
//clone
|
||||
var items = this._selectedItems;
|
||||
var l = items.length;
|
||||
var tmp = new Array(l);
|
||||
for (var i = 0; i < l; i++)
|
||||
tmp[i] = items[i];
|
||||
return tmp;
|
||||
};
|
||||
|
||||
SelectableElements.prototype.isItem = function (node) {
|
||||
return node != null && node.nodeType == 1 && node.parentNode == this._htmlElement;
|
||||
};
|
||||
|
||||
SelectableElements.prototype.destroy = function () {
|
||||
if (this._htmlElement.removeEventListener)
|
||||
this._htmlElement.removeEventListener("click", this._onclick, false);
|
||||
else if (this._htmlElement.detachEvent)
|
||||
this._htmlElement.detachEvent("onclick", this._onclick);
|
||||
|
||||
this._htmlElement = null;
|
||||
this._onclick = null;
|
||||
this._selectedItems = null;
|
||||
};
|
||||
|
||||
/* Traversable Collection Interface */
|
||||
|
||||
SelectableElements.prototype.getNext = function (el) {
|
||||
var n = el.nextSibling;
|
||||
if (n == null || this.isItem(n))
|
||||
return n;
|
||||
return this.getNext(n);
|
||||
};
|
||||
|
||||
SelectableElements.prototype.getPrevious = function (el) {
|
||||
var p = el.previousSibling;
|
||||
if (p == null || this.isItem(p))
|
||||
return p;
|
||||
return this.getPrevious(p);
|
||||
};
|
||||
|
||||
SelectableElements.prototype.isBefore = function (n1, n2) {
|
||||
var next = this.getNext(n1);
|
||||
while (next != null) {
|
||||
if (next == n2)
|
||||
return true;
|
||||
next = this.getNext(next);
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
/* End Traversable Collection Interface */
|
||||
|
||||
/* Indexable Collection Interface */
|
||||
|
||||
SelectableElements.prototype.getItems = function () {
|
||||
var tmp = [];
|
||||
var j = 0;
|
||||
var cs = this._htmlElement.childNodes;
|
||||
var l = cs.length;
|
||||
for (var i = 0; i < l; i++) {
|
||||
if (cs[i].nodeType == 1)
|
||||
tmp[j++] = cs[i]
|
||||
}
|
||||
return tmp;
|
||||
};
|
||||
|
||||
SelectableElements.prototype.getItem = function (nIndex) {
|
||||
var j = 0;
|
||||
var cs = this._htmlElement.childNodes;
|
||||
var l = cs.length;
|
||||
for (var i = 0; i < l; i++) {
|
||||
if (cs[i].nodeType == 1) {
|
||||
if (j == nIndex)
|
||||
return cs[i];
|
||||
j++;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
SelectableElements.prototype.getSelectedIndexes = function () {
|
||||
var items = this.getSelectedItems();
|
||||
var l = items.length;
|
||||
var tmp = new Array(l);
|
||||
for (var i = 0; i < l; i++)
|
||||
tmp[i] = this.getItemIndex(items[i]);
|
||||
return tmp;
|
||||
};
|
||||
|
||||
|
||||
SelectableElements.prototype.getItemIndex = function (el) {
|
||||
var j = 0;
|
||||
var cs = this._htmlElement.childNodes;
|
||||
var l = cs.length;
|
||||
for (var i = 0; i < l; i++) {
|
||||
if (cs[i] == el)
|
||||
return j;
|
||||
if (cs[i].nodeType == 1)
|
||||
j++;
|
||||
}
|
||||
return -1;
|
||||
};
|
||||
|
||||
/* End Indexable Collection Interface */
|
||||
|
||||
|
||||
|
||||
function addClassName(el, sClassName) {
|
||||
var s = el.className;
|
||||
var p = s.split(" ");
|
||||
if (p.length == 1 && p[0] == "")
|
||||
p = [];
|
||||
|
||||
var l = p.length;
|
||||
for (var i = 0; i < l; i++) {
|
||||
if (p[i] == sClassName)
|
||||
return;
|
||||
}
|
||||
p[p.length] = sClassName;
|
||||
el.className = p.join(" ");
|
||||
}
|
||||
|
||||
function removeClassName(el, sClassName) {
|
||||
var s = el.className;
|
||||
var p = s.split(" ");
|
||||
var np = [];
|
||||
var l = p.length;
|
||||
var j = 0;
|
||||
for (var i = 0; i < l; i++) {
|
||||
if (p[i] != sClassName)
|
||||
np[j++] = p[i];
|
||||
}
|
||||
el.className = np.join(" ");
|
||||
}
|
78
phpgwapi/js/tinymce/jscripts/tiny_mce/plugins/filemanager/InsertFile/css/selectabletablerows.js
vendored
Normal file
@ -0,0 +1,78 @@
|
||||
/*----------------------------------------------------------------------------\
|
||||
| Selectable Elements 1.02 |
|
||||
|-----------------------------------------------------------------------------|
|
||||
| Created by Erik Arvidsson |
|
||||
| (http://webfx.eae.net/contact.html#erik) |
|
||||
| For WebFX (http://webfx.eae.net/) |
|
||||
|-----------------------------------------------------------------------------|
|
||||
| A script that allows children of any element to be selected |
|
||||
|-----------------------------------------------------------------------------|
|
||||
| Copyright (c) 1999 - 2004 Erik Arvidsson |
|
||||
|-----------------------------------------------------------------------------|
|
||||
| This software is provided "as is", without warranty of any kind, express or |
|
||||
| implied, including but not limited to the warranties of merchantability, |
|
||||
| fitness for a particular purpose and noninfringement. In no event shall the |
|
||||
| authors or copyright holders be liable for any claim, damages or other |
|
||||
| liability, whether in an action of contract, tort or otherwise, arising |
|
||||
| from, out of or in connection with the software or the use or other |
|
||||
| dealings in the software. |
|
||||
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
||||
| This software is available under the three different licenses mentioned |
|
||||
| below. To use this software you must chose, and qualify, for one of those. |
|
||||
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
||||
| The WebFX Non-Commercial License http://webfx.eae.net/license.html |
|
||||
| Permits anyone the right to use the software in a non-commercial context |
|
||||
| free of charge. |
|
||||
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
||||
| The WebFX Commercial license http://webfx.eae.net/commercial.html |
|
||||
| Permits the license holder the right to use the software in a commercial |
|
||||
| context. Such license must be specifically obtained, however it's valid for |
|
||||
| any number of implementations of the licensed software. |
|
||||
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
||||
| GPL - The GNU General Public License http://www.gnu.org/licenses/gpl.txt |
|
||||
| Permits anyone the right to use and modify the software without limitations |
|
||||
| as long as proper credits are given and the original and modified source |
|
||||
| code are included. Requires that the final product, software derivate from |
|
||||
| the original source or any software utilizing a GPL component, such as |
|
||||
| this, is also licensed under the GPL license. |
|
||||
|-----------------------------------------------------------------------------|
|
||||
| 2002-09-19 | Original Version Posted. |
|
||||
| 2002-09-27 | Fixed a bug in IE when mouse down and up occured on different |
|
||||
| | rows. |
|
||||
| 2003-02-11 | Minor problem with addClassName and removeClassName that |
|
||||
| | triggered a bug in Opera 7. Added destroy method |
|
||||
|-----------------------------------------------------------------------------|
|
||||
| Created 2002-09-04 | All changes are in the log above. | Updated 2003-02-11 |
|
||||
\----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------\
|
||||
| This file requires that SelectableElements is first defined. This class can |
|
||||
| be found in the file selectableelements.js at WebFX |
|
||||
\----------------------------------------------------------------------------*/
|
||||
|
||||
function SelectableTableRows(oTableElement, bMultiple) {
|
||||
SelectableElements.call(this, oTableElement, bMultiple);
|
||||
}
|
||||
SelectableTableRows.prototype = new SelectableElements;
|
||||
|
||||
SelectableTableRows.prototype.isItem = function (node) {
|
||||
return node != null && node.tagName == "TR" &&
|
||||
node.parentNode.tagName == "TBODY" &&
|
||||
node.parentNode.parentNode == this._htmlElement;
|
||||
};
|
||||
|
||||
/* Indexable Collection Interface */
|
||||
|
||||
SelectableTableRows.prototype.getItems = function () {
|
||||
return this._htmlElement.rows;
|
||||
};
|
||||
|
||||
SelectableTableRows.prototype.getItemIndex = function (el) {
|
||||
return el.rowIndex;
|
||||
};
|
||||
|
||||
SelectableTableRows.prototype.getItem = function (i) {
|
||||
return this._htmlElement.rows[i];
|
||||
};
|
||||
|
||||
/* End Indexable Collection Interface */
|
44
phpgwapi/js/tinymce/jscripts/tiny_mce/plugins/filemanager/InsertFile/css/sortabletable.css
vendored
Normal file
@ -0,0 +1,44 @@
|
||||
.sort-table {
|
||||
font: Icon;
|
||||
border: 0px Solid Window;
|
||||
background: Window;
|
||||
color: WindowText;
|
||||
}
|
||||
|
||||
.sort-table thead {
|
||||
background: ButtonFace;
|
||||
}
|
||||
|
||||
.sort-table td {
|
||||
padding: 2px 5px;
|
||||
}
|
||||
|
||||
.sort-table thead td {
|
||||
border: 1px solid;
|
||||
border-color: ButtonHighlight ButtonShadow
|
||||
ButtonShadow ButtonHighlight;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.sort-table thead td:active {
|
||||
border-color: ButtonShadow ButtonHighlight
|
||||
ButtonHighlight ButtonShadow;
|
||||
padding: 3px 4px 1px 6px;
|
||||
}
|
||||
|
||||
.sort-arrow {
|
||||
width: 11px;
|
||||
height: 11px;
|
||||
background-position: center center;
|
||||
background-repeat: no-repeat;
|
||||
margin: 0 2px;
|
||||
}
|
||||
|
||||
.sort-arrow.descending {
|
||||
background-image: url("../img/downsimple.png");
|
||||
|
||||
}
|
||||
|
||||
.sort-arrow.ascending {
|
||||
background-image: url("../img/upsimple.png");
|
||||
}
|
614
phpgwapi/js/tinymce/jscripts/tiny_mce/plugins/filemanager/InsertFile/files.php
vendored
Normal file
@ -0,0 +1,614 @@
|
||||
<?php
|
||||
/***********************************************************************
|
||||
** Title.........: Insert File Dialog, File Manager
|
||||
** Version.......: 1.1
|
||||
** Authors.......: Al Rashid <alrashid@klokan.sk>
|
||||
** Xiang Wei ZHUO <wei@zhuo.org>
|
||||
** URL...........: http://alrashid.klokan.sk/insFile/
|
||||
** Filename......: files.php
|
||||
** Last changed..: 23 July 2004
|
||||
***********************************************************************/
|
||||
require('config.inc.php');
|
||||
require('functions.php');
|
||||
require('view_text.php');
|
||||
|
||||
//Reset auth variables
|
||||
|
||||
$refresh_dirs = false;
|
||||
$clear_upload = false;
|
||||
$err = false;
|
||||
|
||||
|
||||
if (isset($_REQUEST['refresh'])) {
|
||||
$refresh_dirs = true;
|
||||
}
|
||||
if (!isset($_REQUEST['view'])) {
|
||||
$_REQUEST['view'] = 'text';
|
||||
}
|
||||
if (isset($_REQUEST['path'])) {
|
||||
//$path = $_REQUEST['path'];
|
||||
$path = checkName($_REQUEST['path']);
|
||||
$path = unsanitize($path);
|
||||
$path = pathSlashes($path);
|
||||
} else {
|
||||
$path = '/';
|
||||
}
|
||||
|
||||
$MY_PATH = $path;
|
||||
$MY_UP_PATH = substr($MY_PATH,0,@strrpos(substr($MY_PATH,0,strlen($MY_PATH)-1),'/'))."/";
|
||||
//echo "PATH:".$MY_PATH;
|
||||
//echo "<br>UPP:".$MY_UP_PATH;
|
||||
|
||||
function createFolder() {
|
||||
global $MY_ALLOW_CREATE, $MY_MESSAGES, $MY_DOCUMENT_ROOT, $refresh_dirs;
|
||||
global $MY_PATH;
|
||||
if (!$MY_ALLOW_CREATE) return ($MY_MESSAGES['nopermtocreatefolder']);
|
||||
if (!(is_dir($MY_DOCUMENT_ROOT.$MY_PATH))) return ($MY_MESSAGES['pathnotfound']);
|
||||
if ( !isset($_REQUEST['file'])) return ($MY_MESSAGES['foldernamemissing']);
|
||||
$Folder = checkName($_REQUEST['file']);
|
||||
//$Folder = utf8RawUrlDecode($Folder);
|
||||
$newFolder = $MY_DOCUMENT_ROOT.$MY_PATH.$Folder;
|
||||
if (is_dir($newFolder)) return ($MY_MESSAGES['folderalreadyexists']);
|
||||
$newFolder = unsanitize($newFolder);
|
||||
if (!(@mkdir($newFolder,0755))) return ($MY_MESSAGES['mkdirfailed']);
|
||||
chmod($newFolder,0755);
|
||||
$refresh_dirs = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
function deleteFile() {
|
||||
$error = false;
|
||||
global $MY_ALLOW_DELETE, $MY_MESSAGES, $MY_DOCUMENT_ROOT, $MY_PATH ;
|
||||
if (!$MY_ALLOW_DELETE) return ($MY_MESSAGES['nopermtodelete']);
|
||||
if (isset($_REQUEST['folders']) && is_array($_REQUEST['folders'])) {
|
||||
foreach ($_REQUEST['folders'] as $folder) {
|
||||
$folder = unsanitize($folder);
|
||||
deldir($MY_DOCUMENT_ROOT.$MY_PATH.$folder);
|
||||
}
|
||||
}
|
||||
if (isset($_REQUEST['files']) && is_array($_REQUEST['files'])) {
|
||||
foreach ($_REQUEST['files'] as $file) {
|
||||
$file = unsanitize($file);
|
||||
$delFile = $MY_DOCUMENT_ROOT.$MY_PATH.$file;
|
||||
if (is_file($delFile)) {
|
||||
if (!(unlink($delFile))) $error = $error.'\n'.alertSanitize($MY_MESSAGES['unlinkfailed'].' ('.$delFile.')');
|
||||
} else {
|
||||
$error = $error.'\n'.alertSanitize($MY_MESSAGES['filenotfound'].' ('.$delFile.')');
|
||||
}
|
||||
}
|
||||
}
|
||||
$refresh_dirs = true;
|
||||
return $error;
|
||||
}
|
||||
|
||||
function deldir($dir){
|
||||
$current_dir = opendir($dir);
|
||||
while (false !== ($entryname = readdir($current_dir))) {
|
||||
if(is_dir("$dir/$entryname") and ($entryname != "." and $entryname!="..")){
|
||||
deldir("${dir}/${entryname}");
|
||||
}elseif($entryname != "." and $entryname!=".."){
|
||||
unlink("${dir}/${entryname}");
|
||||
}
|
||||
}
|
||||
closedir($current_dir);
|
||||
rmdir($dir);
|
||||
}
|
||||
|
||||
function renameFile() {
|
||||
global $MY_ALLOW_RENAME, $MY_MESSAGES, $MY_DOCUMENT_ROOT, $MY_PATH, $refresh_dirs;
|
||||
global $MY_ALLOW_EXTENSIONS, $MY_DENY_EXTENSIONS ;
|
||||
$error = false;
|
||||
if (!$MY_ALLOW_RENAME) return ($MY_MESSAGES['nopermtorename']);
|
||||
if (isset($_REQUEST['folders']) && is_array($_REQUEST['folders'])) {
|
||||
foreach ($_REQUEST['folders'] as $file) {
|
||||
$oldname = checkName(unsanitize($file['oldname']));
|
||||
$newname = checkName(unsanitize($file['newname']));
|
||||
$oldFile = $MY_DOCUMENT_ROOT.$MY_PATH.$oldname;
|
||||
$newFile = $MY_DOCUMENT_ROOT.$MY_PATH.$newname;
|
||||
if (is_dir($oldFile)) {
|
||||
if (is_dir($newFile)) {
|
||||
$error = $error.'\n'.alertSanitize($MY_MESSAGES['folderalreadyexists'].' ('.$oldFile.' -> '.$newFile.')');
|
||||
} else {
|
||||
if (!rename($oldFile, $newFile)) $error = $error.'\n'.alertSanitize($MY_MESSAGES['renamefailed'].' ('.$oldFile.' -> '.$newFile.')');
|
||||
}
|
||||
} else {
|
||||
$error = $error.'\n'.alertSanitize($MY_MESSAGES['foldernotfound'].' ('.$oldFile.')');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_REQUEST['files']) && is_array($_REQUEST['files'])) {
|
||||
foreach ($_REQUEST['files'] as $file) {
|
||||
$oldname = checkName(unsanitize($file['oldname']));
|
||||
$newname = checkName(unsanitize($file['newname']));
|
||||
$parts = explode('.', $newname);
|
||||
$ext = strtolower($parts[count($parts)-1]);
|
||||
if (is_array($MY_DENY_EXTENSIONS )) {
|
||||
if (in_array($ext, $MY_DENY_EXTENSIONS)) $error = $error.'\n'.$MY_MESSAGES['extnotallowed'];
|
||||
}
|
||||
if (is_array($MY_ALLOW_EXTENSIONS )) {
|
||||
if (!in_array($ext, $MY_ALLOW_EXTENSIONS)) $error = $error.'\n'.$MY_MESSAGES['extnotallowed'];
|
||||
}
|
||||
$oldFile = $MY_DOCUMENT_ROOT.$MY_PATH.$oldname;
|
||||
$newFile = $MY_DOCUMENT_ROOT.$MY_PATH.$newname;
|
||||
if (is_file($oldFile)) {
|
||||
if (is_file($newFile)) {
|
||||
$error = $error.'\n'.alertSanitize($MY_MESSAGES['filealreadyexists'].' ('.$oldFile.' -> '.$newFile.')');
|
||||
} else {
|
||||
if (!rename($oldFile, $newFile)) $error = $error.'\n'.alertSanitize($MY_MESSAGES['renamefailed'].' ('.$oldFile.' -> '.$newFile.')');
|
||||
}
|
||||
} else {
|
||||
$error = $error.'\n'.alertSanitize($MY_MESSAGES['filenotfound'].' ('.$oldFile.')');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$refresh_dirs = true;
|
||||
return $error;
|
||||
}
|
||||
|
||||
function moveFile() {
|
||||
global $MY_ALLOW_MOVE, $MY_MESSAGES, $MY_DOCUMENT_ROOT, $MY_PATH, $refresh_dirs;
|
||||
global $MY_ALLOW_EXTENSIONS, $MY_DENY_EXTENSIONS ;
|
||||
$error = false;
|
||||
if (!$MY_ALLOW_MOVE) return ($MY_MESSAGES['nopermtomove']);
|
||||
$newPath = pathSlashes(checkName($_REQUEST['newpath']));
|
||||
if (!(is_dir($MY_DOCUMENT_ROOT.$newPath))) return ($MY_MESSAGES['pathnotfound']);
|
||||
if (isset($_REQUEST['folders']) && is_array($_REQUEST['folders'])) {
|
||||
foreach ($_REQUEST['folders'] as $file) {
|
||||
$name = checkName(unsanitize($file));
|
||||
$oldFile = $MY_DOCUMENT_ROOT.$MY_PATH.$name;
|
||||
$newFile = $MY_DOCUMENT_ROOT.$newPath.$name;
|
||||
if (is_dir($oldFile)) {
|
||||
if (is_dir($newFile)) {
|
||||
$error = $error.'\n'.alertSanitize($MY_MESSAGES['folderalreadyexists'].' ('.$oldFile.' -> '.$newFile.')');
|
||||
} else {
|
||||
if (!rename($oldFile, $newFile)) $error = $error.'\n'.alertSanitize($MY_MESSAGES['renamefailed'].' ('.$oldFile.' -> '.$newFile.')');
|
||||
}
|
||||
} else {
|
||||
$error = $error.'\n'.alertSanitize($MY_MESSAGES['foldernotfound'].' ('.$oldFile.')');
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isset($_REQUEST['files']) && is_array($_REQUEST['files'])) {
|
||||
foreach ($_REQUEST['files'] as $file) {
|
||||
$name = checkName(unsanitize($file));
|
||||
$oldFile = $MY_DOCUMENT_ROOT.$MY_PATH.$name;
|
||||
$newFile = $MY_DOCUMENT_ROOT.$newPath.$name;
|
||||
if (is_file($oldFile)) {
|
||||
if (is_file($newFile)) {
|
||||
$error = $error.'\n'.alertSanitize($MY_MESSAGES['filealreadyexists'].' ('.$oldFile.' -> '.$newFile.')');
|
||||
} else {
|
||||
if (!rename($oldFile, $newFile)) $error = $error.'\n'.alertSanitize($MY_MESSAGES['renamefailed'].' ('.$oldFile.' -> '.$newFile.')');
|
||||
}
|
||||
} else {
|
||||
$error = $error.'\n'.alertSanitize($MY_MESSAGES['filenotfound'].' ('.$oldFile.')');
|
||||
}
|
||||
}
|
||||
}
|
||||
$refresh_dirs = true;
|
||||
return $error;
|
||||
}
|
||||
|
||||
function uploadFile() {
|
||||
global $MY_ALLOW_UPLOAD, $MY_MESSAGES, $MY_DOCUMENT_ROOT, $MY_PATH, $clear_upload;
|
||||
global $MY_ALLOW_EXTENSIONS, $MY_DENY_EXTENSIONS, $MY_MAX_FILE_SIZE ;
|
||||
if (!$MY_ALLOW_UPLOAD) return ($MY_MESSAGES['nopermtoupload']);
|
||||
if (!(is_dir($MY_DOCUMENT_ROOT.$MY_PATH))) return ($MY_MESSAGES['pathnotfound']);
|
||||
$filename = checkName($_FILES['uploadFile']['name']);
|
||||
$newFile = $MY_DOCUMENT_ROOT.$MY_PATH.$filename;
|
||||
$parts = explode('.', $filename);
|
||||
$ext = strtolower($parts[count($parts)-1]);
|
||||
if (is_file($newFile)) return ($MY_MESSAGES['uploadfilealreadyexists']);
|
||||
if (is_array($MY_DENY_EXTENSIONS )) {
|
||||
if (in_array($ext, $MY_DENY_EXTENSIONS)) return ($MY_MESSAGES['extnotallowed']);
|
||||
}
|
||||
if (is_array($MY_ALLOW_EXTENSIONS )) {
|
||||
if (!in_array($ext, $MY_ALLOW_EXTENSIONS)) return ($MY_MESSAGES['extnotallowed']);
|
||||
}
|
||||
if ($MY_MAX_FILE_SIZE) {
|
||||
if ($_FILES['uploadFile']['size'] > $MY_MAX_FILE_SIZE) return ($MY_MESSAGES['filesizeexceedlimit'].' of '.($MY_MAX_FILE_SIZE/1024).'kB.');
|
||||
}
|
||||
if (!is_file($_FILES['uploadFile']['tmp_name'])) return ($MY_MESSAGES['filenotuploaded']);
|
||||
move_uploaded_file($_FILES['uploadFile']['tmp_name'], $newFile);
|
||||
chmod($newFile, 0666);
|
||||
$clear_upload = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isset($_REQUEST['action'])) {
|
||||
if ('delete' == $_REQUEST['action']) $err = deleteFile();
|
||||
if ('rename' == $_REQUEST['action']) $err = renameFile();
|
||||
if ('move' == $_REQUEST['action']) $err = moveFile();
|
||||
if ('createFolder' == $_REQUEST['action']) $err = createFolder();
|
||||
}
|
||||
if (isset($_FILES['uploadFile']) && is_array($_FILES['uploadFile'])) $err = uploadFile();
|
||||
|
||||
|
||||
function parse_size($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 parse_time($timestamp) {
|
||||
global $MY_DATETIME_FORMAT;
|
||||
return date($MY_DATETIME_FORMAT, $timestamp);
|
||||
}
|
||||
|
||||
|
||||
function draw_no_results() {
|
||||
global $MY_MESSAGES;
|
||||
echo '<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0" style="background-color:Window;"> <tr>
|
||||
<td><div align="center" style="font-size:large;font-weight:bold;color:#CCCCCC;font-family: Helvetica, sans-serif;">';
|
||||
echo $MY_MESSAGES['nofiles'];
|
||||
echo '</div></td></tr></table>';
|
||||
}
|
||||
|
||||
function draw_no_dir() {
|
||||
global $MY_MESSAGES;
|
||||
global $MY_DOCUMENT_ROOT;
|
||||
echo '<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0" style="background-color:Window;"><tr>
|
||||
<td><div align="center" style="font-size:small;font-weight:bold;color:#CC0000;font-family: Helvetica, sans-serif;">';
|
||||
echo $MY_MESSAGES['configproblem']." ".$MY_DOCUMENT_ROOT;
|
||||
echo '</div></td></tr></table>';
|
||||
}
|
||||
|
||||
?>
|
||||
<html>
|
||||
<head>
|
||||
<title>File Browser</title>
|
||||
<?php
|
||||
echo '<meta http-equiv="content-language" content="'.$MY_LANG.'" />'."\n";
|
||||
echo '<meta http-equiv="Content-Type" content="text/html; charset='.$MY_CHARSET.'" />'."\n";
|
||||
echo '<meta name="author" content="AlRashid, www: http://alrashid.klokan.sk; mailto:alrashid@klokan.sk" />'."\n";
|
||||
?>
|
||||
|
||||
<style type="text/css">
|
||||
<!--
|
||||
body {
|
||||
font-family: Verdana, Helvetica, Arial, Sans-Serif;
|
||||
font: message-box;
|
||||
background: ThreedFace;
|
||||
}
|
||||
code {
|
||||
font-size: 1em;
|
||||
}
|
||||
|
||||
a {
|
||||
color: black;
|
||||
}
|
||||
|
||||
a:visited {
|
||||
color: black;
|
||||
}
|
||||
.selected a {
|
||||
background: Highlight;
|
||||
color: HighlightText;
|
||||
}
|
||||
.selected a:visited {
|
||||
background: Highlight;
|
||||
color: HighlightText;
|
||||
}
|
||||
|
||||
|
||||
.selected {
|
||||
background: Highlight;
|
||||
color: HighlightText;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
border: 1px solid ThreeDShadow;
|
||||
border: 1px solid;
|
||||
border-color: ThreeDShadow ThreeDHighLight
|
||||
ThreeDHighLight ThreeDShadow;
|
||||
|
||||
background: Window;
|
||||
}
|
||||
*/
|
||||
td {
|
||||
font: icon;
|
||||
padding: 2px 5px;
|
||||
cursor: default;
|
||||
-moz-user-select: none;
|
||||
}
|
||||
-->
|
||||
</style>
|
||||
<link type="text/css" rel="StyleSheet" href="css/sortabletable.css" />
|
||||
<script type="text/javascript" src="js/sortabletable.js"></script>
|
||||
<script type="text/javascript" src="js/selectableelements.js"></script>
|
||||
<script type="text/javascript" src="js/selectabletablerows.js"></script>
|
||||
|
||||
|
||||
<script language="JavaScript" type="text/JavaScript">
|
||||
/*<![CDATA[*/
|
||||
|
||||
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 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],window.top.document))!=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 = '<?php echo $MY_MESSAGES['loading']; ?>';
|
||||
}
|
||||
else if(state == 'upload') {
|
||||
statusText = '<?php echo $MY_MESSAGES['uploading']; ?>';
|
||||
}
|
||||
if(statusText != null) {
|
||||
var obj = MM_findObj('loadingStatus', window.top.document);
|
||||
if (obj != null && obj.innerHTML != null)
|
||||
obj.innerHTML = statusText;
|
||||
MM_showHideLayers('loading','','show')
|
||||
}
|
||||
}
|
||||
|
||||
function changeDir(nb) {
|
||||
changeLoadingStatus('load');
|
||||
var postForm2 = document.getElementById('form2');
|
||||
postForm2.elements["action"].value="changeDir";
|
||||
postForm2.elements["path"].value=postForm2.elements["path"].value+folderJSArray[nb][1];
|
||||
postForm2.submit();
|
||||
}
|
||||
|
||||
function setSortBy(column, noclick) {
|
||||
switch (column) {
|
||||
case 0: st2.sort(4);
|
||||
if (noclick) st.sort(0);
|
||||
break;
|
||||
case 2: st2.sort(5);
|
||||
if (noclick) st.sort(2);
|
||||
break;
|
||||
case 3: st1.sort(6);
|
||||
st2.sort(6);
|
||||
if (noclick) st.sort(3);
|
||||
break;
|
||||
default: st1.sort(1);
|
||||
st2.sort(1);
|
||||
if (noclick) st.sort(1);
|
||||
}
|
||||
var topDoc = window.top.document.forms[0];
|
||||
topDoc.sortby.value = column;
|
||||
}
|
||||
|
||||
function getSortBy() {
|
||||
var topDoc = window.top.document.forms[0];
|
||||
return (topDoc.sortby.value);
|
||||
}
|
||||
|
||||
function fileSelected(filename, caption, ext, width, height)
|
||||
{
|
||||
var topDoc = window.top.document.forms[0];
|
||||
topDoc.f_url.value = filename;
|
||||
topDoc.f_url2.value = filename;
|
||||
topDoc.f_caption.value = caption;
|
||||
topDoc.f_alt.value = caption;
|
||||
topDoc.f_width.value = width;
|
||||
topDoc.f_height.value = height;
|
||||
topDoc.orginal_width.value = width;
|
||||
topDoc.orginal_height.value = height;
|
||||
topDoc.f_ext.value = ext;
|
||||
}
|
||||
|
||||
function updateDir() {
|
||||
var newPath = "<?php echo $MY_PATH; ?>";
|
||||
if(window.top.document.forms[0] != null) {
|
||||
var allPaths = window.top.document.forms[0].path.options;
|
||||
for(i=0; i<allPaths.length; i++) {
|
||||
allPaths.item(i).selected = false;
|
||||
if((allPaths.item(i).value)==newPath) {
|
||||
allPaths.item(i).selected = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
<?php
|
||||
if($clear_upload) {
|
||||
echo '
|
||||
var topDoc = window.top.document.forms[0];
|
||||
topDoc.uploadFile.value = null;
|
||||
';
|
||||
}
|
||||
if ($refresh_dirs) { ?>
|
||||
function refreshDirs() {
|
||||
var allPaths = window.top.document.forms[0].path.options;
|
||||
var fields = ['/' <?php dirs($MY_DOCUMENT_ROOT,'');?>];
|
||||
var newPath = '<?php echo sanitize2($MY_PATH); ?>';
|
||||
for(i = allPaths.length; i > 0; i--) {
|
||||
allPaths[i-1]=null;
|
||||
}
|
||||
|
||||
for(i=0; i<fields.length; i++) {
|
||||
var newElem = document.createElement("OPTION");
|
||||
var newValue = fields[i];
|
||||
newElem.text = newValue;
|
||||
newElem.value = newValue;
|
||||
if(newValue == newPath)
|
||||
newElem.selected = true;
|
||||
else
|
||||
newElem.selected = false;
|
||||
allPaths.add(newElem);
|
||||
}
|
||||
}
|
||||
refreshDirs();
|
||||
<?php
|
||||
}
|
||||
if ($err) {
|
||||
echo 'alert(\''.$err.'\');';
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
/*]]>*/
|
||||
</script>
|
||||
</head>
|
||||
<body onload="updateDir();">
|
||||
<form action="files.php?dialogname=<?php echo $MY_NAME; ?>&refresh=1" id="form2" name="form2" method="post" enctype="multipart/form-data">
|
||||
<input type="hidden" name="action" id="action" value="" />
|
||||
<input type="hidden" name="path" id="path" value="<?php echo $MY_PATH; ?>" />
|
||||
<input type="hidden" name="uppath" id="uppath" value="<?php echo $MY_UP_PATH; ?>" />
|
||||
<input type="hidden" name="newpath" id="newpath" value="" />
|
||||
<input type="hidden" name="file" id="file" value="" />
|
||||
<input type="hidden" name="view" id="view" value="<?php echo $_REQUEST['view'] ?>" />
|
||||
</form>
|
||||
|
||||
<?php
|
||||
$d = @dir($MY_DOCUMENT_ROOT.$MY_PATH);
|
||||
if($d) {
|
||||
|
||||
$classname = 'view_'.$_REQUEST['view'];
|
||||
include_once $classname.'.php';
|
||||
$view = new $classname;
|
||||
|
||||
$entries_cnt = 0;
|
||||
$fileNb=0;
|
||||
$folderNb=0;
|
||||
$fileJSArray='var fileJSArray = [';
|
||||
$folderJSArray='var folderJSArray = [';
|
||||
$params['MY_MESSAGES'] = $MY_MESSAGES;
|
||||
$params['MY_BASE_URL'] = $MY_BASE_URL;
|
||||
while (false !== ($entry = $d->read())) {
|
||||
if(substr($entry,0,1) != '.') {
|
||||
$params['entry'] = $entry;
|
||||
$params['relativePath'] = $relativePath = $MY_PATH.$entry;
|
||||
$params['absolutePath'] = $absolutePath = $MY_DOCUMENT_ROOT.$relativePath;
|
||||
if (is_dir($absolutePath)) {
|
||||
$entries_cnt++;
|
||||
$params['time'] = $time = filemtime($absolutePath);
|
||||
$params['parsed_time'] = $parsed_time = parse_time($time);
|
||||
$params['folderNb'] = $folderNb;
|
||||
$folders_body .= $view->folder_item($params);
|
||||
$folderJSArray .= "['images/ext/folder_small.gif', '".sanitize2($entry)."', '".$MY_MESSAGES['folder']."', '".$parsed_time."'],\n";
|
||||
$folderNb++;
|
||||
} else {
|
||||
$entries_cnt++;
|
||||
$params['ext'] = $ext = substr(strrchr($entry, '.'), 1);
|
||||
if (is_array($MY_LIST_EXTENSIONS)) {
|
||||
if (!in_array(strtolower($ext), $MY_LIST_EXTENSIONS)) continue;
|
||||
}
|
||||
$params['info'] = array(800,600);
|
||||
if(in_array(strtolower($ext),array('jpg','gif','png','jpeg'))) $params['info'] = @getimagesize($absolutePath);
|
||||
$params['size'] = $size = filesize($absolutePath);
|
||||
$params['time'] = $time = filemtime($absolutePath);
|
||||
$params['parsed_size'] = $parsed_size = parse_size($size);
|
||||
$params['parsed_time'] = $parsed_time = parse_time($time);
|
||||
$params['parsed_icon'] = $parsed_icon = 'img/ext/'.parse_icon($ext);
|
||||
$params['fileNb'] = $fileNb;
|
||||
$files_body .= $view->files_item($params);
|
||||
$fileJSArray .= "['".$parsed_icon."', '".sanitize2($entry)."', '".$parsed_size."', '".$parsed_time."', '".$ext."'],\n";
|
||||
$fileNb++;
|
||||
}
|
||||
}
|
||||
}
|
||||
$d->close();
|
||||
$folderJSArray .= "['', '', '', '']];\n";
|
||||
$fileJSArray .= "['', '', '', '', '']];\n";
|
||||
|
||||
if ($entries_cnt) {
|
||||
echo $view->table_header($params);
|
||||
// echo "\n<div style=\"height:90%; overflow: auto; overflow-y: scroll; background-color:window;\">";
|
||||
echo $view->folders_header($params).$folders_body.$view->folders_footer($params)."\n";
|
||||
echo $view->files_header($params). $files_body. $view->files_footer($params)."\n";
|
||||
// echo "</div>"."\n";
|
||||
echo $view->table_footer($params);
|
||||
|
||||
echo '<script type="text/javascript">';
|
||||
echo '/*<![CDATA[*/';
|
||||
echo $folderJSArray;
|
||||
echo $fileJSArray;
|
||||
echo '/*]]>*/';
|
||||
echo '</script>';
|
||||
}
|
||||
else {
|
||||
draw_no_results();
|
||||
}
|
||||
}
|
||||
elseif($_REQUEST['view'] == 'icon' && $d){
|
||||
$images = array();
|
||||
$folders = array();
|
||||
while (false !== ($entry = $d->read()))
|
||||
{
|
||||
$img_file = $MY_PATH.$entry;
|
||||
$BASE_DIR = $MY_DOCUMENT_ROOT;
|
||||
$BASE_URL = $MY_BASE_URL;
|
||||
// $img_file = $IMG_ROOT.$entry;
|
||||
|
||||
if(is_file($BASE_DIR.$img_file) && substr($entry,0,1) != '.')
|
||||
{
|
||||
$image_info = @getimagesize($BASE_DIR.$img_file);
|
||||
if(is_array($image_info))
|
||||
{
|
||||
$file_details['file'] = $img_file;
|
||||
$file_details['img_info'] = $image_info;
|
||||
$file_details['size'] = filesize($BASE_DIR.$img_file);
|
||||
$images[$entry] = $file_details;
|
||||
//show_image($img_file, $entry, $image_info);
|
||||
}
|
||||
}
|
||||
else if(is_dir($BASE_DIR.$img_file) && substr($entry,0,1) != '.')
|
||||
{
|
||||
$folders[$entry] = $img_file;
|
||||
//show_dir($img_file, $entry);
|
||||
}
|
||||
}
|
||||
$d->close();
|
||||
|
||||
if(count($images) > 0 || count($folders) > 0)
|
||||
{
|
||||
//now sort the folders and images by name.
|
||||
ksort($images);
|
||||
ksort($folders);
|
||||
|
||||
echo '<table border="0" cellpadding="0" cellspacing="2"><tr>';
|
||||
|
||||
for($i=0; $i<count($folders); $i++)
|
||||
{
|
||||
$folder_name = key($folders);
|
||||
// show_dir($folders[$folder_name], $folder_name);
|
||||
next($folders);
|
||||
}
|
||||
foreach($images as $image => $info)
|
||||
{
|
||||
// $image_name = key($images);
|
||||
show_image($info['file'], $image, $info['img_info'], $info['size']);
|
||||
}
|
||||
echo '</tr></table>';
|
||||
}
|
||||
else
|
||||
{
|
||||
draw_no_results();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
draw_no_dir();
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<script language="JavaScript" type="text/JavaScript">
|
||||
/*<![CDATA[*/
|
||||
MM_showHideLayers('loading','','hide')
|
||||
/*]]>*/
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
66
phpgwapi/js/tinymce/jscripts/tiny_mce/plugins/filemanager/InsertFile/functions.php
vendored
Normal file
@ -0,0 +1,66 @@
|
||||
<?php
|
||||
/***********************************************************************
|
||||
** Title.........: Insert File Dialog, File Manager
|
||||
** Version.......: 1.1
|
||||
** Authors.......: Al Rashid <alrashid@klokan.sk>
|
||||
** Xiang Wei ZHUO <wei@zhuo.org>
|
||||
** Filename......: functions.php
|
||||
** URL...........: http://alrashid.klokan.sk/insFile/
|
||||
** Last changed..: 23 July 2004
|
||||
***********************************************************************/
|
||||
|
||||
|
||||
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);
|
||||
$cntDir = count($dirs);
|
||||
for($i=0; $i<$cntDir; $i++) {
|
||||
$name = key($dirs);
|
||||
$current_dir = $abs_path.'/'.$dirs[$name]['name'];
|
||||
echo ", '".sanitize2($current_dir)."/'\n";
|
||||
dirs($dirs[$name]['path'],$current_dir);
|
||||
next($dirs);
|
||||
}
|
||||
}
|
||||
|
||||
function checkName($name) {
|
||||
$name = str_replace('../', '', $name);
|
||||
$name = str_replace('./', '', $name);
|
||||
return $name;
|
||||
}
|
||||
function sanitize2($name) {
|
||||
return str_replace("'", "\'", $name);
|
||||
}
|
||||
|
||||
function unsanitize($name) {
|
||||
return str_replace("\'", "'", $name);
|
||||
}
|
||||
|
||||
function pathSlashes($path) {
|
||||
if ('/' != substr($path,0,1)) $path = '/'.$path;
|
||||
if ('/' != substr($path,-1,1)) $path = $path.'/';
|
||||
return $path;
|
||||
}
|
||||
function alertSanitize($path) {
|
||||
return ( sanitize2(str_replace("\\", "\\\\", $path)) );
|
||||
}
|
||||
|
||||
function percent($p, $w)
|
||||
{
|
||||
return (real)(100 * ($p / $w));
|
||||
}
|
||||
|
||||
function unpercent($percent, $whole)
|
||||
{
|
||||
return (real)(($percent * $whole) / 100);
|
||||
}
|
||||
?>
|
BIN
phpgwapi/js/tinymce/jscripts/tiny_mce/plugins/filemanager/InsertFile/img/blank.png
vendored
Normal file
After Width: | Height: | Size: 144 B |
BIN
phpgwapi/js/tinymce/jscripts/tiny_mce/plugins/filemanager/InsertFile/img/btnBack.gif
vendored
Executable file
After Width: | Height: | Size: 603 B |
BIN
phpgwapi/js/tinymce/jscripts/tiny_mce/plugins/filemanager/InsertFile/img/btnFolderNew.gif
vendored
Executable file
After Width: | Height: | Size: 604 B |
BIN
phpgwapi/js/tinymce/jscripts/tiny_mce/plugins/filemanager/InsertFile/img/btnFolderUp.gif
vendored
Executable file
After Width: | Height: | Size: 599 B |
BIN
phpgwapi/js/tinymce/jscripts/tiny_mce/plugins/filemanager/InsertFile/img/btn_Corner.gif
vendored
Normal file
After Width: | Height: | Size: 78 B |
BIN
phpgwapi/js/tinymce/jscripts/tiny_mce/plugins/filemanager/InsertFile/img/btn_create.gif
vendored
Normal file
After Width: | Height: | Size: 200 B |
BIN
phpgwapi/js/tinymce/jscripts/tiny_mce/plugins/filemanager/InsertFile/img/btn_delete.gif
vendored
Normal file
After Width: | Height: | Size: 160 B |
BIN
phpgwapi/js/tinymce/jscripts/tiny_mce/plugins/filemanager/InsertFile/img/btn_move.gif
vendored
Normal file
After Width: | Height: | Size: 214 B |
BIN
phpgwapi/js/tinymce/jscripts/tiny_mce/plugins/filemanager/InsertFile/img/btn_open.gif
vendored
Normal file
After Width: | Height: | Size: 185 B |
BIN
phpgwapi/js/tinymce/jscripts/tiny_mce/plugins/filemanager/InsertFile/img/btn_rename.gif
vendored
Normal file
After Width: | Height: | Size: 193 B |
BIN
phpgwapi/js/tinymce/jscripts/tiny_mce/plugins/filemanager/InsertFile/img/btn_up.gif
vendored
Normal file
After Width: | Height: | Size: 230 B |
BIN
phpgwapi/js/tinymce/jscripts/tiny_mce/plugins/filemanager/InsertFile/img/dots.gif
vendored
Executable file
After Width: | Height: | Size: 181 B |
BIN
phpgwapi/js/tinymce/jscripts/tiny_mce/plugins/filemanager/InsertFile/img/downsimple.png
vendored
Normal file
After Width: | Height: | Size: 201 B |
BIN
phpgwapi/js/tinymce/jscripts/tiny_mce/plugins/filemanager/InsertFile/img/edit_active.gif
vendored
Executable file
After Width: | Height: | Size: 156 B |
BIN
phpgwapi/js/tinymce/jscripts/tiny_mce/plugins/filemanager/InsertFile/img/edit_pencil.gif
vendored
Executable file
After Width: | Height: | Size: 138 B |
BIN
phpgwapi/js/tinymce/jscripts/tiny_mce/plugins/filemanager/InsertFile/img/edit_trash.gif
vendored
Executable file
After Width: | Height: | Size: 145 B |
BIN
phpgwapi/js/tinymce/jscripts/tiny_mce/plugins/filemanager/InsertFile/img/ext/binary_small.gif
vendored
Normal file
After Width: | Height: | Size: 139 B |
BIN
phpgwapi/js/tinymce/jscripts/tiny_mce/plugins/filemanager/InsertFile/img/ext/def_small.gif
vendored
Normal file
After Width: | Height: | Size: 643 B |
BIN
phpgwapi/js/tinymce/jscripts/tiny_mce/plugins/filemanager/InsertFile/img/ext/doc_small.gif
vendored
Normal file
After Width: | Height: | Size: 140 B |
BIN
phpgwapi/js/tinymce/jscripts/tiny_mce/plugins/filemanager/InsertFile/img/ext/folder_small.gif
vendored
Normal file
After Width: | Height: | Size: 176 B |
BIN
phpgwapi/js/tinymce/jscripts/tiny_mce/plugins/filemanager/InsertFile/img/ext/gif_small.gif
vendored
Normal file
After Width: | Height: | Size: 119 B |
BIN
phpgwapi/js/tinymce/jscripts/tiny_mce/plugins/filemanager/InsertFile/img/ext/gz_small.gif
vendored
Normal file
After Width: | Height: | Size: 612 B |
BIN
phpgwapi/js/tinymce/jscripts/tiny_mce/plugins/filemanager/InsertFile/img/ext/html_small.gif
vendored
Normal file
After Width: | Height: | Size: 622 B |
BIN
phpgwapi/js/tinymce/jscripts/tiny_mce/plugins/filemanager/InsertFile/img/ext/image_small.gif
vendored
Normal file
After Width: | Height: | Size: 184 B |
BIN
phpgwapi/js/tinymce/jscripts/tiny_mce/plugins/filemanager/InsertFile/img/ext/jpg_small.gif
vendored
Normal file
After Width: | Height: | Size: 119 B |
BIN
phpgwapi/js/tinymce/jscripts/tiny_mce/plugins/filemanager/InsertFile/img/ext/mov_small.gif
vendored
Normal file
After Width: | Height: | Size: 363 B |
BIN
phpgwapi/js/tinymce/jscripts/tiny_mce/plugins/filemanager/InsertFile/img/ext/no_small.gif
vendored
Normal file
After Width: | Height: | Size: 55 B |
BIN
phpgwapi/js/tinymce/jscripts/tiny_mce/plugins/filemanager/InsertFile/img/ext/pdf_small.gif
vendored
Normal file
After Width: | Height: | Size: 230 B |
BIN
phpgwapi/js/tinymce/jscripts/tiny_mce/plugins/filemanager/InsertFile/img/ext/png_small.gif
vendored
Normal file
After Width: | Height: | Size: 119 B |
BIN
phpgwapi/js/tinymce/jscripts/tiny_mce/plugins/filemanager/InsertFile/img/ext/ppt_small.gif
vendored
Normal file
After Width: | Height: | Size: 139 B |
BIN
phpgwapi/js/tinymce/jscripts/tiny_mce/plugins/filemanager/InsertFile/img/ext/rar_small.gif
vendored
Normal file
After Width: | Height: | Size: 572 B |
BIN
phpgwapi/js/tinymce/jscripts/tiny_mce/plugins/filemanager/InsertFile/img/ext/script_small.gif
vendored
Normal file
After Width: | Height: | Size: 145 B |
BIN
phpgwapi/js/tinymce/jscripts/tiny_mce/plugins/filemanager/InsertFile/img/ext/sound_small.gif
vendored
Normal file
After Width: | Height: | Size: 121 B |
BIN
phpgwapi/js/tinymce/jscripts/tiny_mce/plugins/filemanager/InsertFile/img/ext/txt_small.gif
vendored
Normal file
After Width: | Height: | Size: 234 B |
BIN
phpgwapi/js/tinymce/jscripts/tiny_mce/plugins/filemanager/InsertFile/img/ext/xls_small.gif
vendored
Normal file
After Width: | Height: | Size: 139 B |
BIN
phpgwapi/js/tinymce/jscripts/tiny_mce/plugins/filemanager/InsertFile/img/ext/zip_small.gif
vendored
Normal file
After Width: | Height: | Size: 612 B |
BIN
phpgwapi/js/tinymce/jscripts/tiny_mce/plugins/filemanager/InsertFile/img/folder.gif
vendored
Executable file
After Width: | Height: | Size: 1.3 KiB |
BIN
phpgwapi/js/tinymce/jscripts/tiny_mce/plugins/filemanager/InsertFile/img/folder_new.png
vendored
Normal file
After Width: | Height: | Size: 649 B |
BIN
phpgwapi/js/tinymce/jscripts/tiny_mce/plugins/filemanager/InsertFile/img/loading.gif
vendored
Executable file
After Width: | Height: | Size: 1.1 KiB |
BIN
phpgwapi/js/tinymce/jscripts/tiny_mce/plugins/filemanager/InsertFile/img/locked.gif
vendored
Executable file
After Width: | Height: | Size: 401 B |
BIN
phpgwapi/js/tinymce/jscripts/tiny_mce/plugins/filemanager/InsertFile/img/move.png
vendored
Normal file
After Width: | Height: | Size: 216 B |
BIN
phpgwapi/js/tinymce/jscripts/tiny_mce/plugins/filemanager/InsertFile/img/noimages.gif
vendored
Executable file
After Width: | Height: | Size: 780 B |
BIN
phpgwapi/js/tinymce/jscripts/tiny_mce/plugins/filemanager/InsertFile/img/remove.png
vendored
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
phpgwapi/js/tinymce/jscripts/tiny_mce/plugins/filemanager/InsertFile/img/revert.png
vendored
Normal file
After Width: | Height: | Size: 780 B |
BIN
phpgwapi/js/tinymce/jscripts/tiny_mce/plugins/filemanager/InsertFile/img/thumbnail.png
vendored
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
phpgwapi/js/tinymce/jscripts/tiny_mce/plugins/filemanager/InsertFile/img/unlocked.gif
vendored
Normal file
After Width: | Height: | Size: 73 B |
BIN
phpgwapi/js/tinymce/jscripts/tiny_mce/plugins/filemanager/InsertFile/img/up.png
vendored
Normal file
After Width: | Height: | Size: 849 B |
BIN
phpgwapi/js/tinymce/jscripts/tiny_mce/plugins/filemanager/InsertFile/img/uploading.gif
vendored
Executable file
After Width: | Height: | Size: 1.0 KiB |
BIN
phpgwapi/js/tinymce/jscripts/tiny_mce/plugins/filemanager/InsertFile/img/upsimple.png
vendored
Normal file
After Width: | Height: | Size: 201 B |
BIN
phpgwapi/js/tinymce/jscripts/tiny_mce/plugins/filemanager/InsertFile/img/view_icon.png
vendored
Normal file
After Width: | Height: | Size: 610 B |
BIN
phpgwapi/js/tinymce/jscripts/tiny_mce/plugins/filemanager/InsertFile/img/view_text.png
vendored
Normal file
After Width: | Height: | Size: 632 B |
774
phpgwapi/js/tinymce/jscripts/tiny_mce/plugins/filemanager/InsertFile/insert_file.php
vendored
Normal file
@ -0,0 +1,774 @@
|
||||
<?php
|
||||
/***********************************************************************
|
||||
** Title.........: Insert File Dialog, File Manager
|
||||
** Version.......: 1.1
|
||||
** Authors.......: Al Rashid <alrashid@klokan.sk>
|
||||
** Xiang Wei ZHUO <wei@zhuo.org>
|
||||
** Filename......: insert_file.php
|
||||
** URL...........: http://alrashid.klokan.sk/insFile/
|
||||
** Last changed..: 23 July 2004
|
||||
***********************************************************************/
|
||||
require('config.inc.php');
|
||||
?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>Insert File</title>
|
||||
<?php
|
||||
echo '<META HTTP-EQUIV="Pragma" CONTENT="no-cache">'."\n";
|
||||
echo '<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">'."\n";
|
||||
echo '<META HTTP-EQUIV="Expires" CONTENT="Fri, Oct 24 1976 00:00:00 GMT">'."\n";
|
||||
echo '<meta http-equiv="content-language" content="'.$MY_LANG.'" />'."\n";
|
||||
echo '<meta http-equiv="Content-Type" content="text/html; charset='.$MY_CHARSET.'" />'."\n";
|
||||
echo '<meta name="author" content="AlRashid, www: http://alrashid.klokan.sk; mailto:alrashid@klokan.sk" />'."\n";
|
||||
?>
|
||||
<script type="text/javascript" src="js/popup.js"></script>
|
||||
<script type="text/javascript" src="js/dialog.js"></script>
|
||||
<script language="javascript" src="../../../tiny_mce_popup.js"></script>
|
||||
<style type="text/css">
|
||||
body { padding: 5px; }
|
||||
table {
|
||||
font: 11px Tahoma,Verdana,sans-serif;
|
||||
}
|
||||
form p {
|
||||
margin-top: 5px;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
fieldset { padding: 0px 10px 5px 5px; }
|
||||
select, input, button { font: 11px Tahoma,Verdana,sans-serif; }
|
||||
button { width: 70px; }
|
||||
|
||||
.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; }
|
||||
a { padding: 2px; border: 1px solid ButtonFace; }
|
||||
a img { border: 0px; vertical-align:bottom; }
|
||||
a:hover { border-color: ButtonHighlight ButtonShadow ButtonShadow ButtonHighlight; }
|
||||
</style>
|
||||
|
||||
<script language="JavaScript" type="text/JavaScript">
|
||||
/*<![CDATA[*/
|
||||
var preview_window = null;
|
||||
var resize_iframe_constant = 150;
|
||||
<?php
|
||||
if (is_array($MY_DENY_EXTENSIONS)) {
|
||||
echo 'var DenyExtensions = [';
|
||||
foreach($MY_DENY_EXTENSIONS as $value) echo '"'.$value.'", ';
|
||||
echo '""];
|
||||
';
|
||||
}
|
||||
if (is_array($MY_ALLOW_EXTENSIONS)) {
|
||||
echo 'var AllowExtensions = [';
|
||||
foreach($MY_ALLOW_EXTENSIONS as $value) echo '"'.$value.'", ';
|
||||
echo '""];
|
||||
';
|
||||
}
|
||||
?>
|
||||
|
||||
function Init() {
|
||||
};
|
||||
|
||||
function onOK() {
|
||||
if (window.opener) {
|
||||
var myPath = fileManager.document.getElementById('form2').elements["path"].value;
|
||||
if(fileManager.stb) {
|
||||
var fileItems = fileManager.stb.getSelectedItems();
|
||||
}
|
||||
else { // in icon mode, only one file could be selected at onece
|
||||
var fileItems = '1';
|
||||
}
|
||||
var returnFiles = new Array();
|
||||
var base_path = '<?php echo $MY_BASE_URL; ?>';
|
||||
var path = base_path+myPath;
|
||||
var editor_url = tinyMCE.baseURL;
|
||||
var plugin_url = "/plugins/filemanager/InsertFile/";
|
||||
|
||||
var output = "";
|
||||
for (var i=0; i<fileItems.length; i++) {
|
||||
var param = new Object();
|
||||
|
||||
if(fileItems != 1) {
|
||||
var strId = fileItems[i].getAttribute("id").toString();
|
||||
var trId = parseInt(strId.substring(1, strId.length));
|
||||
param['f_icon'] = editor_url+plugin_url+fileManager.fileJSArray[trId][0];
|
||||
param['f_size'] = fileManager.fileJSArray[trId][2];
|
||||
param['f_date'] = fileManager.fileJSArray[trId][3];
|
||||
}
|
||||
|
||||
// if only one file is selected, we take the parameters out of the input fields
|
||||
if(fileItems.length == 1) {
|
||||
var fields = ["f_url", "f_alt", "f_caption", "f_align", "f_border", "f_horiz", "f_vert", "f_width", "f_height", "f_ext"];
|
||||
for (var i in fields) {
|
||||
param[fields[i]] = (MM_findObj(fields[i])).value;
|
||||
}
|
||||
if(param['f_url'].length < 1){
|
||||
alert("You must enter the URL");
|
||||
(MM_findObj('f_url')).focus;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// otherwise we need to generate some usefull values
|
||||
else {
|
||||
|
||||
}
|
||||
|
||||
if((MM_findObj("f_action")).value == "f_action_filelink"){
|
||||
var icon = "";
|
||||
var caption = "";
|
||||
var formObj = document.forms[0];
|
||||
if (formObj.f_addicon.checked==true) icon = '<img src="' + param['f_icon'] + '" alt="' + param['f_caption'] + '"> ';
|
||||
if (formObj.f_addsize.checked==true || formObj.f_adddate.checked==true) caption = caption + ' (<span style="font-size:80%">';
|
||||
if (formObj.f_addsize.checked==true) caption = caption + param['f_size'];
|
||||
if (formObj.f_adddate.checked==true) caption = caption + ' ' + param['f_date'];
|
||||
if (formObj.f_addsize.checked==true || formObj.f_adddate.checked==true) caption = caption + '</span>) ';
|
||||
output = output + icon + '<a href="' + param['f_url'] + '">' + param['f_caption'] + '</a>' + caption;
|
||||
}
|
||||
if((MM_findObj("f_action")).value == "f_action_inline"){
|
||||
if(param['f_ext'] == 'jpg' || param['f_ext'] == 'jpeg' || param['f_ext'] == 'gif' || param['f_ext'] == 'png'){
|
||||
output = output + '<img src="' + '/' + param['f_url'] + '"';
|
||||
}
|
||||
else
|
||||
{
|
||||
var inlineobj = true;
|
||||
output = output + '<object src="' + '/' + param['f_url'] + '"';
|
||||
}
|
||||
if(param['f_alt'] > 0) output = output + 'alt="' + param['f_alt'] + '"';
|
||||
if(param['f_align'] > 0) output = output + 'align="' + param['f_align'] + '"';
|
||||
if(param['f_border'] > 0) output = output + 'border="' + param['f_border'] + '"';
|
||||
if(param['f_width'] > 0) output = output + 'width="' + param['f_width'] + '"';
|
||||
if(param['f_height'] > 0) output = output + 'height="' + param['f_height'] + '"';
|
||||
output = output + '>';
|
||||
if(inlineobj == true) output = output + '</object>';
|
||||
}
|
||||
}
|
||||
tinyMCE.execCommand("mceInsertContent",true,output);
|
||||
top.close();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
function onCancel() {
|
||||
top.close();
|
||||
return false;
|
||||
};
|
||||
|
||||
function changeDir(selection) {
|
||||
changeLoadingStatus('load');
|
||||
var newDir = selection.options[selection.selectedIndex].value;
|
||||
var postForm2 = fileManager.document.getElementById('form2');
|
||||
postForm2.elements["action"].value="changeDir";
|
||||
postForm2.elements["path"].value=newDir;
|
||||
postForm2.submit();
|
||||
}
|
||||
|
||||
function goUpDir() {
|
||||
var selection = document.forms[0].path;
|
||||
var dir = selection.options[selection.selectedIndex].value;
|
||||
if(dir != '/'){
|
||||
changeLoadingStatus('load');
|
||||
var postForm2 = fileManager.document.getElementById('form2');
|
||||
postForm2.elements["action"].value="changeDir";
|
||||
postForm2.elements["path"].value=postForm2.elements["uppath"].value;
|
||||
postForm2.submit();
|
||||
}
|
||||
}
|
||||
|
||||
function newFolder() {
|
||||
var selection = document.forms[0].path;
|
||||
var path = selection.options[selection.selectedIndex].value;
|
||||
var folder = prompt('<?php echo $MY_MESSAGES['newfolder']; ?>','');
|
||||
if (folder) {
|
||||
changeLoadingStatus('load');
|
||||
var postForm2 = fileManager.document.getElementById('form2');
|
||||
postForm2.elements["action"].value="createFolder";
|
||||
postForm2.elements["file"].value=folder;
|
||||
postForm2.submit();
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
function deleteFile() {
|
||||
var folderItems = fileManager.sta.getSelectedItems();
|
||||
var folderItemsLength = folderItems.length;
|
||||
var fileItems = fileManager.stb.getSelectedItems();
|
||||
var fileItemsLength = fileItems.length;
|
||||
var message = "<?php echo $MY_MESSAGES['delete']; ?>";
|
||||
if ((folderItemsLength == 0) && (fileItemsLength == 0)) return false;
|
||||
if (folderItemsLength > 0) {
|
||||
message = message + " " + folderItemsLength + " " + "<?php echo $MY_MESSAGES['folders']; ?>";
|
||||
}
|
||||
if (fileItemsLength > 0) {
|
||||
message = message + " " + fileItemsLength + " " + "<?php echo $MY_MESSAGES['files']; ?>";
|
||||
}
|
||||
if (confirm(message+" ?")) {
|
||||
var postForm2 = fileManager.document.getElementById('form2');
|
||||
for (var i=0; i<folderItemsLength; i++) {
|
||||
var strId = folderItems[i].getAttribute("id").toString();
|
||||
var trId = parseInt(strId.substring(1, strId.length));
|
||||
var i_field = fileManager.document.createElement('INPUT');
|
||||
i_field.type = 'hidden';
|
||||
i_field.name = 'folders[' + i.toString() + ']';
|
||||
i_field.value = fileManager.folderJSArray[trId][1];
|
||||
postForm2.appendChild(i_field);
|
||||
}
|
||||
for (var i=0; i<fileItemsLength; i++) {
|
||||
var strId = fileItems[i].getAttribute("id").toString();
|
||||
var trId = parseInt(strId.substring(1, strId.length));
|
||||
var i_field = fileManager.document.createElement('INPUT');
|
||||
i_field.type = 'hidden';
|
||||
i_field.name = 'files[' + i.toString() + ']';
|
||||
i_field.value = fileManager.fileJSArray[trId][1];
|
||||
postForm2.appendChild(i_field);
|
||||
}
|
||||
changeLoadingStatus('load');
|
||||
postForm2.elements["action"].value="delete";
|
||||
postForm2.submit();
|
||||
}
|
||||
}
|
||||
|
||||
function renameFile() {
|
||||
var folderItems = fileManager.sta.getSelectedItems();
|
||||
var folderItemsLength = folderItems.length;
|
||||
var fileItems = fileManager.stb.getSelectedItems();
|
||||
var fileItemsLength = fileItems.length;
|
||||
var postForm2 = fileManager.document.getElementById('form2');
|
||||
if ((folderItemsLength == 0) && (fileItemsLength == 0)) return false;
|
||||
if (!confirm('<?php echo $MY_MESSAGES['renamewarning']; ?>')) return false;
|
||||
for (var i=0; i<folderItemsLength; i++) {
|
||||
var strId = folderItems[i].getAttribute("id").toString();
|
||||
var trId = parseInt(strId.substring(1, strId.length));
|
||||
var newname = prompt('<?php echo $MY_MESSAGES['renamefolder']; ?>', fileManager.folderJSArray[trId][1]);
|
||||
if (!newname) continue;
|
||||
if (!newname == fileManager.folderJSArray[trId][1]) continue;
|
||||
var i_field = fileManager.document.createElement('INPUT');
|
||||
i_field.type = 'hidden';
|
||||
i_field.name = 'folders[' + i.toString() + '][oldname]';
|
||||
i_field.value = fileManager.folderJSArray[trId][1];
|
||||
postForm2.appendChild(i_field);
|
||||
var ii_field = fileManager.document.createElement('INPUT');
|
||||
ii_field.type = 'hidden';
|
||||
ii_field.name = 'folders[' + i.toString() + '][newname]';
|
||||
ii_field.value = newname;
|
||||
postForm2.appendChild(ii_field);
|
||||
}
|
||||
for (var i=0; i<fileItemsLength; i++) {
|
||||
var strId = fileItems[i].getAttribute("id").toString();
|
||||
var trId = parseInt(strId.substring(1, strId.length));
|
||||
var newname = getNewFileName(fileManager.fileJSArray[trId][1]);
|
||||
if (!newname) continue;
|
||||
if (newname == fileManager.fileJSArray[trId][1]) continue;
|
||||
var i_field = fileManager.document.createElement('INPUT');
|
||||
i_field.type = 'hidden';
|
||||
i_field.name = 'files[' + i.toString() + '][oldname]';
|
||||
i_field.value = fileManager.fileJSArray[trId][1];
|
||||
postForm2.appendChild(i_field);
|
||||
var ii_field = fileManager.document.createElement('INPUT');
|
||||
ii_field.type = 'hidden';
|
||||
ii_field.name = 'files[' + i.toString() + '][newname]';
|
||||
ii_field.value = newname;
|
||||
postForm2.appendChild(ii_field);
|
||||
}
|
||||
changeLoadingStatus('load');
|
||||
postForm2.elements["action"].value="rename";
|
||||
postForm2.submit();
|
||||
}
|
||||
|
||||
function moveFile() {
|
||||
var folderItems = fileManager.sta.getSelectedItems();
|
||||
var folderItemsLength = folderItems.length;
|
||||
var fileItems = fileManager.stb.getSelectedItems();
|
||||
var fileItemsLength = fileItems.length;
|
||||
var postForm2 = fileManager.document.getElementById('form2');
|
||||
if ((folderItemsLength == 0) && (fileItemsLength == 0)) return false;
|
||||
if (!confirm('<?php echo $MY_MESSAGES['renamewarning']; ?>')) return false;
|
||||
var postForm2 = fileManager.document.getElementById('form2');
|
||||
Dialog("move.php", function(param) {
|
||||
if (!param) // user must have pressed Cancel
|
||||
return false;
|
||||
else {
|
||||
postForm2.elements["newpath"].value=param['newpath'];
|
||||
moveFiles();
|
||||
}
|
||||
}, null);
|
||||
}
|
||||
|
||||
function changeview(view){
|
||||
if(view.length > 1){
|
||||
var postForm2 = fileManager.document.getElementById('form2');
|
||||
postForm2.elements['view'].value=view;
|
||||
postForm2.submit();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function moveFiles() {
|
||||
var folderItems = fileManager.sta.getSelectedItems();
|
||||
var folderItemsLength = folderItems.length;
|
||||
var fileItems = fileManager.stb.getSelectedItems();
|
||||
var fileItemsLength = fileItems.length;
|
||||
var postForm2 = fileManager.document.getElementById('form2');
|
||||
for (var i=0; i<folderItemsLength; i++) {
|
||||
var strId = folderItems[i].getAttribute("id").toString();
|
||||
var trId = parseInt(strId.substring(1, strId.length));
|
||||
var i_field = fileManager.document.createElement('INPUT');
|
||||
i_field.type = 'hidden';
|
||||
i_field.name = 'folders[' + i.toString() + ']';
|
||||
i_field.value = fileManager.folderJSArray[trId][1];
|
||||
postForm2.appendChild(i_field);
|
||||
}
|
||||
for (var i=0; i<fileItemsLength; i++) {
|
||||
var strId = fileItems[i].getAttribute("id").toString();
|
||||
var trId = parseInt(strId.substring(1, strId.length));
|
||||
var i_field = fileManager.document.createElement('INPUT');
|
||||
i_field.type = 'hidden';
|
||||
i_field.name = 'files[' + i.toString() + ']';
|
||||
i_field.value = fileManager.fileJSArray[trId][1];
|
||||
postForm2.appendChild(i_field);
|
||||
}
|
||||
changeLoadingStatus('load');
|
||||
postForm2.elements["action"].value="move";
|
||||
postForm2.submit();
|
||||
}
|
||||
|
||||
function openFile() {
|
||||
var urlPrefix = "<?php echo '/'. $MY_URL_TO_OPEN_FILE; ?>";
|
||||
var myPath = fileManager.document.getElementById('form2').elements["path"].value;
|
||||
var folderItems = fileManager.sta.getSelectedItems();
|
||||
var folderItemsLength = folderItems.length;
|
||||
var fileItems = fileManager.stb.getSelectedItems();
|
||||
var fileItemsLength = fileItems.length;
|
||||
|
||||
for (var i=0; i<folderItemsLength; i++) {
|
||||
var strId = folderItems[i].getAttribute("id").toString();
|
||||
var trId = parseInt(strId.substring(1, strId.length));
|
||||
window.open(urlPrefix+myPath+fileManager.folderJSArray[trId][1],'','');
|
||||
}
|
||||
for (var i=0; i<fileItemsLength; i++) {
|
||||
var strId = fileItems[i].getAttribute("id").toString();
|
||||
var trId = parseInt(strId.substring(1, strId.length));
|
||||
window.open(urlPrefix+myPath+fileManager.fileJSArray[trId][1],'','');
|
||||
}
|
||||
}
|
||||
|
||||
function doUpload() {
|
||||
var isOK = 1;
|
||||
var fileObj = document.forms[0].uploadFile;
|
||||
if (fileObj == null) return false;
|
||||
|
||||
newname = fileObj.value;
|
||||
isOK = checkExtension(newname);
|
||||
if (isOK == -2) {
|
||||
alert('<?php echo $MY_MESSAGES['extnotallowed']; ?>');
|
||||
return false;
|
||||
}
|
||||
if (isOK == -1) {
|
||||
alert('<?php echo $MY_MESSAGES['extmissing']; ?>');
|
||||
return false;
|
||||
}
|
||||
changeLoadingStatus('upload');
|
||||
}
|
||||
|
||||
function checkExtension(name) {
|
||||
var regexp = /\/|\\/;
|
||||
var parts = name.split(regexp);
|
||||
var filename = parts[parts.length-1].split(".");
|
||||
if (filename.length <= 1) {
|
||||
return(-1);
|
||||
}
|
||||
var ext = filename[filename.length-1].toLowerCase();
|
||||
|
||||
for (i=0; i<DenyExtensions.length; i++) {
|
||||
if (ext == DenyExtensions[i]) return(-2);
|
||||
}
|
||||
for (i=0; i<AllowExtensions.length; i++) {
|
||||
if (ext == AllowExtensions[i]) return(1);
|
||||
}
|
||||
return(-2);
|
||||
}
|
||||
|
||||
function getNewFileName(name) {
|
||||
var isOK = 1;
|
||||
var newname='';
|
||||
do {
|
||||
newname = prompt('<?php echo $MY_MESSAGES['renamefile']; ?>', name);
|
||||
if (!newname) return false;
|
||||
isOK = checkExtension(newname);
|
||||
if (isOK == -2) alert('<?php echo $MY_MESSAGES['extnotallowed']; ?>');
|
||||
if (isOK == -1) alert('<?php echo $MY_MESSAGES['extmissing']; ?>');
|
||||
} while (isOK != 1);
|
||||
return(newname);
|
||||
}
|
||||
|
||||
function selectFolder() {
|
||||
Dialog("move.php", function(param) {
|
||||
if (!param) // user must have pressed Cancel
|
||||
return false;
|
||||
else {
|
||||
var postForm2 = fileManager.document.getElementById('form2');
|
||||
postForm2.elements["newpath"].value=param['newpath'];
|
||||
}
|
||||
}, null);
|
||||
|
||||
}
|
||||
|
||||
function refreshPath(){
|
||||
var selection = document.forms[0].path;
|
||||
changeDir(selection);
|
||||
}
|
||||
|
||||
function winH() {
|
||||
if (window.innerHeight)
|
||||
return window.innerHeight;
|
||||
else if
|
||||
(document.documentElement &&
|
||||
document.documentElement.clientHeight)
|
||||
return document.documentElement.clientHeight;
|
||||
else if
|
||||
(document.body && document.body.clientHeight)
|
||||
return document.body.clientHeight;
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
function resize_iframe() {
|
||||
document.getElementById("fileManager").height=winH()-resize_iframe_constant;//resize the iframe according to the size of the window
|
||||
}
|
||||
|
||||
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 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 = '<?php echo $MY_MESSAGES['loading']; ?> ';
|
||||
}
|
||||
else if(state == 'upload') {
|
||||
statusText = '<?php echo $MY_MESSAGES['uploading']; ?>';
|
||||
}
|
||||
if(statusText != null) {
|
||||
var obj = MM_findObj('loadingStatus');
|
||||
if (obj != null && obj.innerHTML != null)
|
||||
obj.innerHTML = statusText;
|
||||
MM_showHideLayers('loading','','show');
|
||||
}
|
||||
}
|
||||
|
||||
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 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 refresh()
|
||||
{
|
||||
var selection = document.forms[0].dirPath;
|
||||
updateDir(selection);
|
||||
}
|
||||
|
||||
function showAction(action)
|
||||
{
|
||||
MM_showHideLayers('f_action_inline_values','','hide');
|
||||
MM_showHideLayers('f_action_filelink_values','','hide');
|
||||
MM_showHideLayers('f_action_upload_values','','hide');
|
||||
MM_showHideLayers(action + '_values','','show');
|
||||
}
|
||||
/*]]>*/
|
||||
</script>
|
||||
</head>
|
||||
<body onload="Init();">
|
||||
<div class="title"><img src="../images/filemanager.png" border="0" align="absmiddle">
|
||||
<?php echo $MY_MESSAGES['insertfile']; ?>
|
||||
</div>
|
||||
<form action="files.php?dialogname=<?php echo $MY_NAME; ?>" name="form1" method="post" target="fileManager" enctype="multipart/form-data">
|
||||
<div id="loading" style="position:absolute; left:200px; top:130px; width:184px; height:48px; z-index:1" class="statusLayer">
|
||||
<div id= "loadingStatus" align="center" style="font-size:large;font-weight:bold;color:#CCCCCC;font-family: Helvetica, sans-serif; z-index:2; ">
|
||||
<?php echo $MY_MESSAGES['loading']; ?>
|
||||
</div>
|
||||
</div>
|
||||
<fieldset>
|
||||
<legend>
|
||||
<?php
|
||||
echo $MY_MESSAGES['filemanager'];
|
||||
// echo '<span style="font-size:x-small; "> - '.$MY_MESSAGES['ctrlshift'].'</span>';
|
||||
?>
|
||||
</legend>
|
||||
<div style="margin:5px;">
|
||||
<label for="path">
|
||||
<?php echo $MY_MESSAGES['directory']; ?>
|
||||
</label>
|
||||
<select name="path" id="path" style="width:30em" onChange="changeDir(this)">
|
||||
<option value="/">/</option>
|
||||
</select>
|
||||
|
||||
<?php
|
||||
echo '<a href="#" onClick="javascript:goUpDir();"><img src="img/up.png" width="18" height="18" border="0" title="'.$MY_MESSAGES['up'].'" /></a>';
|
||||
if ($MY_ALLOW_CREATE) {
|
||||
echo '<a href="#" onClick="javascript:newFolder();"><img src="img/folder_new.png" width="18" height="18" border="0" title="'.$MY_MESSAGES['newfolder'].'" /></a>';
|
||||
}
|
||||
if ($MY_ALLOW_DELETE) {
|
||||
echo '<a href="#" onClick="javascript:deleteFile();"><img src="img/remove.png" width="18" height="18" border="0" title="'.$MY_MESSAGES['delete'].'" /></a>';
|
||||
}
|
||||
if ($MY_ALLOW_RENAME) {
|
||||
echo '<a href="#" onClick="javascript:renameFile();"><img src="img/revert.png" width="18" height="18" border="0" title="'.$MY_MESSAGES['rename'].'" /></a>';
|
||||
}
|
||||
if ($MY_ALLOW_MOVE) {
|
||||
echo '<a href="#" onClick="javascript:moveFile();"><img src="img/move.png" width="18" height="18" border="0" title="'.$MY_MESSAGES['move'].'" /></a>';
|
||||
}
|
||||
echo '<a href="#" onClick="javascript:openFile();"><img src="img/thumbnail.png" width="18" height="18" border="0" title="'.$MY_MESSAGES['openfile'].'" /></a>';
|
||||
echo '|';
|
||||
echo '<a href="#" onClick="javascript:changeview(\'text\');"><img src="img/view_text.png" width="18" height="18" border="0" title="'.$MY_MESSAGES['textline'].'" /></a>';
|
||||
echo '<a href="#" onClick="javascript:changeview(\'icon\');"><img src="img/view_icon.png" width="18" height="18" border="0" title="'.$MY_MESSAGES['thumbnails'].'" /></a>';
|
||||
|
||||
?>
|
||||
|
||||
<input id="sortby" type="hidden" value="0" />
|
||||
</div>
|
||||
|
||||
<div style="margin:5px;">
|
||||
<iframe src="files.php?dialogname=<?php echo $MY_NAME; ?>&refresh=1" name="fileManager" id="fileManager" background="Window" marginwidth="0" marginheight="0" valign:"top" scrolling="yes" frameborder="0" hspace="0" vspace="0" width="600px" height="250px" style="background-color: Window; margin:0px; padding:0px; border:0px; vertical-align:top;"></iframe>
|
||||
</div>
|
||||
</fieldset>
|
||||
<fieldset style="min-height:20mm;"><legend></legend>
|
||||
|
||||
<div style="margin:5px;">Action:
|
||||
<select id="f_action" name="f_action" onChange="showAction(this.value)">
|
||||
<option value="f_action_inline">Display file</option>
|
||||
<option value="f_action_filelink">Insert file link</option>
|
||||
<option value="f_action_upload">Upload file</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div id="f_action_inline_values" style="visibility:visible;">
|
||||
<table border="0" align="center" cellpadding="2" cellspacing="2">
|
||||
<tr>
|
||||
<td nowrap><div align="right">URL </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">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 colspan="3"><div align="right">
|
||||
<input type="hidden" name="orginal_width" id="orginal_width">
|
||||
<input type="hidden" name="orginal_height" id="orginal_height">
|
||||
<input type="hidden" name="f_ext" id="f_ext">
|
||||
<!-- <input type="checkbox" name="constrain_prop" id="constrain_prop" checked onClick="javascript:toggleConstrains(this);"></div>
|
||||
</td>
|
||||
<td>Constrain Proportions</td> -->
|
||||
<td><div align="right">Border</div></td>
|
||||
<td><input name="border" id="f_border" type="text" size="5" style="width:4em"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div id="f_action_filelink_values" style="position:absolute; top:380px; width:600px; visibility:hidden;">
|
||||
<table border="0" align="center" cellpadding="2" cellspacing="2">
|
||||
<tr>
|
||||
<td nowrap><div align="right">URL</div></td>
|
||||
<td><input name="url2" id="f_url2" type="text" style="width:20em" size="30"></td>
|
||||
<td nowrap><div align="right">Caption</div></td>
|
||||
<td><input name="caption" id="f_caption" type="text" style="width:20em" size="30"></td>
|
||||
</tr>
|
||||
</table>
|
||||
<table border="0" align="center" cellpadding="2" cellspacing="2">
|
||||
<tr>
|
||||
<td>
|
||||
<input id="f_addicon" value="f_addicon" type="checkbox">
|
||||
</td><td>
|
||||
<div align="left">Insert filetype icon</div>
|
||||
</td><td>
|
||||
<input id="f_addsize" value="f_addsize" type="checkbox">
|
||||
</td><td>
|
||||
<div align="left">Insert file size</div>
|
||||
</td><td>
|
||||
<input id="f_adddate" value="f_adddate" type="checkbox">
|
||||
</td><td>
|
||||
<div align="left">Insert file modification date</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div id="f_action_upload_values" style="position:absolute; top:380px; visibility:hidden;">
|
||||
<div style="text-align:center; padding:2px;">
|
||||
<?php
|
||||
if ($MY_ALLOW_UPLOAD) {
|
||||
?>
|
||||
<label for="uploadFile">
|
||||
<?php echo $MY_MESSAGES['upload']; ?>
|
||||
</label>
|
||||
<input name="uploadFile" type="file" id="uploadFile" size="52" />
|
||||
<input type="submit" style="width:5em" value="<?php echo $MY_MESSAGES['upload']; ?>" onClick="javascript:return doUpload();" />
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<div style="text-align: right; margin-top:5px;">
|
||||
<input type="button" name="refresh" value="Refresh" onclick="return refreshPath();">
|
||||
<input type="button" name="cancel" value="Cancel" onclick="return onCancel();">
|
||||
<input type="reset" name="reset" value="Reset">
|
||||
<input type="button" name="ok" value="OK" onclick="return onOK();">
|
||||
</div>
|
||||
<div style="position:absolute; bottom:-5px; right:-3px;">
|
||||
<img src="img/btn_Corner.gif" width="14" height="14" border="0" alt="" />
|
||||
</div>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
111
phpgwapi/js/tinymce/jscripts/tiny_mce/plugins/filemanager/InsertFile/js/dialog.js
vendored
Normal file
@ -0,0 +1,111 @@
|
||||
// Dialog v3.0 - Copyright (c) 2003-2004 interactivetools.com, inc.
|
||||
// This copyright notice MUST stay intact for use (see license.txt).
|
||||
//
|
||||
// Portions (c) dynarch.com, 2003-2004
|
||||
//
|
||||
// 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.
|
||||
// http://dynarch.com/mishoo
|
||||
//
|
||||
// $Id$
|
||||
|
||||
// Though "Dialog" looks like an object, it isn't really an object. Instead
|
||||
// it's just namespace for protecting global symbols.
|
||||
|
||||
function Dialog(url, action, init) {
|
||||
if (typeof init == "undefined") {
|
||||
init = window; // pass this window object by default
|
||||
}
|
||||
Dialog._geckoOpenModal(url, action, init);
|
||||
};
|
||||
|
||||
Dialog._parentEvent = function(ev) {
|
||||
setTimeout( function() { if (Dialog._modal && !Dialog._modal.closed) { Dialog._modal.focus() } }, 50);
|
||||
if (Dialog._modal && !Dialog._modal.closed) {
|
||||
Dialog._stopEvent(ev);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// should be a function, the return handler of the currently opened dialog.
|
||||
Dialog._return = null;
|
||||
|
||||
// constant, the currently opened dialog
|
||||
Dialog._modal = null;
|
||||
|
||||
// the dialog will read it's args from this variable
|
||||
Dialog._arguments = null;
|
||||
|
||||
Dialog._geckoOpenModal = function(url, action, init) {
|
||||
//var urlLink = "hadialog"+url.toString();
|
||||
var myURL = "hadialog"+url;
|
||||
var regObj = /\W/g;
|
||||
myURL = myURL.replace(regObj,'_');
|
||||
var dlg = window.open(url, myURL,
|
||||
"toolbar=no,menubar=no,personalbar=no,width=10,height=10," +
|
||||
"scrollbars=no,resizable=yes,modal=yes,dependable=yes");
|
||||
Dialog._modal = dlg;
|
||||
Dialog._arguments = init;
|
||||
|
||||
// capture some window's events
|
||||
function capwin(w) {
|
||||
Dialog._addEvent(w, "click", Dialog._parentEvent);
|
||||
Dialog._addEvent(w, "mousedown", Dialog._parentEvent);
|
||||
Dialog._addEvent(w, "focus", Dialog._parentEvent);
|
||||
};
|
||||
// release the captured events
|
||||
function relwin(w) {
|
||||
Dialog._removeEvent(w, "click", Dialog._parentEvent);
|
||||
Dialog._removeEvent(w, "mousedown", Dialog._parentEvent);
|
||||
Dialog._removeEvent(w, "focus", Dialog._parentEvent);
|
||||
};
|
||||
capwin(window);
|
||||
// capture other frames
|
||||
for (var i = 0; i < window.frames.length; capwin(window.frames[i++]));
|
||||
// make up a function to be called when the Dialog ends.
|
||||
Dialog._return = function (val) {
|
||||
if (val && action) {
|
||||
action(val);
|
||||
}
|
||||
relwin(window);
|
||||
// capture other frames
|
||||
for (var i = 0; i < window.frames.length; relwin(window.frames[i++]));
|
||||
Dialog._modal = null;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
// event handling
|
||||
|
||||
Dialog._addEvent = function(el, evname, func) {
|
||||
if (Dialog.is_ie) {
|
||||
el.attachEvent("on" + evname, func);
|
||||
} else {
|
||||
el.addEventListener(evname, func, true);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Dialog._removeEvent = function(el, evname, func) {
|
||||
if (Dialog.is_ie) {
|
||||
el.detachEvent("on" + evname, func);
|
||||
} else {
|
||||
el.removeEventListener(evname, func, true);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Dialog._stopEvent = function(ev) {
|
||||
if (Dialog.is_ie) {
|
||||
ev.cancelBubble = true;
|
||||
ev.returnValue = false;
|
||||
} else {
|
||||
ev.preventDefault();
|
||||
ev.stopPropagation();
|
||||
}
|
||||
};
|
||||
|
||||
Dialog.agt = navigator.userAgent.toLowerCase();
|
||||
Dialog.is_ie = ((Dialog.agt.indexOf("msie") != -1) && (Dialog.agt.indexOf("opera") == -1));
|
0
phpgwapi/js/tinymce/jscripts/tiny_mce/plugins/filemanager/InsertFile/js/functions.js
vendored
Normal file
123
phpgwapi/js/tinymce/jscripts/tiny_mce/plugins/filemanager/InsertFile/js/popup.js
vendored
Normal file
@ -0,0 +1,123 @@
|
||||
// htmlArea v3.0 - Copyright (c) 2002, 2003 interactivetools.com, inc.
|
||||
// This copyright notice MUST stay intact for use (see license.txt).
|
||||
//
|
||||
// Portions (c) dynarch.com, 2003
|
||||
//
|
||||
// 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.
|
||||
// http://dynarch.com/mishoo
|
||||
//
|
||||
// $Id$
|
||||
|
||||
// Slightly modified for the ImageManager, window resizing is done only
|
||||
// by each window's script. Added translation for a few other HTML elements.
|
||||
|
||||
function getAbsolutePos(el) {
|
||||
var r = { x: el.offsetLeft, y: el.offsetTop };
|
||||
if (el.offsetParent) {
|
||||
var tmp = getAbsolutePos(el.offsetParent);
|
||||
r.x += tmp.x;
|
||||
r.y += tmp.y;
|
||||
}
|
||||
return r;
|
||||
};
|
||||
|
||||
function comboSelectValue(c, val) {
|
||||
var ops = c.getElementsByTagName("option");
|
||||
for (var i = ops.length; --i >= 0;) {
|
||||
var op = ops[i];
|
||||
op.selected = (op.value == val);
|
||||
}
|
||||
c.value = val;
|
||||
};
|
||||
|
||||
function __dlg_onclose() {
|
||||
if(opener.Dialog._return)
|
||||
opener.Dialog._return(null);
|
||||
};
|
||||
|
||||
function __dlg_init(bottom) {
|
||||
var body = document.body;
|
||||
var body_height = 0;
|
||||
if (typeof bottom == "undefined") {
|
||||
var div = document.createElement("div");
|
||||
body.appendChild(div);
|
||||
var pos = getAbsolutePos(div);
|
||||
body_height = pos.y;
|
||||
} else {
|
||||
var pos = getAbsolutePos(bottom);
|
||||
body_height = pos.y + bottom.offsetHeight;
|
||||
}
|
||||
if(opener && opener.Dialog && opener.Dialog._arguments)
|
||||
window.dialogArguments = opener.Dialog._arguments;
|
||||
if (!document.all) {
|
||||
//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 x = opener.screenX + (opener.outerWidth - window.outerWidth) / 2;
|
||||
var y = opener.screenY + (opener.outerHeight - window.outerHeight) / 2;
|
||||
window.moveTo(x, y);
|
||||
//window.innerWidth = body.offsetWidth + 5;
|
||||
//window.innerHeight = body_height + 2;
|
||||
} else {
|
||||
// window.dialogHeight = body.offsetHeight + 50 + "px";
|
||||
// window.dialogWidth = body.offsetWidth + "px";
|
||||
//window.resizeTo(body.offsetWidth, body_height);
|
||||
var ch = body.clientHeight;
|
||||
var cw = body.clientWidth;
|
||||
//window.resizeBy(body.offsetWidth - cw, body_height - ch);
|
||||
var W = body.offsetWidth;
|
||||
var H = 2 * body_height - ch;
|
||||
if(ch <= 0) H = body_height;
|
||||
var x = (screen.availWidth - W) / 2;
|
||||
var y = (screen.availHeight - H) / 2;
|
||||
|
||||
window.moveTo(x, y);
|
||||
}
|
||||
document.body.onkeypress = __dlg_close_on_esc;
|
||||
};
|
||||
|
||||
function __dlg_translate(i18n) {
|
||||
var types = ["span", "option", "td", "button", "div", "label", "a","img", "legend"];
|
||||
for (var type in types) {
|
||||
var spans = document.getElementsByTagName(types[type]);
|
||||
for (var i = spans.length; --i >= 0;) {
|
||||
var span = spans[i];
|
||||
if (span.firstChild && span.firstChild.data) {
|
||||
var txt = i18n[span.firstChild.data];
|
||||
if (txt) span.firstChild.data = txt;
|
||||
}
|
||||
if(span.title){
|
||||
var txt = i18n[span.title];
|
||||
if(txt) span.title = txt;
|
||||
}
|
||||
if(span.alt){
|
||||
var txt = i18n[span.alt];
|
||||
if(txt) span.alt = txt;
|
||||
}
|
||||
}
|
||||
}
|
||||
var txt = i18n[document.title];
|
||||
if (txt)
|
||||
document.title = txt;
|
||||
};
|
||||
|
||||
// closes the dialog and passes the return info upper.
|
||||
function __dlg_close(val) {
|
||||
opener.Dialog._return(val);
|
||||
window.close();
|
||||
};
|
||||
|
||||
function __dlg_close_on_esc(ev) {
|
||||
ev || (ev = window.event);
|
||||
if (ev.keyCode == 27) {
|
||||
window.close();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
375
phpgwapi/js/tinymce/jscripts/tiny_mce/plugins/filemanager/InsertFile/js/selectableelements.js
vendored
Normal file
@ -0,0 +1,375 @@
|
||||
/*----------------------------------------------------------------------------\
|
||||
| Selectable Elements 1.02 |
|
||||
|-----------------------------------------------------------------------------|
|
||||
| Created by Erik Arvidsson |
|
||||
| (http://webfx.eae.net/contact.html#erik) |
|
||||
| For WebFX (http://webfx.eae.net/) |
|
||||
|-----------------------------------------------------------------------------|
|
||||
| A script that allows children of any element to be selected |
|
||||
|-----------------------------------------------------------------------------|
|
||||
| Copyright (c) 1999 - 2004 Erik Arvidsson |
|
||||
|-----------------------------------------------------------------------------|
|
||||
| This software is provided "as is", without warranty of any kind, express or |
|
||||
| implied, including but not limited to the warranties of merchantability, |
|
||||
| fitness for a particular purpose and noninfringement. In no event shall the |
|
||||
| authors or copyright holders be liable for any claim, damages or other |
|
||||
| liability, whether in an action of contract, tort or otherwise, arising |
|
||||
| from, out of or in connection with the software or the use or other |
|
||||
| dealings in the software. |
|
||||
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
||||
| This software is available under the three different licenses mentioned |
|
||||
| below. To use this software you must chose, and qualify, for one of those. |
|
||||
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
||||
| The WebFX Non-Commercial License http://webfx.eae.net/license.html |
|
||||
| Permits anyone the right to use the software in a non-commercial context |
|
||||
| free of charge. |
|
||||
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
||||
| The WebFX Commercial license http://webfx.eae.net/commercial.html |
|
||||
| Permits the license holder the right to use the software in a commercial |
|
||||
| context. Such license must be specifically obtained, however it's valid for |
|
||||
| any number of implementations of the licensed software. |
|
||||
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
||||
| GPL - The GNU General Public License http://www.gnu.org/licenses/gpl.txt |
|
||||
| Permits anyone the right to use and modify the software without limitations |
|
||||
| as long as proper credits are given and the original and modified source |
|
||||
| code are included. Requires that the final product, software derivate from |
|
||||
| the original source or any software utilizing a GPL component, such as |
|
||||
| this, is also licensed under the GPL license. |
|
||||
|-----------------------------------------------------------------------------|
|
||||
| 2002-09-19 | Original Version Posted. |
|
||||
| 2002-09-27 | Fixed a bug in IE when mouse down and up occured on different |
|
||||
| | rows. |
|
||||
| 2003-02-11 | Minor problem with addClassName and removeClassName that |
|
||||
| | triggered a bug in Opera 7. Added destroy method |
|
||||
|-----------------------------------------------------------------------------|
|
||||
| Created 2002-09-04 | All changes are in the log above. | Updated 2003-02-11 |
|
||||
\----------------------------------------------------------------------------*/
|
||||
|
||||
function SelectableElements(oElement, bMultiple) {
|
||||
if (oElement == null)
|
||||
return;
|
||||
|
||||
this._htmlElement = oElement;
|
||||
this._multiple = Boolean(bMultiple);
|
||||
|
||||
this._selectedItems = [];
|
||||
this._fireChange = true;
|
||||
|
||||
var oThis = this;
|
||||
this._onclick = function (e) {
|
||||
if (e == null) e = oElement.ownerDocument.parentWindow.event;
|
||||
oThis.click(e);
|
||||
};
|
||||
|
||||
if (oElement.addEventListener)
|
||||
oElement.addEventListener("click", this._onclick, false);
|
||||
else if (oElement.attachEvent)
|
||||
oElement.attachEvent("onclick", this._onclick);
|
||||
}
|
||||
|
||||
SelectableElements.prototype.setItemSelected = function (oEl, bSelected) {
|
||||
if (!this._multiple) {
|
||||
if (bSelected) {
|
||||
var old = this._selectedItems[0]
|
||||
if (oEl == old)
|
||||
return;
|
||||
if (old != null)
|
||||
this.setItemSelectedUi(old, false);
|
||||
this.setItemSelectedUi(oEl, true);
|
||||
this._selectedItems = [oEl];
|
||||
this.fireChange();
|
||||
}
|
||||
else {
|
||||
if (this._selectedItems[0] == oEl) {
|
||||
this.setItemSelectedUi(oEl, false);
|
||||
this._selectedItems = [];
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (Boolean(oEl._selected) == Boolean(bSelected))
|
||||
return;
|
||||
|
||||
this.setItemSelectedUi(oEl, bSelected);
|
||||
|
||||
if (bSelected)
|
||||
this._selectedItems[this._selectedItems.length] = oEl;
|
||||
else {
|
||||
// remove
|
||||
var tmp = [];
|
||||
var j = 0;
|
||||
for (var i = 0; i < this._selectedItems.length; i++) {
|
||||
if (this._selectedItems[i] != oEl)
|
||||
tmp[j++] = this._selectedItems[i];
|
||||
}
|
||||
this._selectedItems = tmp;
|
||||
}
|
||||
this.fireChange();
|
||||
}
|
||||
};
|
||||
|
||||
// This method updates the UI of the item
|
||||
SelectableElements.prototype.setItemSelectedUi = function (oEl, bSelected) {
|
||||
if (bSelected)
|
||||
addClassName(oEl, "selected");
|
||||
else
|
||||
removeClassName(oEl, "selected");
|
||||
|
||||
oEl._selected = bSelected;
|
||||
};
|
||||
|
||||
SelectableElements.prototype.getItemSelected = function (oEl) {
|
||||
return Boolean(oEl._selected);
|
||||
};
|
||||
|
||||
SelectableElements.prototype.fireChange = function () {
|
||||
if (!this._fireChange)
|
||||
return;
|
||||
if (typeof this.onchange == "string")
|
||||
this.onchange = new Function(this.onchange);
|
||||
if (typeof this.onchange == "function")
|
||||
this.onchange();
|
||||
};
|
||||
|
||||
|
||||
SelectableElements.prototype.click = function (e) {
|
||||
var oldFireChange = this._fireChange;
|
||||
this._fireChange = false;
|
||||
|
||||
// create a copy to compare with after changes
|
||||
var selectedBefore = this.getSelectedItems(); // is a cloned array
|
||||
|
||||
// find row
|
||||
var el = e.target != null ? e.target : e.srcElement;
|
||||
while (el != null && !this.isItem(el))
|
||||
el = el.parentNode;
|
||||
|
||||
if (el == null) { // happens in IE when down and up occur on different items
|
||||
this._fireChange = oldFireChange;
|
||||
return;
|
||||
}
|
||||
|
||||
var rIndex = el;
|
||||
var aIndex = this._anchorIndex;
|
||||
|
||||
// test whether the current row should be the anchor
|
||||
if (this._selectedItems.length == 0 || (e.ctrlKey && !e.shiftKey && this._multiple)) {
|
||||
aIndex = this._anchorIndex = rIndex;
|
||||
}
|
||||
|
||||
if (!e.ctrlKey && !e.shiftKey || !this._multiple) {
|
||||
// deselect all
|
||||
var items = this._selectedItems;
|
||||
for (var i = items.length - 1; i >= 0; i--) {
|
||||
if (items[i]._selected && items[i] != el)
|
||||
this.setItemSelectedUi(items[i], false);
|
||||
}
|
||||
this._anchorIndex = rIndex;
|
||||
if (!el._selected) {
|
||||
this.setItemSelectedUi(el, true);
|
||||
}
|
||||
this._selectedItems = [el];
|
||||
}
|
||||
|
||||
// ctrl
|
||||
else if (this._multiple && e.ctrlKey && !e.shiftKey) {
|
||||
this.setItemSelected(el, !el._selected);
|
||||
this._anchorIndex = rIndex;
|
||||
}
|
||||
|
||||
// ctrl + shift
|
||||
else if (this._multiple && e.ctrlKey && e.shiftKey) {
|
||||
// up or down?
|
||||
var dirUp = this.isBefore(rIndex, aIndex);
|
||||
|
||||
var item = aIndex;
|
||||
while (item != null && item != rIndex) {
|
||||
if (!item._selected && item != el)
|
||||
this.setItemSelected(item, true);
|
||||
item = dirUp ? this.getPrevious(item) : this.getNext(item);
|
||||
}
|
||||
|
||||
if (!el._selected)
|
||||
this.setItemSelected(el, true);
|
||||
}
|
||||
|
||||
// shift
|
||||
else if (this._multiple && !e.ctrlKey && e.shiftKey) {
|
||||
// up or down?
|
||||
var dirUp = this.isBefore(rIndex, aIndex);
|
||||
|
||||
// deselect all
|
||||
var items = this._selectedItems;
|
||||
for (var i = items.length - 1; i >= 0; i--)
|
||||
this.setItemSelectedUi(items[i], false);
|
||||
this._selectedItems = [];
|
||||
|
||||
// select items in range
|
||||
var item = aIndex;
|
||||
while (item != null) {
|
||||
this.setItemSelected(item, true);
|
||||
if (item == rIndex)
|
||||
break;
|
||||
item = dirUp ? this.getPrevious(item) : this.getNext(item);
|
||||
}
|
||||
}
|
||||
|
||||
// find change!!!
|
||||
var found;
|
||||
var changed = selectedBefore.length != this._selectedItems.length;
|
||||
if (!changed) {
|
||||
for (var i = 0; i < selectedBefore.length; i++) {
|
||||
found = false;
|
||||
for (var j = 0; j < this._selectedItems.length; j++) {
|
||||
if (selectedBefore[i] == this._selectedItems[j]) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
changed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this._fireChange = oldFireChange;
|
||||
if (changed && this._fireChange)
|
||||
this.fireChange();
|
||||
};
|
||||
|
||||
SelectableElements.prototype.getSelectedItems = function () {
|
||||
//clone
|
||||
var items = this._selectedItems;
|
||||
var l = items.length;
|
||||
var tmp = new Array(l);
|
||||
for (var i = 0; i < l; i++)
|
||||
tmp[i] = items[i];
|
||||
return tmp;
|
||||
};
|
||||
|
||||
SelectableElements.prototype.isItem = function (node) {
|
||||
return node != null && node.nodeType == 1 && node.parentNode == this._htmlElement;
|
||||
};
|
||||
|
||||
SelectableElements.prototype.destroy = function () {
|
||||
if (this._htmlElement.removeEventListener)
|
||||
this._htmlElement.removeEventListener("click", this._onclick, false);
|
||||
else if (this._htmlElement.detachEvent)
|
||||
this._htmlElement.detachEvent("onclick", this._onclick);
|
||||
|
||||
this._htmlElement = null;
|
||||
this._onclick = null;
|
||||
this._selectedItems = null;
|
||||
};
|
||||
|
||||
/* Traversable Collection Interface */
|
||||
|
||||
SelectableElements.prototype.getNext = function (el) {
|
||||
var n = el.nextSibling;
|
||||
if (n == null || this.isItem(n))
|
||||
return n;
|
||||
return this.getNext(n);
|
||||
};
|
||||
|
||||
SelectableElements.prototype.getPrevious = function (el) {
|
||||
var p = el.previousSibling;
|
||||
if (p == null || this.isItem(p))
|
||||
return p;
|
||||
return this.getPrevious(p);
|
||||
};
|
||||
|
||||
SelectableElements.prototype.isBefore = function (n1, n2) {
|
||||
var next = this.getNext(n1);
|
||||
while (next != null) {
|
||||
if (next == n2)
|
||||
return true;
|
||||
next = this.getNext(next);
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
/* End Traversable Collection Interface */
|
||||
|
||||
/* Indexable Collection Interface */
|
||||
|
||||
SelectableElements.prototype.getItems = function () {
|
||||
var tmp = [];
|
||||
var j = 0;
|
||||
var cs = this._htmlElement.childNodes;
|
||||
var l = cs.length;
|
||||
for (var i = 0; i < l; i++) {
|
||||
if (cs[i].nodeType == 1)
|
||||
tmp[j++] = cs[i]
|
||||
}
|
||||
return tmp;
|
||||
};
|
||||
|
||||
SelectableElements.prototype.getItem = function (nIndex) {
|
||||
var j = 0;
|
||||
var cs = this._htmlElement.childNodes;
|
||||
var l = cs.length;
|
||||
for (var i = 0; i < l; i++) {
|
||||
if (cs[i].nodeType == 1) {
|
||||
if (j == nIndex)
|
||||
return cs[i];
|
||||
j++;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
SelectableElements.prototype.getSelectedIndexes = function () {
|
||||
var items = this.getSelectedItems();
|
||||
var l = items.length;
|
||||
var tmp = new Array(l);
|
||||
for (var i = 0; i < l; i++)
|
||||
tmp[i] = this.getItemIndex(items[i]);
|
||||
return tmp;
|
||||
};
|
||||
|
||||
|
||||
SelectableElements.prototype.getItemIndex = function (el) {
|
||||
var j = 0;
|
||||
var cs = this._htmlElement.childNodes;
|
||||
var l = cs.length;
|
||||
for (var i = 0; i < l; i++) {
|
||||
if (cs[i] == el)
|
||||
return j;
|
||||
if (cs[i].nodeType == 1)
|
||||
j++;
|
||||
}
|
||||
return -1;
|
||||
};
|
||||
|
||||
/* End Indexable Collection Interface */
|
||||
|
||||
|
||||
|
||||
function addClassName(el, sClassName) {
|
||||
var s = el.className;
|
||||
var p = s.split(" ");
|
||||
if (p.length == 1 && p[0] == "")
|
||||
p = [];
|
||||
|
||||
var l = p.length;
|
||||
for (var i = 0; i < l; i++) {
|
||||
if (p[i] == sClassName)
|
||||
return;
|
||||
}
|
||||
p[p.length] = sClassName;
|
||||
el.className = p.join(" ");
|
||||
}
|
||||
|
||||
function removeClassName(el, sClassName) {
|
||||
var s = el.className;
|
||||
var p = s.split(" ");
|
||||
var np = [];
|
||||
var l = p.length;
|
||||
var j = 0;
|
||||
for (var i = 0; i < l; i++) {
|
||||
if (p[i] != sClassName)
|
||||
np[j++] = p[i];
|
||||
}
|
||||
el.className = np.join(" ");
|
||||
}
|
78
phpgwapi/js/tinymce/jscripts/tiny_mce/plugins/filemanager/InsertFile/js/selectabletablerows.js
vendored
Normal file
@ -0,0 +1,78 @@
|
||||
/*----------------------------------------------------------------------------\
|
||||
| Selectable Elements 1.02 |
|
||||
|-----------------------------------------------------------------------------|
|
||||
| Created by Erik Arvidsson |
|
||||
| (http://webfx.eae.net/contact.html#erik) |
|
||||
| For WebFX (http://webfx.eae.net/) |
|
||||
|-----------------------------------------------------------------------------|
|
||||
| A script that allows children of any element to be selected |
|
||||
|-----------------------------------------------------------------------------|
|
||||
| Copyright (c) 1999 - 2004 Erik Arvidsson |
|
||||
|-----------------------------------------------------------------------------|
|
||||
| This software is provided "as is", without warranty of any kind, express or |
|
||||
| implied, including but not limited to the warranties of merchantability, |
|
||||
| fitness for a particular purpose and noninfringement. In no event shall the |
|
||||
| authors or copyright holders be liable for any claim, damages or other |
|
||||
| liability, whether in an action of contract, tort or otherwise, arising |
|
||||
| from, out of or in connection with the software or the use or other |
|
||||
| dealings in the software. |
|
||||
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
||||
| This software is available under the three different licenses mentioned |
|
||||
| below. To use this software you must chose, and qualify, for one of those. |
|
||||
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
||||
| The WebFX Non-Commercial License http://webfx.eae.net/license.html |
|
||||
| Permits anyone the right to use the software in a non-commercial context |
|
||||
| free of charge. |
|
||||
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
||||
| The WebFX Commercial license http://webfx.eae.net/commercial.html |
|
||||
| Permits the license holder the right to use the software in a commercial |
|
||||
| context. Such license must be specifically obtained, however it's valid for |
|
||||
| any number of implementations of the licensed software. |
|
||||
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
||||
| GPL - The GNU General Public License http://www.gnu.org/licenses/gpl.txt |
|
||||
| Permits anyone the right to use and modify the software without limitations |
|
||||
| as long as proper credits are given and the original and modified source |
|
||||
| code are included. Requires that the final product, software derivate from |
|
||||
| the original source or any software utilizing a GPL component, such as |
|
||||
| this, is also licensed under the GPL license. |
|
||||
|-----------------------------------------------------------------------------|
|
||||
| 2002-09-19 | Original Version Posted. |
|
||||
| 2002-09-27 | Fixed a bug in IE when mouse down and up occured on different |
|
||||
| | rows. |
|
||||
| 2003-02-11 | Minor problem with addClassName and removeClassName that |
|
||||
| | triggered a bug in Opera 7. Added destroy method |
|
||||
|-----------------------------------------------------------------------------|
|
||||
| Created 2002-09-04 | All changes are in the log above. | Updated 2003-02-11 |
|
||||
\----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------\
|
||||
| This file requires that SelectableElements is first defined. This class can |
|
||||
| be found in the file selectableelements.js at WebFX |
|
||||
\----------------------------------------------------------------------------*/
|
||||
|
||||
function SelectableTableRows(oTableElement, bMultiple) {
|
||||
SelectableElements.call(this, oTableElement, bMultiple);
|
||||
}
|
||||
SelectableTableRows.prototype = new SelectableElements;
|
||||
|
||||
SelectableTableRows.prototype.isItem = function (node) {
|
||||
return node != null && node.tagName == "TR" &&
|
||||
node.parentNode.tagName == "TBODY" &&
|
||||
node.parentNode.parentNode == this._htmlElement;
|
||||
};
|
||||
|
||||
/* Indexable Collection Interface */
|
||||
|
||||
SelectableTableRows.prototype.getItems = function () {
|
||||
return this._htmlElement.rows;
|
||||
};
|
||||
|
||||
SelectableTableRows.prototype.getItemIndex = function (el) {
|
||||
return el.rowIndex;
|
||||
};
|
||||
|
||||
SelectableTableRows.prototype.getItem = function (i) {
|
||||
return this._htmlElement.rows[i];
|
||||
};
|
||||
|
||||
/* End Indexable Collection Interface */
|
323
phpgwapi/js/tinymce/jscripts/tiny_mce/plugins/filemanager/InsertFile/js/sortabletable.js
vendored
Normal file
@ -0,0 +1,323 @@
|
||||
|
||||
/*----------------------------------------------------------------------------\
|
||||
| Sortable Table 1.04 |
|
||||
|-----------------------------------------------------------------------------|
|
||||
| Created by Erik Arvidsson |
|
||||
| (http://webfx.eae.net/contact.html#erik) |
|
||||
| For WebFX (http://webfx.eae.net/) |
|
||||
|-----------------------------------------------------------------------------|
|
||||
| A DOM 1 based script that allows an ordinary HTML table to be sortable. |
|
||||
|-----------------------------------------------------------------------------|
|
||||
| Copyright (c) 1998 - 2002 Erik Arvidsson |
|
||||
|-----------------------------------------------------------------------------|
|
||||
| This software is provided "as is", without warranty of any kind, express or |
|
||||
| implied, including but not limited to the warranties of merchantability, |
|
||||
| fitness for a particular purpose and noninfringement. In no event shall the |
|
||||
| authors or copyright holders be liable for any claim, damages or other |
|
||||
| liability, whether in an action of contract, tort or otherwise, arising |
|
||||
| from, out of or in connection with the software or the use or other |
|
||||
| dealings in the software. |
|
||||
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
||||
| This software is available under the three different licenses mentioned |
|
||||
| below. To use this software you must chose, and qualify, for one of those. |
|
||||
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
||||
| The WebFX Non-Commercial License http://webfx.eae.net/license.html |
|
||||
| Permits anyone the right to use the software in a non-commercial context |
|
||||
| free of charge. |
|
||||
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
||||
| The WebFX Commercial license http://webfx.eae.net/commercial.html |
|
||||
| Permits the license holder the right to use the software in a commercial |
|
||||
| context. Such license must be specifically obtained, however it's valid for |
|
||||
| any number of implementations of the licensed software. |
|
||||
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
||||
| GPL - The GNU General Public License http://www.gnu.org/licenses/gpl.txt |
|
||||
| Permits anyone the right to use and modify the software without limitations |
|
||||
| as long as proper credits are given and the original and modified source |
|
||||
| code are included. Requires that the final product, software derivate from |
|
||||
| the original source or any software utilizing a GPL component, such as |
|
||||
| this, is also licensed under the GPL license. |
|
||||
|-----------------------------------------------------------------------------|
|
||||
| 2003-01-10 | First version |
|
||||
| 2003-01-19 | Minor changes to the date parsing |
|
||||
| 2003-01-28 | JScript 5.0 fixes (no support for 'in' operator) |
|
||||
| 2003-02-01 | Sloppy typo like error fixed in getInnerText |
|
||||
| 2003-07-04 | Added workaround for IE cellIndex bug. |
|
||||
|-----------------------------------------------------------------------------|
|
||||
| Created 2003-01-10 | All changes are in the log above. | Updated 2003-07-04 |
|
||||
\----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
function SortableTable(oTable, oSortTypes) {
|
||||
|
||||
this.element = oTable;
|
||||
this.tHead = oTable.tHead;
|
||||
this.tBody = oTable.tBodies[0];
|
||||
this.document = oTable.ownerDocument || oTable.document;
|
||||
|
||||
this.sortColumn = null;
|
||||
this.descending = null;
|
||||
|
||||
var oThis = this;
|
||||
this._headerOnclick = function (e) {
|
||||
oThis.headerOnclick(e);
|
||||
};
|
||||
|
||||
|
||||
// only IE needs this
|
||||
var win = this.document.defaultView || this.document.parentWindow;
|
||||
this._onunload = function () {
|
||||
oThis.destroy();
|
||||
};
|
||||
if (win && typeof win.attachEvent != "undefined") {
|
||||
win.attachEvent("onunload", this._onunload);
|
||||
}
|
||||
|
||||
this.initHeader(oSortTypes || []);
|
||||
}
|
||||
|
||||
SortableTable.gecko = navigator.product == "Gecko";
|
||||
SortableTable.msie = /msie/i.test(navigator.userAgent);
|
||||
// Mozilla is faster when doing the DOM manipulations on
|
||||
// an orphaned element. MSIE is not
|
||||
SortableTable.removeBeforeSort = SortableTable.gecko;
|
||||
|
||||
SortableTable.prototype.onsort = function () {};
|
||||
|
||||
// adds arrow containers and events
|
||||
// also binds sort type to the header cells so that reordering columns does
|
||||
// not break the sort types
|
||||
SortableTable.prototype.initHeader = function (oSortTypes) {
|
||||
var cells = this.tHead.rows[0].cells;
|
||||
var l = cells.length;
|
||||
var img, c;
|
||||
for (var i = 0; i < l; i++) {
|
||||
c = cells[i];
|
||||
img = this.document.createElement("IMG");
|
||||
img.src = "img/blank.png";
|
||||
c.appendChild(img);
|
||||
if (oSortTypes[i] != null) {
|
||||
c._sortType = oSortTypes[i];
|
||||
}
|
||||
if (typeof c.addEventListener != "undefined")
|
||||
c.addEventListener("click", this._headerOnclick, false);
|
||||
else if (typeof c.attachEvent != "undefined")
|
||||
c.attachEvent("onclick", this._headerOnclick);
|
||||
}
|
||||
this.updateHeaderArrows();
|
||||
};
|
||||
|
||||
// remove arrows and events
|
||||
SortableTable.prototype.uninitHeader = function () {
|
||||
var cells = this.tHead.rows[0].cells;
|
||||
var l = cells.length;
|
||||
var c;
|
||||
for (var i = 0; i < l; i++) {
|
||||
c = cells[i];
|
||||
c.removeChild(c.lastChild);
|
||||
if (typeof c.removeEventListener != "undefined")
|
||||
c.removeEventListener("click", this._headerOnclick, false);
|
||||
else if (typeof c.detachEvent != "undefined")
|
||||
c.detachEvent("onclick", this._headerOnclick);
|
||||
}
|
||||
};
|
||||
|
||||
SortableTable.prototype.updateHeaderArrows = function () {
|
||||
var cells = this.tHead.rows[0].cells;
|
||||
var l = cells.length;
|
||||
var img;
|
||||
for (var i = 0; i < l; i++) {
|
||||
img = cells[i].lastChild;
|
||||
if (i == this.sortColumn)
|
||||
img.className = "sort-arrow " + (this.descending ? "descending" : "ascending");
|
||||
else
|
||||
img.className = "sort-arrow";
|
||||
}
|
||||
};
|
||||
|
||||
SortableTable.prototype.headerOnclick = function (e) {
|
||||
// find TD element
|
||||
var el = e.target || e.srcElement;
|
||||
while (el.tagName != "TD")
|
||||
el = el.parentNode;
|
||||
|
||||
this.sort(SortableTable.msie ? SortableTable.getCellIndex(el) : el.cellIndex);
|
||||
};
|
||||
|
||||
// IE returns wrong cellIndex when columns are hidden
|
||||
SortableTable.getCellIndex = function (oTd) {
|
||||
var cells = oTd.parentNode.childNodes
|
||||
var l = cells.length;
|
||||
var i;
|
||||
for (i = 0; cells[i] != oTd && i < l; i++)
|
||||
;
|
||||
return i;
|
||||
};
|
||||
|
||||
SortableTable.prototype.getSortType = function (nColumn) {
|
||||
var cell = this.tHead.rows[0].cells[nColumn];
|
||||
var val = cell._sortType;
|
||||
if (val != "")
|
||||
return val;
|
||||
return "String";
|
||||
};
|
||||
|
||||
// only nColumn is required
|
||||
// if bDescending is left out the old value is taken into account
|
||||
// if sSortType is left out the sort type is found from the sortTypes array
|
||||
|
||||
SortableTable.prototype.sort = function (nColumn, bDescending, sSortType) {
|
||||
if (sSortType == null)
|
||||
sSortType = this.getSortType(nColumn);
|
||||
|
||||
// exit if None
|
||||
if (sSortType == "None")
|
||||
return;
|
||||
|
||||
if (bDescending == null) {
|
||||
if (this.sortColumn != nColumn)
|
||||
this.descending = true;
|
||||
else
|
||||
this.descending = !this.descending;
|
||||
}
|
||||
|
||||
this.sortColumn = nColumn;
|
||||
|
||||
if (typeof this.onbeforesort == "function")
|
||||
this.onbeforesort();
|
||||
|
||||
var f = this.getSortFunction(sSortType, nColumn);
|
||||
var a = this.getCache(sSortType, nColumn);
|
||||
var tBody = this.tBody;
|
||||
|
||||
a.sort(f);
|
||||
|
||||
if (this.descending)
|
||||
a.reverse();
|
||||
|
||||
if (SortableTable.removeBeforeSort) {
|
||||
// remove from doc
|
||||
var nextSibling = tBody.nextSibling;
|
||||
var p = tBody.parentNode;
|
||||
p.removeChild(tBody);
|
||||
}
|
||||
|
||||
// insert in the new order
|
||||
var l = a.length;
|
||||
for (var i = 0; i < l; i++)
|
||||
tBody.appendChild(a[i].element);
|
||||
|
||||
if (SortableTable.removeBeforeSort) {
|
||||
// insert into doc
|
||||
p.insertBefore(tBody, nextSibling);
|
||||
}
|
||||
|
||||
this.updateHeaderArrows();
|
||||
|
||||
this.destroyCache(a);
|
||||
|
||||
if (typeof this.onsort == "function")
|
||||
this.onsort();
|
||||
};
|
||||
|
||||
SortableTable.prototype.asyncSort = function (nColumn, bDescending, sSortType) {
|
||||
var oThis = this;
|
||||
this._asyncsort = function () {
|
||||
oThis.sort(nColumn, bDescending, sSortType);
|
||||
};
|
||||
window.setTimeout(this._asyncsort, 1);
|
||||
};
|
||||
|
||||
SortableTable.prototype.getCache = function (sType, nColumn) {
|
||||
var rows = this.tBody.rows;
|
||||
var l = rows.length;
|
||||
var a = new Array(l);
|
||||
var r;
|
||||
for (var i = 0; i < l; i++) {
|
||||
r = rows[i];
|
||||
a[i] = {
|
||||
value: this.getRowValue(r, sType, nColumn),
|
||||
element: r
|
||||
};
|
||||
};
|
||||
return a;
|
||||
};
|
||||
|
||||
SortableTable.prototype.destroyCache = function (oArray) {
|
||||
var l = oArray.length;
|
||||
for (var i = 0; i < l; i++) {
|
||||
oArray[i].value = null;
|
||||
oArray[i].element = null;
|
||||
oArray[i] = null;
|
||||
}
|
||||
}
|
||||
|
||||
SortableTable.prototype.getRowValue = function (oRow, sType, nColumn) {
|
||||
var s;
|
||||
var c = oRow.cells[nColumn];
|
||||
if (typeof c.innerText != "undefined")
|
||||
s = c.innerText;
|
||||
else
|
||||
s = SortableTable.getInnerText(c);
|
||||
return this.getValueFromString(s, sType);
|
||||
};
|
||||
|
||||
SortableTable.getInnerText = function (oNode) {
|
||||
var s = "";
|
||||
var cs = oNode.childNodes;
|
||||
var l = cs.length;
|
||||
for (var i = 0; i < l; i++) {
|
||||
switch (cs[i].nodeType) {
|
||||
case 1: //ELEMENT_NODE
|
||||
s += SortableTable.getInnerText(cs[i]);
|
||||
break;
|
||||
case 3: //TEXT_NODE
|
||||
s += cs[i].nodeValue;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
SortableTable.prototype.getValueFromString = function (sText, sType) {
|
||||
switch (sType) {
|
||||
case "Number":
|
||||
return Number(sText);
|
||||
case "CaseInsensitiveString":
|
||||
return sText.toUpperCase();
|
||||
case "Date":
|
||||
var parts = sText.split("-");
|
||||
var d = new Date(0);
|
||||
d.setFullYear(parts[0]);
|
||||
d.setDate(parts[2]);
|
||||
d.setMonth(parts[1] - 1);
|
||||
return d.valueOf();
|
||||
}
|
||||
return sText;
|
||||
};
|
||||
|
||||
SortableTable.prototype.getSortFunction = function (sType, nColumn) {
|
||||
return function compare(n1, n2) {
|
||||
if (n1.value < n2.value)
|
||||
return -1;
|
||||
if (n2.value < n1.value)
|
||||
return 1;
|
||||
return 0;
|
||||
};
|
||||
};
|
||||
|
||||
SortableTable.prototype.destroy = function () {
|
||||
this.uninitHeader();
|
||||
var win = this.document.parentWindow;
|
||||
if (win && typeof win.detachEvent != "undefined") { // only IE needs this
|
||||
win.detachEvent("onunload", this._onunload);
|
||||
}
|
||||
this._onunload = null;
|
||||
this.element = null;
|
||||
this.tHead = null;
|
||||
this.tBody = null;
|
||||
this.document = null;
|
||||
this._headerOnclick = null;
|
||||
this.sortTypes = null;
|
||||
this._asyncsort = null;
|
||||
this.onsort = null;
|
||||
};
|
21
phpgwapi/js/tinymce/jscripts/tiny_mce/plugins/filemanager/InsertFile/lang/en.js
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
// I18N constants
|
||||
|
||||
// LANG: "en", ENCODING: UTF-8 | ISO-8859-1
|
||||
// Author: Al Rashid, http://alrashid.klokan.sk
|
||||
|
||||
// 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.)
|
||||
|
||||
InsertFile.I18N = {
|
||||
"InsertFileTooltip" : "Insert link to file"
|
||||
};
|
||||
/*
|
||||
|
||||
|
||||
*/
|
59
phpgwapi/js/tinymce/jscripts/tiny_mce/plugins/filemanager/InsertFile/lang/lang-de.php
vendored
Normal file
@ -0,0 +1,59 @@
|
||||
<?php
|
||||
// $Id$
|
||||
/**
|
||||
* HTMLArea3 XTD addon - FileManager
|
||||
* Based on AlRashid's FileManager
|
||||
* @package Mambo Open Source
|
||||
* @Copyright © 2004 Bernhard Pfeifer aka novocaine
|
||||
* @ All rights reserved
|
||||
* @ Mambo Open Source is Free Software
|
||||
* @ Released under GNU/GPL License : http://www.gnu.org/copyleft/gpl.html
|
||||
* @version $Revision$
|
||||
**/
|
||||
$MY_MESSAGES = array();
|
||||
$MY_MESSAGES['extmissing'] = 'Bitte laden Sie eine Datei mit einer Dateiendung hoch, z. B. "bild.jpg".';
|
||||
$MY_MESSAGES['loading'] = 'Lade Dateien...';
|
||||
$MY_MESSAGES['uploading'] = 'Lade hoch...';
|
||||
$MY_MESSAGES['nopermtodeletefile'] = 'Keine ausreichende Berechtigung zum Löschen der Datei.';
|
||||
$MY_MESSAGES['filenotfound'] = 'Datei nicht gefunden.';
|
||||
$MY_MESSAGES['unlinkfailed'] = 'Löschen fehlgeschlagen.';
|
||||
$MY_MESSAGES['rmdirfailed'] = 'Verzeichnis löschen fehlgeschlagen.';
|
||||
$MY_MESSAGES['nopermtodeletefolder'] = 'Keine ausreichende Berechtigung zum Löschen des Verzeichnisses.';
|
||||
$MY_MESSAGES['foldernotfound'] = 'Verzeichnis nicht gefunden.';
|
||||
$MY_MESSAGES['foldernotempty'] = 'Verzeichnis ist nicht leer.\nBitte löschen Sie zuerst alle darin enthaltenen Dateien.';
|
||||
$MY_MESSAGES['nopermtocreatefolder'] = 'Keine ausreichende Berechtigung zum Erstellen eines Verzeichnisses.';
|
||||
$MY_MESSAGES['pathnotfound'] = 'Pfad nicht gefunden.';
|
||||
$MY_MESSAGES['foldernamemissing'] = 'Verzeichnisname fehlt.';
|
||||
$MY_MESSAGES['folderalreadyexists'] = 'Verzeichnis existiert bereits.';
|
||||
$MY_MESSAGES['mkdirfailed'] = 'Verzeichnis erstellen fehlgeschlagen.';
|
||||
$MY_MESSAGES['nopermtoupload'] = 'Keine ausreichende Berechtigung zum Hochladen von Dateien.';
|
||||
$MY_MESSAGES['extnotallowed'] = 'Dateien mit dieser Dateiendung sind nicht erlaubt.';
|
||||
$MY_MESSAGES['filesizeexceedlimit'] = 'Datei überschreitet die zulässige Kapazität.';
|
||||
$MY_MESSAGES['filenotuploaded'] = 'Datei wurde nicht hochgeladen.';
|
||||
$MY_MESSAGES['nofiles'] = 'Keine Dateien...';
|
||||
$MY_MESSAGES['configproblem'] = 'Konfigurationsproblem ';
|
||||
$MY_MESSAGES['deletefile'] = 'Datei löschen';
|
||||
$MY_MESSAGES['deletefolder'] = 'Verzeichnis löschen';
|
||||
$MY_MESSAGES['refresh'] = 'Aktualisieren';
|
||||
$MY_MESSAGES['folder'] = 'Verzeichnis';
|
||||
$MY_MESSAGES['type'] = 'Typ';
|
||||
$MY_MESSAGES['name'] = 'Name';
|
||||
$MY_MESSAGES['size'] = 'Grösse';
|
||||
$MY_MESSAGES['datemodified'] = 'Geändert am';
|
||||
$MY_MESSAGES['url'] = 'Pfad';
|
||||
$MY_MESSAGES['comment'] = 'Kommentar';
|
||||
$MY_MESSAGES['caption'] = 'Text';
|
||||
$MY_MESSAGES['upload'] = 'Hochladen';
|
||||
$MY_MESSAGES['insertfile'] = "Datei einfügen";
|
||||
$MY_MESSAGES['filemanager'] = "Datei Manager";
|
||||
$MY_MESSAGES['directory'] = "Verzeichnis";
|
||||
$MY_MESSAGES['enterurl'] = "Bitte geben Sie eine URL ein.";
|
||||
$MY_MESSAGES['entercaption'] = 'Bitte geben Sie einen Text für die Datei ein.';
|
||||
$MY_MESSAGES['inserticon'] = 'Icon für Dateityp hinzufügen';
|
||||
$MY_MESSAGES['insertsize'] = 'Angaben über Dateigrösse hinzufügen';
|
||||
$MY_MESSAGES['insertdate'] = 'Angaben über Änderungsdatum hinzufügen';
|
||||
$MY_MESSAGES['newfolder'] = 'Name des Verzeichnisses:';
|
||||
$MY_MESSAGES['cancel'] = 'Abbrechen';
|
||||
|
||||
|
||||
?>
|
69
phpgwapi/js/tinymce/jscripts/tiny_mce/plugins/filemanager/InsertFile/lang/lang-en.php
vendored
Normal file
@ -0,0 +1,69 @@
|
||||
<?php
|
||||
/***********************************************************************
|
||||
** Title.........: Insert File Dialog, File Manager
|
||||
** Version.......: 1.1
|
||||
** Author........: Al Rashid <alrashid@klokan.sk>
|
||||
** Filename......: lang-en.php (english language file)
|
||||
** URL...........: http://alrashid.klokan.sk/insFile/
|
||||
** Last changed..: 8 Jun 2004
|
||||
***********************************************************************/
|
||||
$MY_MESSAGES = array();
|
||||
$MY_MESSAGES['extmissing'] = 'Only files with extensions are permited, e.g. "imagefile.jpg".';
|
||||
$MY_MESSAGES['loading'] = 'Loading files';
|
||||
$MY_MESSAGES['uploading'] = 'Uploading...';
|
||||
$MY_MESSAGES['nopermtodelete'] = 'No permission to delete file.';
|
||||
$MY_MESSAGES['filenotfound'] = 'File not found.';
|
||||
$MY_MESSAGES['unlinkfailed'] = 'Unlink failed.';
|
||||
$MY_MESSAGES['rmdirfailed'] = 'Rmdir failed.';
|
||||
$MY_MESSAGES['foldernotfound'] = 'Folder not found.';
|
||||
$MY_MESSAGES['nopermtocreatefolder'] = 'No permission to create folder.';
|
||||
$MY_MESSAGES['pathnotfound'] = 'Path not found.';
|
||||
$MY_MESSAGES['foldernamemissing'] = 'Folder name missing.';
|
||||
$MY_MESSAGES['folderalreadyexists'] = 'Folder already exists.';
|
||||
$MY_MESSAGES['mkdirfailed'] = 'Mkdir failed.';
|
||||
$MY_MESSAGES['nopermtoupload'] = 'No permission to upload.';
|
||||
$MY_MESSAGES['extnotallowed'] = 'Files with this extension are not allowed.';
|
||||
$MY_MESSAGES['filesizeexceedlimit'] = 'File exceeds the size limit';
|
||||
$MY_MESSAGES['filenotuploaded'] = 'File was not uploaded.';
|
||||
$MY_MESSAGES['nofiles'] = 'No files...';
|
||||
$MY_MESSAGES['configproblem'] = 'Configuration problem ';
|
||||
$MY_MESSAGES['delete'] = 'Delete';
|
||||
$MY_MESSAGES['folders'] = 'folder(s)';
|
||||
$MY_MESSAGES['files'] = 'file(s)';
|
||||
$MY_MESSAGES['refresh'] = 'Refresh';
|
||||
$MY_MESSAGES['folder'] = 'Folder';
|
||||
$MY_MESSAGES['type'] = '';
|
||||
$MY_MESSAGES['name'] = 'Name';
|
||||
$MY_MESSAGES['size'] = 'Size';
|
||||
$MY_MESSAGES['datemodified'] = 'Date Modified';
|
||||
$MY_MESSAGES['url'] = 'URL';
|
||||
$MY_MESSAGES['comment'] = 'Comment';
|
||||
$MY_MESSAGES['caption'] = 'Caption';
|
||||
$MY_MESSAGES['upload'] = 'Upload';
|
||||
$MY_MESSAGES['insertfile'] = "Insert File";
|
||||
$MY_MESSAGES['filemanager'] = "File manager";
|
||||
$MY_MESSAGES['directory'] = "Directory";
|
||||
$MY_MESSAGES['enterurl'] = "You must enter the URL";
|
||||
$MY_MESSAGES['entercaption'] = 'Please enter the caption text';
|
||||
$MY_MESSAGES['newfolder'] = 'New folder';
|
||||
$MY_MESSAGES['newfoldernamemissing'] = 'New folder name missing!';
|
||||
$MY_MESSAGES['renamefolder'] = 'New folder name:';
|
||||
$MY_MESSAGES['renamewarning'] = 'Warning!\n Renaming or moving folders and files will break existing links in your documents. Continue?';
|
||||
$MY_MESSAGES['renamefile'] = 'New file name:';
|
||||
$MY_MESSAGES['nopermtorename'] = 'No permission to rename files and folders.';
|
||||
$MY_MESSAGES['newfilenamemissing'] = 'New file name missing!';
|
||||
$MY_MESSAGES['filealreadyexists'] = 'File with specified new name already exists. File was not renamed/moved.';
|
||||
$MY_MESSAGES['folderalreadyexists'] = 'Folder with specified new name already exists. Folder was not renamed/moved.';
|
||||
$MY_MESSAGES['uploadfilealreadyexists'] = 'File already exists. File was not uploaded.';
|
||||
$MY_MESSAGES['cancel'] = 'Cancel';
|
||||
$MY_MESSAGES['ok'] = 'OK';
|
||||
$MY_MESSAGES['openfile'] = 'Open file in new window';
|
||||
$MY_MESSAGES['up'] = 'Up';
|
||||
$MY_MESSAGES['rename'] = 'Rename';
|
||||
$MY_MESSAGES['renamefailed'] = 'Rename failed';
|
||||
$MY_MESSAGES['move'] = 'Move';
|
||||
$MY_MESSAGES['nopermtomove'] = 'No permission to move files and folders.';
|
||||
$MY_MESSAGES['selectfolder'] = 'Choose directory to move selected folders and files to.';
|
||||
$MY_MESSAGES['ctrlshift'] = 'Use Ctrl and/or Shift to select multiple items.';
|
||||
$MY_MESSAGES['filename'] = 'File:';
|
||||
?>
|
55
phpgwapi/js/tinymce/jscripts/tiny_mce/plugins/filemanager/InsertFile/lang/lang-nl.php
vendored
Normal file
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
/***********************************************************************
|
||||
** Title.........: Insert File Dialog, File Manager
|
||||
** Version.......: 1.00
|
||||
** Author........: Thomas van Ditzhuijsen, ditzhuijsen@hotmail.com
|
||||
** Filename......: lang-nl.php
|
||||
** Last changed..: 8 Jan 2004
|
||||
dutch language file
|
||||
***********************************************************************/
|
||||
$MY_MESSAGES = array();
|
||||
$MY_MESSAGES['extmissing'] = 'Het te upload bestand moet een extensie (iets achter de punt) hebben, bijv. "imagefile.jpg".';
|
||||
$MY_MESSAGES['loading'] = 'Bestanden worden geladen';
|
||||
$MY_MESSAGES['uploading'] = 'Uploaden...';
|
||||
$MY_MESSAGES['nopermtodeletefile'] = 'Je hebt niet de rechten om bestanden te verwijderen.';
|
||||
$MY_MESSAGES['filenotfound'] = 'Bestand niet gevonden.';
|
||||
$MY_MESSAGES['unlinkfailed'] = 'Verwijderen niet gelukt.';
|
||||
$MY_MESSAGES['rmdirfailed'] = 'Verwijderen van de map is niet gelukt.';
|
||||
$MY_MESSAGES['nopermtodeletefolder'] = 'Je hebt niet de rechten om een map te verwijderen.';
|
||||
$MY_MESSAGES['foldernotfound'] = 'map niet gevonden.';
|
||||
$MY_MESSAGES['foldernotempty'] = 'Folder is niet leeg. Verwijder alle bestanden aub eerst.';
|
||||
$MY_MESSAGES['nopermtocreatefolder'] = 'Je hebt niet de rechten om een folder te maken.';
|
||||
$MY_MESSAGES['pathnotfound'] = 'map niet gevonden.';
|
||||
$MY_MESSAGES['foldernamemissing'] = 'map naam ontbreekt.';
|
||||
$MY_MESSAGES['folderalreadyexists'] = 'map bestaat al.';
|
||||
$MY_MESSAGES['mkdirfailed'] = 'Het maken van de map is niet gelukt.';
|
||||
$MY_MESSAGES['nopermtoupload'] = 'Je hebt niet de rechten om te uploaden.';
|
||||
$MY_MESSAGES['extnotallowed'] = 'Bestanden met deze extensie zijn niet toegestaan.';
|
||||
$MY_MESSAGES['filesizeexceedlimit'] = 'Bestand is groter dan de maximale bestands grootte.';
|
||||
$MY_MESSAGES['filenotuploaded'] = 'Bestand is niet geupload.';
|
||||
$MY_MESSAGES['nofiles'] = 'Geen bestanden...';
|
||||
$MY_MESSAGES['configproblem'] = 'Configuratie probleem ';
|
||||
$MY_MESSAGES['deletefile'] = 'Verwijder bestand';
|
||||
$MY_MESSAGES['deletefolder'] = 'Verwijdermap';
|
||||
$MY_MESSAGES['refresh'] = 'Vernieuw';
|
||||
$MY_MESSAGES['folder'] = 'Map';
|
||||
$MY_MESSAGES['type'] = '';
|
||||
$MY_MESSAGES['name'] = 'Naam';
|
||||
$MY_MESSAGES['size'] = 'Grootte';
|
||||
$MY_MESSAGES['datemodified'] = 'Datum gewijzigd';
|
||||
$MY_MESSAGES['url'] = 'URL';
|
||||
$MY_MESSAGES['comment'] = 'Commentaar';
|
||||
$MY_MESSAGES['caption'] = 'Titel';
|
||||
$MY_MESSAGES['upload'] = 'Upload';
|
||||
$MY_MESSAGES['insertfile'] = "Voeg bestand toe";
|
||||
$MY_MESSAGES['filemanager'] = "Bestands beheer";
|
||||
$MY_MESSAGES['directory'] = "map";
|
||||
$MY_MESSAGES['enterurl'] = "Je moet een URL invoeren";
|
||||
$MY_MESSAGES['entercaption'] = 'Type aub een Titel tekst';
|
||||
$MY_MESSAGES['inserticon'] = 'Insert filetype icon';
|
||||
$MY_MESSAGES['insertsize'] = 'Insert file size';
|
||||
$MY_MESSAGES['insertdate'] = 'Insert file modification date';
|
||||
$MY_MESSAGES['newfolder'] = 'New folder name:';
|
||||
|
||||
|
||||
?>
|
99
phpgwapi/js/tinymce/jscripts/tiny_mce/plugins/filemanager/InsertFile/move.php
vendored
Normal file
@ -0,0 +1,99 @@
|
||||
<?php
|
||||
/***********************************************************************
|
||||
** Title.........: Insert File Dialog, File Manager
|
||||
** Version.......: 1.1
|
||||
** Authors.......: Al Rashid <alrashid@klokan.sk>
|
||||
** Xiang Wei ZHUO <wei@zhuo.org>
|
||||
** Filename......: move.php
|
||||
** URL...........: http://alrashid.klokan.sk/insFile/
|
||||
** Last changed..: 23 July 2004
|
||||
***********************************************************************/
|
||||
|
||||
require('config.inc.php');
|
||||
require('functions.php');
|
||||
?>
|
||||
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>Folder dialog</title>
|
||||
<?php
|
||||
echo '<meta http-equiv="content-language" content="'.$MY_LANG.'" />'."\n";
|
||||
echo '<meta http-equiv="Content-Type" content="text/html; charset='.$MY_CHARSET.'" />'."\n";
|
||||
echo '<meta name="author" content="AlRashid, www: http://alrashid.klokan.sk; mailto:alrashid@klokan.sk" />'."\n";
|
||||
?>
|
||||
|
||||
<style type="text/css">
|
||||
/*<![CDATA[*/
|
||||
html, body { background-color: ButtonFace; color: ButtonText; font: 11px Tahoma,Verdana,sans-serif; margin: 0; padding: 0;}
|
||||
body { padding: 5px; }
|
||||
.title { background-color: #ddf; color: #000; font-weight: bold; font-size: 120%; padding: 3px 10px; margin-bottom: 10px; border-bottom: 1px solid black; letter-spacing: 2px;}
|
||||
select, input, button { font: 11px Tahoma,Verdana,sans-serif; }
|
||||
.buttons { width: 70px; text-align: center; }
|
||||
form { padding: 0px; margin: 0;}
|
||||
form .elements{
|
||||
padding: 10px; text-align: center;
|
||||
}
|
||||
/*]]>*/
|
||||
</style>
|
||||
<script type="text/javascript" src="js/popup.js"></script>
|
||||
<script type="text/javascript">
|
||||
/*<![CDATA[*/
|
||||
window.resizeTo(550, 200);
|
||||
|
||||
function onCancel() {
|
||||
__dlg_close(null);
|
||||
return false;
|
||||
}
|
||||
|
||||
function onOK() {
|
||||
// pass data back to the calling window
|
||||
var param = new Object();
|
||||
var selection = document.forms[0].newpath;
|
||||
var newDir = selection.options[selection.selectedIndex].value;
|
||||
param['newpath'] = newDir;
|
||||
__dlg_close(param);
|
||||
return false;
|
||||
}
|
||||
|
||||
function Init() {
|
||||
__dlg_init();
|
||||
}
|
||||
|
||||
function refreshDirs() {
|
||||
var allPaths = document.forms[0].newpath.options;
|
||||
var fields = ["/" <?php dirs($MY_DOCUMENT_ROOT,'');?>];
|
||||
for(i=0; i<fields.length; i++) {
|
||||
var newElem = document.createElement("OPTION");
|
||||
var newValue = fields[i];
|
||||
newElem.text = newValue;
|
||||
newElem.value = newValue;
|
||||
allPaths.add(newElem);
|
||||
}
|
||||
}
|
||||
/*]]>*/
|
||||
</script>
|
||||
</head>
|
||||
<body onload="Init()">
|
||||
<div class="title"><?php echo $MY_MESSAGES['selectfolder']; ?></div>
|
||||
<form action="">
|
||||
<div class="elements">
|
||||
<label for="newpath">
|
||||
<?php echo $MY_MESSAGES['directory']; ?>
|
||||
</label>
|
||||
<select name="newpath" id="newpath" style="width:35em">
|
||||
</select>
|
||||
</div>
|
||||
<div style="text-align: right;">
|
||||
<hr />
|
||||
<button type="button" class="buttons" onclick="return onCancel();"><?php echo $MY_MESSAGES['cancel']; ?></button>
|
||||
<button type="button" class="buttons" onclick="return onOK();"><?php echo $MY_MESSAGES['ok']; ?></button>
|
||||
</div>
|
||||
</form>
|
||||
<script type="text/javascript">
|
||||
/*<![CDATA[*/
|
||||
refreshDirs();
|
||||
/*]]>*/
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
87
phpgwapi/js/tinymce/jscripts/tiny_mce/plugins/filemanager/InsertFile/thumbs.php
vendored
Normal file
@ -0,0 +1,87 @@
|
||||
<?php
|
||||
/**************************************************************************\
|
||||
* eGroupWare - UploadImage-plugin for htmlArea *
|
||||
* http://www.eGroupWare.org *
|
||||
* Written and (c) by Xiang Wei ZHUO <wei@zhuo.org> *
|
||||
* Modified for eGW by and (c) by Pim Snel <pim@lingewoud.nl> *
|
||||
* -------------------------------------------- *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU General Public License as published by the *
|
||||
* Free Software Foundation; version 2 of the License. *
|
||||
* -------------------------------------------- *
|
||||
* Title.........: Thumbnail generator, with cache. *
|
||||
* Version.......: 1.01 *
|
||||
* Author........: Xiang Wei ZHUO <wei@zhuo.org> *
|
||||
* Notes.........: Configuration in config.inc.php *
|
||||
* *
|
||||
* Functions *
|
||||
* - if the thumbnail does not exists or the source file is newer, create a *
|
||||
* new thumbnail. *
|
||||
\**************************************************************************/
|
||||
|
||||
/* $id */
|
||||
|
||||
require_once 'config.inc.php';
|
||||
require_once 'functions.php';
|
||||
require_once 'Transform.php';
|
||||
|
||||
$img = $BASE_DIR.urldecode($_GET['img']);
|
||||
|
||||
if(is_file($img)) {
|
||||
make_thumbs(urldecode($_GET['img']));
|
||||
}
|
||||
|
||||
function make_thumbs($img)
|
||||
{
|
||||
global $BASE_DIR, $BASE_URL;
|
||||
|
||||
$path_info = pathinfo($img);
|
||||
$path = $path_info['dirname']."/";
|
||||
$img_file = $path_info['basename'];
|
||||
|
||||
$thumb = $path.'.'.$img_file;
|
||||
|
||||
$img_info = getimagesize($BASE_DIR.$path.$img_file);
|
||||
$w = $img_info[0]; $h = $img_info[1];
|
||||
|
||||
$nw = 96; $nh = 96;
|
||||
|
||||
if($w <= $nw && $h <= $nh) {
|
||||
header('Location: '.$BASE_URL.$path.$img_file);
|
||||
exit();
|
||||
}
|
||||
|
||||
if(is_file($BASE_DIR.$thumb)) {
|
||||
|
||||
$t_mtime = filemtime($BASE_DIR.$thumb);
|
||||
$o_mtime = filemtime($BASE_DIR.$img);
|
||||
|
||||
if($t_mtime > $o_mtime) {
|
||||
//echo $BASE_URL.$path.'.'.$img_file;
|
||||
header('Location: '.$BASE_URL.$path.'.'.$img_file);
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
$img_thumbs = Image_Transform::factory(IMAGE_CLASS);
|
||||
$img_thumbs->load($BASE_DIR.$path.$img_file);
|
||||
|
||||
if ($w > $h)
|
||||
$nh = unpercent(percent($nw, $w), $h);
|
||||
else if ($h > $w)
|
||||
$nw = unpercent(percent($nh, $h), $w);
|
||||
|
||||
$img_thumbs->resize($nw, $nh);
|
||||
|
||||
$img_thumbs->save($BASE_DIR.$thumb);
|
||||
$img_thumbs->free();
|
||||
|
||||
chmod($BASE_DIR.$thumb, 0666);
|
||||
|
||||
if(is_file($BASE_DIR.$thumb)) {
|
||||
header('Location: '.$BASE_URL.$path.'.'.$img_file);
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
124
phpgwapi/js/tinymce/jscripts/tiny_mce/plugins/filemanager/InsertFile/view_icon.php
vendored
Normal file
@ -0,0 +1,124 @@
|
||||
<script language="JavaScript" type="text/JavaScript">
|
||||
|
||||
function pviiClassNew(obj, new_style) { //v2.6 by PVII
|
||||
obj.className=new_style;
|
||||
}
|
||||
|
||||
function deleteImage(file)
|
||||
{
|
||||
if(confirm("Delete image \""+file+"\"?"))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
</script>
|
||||
|
||||
<?php
|
||||
class view_icon {
|
||||
|
||||
function view_icon()
|
||||
{
|
||||
require_once 'Transform.php';
|
||||
}
|
||||
|
||||
function dir_name($dir)
|
||||
{
|
||||
$lastSlash = intval(strrpos($dir, '/'));
|
||||
if($lastSlash == strlen($dir)-1){
|
||||
return substr($dir, 0, $lastSlash);
|
||||
}
|
||||
else
|
||||
return dirname($dir);
|
||||
}
|
||||
|
||||
function folder_item($params)
|
||||
{
|
||||
// $num_files = num_files($params['absolutePath']);
|
||||
return '<td>
|
||||
<table width="102" border="0" cellpadding="0" cellspacing="2">
|
||||
<tr>
|
||||
<td align="center" class="imgBorder" onMouseOver="pviiClassNew(this,\'imgBorderHover\')" onMouseOut="pviiClassNew(this,\'imgBorder\')">
|
||||
<a href="javascript:changeDir('.$params['folderNb'].');" title="'.$params['entry'].'">
|
||||
<img src="img/folder.gif" width="80" height="80" border=0 alt="'. $params['entry'].'">
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><table width="100%" border="0" cellspacing="1" cellpadding="2">
|
||||
<tr>
|
||||
<td width="1%" class="buttonOut" onMouseOver="pviiClassNew(this,\'buttonHover\')" onMouseOut="pviiClassNew(this,\'buttonOut\')">
|
||||
<!-- <a href="files.php?delFolder='. $params['absolutePath']. '&dir='. $newPath. '" onClick="return deleteFolder(\''. $dir.'\','.
|
||||
$num_files. ')"><img src="img/edit_trash.gif" width="15" height="15" border="0"></a></td> -->
|
||||
<td width="99%" class="imgCaption">'. $params['entry']. '</td>
|
||||
</tr>
|
||||
</table></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>';
|
||||
}
|
||||
|
||||
function files_item($params)
|
||||
{
|
||||
|
||||
|
||||
$img_url = $params['MY_BASE_URL']. $params['relativePath'];
|
||||
$thumb_image = 'thumbs.php?img='.urlencode($params['relativePath']);//$params['absolutePath']);
|
||||
$filesize = $params['parsed_size'];
|
||||
$file = $params['entry'];
|
||||
$ext = $params['ext'];
|
||||
$info = $params['info'];
|
||||
return '
|
||||
<td>
|
||||
<table width="102" border="0" cellpadding="0" cellspacing="2">
|
||||
<tr>
|
||||
<td align="center" class="imgBorder" onMouseOver="pviiClassNew(this,\'imgBorderHover\')" onMouseOut="pviiClassNew(this,\'imgBorder\')">
|
||||
<a href="javascript:;" onClick="javascript:fileSelected(\''. $img_url. '\',\''. $file. '\',\''. $ext. '\','. $info[0]. ','. $info[1]. ');">
|
||||
<img src="'. $thumb_image. '" alt="'. $file. ' - '. $filesize. '" border="0"></a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><table width="100%" border="0" cellspacing="0" cellpadding="2">
|
||||
<tr>
|
||||
<!-- <td width="1%" class="buttonOut" onMouseOver="pviiClassNew(this,\'buttonHover\')" onMouseOut="pviiClassNew(this,\'buttonOut\')">
|
||||
<a href="javascript:;" onClick="javascript:preview(\''. $img_url. '\',\''. $file. '\',\''. $filesize. '\','.
|
||||
$info[0].','.$info[1]. ');"><img src="img/edit_pencil.gif" width="15" height="15" border="0"></a></td>
|
||||
<td width="1%" class="buttonOut" onMouseOver="pviiClassNew(this,\'buttonHover\')" onMouseOut="pviiClassNew(this,\'buttonOut\')">
|
||||
<a href="files.php?delFile='. $file.' &dir='. $newPath. '" onClick="return deleteImage(\''. $file. '\');"><img src="img/edit_trash.gif" width="15" height="15" border="0"></a></td> -->
|
||||
<td colspan="3" width="98%" class="imgCaption">'. $info[0].'x'.$info[1]. '</td>
|
||||
</tr>
|
||||
</table></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>';
|
||||
}
|
||||
|
||||
function files_header($param)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
function files_footer($param)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
function folders_header($param)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
function folders_footer($param)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
function table_header($param)
|
||||
{
|
||||
return '<table class="sort-table" id="tableHeader" border="0" cellpadding="0" cellspacing="2"><tr id="sortmefirst">';
|
||||
}
|
||||
|
||||
function table_footer($param)
|
||||
{
|
||||
return '</tr></table>';
|
||||
}
|
||||
}
|
||||
?>
|
128
phpgwapi/js/tinymce/jscripts/tiny_mce/plugins/filemanager/InsertFile/view_text.php
vendored
Normal file
@ -0,0 +1,128 @@
|
||||
<?php
|
||||
|
||||
class view_text {
|
||||
|
||||
function folder_item($params)
|
||||
{
|
||||
return '<tr id="D'.$params['folderNb'].'">
|
||||
<td width="4%"><img src="img/ext/folder_small.gif" width="16" height="16" border="0" alt="'.$params['entry'].'" /></td>
|
||||
<td width="50%"><div style="height:15px; overflow:hidden;"><a href="javascript:changeDir('.$params['folderNb'].');" title="'.$params['entry'].'">'.$params['entry'].'</a></div></td>
|
||||
<td width="18%" align="right">'.$params['MY_MESSAGES']['folder'].'</td>
|
||||
<td width="25%">'.$params['parsed_time'].'</td>
|
||||
<td width="0px" style="display: none;"> </td>
|
||||
<td width="0px" style="display: none;"> </td>
|
||||
<td width="0px" style="display: none;">'.$params['time'].'</td>
|
||||
</tr>';
|
||||
}
|
||||
|
||||
function files_item($params)
|
||||
{
|
||||
$trId = (int)$params['fileNb'] + 1;
|
||||
return '<tr id="F'.$params['fileNb'].'">
|
||||
<td width="4%"><img src="'.$params['parsed_icon'].'" width="16" height="16" border="0" alt="'.$params['entry'].'" /></td>
|
||||
<td width="50%"><div style="height:15px; overflow:hidden;"><a href="javascript:;" onClick="javascript:fileSelected(\''.$params['MY_BASE_URL'].$params['relativePath'].'\',\''.$params['entry'].'\',\''. $params['ext']. '\',\''. $params['info'][0].'\',\''.$params['info'][1].'\');">'.$params['entry'].'</div></td>
|
||||
<td width="18%" align="right">'.$params['parsed_size'].'</td>
|
||||
<td width="25%">'.$params['parsed_time'].'</td>
|
||||
<td width="0px" style="display: none;">'.$params['ext'].'</td>
|
||||
<td width="0px" style="display: none;">'.$params['size'].'</td>
|
||||
<td width="0px" style="display: none;">'.$params['time'].'</td>
|
||||
</tr>';
|
||||
}
|
||||
|
||||
function table_header($params)
|
||||
{
|
||||
return '<table class="sort-table" id="tableHeader" cellspacing="0" width="100%" border="0" >
|
||||
<col />
|
||||
<col />
|
||||
<col style="text-align: right" />
|
||||
<col />
|
||||
<thead>
|
||||
<tr>
|
||||
<td width="4%" id="sortmefirst" onclick="setSortBy(0, false);">'.$params['MY_MESSAGES']['type'].'</td>
|
||||
<td width="50%" title="CaseInsensitiveString" onclick="setSortBy(1, false);">'.$params['MY_MESSAGES']['name'].'</td>
|
||||
<td width="13%" onclick="setSortBy(2, false);">'.$params['MY_MESSAGES']['size'].'</td>
|
||||
<td width="25%" onclick="setSortBy(3, false);">'.$params['MY_MESSAGES']['datemodified'].'</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody style="display: none;" >
|
||||
<tr>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</tbody></table>';
|
||||
}
|
||||
|
||||
function folders_header($params)
|
||||
{
|
||||
return '<table class="sort-table" id="tableFolders" onselectstart="return false" cellspacing="0" width="100%" border="0" >
|
||||
<col />
|
||||
<col />
|
||||
<col style="text-align: right" />
|
||||
<col />
|
||||
<col />
|
||||
<col />
|
||||
<col />
|
||||
<thead style="display: none;">
|
||||
<tr>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>';
|
||||
}
|
||||
|
||||
function folders_footer($parms)
|
||||
{
|
||||
return '</tbody> </table>';
|
||||
}
|
||||
|
||||
function files_header($params)
|
||||
{
|
||||
return '<table class="sort-table" id="tableFiles" onselectstart="return false" cellspacing="0" width="100%" border="0" >
|
||||
<col />
|
||||
<col />
|
||||
<col style="text-align: right" />
|
||||
<col />
|
||||
<col />
|
||||
<col />
|
||||
<col />
|
||||
<thead style="display: none;">
|
||||
<tr>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>';
|
||||
}
|
||||
|
||||
function files_footer($params)
|
||||
{
|
||||
return '</tbody> </table>';
|
||||
}
|
||||
function table_footer($params)
|
||||
{
|
||||
return '<script type="text/javascript">
|
||||
/*<![CDATA[*/
|
||||
var st = new SortableTable(document.getElementById("tableHeader"), ["CaseInsensitiveString", "CaseInsensitiveString", "Number", "Number"]);
|
||||
var st1 = new SortableTable(document.getElementById("tableFolders"), ["None", "CaseInsensitiveString", "None", "None", "CaseInsensitiveString", "Number", "Number"]);
|
||||
var st2 = new SortableTable(document.getElementById("tableFiles"), ["None", "CaseInsensitiveString", "None", "None", "CaseInsensitiveString", "Number", "Number"]);
|
||||
var sta = new SelectableTableRows(document.getElementById("tableFolders"), true);
|
||||
var stb = new SelectableTableRows(document.getElementById("tableFiles"), true);
|
||||
setSortBy(1, true);
|
||||
/*]]>*/
|
||||
</script>';
|
||||
}
|
||||
}
|
||||
?>
|
31
phpgwapi/js/tinymce/jscripts/tiny_mce/plugins/filemanager/editor_plugin.js
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
/* Import theme specific language pack */
|
||||
tinyMCE.importPluginLanguagePack('filemanager', 'en');
|
||||
|
||||
function TinyMCE_filemanager_getControlHTML(control_name) {
|
||||
switch (control_name) {
|
||||
case "filemanager":
|
||||
return '<img id="{$editor_id}_filemanager" src="{$pluginurl}/images/filemanager.png" title="{$lang_insert_filemanager}" width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceFilemanager\');" />';
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes the mceFilemanager command.
|
||||
*/
|
||||
function TinyMCE_filemanager_execCommand(editor_id, element, command, user_interface, value) {
|
||||
// Handle commands
|
||||
switch (command) {
|
||||
case "mceFilemanager":
|
||||
var template = new Array();
|
||||
template['file'] = '../../plugins/filemanager/InsertFile/insert_file.php'; // Relative to theme
|
||||
template['width'] = 660;
|
||||
template['height'] = 500;
|
||||
|
||||
tinyMCE.openWindow(template, {editor_id : editor_id});
|
||||
return true;
|
||||
}
|
||||
// Pass to next handler in chain
|
||||
return false;
|
||||
}
|
||||
|
||||
|
BIN
phpgwapi/js/tinymce/jscripts/tiny_mce/plugins/filemanager/images/filemanager.gif
vendored
Normal file
After Width: | Height: | Size: 144 B |
BIN
phpgwapi/js/tinymce/jscripts/tiny_mce/plugins/filemanager/images/filemanager.png
vendored
Normal file
After Width: | Height: | Size: 639 B |
34
phpgwapi/js/tinymce/jscripts/tiny_mce/plugins/filemanager/readme.txt
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
file Manager plugin for TinyMCE
|
||||
---------------------------------
|
||||
|
||||
Installation instructions:
|
||||
* Copy the ibrowser directory to the plugins directory of TinyMCE (/jscripts/tiny_mce/plugins).
|
||||
* Add plugin to TinyMCE plugin option list example: plugins : "filemanager".
|
||||
* Add the ibrowser button name to button list, example: theme_advanced_buttons3_add : "filemanager".
|
||||
* Modify the ..../jscripts/tiny_mce/plugins/filemanager/insertfile/config.inc.php
|
||||
|
||||
Configuration example:
|
||||
$MY_DOCUMENT_ROOT = 'C:/appserv/www/tinymce142/resource/insfile'; //* system path to the directory you want to manage the files and folders
|
||||
$MY_BASE_URL = "http://localhost/tinymce142/resource/insfile";
|
||||
$MY_URL_TO_OPEN_FILE = "http://localhost/tinymce142/resource/insfile";
|
||||
$MY_ALLOW_EXTENSIONS = array('html', 'doc', 'xls', 'txt', 'gif', 'jpeg', 'jpg', 'png', 'pdf', 'zip', 'pdf');
|
||||
$MY_DENY_EXTENSIONS = array('php', 'php3', 'php4', 'phtml', 'shtml', 'cgi', 'pl');
|
||||
$MY_LIST_EXTENSIONS = array('html', 'doc', 'xls', 'txt', 'gif', 'jpeg', 'jpg', 'png', 'pdf', 'zip', 'pdf');
|
||||
$MY_ALLOW_CREATE = true; // Boolean (false or true) whether creating folders is allowed or not.
|
||||
$MY_ALLOW_DELETE = true; // Boolean (false or true) whether deleting files and folders is allowed or not.
|
||||
$MY_ALLOW_RENAME = true; // Boolean (false or true) whether renaming files and folders is allowed or not.
|
||||
$MY_ALLOW_MOVE = true; // Boolean (false or true) whether moving files and folders is allowed or not.
|
||||
$MY_ALLOW_UPLOAD = true; // Boolean (false or true) whether uploading files is allowed or not.
|
||||
|
||||
|
||||
|
||||
Initialization example:
|
||||
tinyMCE.init({
|
||||
theme : "advanced",
|
||||
elements: "ta",
|
||||
mode : "exact",
|
||||
plugins : "filemanager",
|
||||
theme_advanced_buttons3_add : "filemanager"
|
||||
});
|
||||
|
||||
|