Return-Path: Delivered-To: apmail-cocoon-cvs-archive@www.apache.org Received: (qmail 77697 invoked from network); 22 Jul 2007 14:52:53 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 22 Jul 2007 14:52:53 -0000 Received: (qmail 23566 invoked by uid 500); 22 Jul 2007 14:52:53 -0000 Delivered-To: apmail-cocoon-cvs-archive@cocoon.apache.org Received: (qmail 23487 invoked by uid 500); 22 Jul 2007 14:52:52 -0000 Mailing-List: contact cvs-help@cocoon.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@cocoon.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list cvs@cocoon.apache.org Received: (qmail 23412 invoked by uid 99); 22 Jul 2007 14:52:52 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 22 Jul 2007 07:52:52 -0700 X-ASF-Spam-Status: No, hits=-99.5 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 22 Jul 2007 07:52:40 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 44B5C1A9831; Sun, 22 Jul 2007 07:51:56 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: cvs@cocoon.apache.org From: felixk@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070722145156.44B5C1A9831@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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 @@ +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 + * array('path name' => 'full directory path', ...) + */ + 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 + * array('path name' => 'full directory path', ...) + */ + 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. + * array(0=>array('relative'=>'fullpath',...), 1=>array('filename'=>fileinfo array(),...) + * fileinfo array: array('url'=>'full url', + * 'relative'=>'relative to base', + * 'fullpath'=>'full file path', + * 'image'=>imageInfo array() false if not image, + * 'stat' => filestat) + */ + 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."
"; + 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 + +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) + { + '; + $IMConfig['images_url'] = ''; + $IMConfig['files_dir'] = ''; + $IMConfig['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-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;s4){ +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+ah0&&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=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¶ms="+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¶ms="+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¶ms="+_3.value; +}else{ +if(isNaN(parseFloat(r_ra.value))==false){ +location.href=_backend_url+"__function=editorFrame&img="+currentImageFile+"&action=rotate¶ms="+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¶ms="+_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 @@ + + + + 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