cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fel...@apache.org
Subject svn commit: r558490 [11/33] - in /cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/xinha: ./ images/ images/de/ images/fr/ lang/ modules/ modules/ColorPicker/ modules/CreateLink/ modules/Dialogs/ m...
Date Sun, 22 Jul 2007 14:51:30 GMT
Added: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/xinha/plugins/ExtendedFileManager/Classes/ExtendedFileManager.php
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/xinha/plugins/ExtendedFileManager/Classes/ExtendedFileManager.php?view=auto&rev=558490
==============================================================================
--- cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/xinha/plugins/ExtendedFileManager/Classes/ExtendedFileManager.php (added)
+++ cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/xinha/plugins/ExtendedFileManager/Classes/ExtendedFileManager.php Sun Jul 22 07:50:10 2007
@@ -0,0 +1,825 @@
+<?php
+/**
+ * ExtendedFileManager, list images, directories, and thumbnails.
+ * Authors: Wei Zhuo, Afru, Krzysztof Kotowicz, Raimund Meyer
+ * Version: Updated on 08-01-2005 by Afru
+ * Version: Updated on 04-07-2006 by Krzysztof Kotowicz
+ * Version: Updated on 29-10-2006 by Raimund Meyer
+ * Package: ExtendedFileManager (EFM 1.1.3)
+ * http://www.afrusoft.com/htmlarea
+ */
+
+/**
+ * We use classes from ImageManager to avoid code duplication
+ */
+require_once '../ImageManager/Classes/Files.php';
+
+/**
+ * ExtendedFileManager Class.
+ * @author $Author: ray $
+ * @author $Author: ray $
+ * @version $Id: ExtendedFileManager.php 677 2007-01-19 22:24:36Z ray $
+ */
+class ExtendedFileManager 
+{
+	/**
+	 * Configuration array.
+	 */
+	var $config;
+
+	/**
+	 * Array of directory information.
+	 */
+	var $dirs;
+	
+    /**
+     * Manager mode - image | link
+     */
+	var $mode;
+
+	/**
+	 * Constructor. Create a new Image Manager instance.
+	 * @param array $config configuration array, see config.inc.php
+	 */
+	function ExtendedFileManager($config, $mode = null)
+	{
+		$this->config = $config;
+		
+		$this->mode = empty($mode) ? (empty($config['insert_mode']) ? 'image' : $config['insert_mode']): $mode;
+	}
+
+	/**
+	 * Get the base directory.
+	 * @return string base dir, see config.inc.php
+	 */
+	function getImagesDir()
+	{
+		if ($this->mode == 'link' && isset($this->config['files_dir']))
+			Return $this->config['files_dir'];
+		else Return $this->config['images_dir'];
+	}
+
+	/**
+	 * Get the base URL.
+	 * @return string base url, see config.inc.php
+	 */
+	function getImagesURL()
+	{
+		if ($this->mode == 'link' && isset($this->config['files_url']))
+				Return $this->config['files_url'];
+		else Return $this->config['images_url'];
+	}
+
+	function isValidBase()
+	{
+		return is_dir($this->getImagesDir());
+	}
+
+	/**
+	 * Get the tmp file prefix.
+     * @return string tmp file prefix.
+	 */
+	function getTmpPrefix() 
+	{
+		Return $this->config['tmp_prefix'];
+	}
+
+	/**
+	 * Get the sub directories in the base dir.
+	 * Each array element contain
+	 * the relative path (relative to the base dir) as key and the 
+	 * full path as value.
+	 * @return array of sub directries
+	 * <code>array('path name' => 'full directory path', ...)</code>
+	 */
+	function getDirs() 
+	{
+		if(is_null($this->dirs))
+		{
+			$dirs = $this->_dirs($this->getImagesDir(),'/');
+			ksort($dirs);
+			$this->dirs = $dirs;
+		}
+		return $this->dirs;
+	}
+
+	/**
+	 * Recursively travese the directories to get a list
+	 * of accessable directories.
+	 * @param string $base the full path to the current directory
+	 * @param string $path the relative path name
+	 * @return array of accessiable sub-directories
+	 * <code>array('path name' => 'full directory path', ...)</code>
+	 */
+	function _dirs($base, $path) 
+	{
+		$base = Files::fixPath($base);
+		$dirs = array();
+
+		if($this->isValidBase() == false)
+			return $dirs;
+
+		$d = @dir($base);
+		
+		while (false !== ($entry = $d->read())) 
+		{
+			//If it is a directory, and it doesn't start with
+			// a dot, and if is it not the thumbnail directory
+			if(is_dir($base.$entry) 
+				&& substr($entry,0,1) != '.'
+				&& $this->isThumbDir($entry) == false) 
+			{
+				$relative = Files::fixPath($path.$entry);
+				$fullpath = Files::fixPath($base.$entry);
+				$dirs[$relative] = $fullpath;
+				$dirs = array_merge($dirs, $this->_dirs($fullpath, $relative));
+			}
+		}
+		$d->close();
+
+		Return $dirs;
+	}
+
+	/**
+	 * Get all the files and directories of a relative path.
+	 * @param string $path relative path to be base path.
+	 * @return array of file and path information.
+	 * <code>array(0=>array('relative'=>'fullpath',...), 1=>array('filename'=>fileinfo array(),...)</code>
+	 * fileinfo array: <code>array('url'=>'full url', 
+	 *                       'relative'=>'relative to base', 
+	 *                        'fullpath'=>'full file path', 
+	 *                        'image'=>imageInfo array() false if not image,
+	 *                        'stat' => filestat)</code>
+	 */
+	function getFiles($path) 
+	{
+		$files = array();
+		$dirs = array();
+
+        $valid_extensions = $this->mode == 'image' ? $this->config['allowed_image_extensions'] : $this->config['allowed_link_extensions'];
+
+		if($this->isValidBase() == false)
+			return array($files,$dirs);
+
+		$path = Files::fixPath($path);
+		$base = Files::fixPath($this->getImagesDir());
+		$fullpath = Files::makePath($base,$path);
+
+
+		$d = @dir($fullpath);
+		
+		while (false !== ($entry = $d->read())) 
+		{
+			//not a dot file or directory
+			if(substr($entry,0,1) != '.')
+			{
+				if(is_dir($fullpath.$entry)
+					&& $this->isThumbDir($entry) == false)
+				{
+					$relative = Files::fixPath($path.$entry);
+					$full = Files::fixPath($fullpath.$entry);
+					$count = $this->countFiles($full);
+					$dirs[$relative] = array('fullpath'=>$full,'entry'=>$entry,'count'=>$count, 'stat'=>stat($fullpath.$entry));
+				}
+
+				else if(is_file($fullpath.$entry) && $this->isThumb($entry)==false && $this->isTmpFile($entry) == false) 
+				{
+					$afruext = strtolower(substr(strrchr($entry, "."), 1));
+
+                    if(in_array($afruext,$valid_extensions))
+					{
+
+						$file['url'] = Files::makePath($this->config['base_url'],$path).$entry;
+						$file['relative'] = $path.$entry;
+						$file['fullpath'] = $fullpath.$entry;
+						$img = $this->getImageInfo($fullpath.$entry);
+						if(!is_array($img)) $img[0]=$img[1]=0;
+						$file['image'] = $img;
+						$file['stat'] = stat($fullpath.$entry);
+						$file['ext'] = $afruext;
+						$files[$entry] = $file;
+					}
+
+				}
+			}
+		}
+		$d->close();
+		ksort($dirs);
+		ksort($files);
+		
+		Return array($dirs, $files);
+	}	
+
+	/**
+	 * Count the number of files and directories in a given folder
+	 * minus the thumbnail folders and thumbnails.
+	 */
+	function countFiles($path) 
+	{
+		$total = 0;
+
+		if(is_dir($path)) 
+		{
+			$d = @dir($path);
+
+			while (false !== ($entry = $d->read())) 
+			{
+				//echo $entry."<br>";
+				if(substr($entry,0,1) != '.'
+					&& $this->isThumbDir($entry) == false
+					&& $this->isTmpFile($entry) == false
+					&& $this->isThumb($entry) == false) 
+				{
+					$total++;
+				}
+			}
+			$d->close();
+		}
+		return $total;
+	}
+
+	/**
+	 * Get image size information.
+	 * @param string $file the image file
+	 * @return array of getImageSize information, 
+	 *  false if the file is not an image.
+	 */
+	function getImageInfo($file) 
+	{
+		Return @getImageSize($file);
+	}
+
+	/**
+	 * Check if the file contains the thumbnail prefix.
+	 * @param string $file filename to be checked
+	 * @return true if the file contains the thumbnail prefix, false otherwise.
+	 */
+	function isThumb($file) 
+	{
+		$len = strlen($this->config['thumbnail_prefix']);
+		if(substr($file,0,$len)==$this->config['thumbnail_prefix'])
+			Return true;
+		else
+			Return false;
+	}
+
+	/**
+	 * Check if the given directory is a thumbnail directory.
+	 * @param string $entry directory name
+	 * @return true if it is a thumbnail directory, false otherwise
+	 */
+	function isThumbDir($entry) 
+	{
+		if($this->config['thumbnail_dir'] == false
+			|| strlen(trim($this->config['thumbnail_dir'])) == 0)
+			Return false;		
+		else
+			Return ($entry == $this->config['thumbnail_dir']);
+	}
+
+	/**
+	 * Check if the given file is a tmp file.
+	 * @param string $file file name
+	 * @return boolean true if it is a tmp file, false otherwise
+	 */
+	function isTmpFile($file) 
+	{
+		$len = strlen($this->config['tmp_prefix']);
+		if(substr($file,0,$len)==$this->config['tmp_prefix'])
+			Return true;
+		else
+			Return false;	 	
+	}
+
+	/**
+	 * For a given image file, get the respective thumbnail filename
+	 * no file existence check is done.
+	 * @param string $fullpathfile the full path to the image file
+	 * @return string of the thumbnail file
+	 */
+	function getThumbName($fullpathfile) 
+	{
+		$path_parts = pathinfo($fullpathfile);
+		
+		$thumbnail = $this->config['thumbnail_prefix'].$path_parts['basename'];
+
+		if($this->config['safe_mode'] == true
+			|| strlen(trim($this->config['thumbnail_dir'])) == 0)
+		{
+			Return Files::makeFile($path_parts['dirname'],$thumbnail);
+		}
+		else
+		{
+			if(strlen(trim($this->config['thumbnail_dir'])) > 0)
+			{
+				$path = Files::makePath($path_parts['dirname'],$this->config['thumbnail_dir']);
+				if(!is_dir($path))
+					Files::createFolder($path);
+				Return Files::makeFile($path,$thumbnail);
+			}
+			else //should this ever happen?
+			{
+				//error_log('ExtendedFileManager: Error in creating thumbnail name');
+			}
+		}
+	}
+	
+	/**
+	 * Similar to getThumbName, but returns the URL, base on the
+	 * given base_url in config.inc.php
+	 * @param string $relative the relative image file name, 
+	 * relative to the base_dir path
+	 * @return string the url of the thumbnail
+	 */
+	function getThumbURL($relative) 
+	{
+		$path_parts = pathinfo($relative);
+		$thumbnail = $this->config['thumbnail_prefix'].$path_parts['basename'];
+		if($path_parts['dirname']=='\\') $path_parts['dirname']='/';
+
+		if($this->config['safe_mode'] == true
+			|| strlen(trim($this->config['thumbnail_dir'])) == 0)
+		{
+			Return Files::makeFile($this->getImagesURL(),$thumbnail);
+		}
+		else
+		{
+			if(strlen(trim($this->config['thumbnail_dir'])) > 0)
+			{
+				$path = Files::makePath($path_parts['dirname'],$this->config['thumbnail_dir']);
+				$url_path = Files::makePath($this->getImagesURL(), $path);
+				Return Files::makeFile($url_path,$thumbnail);
+			}
+			else //should this ever happen?
+			{
+				//error_log('ExtendedFileManager: Error in creating thumbnail url');
+			}
+
+		}
+	}
+
+   /**
+    * For a given image file, get the respective resized filename
+    * no file existence check is done.
+    * @param string $fullpathfile the full path to the image file
+    * @param integer $width the intended width
+    * @param integer $height the intended height
+    * @param boolean $mkDir whether to attempt to make the resized_dir if it doesn't exist
+    * @return string of the resized filename
+    */
+	function getResizedName($fullpathfile, $width, $height, $mkDir = TRUE)
+	{
+		$path_parts = pathinfo($fullpathfile);
+
+		$thumbnail = $this->config['resized_prefix']."_{$width}x{$height}_{$path_parts['basename']}";
+
+		if( strlen(trim($this->config['resized_dir'])) == 0 || $this->config['safe_mode'] == true )
+		{
+			Return Files::makeFile($path_parts['dirname'],$thumbnail);
+		}
+		else
+		{
+      $path = Files::makePath($path_parts['dirname'],$this->config['resized_dir']);
+      if($mkDir && !is_dir($path))
+        Files::createFolder($path);
+      Return Files::makeFile($path,$thumbnail);
+		}
+	}
+
+	/**
+	 * Check if the given path is part of the subdirectories
+	 * under the base_dir.
+	 * @param string $path the relative path to be checked
+	 * @return boolean true if the path exists, false otherwise
+	 */
+	function validRelativePath($path) 
+	{
+		$dirs = $this->getDirs();
+		if($path == '/')
+			Return true;
+		//check the path given in the url against the 
+		//list of paths in the system.
+		for($i = 0; $i < count($dirs); $i++)
+		{
+			$key = key($dirs);
+			//we found the path
+			if($key == $path)
+				Return true;
+		
+			next($dirs);
+		}		
+		Return false;
+	}
+
+	/**
+	 * Process uploaded files, assumes the file is in 
+	 * $_FILES['upload'] and $_POST['dir'] is set.
+	 * The dir must be relative to the base_dir and exists.
+	 * @return null
+	 */
+	function processUploads() 
+	{
+		if($this->isValidBase() == false)
+			return;
+
+		$relative = null;
+
+		if(isset($_POST['dir'])) 
+			$relative = rawurldecode($_POST['dir']);
+		else
+			return;
+
+		//check for the file, and must have valid relative path
+		if(isset($_FILES['upload']) && $this->validRelativePath($relative))
+		{
+			Return $this->_processFiles($relative, $_FILES['upload']);
+		}
+	}
+
+	/**
+	 * Process upload files. The file must be an 
+	 * uploaded file. Any duplicate
+	 * file will be renamed. See Files::copyFile for details
+	 * on renaming.
+	 * @param string $relative the relative path where the file
+	 * should be copied to.
+	 * @param array $file the uploaded file from $_FILES
+	 * @return boolean true if the file was processed successfully, 
+	 * false otherwise
+	 */
+	function _processFiles($relative, $file)
+	{
+		
+		if($file['error']!=0)
+		{
+			Return false;
+		}
+
+		if(!is_file($file['tmp_name']))
+		{
+			Return false;
+		}
+
+		if(!is_uploaded_file($file['tmp_name']))
+		{
+			Files::delFile($file['tmp_name']);
+			Return false;
+		}
+
+        $valid_extensions = $this->mode == 'image' ? $this->config['allowed_image_extensions'] : $this->config['allowed_link_extensions'];
+        $max_size = $this->mode == 'image' ? $this->config['max_filesize_kb_image'] : $this->config['max_filesize_kb_link'];
+		$afruext = strtolower(substr(strrchr($file['name'], "."), 1));
+
+		if(!in_array($afruext, $valid_extensions))
+		{
+			Files::delFile($file['tmp_name']);
+			Return 'Cannot upload $extension='.$afruext.'$ Files. Permission denied.';
+		}
+
+		if($file['size']>($max_size*1024))
+		{
+			Files::delFile($file['tmp_name']);
+			Return 'Unble to upload file. Maximum file size [$max_size='.$max_size.'$ KB] exceeded.';
+		}
+
+		if(!empty($this->config['max_foldersize_mb']) &&  (Files::dirSize($this->getImagesDir()))+$file['size']> ($this->config['max_foldersize_mb']*1048576))
+		{
+			Files::delFile($file['tmp_name']);
+			Return ("Cannot upload. Maximum folder size reached. Delete unwanted files and try again.");
+		}
+
+		//now copy the file
+		$path = Files::makePath($this->getImagesDir(),$relative);
+		$result = Files::copyFile($file['tmp_name'], $path, $file['name']);
+
+		//no copy error
+		if(!is_int($result))
+		{
+			Files::delFile($file['tmp_name']);
+			Return 'File "$file='.$file['name'].'$" successfully uploaded.';
+		}
+
+		//delete tmp files.
+		Files::delFile($file['tmp_name']);
+		Return false;
+
+	}
+
+
+	function getDiskInfo()
+	{
+        if (empty($this->config['max_foldersize_mb']))
+            return '';
+            
+		$tmpFreeSize=($this->config['max_foldersize_mb']*1048576)-Files::dirSize($this->getImagesDir());
+
+		if(!is_numeric($tmpFreeSize) || $tmpFreeSize<0)	$tmpFreeSize=0;
+        
+		Return 'Total Size : $max_foldersize_mb='.$this->config['max_foldersize_mb'].'$ MB, Free Space: $free_space='.Files::formatSize($tmpFreeSize).'$';
+	}
+
+
+
+	/**
+	 * Get the URL of the relative file.
+	 * basically appends the relative file to the 
+	 * base_url given in config.inc.php
+	 * @param string $relative a file the relative to the base_dir
+	 * @return string the URL of the relative file.
+	 */
+	function getFileURL($relative) 
+	{
+		Return Files::makeFile($this->getImagesURL(),$relative);
+	}
+
+	/**
+	 * Get the fullpath to a relative file.
+	 * @param string $relative the relative file.
+	 * @return string the full path, .ie. the base_dir + relative.
+	 */
+	function getFullPath($relative) 
+	{
+		Return Files::makeFile($this->getImagesDir(),$relative);;
+	}
+
+	/**
+	 * Get the default thumbnail.
+	 * @return string default thumbnail, empty string if 
+	 * the thumbnail doesn't exist.
+	 */
+	function getDefaultThumb() 
+	{
+		if(is_file($this->config['default_thumbnail']))
+			Return $this->config['default_thumbnail'];
+		else 
+			Return '';
+	}
+
+
+	/**
+	 * Checks image size. If the image size is less than default size
+	 * returns the original size else returns default size to display thumbnail
+	*/
+	function checkImageSize($relative)
+	{
+		$fullpath = Files::makeFile($this->getImagesDir(),$relative);
+
+		$afruext = strtolower(substr(strrchr($relative, "."), 1));
+		
+		if(!in_array($afruext,$this->config['thumbnail_extensions']))
+		{
+			$imgInfo=array(0,0);
+			Return $imgInfo;
+		}
+		else
+		{
+			$imgInfo = @getImageSize($fullpath);
+			//not an image
+			if(!is_array($imgInfo))
+			{
+				$imgInfo=array(0,0);
+				Return $imgInfo;
+			}
+			else
+			{
+				if($imgInfo[0] > $this->config['thumbnail_width'])
+				$imgInfo[0] = $this->config['thumbnail_width'];
+
+				if($imgInfo[1] > $this->config['thumbnail_height'])
+				$imgInfo[1] = $this->config['thumbnail_height'];
+
+				Return $imgInfo;
+			}
+		}
+
+	}
+
+
+	/**
+	 * Get the thumbnail url to be displayed. 
+	 * If the thumbnail exists, and it is up-to-date
+	 * the thumbnail url will be returns. If the 
+	 * file is not an image, a default image will be returned.
+	 * If it is an image file, and no thumbnail exists or 
+	 * the thumbnail is out-of-date (i.e. the thumbnail 
+	 * modified time is less than the original file)
+	 * then a thumbs.php?img=filename.jpg is returned.
+	 * The thumbs.php url will generate a new thumbnail
+	 * on the fly. If the image is less than the dimensions
+	 * of the thumbnails, the image will be display instead.
+	 * @param string $relative the relative image file.
+	 * @return string the url of the thumbnail, be it
+	 * actually thumbnail or a script to generate the
+	 * thumbnail on the fly.
+	 */
+	function getThumbnail($relative) 
+	{
+		global $IMConfig;
+		
+		$fullpath = Files::makeFile($this->getImagesDir(),$relative);
+
+		//not a file???
+		if(!is_file($fullpath))
+			Return $this->getDefaultThumb();
+
+		$afruext = strtolower(substr(strrchr($relative, "."), 1));
+		
+		if(!in_array($afruext,$this->config['thumbnail_extensions']))
+		{
+			if(is_file('icons/'.$afruext.'.gif')) 
+				Return('icons/'.$afruext.'.gif');
+			else
+				Return $this->getDefaultThumb();
+		}
+
+		$imgInfo = @getImageSize($fullpath);
+
+		//not an image
+		if(!is_array($imgInfo))
+			Return $this->getDefaultThumb();
+
+
+		//Returning original image as thumbnail without Image Library by Afru
+		if(!$this->config['img_library']) Return $this->getFileURL($relative);
+
+
+		//the original image is smaller than thumbnails,
+		//so just return the url to the original image.
+		if ($imgInfo[0] <= $this->config['thumbnail_width']
+		 && $imgInfo[1] <= $this->config['thumbnail_height'])
+			Return $this->getFileURL($relative);
+
+		$thumbnail = $this->getThumbName($fullpath);
+		
+		//check for thumbnails, if exists and
+		// it is up-to-date, return the thumbnail url
+		if(is_file($thumbnail))
+		{
+			if(filemtime($thumbnail) >= filemtime($fullpath))
+				Return $this->getThumbURL($relative);
+		}
+
+		//well, no thumbnail was found, so ask the thumbs.php
+		//to generate the thumbnail on the fly.
+		Return $IMConfig['backend_url'] . '__function=thumbs&img='.rawurlencode($relative)."&mode=$this->mode";
+	}
+
+	/**
+	 * Delete and specified files.
+	 * @return boolean true if delete, false otherwise
+	 */
+	function deleteFiles() 
+	{
+		if(isset($_GET['delf']))
+			return $this->_delFile(rawurldecode($_GET['delf']));
+        return false;
+	}
+
+	/**
+	 * Delete and specified directories.
+	 * @return boolean true if delete, false otherwise
+	 */
+	function deleteDirs() 
+	{
+		 if(isset($_GET['deld']))
+			return $this->_delDir(rawurldecode($_GET['deld']));		
+		 else
+			 Return false;
+	}
+
+	/**
+	 * Delete the relative file, and any thumbnails.
+	 * @param string $relative the relative file.
+	 * @return boolean true if deleted, false otherwise.
+	 */
+	function _delFile($relative) 
+	{
+		$fullpath = Files::makeFile($this->getImagesDir(),$relative);
+	
+		$afruext = strtolower(substr(strrchr($relative, "."), 1));
+
+        $valid_extensions = $this->mode == 'image' ? $this->config['allowed_image_extensions'] : $this->config['allowed_link_extensions'];
+
+		if(!in_array($afruext,$valid_extensions))
+		{
+			return false;
+		}
+
+		//check that the file is an image
+		if(is_array($this->getImageInfo($fullpath)))
+		{
+			$thumbnail = $this->getThumbName($fullpath);
+			Files::delFile($thumbnail);
+		}
+
+		Return Files::delFile($fullpath);
+	}
+
+	/**
+	 * Delete directories recursively.
+	 * @param string $relative the relative path to be deleted.
+	 * @return boolean true if deleted, false otherwise.
+	 */
+	function _delDir($relative) 
+	{
+		$fullpath = Files::makePath($this->getImagesDir(),$relative);
+	//	if($this->countFiles($fullpath) <= 0)
+			return Files::delFolder($fullpath,true); //delete recursively.
+		//else
+			//Return false;
+	}
+
+	/**
+	 * Create new directories.
+	 * If in safe_mode, nothing happens.
+	 * @return boolean true if created, false otherwise.
+	 */
+	function processNewDir() 
+	{
+		if($this->config['safe_mode'] == true)
+			Return false;
+
+		if(isset($_GET['newDir']) && isset($_GET['dir']))
+		{
+			$newDir = rawurldecode($_GET['newDir']);
+			$dir = rawurldecode($_GET['dir']);
+			$path = Files::makePath($this->getImagesDir(),$dir);
+			$fullpath = Files::makePath($path, Files::escape($newDir));
+			if(is_dir($fullpath))
+				Return false;
+
+			Return Files::createFolder($fullpath);
+		}
+	}
+
+	/**
+	 * Renames files if certain GET variables are set
+	 * @return bool
+	 */
+	function processRenames()
+	{
+		if(!empty($_GET['rename']) && !empty($_GET['renameTo']))
+		{
+			// new file name (without path and extension)
+			$newName = Files::escape(rawurldecode($_GET['renameTo']));
+			$newName = str_replace('.', '', $newName);
+
+			// path to file (from base images directory)
+			$oldName = rawurldecode($_GET['rename']);
+
+			// strip parent dir ("..") to avoid escaping from base directiory
+			$oldName = preg_replace('#\.\.#', '', $oldName);
+
+			if (is_dir($oldPath = Files::makeFile($this->getImagesDir(), $_GET['dir'].$oldName)))
+			{
+				$newPath = Files::makeFile($this->getImagesDir(), $_GET['dir'].$newName);
+				return Files::rename($oldPath,$newPath);
+			}
+			else 
+			{
+				// path to old file
+				$oldPath = Files::makeFile($this->getImagesDir(), $oldName);
+	
+				$ret = Files::renameFile($oldPath, $newName);
+				if ($ret === true) {
+					// delete old thumbnail
+					Files::delFile($this->getThumbname($oldPath));
+				}
+			}
+			return $ret;
+		}
+		
+		return null;
+	}
+
+	function processPaste()
+	{
+		switch ($_GET['paste'])
+		{
+			case 'copyFile':
+				$src = Files::makeFile($this->getImagesDir(), $_GET['srcdir'].$_GET['file']);
+				$file = $_GET['file'];
+				$dest = Files::makeFile($this->getImagesDir(), $_GET['dir']);
+				return  Files::copyFile($src,$dest,$file);
+			break;
+			case 'copyDir':
+				$basePath = $this->getImagesDir();
+				$src = $_GET['srcdir'].$_GET['file'];
+				$dest = $_GET['dir'].$_GET['file'];
+				return Files::copyDir($basePath,$src,$dest);
+			break;
+			case 'moveFile':
+				$src = Files::makePath($this->getImagesDir(), $_GET['srcdir'].$_GET['file']);
+				$dest = Files::makePath($this->getImagesDir(), $_GET['dir'].$_GET['file']);
+				return Files::rename($src,$dest);
+			break;
+			case 'moveDir':
+				$src = Files::makeFile($this->getImagesDir(), $_GET['srcdir'].$_GET['file']);
+				$dest = Files::makeFile($this->getImagesDir(), $_GET['dir'].$_GET['file']);
+				return Files::rename($src,$dest);
+			break;
+		}
+	}
+}
+
+?>

Added: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/xinha/plugins/ExtendedFileManager/Readme.txt
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/xinha/plugins/ExtendedFileManager/Readme.txt?view=auto&rev=558490
==============================================================================
--- cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/xinha/plugins/ExtendedFileManager/Readme.txt (added)
+++ cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/xinha/plugins/ExtendedFileManager/Readme.txt Sun Jul 22 07:50:10 2007
@@ -0,0 +1,111 @@
+Package : Extended File Manager EFM 1.1.1
+
+Version 1.1 created from 1.0 beta by Krzysztof Kotowicz <koto@webworkers.pl>
+
+Overview :
+----------
+
+Extended File Manager is an advanced plugin for Xinha 
+
+It works in two different modes.
+1). Insert Image Mode and 
+2). Insert File Link Mode.
+
+In Insert Image Mode, it replaces the basic insert image functionality of Xinha with its advanced image manager.
+
+If Insert File Link Mode is enabled, a new icon will be added to the toolbar with advanced file linking capability.
+
+
+
+Complete Features :
+-------------------
+* Easy config.inc file that enables individual options for both modes.
+* Thumnail View 
+* List View 
+* Nice icons for both views 
+* Create Folders 
+* Vertical Scrolling 
+* Allowed extensions to view or upload.
+* File Uploads 
+* Max File upload limit 
+* Max Upload Folder size (Including all subfolders and files. A must see option.)
+* Dynamic display of available free space in the Upload Folder 
+* Dynamic Thumbnails using Image libraries or browser resize 
+* Image Editor (Actually done by Wei...a great addon) 
+* Can be used to insert images along with properties. 
+* Can be used to insert link to non-image files like pdf or zip.
+* You can specify image margin / padding / background and border colors
+* You may edit Alt/title tags for inserted images
+
+(Most of the features can be enabled/disabled as needed)
+
+Installation :
+--------------
+
+Installing involves extracting the archive to 'plugins' subdirectory of Xinha
+and selecting the plugin in appropriate xinha_plugins list.
+
+Plugin may be configured via xinha_config.ExtendedFileManager object.
+Look into ImageManager plugin documentation as this plugin uses almost identical
+settings. All available options can be found in the file config.inc.php.
+
+// only snippets of code from initializing file shown below
+
+
+  xinha_plugins = xinha_plugins ? xinha_plugins :
+  [
+   'ContextMenu',
+   'SuperClean',
+   'CharacterMap',
+   'GetHtml',
+   'ExtendedFileManager',
+   /*'ImageManager',*/  // replace image manager with EFM
+   'Linker'
+  ];
+
+...
+
+//If you don't want to add a button for linking files and use only the advanced ImageManager
+xinha_config.ExtendedFileManager.use_linker = false;
+// pass the configuration to plugin
+if (xinha_config.ExtendedFileManager) {
+   	    with (xinha_config.ExtendedFileManager)
+        {
+            <?php
+
+            // define backend configuration for the plugin
+            $IMConfig = array();
+            $IMConfig['images_dir'] = '<images dir>';
+            $IMConfig['images_url'] = '<images url>';
+            $IMConfig['files_dir'] = '<files dir>';
+            $IMConfig['files_url'] = '<files url>';
+            $IMConfig['thumbnail_prefix'] = 't_';
+            $IMConfig['thumbnail_dir'] = 't';
+            $IMConfig['resized_prefix'] = 'resized_';
+            $IMConfig['resized_dir'] = '';
+            $IMConfig['tmp_prefix'] = '_tmp';
+            $IMConfig['max_filesize_kb_image'] = 2000;
+            // maximum size for uploading files in 'insert image' mode (2000 kB here)
+
+            $IMConfig['max_filesize_kb_link'] = 5000;
+            // maximum size for uploading files in 'insert link' mode (5000 kB here)
+
+            // Maximum upload folder size in Megabytes.
+            // Use 0 to disable limit
+            $IMConfig['max_foldersize_mb'] = 0;
+            
+            $IMConfig['allowed_image_extensions'] = array("jpg","gif","png");
+            $IMConfig['allowed_link_extensions'] = array("jpg","gif","pdf","ip","txt",
+                                                         "psd","png","html","swf",
+                                                         "xml","xls");
+
+            require_once '/path/to/xinha/contrib/php-xinha.php';
+            xinha_pass_to_php_backend($IMConfig);
+            
+            ?>
+        }
+}
+
+=====
+afrusoft@gmail.com - author of EFM 1.0 beta
+koto@webworkers.pl - EFM 1.1 (most of the code taken from Xinha codebase)
\ No newline at end of file

Propchange: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/xinha/plugins/ExtendedFileManager/Readme.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/xinha/plugins/ExtendedFileManager/assets/EditorContent.js
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/xinha/plugins/ExtendedFileManager/assets/EditorContent.js?view=auto&rev=558490
==============================================================================
--- cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/xinha/plugins/ExtendedFileManager/assets/EditorContent.js (added)
+++ cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/xinha/plugins/ExtendedFileManager/assets/EditorContent.js Sun Jul 22 07:50:10 2007
@@ -0,0 +1,657 @@
+function MM_findObj(n,d){
+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;
+}
+var pic_x,pic_y;
+function P7_Snap(){
+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;
+if(event==null){
+x=document.body.scrollLeft+bx;
+}else{
+x=document.body.scrollLeft+event.clientX+bx;
+}
+if(event==null){
+y=document.body.scrollTop;
+}else{
+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;
+}
+pic_x=parseInt(xx);
+pic_y=parseInt(yy);
+}
+}
+}
+var ie=document.all;
+var ns6=document.getElementById&&!document.all;
+var dragapproved=false;
+var z,x,y,status,ant,canvas,content,pic_width,pic_height,image,resizeHandle,oa_w,oa_h,oa_x,oa_y,mx2,my2;
+function init_resize(){
+if(mode=="scale"){
+P7_Snap("theImage","ant",0,0);
+if(canvas==null){
+canvas=MM_findObj("imgCanvas");
+}
+if(pic_width==null||pic_height==null){
+image=MM_findObj("theImage");
+pic_width=image.width;
+pic_height=image.height;
+}
+if(ant==null){
+ant=MM_findObj("ant");
+}
+ant.style.left=pic_x;
+ant.style.top=pic_y;
+ant.style.width=pic_width;
+ant.style.height=pic_height;
+ant.style.visibility="visible";
+drawBoundHandle();
+jg_doc.paint();
+}
+}
+initEditor=function(){
+init_crop();
+init_resize();
+var _a=MM_findObj("markerImg",window.top.document);
+if(_a.src.indexOf("img/t_white.gif")>0){
+toggleMarker();
+}
+};
+function init_crop(){
+P7_Snap("theImage","ant",0,0);
+}
+function setMode(_b){
+mode=_b;
+reset();
+}
+function reset(){
+if(ant==null){
+ant=MM_findObj("ant");
+}
+ant.style.visibility="hidden";
+ant.style.left=0;
+ant.style.top=0;
+ant.style.width=0;
+ant.style.height=0;
+mx2=null;
+my2=null;
+jg_doc.clear();
+if(mode!="measure"){
+showStatus();
+}
+if(mode=="scale"){
+init_resize();
+}
+P7_Snap("theImage","ant",0,0);
+}
+function toggleMarker(){
+if(ant==null){
+ant=MM_findObj("ant");
+}
+if(ant.className=="selection"){
+ant.className="selectionWhite";
+}else{
+ant.className="selection";
+}
+if(jg_doc.getColor()=="#000000"){
+jg_doc.setColor("#FFFFFF");
+}else{
+jg_doc.setColor("#000000");
+}
+drawBoundHandle;
+jg_doc.paint();
+}
+function move(e){
+if(dragapproved){
+var w=ns6?temp1+e.clientX-x:temp1+event.clientX-x;
+var h=ns6?temp2+e.clientY-y:temp2+event.clientY-y;
+if(ant!=null){
+if(w>=0){
+ant.style.left=x;
+ant.style.width=w;
+}else{
+ant.style.left=x+w;
+ant.style.width=-1*w;
+}
+if(h>=0){
+ant.style.top=y;
+ant.style.height=h;
+}else{
+ant.style.top=y+h;
+ant.style.height=-1*h;
+}
+}
+showStatus();
+return false;
+}
+}
+function moveContent(e){
+if(dragapproved){
+var dx=ns6?oa_x+e.clientX-x:oa_x+event.clientX-x;
+var dy=ns6?oa_y+e.clientY-y:oa_y+event.clientY-y;
+ant.style.left=dx;
+ant.style.top=dy;
+showStatus();
+return false;
+}
+}
+function moveHandle(e){
+if(dragapproved){
+var w=ns6?e.clientX-x:event.clientX-x;
+var h=ns6?e.clientY-y:event.clientY-y;
+var _15=MM_findObj("constProp",window.top.document);
+var _16=document.theImage.height;
+var _17=document.theImage.width;
+rapp=_17/_16;
+rapp_inv=_16/_17;
+switch(resizeHandle){
+case "s-resize":
+if(oa_h+h>=0){
+ant.style.height=oa_h+h;
+if(_15.checked){
+ant.style.width=rapp*(oa_h+h);
+ant.style.left=oa_x-rapp*h/2;
+}
+}
+break;
+case "e-resize":
+if(oa_w+w>=0){
+ant.style.width=oa_w+w;
+if(_15.checked){
+ant.style.height=rapp_inv*(oa_w+w);
+ant.style.top=oa_y-rapp_inv*w/2;
+}
+}
+break;
+case "n-resize":
+if(oa_h-h>=0){
+ant.style.top=oa_y+h;
+ant.style.height=oa_h-h;
+if(_15.checked){
+ant.style.width=rapp*(oa_h-h);
+ant.style.left=oa_x+rapp*h/2;
+}
+}
+break;
+case "w-resize":
+if(oa_w-w>=0){
+ant.style.left=oa_x+w;
+ant.style.width=oa_w-w;
+if(_15.checked){
+ant.style.height=rapp_inv*(oa_w-w);
+ant.style.top=oa_y+rapp_inv*w/2;
+}
+}
+break;
+case "nw-resize":
+if(oa_h-h>=0&&oa_w-w>=0){
+ant.style.left=oa_x+w;
+ant.style.width=oa_w-w;
+ant.style.top=oa_y+h;
+if(_15.checked){
+ant.style.height=rapp_inv*(oa_w-w);
+}else{
+ant.style.height=oa_h-h;
+}
+}
+break;
+case "ne-resize":
+if(oa_h-h>=0&&oa_w+w>=0){
+ant.style.top=oa_y+h;
+ant.style.width=oa_w+w;
+if(_15.checked){
+ant.style.height=rapp_inv*(oa_w+w);
+}else{
+ant.style.height=oa_h-h;
+}
+}
+break;
+case "se-resize":
+if(oa_h+h>=0&&oa_w+w>=0){
+ant.style.width=oa_w+w;
+if(_15.checked){
+ant.style.height=rapp_inv*(oa_w+w);
+}else{
+ant.style.height=oa_h+h;
+}
+}
+break;
+case "sw-resize":
+if(oa_h+h>=0&&oa_w-w>=0){
+ant.style.left=oa_x+w;
+ant.style.width=oa_w-w;
+if(_15.checked){
+ant.style.height=rapp_inv*(oa_w-w);
+}else{
+ant.style.height=oa_h+h;
+}
+}
+}
+showStatus();
+return false;
+}
+}
+function drags(e){
+if(!ie&&!ns6){
+return;
+}
+var _19=ns6?e.target:event.srcElement;
+var _1a=ns6?"HTML":"BODY";
+while(_19.tagName!=_1a&&!(_19.className=="crop"||_19.className=="handleBox"||_19.className=="selection"||_19.className=="selectionWhite")){
+_19=ns6?_19.parentNode:_19.parentElement;
+}
+if(_19.className=="handleBox"){
+if(content!=null){
+if(content.width!=null&&content.height!=null){
+content.width=0;
+content.height=0;
+}
+}
+resizeHandle=_19.id;
+x=ns6?e.clientX:event.clientX;
+y=ns6?e.clientY:event.clientY;
+oa_w=parseInt(ant.style.width);
+oa_h=parseInt(ant.style.height);
+oa_x=parseInt(ant.style.left);
+oa_y=parseInt(ant.style.top);
+dragapproved=true;
+document.onmousemove=moveHandle;
+return false;
+}else{
+if((_19.className=="selection"||_19.className=="selectionWhite")&&mode=="crop"){
+x=ns6?e.clientX:event.clientX;
+y=ns6?e.clientY:event.clientY;
+oa_x=parseInt(ant.style.left);
+oa_y=parseInt(ant.style.top);
+dragapproved=true;
+document.onmousemove=moveContent;
+return false;
+}else{
+if(_19.className=="crop"&&mode=="crop"){
+if(content!=null){
+if(content.width!=null&&content.height!=null){
+content.width=0;
+content.height=0;
+}
+}
+if(status==null){
+status=MM_findObj("status");
+}
+if(ant==null){
+ant=MM_findObj("ant");
+}
+if(canvas==null){
+canvas=MM_findObj("imgCanvas");
+}
+if(content==null){
+content=MM_findObj("cropContent");
+}
+if(pic_width==null||pic_height==null){
+image=MM_findObj("theImage");
+pic_width=image.width;
+pic_height=image.height;
+}
+ant.style.visibility="visible";
+obj=_19;
+dragapproved=true;
+z=_19;
+temp1=parseInt(z.style.left+0);
+temp2=parseInt(z.style.top+0);
+x=ns6?e.clientX:event.clientX;
+y=ns6?e.clientY:event.clientY;
+document.onmousemove=move;
+return false;
+}else{
+if(_19.className=="crop"&&mode=="measure"){
+if(ant==null){
+ant=MM_findObj("ant");
+}
+if(canvas==null){
+canvas=MM_findObj("imgCanvas");
+}
+x=ns6?e.clientX:event.clientX;
+y=ns6?e.clientY:event.clientY;
+dragapproved=true;
+document.onmousemove=measure;
+return false;
+}
+}
+}
+}
+}
+function measure(e){
+if(dragapproved){
+mx2=ns6?e.clientX:event.clientX;
+my2=ns6?e.clientY:event.clientY;
+jg_doc.clear();
+jg_doc.setStroke(Stroke.DOTTED);
+jg_doc.drawLine(x,y,mx2,my2);
+jg_doc.paint();
+showStatus();
+return false;
+}
+}
+function setMarker(nx,ny,nw,nh){
+if(isNaN(nx)){
+nx=0;
+}
+if(isNaN(ny)){
+ny=0;
+}
+if(isNaN(nw)){
+nw=0;
+}
+if(isNaN(nh)){
+nh=0;
+}
+if(ant==null){
+ant=MM_findObj("ant");
+}
+if(canvas==null){
+canvas=MM_findObj("imgCanvas");
+}
+if(content==null){
+content=MM_findObj("cropContent");
+}
+if(pic_width==null||pic_height==null){
+image=MM_findObj("theImage");
+pic_width=image.width;
+pic_height=image.height;
+}
+ant.style.visibility="visible";
+nx=pic_x+nx;
+ny=pic_y+ny;
+if(nw>=0){
+ant.style.left=nx;
+ant.style.width=nw;
+}else{
+ant.style.left=nx+nw;
+ant.style.width=-1*nw;
+}
+if(nh>=0){
+ant.style.top=ny;
+ant.style.height=nh;
+}else{
+ant.style.top=ny+nh;
+ant.style.height=-1*nh;
+}
+}
+function max(x,y){
+if(y>x){
+return x;
+}else{
+return y;
+}
+}
+function drawBoundHandle(){
+if(ant==null||ant.style==null){
+return false;
+}
+var ah=parseInt(ant.style.height);
+var aw=parseInt(ant.style.width);
+var ax=parseInt(ant.style.left);
+var ay=parseInt(ant.style.top);
+jg_doc.drawHandle(ax-15,ay-15,30,30,"nw-resize");
+jg_doc.drawHandle(ax-15,ay+ah-15,30,30,"sw-resize");
+jg_doc.drawHandle(ax+aw-15,ay-15,30,30,"ne-resize");
+jg_doc.drawHandle(ax+aw-15,ay+ah-15,30,30,"se-resize");
+jg_doc.drawHandle(ax+max(15,aw/10),ay-8,aw-2*max(15,aw/10),8,"n-resize");
+jg_doc.drawHandle(ax+max(15,aw/10),ay+ah,aw-2*max(15,aw/10),8,"s-resize");
+jg_doc.drawHandle(ax-8,ay+max(15,ah/10),8,ah-2*max(15,ah/10),"w-resize");
+jg_doc.drawHandle(ax+aw,ay+max(15,ah/10),8,ah-2*max(15,ah/10),"e-resize");
+jg_doc.drawHandleBox(ax-4,ay-4,8,8,"nw-resize");
+jg_doc.drawHandleBox(ax-4,ay+ah-4,8,8,"sw-resize");
+jg_doc.drawHandleBox(ax+aw-4,ay-4,8,8,"ne-resize");
+jg_doc.drawHandleBox(ax+aw-4,ay+ah-4,8,8,"se-resize");
+jg_doc.drawHandleBox(ax+aw/2-4,ay-4,8,8,"n-resize");
+jg_doc.drawHandleBox(ax+aw/2-4,ay+ah-4,8,8,"s-resize");
+jg_doc.drawHandleBox(ax-4,ay+ah/2-4,8,8,"w-resize");
+jg_doc.drawHandleBox(ax+aw-4,ay+ah/2-4,8,8,"e-resize");
+}
+function showStatus(){
+if(ant==null||ant.style==null){
+return false;
+}
+if(mode=="measure"){
+mx1=x-pic_x;
+my1=y-pic_y;
+mw=mx2-x;
+mh=my2-y;
+md=parseInt(Math.sqrt(mw*mw+mh*mh)*100)/100;
+ma=(Math.atan(-1*mh/mw)/Math.PI)*180;
+if(mw<0&&mh<0){
+ma=ma+180;
+}
+if(mw<0&&mh>0){
+ma=ma-180;
+}
+ma=parseInt(ma*100)/100;
+if(m_sx!=null&&!isNaN(mx1)){
+m_sx.value=mx1+"px";
+}
+if(m_sy!=null&&!isNaN(my1)){
+m_sy.value=my1+"px";
+}
+if(m_w!=null&&!isNaN(mw)){
+m_w.value=mw+"px";
+}
+if(m_h!=null&&!isNaN(mh)){
+m_h.value=mh+"px";
+}
+if(m_d!=null&&!isNaN(md)){
+m_d.value=md+"px";
+}
+if(m_a!=null&&!isNaN(ma)){
+m_a.value=ma+"";
+}
+if(r_ra!=null&&!isNaN(ma)){
+r_ra.value=ma;
+}
+return false;
+}
+var ah=parseInt(ant.style.height);
+var aw=parseInt(ant.style.width);
+var ax=parseInt(ant.style.left);
+var ay=parseInt(ant.style.top);
+var cx=ax-pic_x<0?0:ax-pic_x;
+var cy=ay-pic_y<0?0:ay-pic_y;
+cx=cx>pic_width?pic_width:cx;
+cy=cy>pic_height?pic_height:cy;
+var cw=ax-pic_x>0?aw:aw-(pic_x-ax);
+var ch=ay-pic_y>0?ah:ah-(pic_y-ay);
+ch=ay+ah<pic_y+pic_height?ch:ch-(ay+ah-pic_y-pic_height);
+cw=ax+aw<pic_x+pic_width?cw:cw-(ax+aw-pic_x-pic_width);
+ch=ch<0?0:ch;
+cw=cw<0?0:cw;
+if(ant.style.visibility=="hidden"){
+cx="";
+cy="";
+cw="";
+ch="";
+}
+if(mode=="crop"){
+if(t_cx!=null){
+t_cx.value=cx;
+}
+if(t_cy!=null){
+t_cy.value=cy;
+}
+if(t_cw!=null){
+t_cw.value=cw;
+}
+if(t_ch!=null){
+t_ch.value=ch;
+}
+}else{
+if(mode=="scale"){
+var sw=aw,sh=ah;
+if(s_sw.value.indexOf("%")>0&&s_sh.value.indexOf("%")>0){
+sw=cw/pic_width;
+sh=ch/pic_height;
+}
+if(s_sw!=null){
+s_sw.value=sw;
+}
+if(s_sh!=null){
+s_sh.value=sh;
+}
+}
+}
+}
+function dragStopped(){
+dragapproved=false;
+if(ant==null||ant.style==null){
+return false;
+}
+if(mode=="measure"){
+jg_doc.drawLine(x-4,y,x+4,y);
+jg_doc.drawLine(x,y-4,x,y+4);
+jg_doc.drawLine(mx2-4,my2,mx2+4,my2);
+jg_doc.drawLine(mx2,my2-4,mx2,my2+4);
+jg_doc.paint();
+showStatus();
+return false;
+}
+var ah=parseInt(ant.style.height);
+var aw=parseInt(ant.style.width);
+var ax=parseInt(ant.style.left);
+var ay=parseInt(ant.style.top);
+jg_doc.clear();
+if(content!=null){
+if(content.width!=null&&content.height!=null){
+content.width=aw-1;
+content.height=ah-1;
+}
+}
+if(mode=="crop"){
+jg_doc.fillRectPattern(pic_x,pic_y,pic_width,ay-pic_y,pattern);
+var h1=ah;
+var y1=ay;
+if(ah+ay>=pic_height+pic_y){
+h1=pic_height+pic_y-ay;
+}else{
+if(ay<=pic_y){
+h1=ay+ah-pic_y;
+y1=pic_y;
+}
+}
+jg_doc.fillRectPattern(pic_x,y1,ax-pic_x,h1,pattern);
+jg_doc.fillRectPattern(ax+aw,y1,pic_x+pic_width-ax-aw,h1,pattern);
+jg_doc.fillRectPattern(pic_x,ay+ah,pic_width,pic_height+pic_y-ay-ah,pattern);
+}else{
+if(mode=="scale"){
+document.theImage.height=ah;
+document.theImage.width=aw;
+document.theImage.style.height=ah+" px";
+document.theImage.style.width=aw+" px";
+P7_Snap("theImage","ant",0,0);
+}
+}
+drawBoundHandle();
+jg_doc.paint();
+showStatus();
+return false;
+}
+document.onmousedown=drags;
+document.onmouseup=dragStopped;
+

Propchange: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/xinha/plugins/ExtendedFileManager/assets/EditorContent.js
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/xinha/plugins/ExtendedFileManager/assets/ImageEditor.css
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/xinha/plugins/ExtendedFileManager/assets/ImageEditor.css?view=auto&rev=558490
==============================================================================
--- cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/xinha/plugins/ExtendedFileManager/assets/ImageEditor.css (added)
+++ cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/xinha/plugins/ExtendedFileManager/assets/ImageEditor.css Sun Jul 22 07:50:10 2007
@@ -0,0 +1,76 @@
+.icons {
+    font: 11px Tahoma,Verdana,sans-serif;
+    color: #666699;
+    text-align: center;
+    text-decoration: none;
+    border: 1px solid #EEEEFF;
+    -Moz-Border-Radius: 6px 6px 6px 6px;
+}
+
+body, td, p {
+    font: 11px Tahoma,Verdana,sans-serif;
+}
+.iconsOver {
+    font: 11px Tahoma,Verdana,sans-serif;
+    color: #666699;
+    text-align: center;
+    text-decoration: none;
+    background-color: #F9F9FF;
+    border: 1px solid #666699;
+    -Moz-Border-Radius: 6px 6px 6px 6px;
+}
+.topBar {
+    font: 11px Tahoma,Verdana,sans-serif;
+    color: #666699;
+}
+.iconsSel {
+    font: 11px Tahoma,Verdana,sans-serif;
+    color: #666699;
+    text-align: center;
+    text-decoration: none;
+    border: 1px solid #666699;
+    -Moz-Border-Radius: 6px 6px 6px 6px;
+}
+.iconText {
+    font: 11px Tahoma,Verdana,sans-serif;
+    color: #666699;
+    text-decoration: none;
+    text-align: center;
+}
+.measureStats{
+    width: 50px;
+}
+
+#slidercasing {
+    /*border:1px solid #CCCCCC;
+    background-color:#FFFFFF;*/
+    width:100px;
+    height:5px;
+    position:relative;
+    z-index:4;
+    padding:10px;
+}
+
+
+#slidertrack {
+    position:relative;
+    border:1px solid #CCCCCC;
+    background-color:#FFFFCC;
+    z-index:5;
+    height:5px;
+}
+
+
+#sliderbar {
+    position:absolute;
+    z-index:6;
+    border:1px solid #CCCCCC;
+    background-color:#DDDDDD;
+    width:15px;     
+    padding:0px;
+    height:20px; 
+    cursor: pointer;
+    top:2px;
+}
+
+select, input, button { font: 11px Tahoma,Verdana,sans-serif; }

Propchange: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/xinha/plugins/ExtendedFileManager/assets/ImageEditor.css
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/xinha/plugins/ExtendedFileManager/assets/dialog.js
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/xinha/plugins/ExtendedFileManager/assets/dialog.js?view=auto&rev=558490
==============================================================================
--- cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/xinha/plugins/ExtendedFileManager/assets/dialog.js (added)
+++ cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/xinha/plugins/ExtendedFileManager/assets/dialog.js Sun Jul 22 07:50:10 2007
@@ -0,0 +1,75 @@
+function Dialog(_1,_2,_3){
+if(typeof _3=="undefined"){
+_3=window;
+}
+Dialog._geckoOpenModal(_1,_2,_3);
+}
+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);
+}
+};
+Dialog._return=null;
+Dialog._modal=null;
+Dialog._arguments=null;
+Dialog._geckoOpenModal=function(_5,_6,_7){
+var _8="hadialog"+_5;
+var _9=/\W/g;
+_8=_8.replace(_9,"_");
+var _a=window.open(_5,_8,"toolbar=no,menubar=no,personalbar=no,width=10,height=10,"+"scrollbars=no,resizable=yes,modal=yes,dependable=yes");
+Dialog._modal=_a;
+Dialog._arguments=_7;
+function capwin(w){
+Dialog._addEvent(w,"click",Dialog._parentEvent);
+Dialog._addEvent(w,"mousedown",Dialog._parentEvent);
+Dialog._addEvent(w,"focus",Dialog._parentEvent);
+}
+function relwin(w){
+Dialog._removeEvent(w,"click",Dialog._parentEvent);
+Dialog._removeEvent(w,"mousedown",Dialog._parentEvent);
+Dialog._removeEvent(w,"focus",Dialog._parentEvent);
+}
+capwin(window);
+for(var i=0;i<window.frames.length;capwin(window.frames[i++])){
+}
+Dialog._return=function(_e){
+if(_e&&_6){
+_6(_e);
+}
+relwin(window);
+for(var i=0;i<window.frames.length;relwin(window.frames[i++])){
+}
+Dialog._modal=null;
+};
+};
+Dialog._addEvent=function(el,_11,_12){
+if(Dialog.is_ie){
+el.attachEvent("on"+_11,_12);
+}else{
+el.addEventListener(_11,_12,true);
+}
+};
+Dialog._removeEvent=function(el,_14,_15){
+if(Dialog.is_ie){
+el.detachEvent("on"+_14,_15);
+}else{
+el.removeEventListener(_14,_15,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));
+

Propchange: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/xinha/plugins/ExtendedFileManager/assets/dialog.js
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/xinha/plugins/ExtendedFileManager/assets/editor.css
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/xinha/plugins/ExtendedFileManager/assets/editor.css?view=auto&rev=558490
==============================================================================
--- cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/xinha/plugins/ExtendedFileManager/assets/editor.css (added)
+++ cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/xinha/plugins/ExtendedFileManager/assets/editor.css Sun Jul 22 07:50:10 2007
@@ -0,0 +1,196 @@
+		body
+		{
+			margin: 0; padding: 0;
+			font: 11px Tahoma,Verdana,sans-serif;
+		}
+		select, input, button { font: 11px Tahoma,Verdana,sans-serif; }
+
+		#indicator
+		{
+			width: 25px;
+			height: 20px;
+			background-color: #eef;			
+			padding: 15px 20px;
+			position: absolute;
+			left: 0; top: 0;
+		}
+		* html #indicator
+		{
+			padding: 14px 22px;
+		}
+		#tools
+		{
+			width: 600px;
+			height: 50px;
+			background-color: #eef;
+			padding: 0;
+			position: absolute;
+			left: 63px;
+			border-left: 1px solid white;
+			border-bottom: 1px solid white;
+		}
+		#toolbar
+		{
+			width: 53px;
+			height: 435px;
+			background-color: #eef;
+			float: left;
+			text-align: center;
+			padding: 5px;
+			position: absolute;
+			top: 50px;
+			border-top: 1px solid white;
+			border-right: 1px solid white;
+		}
+		
+		#contents
+		{
+			width: 600px;
+			height: 445px;
+			position: absolute;
+			left: 64px; top: 51px;
+		}
+		
+		#editor
+		{
+			width: 600px;
+			height: 445px;
+		}
+
+		#toolbar a 
+		{
+			padding: 5px;
+			width: 40px;
+			display: block;
+			border: 1px solid #eef;
+			text-align: center;
+			text-decoration: none;
+			color: #669;
+			margin: 5px 0;
+		}
+		#toolbar a:hover
+		{
+			background-color: #F9F9FF;
+			border-color: #669;
+		}
+		
+		#toolbar a.iconActive
+		{
+			border-color: #669;
+		}
+
+		#toolbar a span
+		{
+			display: block;
+			text-decoration: none;
+			
+		}
+		#toolbar a img
+		{
+			border: 0 none;
+		}
+		
+		#tools .textInput
+		{
+			width: 3em;
+			vertical-align: 0px;
+
+		}
+		* html #tools .textInput
+		{
+			vertical-align: middle;
+		}
+		#tools .measureStats
+		{
+			width: 4.5em;
+			border: 0 none;
+			background-color: #eef;
+			vertical-align: 0px;
+		}
+		* html #tools .measureStats
+		{
+			vertical-align: middle;
+		}
+		#tools label
+		{
+			margin: 0 2px 0 5px;
+		}
+		#tools input
+		{
+			vertical-align: middle;
+		}
+		#tools #tool_inputs
+		{
+			padding-top: 10px;
+			float: left;			
+		}
+		#tools .div
+		{
+			vertical-align: middle;
+			margin: 0 5px;
+		}
+		#tools img
+		{
+			border: 0 none;
+		}
+		#tools a.buttons
+		{
+			margin-top: 10px;
+			border: 1px solid #eef;
+			display: block;
+			float: left;
+		}
+		#tools a.buttons:hover
+		{
+			background-color: #F9F9FF;
+			border-color: #669;
+		}
+		#slidercasing {
+    /*border:1px solid #CCCCCC;
+    background-color:#FFFFFF;*/
+    width:100px;
+    height:5px;
+    position:relative;
+    z-index:4;
+    padding:10px;
+	 top: 6px;
+	 margin: 0 -5px 0 -10px;
+
+	
+}
+
+
+#slidertrack {
+    position:relative;
+    border:1px solid #CCCCCC;
+    background-color:#FFFFCC;
+    z-index:5;
+    height:5px;
+}
+
+
+#sliderbar {
+    position:absolute;
+    z-index:6;
+    border:1px solid #CCCCCC;
+    background-color:#DDDDDD;
+    width:15px;     
+    padding:0px;
+    height:20px; 
+    cursor: pointer;
+    top:2px;
+}
+
+* html #slidercasing
+{
+	top:0;
+}
+
+
+#bottom
+{
+	position: relative;
+	top: 490px;
+}
+
+#save_filename {width: 100px;}
\ No newline at end of file

Propchange: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/xinha/plugins/ExtendedFileManager/assets/editor.css
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/xinha/plugins/ExtendedFileManager/assets/editor.js
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/xinha/plugins/ExtendedFileManager/assets/editor.js?view=auto&rev=558490
==============================================================================
--- cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/xinha/plugins/ExtendedFileManager/assets/editor.js (added)
+++ cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/xinha/plugins/ExtendedFileManager/assets/editor.js Sun Jul 22 07:50:10 2007
@@ -0,0 +1,127 @@
+var current_action=null;
+var actions=["crop","scale","rotate","measure","save"];
+var orginal_width=null,orginal_height=null;
+function toggle(_1){
+if(current_action!=_1){
+for(var i in actions){
+if(actions[i]!=_1){
+var _3=document.getElementById("tools_"+actions[i]);
+_3.style.display="none";
+var _4=document.getElementById("icon_"+actions[i]);
+_4.className="";
+}
+}
+current_action=_1;
+var _3=document.getElementById("tools_"+_1);
+_3.style.display="block";
+var _4=document.getElementById("icon_"+_1);
+_4.className="iconActive";
+var _5=document.getElementById("indicator_image");
+_5.src="img/"+_1+".gif";
+editor.setMode(current_action);
+if(_1=="scale"){
+var _6=editor.window.document.getElementById("theImage");
+orginal_width=_6.width;
+orginal_height=_6.height;
+var w=document.getElementById("sw");
+w.value=orginal_width;
+var h=document.getElementById("sh");
+h.value=orginal_height;
+}
+}
+}
+function toggleMarker(){
+var _9=document.getElementById("markerImg");
+if(_9!=null&&_9.src!=null){
+if(_9.src.indexOf("t_black.gif")>=0){
+_9.src="img/t_white.gif";
+}else{
+_9.src="img/t_black.gif";
+}
+editor.toggleMarker();
+}
+}
+function toggleConstraints(){
+var _a=document.getElementById("scaleConstImg");
+var _b=document.getElementById("constProp");
+if(_a!=null&&_a.src!=null){
+if(_a.src.indexOf("unlocked2.gif")>=0){
+_a.src="img/islocked2.gif";
+_b.checked=true;
+checkConstrains("width");
+}else{
+_a.src="img/unlocked2.gif";
+_b.checked=false;
+}
+}
+}
+function checkConstrains(_c){
+var _d=document.getElementById("constProp");
+if(_d.checked){
+var w=document.getElementById("sw");
+var _f=w.value;
+var h=document.getElementById("sh");
+var _11=h.value;
+if(orginal_width>0&&orginal_height>0){
+if(_c=="width"&&_f>0){
+h.value=parseInt((_f/orginal_width)*orginal_height);
+}else{
+if(_c=="height"&&_11>0){
+w.value=parseInt((_11/orginal_height)*orginal_width);
+}
+}
+}
+}
+updateMarker("scale");
+}
+function updateMarker(_12){
+if(_12=="crop"){
+var _13=document.getElementById("cx");
+var _14=document.getElementById("cy");
+var _15=document.getElementById("cw");
+var _16=document.getElementById("ch");
+editor.setMarker(parseInt(_13.value),parseInt(_14.value),parseInt(_15.value),parseInt(_16.value));
+}else{
+if(_12=="scale"){
+var _17=document.getElementById("sw");
+var _18=document.getElementById("sh");
+editor.setMarker(0,0,parseInt(_17.value),parseInt(_18.value));
+}
+}
+}
+function rotatePreset(_19){
+var _1a=_19.options[_19.selectedIndex].value;
+if(_1a.length>0&&parseInt(_1a)!=0){
+var ra=document.getElementById("ra");
+ra.value=parseInt(_1a);
+}
+}
+function updateFormat(_1c){
+var _1d=_1c.options[_1c.selectedIndex].value;
+var _1e=_1d.split(",");
+if(_1e.length>1){
+updateSlider(parseInt(_1e[1]));
+}
+}
+function addEvent(obj,_20,fn){
+if(obj.addEventListener){
+obj.addEventListener(_20,fn,true);
+return true;
+}else{
+if(obj.attachEvent){
+var r=obj.attachEvent("on"+_20,fn);
+return r;
+}else{
+return false;
+}
+}
+}
+init=function(){
+var _23=document.getElementById("bottom");
+if(window.opener){
+__dlg_init(null,{width:673,height:531});
+__dlg_translate("ExtendedFileManager");
+}
+};
+addEvent(window,"load",init);
+

Propchange: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/xinha/plugins/ExtendedFileManager/assets/editor.js
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/xinha/plugins/ExtendedFileManager/assets/editorFrame.css
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/xinha/plugins/ExtendedFileManager/assets/editorFrame.css?view=auto&rev=558490
==============================================================================
--- cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/xinha/plugins/ExtendedFileManager/assets/editorFrame.css (added)
+++ cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/xinha/plugins/ExtendedFileManager/assets/editorFrame.css Sun Jul 22 07:50:10 2007
@@ -0,0 +1,8 @@
+body { margin: 0; padding: 0;  background-color: #eee; }
+table { width: 100%; }
+table td { text-align: center; }
+.crop{cursor:crosshair;}
+.selection { border: dotted 1px #000000; position:absolute; width: 0px; height: 1px; z-index:5; }
+.selectionWhite{ border: dotted 1px #FFFFFF; position:absolute; width: 0px; height: 1px; z-index:5; }
+.handleBox{ z-index:105; }
+.error { font-size:large; font-weight:bold; color:#c00; font-family: Helvetica, sans-serif; } 
\ No newline at end of file

Propchange: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/xinha/plugins/ExtendedFileManager/assets/editorFrame.css
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/xinha/plugins/ExtendedFileManager/assets/editorFrame.js
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/xinha/plugins/ExtendedFileManager/assets/editorFrame.js?view=auto&rev=558490
==============================================================================
--- cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/xinha/plugins/ExtendedFileManager/assets/editorFrame.js (added)
+++ cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/xinha/plugins/ExtendedFileManager/assets/editorFrame.js Sun Jul 22 07:50:10 2007
@@ -0,0 +1,73 @@
+var topDoc=window.top.document;
+var t_cx=topDoc.getElementById("cx");
+var t_cy=topDoc.getElementById("cy");
+var t_cw=topDoc.getElementById("cw");
+var t_ch=topDoc.getElementById("ch");
+var m_sx=topDoc.getElementById("sx");
+var m_sy=topDoc.getElementById("sy");
+var m_w=topDoc.getElementById("mw");
+var m_h=topDoc.getElementById("mh");
+var m_a=topDoc.getElementById("ma");
+var m_d=topDoc.getElementById("md");
+var s_sw=topDoc.getElementById("sw");
+var s_sh=topDoc.getElementById("sh");
+var r_ra=topDoc.getElementById("ra");
+var pattern="img/2x2.gif";
+function doSubmit(_1){
+if(_1=="crop"){
+var _2=_backend_url+"__function=editorFrame&img="+currentImageFile+"&action=crop&params="+parseInt(t_cx.value)+","+parseInt(t_cy.value)+","+parseInt(t_cw.value)+","+parseInt(t_ch.value);
+location.href=_2;
+}else{
+if(_1=="scale"){
+var _2=_backend_url+"__function=editorFrame&img="+currentImageFile+"&action=scale&params="+parseInt(s_sw.value)+","+parseInt(s_sh.value);
+location.href=_2;
+}else{
+if(_1=="rotate"){
+var _3=topDoc.getElementById("flip");
+if(_3.value=="hoz"||_3.value=="ver"){
+location.href=_backend_url+"__function=editorFrame&img="+currentImageFile+"&action=flip&params="+_3.value;
+}else{
+if(isNaN(parseFloat(r_ra.value))==false){
+location.href=_backend_url+"__function=editorFrame&img="+currentImageFile+"&action=rotate&params="+parseFloat(r_ra.value);
+}
+}
+}else{
+if(_1=="save"){
+var _4=topDoc.getElementById("save_filename");
+var _5=topDoc.getElementById("save_format");
+var _6=topDoc.getElementById("quality");
+var _7=_5.value.split(",");
+if(_4.value.length<=0){
+alert(i18n("Please enter a filename to save."));
+}else{
+var _8=encodeURI(_4.value);
+var _9=parseInt(_6.value);
+var _2=_backend_url+"__function=editorFrame&img="+currentImageFile+"&action=save&params="+_7[0]+","+_9+"&file="+_8;
+location.href=_2;
+}
+}
+}
+}
+}
+}
+function addEvent(_a,_b,fn){
+if(_a.addEventListener){
+_a.addEventListener(_b,fn,true);
+return true;
+}else{
+if(_a.attachEvent){
+var r=_a.attachEvent("on"+_b,fn);
+return r;
+}else{
+return false;
+}
+}
+}
+var jg_doc;
+init=function(){
+jg_doc=new jsGraphics("imgCanvas");
+jg_doc.setColor("#000000");
+initEditor();
+};
+addEvent(window,"load",init);
+

Propchange: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/xinha/plugins/ExtendedFileManager/assets/editorFrame.js
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/xinha/plugins/ExtendedFileManager/assets/hover.htc
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/xinha/plugins/ExtendedFileManager/assets/hover.htc?view=auto&rev=558490
==============================================================================
--- cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/xinha/plugins/ExtendedFileManager/assets/hover.htc (added)
+++ cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/xinha/plugins/ExtendedFileManager/assets/hover.htc Sun Jul 22 07:50:10 2007
@@ -0,0 +1,34 @@
+<attach event="onmouseover" handler="hoverRollOver" />
+<attach event="onmouseout" handler="hoverRollOff" />
+<script type="text/javascript">
+//
+//	Simple behaviour for IE5+ to emulate :hover CSS pseudo-class.
+//  Experimental ver 0.1
+//
+//	This is an experimental version! Handle with care!
+//	Manual at: http://www.hszk.bme.hu/~hj130/css/list_menu/hover/
+//
+
+function hoverRollOver() {
+	
+	element.origClassName = element.className;	// backup origonal className
+	
+	var tempClassStr = element.className;		
+	
+	tempClassStr += "Hover";					// convert name+'Hover' the last class name	to emulate tag.class:hover
+	
+	tempClassStr = tempClassStr.replace(/\s/g,"Hover ");	//convert name+'Hover' the others to emulate tag.class:hover
+	
+	tempClassStr += " hover";				// add simple 'hover' class name to emulate tag:hover
+	
+	element.className = element.className + " " + tempClassStr; 
+	
+	//alert(element.className);
+	//window.status = element.className;		// only for TEST
+}
+function hoverRollOff() {
+	element.className = element.origClassName;
+}
+
+</script>
+

Added: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/xinha/plugins/ExtendedFileManager/assets/imagelist.css
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/xinha/plugins/ExtendedFileManager/assets/imagelist.css?view=auto&rev=558490
==============================================================================
--- cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/xinha/plugins/ExtendedFileManager/assets/imagelist.css (added)
+++ cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/xinha/plugins/ExtendedFileManager/assets/imagelist.css Sun Jul 22 07:50:10 2007
@@ -0,0 +1,54 @@
+body { margin: 0; padding: 0;}
+.edit,.dir_holder .fileName, .thumb_holder .fileName    { font-size: 8pt; font-family: small-caption, sans-serif; padding-top: 3px;}
+.edit a { border: none; padding: 0; text-decoration:none; }
+.edit a:hover { background-color: ButtonHighlight; }
+.edit a img { border: none; vertical-align: bottom; }
+.noResult { font-size:large; font-weight:bold; color:#ccc; font-family: Helvetica, sans-serif;  text-align: center;  padding-top: 60px;   }
+.error { color:#c00; font-weight:bold; font-size: medium; font-family: Helvetica, sans-serif; text-align: center;  padding-top: 65px;}
+
+.dir_holder, .thumb_holder
+{
+  width:106px; height:132px;
+  float:left;
+  margin:6px 4px;
+  background-color:ButtonFace;
+  border: 1px outset;
+}
+
+.thumb_holder.active
+{
+  background:Highlight;
+  color:HighlightText;
+  border:1px dashed Highlight;
+}
+
+.dir_holder a.dir, .thumb_holder a.thumb
+{
+  height:85px;
+  display:block;
+  text-align:center;
+  padding:5px;
+  text-decoration:none;
+}
+
+.thumb_holder a.thumb img
+{
+  border:1px solid black;
+}
+
+.dir_holder a.dir img
+{
+  border:none;
+}
+
+.listview { width:100% }
+.listview td, .listview th { text-align:left; font-size:small; }
+.listview td.actions { text-align: right; }
+.listview td.actions img { border:0; }
+
+.listview thead th {background-color: ButtonFace; border: 1px solid threedface; border-color: ButtonHighlight ButtonShadow ButtonShadow ButtonHighlight; padding-top:2px; padding-bottom:2px; padding-left: 5px; padding-right: 5px; font-size: 9pt; font-family: "MS Sans Serif", Geneva, sans-serif;}
+.listview tbody td, .listview tbody th {padding-top:2px; padding-left: 3px; font-size: 9pt; font-family: "MS Sans Serif", Geneva, sans-serif;}
+.listview tbody a, listview tbody a:visited { font-weight: normal; text-decoration: none; color: #000; border:0px; padding:2px;}
+.listview tbody a:hover { background-color:#0B256B; color:#fff;}
+
+.listview tbody tr:hover {background-color: rgb(221,221,255);

Propchange: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/xinha/plugins/ExtendedFileManager/assets/imagelist.css
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/xinha/plugins/ExtendedFileManager/assets/images.js
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/xinha/plugins/ExtendedFileManager/assets/images.js?view=auto&rev=558490
==============================================================================
--- cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/xinha/plugins/ExtendedFileManager/assets/images.js (added)
+++ cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/xinha/plugins/ExtendedFileManager/assets/images.js Sun Jul 22 07:50:10 2007
@@ -0,0 +1,242 @@
+function i18n(_1){
+return Xinha._lc(_1,"ExtendedFileManager");
+}
+function changeDir(_2){
+showMessage("Loading");
+var _3=window.top.document.getElementById("manager_mode").value;
+var _4=window.top.document.getElementById("viewtype");
+var _5=_4.options[_4.selectedIndex].value;
+location.href=_backend_url+"__function=images&mode="+_3+"&dir="+_2+"&viewtype="+_5;
+document.cookie="EFMStartDir"+_3+"="+_2;
+}
+function newFolder(_6,_7){
+var _8=window.top.document.getElementById("manager_mode").value;
+var _9=window.top.document.getElementById("viewtype");
+var _a=_9.options[_9.selectedIndex].value;
+location.href=_backend_url+"__function=images&mode="+_8+"&dir="+_6+"&newDir="+_7+"&viewtype="+_a;
+}
+function renameFile(_b){
+var _c=_b.replace(/.*%2F/,"").replace(/\..*$/,"");
+var _d=function(_e){
+if(_e==""||_e==null||_e==_c){
+alert(i18n("Cancelled rename."));
+return false;
+}
+var _f=window.top.document.getElementById("manager_mode").value;
+var _10=window.top.document.getElementById("dirPath");
+var dir=_10.options[_10.selectedIndex].value;
+_10=window.top.document.getElementById("viewtype");
+var _12=_10.options[_10.selectedIndex].value;
+location.href=_backend_url+"__function=images&mode="+_f+"&dir="+dir+"&rename="+_b+"&renameTo="+_e+"&viewtype="+_12;
+};
+if(Xinha.ie_version>6){
+popupPrompt(i18n("Please enter new name for this file..."),_c,_d,i18n("Rename"));
+}else{
+var _13=prompt(i18n("Please enter new name for this file..."),_c);
+_d(_13);
+}
+}
+function renameDir(_14){
+function rename(_15){
+if(_15==""||_15==null||_15==_14){
+alert(i18n("Cancelled rename."));
+return false;
+}
+var _16=window.top.document.getElementById("manager_mode").value;
+var _17=window.top.document.getElementById("dirPath");
+var dir=_17.options[_17.selectedIndex].value;
+_17=window.top.document.getElementById("viewtype");
+var _19=_17.options[_17.selectedIndex].value;
+location.href=_backend_url+"__function=images&mode="+_16+"&dir="+dir+"&rename="+_14+"&renameTo="+_15+"&viewtype="+_19;
+}
+if(Xinha.ie_version>6){
+popupPrompt(i18n("Please enter new name for this folder..."),_14,rename,i18n("Rename"));
+}else{
+var _1a=prompt(i18n("Please enter new name for this folder..."),_14);
+rename(_1a);
+}
+}
+function copyFile(_1b,_1c){
+var _1d=window.top.document.getElementById("dirPath");
+var dir=_1d.options[_1d.selectedIndex].value;
+window.top.pasteButton({"dir":dir,"file":_1b,"action":_1c+"File"});
+}
+function copyDir(_1f,_20){
+var _21=window.top.document.getElementById("dirPath");
+var dir=_21.options[_21.selectedIndex].value;
+window.top.pasteButton({"dir":dir,"file":_1f,"action":_20+"Dir"});
+}
+function paste(_23){
+var _24=window.top.document.getElementById("manager_mode").value;
+var _25=window.top.document.getElementById("dirPath");
+var dir=_25.options[_25.selectedIndex].value;
+_25=window.top.document.getElementById("viewtype");
+var _27=_25.options[_25.selectedIndex].value;
+location.href=_backend_url+"__function=images&mode="+_24+"&dir="+dir+"&paste="+_23.action+"&srcdir="+_23.dir+"&file="+_23.file+"&viewtype="+_27;
+}
+function updateDir(_28){
+var _29=window.top.document.getElementById("manager_mode").value;
+document.cookie="EFMStartDir"+_29+"="+_28;
+var _2a=window.top.document.getElementById("dirPath");
+if(_2a){
+for(var i=0;i<_2a.length;i++){
+var _2c=_2a.options[i].text;
+if(_2c==_28){
+_2a.selectedIndex=i;
+showMessage("Loading");
+break;
+}
+}
+}
+}
+function emptyProperties(){
+toggleImageProperties(false);
+var _2d=window.top.document;
+_2d.getElementById("f_url").value="";
+_2d.getElementById("f_alt").value="";
+_2d.getElementById("f_title").value="";
+_2d.getElementById("f_width").value="";
+_2d.getElementById("f_margin").value="";
+_2d.getElementById("f_height").value="";
+_2d.getElementById("f_padding").value="";
+_2d.getElementById("f_border").value="";
+_2d.getElementById("f_borderColor").value="";
+_2d.getElementById("f_backgroundColor").value="";
+}
+function toggleImageProperties(val){
+var _2f=window.top.document;
+if(val==true){
+_2f.getElementById("f_width").value="";
+_2f.getElementById("f_margin").value="";
+_2f.getElementById("f_height").value="";
+_2f.getElementById("f_padding").value="";
+_2f.getElementById("f_border").value="";
+_2f.getElementById("f_borderColor").value="";
+_2f.getElementById("f_backgroundColor").value="";
+}
+_2f.getElementById("f_width").disabled=val;
+_2f.getElementById("f_margin").disabled=val;
+_2f.getElementById("f_height").disabled=val;
+_2f.getElementById("f_padding").disabled=val;
+_2f.getElementById("f_align").disabled=val;
+_2f.getElementById("f_border").disabled=val;
+_2f.getElementById("f_borderColor").value="";
+_2f.getElementById("f_backgroundColor").value="";
+_2f.getElementById("constrain_prop").disabled=val;
+}
+function selectImage(_30,alt,_32,_33){
+var _34=window.top.document;
+if(_34.getElementById("manager_mode").value=="image"){
+var obj=_34.getElementById("f_url");
+obj.value=_30;
+obj=_34.getElementById("f_alt");
+obj.value=alt;
+obj=_34.getElementById("f_title");
+obj.value=alt;
+if(_32==0&&_33==0){
+toggleImageProperties(true);
+}else{
+toggleImageProperties(false);
+var obj=_34.getElementById("f_width");
+obj.value=_32;
+var obj=_34.getElementById("f_height");
+obj.value=_33;
+var obj=_34.getElementById("orginal_width");
+obj.value=_32;
+var obj=_34.getElementById("orginal_height");
+obj.value=_33;
+update_selected();
+}
+}else{
+if(_34.getElementById("manager_mode").value=="link"){
+var obj=_34.getElementById("f_href");
+obj.value=_30;
+var obj=_34.getElementById("f_title");
+obj.value=alt;
+}
+}
+return false;
+}
+var _current_selected=null;
+function update_selected(){
+var _36=window.top.document;
+if(_current_selected){
+_current_selected.className=_current_selected.className.replace(/(^| )active( |$)/,"$1$2");
+_current_selected=null;
+}
+var _37=_36.getElementById("f_url").value;
+var _38=_36.getElementById("dirPath");
+var _39=_38.options[_38.selectedIndex].text;
+var dRe=new RegExp("^("+_39.replace(/([\/\^$*+?.()|{}[\]])/g,"\\$1")+")([^/]*)$");
+if(dRe.test(_37)){
+var _3b=document.getElementById("holder_"+asc2hex(RegExp.$2));
+if(_3b){
+_current_selected=_3b;
+_3b.className+=" active";
+}
+}
+showPreview(_37);
+}
+function asc2hex(str){
+var _3d="";
+for(var i=0;i<str.length;i++){
+var hex=(str.charCodeAt(i)).toString(16);
+if(hex.length==1){
+hex="0"+hex;
+}
+_3d+=hex;
+}
+return _3d;
+}
+function showMessage(_40){
+var _41=window.top.document;
+var _42=_41.getElementById("message");
+var _43=_41.getElementById("messages");
+if(_42&&_43){
+if(_42.firstChild){
+_42.removeChild(_42.firstChild);
+}
+_42.appendChild(_41.createTextNode(i18n(_40)));
+_43.style.display="block";
+}
+}
+function updateDiskMesg(_44){
+var _45=window.top.document;
+var _46=_45.getElementById("diskmesg");
+if(_46){
+if(_46.firstChild){
+_46.removeChild(_46.firstChild);
+}
+_46.appendChild(_45.createTextNode(_44));
+}
+}
+function addEvent(obj,_48,fn){
+if(obj.addEventListener){
+obj.addEventListener(_48,fn,true);
+return true;
+}else{
+if(obj.attachEvent){
+var r=obj.attachEvent("on"+_48,fn);
+return r;
+}else{
+return false;
+}
+}
+}
+function confirmDeleteFile(_4b){
+if(confirm(i18n("Delete file \"$file="+_4b+"$\"?"))){
+return true;
+}
+return false;
+}
+function confirmDeleteDir(dir,_4d){
+if(confirm(i18n("Delete folder \"$dir="+dir+"$\"?"))){
+return true;
+}
+return false;
+}
+function showPreview(_4e){
+window.parent.document.getElementById("f_preview").src=_4e?window.parent._backend_url+"__function=thumbs&img="+_4e:window.parent.opener._editor_url+"plugins/ExtendedFileManager/img/1x1_transparent.gif";
+}
+addEvent(window,"load",init);
+

Propchange: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/xinha/plugins/ExtendedFileManager/assets/images.js
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/xinha/plugins/ExtendedFileManager/assets/manager.css
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/xinha/plugins/ExtendedFileManager/assets/manager.css?view=auto&rev=558490
==============================================================================
--- cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/xinha/plugins/ExtendedFileManager/assets/manager.css (added)
+++ cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/xinha/plugins/ExtendedFileManager/assets/manager.css Sun Jul 22 07:50:10 2007
@@ -0,0 +1,49 @@
+html, body, .dialog {  background-color: ButtonFace;  color: ButtonText; font: 11px Tahoma,Verdana,sans-serif; margin: 0; padding: 0;}
+body { padding: 5px; }
+fieldset { padding: 0;}
+.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;}
+form { padding: 0px;  margin: 0 auto; width: 100%;}
+/*.dirWidth { width: 60%; }*/
+a { padding: 5px; border: 1px solid ButtonFace;	}	
+a img	{ border: 0; }	
+a:hover { border-color: ButtonHighlight ButtonShadow ButtonShadow ButtonHighlight; }
+.dirs {	padding: 1em; 	}
+
+.imageFrame { overflow-x:hidden; width: 100%; height: 145px; margin:0px; background-color: #fff;}
+.smallWidth{ width: 4em; }
+.largelWidth{ width: 30em; }
+.extralargelWidth{ width: 100%; }
+.inputTable { margin: 1em auto 1em 0;width:100%}
+select, input, button { font: 11px Tahoma,Verdana,sans-serif; }
+.buttons { width: 70px; text-align: center; }
+.clearboth{ clear: both; }
+#messages { position: relative; left: 175px; top: 115px; background-color: white; width:200px;  float: left; margin-top: -52px; border: 1px solid #ccc; text-align: center; padding: 15px; }
+#message  { font-size: 15px; font-weight: bold; color: #69c; }
+iframe { border:1px inset; border-right:none; border-left:none; border-bottom:none; }
+
+table { margin-top:10px; }
+th, td { padding-right:3px; text-align:left; font-family:small-caption,helvetica,sans-serif; }
+.dirWidth {width: 59%}
+
+.buttonColor {
+  width :1em;
+  margin-left: 2px;
+  cursor: default;
+}
+
+.buttonColor .chooser, .buttonColor .nocolor {
+  height: 0.6em;
+  border: 1px solid;
+  padding: 0px 1em;
+  border-color: ButtonHighlight ButtonShadow ButtonShadow ButtonHighlight;
+}
+
+.buttonColor .buttonClick {
+  border-color: ButtonShadow ButtonHighlight ButtonHighlight ButtonShadow;
+}
+.buttonColor .buttonColor-hilite {
+  border-color: ButtonShadow ButtonHighlight ButtonHighlight ButtonShadow;
+}
+
+.buttonColor .nocolor { padding: 0px; }
+.buttonColor .nocolor-hilite { background-color: #fff; color: #f00; }

Propchange: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/xinha/plugins/ExtendedFileManager/assets/manager.css
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message