@@ -1,54 +0,0 @@
|
||||
<div id="content">
|
||||
<table class="tableList" id="tableList" cellpadding="0" cellspacing="0" border="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="5"><a href="#" class="check_all" id="tickAll" title="<?php echo TIP_SELECT_ALL; ?>" onclick="checkAll(this);"> </a></th>
|
||||
<th width="10" class="fileColumns"> </th>
|
||||
<th class="docName"><?php echo LBL_NAME; ?></th>
|
||||
<th width="70" class="fileColumns"><?php echo LBL_SIZE; ?></th>
|
||||
<th class="fileColumns"><?php echo LBL_MODIFIED; ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="fileList">
|
||||
<?php
|
||||
$count = 1;
|
||||
$css = "";
|
||||
//list all documents (files and folders) under this current folder,
|
||||
//<?php echo appendQueryString(appendQueryString(CONFIG_URL_FILEnIMAGE_MANAGER, "path=" . $file['path']), makeQueryString(array('path')));
|
||||
foreach($fileList as $file)
|
||||
{
|
||||
$css = ($css == "" || $css == "even"?"odd":"even");
|
||||
$strDisabled = ($file['is_writable']?"":" disabled");
|
||||
$strClass = ($file['is_writable']?"left":" leftDisabled");
|
||||
if($file['type'] == 'file')
|
||||
{
|
||||
|
||||
?>
|
||||
<tr class="<?php echo $css; ?>" id="row<?php echo $count; ?>" >
|
||||
<td align="center" id="tdz<?php echo $count; ?>"><span id="flag<?php echo $count; ?>" class="<?php echo $file['flag']; ?>"> </span><input type="checkbox" name="check[]" id="cb<?php echo $count; ?>" value="<?php echo $file['path']; ?>" <?php echo $strDisabled; ?> />
|
||||
</td>
|
||||
<td align="center" class="fileColumns" id="tdst<?php echo $count; ?>"> <a id="a<?php echo $count; ?>" href="<?php echo $file['path']; ?>" target="_blank"><span class="<?php echo $file['cssClass']; ?>"> </span></a></td>
|
||||
<td class="<?php echo $strClass; ?> docName" id="tdnd<?php echo $count; ?>"><?php echo $file['name']; ?></td>
|
||||
<td class="docInfo" id="tdrd<?php echo $count; ?>"><?php echo transformFileSize($file['size']); ?></td>
|
||||
<td class="docInfo" id="tdth<?php echo $count; ?>"><?php echo @date(DATE_TIME_FORMAT,$file['mtime']); ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
}else
|
||||
{
|
||||
?>
|
||||
<tr class="<?php echo $css; ?>" id="row<?php echo $count; ?>" >
|
||||
<td align="center" id="tdz<?php echo $count; ?>"><span id="flag<?php echo $count; ?>" class="<?php echo $file['flag']; ?>"> </span><input type="checkbox" name="check[]" id="cb<?php echo $count; ?>" value="<?php echo $file['path']; ?>" <?php echo $strDisabled; ?>/>
|
||||
</td>
|
||||
<td lign="center" class="fileColumns" id="tdst<?php echo $count; ?>"> <a id="a<?php echo $count; ?>" href="<?php echo $file['path']; ?>" <?php echo $file['cssClass'] == 'filePicture'?'rel="ajaxPhotos"':''; ?> ><span class="<?php echo ($file['file']||$file['subdir']?$file['cssClass']:"folderEmpty"); ?>"> </span></a></td>
|
||||
<td class="<?php echo $strClass; ?> docName" id="tdnd<?php echo $count; ?>"><?php echo $file['name']; ?></td>
|
||||
<td class="docInfo" id="tdrd<?php echo $count; ?>"> </td>
|
||||
<td class="docInfo" id="tdth<?php echo $count; ?>"><?php echo @date(DATE_TIME_FORMAT,$file['mtime']); ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
$count++;
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@@ -1,37 +0,0 @@
|
||||
<div id="content">
|
||||
<?php
|
||||
|
||||
$count = 1;
|
||||
$thumbnailBaseUrl = appendQueryString(CONFIG_URL_IMG_THUMBNAIL, makeQueryString(array('path')));
|
||||
foreach($fileList as $file)
|
||||
|
||||
{
|
||||
?>
|
||||
<dl class="thumbnailListing" id="dl<?php echo $count; ?>">
|
||||
<dt id="dt<?php echo $count; ?>" class="<?php echo ($file['type'] == 'folder' && empty($file['file']) && empty($file['subdir'])?'folderEmpty':$file['cssClass']); ?>" class="<?php echo $file['cssClass']; ?>">
|
||||
<?php
|
||||
switch($file['cssClass'])
|
||||
{
|
||||
case 'filePicture':
|
||||
echo '<a id="thumbUrl' . $count . '" rel="thumbPhotos" href="' . $file['path'] . '">';
|
||||
echo '<img src="' . appendQueryString($thumbnailBaseUrl, 'path=' . $file['path']) . '" id="thumbImg' . $count . '"></a>' . "\n";
|
||||
break;
|
||||
case 'fileFlash':
|
||||
case 'fileVideo':
|
||||
case 'fileMusic':
|
||||
break;
|
||||
default:
|
||||
echo ' ';
|
||||
}
|
||||
?>
|
||||
|
||||
</dt>
|
||||
<dd id="dd<?php echo $count; ?>" class="thumbnailListing_info"><span id="flag<?php echo $count; ?>" class="<?php echo $file['flag']; ?>"> </span><input id="cb<?php echo $count; ?>" type="checkbox" name="check[]" <?php echo ($file['is_writable']?'':'disabled'); ?> class="radio" value="<?php echo $file['path']; ?>" />
|
||||
<a <?php echo ($file['cssClass']== 'filePicture'?'rel="orgImg"':''); ?> href="<?php echo $file['path']; ?>" title="<?php echo $file['name']; ?>" id="a<?php echo $count; ?>"><?php echo shortenFileName($file['name']); ?></a></dd>
|
||||
|
||||
</dl>
|
||||
<?php
|
||||
$count++;
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
@@ -1,17 +0,0 @@
|
||||
<?php
|
||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
|
||||
require_once('../../config/config.inc.php');
|
||||
require_once('../init.php');
|
||||
?>
|
||||
<select class="input inputSearch" name="search_folder" id="search_folder">
|
||||
<?php
|
||||
|
||||
foreach(getFolderListing(CONFIG_SYS_ROOT_PATH) as $k=>$v)
|
||||
{
|
||||
?>
|
||||
<option value="<?php echo $v; ?>" ><?php echo shortenFileName($k, 30); ?></option>
|
||||
<?php
|
||||
}
|
||||
|
||||
?>
|
||||
</select>
|
||||
@@ -1,75 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* create a folder
|
||||
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
|
||||
* @link www.phpletter.com
|
||||
* @since 22/May/2007
|
||||
*
|
||||
*/
|
||||
require_once('../../config/config.inc.php');
|
||||
require_once('../init.php');
|
||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
|
||||
@ob_start();
|
||||
displayArray($_POST);
|
||||
writeInfo(@ob_get_clean());
|
||||
echo "{";
|
||||
$error = "";
|
||||
$info = "";
|
||||
/* $_POST['new_folder'] = substr(md5(time()), 1, 5);
|
||||
$_POST['currentFolderPath'] = "../../uploaded/";*/
|
||||
if(CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_NEWFOLDER)
|
||||
{
|
||||
$error = SYS_DISABLED;
|
||||
}
|
||||
elseif(empty($_POST['new_folder']))
|
||||
{
|
||||
$error = ERR_FOLDER_NAME_EMPTY;
|
||||
}elseif(!preg_match("/^[a-zA-Z0-9_\- ]+$/", $_POST['new_folder']))
|
||||
{
|
||||
$error = ERR_FOLDER_FORMAT;
|
||||
}else if(empty($_POST['currentFolderPath']) || !isUnderRoot($_POST['currentFolderPath']))
|
||||
{
|
||||
$error = ERR_FOLDER_PATH_NOT_ALLOWED;
|
||||
}
|
||||
elseif(file_exists(addTrailingSlash($_POST['currentFolderPath']) . $_POST['new_folder']))
|
||||
{
|
||||
$error = ERR_FOLDER_EXISTS;
|
||||
}else
|
||||
{
|
||||
include_once(CLASS_FILE);
|
||||
$file = new file();
|
||||
if($file->mkdir(addTrailingSlash($_POST['currentFolderPath']) . $_POST['new_folder'], 0775))
|
||||
{
|
||||
include_once(CLASS_MANAGER);
|
||||
$manager = new manager(addTrailingSlash($_POST['currentFolderPath']) . $_POST['new_folder'], false);
|
||||
$pathInfo = $manager->getFolderInfo(addTrailingSlash($_POST['currentFolderPath']) . $_POST['new_folder']);
|
||||
foreach($pathInfo as $k=>$v)
|
||||
{
|
||||
switch ($k)
|
||||
{
|
||||
|
||||
|
||||
case "ctime";
|
||||
case "mtime":
|
||||
case "atime":
|
||||
$v = date(DATE_TIME_FORMAT, $v);
|
||||
break;
|
||||
case 'name':
|
||||
$info .= sprintf(", %s:'%s'", 'short_name', shortenFileName($v));
|
||||
break;
|
||||
case 'cssClass':
|
||||
$v = 'folderEmpty';
|
||||
break;
|
||||
}
|
||||
$info .= sprintf(", %s:'%s'", $k, $v);
|
||||
}
|
||||
}else
|
||||
{
|
||||
$error = ERR_FOLDER_CREATION_FAILED;
|
||||
}
|
||||
//$error = "For security reason, folder creation function has been disabled.";
|
||||
}
|
||||
echo "error:'" . $error . "'";
|
||||
echo $info;
|
||||
echo "}";
|
||||
?>
|
||||
@@ -1,79 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* delete selected files
|
||||
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
|
||||
* @link www.phpletter.com
|
||||
* @since 22/April/2007
|
||||
*
|
||||
*/
|
||||
require_once('../../config/config.inc.php');
|
||||
require_once('../init.php');
|
||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
|
||||
$error = "";
|
||||
if(CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_DELETE)
|
||||
{
|
||||
$error = SYS_DISABLED;
|
||||
}
|
||||
elseif(!empty($_GET['delete']))
|
||||
{//delete the selected file from context menu
|
||||
if(!file_exists($_GET['delete']))
|
||||
{
|
||||
$error = ERR_FILE_NOT_AVAILABLE;
|
||||
}
|
||||
elseif(!isUnderRoot($_GET['delete']))
|
||||
{
|
||||
$error = ERR_FOLDER_PATH_NOT_ALLOWED;
|
||||
}else
|
||||
{
|
||||
include_once(CLASS_FILE);
|
||||
$file = new file();
|
||||
if(is_dir($_GET['delete'])
|
||||
&& isValidPattern(CONFIG_SYS_INC_DIR_PATTERN, getBaseName($_GET['delete']))
|
||||
&& !isInvalidPattern(CONFIG_SYS_EXC_DIR_PATTERN, getBaseName($_GET['delete'])))
|
||||
{
|
||||
$file->delete(addTrailingSlash(backslashToSlash($_GET['delete'])));
|
||||
}elseif(is_file($_GET['delete'])
|
||||
&& isValidPattern(CONFIG_SYS_INC_FILE_PATTERN, getBaseName($_GET['delete']))
|
||||
&& !isInvalidPattern(CONFIG_SYS_EXC_FILE_PATTERN, getBaseName($_GET['delete']))
|
||||
)
|
||||
{
|
||||
$file->delete(($_GET['delete']));
|
||||
}
|
||||
}
|
||||
}else
|
||||
{
|
||||
if(!isset($_POST['selectedDoc']) || !is_array($_POST['selectedDoc']) || sizeof($_POST['selectedDoc']) < 1)
|
||||
{
|
||||
$error = ERR_NOT_FILE_SELECTED;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
include_once(CLASS_FILE);
|
||||
$file = new file();
|
||||
|
||||
foreach($_POST['selectedDoc'] as $doc)
|
||||
{
|
||||
if(file_exists($doc) && isUnderRoot($doc))
|
||||
{
|
||||
if(is_dir($doc)
|
||||
&& isValidPattern(CONFIG_SYS_INC_DIR_PATTERN, $doc)
|
||||
&& !isInvalidPattern(CONFIG_SYS_EXC_DIR_PATTERN, $doc))
|
||||
{
|
||||
$file->delete(addTrailingSlash(backslashToSlash($doc)));
|
||||
}elseif(is_file($doc)
|
||||
&& isValidPattern(CONFIG_SYS_INC_FILE_PATTERN, $doc)
|
||||
&& !isInvalidPattern(CONFIG_SYS_EXC_FILE_PATTERN, $doc)
|
||||
)
|
||||
{
|
||||
$file->delete($doc);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo "{error:'" . $error . "'}";
|
||||
?>
|
||||
@@ -1,33 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* delete selected files
|
||||
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
|
||||
* @link www.phpletter.com
|
||||
* @since 22/April/2007
|
||||
*
|
||||
*/
|
||||
require_once('../../config/config.inc.php');
|
||||
require_once('../init.php');
|
||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
|
||||
if(!empty($_GET['path']) && file_exists($_GET['path']) && is_file($_GET['path']) && isUnderRoot($_GET['path']))
|
||||
{
|
||||
|
||||
$path = $_GET['path'];
|
||||
//check if the file size
|
||||
$fileSize = @filesize($path);
|
||||
|
||||
if($fileSize > getMemoryLimit())
|
||||
{//larger then the php memory limit, redirect to the file
|
||||
|
||||
header('Location: ' . $path);
|
||||
exit;
|
||||
}else
|
||||
{//open it up and send out with php
|
||||
downloadFile($path);
|
||||
|
||||
}
|
||||
}else
|
||||
{
|
||||
die(ERR_DOWNLOAD_FILE_NOT_FOUND);
|
||||
}
|
||||
?>
|
||||
@@ -1,118 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* reset the image
|
||||
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
|
||||
* @link www.phpletter.com
|
||||
* @since 22/May/2007
|
||||
*
|
||||
*/
|
||||
require_once('../../config/config.inc.php');
|
||||
require_once('../init.php');
|
||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
|
||||
if(!isset($_POST['path']))
|
||||
{
|
||||
$_POST['path'] = "uploaded/Winter.jpg" . "?" . makeQueryString(array('path'));
|
||||
//for crop
|
||||
$_POST['mode'] = "crop";
|
||||
$_POST['x'] = 100;
|
||||
$_POST['y'] = 100;
|
||||
$imageInfo = @GetImageSize($_POST['path']);
|
||||
$_POST['width'] = $imageInfo[0];
|
||||
$_POST['height'] = $imageInfo[1];
|
||||
|
||||
}
|
||||
initSessionHistory($_POST['path']);
|
||||
|
||||
echo "{";
|
||||
$error = "";
|
||||
$info = "";
|
||||
|
||||
if(empty($_POST['path']))
|
||||
{
|
||||
$error = IMG_SAVE_EMPTY_PATH;
|
||||
}elseif(!file_exists($_POST['path']))
|
||||
{
|
||||
$error = IMG_SAVE_NOT_EXISTS;
|
||||
}else if(!isUnderRoot($_POST['path']))
|
||||
{
|
||||
$error = IMG_SAVE_PATH_DISALLOWED;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!empty($_POST['mode']))
|
||||
{
|
||||
|
||||
include_once(CLASS_IMAGE);
|
||||
$image = new Image();
|
||||
$image->loadImage($_POST['path']);
|
||||
|
||||
switch($_POST['mode'])
|
||||
{
|
||||
case "resize":
|
||||
if(!$image->resize($_POST['width'], $_POST['height'], (!empty($_POST['constraint'])?true:false)))
|
||||
{
|
||||
$error = IMG_SAVE_RESIZE_FAILED;
|
||||
}
|
||||
break;
|
||||
case "crop":
|
||||
if(!$image->cropToDimensions($_POST['x'], $_POST['y'], (int)($_POST['x']) + (int)($_POST['width']), (int)($_POST['y']) + (int)($_POST['height'])))
|
||||
{
|
||||
$error = IMG_SAVE_CROP_FAILED;
|
||||
}
|
||||
|
||||
break;
|
||||
case "flip":
|
||||
if(!$image->flip($_POST['flip_angle']))
|
||||
{
|
||||
$error = IMG_SAVE_FLIP_FAILED;
|
||||
}
|
||||
break;
|
||||
case "rotate":
|
||||
if(!$image->rotate((int)($_POST['angle'])))
|
||||
{
|
||||
$error = IMG_SAVE_ROTATE_FAILED;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
$error = IMG_SAVE_UNKNOWN_MODE;
|
||||
}
|
||||
if(empty($error))
|
||||
{
|
||||
|
||||
$sessionNewPath = $session->getSessionDir() . uniqid(md5(time())) . "." . getFileExt($_POST['path']);
|
||||
if(!@copy($_POST['path'], $sessionNewPath))
|
||||
{
|
||||
$error = IMG_SAVE_BACKUP_FAILED;
|
||||
}else
|
||||
{
|
||||
addSessionHistory($_POST['path'], $sessionNewPath);
|
||||
if($image->saveImage($_POST['path']))
|
||||
{
|
||||
$imageInfo = $image->getFinalImageInfo();
|
||||
$info .= ",width:" . $imageInfo['width'] . "\n";
|
||||
$info .= ",height:" . $imageInfo['height'] . "\n";
|
||||
$info .= ",size:'" . transformFileSize($imageInfo['size']) . "'\n";
|
||||
}else
|
||||
{
|
||||
$error = IMG_SAVE_FAILED;
|
||||
}
|
||||
}
|
||||
}else
|
||||
{
|
||||
//$image->DestroyImages();
|
||||
}
|
||||
}else
|
||||
{
|
||||
$error = IMG_SAVE_UNKNOWN_MODE;
|
||||
}
|
||||
}
|
||||
|
||||
echo "error:'" . $error . "'\n";
|
||||
if(isset($image) && is_object($image))
|
||||
{
|
||||
$image->DestroyImages();
|
||||
}
|
||||
echo $info;
|
||||
echo ",history:" . sizeof($_SESSION[$_POST['path']]) . "\n";
|
||||
echo "}";
|
||||
?>
|
||||
@@ -1,35 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* copy file
|
||||
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
|
||||
* @link www.phpletter.com
|
||||
* @since 22/May/2007
|
||||
*
|
||||
*/
|
||||
require_once('../../config/config.inc.php');
|
||||
require_once('../init.php');
|
||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
|
||||
$error = "";
|
||||
$info = '';
|
||||
if(CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_COPY)
|
||||
{
|
||||
$error = SYS_DISABLED;
|
||||
}
|
||||
elseif(!isset($_POST['selectedDoc']) || !is_array($_POST['selectedDoc']) || sizeof($_POST['selectedDoc']) < 1)
|
||||
{
|
||||
$error = ERR_NOT_DOC_SELECTED_FOR_COPY;
|
||||
}
|
||||
elseif(empty($_POST['currentFolderPath']) || !isUnderRoot($_POST['currentFolderPath']))
|
||||
{
|
||||
$error = ERR_FOLDER_PATH_NOT_ALLOWED;
|
||||
}else
|
||||
{
|
||||
require_once(CLASS_SESSION_ACTION);
|
||||
$sessionAction = new SessionAction();
|
||||
$sessionAction->setAction($_POST['action_value']);
|
||||
$sessionAction->setFolder($_POST['currentFolderPath']);
|
||||
$sessionAction->set($_POST['selectedDoc']);
|
||||
$info = ',num:' . sizeof($_POST['selectedDoc']);
|
||||
}
|
||||
echo "{error:'" . $error . "'\n" . $info . "}";
|
||||
?>
|
||||
@@ -1,36 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* cut file
|
||||
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
|
||||
* @link www.phpletter.com
|
||||
* @since 22/May/2007
|
||||
*
|
||||
*/
|
||||
require_once('../../config/config.inc.php');
|
||||
require_once('../init.php');
|
||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
|
||||
|
||||
$error = "";
|
||||
$info = '';
|
||||
if(CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_CUT)
|
||||
{
|
||||
$error = SYS_DISABLED;
|
||||
}
|
||||
elseif(!isset($_POST['selectedDoc']) || !is_array($_POST['selectedDoc']) || sizeof($_POST['selectedDoc']) < 1)
|
||||
{
|
||||
$error = ERR_NOT_DOC_SELECTED_FOR_CUT;
|
||||
}
|
||||
elseif(empty($_POST['currentFolderPath']) || !isUnderRoot($_POST['currentFolderPath']))
|
||||
{
|
||||
$error = ERR_FOLDER_PATH_NOT_ALLOWED;
|
||||
}else
|
||||
{
|
||||
require_once(CLASS_SESSION_ACTION);
|
||||
$sessionAction = new SessionAction();
|
||||
$sessionAction->setAction($_POST['action_value']);
|
||||
$sessionAction->setFolder($_POST['currentFolderPath']);
|
||||
$sessionAction->set($_POST['selectedDoc']);
|
||||
$info = ',num:' . sizeof($_POST['selectedDoc']);
|
||||
}
|
||||
echo "{error:'" . $error . "'\n" . $info . "}";
|
||||
?>
|
||||
@@ -1,140 +0,0 @@
|
||||
<?
|
||||
include_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
|
||||
require_once('../../config/config.inc.php');
|
||||
require_once('../init.php');
|
||||
$error = '';
|
||||
$fileMoved = array();
|
||||
$unmovedDocDueToSamePath = array();
|
||||
if(CONFIG_SYS_VIEW_ONLY || (!CONFIG_OPTIONS_CUT && !CONFIG_OPTIONS_COPY))
|
||||
{
|
||||
$error = SYS_DISABLED;
|
||||
}
|
||||
elseif(empty($_GET['current_folder_path']))
|
||||
{
|
||||
$error = ERR_NOT_DEST_FOLDER_SPECIFIED;
|
||||
}elseif(!file_exists($_GET['current_folder_path']) || !is_dir($_GET['current_folder_path']))
|
||||
{
|
||||
$error = ERR_DEST_FOLDER_NOT_FOUND;
|
||||
}elseif(!isUnderRoot($_GET['current_folder_path']))
|
||||
{
|
||||
$error = ERR_DEST_FOLDER_NOT_ALLOWED;
|
||||
}else
|
||||
{
|
||||
|
||||
include_once(CLASS_MANAGER);
|
||||
include_once(CLASS_SESSION_ACTION);
|
||||
$sessionAction = new SessionAction();
|
||||
include_once(DIR_AJAX_INC . "class.manager.php");
|
||||
$manager = new manager();
|
||||
$manager->setSessionAction($sessionAction);
|
||||
$selectedDocuments = $sessionAction->get();
|
||||
|
||||
$destFolderPath = addTrailingSlash(backslashToSlash($_GET['current_folder_path']));
|
||||
|
||||
|
||||
if(sizeof($selectedDocuments))
|
||||
{
|
||||
//get all files within the destination folder
|
||||
$allDocs = array();
|
||||
if(($fh = @opendir($_GET['current_folder_path'])))
|
||||
{
|
||||
while(($file = readdir($fh)) && $file != '.' && $file != '..')
|
||||
{
|
||||
$allDocs[] = getRealPath($destFolderPath . $file);
|
||||
}
|
||||
}
|
||||
closedir($fh);
|
||||
include_once(CLASS_FILE);
|
||||
$file = new file();
|
||||
//check if all files are allowed to cut or copy
|
||||
|
||||
foreach($selectedDocuments as $doc)
|
||||
{
|
||||
if(file_exists($doc) && isUnderRoot($doc) )
|
||||
{
|
||||
|
||||
if( array_search(getRealPath($doc), $allDocs) === false || CONFIG_OVERWRITTEN)
|
||||
{
|
||||
if(CONFIG_OVERWRITTEN)
|
||||
{
|
||||
$file->delete($doc);
|
||||
}
|
||||
if($file->copyTo($doc, $_GET['current_folder_path']))
|
||||
{
|
||||
|
||||
$finalPath = $destFolderPath . basename($doc);
|
||||
$objFile = new file($finalPath);
|
||||
$tem = $objFile->getFileInfo();
|
||||
$obj = new manager($finalPath, false);
|
||||
|
||||
$fileType = $obj->getFileType($finalPath, (is_dir($finalPath)?true:false));
|
||||
|
||||
foreach($fileType as $k=>$v)
|
||||
{
|
||||
$tem[$k] = $v;
|
||||
}
|
||||
|
||||
/* foreach ($folderInfo as $k=>$v)
|
||||
{
|
||||
$tem['i_' . $k] = $v;
|
||||
}
|
||||
if($folderInfo['type'] == 'folder' && empty($folderInfo['subdir']) && empty($folderInfo['file']))
|
||||
{
|
||||
$tem['cssClass'] = 'folderEmpty';
|
||||
}*/
|
||||
|
||||
$tem['final_path'] = $finalPath;
|
||||
$tem['path'] = backslashToSlash($finalPath);
|
||||
$tem['type'] = (is_dir($finalPath)?'folder':'file');
|
||||
$tem['size'] = @transformFileSize($tem['size']);
|
||||
$tem['ctime'] = date(DATE_TIME_FORMAT, $tem['ctime']);
|
||||
$tem['mtime'] = date(DATE_TIME_FORMAT, $tem['mtime']);
|
||||
$tem['flag'] = 'noFlag';
|
||||
$tem['url'] = getFileUrl($doc);
|
||||
|
||||
$manager = null;
|
||||
if($sessionAction->getAction() == "cut")
|
||||
{
|
||||
$file->delete($doc);
|
||||
}
|
||||
$fileMoved[sizeof($fileMoved)] = $tem;
|
||||
$tem = null;
|
||||
}
|
||||
}else
|
||||
{
|
||||
$unmovedDocDueToSamePath[] = $doc;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$sessionAction->set(array());
|
||||
}
|
||||
if(sizeof($unmovedDocDueToSamePath) == sizeof($selectedDocuments))
|
||||
{
|
||||
$error = ERR_DEST_FOLDER_NOT_ALLOWED;
|
||||
}elseif(sizeof($unmovedDocDueToSamePath))
|
||||
{
|
||||
foreach($unmovedDocDueToSamePath as $v)
|
||||
{
|
||||
$error .= sprintf(ERR_UNABLE_TO_MOVE_TO_SAME_DEST, $v) . "\r\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo "{'error':'" . $error . "', 'unmoved_files':" . sizeof($unmovedDocDueToSamePath) . ", 'files':{";
|
||||
foreach($fileMoved as $i=>$file)
|
||||
{
|
||||
|
||||
echo ($i>0?', ':' ') . $i . ": { ";
|
||||
$j = 0;
|
||||
foreach($file as $k=>$v)
|
||||
{
|
||||
echo ($j++ > 0? ", ":'') . "'" . $k . "':'" . $v . "'";
|
||||
|
||||
}
|
||||
echo "} ";
|
||||
}
|
||||
echo "} }";
|
||||
|
||||
?>
|
||||
@@ -1,90 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* processing the uploaded files
|
||||
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
|
||||
* @link www.phpletter.com
|
||||
* @since 22/May/2007
|
||||
*
|
||||
*/
|
||||
|
||||
require_once('../../config/config.inc.php');
|
||||
require_once('../init.php');
|
||||
|
||||
sleep(3);
|
||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
|
||||
echo "{";
|
||||
$error = "";
|
||||
$info = "";
|
||||
|
||||
include_once(CLASS_UPLOAD);
|
||||
$upload = new Upload();
|
||||
|
||||
$upload->setInvalidFileExt(explode(",", CONFIG_UPLOAD_INVALID_EXTS));
|
||||
if(CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_UPLOAD)
|
||||
{
|
||||
$error = SYS_DISABLED;
|
||||
}
|
||||
elseif(empty($_GET['folder']) || !isUnderRoot($_GET['folder']))
|
||||
{
|
||||
$error = ERR_FOLDER_PATH_NOT_ALLOWED;
|
||||
}else if(!$upload->isFileUploaded('file'))
|
||||
{
|
||||
$error = ERR_FILE_NOT_UPLOADED;
|
||||
}else if(!$upload->moveUploadedFile($_GET['folder']))
|
||||
{
|
||||
$error = ERR_FILE_MOVE_FAILED;
|
||||
}
|
||||
elseif(!$upload->isPermittedFileExt(explode(",", CONFIG_UPLOAD_VALID_EXTS)))
|
||||
{
|
||||
$error = ERR_FILE_TYPE_NOT_ALLOWED;
|
||||
}elseif(defined('CONFIG_UPLOAD_MAXSIZE') && CONFIG_UPLOAD_MAXSIZE && $upload->isSizeTooBig(CONFIG_UPLOAD_MAXSIZE))
|
||||
{
|
||||
$error = sprintf(ERROR_FILE_TOO_BID, transformFileSize(CONFIG_UPLOAD_MAXSIZE));
|
||||
}else
|
||||
{
|
||||
include_once(CLASS_FILE);
|
||||
$path = $upload->getFilePath();
|
||||
$obj = new file($path);
|
||||
$tem = $obj->getFileInfo();
|
||||
if(sizeof($tem))
|
||||
{
|
||||
include_once(CLASS_MANAGER);
|
||||
|
||||
$manager = new manager($upload->getFilePath(), false);
|
||||
|
||||
$fileType = $manager->getFileType($upload->getFileName());
|
||||
|
||||
foreach($fileType as $k=>$v)
|
||||
{
|
||||
$tem[$k] = $v;
|
||||
}
|
||||
|
||||
$tem['path'] = backslashToSlash($path);
|
||||
$tem['type'] = "file";
|
||||
$tem['size'] = transformFileSize($tem['size']);
|
||||
$tem['ctime'] = date(DATE_TIME_FORMAT, $tem['ctime']);
|
||||
$tem['mtime'] = date(DATE_TIME_FORMAT, $tem['mtime']);
|
||||
$tem['short_name'] = shortenFileName($tem['name']);
|
||||
$tem['flag'] = 'noFlag';
|
||||
$obj->close();
|
||||
foreach($tem as $k=>$v)
|
||||
{
|
||||
$info .= sprintf(", %s:'%s'", $k, $v);
|
||||
}
|
||||
|
||||
$info .= sprintf(", url:'%s'", getFileUrl($path));
|
||||
$info .= sprintf(", tipedit:'%s'", TIP_DOC_RENAME);
|
||||
|
||||
|
||||
}else
|
||||
{
|
||||
$error = ERR_FILE_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
echo "error:'" . $error . "'";
|
||||
echo $info;
|
||||
echo "}";
|
||||
|
||||
?>
|
||||
@@ -1,139 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* the php script used to get the list of file or folders under a specific folder
|
||||
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
|
||||
* @link www.phpletter.com
|
||||
* @since 22/May/2007
|
||||
*
|
||||
*/
|
||||
require_once('../../config/config.inc.php');
|
||||
require_once('../init.php');
|
||||
|
||||
if(!isset($manager))
|
||||
{
|
||||
/**
|
||||
* this is part of script for processing file paste
|
||||
*/
|
||||
//$_GET = $_POST;
|
||||
include_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
|
||||
include_once(CLASS_PAGINATION);
|
||||
$pagination = new pagination(false);
|
||||
if(!empty($_GET['search']))
|
||||
{
|
||||
include_once(CLASS_SEARCH);
|
||||
|
||||
$search = new Search($_GET['search_folder']);
|
||||
$search->addSearchKeyword('recursive', @$_GET['search_recursively']);
|
||||
$search->addSearchKeyword('mtime_from', @$_GET['search_mtime_from']);
|
||||
$search->addSearchKeyword('mtime_to', @$_GET['search_mtime_to']);
|
||||
$search->addSearchKeyword('size_from', @$_GET['search_size_from']);
|
||||
$search->addSearchKeyword('size_to', @$_GET['search_size_to']);
|
||||
$search->addSearchKeyword('recursive', @$_GET['search_recursively']);
|
||||
$search->addSearchKeyword('name', @$_GET['search_name']);
|
||||
$search->doSearch();
|
||||
$fileList = $search->getFoundFiles();
|
||||
$folderInfo = $search->getRootFolderInfo();
|
||||
|
||||
}else
|
||||
{
|
||||
include_once(CLASS_MANAGER);
|
||||
include_once(CLASS_SESSION_ACTION);
|
||||
$sessionAction = new SessionAction();
|
||||
include_once(DIR_AJAX_INC . "class.manager.php");
|
||||
|
||||
$manager = new manager();
|
||||
$manager->setSessionAction($sessionAction);
|
||||
|
||||
$fileList = $manager->getFileList();
|
||||
$folderInfo = $manager->getFolderInfo();
|
||||
|
||||
}
|
||||
$pagination->setUrl(CONFIG_URL_FILEnIMAGE_MANAGER);
|
||||
|
||||
}else
|
||||
{
|
||||
include_once(CLASS_PAGINATION);
|
||||
$pagination = new pagination(false);
|
||||
}
|
||||
|
||||
|
||||
$pagination->setTotal(sizeof($fileList));
|
||||
$pagination->setFirstText(PAGINATION_FIRST);
|
||||
$pagination->setPreviousText(PAGINATION_PREVIOUS);
|
||||
$pagination->setNextText(PAGINATION_NEXT);
|
||||
$pagination->setLastText(PAGINATION_LAST);
|
||||
$pagination->setLimit(!empty($_GET['limit'])?(int)($_GET['limit']):CONFIG_DEFAULT_PAGINATION_LIMIT);
|
||||
echo $pagination->getPaginationHTML();
|
||||
echo "<script type=\"text/javascript\">\n";
|
||||
|
||||
echo "parentFolder = {path:'" . getParentFolderPath($folderInfo['path']). "'};\n";
|
||||
echo 'currentFolder ={';
|
||||
$count =1;
|
||||
foreach($folderInfo as $k=>$v)
|
||||
{
|
||||
echo ($count++ == 1?'':',') . "'" . $k . "':'" . ($k=='ctime'|| $k=='mtime'?date(DATE_TIME_FORMAT, $v):$v) . "'";
|
||||
|
||||
}
|
||||
echo "};\n";
|
||||
$fileList = array_slice($fileList, $pagination->getPageOffset(), $pagination->getLimit());
|
||||
echo 'numRows = ' . sizeof($fileList) . ";\n";
|
||||
echo "files = {\n";
|
||||
$count = 1;
|
||||
|
||||
|
||||
foreach($fileList as $file)
|
||||
{
|
||||
echo (($count > 1)?",":'').$count++ . ":{";
|
||||
$j = 1;
|
||||
foreach($file as $k=>$v)
|
||||
{
|
||||
|
||||
if($k == 'ctime' || $k == 'mtime')
|
||||
{
|
||||
$v = @date(DATE_TIME_FORMAT, $v);
|
||||
}
|
||||
if($k == 'size')
|
||||
{
|
||||
$v = transformFileSize($v);
|
||||
}
|
||||
echo (($j++ > 1)?",":'') . "'" . $k . "':'" . $v . "'";
|
||||
}
|
||||
echo (($j++ > 1)?",":'') . "'url':'" . getFileUrl($file['path']) . "'";
|
||||
echo "}\n";
|
||||
}
|
||||
echo "};</script>\n";
|
||||
if(!empty($_GET['view']))
|
||||
{
|
||||
switch($_GET['view'])
|
||||
{
|
||||
case 'detail':
|
||||
case 'thumbnail':
|
||||
case 'text':
|
||||
$view = $_GET['view'];
|
||||
break;
|
||||
default:
|
||||
$view = CONFIG_DEFAULT_VIEW;
|
||||
}
|
||||
}else
|
||||
{
|
||||
$view = CONFIG_DEFAULT_VIEW;
|
||||
}
|
||||
switch($view)
|
||||
{
|
||||
case 'text':
|
||||
//list file name only
|
||||
include_once(DIR_AJAX_ROOT . '_ajax_get_text_listing.php');
|
||||
break;
|
||||
case 'thumbnail':
|
||||
//list file with thumbnail
|
||||
include_once(DIR_AJAX_ROOT . '_ajax_get_thumbnail_listing.php');
|
||||
break;
|
||||
case 'detail':
|
||||
default:
|
||||
include_once(DIR_AJAX_ROOT . '_ajax_get_details_listing.php');
|
||||
}
|
||||
|
||||
|
||||
|
||||
?>
|
||||
@@ -1,15 +0,0 @@
|
||||
<?php
|
||||
require_once('../../config/config.inc.php');
|
||||
require_once('../init.php');
|
||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
|
||||
echo '{';
|
||||
$count = 1;
|
||||
foreach(getFolderListing(CONFIG_SYS_ROOT_PATH) as $k=>$v)
|
||||
{
|
||||
|
||||
|
||||
echo (($count > 1)?', ':''). "'" . $v . "':'" . $k . "'";
|
||||
$count++;
|
||||
}
|
||||
echo "}";
|
||||
?>
|
||||
@@ -1,210 +0,0 @@
|
||||
<?php
|
||||
require_once('../../config/config.inc.php');
|
||||
require_once('../init.php');
|
||||
/**
|
||||
* Ajax image editor platform
|
||||
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
|
||||
* @link www.phpletter.com
|
||||
* @since 22/May/2007
|
||||
*
|
||||
*/
|
||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
|
||||
if(CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_EDITABLE)
|
||||
{
|
||||
die(SYS_DISABLED);
|
||||
}
|
||||
//$session->gc();
|
||||
$_GET['path'] = empty($_GET['path'])?CONFIG_SYS_ROOT_PATH . "ajax_image_editor_demo.jpg":$_GET['path'];
|
||||
if(!empty($_GET['path']) && file_exists($_GET['path']) && is_file($_GET['path']) && isUnderRoot($_GET['path']))
|
||||
{
|
||||
$path = $_GET['path'];
|
||||
}else
|
||||
{
|
||||
die(IMG_GEN_IMG_NOT_EXISTS);
|
||||
}
|
||||
require_once(CLASS_HISTORY);
|
||||
$history = new History($path, $session);
|
||||
if(CONFIG_SYS_DEMO_ENABLE)
|
||||
{
|
||||
$sessionImageInfo = $history->getLastestRestorable();
|
||||
$originalSessionImageInfo = $history->getOriginalImage();
|
||||
if(sizeof($originalSessionImageInfo))
|
||||
{
|
||||
$path = backslashToSlash($session->getSessionDir() . $originalSessionImageInfo['info']['name']);
|
||||
}
|
||||
}
|
||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "class.image.php");
|
||||
$image = new Image();
|
||||
|
||||
$imageInfo = $image->getImageInfo($path);
|
||||
|
||||
?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="author" content="Logan Cai" />
|
||||
<meta name="website" content="http://www.phpletter.com" />
|
||||
<script type="text/javascript" src="jscripts/ajaximageeditor_c.js"></script>
|
||||
<!--
|
||||
<script type="text/javascript" src="jscripts/jquery.js"></script>
|
||||
<script type="text/javascript" src="jscripts/form.js"></script>
|
||||
<script type="text/javascript" src="jscripts/select.js"></script>
|
||||
<script type="text/javascript" src="jscripts/jqModal.js"></script>
|
||||
<script type="text/javascript" src="jscripts/rotate.js"></script>
|
||||
<script type="text/javascript" src="jscripts/interface.js"></script>
|
||||
|
||||
-->
|
||||
<script type="text/javascript" src="jscripts/ajaximageeditor.js"></script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
var imageHistory = false;
|
||||
var currentFolder = '<?php echo removeTrailingSlash(backslashToSlash(dirname($path))); ?>';
|
||||
var warningLostChanges = '<?php echo IMG_WARNING_LOST_CHANAGES; ?>';
|
||||
var warningReset = '<?php echo IMG_WARNING_REST; ?>';
|
||||
var warningResetEmpty = '<?php echo IMG_WARNING_EMPTY_RESET; ?>';
|
||||
var warningEditorClose = '<?php echo IMG_WARING_WIN_CLOSE; ?>';
|
||||
var warningUndoImage = '<?php echo IMG_WARNING_UNDO; ?>';
|
||||
var warningFlipHorizotal = '<?php echo IMG_WARING_FLIP_H; ?>';
|
||||
var warningFlipVertical = '<?php echo IMG_WARING_FLIP_V; ?>';
|
||||
var numSessionHistory = <?php echo $history->getNumRestorable(); ?>;
|
||||
var noChangeMadeBeforeSave = '<?php echo IMG_WARNING_NO_CHANGE_BEFORE_SAVE; ?>';
|
||||
var warningInvalidNewName = '<?php echo IMG_SAVE_AS_ERR_NAME_INVALID; ?>';
|
||||
var wordCloseWindow = '<?php echo LBL_ACTION_CLOSE; ?>';
|
||||
var warningNoFolderSelected = '<?php echo IMG_SAVE_AS_NOT_FOLDER_SELECTED; ?>';
|
||||
var urlGetFolderList = '<?php echo appendQueryString(CONFIG_URL_GET_FOLDER_LIST, makeQueryString(array('path'))); ?>';
|
||||
$(document).ready(
|
||||
function()
|
||||
{
|
||||
$('#windowSaveAs').jqm();
|
||||
$('#image_mode').val('');
|
||||
$('#angle').val(0);
|
||||
$(getImageElement()).clone().appendTo("#hiddenImage");
|
||||
changeMode();
|
||||
initDisabledButtons(true);
|
||||
}
|
||||
);
|
||||
|
||||
</script>
|
||||
<link href="theme/<?php echo CONFIG_THEME_NAME; ?>/css/ajaximageeditor.css" type="text/css" rel="stylesheet" />
|
||||
<link href="theme/<?php echo CONFIG_THEME_NAME; ?>/css/jqModal.css" type="text/css" rel="stylesheet" />
|
||||
<title>Ajax Image Editor</title>
|
||||
</head>
|
||||
<body>
|
||||
<?php
|
||||
//displayArray($_SESSION);
|
||||
|
||||
?>
|
||||
<div id="controls">
|
||||
<fieldset id="modes">
|
||||
<legend>Modes</legend>
|
||||
<form name="formAction" id="formAction" method="post" action="<?php echo appendQueryString(CONFIG_URL_IMAGE_UNDO, makeQueryString(array('path'))); ?>">
|
||||
<input type="hidden" name="file_path" id="file_path" value="<?php echo $_GET['path']; ?>" />
|
||||
|
||||
<p><label><?php echo IMG_MODE_RESIZE; ?></label> <input type="radio" name="mode" value="resize" class="input" checked="checked" onclick="return changeMode();"/>
|
||||
<label><?php echo IMG_MODE_CROP; ?></label> <input type="radio" name="mode" value="crop" class="input" onclick="return changeMode();" />
|
||||
<label><?php echo IMG_MODE_ROTATE; ?></label> <input type="radio" name="mode" value="rotate" class="input" onclick="return changeMode();" />
|
||||
<label><?php echo IMG_MODE_FLIP; ?></label> <input type="radio" name="mode" value="flip" class="input" onclick="return changeMode();" />
|
||||
<label><?php echo IMG_CHECKBOX_CONSTRAINT; ?></label> <input type="checkbox" name="constraint" id="constraint" value="1" class="input" onclick="return toggleConstraint();" />
|
||||
<!-- <label>Watermark:</label> <input type="radio" name="mode" value="watermark" class="input" onclick="return false;" />-->
|
||||
|
||||
<button id="actionRotateLeft" class="disabledButton" onclick="return leftRotate();" disabled><?php echo IMG_BTN_ROTATE_LEFT; ?></button>
|
||||
<button id="actionRotateRight" class="disabledButton" onclick="return rightRotate();" disabled><?php echo IMG_BTN_ROTATE_RIGHT; ?></button>
|
||||
<button id="actionFlipH" class="disabledButton" onclick="return flipHorizontal();" disabled><?php echo IMG_BTN_FLIP_H; ?></button>
|
||||
<button id="actionFlipV" class="disabledButton" onclick="return flipVertical();" disabled><?php echo IMG_BTN_FLIP_V; ?></button>
|
||||
<button id="actionReset" class="button" onclick="return resetEditor();"><?php echo IMG_BTN_RESET; ?></button>
|
||||
<button id="actionUndo" class="button" onclick="return undoImage();"><?php echo IMG_BTN_UNDO; ?></button>
|
||||
<button id="actionSave" class="button" onclick="return saveImage();"><?php echo IMG_BTN_SAVE; ?></button>
|
||||
<button id="actionSaveAs" class="button" onclick="return saveAsImagePre();"><?php echo IMG_BTN_SAVE_AS; ?></button>
|
||||
<button id="actionClose" class="button" onclick="return editorClose();"><?php echo IMG_BTN_CLOSE; ?></button></p>
|
||||
</form>
|
||||
</fieldset>
|
||||
<fieldset id="imageInfo">
|
||||
<legend id="imageInfoLegend"><?php echo IMG_INFO; ?></legend>
|
||||
<form name="formImageInfo" action="<?php echo appendQueryString(CONFIG_URL_IMAGE_SAVE, makeQueryString(array('path'))); ?>" method="post" id="formImageInfo">
|
||||
<p><input type="hidden" name="mode" id="image_mode" value="" />
|
||||
<input type="hidden" name="new_name" id="hidden_new_name" value="" />
|
||||
<input type="hidden" name="save_to" id="hidden_save_to" value="" />
|
||||
<input type="hidden" name="path" id="path" value="<?php echo $_GET['path']; ?>" />
|
||||
<input type="hidden" name="flip_angle" id="flip_angle" value="" />
|
||||
<label><?php echo IMG_LBL_WIDTH; ?></label> <input type="text" name="width" id="width" value="" class="input imageInput" />
|
||||
<label><?php echo IMG_LBL_HEIGHT; ?></label> <input type="text" name="height" id="height" value="" class="input imageInput" />
|
||||
<label><?php echo IMG_LBL_X; ?></label> <input type="text" name="x" id="x" value="" class="input imageInput"/>
|
||||
<label><?php echo IMG_LBL_Y; ?></label> <input type="text" name="y" id="y" value="" class="input imageInput"/>
|
||||
<!-- <b>Percentage:</b> <input type="text" name="percentage" id="percentage" value="" class="input imageInput"/>-->
|
||||
<label><?php echo IMG_LBL_RATIO; ?></label> <input type="text" name="ratio" id="ratio" value="" class="input imageInput"/>
|
||||
<label><?php echo IMG_LBL_ANGLE; ?></label> <input type="text" name="angle" id="angle" value="" class="input imageInput" />
|
||||
|
||||
</p>
|
||||
</form>
|
||||
</fieldset>
|
||||
</div>
|
||||
<div id="imageArea">
|
||||
<div id="imageContainer">
|
||||
<img src="<?php echo $path; ?>" name="<?php echo basename($path); ?>" width="<?php echo $imageInfo['width']; ?>" height="<?php echo $imageInfo['height']; ?>" />
|
||||
</div>
|
||||
<div id="resizeMe">
|
||||
<div id="resizeSE"></div>
|
||||
<div id="resizeE"></div>
|
||||
<div id="resizeNE"></div>
|
||||
<div id="resizeN"></div>
|
||||
<div id="resizeNW"></div>
|
||||
<div id="resizeW"></div>
|
||||
<div id="resizeSW"></div>
|
||||
<div id="resizeS"></div>
|
||||
<img id="loading" style="display:none;" src="theme/<?php echo CONFIG_THEME_NAME; ?>/images/ajaxLoading.gif" />
|
||||
</div>
|
||||
</div>
|
||||
<div id="hiddenImage">
|
||||
</div>
|
||||
<div id="windowSaveAs" class="jqmWindow" style="display:none">
|
||||
<a href="#" class="jqmClose" id="windowSaveClose"><?php echo LBL_ACTION_CLOSE; ?></a>
|
||||
<form id="formSaveAs" name="formSaveAs" action="" method="post">
|
||||
<table class="tableForm" cellpadding="0" cellspacing="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="2"><?php echo IMG_LBL_SAVE_AS; ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>
|
||||
<label><?php echo IMG_LBL_NEW_NAME; ?></label>
|
||||
</th>
|
||||
<td>
|
||||
<input type="text" id="new_name" class="input" name="new_name" value="" /> .<?php echo getFileExt($path); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
<label><?php echo IMG_LBL_SAVE_TO; ?></label>
|
||||
</th>
|
||||
<td>
|
||||
<select class="input" name="save_to" id="save_to"></select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
</th>
|
||||
<td>
|
||||
<span class="comments">*</span>
|
||||
<?php echo IMG_NEW_NAME_COMMENTS; ?>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th> </th>
|
||||
<td><input type="button" class="button" value="<?php echo IMG_BTN_SAVE_AS; ?>" onclick="return saveAsImage();" /></td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,196 +0,0 @@
|
||||
<?php
|
||||
require_once('../../config/config.inc.php');
|
||||
require_once('../init.php');
|
||||
/**
|
||||
* image save function
|
||||
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
|
||||
* @link www.phpletter.com
|
||||
* @since 22/May/2007
|
||||
*
|
||||
*/
|
||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
|
||||
|
||||
|
||||
$error = "";
|
||||
$info = "";
|
||||
if(CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_EDITABLE)
|
||||
{
|
||||
$error = SYS_DISABLED;
|
||||
}
|
||||
elseif(empty($_POST['path']))
|
||||
{
|
||||
$error = IMG_SAVE_EMPTY_PATH;
|
||||
}elseif(!file_exists($_POST['path']))
|
||||
{
|
||||
$error = IMG_SAVE_NOT_EXISTS;
|
||||
}elseif(!isUnderRoot($_POST['path']))
|
||||
{
|
||||
$error = IMG_SAVE_PATH_DISALLOWED;
|
||||
}elseif(($sessionDir = $session->getSessionDir()) == '')
|
||||
{
|
||||
$error = SESSION_PERSONAL_DIR_NOT_FOUND;
|
||||
}
|
||||
else
|
||||
{
|
||||
require_once(CLASS_HISTORY);
|
||||
$history = new History($_POST['path'], $session);
|
||||
if(!empty($_POST['mode']))
|
||||
{
|
||||
//get the original image which is the lastest session image if any when the system is in demo
|
||||
$lastestSessionImageInfo = $history->getLastestRestorable();
|
||||
if(sizeof($lastestSessionImageInfo) && CONFIG_SYS_DEMO_ENABLE)
|
||||
{
|
||||
$originalSessionImageInfo = $history->getOriginalImage();
|
||||
if(sizeof($originalSessionImageInfo))
|
||||
{
|
||||
$originalImage = $sessionDir . $originalSessionImageInfo['info']['name'];
|
||||
}
|
||||
}
|
||||
if(empty($originalImage))
|
||||
{
|
||||
$originalImage = $_POST['path'];
|
||||
}
|
||||
|
||||
include_once(CLASS_IMAGE);
|
||||
$image = new Image();
|
||||
if($image->loadImage($originalImage))
|
||||
{
|
||||
|
||||
switch($_POST['mode'])
|
||||
{
|
||||
case "resize":
|
||||
if(!$image->resize($_POST['width'], $_POST['height'], (!empty($_POST['constraint'])?true:false)))
|
||||
{
|
||||
$error = IMG_SAVE_RESIZE_FAILED;
|
||||
}
|
||||
break;
|
||||
case "crop":
|
||||
if(!$image->crop($_POST['x'], $_POST['y'], $_POST['width'], $_POST['height']))
|
||||
{
|
||||
$error = IMG_SAVE_CROP_FAILED;
|
||||
}
|
||||
break;
|
||||
case "flip":
|
||||
if(!$image->flip($_POST['flip_angle']))
|
||||
{
|
||||
$error = IMG_SAVE_FLIP_FAILED;
|
||||
}
|
||||
break;
|
||||
case "rotate":
|
||||
|
||||
if(!$image->rotate((int)($_POST['angle'])))
|
||||
{
|
||||
$error = IMG_SAVE_ROTATE_FAILED;
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
$error = IMG_SAVE_UNKNOWN_MODE;
|
||||
}
|
||||
|
||||
|
||||
if(empty($error))
|
||||
{
|
||||
$sessionNewPath = $sessionDir . uniqid(md5(time())) . "." . getFileExt($_POST['path']);
|
||||
if(!@copy($originalImage, $sessionNewPath))
|
||||
{//keep a copy under the session folder
|
||||
$error = IMG_SAVE_BACKUP_FAILED;
|
||||
}else
|
||||
{
|
||||
|
||||
$isSaveAsRequest = (!empty($_POST['new_name']) && !empty($_POST['save_to'])?true:false);
|
||||
//save the modified image
|
||||
$sessionImageInfo = array('name'=>basename($sessionNewPath), 'restorable'=>1);
|
||||
$history->add($sessionImageInfo);
|
||||
if(CONFIG_SYS_DEMO_ENABLE)
|
||||
{//demo only
|
||||
if(isset($originalSessionImageInfo) && sizeof($originalSessionImageInfo))
|
||||
{
|
||||
$imagePath = $sessionDir . $originalSessionImageInfo['info']['name'];
|
||||
}else
|
||||
{
|
||||
$imagePath = $sessionDir . uniqid(md5(time())) . "." . getFileExt($_POST['path']);
|
||||
}
|
||||
}else
|
||||
{
|
||||
if($isSaveAsRequest)
|
||||
{//save as request
|
||||
//check save to folder if exists
|
||||
$imagePath = addTrailingSlash(backslashToSlash($_POST['save_to'])) . $_POST['new_name'] . "." . getFileExt($_POST['path']);
|
||||
if(!file_exists($_POST['save_to']) || !is_dir($_POST['save_to']))
|
||||
{
|
||||
$error = IMG_SAVE_AS_FOLDER_NOT_FOUND;
|
||||
}elseif(file_exists($imagePath))
|
||||
{
|
||||
$error = IMG_SAVE_AS_NEW_IMAGE_EXISTS;
|
||||
}elseif(!preg_match("/^[a-zA-Z0-9_\- ]+$/", $_POST['new_name']))
|
||||
{
|
||||
$error = IMG_SAVE_AS_ERR_NAME_INVALID;
|
||||
}
|
||||
|
||||
}else
|
||||
{//save request
|
||||
$imagePath = $originalImage;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if($image->saveImage($imagePath))
|
||||
{
|
||||
|
||||
if(CONFIG_SYS_DEMO_ENABLE)
|
||||
{
|
||||
if(!isset($originalSessionImageInfo) || !sizeof($originalSessionImageInfo))
|
||||
{//keep this original image information on session for future reference if demo only
|
||||
$originalSessionImageInfo = array('name'=>basename($imagePath), 'restorable'=>0, 'is_original'=>1);
|
||||
$history->add($originalSessionImageInfo);
|
||||
}
|
||||
}
|
||||
$imageInfo = $image->getFinalImageInfo();
|
||||
}else
|
||||
{
|
||||
$error = IMG_SAVE_FAILED;
|
||||
|
||||
}
|
||||
if(isset($imageInfo))
|
||||
{
|
||||
$info .= ",width:" . $imageInfo['width'] . "";
|
||||
$info .= ",height:" . $imageInfo['height'] . "";
|
||||
$info .= ",size:'" . transformFileSize($imageInfo['size']) . "'";
|
||||
if($isSaveAsRequest)
|
||||
{
|
||||
$info .= ",save_as:'1'";
|
||||
}else
|
||||
{
|
||||
$info .= ",save_as:'0'";
|
||||
}
|
||||
$info .= ",folder_path:'" . dirname($imagePath) . "'";
|
||||
$info .= ",path:'" . backslashToSlash($imagePath) . "'";
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}else
|
||||
{
|
||||
$error = IMG_SAVE_IMG_OPEN_FAILED;
|
||||
}
|
||||
|
||||
}else
|
||||
{
|
||||
$error = IMG_SAVE_UNKNOWN_MODE;
|
||||
}
|
||||
}
|
||||
echo "{";
|
||||
echo "error:'" . $error . "'";
|
||||
if(isset($image) && is_object($image))
|
||||
{
|
||||
$image->DestroyImages();
|
||||
}
|
||||
echo $info;
|
||||
echo ",history:" . (isset($history) && is_object($history)?($history->getNumRestorable()):0) . "";
|
||||
echo "}";
|
||||
|
||||
|
||||
?>
|
||||
@@ -1,35 +0,0 @@
|
||||
<?php
|
||||
require_once('../../config/config.inc.php');
|
||||
require_once('../init.php');
|
||||
/**
|
||||
* ajax preview
|
||||
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
|
||||
* @link www.phpletter.com
|
||||
* @since 22/April/2007
|
||||
*
|
||||
*/
|
||||
include_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
|
||||
if(!empty($_GET['path']) && file_exists($_GET['path']) && is_file($_GET['path']))
|
||||
{
|
||||
include_once(CLASS_IMAGE);
|
||||
$image = new Image(true);
|
||||
if($image->loadImage($_GET['path']))
|
||||
{
|
||||
if($image->resize(CONFIG_IMG_THUMBNAIL_MAX_X, CONFIG_IMG_THUMBNAIL_MAX_Y, true, true))
|
||||
{
|
||||
$image->showImage();
|
||||
}else
|
||||
{
|
||||
echo PREVIEW_NOT_PREVIEW . ".";
|
||||
}
|
||||
}else
|
||||
{
|
||||
echo PREVIEW_NOT_PREVIEW . "..";
|
||||
}
|
||||
|
||||
|
||||
}else
|
||||
{
|
||||
echo PREVIEW_NOT_PREVIEW . "...";
|
||||
}
|
||||
|
||||
@@ -1,96 +0,0 @@
|
||||
<?php
|
||||
require_once('../../config/config.inc.php');
|
||||
require_once('../init.php');
|
||||
/**
|
||||
* ajax image undo function
|
||||
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
|
||||
* @link www.phpletter.com
|
||||
* @since 22/May/2007
|
||||
*
|
||||
*/
|
||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
|
||||
require_once(CLASS_HISTORY);
|
||||
$history = new History($_POST['file_path'], $session);
|
||||
$lastestSessionImageInfo = $history->getLastestRestorable();
|
||||
echo "{";
|
||||
$error = "";
|
||||
$info = "";
|
||||
if(CONFIG_SYS_VIEW_ONLY)
|
||||
{
|
||||
$error = SYS_DISABLED;
|
||||
}
|
||||
elseif(empty($_POST['file_path']))
|
||||
{
|
||||
$error = IMG_SAVE_EMPTY_PATH;
|
||||
}elseif(!file_exists($_POST['file_path']))
|
||||
{
|
||||
$error = IMG_SAVE_NOT_EXISTS;
|
||||
}elseif(!isUnderRoot($_POST['file_path']))
|
||||
{
|
||||
$error = IMG_SAVE_PATH_DISALLOWED;
|
||||
}else if(!sizeof($lastestSessionImageInfo))
|
||||
{
|
||||
$error = IMG_UNDO_NO_HISTORY_AVAIALBE;
|
||||
}
|
||||
else
|
||||
{
|
||||
//get the original image which is the lastest session image if any when the system is in demo
|
||||
$sessionImage = $session->getSessionDir() . $lastestSessionImageInfo['name'];
|
||||
$originalSessionImageInfo = $history->getOriginalImage();
|
||||
if(CONFIG_SYS_DEMO_ENABLE && sizeof($originalSessionImageInfo))
|
||||
{
|
||||
$originalImage = $session->getSessionDir() . $originalSessionImageInfo['info']['name'];
|
||||
}else
|
||||
{
|
||||
$originalImage = $_POST['file_path'];
|
||||
}
|
||||
|
||||
include_once(CLASS_IMAGE);
|
||||
$image = new Image();
|
||||
if($image->loadImage($sessionImage))
|
||||
{
|
||||
$imageInfo = $image->getOriginalImageInfo();
|
||||
if(!@copy($sessionImage, $originalImage))
|
||||
{
|
||||
$error = IMG_UNDO_COPY_FAILED;
|
||||
}else
|
||||
{
|
||||
|
||||
//remove the session image
|
||||
if(@unlink($sessionImage))
|
||||
{
|
||||
$history->restore();
|
||||
}
|
||||
//only one left, remove the session original if demo
|
||||
|
||||
if($history->getNumRestorable() == 0 && CONFIG_SYS_DEMO_ENABLE && sizeof($originalSessionImageInfo))
|
||||
{
|
||||
@unlink($session->getSessionDir() . $originalSessionImageInfo['info']['name']);
|
||||
$originalImage = $_POST['file_path'];
|
||||
}
|
||||
}
|
||||
$imagePath = $originalImage;
|
||||
|
||||
}else
|
||||
{
|
||||
$error = IMG_SAVE_IMG_OPEN_FAILED;
|
||||
}
|
||||
if(isset($imageInfo))
|
||||
{
|
||||
$info .= ",width:" . $imageInfo['width'] . "\n";
|
||||
$info .= ",height:" . $imageInfo['height'] . "\n";
|
||||
$info .= ",size:'" . transformFileSize($imageInfo['size']) . "'\n";
|
||||
$info .= ",path:'" . backslashToSlash($imagePath) . "'\n";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
echo "error:'" . $error . "'\n";
|
||||
if(isset($image) && is_object($image))
|
||||
{
|
||||
$image->DestroyImages();
|
||||
}
|
||||
echo $info;
|
||||
echo ",history:" . ($history->getNumRestorable()) . "\n";
|
||||
echo "}";
|
||||
?>
|
||||
@@ -1,67 +0,0 @@
|
||||
<?php
|
||||
require_once('../../config/config.inc.php');
|
||||
require_once('../init.php');
|
||||
/**
|
||||
* access control login form
|
||||
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
|
||||
* @link www.phpletter.com
|
||||
* @since 22/April/2007
|
||||
*
|
||||
*/
|
||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
|
||||
//Code added to adjust for local admin rights.
|
||||
if(!isset($_SESSION['loggedin']) || $_SESSION['loggedin'] === false) {
|
||||
|
||||
if(isset($_POST['username']))
|
||||
{
|
||||
if($auth->login())
|
||||
{
|
||||
header('Location: ' . appendQueryString(CONFIG_URL_HOME, makeQueryString()));
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
$_SESSION['ajax_user'] = true;
|
||||
header('Location: ' . appendQueryString(CONFIG_URL_HOME, makeQueryString()));
|
||||
exit;
|
||||
}
|
||||
?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<link type="text/css" href="theme/<?php echo CONFIG_THEME_NAME; ?>/css/login.css" rel="stylesheet" />
|
||||
<title><?php echo LOGIN_PAGE_TITLE; ?></title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="container">
|
||||
<div id="content">
|
||||
<form name="frmLogin" method="post" action="">
|
||||
<table class="adminLoginTable" cellpadding="0" cellspacing="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="2"><?php echo LOGIN_FORM_TITLE; ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th class="padTop"><label><?php echo LOGIN_USERNAME; ?> </label></th>
|
||||
<td class="padTop"><input type="text" value="" class="input" name="username" id="username" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><label><?php echo LOGIN_PASSWORD; ?> </label></th>
|
||||
<td><input type="password" value="" class="input" name="password" id="password" /></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td><input type="submit" class="button" value="Login" /></td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,60 +0,0 @@
|
||||
<?php
|
||||
require_once('../../config/config.inc.php');
|
||||
require_once('../init.php');
|
||||
/**
|
||||
* ajax preview
|
||||
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
|
||||
* @link www.phpletter.com
|
||||
* @since 22/April/2007
|
||||
*
|
||||
*/
|
||||
include_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
|
||||
echo getRealPath($_GET['path']);
|
||||
if(!empty($_GET['path']) && file_exists($_GET['path']) && is_file($_GET['path']))
|
||||
{
|
||||
|
||||
include_once(CLASS_MANAGER);
|
||||
$manager = new manager($_GET['path'], false);
|
||||
$fileTypes = $manager->getFileType(basename($_GET['path']));
|
||||
if($fileTypes['preview'])
|
||||
{
|
||||
switch($fileTypes['fileType'])
|
||||
{
|
||||
case "image":
|
||||
$imageInfo = @getimagesize($_GET['path']);
|
||||
if(!empty($imageInfo[0]) && !empty($imageInfo[1]))
|
||||
{
|
||||
$thumInfo = getThumbWidthHeight($imageInfo[0], $imageInfo[1], 400, 135);
|
||||
printf("<img src=\"%s\" width=\"%s\" height=\"%s\" />", getFileUrl($_GET['path']), $thumInfo['width'], $thumInfo['height']);
|
||||
|
||||
}else
|
||||
{
|
||||
echo PREVIEW_IMAGE_LOAD_FAILED;
|
||||
}
|
||||
|
||||
break;
|
||||
case "txt":
|
||||
if(($fp = @fopen($_GET['path'], 'r')))
|
||||
{
|
||||
echo @fread($fp, @filesize($_GET['path']));
|
||||
@fclose($fp);
|
||||
}else
|
||||
{
|
||||
echo PREVIEW_OPEN_FAILED . ".";
|
||||
}
|
||||
break;
|
||||
|
||||
case "video":
|
||||
break;
|
||||
}
|
||||
}else
|
||||
{
|
||||
echo PREVIEW_NOT_PREVIEW . "..";
|
||||
}
|
||||
|
||||
}else
|
||||
{
|
||||
echo PREVIEW_NOT_PREVIEW . "...";
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -1,59 +0,0 @@
|
||||
<?php
|
||||
require_once('../../config/config.inc.php');
|
||||
require_once('../init.php');
|
||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
|
||||
|
||||
?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>Untitled Document</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<a href="#" class="jqmClose" id="windowSaveClose"><?php echo IMG_BTN_CANCEL; ?></a>
|
||||
<form id="formSaveAs" name="formSaveAs" action="" method="post">
|
||||
<table class="tableForm" cellpadding="0" cellspacing="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="2"><?php echo IMG_LBL_SAVE_AS; ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>
|
||||
<label><?php echo IMG_LBL_NEW_NAME; ?></label>
|
||||
</th>
|
||||
<td>
|
||||
<input type="text" id="new_name" class="input" name="new_name" value="" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
<label><?php echo IMG_LBL_SAVE_TO; ?></label>
|
||||
</th>
|
||||
<td>
|
||||
<select class="input" name="save_to">
|
||||
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
</th>
|
||||
<td>
|
||||
<span class="comments">*</span>
|
||||
<?php echo IMG_NEW_NAME_COMMENTS; ?>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th> </th>
|
||||
<td><input type="button" class="button" value="<?php echo IMG_BTN_SAVE_AS; ?>" onclick="return saveAsImage();" /></td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,81 +0,0 @@
|
||||
<?php
|
||||
require_once('../../config/config.inc.php');
|
||||
require_once('../init.php');
|
||||
/**
|
||||
* ajax save name
|
||||
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
|
||||
* @link www.phpletter.com
|
||||
* @since 22/May/2007
|
||||
*
|
||||
*/
|
||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
|
||||
$error = '';
|
||||
$fileInfo = array();
|
||||
if(CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_RENAME)
|
||||
{
|
||||
$error = SYS_DISABLED;
|
||||
}
|
||||
elseif(empty($_POST['name']))
|
||||
{
|
||||
$error = ERR_RENAME_EMPTY;
|
||||
}elseif(!preg_match("/^[a-zA-Z0-9 _\-.]+$/", $_POST['name']))
|
||||
{
|
||||
$error = ERR_RENAME_FORMAT;
|
||||
}elseif(empty($_POST['original_path']) || !file_exists($_POST['original_path']))
|
||||
{
|
||||
$error = ERR_RENAME_FILE_NOT_EXISTS;
|
||||
}elseif(substr(slashToBackslash(removeTrailingSlash($_POST['original_path'])), strrpos(slashToBackslash(removeTrailingSlash($_POST['original_path'])), "/") + 1) == $_POST['name'])
|
||||
{
|
||||
$error = ERR_NO_CHANGES_MADE;
|
||||
}elseif(file_exists(addTrailingSlash(getParentPath($_POST['original_path'])) . $_POST['name']))
|
||||
{
|
||||
$error = ERR_RENAME_EXISTS;
|
||||
}elseif(is_file($_POST['original_path']) && !isValidExt($_POST['name'], explode(",", CONFIG_UPLOAD_VALID_EXTS), explode(",", CONFIG_UPLOAD_INVALID_EXTS)))
|
||||
{
|
||||
$error = ERR_RENAME_FILE_TYPE_NOT_PERMITED;
|
||||
}elseif(!rename(removeTrailingSlash($_POST['original_path']), addTrailingSlash(getParentPath($_POST['original_path'])) . $_POST['name']))
|
||||
{
|
||||
$error = ERR_RENAME_FAILED;
|
||||
}else
|
||||
{
|
||||
//update record of session if image exists in session for cut or copy
|
||||
include_once(CLASS_SESSION_ACTION);
|
||||
$sessionAction = new SessionAction();
|
||||
$selectedDocuments = $sessionAction->get();
|
||||
if(removeTrailingSlash($sessionAction->getFolder()) == getParentPath($_POST['original_path']) && sizeof($selectedDocuments))
|
||||
{
|
||||
if(($key = array_search(basename($_POST['original_path']), $selectedDocuments)) !== false)
|
||||
{
|
||||
$selectedDocuments[$key] = $_POST['name'];
|
||||
$sessionAction->set($selectedDocuments);
|
||||
|
||||
}
|
||||
|
||||
}elseif(removeTrailingSlash($sessionAction->getFolder()) == removeTrailingSlash($_POST['original_path']))
|
||||
{
|
||||
$sessionAction->setFolder($_POST['original_path']);
|
||||
}
|
||||
$path = addTrailingSlash(getParentPath($_POST['original_path'])) . $_POST['name'];
|
||||
if(is_file($path))
|
||||
{
|
||||
include_once(CLASS_FILE);
|
||||
$file = new file($path);
|
||||
$fileInfo = $file->getFileInfo();
|
||||
}else
|
||||
{
|
||||
include_once(CLASS_MANAGER);
|
||||
$manager = new manager($path, false);
|
||||
$fileInfo = $manager->getFolderInfo();
|
||||
}
|
||||
}
|
||||
|
||||
echo "{";
|
||||
echo "error:'" . $error . "' ";
|
||||
foreach ($fileInfo as $k=>$v)
|
||||
{
|
||||
echo "," . $k . ":'" . $v . "' ";
|
||||
}
|
||||
echo "}";
|
||||
|
||||
|
||||
?>
|
||||
@@ -1,90 +0,0 @@
|
||||
<?php
|
||||
require_once('../../config/config.inc.php');
|
||||
require_once('../init.php');
|
||||
/**
|
||||
* ajax save name
|
||||
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
|
||||
* @link www.phpletter.com
|
||||
* @since 22/May/2007
|
||||
*
|
||||
*/
|
||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
|
||||
$error = '';
|
||||
$path = addTrailingSlash(backslashToSlash($_POST['folder'])) . $_POST['name'];
|
||||
if(CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_EDITABLE)
|
||||
{
|
||||
$error = SYS_DISABLED;
|
||||
}
|
||||
elseif(isset($_POST['save_as_request']))
|
||||
{
|
||||
if(!preg_match('/^[a-zA-Z0-9_\-.]+$/', $_POST['name']))
|
||||
{
|
||||
$error = TXT_SAVE_AS_ERR_NAME_INVALID;
|
||||
}elseif(array_search(strtolower(getFileExt($_POST['name'])), getValidTextEditorExts()) === false)
|
||||
{
|
||||
$error = TXT_DISALLOWED_EXT;
|
||||
}elseif(!isUnderRoot($_POST['folder']))
|
||||
{
|
||||
$error = ERR_FOLDER_PATH_NOT_ALLOWED;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if(!empty($_POST['save_as_request']))
|
||||
{//save as request
|
||||
if(file_exists($path))
|
||||
{
|
||||
$error = TXT_FILE_EXIST;
|
||||
}else
|
||||
{
|
||||
if(($fp = @fopen($path, 'w+')) !== false)
|
||||
{
|
||||
if(@fwrite($fp, $_POST['text']))
|
||||
{
|
||||
@fclose($fp);
|
||||
}else
|
||||
{
|
||||
$error = TXT_CONTENT_WRITE_FAILED;
|
||||
}
|
||||
}else
|
||||
{
|
||||
$error = TXT_CREATE_FAILED;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}else
|
||||
{
|
||||
if(!file_exists($path))
|
||||
{
|
||||
$error = TXT_FILE_NOT_EXIST;
|
||||
}else
|
||||
{
|
||||
if(($fp = @fopen($path, 'w')) !== false)
|
||||
{
|
||||
if(@fwrite($fp, $_POST['text']))
|
||||
{
|
||||
@fclose($fp);
|
||||
}else
|
||||
{
|
||||
$error = TXT_CONTENT_UPDATE_FAILED;
|
||||
}
|
||||
}else
|
||||
{
|
||||
$error = TXT_FILE_OPEN_FAILED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}else
|
||||
{
|
||||
$error = TXT_UNKNOWN_REQUEST;
|
||||
}
|
||||
echo "{";
|
||||
echo "error:'" . $error . "',\n";
|
||||
echo "path:'" . $path . "'";
|
||||
echo "}";
|
||||
|
||||
?>
|
||||
@@ -1,168 +0,0 @@
|
||||
<?php
|
||||
require_once('../../config/config.inc.php');
|
||||
require_once('../init.php');
|
||||
/**
|
||||
* Ajax image editor platform
|
||||
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
|
||||
* @link www.phpletter.com
|
||||
* @since 22/May/2007
|
||||
*
|
||||
*/
|
||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
|
||||
if(CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_EDITABLE)
|
||||
{
|
||||
die(SYS_DISABLED);
|
||||
}
|
||||
//$session->gc();
|
||||
$_GET['path'] = empty($_GET['path'])?CONFIG_SYS_ROOT_PATH . "ajax_image_editor_demo.jpg":$_GET['path'];
|
||||
if(!empty($_GET['path']) && file_exists($_GET['path']) && is_file($_GET['path']) && isUnderRoot($_GET['path']))
|
||||
{
|
||||
$path = $_GET['path'];
|
||||
}else
|
||||
{
|
||||
die(TXT_FILE_NOT_FOUND);
|
||||
}
|
||||
if(file_exists(DIR_AJAX_EDIT_AREA . "reg_syntax" . DIRECTORY_SEPARATOR . getFileExt($path) . ".js"))
|
||||
{
|
||||
$syntax = getFileExt($path);
|
||||
}else
|
||||
{
|
||||
switch (getFileExt($path))
|
||||
{
|
||||
case 'htm':
|
||||
$syntax = 'html';
|
||||
break;
|
||||
default:
|
||||
$syntax = 'basic';
|
||||
}
|
||||
}
|
||||
if(array_search(getFileExt($path), getValidTextEditorExts())=== false)
|
||||
{
|
||||
die(TXT_DISALLOWED_EXT);
|
||||
}
|
||||
?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="author" content="Logan Cai" />
|
||||
<meta name="website" content="http://www.phpletter.com" />
|
||||
<script type="text/javascript" src="jscripts/ajaxtexteditor_c.js"></script>
|
||||
<!--<script type="text/javascript" src="jscripts/jquery.js"></script>
|
||||
<script type="text/javascript" src="jscripts/form.js"></script>
|
||||
<script type="text/javascript" src="jscripts/select.js"></script>
|
||||
<script type="text/javascript" src="jscripts/jqModal.js"></script>
|
||||
<script type="text/javascript" src="jscripts/ajaxtexteditor.js"></script>
|
||||
-->
|
||||
<script type="text/javascript" src="jscripts/edit_area/edit_area_full.js"></script>
|
||||
<script type="text/javascript">
|
||||
var warningExtNotSelected = '<?php echo TXT_EXT_NOT_SELECTED; ?>';
|
||||
var urlGetFolderList = '<?php echo appendQueryString(CONFIG_URL_GET_FOLDER_LIST, makeQueryString(array('path'))); ?>';
|
||||
var warningInvalidName = '<?php echo TXT_SAVE_AS_ERR_NAME_INVALID; ?>';
|
||||
var waringFolderNotSelected = '<?php echo TXT_DEST_FOLDER_NOT_SELECTED; ?>';
|
||||
var currentFolder = '<?php echo dirname($path); ?>';
|
||||
var currentName = '<?php echo basename($path); ?>';
|
||||
|
||||
jQuery(document).ready(
|
||||
function()
|
||||
{
|
||||
editAreaLoader.init({
|
||||
id: "content" // id of the textarea to transform
|
||||
,start_highlight: false // if start with highlight
|
||||
,allow_resize: "both"
|
||||
,gecko_spellcheck:true
|
||||
,allow_toggle: true
|
||||
,toolbar:"search, go_to_line, fullscreen, |, undo, redo, |, select_font,|, highlight, reset_highlight, |, save, save_as"
|
||||
,save_callback:"save"
|
||||
,save_as_callback:"save_as"
|
||||
,language: "<?php echo (file_exists(DIR_AJAX_EDIT_AREA . 'langs' . DIRECTORY_SEPARATOR .CONFIG_LANG_INDEX . ".js")?CONFIG_LANG_INDEX:'en'); ?>"
|
||||
,syntax: "<?php echo $syntax; ?>"
|
||||
});
|
||||
jQuery('#windowSaveAs').jqm();
|
||||
jQuery('#windowProcessing').jqm({modal:true});
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<link href="theme/<?php echo CONFIG_THEME_NAME; ?>/css/ajaxtexteditor.css" type="text/css" rel="stylesheet" />
|
||||
<link href="theme/<?php echo CONFIG_THEME_NAME; ?>/css/jqModal.css" type="text/css" rel="stylesheet" />
|
||||
<title>Ajax Text Editor</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="pageBody">
|
||||
<textarea name="content" id="content" style="height:500px; width: 97%;"><?php echo getFileContent($path); ?></textarea>
|
||||
</div>
|
||||
<div id="windowProcessing" class="jqmWindow" style="display:none">
|
||||
<form name="frmProcessing" id="frmProcessing" method="POST" action="<?php echo appendQueryString(CONFIG_URL_SAVE_TEXT, makeQueryString(array('path')));?>">
|
||||
<input type="hidden" name="folder" id="folder" value="<?php echo dirname($path); ?>" />
|
||||
<input type="hidden" name="name" id="name" value="<?php echo basename($path); ?>" />
|
||||
<input type="hidden" name="save_as_request" id="save_as_request" value="0" />
|
||||
<div style="display:none"><textarea name="text" id="text"></textarea></div>
|
||||
</form>
|
||||
<a href="#" class="jqmClose" id="windowSaveClose"><?php echo IMG_BTN_CANCEL; ?></a>
|
||||
<p><img src="theme/<?php echo CONFIG_THEME_NAME; ?>/images/loading.gif" /></p>
|
||||
</div>
|
||||
<div id="windowSaveAs" class="jqmWindow" style="display:none">
|
||||
<a href="#" class="jqmClose" id="windowSaveClose"><?php echo IMG_BTN_CANCEL; ?></a>
|
||||
<form id="formSaveAs" name="formSaveAs" action="" method="post">
|
||||
<table class="tableForm" cellpadding="0" cellspacing="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="2"><?php echo IMG_LBL_SAVE_AS; ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>
|
||||
<label><?php echo IMG_LBL_NEW_NAME; ?></label>
|
||||
</th>
|
||||
<td>
|
||||
<input type="text" id="new_name" class="input" name="new_name" value="" />
|
||||
. <select id="ext" name="ext">
|
||||
<?php
|
||||
foreach(getValidTextEditorExts() as $v)
|
||||
{
|
||||
?>
|
||||
<option value="<?php echo $v; ?>" <?php echo (strtolower($v) == strtolower(getFileExt($path))?'selected':''); ?>><?php echo $v; ?></option>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
<label><?php echo IMG_LBL_SAVE_TO; ?></label>
|
||||
</th>
|
||||
<td>
|
||||
<select class="input" name="save_to" id="save_to">
|
||||
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
</th>
|
||||
<td>
|
||||
<span class="comments">*</span>
|
||||
<?php echo IMG_NEW_NAME_COMMENTS; ?>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th> </th>
|
||||
<td><input type="button" class="button" value="<?php echo IMG_BTN_SAVE_AS; ?>" onclick="return do_save_as();" /></td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
</body></html>
|
||||
|
||||
@@ -1,689 +0,0 @@
|
||||
<?php
|
||||
require_once('../../config/config.inc.php');
|
||||
require_once('../init.php');
|
||||
/**
|
||||
* file manager platform
|
||||
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
|
||||
* @link www.phpletter.com
|
||||
* @since 22/May/2007
|
||||
*
|
||||
*/
|
||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
|
||||
//$session->gc();
|
||||
require_once(CLASS_SESSION_ACTION);
|
||||
$sessionAction = new SessionAction();
|
||||
if(CONFIG_LOAD_DOC_LATTER)
|
||||
{
|
||||
$fileList = array();
|
||||
$folderInfo = array('path'=>getCurrentFolderPath());
|
||||
}else
|
||||
{
|
||||
require_once(CLASS_MANAGER);
|
||||
|
||||
|
||||
$manager = new manager();
|
||||
$manager->setSessionAction($sessionAction);
|
||||
$fileList = $manager->getFileList();
|
||||
$folderInfo = $manager->getFolderInfo();
|
||||
}
|
||||
if(CONFIG_SYS_THUMBNAIL_VIEW_ENABLE)
|
||||
{
|
||||
$views = array(
|
||||
'detail'=>LBL_BTN_VIEW_DETAILS,
|
||||
'thumbnail'=>LBL_BTN_VIEW_THUMBNAIL,
|
||||
);
|
||||
}else
|
||||
{
|
||||
$views = array(
|
||||
'detail'=>LBL_BTN_VIEW_DETAILS,
|
||||
);
|
||||
}
|
||||
|
||||
if(!empty($_GET['view']))
|
||||
{
|
||||
switch($_GET['view'])
|
||||
{
|
||||
case 'detail':
|
||||
case 'thumbnail':
|
||||
$view = $_GET['view'];
|
||||
break;
|
||||
default:
|
||||
$view = CONFIG_DEFAULT_VIEW;
|
||||
}
|
||||
}else
|
||||
{
|
||||
$view = CONFIG_DEFAULT_VIEW;
|
||||
}
|
||||
|
||||
?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" debug="true">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>Ajax File Manager</title>
|
||||
<script type="text/javascript" src="jscripts/ajaxfilemanager_c.js"></script>
|
||||
<!--<script type="text/javascript" src="jscripts/jquery.js"></script>
|
||||
<script type="text/javascript" src="jscripts/form.js"></script>
|
||||
<script type="text/javascript" src="jscripts/select.js"></script>
|
||||
<script type="text/javascript" src="jscripts/thickbox.js"></script>
|
||||
<script type="text/javascript" src="jscripts/calendar.js"></script>
|
||||
<script type="text/javascript" src="jscripts/contextmenu.js"></script>
|
||||
<script type="text/javascript" src="jscripts/media.js"></script>
|
||||
<script type="text/javascript" src="jscripts/ajaxfileupload.js"></script>
|
||||
<script type="text/javascript" src="jscripts/ajaxfilemanager.js"></script>-->
|
||||
<script type="text/javascript">
|
||||
var globalSettings = {'upload_init':false};
|
||||
var queryString = '<?php echo makeQueryString(array('path')); ?>';
|
||||
var paths = {'root':'<?php echo addTrailingSlash(backslashToSlash(CONFIG_SYS_ROOT_PATH)); ?>', 'root_title':'<?php echo LBL_FOLDER_ROOT; ?>'};
|
||||
var parentFolder = {};
|
||||
var urls = {
|
||||
'upload':'<?php echo CONFIG_URL_UPLOAD; ?>',
|
||||
'preview':'<?php echo CONFIG_URL_PREVIEW; ?>',
|
||||
'cut':'<?php echo CONFIG_URL_CUT; ?>',
|
||||
'copy':'<?php echo CONFIG_URL_COPY; ?>',
|
||||
'paste':'<?php echo CONFIG_URL_FILE_PASTE; ?>',
|
||||
'delete':'<?php echo CONFIG_URL_DELETE; ?>',
|
||||
'rename':'<?php echo CONFIG_URL_SAVE_NAME; ?>',
|
||||
'thumbnail':'<?php echo CONFIG_URL_IMG_THUMBNAIL; ?>',
|
||||
'create_folder':'<?php echo CONFIG_URL_CREATE_FOLDER; ?>',
|
||||
'text_editor':'<?php echo CONFIG_URL_TEXT_EDITOR; ?>',
|
||||
'image_editor':'<?php echo CONFIG_URL_IMAGE_EDITOR; ?>',
|
||||
'download':'<?php echo CONFIG_URL_DOWNLOAD; ?>',
|
||||
'present':'<?php echo getCurrentUrl(); ?>',
|
||||
'home':'<?php echo CONFIG_URL_HOME; ?>',
|
||||
'view':'<?php echo CONFIG_URL_LIST_LISTING; ?>'
|
||||
};
|
||||
var permits = {'del':<?php echo (CONFIG_OPTIONS_DELETE?1:0); ?>, 'cut':<?php echo (CONFIG_OPTIONS_CUT?'1':'0'); ?>, 'copy':<?php echo (CONFIG_OPTIONS_COPY?1:0); ?>, 'newfolder':<?php echo (CONFIG_OPTIONS_NEWFOLDER?1:0); ?>, 'rename':<?php echo (CONFIG_OPTIONS_RENAME?1:0); ?>, 'upload':<?php echo (CONFIG_OPTIONS_UPLOAD?1:0); ?>, 'edit':<?php echo (CONFIG_OPTIONS_EDITABLE?1:0); ?>, 'view_only':<?php echo (CONFIG_SYS_VIEW_ONLY?1:0); ?>};
|
||||
var currentFolder = {};
|
||||
var warningDelete = '<?php echo WARNING_DELETE; ?>';
|
||||
var newFile = {'num':1, 'label':'<?php echo FILE_LABEL_SELECT; ?>', 'upload':'<?php echo FILE_LBL_UPLOAD; ?>'};
|
||||
var counts = {'new_file':1};
|
||||
var thickbox = {'width':'<?php echo CONFIG_THICKBOX_MAX_WIDTH; ?>',
|
||||
'height':'<?php echo CONFIG_THICKBOX_MAX_HEIGHT; ?>',
|
||||
'next':'<?php echo THICKBOX_NEXT; ?>',
|
||||
'previous':'<?php echo THICKBOX_PREVIOUS; ?>',
|
||||
'close':'<?php echo THICKBOX_CLOSE; ?>'
|
||||
|
||||
};
|
||||
|
||||
var tb_pathToImage = "theme/<?php echo CONFIG_THEME_NAME; ?>/images/loadingAnimation.gif";
|
||||
var msgInvalidFolderName = '<?php echo ERR_FOLDER_FORMAT; ?>';
|
||||
var msgInvalidFileName = '<?php echo ERR_FILE_NAME_FORMAT; ?>';
|
||||
var msgInvalidExt = '<?php echo ERR_FILE_TYPE_NOT_ALLOWED; ?>';
|
||||
var msgNotPreview = '<?php echo PREVIEW_NOT_PREVIEW; ?>';
|
||||
|
||||
var warningCutPaste = '<?php echo WARNING_CUT_PASTE; ?>';
|
||||
var warningCopyPaste = '<?php echo WARNING_COPY_PASTE; ?>';
|
||||
var warningDel = '<?php echo WARNING_DELETE; ?>';
|
||||
var warningNotDocSelected = '<?php echo ERR_NOT_DOC_SELECTED; ?>';
|
||||
var noFileSelected = '<?php echo ERR_NOT_FILE_SELECTED; ?>';
|
||||
var unselectAllText = '<?php echo TIP_UNSELECT_ALL; ?>';
|
||||
var selectAllText = '<?php echo TIP_SELECT_ALL; ?>';
|
||||
var action = '<?php echo $sessionAction->getAction(); ?>';
|
||||
var numFiles = <?php echo $sessionAction->count(); ?>;
|
||||
var warningCloseWindow = '<?php echo WARING_WINDOW_CLOSE; ?>';
|
||||
var numRows = 0;
|
||||
|
||||
var wordCloseWindow = '<?php echo LBL_ACTION_CLOSE; ?>';
|
||||
var wordPreviewClick = '<?php echo LBL_CLICK_PREVIEW; ?>';
|
||||
|
||||
var searchRequired = false;
|
||||
var supporedPreviewExts = '<?php echo CONFIG_VIEWABLE_VALID_EXTS; ?>';
|
||||
var supportedUploadExts = '<?php echo CONFIG_UPLOAD_VALID_EXTS; ?>'
|
||||
var elementId = <?php echo (!empty($_GET['elementId'])?"'" . $_GET['elementId'] . "'":'null'); ?>;
|
||||
var files = {};
|
||||
$(document).ready(
|
||||
function()
|
||||
{
|
||||
jQuery(document).bind('keypress', function(event) {
|
||||
var code=event.charCode || event.keyCode;
|
||||
if(code && code == 13) {// if enter is pressed
|
||||
event.preventDefault(); //prevent browser from following the actual href
|
||||
};
|
||||
});
|
||||
if(typeof(cancelSelectFile) != 'undefined')
|
||||
{
|
||||
$('#linkClose').show();
|
||||
}
|
||||
$('input[@name=view]').each(
|
||||
function()
|
||||
{
|
||||
|
||||
if(this.value == '<?php echo $view; ?>')
|
||||
{
|
||||
this.checked = true;
|
||||
}else
|
||||
{
|
||||
this.checked = false;
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
popUpCal.clearText = '<?php echo CALENDAR_CLEAR; ?>';
|
||||
popUpCal.closeText = '<?php echo CALENDAR_CLOSE; ?>';
|
||||
popUpCal.prevText = '<?php echo CALENDAR_PREVIOUS; ?>';
|
||||
popUpCal.nextText = '<?php echo CALENDAR_NEXT; ?>';
|
||||
popUpCal.currentText = '<?php echo CALENDAR_CURRENT; ?>';
|
||||
popUpCal.buttonImageOnly = true;
|
||||
popUpCal.dayNames = new Array('<?php echo CALENDAR_SUN; ?>','<?php echo CALENDAR_MON; ?>','<?php echo CALENDAR_TUE; ?>','<?php echo CALENDAR_WED; ?>','<?php echo CALENDAR_THU; ?>','<?php echo CALENDAR_FRI; ?>','<?php echo CALENDAR_SAT; ?>');
|
||||
popUpCal.monthNames = new Array('<?php echo CALENDAR_JAN; ?>','<?php echo CALENDAR_FEB; ?>','<?php echo CALENDAR_MAR; ?>','<?php echo CALENDAR_APR; ?>','<?php echo CALENDAR_MAY; ?>','<?php echo CALENDAR_JUN; ?>','<?php echo CALENDAR_JUL; ?>','<?php echo CALENDAR_AUG; ?>','<?php echo CALENDAR_SEP; ?>','<?php echo CALENDAR_OCT; ?>','<?php echo CALENDAR_NOV; ?>','<?php echo CALENDAR_DEC; ?>');
|
||||
popUpCal.dateFormat = 'YMD-';
|
||||
$('.inputMtime').calendar({autoPopUp:'both', buttonImage:'theme/<?php echo CONFIG_THEME_NAME; ?>/images/standard/date_picker.png'});
|
||||
|
||||
|
||||
initAfterListingLoaded();
|
||||
//addMoreFile();
|
||||
|
||||
} );
|
||||
|
||||
|
||||
</script>
|
||||
<?php
|
||||
if(file_exists(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'jscripts' . DIRECTORY_SEPARATOR . 'for_' . CONFIG_EDITOR_NAME . ".js")
|
||||
{
|
||||
?>
|
||||
<script type="text/javascript" src="jscripts/<?php echo 'for_' . CONFIG_EDITOR_NAME . '.js'; ?>"></script>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<link rel="stylesheet" type="text/css" href="theme/<?php echo CONFIG_THEME_NAME; ?>/css/template.css" />
|
||||
<link rel="stylesheet" type="text/css" href="theme/<?php echo CONFIG_THEME_NAME; ?>/css/jquery-calendar.css" />
|
||||
<link rel="stylesheet" href="theme/<?php echo CONFIG_THEME_NAME; ?>/css/thickbox.css" type="text/css" media="screen" />
|
||||
<!--[if IE 6]>
|
||||
<link href="theme/<?php echo CONFIG_THEME_NAME; ?>/css/ie6.css" type="text/css" rel="Stylesheet" media="screen">
|
||||
<![endif]-->
|
||||
</head>
|
||||
<body style="background-color:#E8E8E8;">
|
||||
<div id="wrapper">
|
||||
<div id="header">
|
||||
<dl id="currentFolderInfo">
|
||||
<dt><?php echo LBL_CURRENT_FOLDER_PATH; ?></dt>
|
||||
<dd id="currentFolderPath"><?php echo $folderInfo['path']; ?></dd>
|
||||
</dl>
|
||||
<div id="viewList">
|
||||
|
||||
|
||||
<label><?php echo LBL_BTN_VIEW_OPTIONS; ?></label>
|
||||
<?php
|
||||
foreach($views as $k=>$v)
|
||||
{
|
||||
?>
|
||||
<input type="radio" name="view" class="radio" onclick="changeView(this);" value="<?php echo $k; ?>" <?php echo ($k==$view?'checked':''); ?>> <?php echo $v; ?>
|
||||
|
||||
<?php
|
||||
}
|
||||
?></div>
|
||||
<ul id="actionHeader">
|
||||
<li><a href="#" id="actionRefresh" onclick="return windowRefresh();"><span><?php echo LBL_ACTION_REFRESH; ?></span></a></li>
|
||||
<li><a href="#" id="actionSelectAll" class="check_all" onclick="return checkAll(this);"><span><?php echo LBL_ACTION_SELECT_ALL; ?></span></a></li>
|
||||
<?php
|
||||
if(CONFIG_OPTIONS_DELETE)
|
||||
{
|
||||
?>
|
||||
<li><a href="#" id="actionDelete" onclick="return deleteDocuments();"><span><?php echo LBL_ACTION_DELETE; ?></span></a></li>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
if(CONFIG_OPTIONS_CUT)
|
||||
{
|
||||
?>
|
||||
<li><a href="#" id="actionCut" onclick="return cutDocuments('<?php echo ERR_NOT_DOC_SELECTED_FOR_CUT; ?>');"><span><?php echo LBL_ACTION_CUT; ?></span></a></li>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
if(CONFIG_OPTIONS_COPY)
|
||||
{
|
||||
?>
|
||||
<li><a href="#" id="actionCopy" onclick="return copyDocuments('<?php echo ERR_NOT_DOC_SELECTED_FOR_COPY; ?>');"><span><?php echo LBL_ACTION_COPY; ?></span></a></li>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
if(CONFIG_OPTIONS_CUT || CONFIG_OPTIONS_COPY)
|
||||
{
|
||||
?>
|
||||
<li><a href="#" id="actionPaste" onclick="return pasteDocuments('<?php echo ERR_NOT_DOC_SELECTED_FOR_PASTE; ?>');"><span><?php echo LBL_ACTION_PASTE; ?></span></a></li>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<?php
|
||||
if(CONFIG_OPTIONS_NEWFOLDER)
|
||||
{
|
||||
?>
|
||||
<li><a id="actionNewFolder" href="#" onclick="return newFolderWin(this);"><span><?php echo LBL_BTN_NEW_FOLDER; ?></span></a></li>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
if(CONFIG_OPTIONS_UPLOAD)
|
||||
{
|
||||
?>
|
||||
<li><a id="actionUpload" href="#" onclick="return uploadFileWin(this);"><span><?php echo LBL_BTN_UPLOAD; ?></span></a></li>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- <li><a href="#" id="actionClose" onclick="closeWindow('<?php echo IMG_WARING_WIN_CLOSE; ?>');"><?php echo IMG_BTN_CLOSE; ?></a></li>-->
|
||||
<li><a href="#" class="thickbox" id="actionInfo" onclick="return infoWin(this);"><span>Info</span></a></li>
|
||||
<!-- thest functions will be added in the near future
|
||||
<li ><a href="#" id="actionZip"><span>Zip</span></a><li>
|
||||
<li ><a href="#" id="actionUnzip"><span>Unzip</span></a><li>-->
|
||||
</ul>
|
||||
<form action="" method="POST" name="formAction" id="formAction"><input type="hidden" name="currentFolderPath" id="currentFolderPathVal" value="" /><select name="selectedDoc[]" id="selectedDoc" style="display:none;" multiple="multiple"></select><input type="hidden" name="action_value" value="" id="action_value" /></form>
|
||||
</div>
|
||||
|
||||
<div id="body">
|
||||
|
||||
|
||||
<div id="rightCol">
|
||||
<?php
|
||||
if(CONFIG_LOAD_DOC_LATTER )
|
||||
{
|
||||
$currentPath = getCurrentFolderPath();
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
parentFolder = {path:'<?php echo getParentFolderPath($currentPath); ?>'};
|
||||
currentFolder = {'friendly_path':'<?php echo transformFilePath($currentPath); ?>'};
|
||||
$(document).ready(
|
||||
function()
|
||||
{
|
||||
var url = getUrl('view', false, false, false);
|
||||
$('#rightCol').empty();
|
||||
ajaxStart('#rightCol');
|
||||
|
||||
$('#rightCol').load(url,
|
||||
{},
|
||||
function(){
|
||||
ajaxStop('#rightCol img.ajaxLoadingImg');
|
||||
urls.present = getUrl('home', true, true);
|
||||
initAfterListingLoaded();
|
||||
});
|
||||
}
|
||||
);
|
||||
</script>
|
||||
<?php
|
||||
}else
|
||||
{
|
||||
include_once(CONFIG_URL_LIST_LISTING);
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
||||
<div id="leftCol">
|
||||
|
||||
|
||||
|
||||
<fieldset id="folderFieldSet" >
|
||||
|
||||
<legend><?php echo LBL_FOLDER_INFO; ?></legend>
|
||||
<table cellpadding="0" cellspacing="0" class="tableSummary" id="folderInfo">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th><?php echo LBL_FOLDER_PATH; ?></th>
|
||||
<td colspan="3" id="folderPath"><?php echo transformFilePath($folderInfo['path']); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo LBL_FOLDER_CREATED; ?></th>
|
||||
<td colspan="3" id="folderCtime"><?php echo (!empty($folderInfo['ctime'])?date(DATE_TIME_FORMAT,$folderInfo['ctime']):' ') ; ?></td>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo LBL_FOLDER_MODIFIED; ?></th>
|
||||
<td colspan="3" id="folderMtime"><?php echo (!empty($folderInfo['mtime'])?date(DATE_TIME_FORMAT,$folderInfo['mtime']):' '); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo LBL_FOLDER_SUDDIR; ?></th>
|
||||
<td colspan="3" id="folderSubdir"><?php echo (isset($folderInfo['subdir'])?$folderInfo['subdir']:" "); ?></td>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo LBL_FOLDER_FIELS; ?></th>
|
||||
<td colspan="3" id="folderFile"><?php echo (isset($folderInfo['file'])?$folderInfo['file']:' '); ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th><?php echo LBL_FOLDER_WRITABLE; ?></th>
|
||||
<td id="folderWritable"><span class="<?php echo (isset($folderInfo['is_readable'])?($folderInfo['is_readable']?'flagYes':'flagNo'):' '); ?>"> </span></td>
|
||||
<th><?php echo LBL_FOLDER_READABLE; ?></th>
|
||||
<td id="folderReadable"><span class="<?php echo (isset($folderInfo['is_writable'])?($folderInfo['is_writable']?'flagYes':'flagNo'):' '); ?>"> </span></td>
|
||||
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</fieldset>
|
||||
<fieldset id="fileFieldSet" style="display:none" >
|
||||
<legend><?php echo LBL_FILE_INFO; ?></legend>
|
||||
<table cellpadding="0" cellspacing="0" class="tableSummary" id="fileInfo">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th><?php echo LBL_FILE_NAME; ?></th>
|
||||
<td colspan="3" id="fileName"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo LBL_FILE_CREATED; ?></th>
|
||||
<td colspan="3" id="fileCtime"></td>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo LBL_FILE_MODIFIED; ?></th>
|
||||
<td colspan="3" id="fileMtime"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo LBL_FILE_SIZE; ?></th>
|
||||
<td colspan="3" id="fileSize"></td>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo LBL_FILE_TYPE; ?></th>
|
||||
<td colspan="3" id="fileType"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo LBL_FILE_WRITABLE; ?></th>
|
||||
<td id="fileWritable"><span class="flagYes"> </span></td>
|
||||
<th><?php echo LBL_FILE_READABLE; ?></th>
|
||||
<td id="fileReadable"><span class="flagNo"> </span></td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<p class="searchButtons" id="returnCurrentUrl">
|
||||
|
||||
<span class="right" id="linkSelect">
|
||||
<input type="button" value="<?php echo MENU_SELECT; ?>" id="selectCurrentUrl" class="button">
|
||||
</span>
|
||||
|
||||
</p>
|
||||
</fieldset>
|
||||
|
||||
|
||||
|
||||
<fieldset class="boxSearch">
|
||||
<legend><?php echo LBL_SEARCH; ?></legend>
|
||||
|
||||
|
||||
|
||||
<table cellpadding="0" cellspacing="0" class="tableSearch">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<b><?php echo LBL_SEARCH_NAME; ?></b> <br />
|
||||
<input type="text" class="input inputSearch" name="search_name" id="search_name" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td >
|
||||
<b><?php echo LBL_SEARCH_FOLDER; ?></b><br />
|
||||
<span id="searchFolderContainer">
|
||||
<?php
|
||||
if(CONFIG_LOAD_DOC_LATTER)
|
||||
{
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(
|
||||
function()
|
||||
{
|
||||
ajaxStart('#searchFolderContainer');
|
||||
$('#searchFolderContainer').load('<?php echo CONFIG_URL_LOAD_FOLDERS; ?>');
|
||||
}
|
||||
);
|
||||
</script>
|
||||
<?php
|
||||
}else
|
||||
{
|
||||
?>
|
||||
<select class="input inputSearch" name="search_folder" id="search_folder">
|
||||
<?php
|
||||
|
||||
foreach(getFolderListing(CONFIG_SYS_ROOT_PATH) as $k=>$v)
|
||||
{
|
||||
?>
|
||||
<option value="<?php echo $v; ?>" <?php echo (removeTrailingSlash(backslashToSlash(($folderInfo['path']))) == removeTrailingSlash(backslashToSlash(($v)))?' selected="selected"':''); ?>><?php echo shortenFileName($k, 30); ?></option>
|
||||
<?php
|
||||
}
|
||||
|
||||
?>
|
||||
</select>
|
||||
<?php
|
||||
}
|
||||
?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<b><?php echo LBL_SEARCH_MTIME; ?></b><br />
|
||||
<input type="text" class="input inputMtime" name="search_mtime_from" id="search_mtime_from" value="<?php echo (!empty($_GET['search_mtime_from'])?$_GET['search_mtime_from']:''); ?>" />
|
||||
<span class="leftToRightArrow"> </span>
|
||||
<input type="text" class="input inputMtime" name="search_mtime_to" id="search_mtime_to" value="<?php echo (!empty($_GET['search_mtime_to'])?$_GET['search_mtime_to']:''); ?>" />
|
||||
</td></tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<b><?php echo LBL_SEARCH_RECURSIVELY; ?></b>
|
||||
<input type="radio" name="search_recursively" value="1" id="search_recursively_1" class="radio" <?php echo (!empty($_GET['search_recursively'])?'checked="checked"':''); ?> /> <?php echo LBL_RECURSIVELY_YES; ?>
|
||||
<input type="radio" name="search_recursively" value="0" id="search_recursively_0" class="radio" <?php echo (empty($_GET['search_recursively'])?'checked="checked"':''); ?> /> <?php echo LBL_RECURSIVELY_NO; ?>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
|
||||
<p class="searchButtons">
|
||||
<span class="left" id="linkClose" style="display:none">
|
||||
<input type="button" value="<?php echo LBL_ACTION_CLOSE; ?>" onclick="return cancelSelectFile();" class="button">
|
||||
</span>
|
||||
<span class="right" id="linkSearch">
|
||||
<input type="button" value="<?php echo BTN_SEARCH; ?>" onclick="return search();" class="button">
|
||||
</span>
|
||||
|
||||
</p>
|
||||
</fieldset>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
|
||||
|
||||
|
||||
<div id="ajaxLoading" style="display:none"><img class="ajaxLoadingImg" src="theme/<?php echo CONFIG_THEME_NAME; ?>/images/ajaxLoading.gif" /></div>
|
||||
<div id="winUpload" style="display:none">
|
||||
<div class="jqmContainer">
|
||||
<div class="jqmHeader">
|
||||
<a href="#" onclick="tb_remove();"><?php echo LBL_ACTION_CLOSE; ?></a>
|
||||
</div>
|
||||
<div class="jqmBody">
|
||||
<form id="formUpload" name="formUpload" method="POST" enctype="multipart/form-data" action="">
|
||||
<table class="tableForm" cellpadding="0" cellspacing="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="2"><?php echo FILE_FORM_TITLE; ?><a class="action" href="#" title="<?php echo FILE_LBL_MORE; ?>" onclick="return addMoreFile();"><span class="addMore"> </span></a></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="fileUploadBody">
|
||||
<tr style="display:none">
|
||||
<th><label><?php echo FILE_LABEL_SELECT; ?></label></th>
|
||||
<td><input type="file" class="input" name="file" /> <input type="button" class="button" value="<?php echo FILE_LBL_UPLOAD; ?>" /> <a href="#" class="action" title="Cancel" style="display:none" ><span class="cancel"> </span></a> <span class="uploadProcessing" style="display:none"> <span></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th> </th>
|
||||
<td></td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div id="winNewFolder" style="display:none">
|
||||
<div class="jqmContainer">
|
||||
<div class="jqmHeader">
|
||||
<a href="#" onclick="tb_remove();"><?php echo LBL_ACTION_CLOSE; ?></a>
|
||||
</div>
|
||||
<div class="jqmBody">
|
||||
<form id="formNewFolder" name="formNewFolder" method="POST" action="">
|
||||
<input type="hidden" name="currentFolderPath" value="" id="currentNewfolderPath" />
|
||||
<table class="tableForm" cellpadding="0" cellspacing="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="2"><?php echo FOLDER_FORM_TITLE; ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th><label><?php echo FOLDER_LBL_TITLE; ?></label></th>
|
||||
<td><input type="text" name="new_folder" id="new_folder" value="" class="input"></td>
|
||||
</tr>
|
||||
|
||||
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th> </th>
|
||||
<td><input type="button" value="<?php echo FOLDER_LBL_CREATE; ?>" class="button" onclick="return doCreateFolder();" /></td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div id="winPlay" style="display:none">
|
||||
<div class="jqmContainer">
|
||||
<div class="jqmHeader">
|
||||
<a href="#" onclick="closeWinPlay();"><?php echo LBL_ACTION_CLOSE; ?></a>
|
||||
</div>
|
||||
<div class="jqmBody">
|
||||
<div id="playGround"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="winRename" style="display:none">
|
||||
<div class="jqmContainer">
|
||||
<div class="jqmHeader">
|
||||
<a href="#" onclick="tb_remove();"><?php echo LBL_ACTION_CLOSE; ?></a>
|
||||
</div>
|
||||
<div class="jqmBody">
|
||||
<form id="formRename" name="formRename" method="POST" action="">
|
||||
<input type="hidden" name="original_path" id="original_path" />
|
||||
<input type="hidden" name="num" id="renameNum" value="" />
|
||||
<table class="tableForm" cellpadding="0" cellspacing="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="2"><?php echo RENAME_FORM_TITLE; ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th><label><?php echo RENAME_NEW_NAME; ?></label></th>
|
||||
<td><input type="name" id="renameName" class="input" name="name" style="width:250px" />
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th> </th>
|
||||
<td><input type="button" value="<?php echo RENAME_LBL_RENAME; ?>" class="button" onclick="return doRename();" /></td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div id="winInfo" style="display:none">
|
||||
<div class="jqmContainer">
|
||||
<div class="jqmHeader">
|
||||
<a href="#" onclick="tb_remove();"><?php echo LBL_ACTION_CLOSE; ?></a>
|
||||
</div>
|
||||
<div class="jqmBody">
|
||||
<table class="tableInfo" cellpadding="0" cellspacing="0">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th nowrap>
|
||||
<label>Author:</label>
|
||||
</th>
|
||||
<td>
|
||||
<a href="mailto:cailongqun@yahoo.com.cn">Logan Cai</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th nowrap>
|
||||
<label>Template Designer:</label>
|
||||
</th>
|
||||
<td>
|
||||
<a href="mailto:Gabriel@4v.com.br">Gabriel</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th nowrap>
|
||||
<label>Official Website:</label>
|
||||
</th>
|
||||
<td>
|
||||
<a href="http://www.phpletter.com">http://www.phpletter.com</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th nowrap>
|
||||
<label>Support Forum:</label>
|
||||
</th>
|
||||
<td>
|
||||
<a href="http://www.phpletter.com/forum/">http://www.phpletter.com/forum/</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th nowrap>
|
||||
<label>©Copyright:</label>
|
||||
</th>
|
||||
<td>
|
||||
All copyright declarations in the source must remain unchange. Please contact us if you need to make changes to it, in order to avoid any Legal Issues.
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div id="contextMenu" style="display:none">
|
||||
<ul>
|
||||
<li><a href="#" class="contentMenuItem" id="menuSelect"><?php echo MENU_SELECT; ?></a></li>
|
||||
<li><a href="#" class="contentMenuItem" id="menuPreview"><?php echo MENU_PREVIEW; ?></a></li>
|
||||
<li><a href="#" class="contentMenuItem" id="menuDownload"><?php echo MENU_DOWNLOAD; ?></a></li>
|
||||
<li><a href="#" class="contentMenuItem" id="menuRename"><?php echo MENU_RENAME; ?></a></li>
|
||||
<li><a href="#" class="contentMenuItem" id="menuEdit"><?php echo MENU_EDIT; ?></a></li>
|
||||
<li><a href="#" class="contentMenuItem" id="menuCut"><?php echo MENU_CUT; ?></a></li>
|
||||
<li><a href="#" class="contentMenuItem" id="menuCopy"><?php echo MENU_COPY; ?></a></li>
|
||||
<li><a href="#" class="contentMenuItem" id="menuPaste"><?php echo MENU_PASTE; ?></a></li>
|
||||
<li><a href="#" class="contentMenuItem" id="menuDelete"><?php echo MENU_DELETE; ?></a></li>
|
||||
<li><a href="#" class="contentMenuItem" id="menuPlay"><?php echo MENU_PLAY; ?></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,48 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* the purpose I added this class is to make the file system much flexible
|
||||
* for customization.
|
||||
* Actually, this is a kind of interface and you should modify it to fit your system
|
||||
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
|
||||
* @link www.phpletter.com
|
||||
* @since 4/August/2007
|
||||
*/
|
||||
class Auth
|
||||
{
|
||||
var $__loginIndexInSession = 'ajax_user';
|
||||
function __construct()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
function Auth()
|
||||
{
|
||||
$this->__construct();
|
||||
}
|
||||
/**
|
||||
* check if the user has logged
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function isLoggedIn()
|
||||
{
|
||||
return (!empty($_SESSION[$this->__loginIndexInSession])?true:false);
|
||||
}
|
||||
/**
|
||||
* validate the username & password
|
||||
* @return boolean
|
||||
*
|
||||
*/
|
||||
function login()
|
||||
{
|
||||
if($_POST['username'] == CONFIG_LOGIN_USERNAME && $_POST['password'] == CONFIG_LOGIN_PASSWORD)
|
||||
{
|
||||
$_SESSION[$this->__loginIndexInSession] = true;
|
||||
return true;
|
||||
}else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -1,436 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* file modification
|
||||
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
|
||||
* @link www.phpletter.com
|
||||
* @since 22/April/2007
|
||||
*
|
||||
*/
|
||||
class file
|
||||
{
|
||||
var $fileInfo = "";
|
||||
var $filePath = "";
|
||||
var $fileStat = "";
|
||||
var $mask = '0775';
|
||||
var $debug = false;
|
||||
var $errors = array();
|
||||
/**
|
||||
* constructor
|
||||
*
|
||||
* @param string $path the path to a file or folder
|
||||
*/
|
||||
function __construct($path = null)
|
||||
{
|
||||
if(!is_null($path))
|
||||
{
|
||||
if(file_exists($path))
|
||||
{
|
||||
$this->filePath = $path;
|
||||
if(is_file($this->filePath))
|
||||
{
|
||||
$this->fileStat = @stat($path);
|
||||
$this->fileInfo['size'] = $this->fileStat[7];
|
||||
$this->fileInfo['atime'] = $this->fileStat[8];
|
||||
$this->fileInfo['ctime'] = $this->fileStat[10];
|
||||
$this->fileInfo['mtime'] = $this->fileStat[9];
|
||||
$this->fileInfo['path'] = $path;
|
||||
$this->fileInfo['name'] = basename($path);
|
||||
$this->fileInfo['is_writable'] = $this->isWritable();
|
||||
$this->fileInfo['is_readable'] = $this->isReadable();
|
||||
}elseif(is_dir($this->filePath))
|
||||
{
|
||||
$this->fileStat = @stat($path);
|
||||
$this->fileInfo['name'] = basename($path);
|
||||
$this->fileInfo['path'] = $path;
|
||||
$this->fileInfo['atime'] = $this->fileStat[8];
|
||||
$this->fileInfo['ctime'] = $this->fileStat[10];
|
||||
$this->fileInfo['mtime'] = $this->fileStat[9];
|
||||
$this->fileInfo['is_writable'] = $this->isWritable();
|
||||
$this->fileInfo['is_readable'] = $this->isReadable();
|
||||
}
|
||||
}else
|
||||
{
|
||||
trigger_error('No such file exists. ' . $path, E_USER_NOTICE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
/**
|
||||
* contructor
|
||||
*
|
||||
* @param string $path
|
||||
*/
|
||||
function file($path=null)
|
||||
{
|
||||
$this->__construct($path);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* check if a file or folder writable
|
||||
*
|
||||
* @param file path $path
|
||||
* @return boolean
|
||||
*/
|
||||
function isWritable($path=null)
|
||||
{
|
||||
$path = (is_null($path)?$this->filePath:$path);
|
||||
if (DIRECTORY_SEPARATOR == "\\")
|
||||
{
|
||||
$path = slashToBackslash($path);
|
||||
if(is_file($path))
|
||||
{
|
||||
$fp = @fopen($path,'ab');
|
||||
if($fp)
|
||||
{
|
||||
@fclose($fp);
|
||||
return true;
|
||||
}
|
||||
}elseif(is_dir($path))
|
||||
{
|
||||
$path = addTrailingSlash($path);
|
||||
$tmp = uniqid(time());
|
||||
if (@touch($path . $tmp))
|
||||
{
|
||||
@unlink($path . $tmp);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}else
|
||||
{
|
||||
return @is_writable(slashToBackslash($path));
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* Returns true if the files is readable.
|
||||
*
|
||||
* @return boolean true if the files is readable.
|
||||
*/
|
||||
function isReadable($path =null)
|
||||
{
|
||||
$path = is_null($path)?$this->filePath:$path;
|
||||
return @is_readable(slashToBackslash($path));
|
||||
}
|
||||
/**
|
||||
* change the modified time
|
||||
*
|
||||
* @param string $path
|
||||
* @param string $time
|
||||
* @return boolean
|
||||
*/
|
||||
function setLastModified($path=null, $time)
|
||||
{
|
||||
$path = is_null($path)?$this->filePath:$path;
|
||||
$time = is_null($time)?time():$time;
|
||||
return @touch(slashToBackslash($path), $time);
|
||||
}
|
||||
|
||||
/**
|
||||
* create a new folder
|
||||
*
|
||||
* @path the path for the new folder
|
||||
* @mask
|
||||
* @dirOwner
|
||||
* @return boolean
|
||||
*/
|
||||
function mkdir($path = null, $mask=null, $dirOwner='')
|
||||
{
|
||||
$path = is_null($path)?$this->filePath:$path;
|
||||
if(!file_exists($path))
|
||||
{
|
||||
$mask = is_null($mask)?$this->mask:$mask;
|
||||
$status = @mkdir(slashToBackslash($path));
|
||||
if ($mask)
|
||||
{
|
||||
@chmod(slashToBackslash($path), intval($mask, 8));
|
||||
}
|
||||
if($dirOwner)
|
||||
{
|
||||
$this->chown(slashToBackslash($path), $dirOwner);
|
||||
}
|
||||
return $status;
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
/**
|
||||
* change the own of a file or folder
|
||||
*
|
||||
* @param the file path $path
|
||||
* @param $owner
|
||||
*/
|
||||
function chown($path, $owner)
|
||||
{
|
||||
if(!empty($owner))
|
||||
{
|
||||
$owners = explode(":", $owner);
|
||||
if(!empty($owners[0]))
|
||||
@chown($path, $owners[0]);
|
||||
if(!empty($owners[1]))
|
||||
@chgrp($path, $owner[1]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy a file, or recursively copy a folder and its contents
|
||||
* @author Aidan Lister <aidan@php.net>
|
||||
* @author Paul Scott
|
||||
* @version 1.0.1
|
||||
* @param string $source Source path
|
||||
* @param string $dest Destination path
|
||||
* @return bool Returns TRUE on success, FALSE on failure
|
||||
*/
|
||||
function copyTo($source, $dest)
|
||||
{
|
||||
$source = removeTrailingSlash(backslashToSlash($source));
|
||||
$dest = removeTrailingSlash(backslashToSlash($dest));
|
||||
if(!file_exists($dest) || !is_dir($dest))
|
||||
{
|
||||
if(!$this->mkdir($dest))
|
||||
{
|
||||
$this->_debug('Unable to create folder (' . $dest . ")");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// Copy in to your self?
|
||||
if (getAbsPath($source) == getAbsPath($dest))
|
||||
{
|
||||
$this->_debug('Unable to copy itself. source: ' . getAbsPath($source) . "; dest: " . getAbsPath($dest));
|
||||
return false;
|
||||
}
|
||||
// Simple copy for a file
|
||||
if (is_file($source))
|
||||
{
|
||||
$dest = addTrailingSlash($dest) . (basename($source));
|
||||
if(file_exists($dest))
|
||||
{
|
||||
return false;
|
||||
}else {
|
||||
|
||||
return copy($source, $dest);
|
||||
}
|
||||
|
||||
|
||||
}elseif(is_dir($source))
|
||||
{
|
||||
// Loop through the folder
|
||||
if(file_exists(addTrailingSlash($dest) . basename($source)))
|
||||
{
|
||||
return false;
|
||||
}else
|
||||
{
|
||||
if(!file_exists(addTrailingSlash($dest) . basename($source)) || !is_dir(addTrailingSlash($dest) . basename($source)))
|
||||
{
|
||||
if(!$this->mkdir(addTrailingSlash($dest) . basename($source)))
|
||||
{
|
||||
$this->_debug('Unable to create folder (' . addTrailingSlash($dest) . basename($source) . ")");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
$handle = opendir($source);
|
||||
while(false !== ($readdir = readdir($handle)))
|
||||
{
|
||||
if($readdir != '.' && $readdir != '..')
|
||||
{
|
||||
$path = addTrailingSlash($source).'/'.$readdir;
|
||||
$this->copyTo($path, addTrailingSlash($dest) . basename($source));
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* get next available file name
|
||||
*
|
||||
* @param string $fileToMove the path of the file will be moved to
|
||||
* @param string $destFolder the path of destination folder
|
||||
* @return string
|
||||
*/
|
||||
function getNextAvailableFileName($fileToMove, $destFolder)
|
||||
{
|
||||
|
||||
$folderPath = addslashes(backslashToSlash(getParentPath($fileToMove)));
|
||||
$destFolder = addslashes(backslashToSlash(getParentPath($destFolder)));
|
||||
$finalPath = $destFolder . basename($fileToMove);
|
||||
if(file_exists($fileToMove))
|
||||
{
|
||||
if(is_file())
|
||||
{
|
||||
$fileExt = getFileExt($fileToMove);
|
||||
$fileBaseName = basename($fileToMove, '.' . $fileExt);
|
||||
$count = 1;
|
||||
while(file_exists($destFolder . $fileBaseName . $count . "." . $fileExt))
|
||||
{
|
||||
$count++;
|
||||
}
|
||||
$filePath = $destFolder . $fileBaseName . $count . "." . $fileExt;
|
||||
}elseif(is_dir())
|
||||
{
|
||||
$folderName = basename($fileToMove);
|
||||
$count = 1;
|
||||
while(file_exists($destFolder . $folderName . $count))
|
||||
{
|
||||
$count++;
|
||||
}
|
||||
$filePath = $destFolder . $fileBaseName . $count;
|
||||
}
|
||||
|
||||
}
|
||||
return $finalPath;
|
||||
}
|
||||
/**
|
||||
* get file information
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function getFileInfo()
|
||||
{
|
||||
return $this->fileInfo;
|
||||
}
|
||||
/**
|
||||
* close
|
||||
*
|
||||
*/
|
||||
function close()
|
||||
{
|
||||
$this->fileInfo = null;
|
||||
$this->fileStat = null;
|
||||
}
|
||||
/**
|
||||
* delete a file or a folder and all contents within that folder
|
||||
*
|
||||
* @param string $path
|
||||
* @return boolean
|
||||
*/
|
||||
function delete($path = null)
|
||||
{
|
||||
$path = is_null($path)?$this->filePath:$path;
|
||||
if(file_exists($path))
|
||||
{
|
||||
if(is_file($path))
|
||||
{
|
||||
return @unlink($path);
|
||||
}elseif(is_dir($path))
|
||||
{
|
||||
return $this->__recursive_remove_directory($path);
|
||||
}
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* empty a folder
|
||||
*
|
||||
* @param string $path
|
||||
* @return boolean
|
||||
*/
|
||||
function emptyFolder($path)
|
||||
{
|
||||
$path = is_null($path)?$this->filePath:"";
|
||||
if(file_exists($path) && is_dir($path))
|
||||
{
|
||||
return $this->__recursive_remove_directory($path, true);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function _debug($info)
|
||||
{
|
||||
if($this->debug)
|
||||
{
|
||||
echo $info . "<br>\n";
|
||||
}else
|
||||
{
|
||||
$this->errors[] = $info;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* recursive_remove_directory( directory to delete, empty )
|
||||
* expects path to directory and optional TRUE / FALSE to empty
|
||||
* of course PHP has to have the rights to delete the directory
|
||||
* you specify and all files and folders inside the directory
|
||||
*
|
||||
* to use this function to totally remove a directory, write:
|
||||
* recursive_remove_directory('path/to/directory/to/delete');
|
||||
* to use this function to empty a directory, write:
|
||||
* recursive_remove_directory('path/to/full_directory',TRUE);
|
||||
* @param string $directory
|
||||
* @param boolean $empty
|
||||
* @return boolean
|
||||
*/
|
||||
function __recursive_remove_directory($directory, $empty=FALSE)
|
||||
{
|
||||
// if the path has a slash at the end we remove it here
|
||||
if(substr($directory,-1) == '/')
|
||||
{
|
||||
$directory = substr($directory,0,-1);
|
||||
}
|
||||
|
||||
// if the path is not valid or is not a directory ...
|
||||
if(!file_exists($directory) || !is_dir($directory))
|
||||
{
|
||||
// ... we return false and exit the function
|
||||
return FALSE;
|
||||
|
||||
// ... if the path is not readable
|
||||
}elseif(!is_readable($directory))
|
||||
{
|
||||
// ... we return false and exit the function
|
||||
return FALSE;
|
||||
|
||||
// ... else if the path is readable
|
||||
}else{
|
||||
|
||||
// we open the directory
|
||||
$handle = @opendir($directory);
|
||||
|
||||
// and scan through the items inside
|
||||
while (FALSE !== ($item = @readdir($handle)))
|
||||
{
|
||||
// if the filepointer is not the current directory
|
||||
// or the parent directory
|
||||
if($item != '.' && $item != '..')
|
||||
{
|
||||
// we build the new path to delete
|
||||
$path = $directory.'/'.$item;
|
||||
|
||||
// if the new path is a directory
|
||||
if(is_dir($path)) {
|
||||
// we call this function with the new path
|
||||
$this->__recursive_remove_directory($path);
|
||||
|
||||
// if the new path is a file
|
||||
}else{
|
||||
// we remove the file
|
||||
@unlink($path);
|
||||
}
|
||||
}
|
||||
}
|
||||
// close the directory
|
||||
@closedir($handle);
|
||||
|
||||
// if the option to empty is not set to true
|
||||
if($empty == FALSE)
|
||||
{
|
||||
// try to delete the now empty directory
|
||||
if(!@rmdir($directory))
|
||||
{
|
||||
// return false if not possible
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
// return success
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -1,155 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* class history
|
||||
* this class used to keep records of any changed to uploaded images under a session
|
||||
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
|
||||
* @link www.phpletter.com
|
||||
* @since 22/May/2007
|
||||
*
|
||||
*/
|
||||
class History
|
||||
{
|
||||
var $history = array(); //keep all changes
|
||||
var $path = ''; //path to the iamge
|
||||
var $session = null;
|
||||
/**
|
||||
* constructor
|
||||
*
|
||||
* @param string $path the path to the image
|
||||
* @param object $session an instance of session class
|
||||
*/
|
||||
function __construct($path, &$session)
|
||||
{
|
||||
$this->path = $path;
|
||||
$this->session = &$session;
|
||||
if(!isset($_SESSION[$this->path]))
|
||||
{
|
||||
$_SESSION[$this->path] = array();
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* constructor
|
||||
*
|
||||
* @param string $path the path to the image
|
||||
* @param object $session an instance of session class
|
||||
*/
|
||||
function History($path, &$session)
|
||||
{
|
||||
$this->__construct($path, $session);
|
||||
}
|
||||
|
||||
/**
|
||||
* keep tracks of each changes made to an image
|
||||
*
|
||||
* @param string $key
|
||||
* @param string $info array('name', 'restorable', 'is_original')
|
||||
*/
|
||||
function add($info)
|
||||
{
|
||||
$_SESSION[$this->path][] = $info;
|
||||
}
|
||||
/**
|
||||
* get the lastest changes for restore
|
||||
*
|
||||
* @return array array('name', 'restorable', 'is_original')
|
||||
*/
|
||||
function getNumRestorable()
|
||||
{
|
||||
$output = 0;
|
||||
if(isset($_SESSION[$this->path]) && is_array($_SESSION[$this->path]))
|
||||
{
|
||||
foreach($_SESSION[$this->path] as $k=>$v)
|
||||
{
|
||||
if(!empty($v['restorable']) && empty($v['is_original']))
|
||||
{
|
||||
if(file_exists($this->session->getSessionDir() . $v['name']))
|
||||
{
|
||||
$output++;
|
||||
}else
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* get the path of image which keep the lastest changes
|
||||
*
|
||||
* @return return empty array when failed
|
||||
*/
|
||||
function getLastestRestorable()
|
||||
{
|
||||
if(isset($_SESSION[$this->path]) && is_array($_SESSION[$this->path]) && sizeof($_SESSION[$this->path]))
|
||||
{
|
||||
$sessionImages = array_reverse($_SESSION[$this->path], true);
|
||||
$lastestKey = '';
|
||||
foreach($sessionImages as $k=>$v)
|
||||
{
|
||||
if($v['restorable'] && empty($v['is_original']) && file_exists($this->session->getSessionDir() . $v['name']))
|
||||
{
|
||||
return $sessionImages[$k];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return array();
|
||||
|
||||
}
|
||||
/**
|
||||
* get the original image which is kept in the session folder
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function getOriginalImage()
|
||||
{
|
||||
$outputs = array();
|
||||
if(isset($_SESSION[$this->path]) && is_array($_SESSION[$this->path]))
|
||||
{
|
||||
$sessionImages = array_reverse($_SESSION[$this->path], true);
|
||||
foreach($sessionImages as $k=>$v)
|
||||
{
|
||||
if(!empty($v['is_original']))
|
||||
{
|
||||
if(file_exists($this->session->getSessionDir() . $v['name']))
|
||||
{
|
||||
return array('info'=>$_SESSION[$this->path][$k], 'key'=>$k);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
return $outputs;
|
||||
|
||||
}
|
||||
/**
|
||||
* remove the lastest restorable state
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function restore()
|
||||
{
|
||||
if(isset($_SESSION[$this->path]) && is_array($_SESSION[$this->path]) && sizeof($_SESSION[$this->path]))
|
||||
{
|
||||
$sessionImages = array_reverse($_SESSION[$this->path], true);
|
||||
$lastestKey = '';
|
||||
foreach($sessionImages as $k=>$v)
|
||||
{
|
||||
if($v['restorable'] && empty($v['is_original']))
|
||||
{
|
||||
unset($_SESSION[$k]);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
@@ -1,789 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* this class provide functions to edit an image, e.g. resize, rotate, flip, crop
|
||||
* @author Logan Cai cailongqun [at] yahoo [dot] com [dot] cn
|
||||
* @link www.phpletter.com
|
||||
* @version 0.9
|
||||
* @since 14/May/2007
|
||||
* @name Image
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
class Image
|
||||
{
|
||||
var $_debug = false;
|
||||
var $_errors = array();
|
||||
var $gdInfo = array(); //keep all information of GD extension
|
||||
var $_imgOrig = null; //the hanlder of original image
|
||||
var $_imgFinal = null; //the handler of final image
|
||||
var $imageFile = null;
|
||||
var $transparentColorRed = null;
|
||||
var $transparentColorGreen = null;
|
||||
var $transparentColorBlue = null;
|
||||
var $chmod = 0755;
|
||||
var $_imgInfoOrig = array(
|
||||
'name'=>'',
|
||||
'ext'=>'',
|
||||
'size'=>'',
|
||||
'width'=>'',
|
||||
'height'=>'',
|
||||
'type'=>'',
|
||||
'path'=>'',
|
||||
);
|
||||
var $_imgInfoFinal = array(
|
||||
'name'=>'',
|
||||
'ext'=>'',
|
||||
'size'=>'',
|
||||
'width'=>'',
|
||||
'height'=>'',
|
||||
'type'=>'',
|
||||
'path'=>'',
|
||||
);
|
||||
var $_imgQuality = 90;
|
||||
/**
|
||||
* constructor
|
||||
*
|
||||
* @param boolean $debug
|
||||
* @return Image
|
||||
*/
|
||||
|
||||
function __construct($debug = false)
|
||||
{
|
||||
$this->enableDebug($debug);
|
||||
$this->gdInfo = $this->getGDInfo();
|
||||
}
|
||||
function Image($debug = false)
|
||||
{
|
||||
$this->__construct($debug);
|
||||
}
|
||||
/**
|
||||
* enable to debug
|
||||
*
|
||||
* @param boolean $value
|
||||
*/
|
||||
function enableDebug($value)
|
||||
{
|
||||
$this->_debug = ($value?true:false);
|
||||
}
|
||||
/**
|
||||
* check if debug enable
|
||||
* @return boolean
|
||||
*/
|
||||
function _isDebugEnable()
|
||||
{
|
||||
return $this->_debug;
|
||||
}
|
||||
|
||||
/**
|
||||
* append to errors array and shown the each error when the debug turned on
|
||||
*
|
||||
* @param string $string
|
||||
* @return void
|
||||
* @access private
|
||||
* @copyright this function originally come from Andy's php
|
||||
*/
|
||||
function _debug($value)
|
||||
{
|
||||
$this->_errors[] = $value;
|
||||
if ($this->_debug)
|
||||
{
|
||||
echo $value . "<br />\n";
|
||||
}
|
||||
}
|
||||
/**
|
||||
* show erros
|
||||
*
|
||||
*/
|
||||
function showErrors()
|
||||
{
|
||||
if(sizeof($this->_errors))
|
||||
{
|
||||
foreach($this->_errors as $error)
|
||||
{
|
||||
echo $error . "<br />\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Load an image from the file system.
|
||||
*
|
||||
* @param string $filename
|
||||
* @return bool
|
||||
* @access public
|
||||
* @copyright this function originally come from Andy's php
|
||||
*/
|
||||
function loadImage($filename)
|
||||
{
|
||||
$ext = strtolower($this->_getExtension($filename));
|
||||
$func = 'imagecreatefrom' . ($ext == 'jpg' ? 'jpeg' : $ext);
|
||||
if (!$this->_isSupported($filename, $ext, $func, false)) {
|
||||
return false;
|
||||
}
|
||||
if($ext == "gif")
|
||||
{
|
||||
// the following part gets the transparency color for a gif file
|
||||
// this code is from the PHP manual and is written by
|
||||
// fred at webblake dot net and webmaster at webnetwizard dotco dotuk, thanks!
|
||||
$fp = @fopen($filename, "rb");
|
||||
$result = @fread($fp, 13);
|
||||
$colorFlag = ord(substr($result,10,1)) >> 7;
|
||||
$background = ord(substr($result,11));
|
||||
if ($colorFlag) {
|
||||
$tableSizeNeeded = ($background + 1) * 3;
|
||||
$result = @fread($fp, $tableSizeNeeded);
|
||||
$this->transparentColorRed = ord(substr($result, $background * 3, 1));
|
||||
$this->transparentColorGreen = ord(substr($result, $background * 3 + 1, 1));
|
||||
$this->transparentColorBlue = ord(substr($result, $background * 3 + 2, 1));
|
||||
}
|
||||
fclose($fp);
|
||||
// -- here ends the code related to transparency handling
|
||||
}
|
||||
$this->_imgOrig = @$func($filename);
|
||||
if ($this->_imgOrig == null) {
|
||||
$this->_debug("The image could not be created from the '$filename' file using the '$func' function.");
|
||||
return false;
|
||||
}else
|
||||
{
|
||||
$this->imageFile = $filename;
|
||||
$this->_imgInfoOrig = array(
|
||||
'name'=>basename($filename),
|
||||
'ext'=>$ext,
|
||||
'size'=>filesize($filename),
|
||||
'path'=>$filename,
|
||||
);
|
||||
$imgInfo = $this->_getImageInfo($filename);
|
||||
if(sizeof($imgInfo))
|
||||
{
|
||||
foreach($imgInfo as $k=>$v)
|
||||
{
|
||||
$this->_imgInfoOrig[$k] = $v;
|
||||
$this->_imgInfoFinal[$k] = $v;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load an image from a string (eg. from a database table)
|
||||
*
|
||||
* @param string $string
|
||||
* @return bool
|
||||
* @access public
|
||||
* @copyright this function originally come from Andy's php
|
||||
*/
|
||||
function loadImageFromString($string)
|
||||
{
|
||||
$this->imageFile = $filename;
|
||||
$this->_imgOrig = imagecreatefromstring($string);
|
||||
if (!$this->_imgOrig) {
|
||||
$this->_debug('The image (supplied as a string) could not be created.');
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Save the modified image
|
||||
*
|
||||
* @param string $filename
|
||||
* @param int $quality
|
||||
* @param string $forcetype
|
||||
* @return bool
|
||||
* @access public
|
||||
* @copyright this function originally come from Andy's php
|
||||
*/
|
||||
function saveImage($filename, $quality = 90, $forcetype = '')
|
||||
{
|
||||
if ($this->_imgFinal == null) {
|
||||
$this->_debug('No changes intend to be made.');
|
||||
return false;
|
||||
}
|
||||
|
||||
$ext = ($forcetype == '') ? $this->_getExtension($filename) : strtolower($forcetype);
|
||||
$func = 'image' . ($ext == 'jpg' ? 'jpeg' : $ext);
|
||||
if (!$this->_isSupported($filename, $ext, $func, true))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
$saved = false;
|
||||
switch($ext)
|
||||
{
|
||||
case 'gif':
|
||||
if ($this->gdInfo['Truecolor Support'] && imageistruecolor($this->_imgFinal))
|
||||
{
|
||||
imagetruecolortopalette($this->_imgFinal, false, 255);
|
||||
}
|
||||
case 'png':
|
||||
$saved = $func($this->_imgFinal, $filename);
|
||||
break;
|
||||
case 'jpg':
|
||||
$saved = $func($this->_imgFinal, $filename, $quality);
|
||||
break;
|
||||
}
|
||||
|
||||
if ($saved === false)
|
||||
{
|
||||
$this->_debug("The image could not be saved to the '$filename' file as the file type '$ext' using the '$func' function.");
|
||||
return false;
|
||||
}else
|
||||
{
|
||||
$this->_imgInfoFinal['size'] = @filesize($filename);
|
||||
@chmod($filename, intval($this->chmod, 8));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* Shows the masked image without any saving
|
||||
*
|
||||
* @param string $type
|
||||
* @param int $quality
|
||||
* @return bool
|
||||
* @access public
|
||||
* @copyright this function originally come from Andy's php
|
||||
*/
|
||||
function showImage($type = '', $quality = '')
|
||||
{
|
||||
if ($this->_imgFinal == null) {
|
||||
$this->_debug('There is no cropped image to show.');
|
||||
return false;
|
||||
}
|
||||
$type = (!empty($type)?$type:$this->_imgInfoOrig['ext']);
|
||||
$quality = (!empty($quality)?$quality:$this->_imgQuality);
|
||||
|
||||
$type = strtolower($type);
|
||||
$func = 'image' . ($type == 'jpg' ? 'jpeg' : $type);
|
||||
$head = 'image/' . ($type == 'jpg' ? 'jpeg' : $type);
|
||||
|
||||
if (!$this->_isSupported('[showing file]', $type, $func, false)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
header("Content-type: $head");
|
||||
switch($type)
|
||||
{
|
||||
case 'gif':
|
||||
if ($this->gdInfo['Truecolor Support'] && imageistruecolor($this->_imgFinal))
|
||||
{
|
||||
@imagetruecolortopalette($this->_imgFinal, false, 255);
|
||||
}
|
||||
case 'png':
|
||||
$func($this->_imgFinal);
|
||||
break;
|
||||
case 'jpg':
|
||||
$func($this->_imgFinal, '', $quality);
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used for cropping image
|
||||
*
|
||||
* @param int $dst_x
|
||||
* @param int $dst_y
|
||||
* @param int $dst_w
|
||||
* @param int $dst_h
|
||||
* @return bool
|
||||
* @access public
|
||||
* @copyright this function originally come from Andy's php
|
||||
*/
|
||||
function crop($dst_x, $dst_y, $dst_w, $dst_h)
|
||||
{
|
||||
if ($this->_imgOrig == null) {
|
||||
$this->_debug('The original image has not been loaded.');
|
||||
return false;
|
||||
}
|
||||
if (($dst_w <= 0) || ($dst_h <= 0)) {
|
||||
$this->_debug('The image could not be cropped because the size given is not valid.');
|
||||
return false;
|
||||
}
|
||||
if (($dst_w > imagesx($this->_imgOrig)) || ($dst_h > imagesy($this->_imgOrig))) {
|
||||
$this->_debug('The image could not be cropped because the size given is larger than the original image.');
|
||||
return false;
|
||||
}
|
||||
$this->_createFinalImageHandler($dst_w, $dst_h);
|
||||
if ($this->gdInfo['Truecolor Support'])
|
||||
{
|
||||
if(!@imagecopyresampled($this->_imgFinal, $this->_imgOrig, 0, 0, $dst_x, $dst_y, $dst_w, $dst_h, $dst_w, $dst_h))
|
||||
{
|
||||
$this->_debug('Unable crop the image.');
|
||||
return false;
|
||||
}
|
||||
} else
|
||||
{
|
||||
if(!@imagecopyresized($this->_imgFinal, $this->_imgOrig, 0, 0, $dst_x, $dst_y, $dst_w, $dst_h, $dst_w, $dst_h))
|
||||
{
|
||||
$this->_debug('Unable crop the image.');
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
$this->_imgInfoFinal['width'] = $dst_w;
|
||||
$this->_imgInfoFinal['height'] = $dst_h;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Resize the Image in the X and/or Y direction
|
||||
* If either is 0 it will be scaled proportionally
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @param mixed $new_x
|
||||
* @param mixed $new_y
|
||||
* @param boolean $constraint keep to resize the image proportionally
|
||||
* @param boolean $unchangeIfsmaller keep the orignial size if the orignial smaller than the new size
|
||||
*
|
||||
*
|
||||
* @return mixed none or PEAR_error
|
||||
*/
|
||||
function resize( $new_x, $new_y, $constraint= false, $unchangeIfsmaller=false)
|
||||
{
|
||||
if(!$this->_imgOrig)
|
||||
{
|
||||
$this->_debug('No image fould.');
|
||||
return false;
|
||||
}
|
||||
|
||||
$new_x = (int)($new_x);
|
||||
$new_y = (int)($new_y);
|
||||
if($new_x <=0 || $new_y <= 0)
|
||||
{
|
||||
$this->_debug('either of new width or height can be zeor or less.');
|
||||
}else
|
||||
{
|
||||
|
||||
if($constraint)
|
||||
{
|
||||
if($new_x < 1 && $new_y < 1)
|
||||
{
|
||||
$new_x = $this->_imgInfoOrig['width'];
|
||||
$new_y = $this->_imgInfoOrig['height'];
|
||||
}elseif($new_x < 1)
|
||||
{
|
||||
$new_x = floor($new_y / $this->_imgInfoOrig['height'] * $this->_imgInfoOrig['width']);
|
||||
|
||||
}elseif($new_y < 1)
|
||||
{
|
||||
$new_y = floor($new_x / $this->_imgInfoOrig['width'] * $this->_imgInfoOrig['height']);
|
||||
}else
|
||||
{
|
||||
$scale = min($new_x/$this->_imgInfoOrig['width'], $new_y/$this->_imgInfoOrig['height']) ;
|
||||
$new_x = floor($scale*$this->_imgInfoOrig['width']);
|
||||
$new_y = floor($scale*$this->_imgInfoOrig['height']);
|
||||
}
|
||||
}
|
||||
if($unchangeIfsmaller)
|
||||
{
|
||||
if($this->_imgInfoOrig['width'] < $new_x && $this->_imgInfoOrig['height'] < $new_y )
|
||||
{
|
||||
$new_x = $this->_imgInfoOrig['width'];
|
||||
$new_y = $this->_imgInfoOrig['height'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(is_null($this->_imgOrig))
|
||||
{
|
||||
$this->loadImage($filePath);
|
||||
}
|
||||
if(sizeof($this->_errors) == 0)
|
||||
{
|
||||
return $this->_resize($new_x, $new_y);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
} // End resize
|
||||
/**
|
||||
* resize the image and return the thumbnail image details array("width"=>, "height"=>, "name")
|
||||
*
|
||||
* @param string $fileName
|
||||
* @param int $new_x the thumbnail width
|
||||
* @param int $new_y the thumbnail height
|
||||
* @param string $mode can be save, view and both
|
||||
* @return unknown
|
||||
*/
|
||||
function _resize( $new_x, $new_y)
|
||||
{
|
||||
$this->_createFinalImageHandler($new_x, $new_y);
|
||||
// hacks fot transparency of png24 files
|
||||
if ($this->_imgInfoOrig['type'] == 'png')
|
||||
{
|
||||
@imagealphablending($this->_imgFinal, false);
|
||||
if(function_exists('ImageCopyResampled'))
|
||||
{
|
||||
@ImageCopyResampled($this->_imgFinal, $this->_imgOrig, 0, 0, 0, 0, $new_x, $new_y, $this->_imgInfoOrig['width'], $this->_imgInfoOrig['height']);
|
||||
} else {
|
||||
@ImageCopyResized($this->_imgFinal, $this->_imgOrig, 0, 0, 0, 0, $new_x, $new_y, $this->_imgInfoOrig['width'], $this->_imgInfoOrig['height']);
|
||||
}
|
||||
@imagesavealpha($this->_imgFinal, true);
|
||||
|
||||
}else
|
||||
{//for the rest image
|
||||
if(function_exists('ImageCopyResampled'))
|
||||
{
|
||||
@ImageCopyResampled($this->_imgFinal, $this->_imgOrig, 0, 0, 0, 0, $new_x, $new_y, $this->_imgInfoOrig['width'], $this->_imgInfoOrig['height']);
|
||||
} else {
|
||||
@ImageCopyResized($this->_imgFinal, $this->_imgOrig, 0, 0, 0, 0, $new_x, $new_y, $this->_imgInfoOrig['width'], $this->_imgInfoOrig['height']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$this->_imgInfoFinal['width'] = $new_x;
|
||||
$this->_imgInfoFinal['height'] = $new_y;
|
||||
$this->_imgInfoFinal['name'] = basename($this->_imgInfoOrig['name']);
|
||||
$this->_imgInfoFinal['path'] = $this->_imgInfoOrig['path'];
|
||||
if($this->_imgFinal)
|
||||
{
|
||||
return true;
|
||||
}else
|
||||
{
|
||||
$this->_debug('Unable to resize the image on the fly.');
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* Get the extension of a file name
|
||||
*
|
||||
* @param string $file
|
||||
* @return string
|
||||
* @copyright this function originally come from Andy's php
|
||||
*/
|
||||
function _getExtension($file)
|
||||
{
|
||||
$ext = '';
|
||||
if (strrpos($file, '.')) {
|
||||
$ext = strtolower(substr($file, (strrpos($file, '.') ? strrpos($file, '.') + 1 : strlen($file)), strlen($file)));
|
||||
}
|
||||
return $ext;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate whether image reading/writing routines are valid.
|
||||
*
|
||||
* @param string $filename
|
||||
* @param string $extension
|
||||
* @param string $function
|
||||
* @param bool $write
|
||||
* @return bool
|
||||
* @access private
|
||||
* @copyright this function originally come from Andy's php
|
||||
*/
|
||||
function _isSupported($filename, $extension, $function, $write = false)
|
||||
{
|
||||
|
||||
$giftype = ($write) ? ' Create Support' : ' Read Support';
|
||||
$support = strtoupper($extension) . ($extension == 'gif' ? $giftype : ' Support');
|
||||
|
||||
if (!isset($this->gdInfo[$support]) || $this->gdInfo[$support] == false) {
|
||||
$request = ($write) ? 'saving' : 'reading';
|
||||
$this->_debug("Support for $request the file type '$extension' cannot be found.");
|
||||
return false;
|
||||
}
|
||||
if (!function_exists($function)) {
|
||||
$request = ($write) ? 'save' : 'read';
|
||||
$this->_debug("The '$function' function required to $request the '$filename' file cannot be found.");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* flip image horizotally or vertically
|
||||
*
|
||||
* @param string $direction
|
||||
* @return boolean
|
||||
*/
|
||||
function flip($direction="horizontal")
|
||||
{
|
||||
$this->_createFinalImageHandler($this->_imgInfoOrig['width'], $this->_imgInfoOrig['height']);
|
||||
if($direction != "vertical")
|
||||
{
|
||||
$dst_x = 0;
|
||||
$dst_y = 0;
|
||||
$src_x = $this->_imgInfoOrig['width'] -1;
|
||||
$src_y = 0;
|
||||
$dst_w = $this->_imgInfoOrig['width'];
|
||||
$dst_h = $this->_imgInfoOrig['height'];
|
||||
$src_w = 0 - $this->_imgInfoOrig['width'];
|
||||
$src_h = $this->_imgInfoOrig['height'];
|
||||
|
||||
}else
|
||||
{
|
||||
$dst_x = 0;
|
||||
$dst_y = 0;
|
||||
$src_x = 0;
|
||||
$src_y = $this->_imgInfoOrig['height'] - 1;
|
||||
$dst_w = $this->_imgInfoOrig['width'];
|
||||
$dst_h = $this->_imgInfoOrig['height'];
|
||||
$src_w = $this->_imgInfoOrig['width'];
|
||||
$src_h = 0 - $this->_imgInfoOrig['height'];
|
||||
}
|
||||
if(function_exists('ImageCopyResampled')){
|
||||
ImageCopyResampled($this->_imgFinal, $this->_imgOrig, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h);
|
||||
} else {
|
||||
ImageCopyResized($this->_imgFinal, $this->_imgOrig, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h);
|
||||
}
|
||||
$this->_imgInfoFinal['width'] = $dst_w;
|
||||
$this->_imgInfoFinal['height'] = $dst_h;
|
||||
$this->_imgInfoFinal['name'] = basename($this->imageFile);
|
||||
$this->_imgInfoFinal['path'] = $this->imageFile;
|
||||
if($this->_imgFinal)
|
||||
{
|
||||
return true;
|
||||
}else
|
||||
{
|
||||
$this->_debug('Unable to resize the image on the fly.');
|
||||
return false;
|
||||
|
||||
}
|
||||
}
|
||||
/**
|
||||
* flip vertically
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function flipVertical()
|
||||
{
|
||||
return $this->flip('vertical');
|
||||
}
|
||||
/**
|
||||
* flip horizontal
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function flipHorizontal()
|
||||
{
|
||||
return $this->flip('horizontal');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* get the GD version information
|
||||
*
|
||||
* @param bool $versionOnly
|
||||
* @return array
|
||||
* @access private
|
||||
* @copyright this function originally come from Andy's php
|
||||
*/
|
||||
function getGDInfo($versionOnly = false)
|
||||
{
|
||||
$outputs = array();
|
||||
if (function_exists('gd_info'))
|
||||
{
|
||||
$outputs = gd_info();
|
||||
} else
|
||||
{
|
||||
$gd = array(
|
||||
'GD Version' => '',
|
||||
'GIF Read Support' => false,
|
||||
'GIF Create Support' => false,
|
||||
'JPG Support' => false,
|
||||
'PNG Support' => false,
|
||||
'FreeType Support' => false,
|
||||
'FreeType Linkage' => '',
|
||||
'T1Lib Support' => false,
|
||||
'WBMP Support' => false,
|
||||
'XBM Support' => false
|
||||
);
|
||||
ob_start();
|
||||
phpinfo();
|
||||
$buffer = ob_get_contents();
|
||||
ob_end_clean();
|
||||
foreach (explode("\n", $buffer) as $line) {
|
||||
$line = array_map('trim', (explode('|', strip_tags(str_replace('</td>', '|', $line)))));
|
||||
if (isset($gd[$line[0]])) {
|
||||
if (strtolower($line[1]) == 'enabled') {
|
||||
$gd[$line[0]] = true;
|
||||
} else {
|
||||
$gd[$line[0]] = $line[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
$outputs = $gd;
|
||||
}
|
||||
|
||||
if (isset($outputs['JIS-mapped Japanese Font Support'])) {
|
||||
unset($outputs['JIS-mapped Japanese Font Support']);
|
||||
}
|
||||
if (function_exists('imagecreatefromgd')) {
|
||||
$outputs['GD Support'] = true;
|
||||
}
|
||||
if (function_exists('imagecreatefromgd2')) {
|
||||
$outputs['GD2 Support'] = true;
|
||||
}
|
||||
if (preg_match('/^(bundled|2)/', $outputs['GD Version'])) {
|
||||
$outputs['Truecolor Support'] = true;
|
||||
} else {
|
||||
$outputs['Truecolor Support'] = false;
|
||||
}
|
||||
if ($outputs['GD Version'] != '') {
|
||||
$match = array();
|
||||
if (preg_match('/([0-9\.]+)/', $outputs['GD Version'], $match)) {
|
||||
$foo = explode('.', $match[0]);
|
||||
$outputs['Version'] = array('major' => isset($foo[0])?$foo[0]:'', 'minor' => isset($foo[1])?$foo[1]:'', 'patch' => isset($foo[2])?$foo:"");
|
||||
}
|
||||
}
|
||||
|
||||
return ($versionOnly) ? $outputs['Version'] : $outputs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy the resources used by the images.
|
||||
*
|
||||
* @param bool $original
|
||||
* @return void
|
||||
* @access public
|
||||
* @copyright this function originally come from Andy's php
|
||||
*/
|
||||
function DestroyImages($original = true)
|
||||
{
|
||||
if(!is_null($this->_imgFinal))
|
||||
{
|
||||
@imagedestroy($this->_imgFinal);
|
||||
}
|
||||
$this->_imgFinal = null;
|
||||
if ($original && !is_null($this->_imgOrig)) {
|
||||
@imagedestroy($this->_imgOrig);
|
||||
$this->_imgOrig = null;
|
||||
}
|
||||
}
|
||||
|
||||
function getImageInfo($imagePath)
|
||||
{
|
||||
return $this->_getImageInfo($imagePath);
|
||||
}
|
||||
/**
|
||||
* get image information, e.g. width, height, type
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
function _getImageInfo($imagePath)
|
||||
{
|
||||
$outputs = array();
|
||||
$imageInfo = @GetImageSize($imagePath);
|
||||
if ($imageInfo && is_array($imageInfo))
|
||||
{
|
||||
switch($imageInfo[2]){
|
||||
case 1:
|
||||
$type = 'gif';
|
||||
break;
|
||||
case 2:
|
||||
$type = 'jpeg';
|
||||
break;
|
||||
case 3:
|
||||
$type = 'png';
|
||||
break;
|
||||
case 4:
|
||||
$type = 'swf';
|
||||
break;
|
||||
case 5:
|
||||
$type = 'psd';
|
||||
case 6:
|
||||
$type = 'bmp';
|
||||
case 7:
|
||||
case 8:
|
||||
$type = 'tiff';
|
||||
default:
|
||||
$type = '';
|
||||
}
|
||||
$outputs['width'] = $imageInfo[0];
|
||||
$outputs['height'] = $imageInfo[1];
|
||||
$outputs['type'] = $type;
|
||||
$outputs['ext'] = $this->_getExtension($imagePath);
|
||||
} else {
|
||||
$this->_debug('Unable locate the image or read images information.');
|
||||
}
|
||||
return $outputs;
|
||||
|
||||
}
|
||||
function rotate($angle, $bgColor=0)
|
||||
{
|
||||
$angle = (int)($angle) -360;
|
||||
while($angle <0)
|
||||
{
|
||||
$angle += 360;
|
||||
}
|
||||
|
||||
|
||||
if($this->_imgFinal = imagerotate($this->_imgOrig, $angle))
|
||||
{
|
||||
return true;
|
||||
}else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
/**
|
||||
* get the original image info
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function getOriginalImageInfo()
|
||||
{
|
||||
return $this->_imgInfoOrig;
|
||||
}
|
||||
/**
|
||||
* return the final image info
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function getFinalImageInfo()
|
||||
{
|
||||
if($this->_imgInfoFinal['width'] == '')
|
||||
{
|
||||
if(is_null($this->_imgFinal))
|
||||
{
|
||||
$this->_imgInfoFinal = $this->_imgInfoOrig;
|
||||
}else
|
||||
{
|
||||
$this->_imgInfoFinal['width'] = @imagesx($this->_imgFinal);
|
||||
$this->_imgInfoFinal['height'] = @imagesy($this->_imgFinal);
|
||||
}
|
||||
}
|
||||
return $this->_imgInfoFinal;
|
||||
}
|
||||
|
||||
/**
|
||||
* create final image handler
|
||||
*
|
||||
* @access private
|
||||
* @param $dst_w width
|
||||
* @param $dst_h height
|
||||
* @return boolean
|
||||
* @copyright original from noname at nivelzero dot ro
|
||||
*/
|
||||
function _createFinalImageHandler($dst_w, $dst_h)
|
||||
{
|
||||
if(function_exists('ImageCreateTrueColor'))
|
||||
{
|
||||
$this->_imgFinal = @ImageCreateTrueColor($dst_w,$dst_h);
|
||||
} else {
|
||||
$this->_imgFinal = @ImageCreate($dst_w,$dst_h);
|
||||
}
|
||||
if (!is_null($this->transparentColorRed) && !is_null($this->transparentColorGreen) && !is_null($this->transparentColorBlue)) {
|
||||
|
||||
$transparent = @imagecolorallocate($targetImageIdentifier, $this->transparentColorRed, $this->transparentColorGreen, $this->transparentColorBlue);
|
||||
@imagefilledrectangle($this->_imgFinal, 0, 0, $dst_w, $dst_h, $transparent);
|
||||
@imagecolortransparent($this->_imgFinal, $transparent);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -1,373 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* file listing
|
||||
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
|
||||
* @link www.phpletter.com
|
||||
* @since 22/April/2007
|
||||
*
|
||||
*/
|
||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "class.file.php");
|
||||
class manager
|
||||
{
|
||||
var $currentFolderPath;
|
||||
var $sessionAction = null; //object to session action
|
||||
var $flags = array('no'=>'noFlag', 'cut'=>'cutFlag', 'copy'=>'copyFlag');
|
||||
var $forceFolderOnTop = false; //forced to have folder shown on the top of the list
|
||||
var $currentFolderInfo = array(
|
||||
'name'=>'',
|
||||
'subdir'=>0,
|
||||
'file'=>0,
|
||||
'ctime'=>'',
|
||||
'mtime'=>'',
|
||||
'is_readable'=>'',
|
||||
'is_writable'=>'',
|
||||
'size'=>0,
|
||||
'path'=>'',
|
||||
'type'=>'folder',
|
||||
'flag'=>'noFlag',
|
||||
'friendly_path'=>'',
|
||||
);
|
||||
|
||||
var $lastVisitedFolderPathIndex = 'ajax_last_visited_folder';
|
||||
var $folderPathIndex = "path";
|
||||
var $calculateSubdir = true;
|
||||
var $fileTypes = array(
|
||||
array(array("exe", "com"), "fileExe", SEARCH_TYPE_EXE, 0),
|
||||
array(array("gif", "jpg", "png", "bmp", "tif"), "filePicture", SEARCH_TYPE_IMG, 1),
|
||||
array(array("zip", "sit", "rar", "gz", "tar"), "fileZip", SEARCH_TYPE_ARCHIVE, 0),
|
||||
array(array("htm", "html", "php", "jsp", "asp", 'js', 'css'), "fileCode", SEARCH_TYPE_HTML, 1),
|
||||
array(array("mov", "ram", "rm", "asx", "dcr", "wmv"), "fileVideo", SEARCH_TYPE_VIDEO, 1),
|
||||
array(array("mpg", "avi", "asf", "mpeg"), "fileVideo", SEARCH_TYPE_MOVIE, 1),
|
||||
array(array("aif", "aiff", "wav", "mp3", "wma"), "fileMusic", SEARCH_TYPE_MUSIC, 1),
|
||||
array(array("swf", 'flv'), "fileFlash", SEARCH_TYPE_FLASH, 1),
|
||||
array(array("ppt"), "filePPT", SEARCH_TYPE_PPT, 0),
|
||||
array(array("rtf"), "fileRTF", SEARCH_TYPE_DOC, 0),
|
||||
array(array("doc"), "fileWord", SEARCH_TYPE_WORD, 0),
|
||||
array(array("pdf"), "fileAcrobat", SEARCH_TYPE_PDF, 0),
|
||||
array(array("xls", "csv"), "fileExcel", SEARCH_TYPE_EXCEL, 0),
|
||||
array(array("txt"), "fileText", SEARCH_TYPE_TEXT, 1),
|
||||
array(array("xml", "xsl", "dtd"), "fileXml", SEARCH_TYPE_XML, 1)
|
||||
);
|
||||
|
||||
/**
|
||||
* constructor
|
||||
* @path the path to a folder
|
||||
* @calculateSubdir force to get the subdirectories information
|
||||
*/
|
||||
function __construct($path = null, $calculateSubdir=true)
|
||||
{
|
||||
|
||||
$this->calculateSubdir = $calculateSubdir;
|
||||
if(defined('CONFIG_SYS_FOLDER_SHOWN_ON_TOP'))
|
||||
{
|
||||
$this->forceFolderOnTop = CONFIG_SYS_FOLDER_SHOWN_ON_TOP;
|
||||
}
|
||||
if(!is_null($path))
|
||||
{
|
||||
$this->currentFolderPath = $path;
|
||||
|
||||
}elseif(isset($_GET[$this->folderPathIndex]) && file_exists($_GET[$this->folderPathIndex]) && !is_file($_GET[$this->folderPathIndex]) )
|
||||
{
|
||||
$this->currentFolderPath = $_GET[$this->folderPathIndex];
|
||||
}
|
||||
elseif(isset($_SESSION[$this->lastVisitedFolderPathIndex]) && file_exists($_SESSION[$this->lastVisitedFolderPathIndex]) && !is_file($_SESSION[$this->lastVisitedFolderPathIndex]))
|
||||
{
|
||||
$this->currentFolderPath = $_SESSION[$this->lastVisitedFolderPathIndex];
|
||||
}else
|
||||
{
|
||||
$this->currentFolderPath = CONFIG_SYS_DEFAULT_PATH;
|
||||
}
|
||||
|
||||
$this->currentFolderPath = (isUnderRoot($this->currentFolderPath)?backslashToSlash((addTrailingSlash($this->currentFolderPath))):CONFIG_SYS_DEFAULT_PATH);
|
||||
|
||||
if($this->calculateSubdir)
|
||||
{// keep track of this folder path in session
|
||||
$_SESSION[$this->lastVisitedFolderPathIndex] = $this->currentFolderPath;
|
||||
}
|
||||
if(is_dir($this->currentFolderPath))
|
||||
{
|
||||
$file = new file($this->currentFolderPath);
|
||||
$folderInfo = $file->getFileInfo();
|
||||
if(sizeof($folderInfo))
|
||||
{
|
||||
$this->currentFolderInfo['name']=basename($this->currentFolderPath);
|
||||
$this->currentFolderInfo['subdir']=0;
|
||||
$this->currentFolderInfo['file']=0;
|
||||
$this->currentFolderInfo['ctime']=$folderInfo['ctime'];
|
||||
$this->currentFolderInfo['mtime']=$folderInfo['mtime'];
|
||||
$this->currentFolderInfo['is_readable']=$folderInfo['is_readable'];
|
||||
$this->currentFolderInfo['is_writable']=$folderInfo['is_writable'];
|
||||
$this->currentFolderInfo['path'] = $this->currentFolderPath;
|
||||
$this->currentFolderInfo['friendly_path'] = transformFilePath($this->currentFolderPath);
|
||||
$this->currentFolderInfo['type'] = "folder";
|
||||
$this->currentFolderInfo['cssClass']='folder';
|
||||
|
||||
//$this->currentFolderInfo['flag'] = $folderInfo['flag'];
|
||||
}
|
||||
}
|
||||
if($calculateSubdir && !file_exists($this->currentFolderPath))
|
||||
{
|
||||
die(ERR_FOLDER_NOT_FOUND . $this->currentFolderPath);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
function setSessionAction(&$session)
|
||||
{
|
||||
$this->sessionAction = $session;
|
||||
}
|
||||
/**
|
||||
* constructor
|
||||
*/
|
||||
function manager($path = null, $calculateSubdir=true)
|
||||
{
|
||||
$this->__construct($path, $calculateSubdir);
|
||||
}
|
||||
/**
|
||||
* get current folder path
|
||||
* @return string
|
||||
*/
|
||||
function getCurrentFolderPath()
|
||||
{
|
||||
return $this->currentFolderPath;
|
||||
}
|
||||
/**
|
||||
* get the list of files and folders under this current fold
|
||||
* @return array
|
||||
*/
|
||||
function getFileList()
|
||||
{
|
||||
$outputs = array();
|
||||
$files = array();
|
||||
$folders = array();
|
||||
$tem = array();
|
||||
$dirHandler = @opendir($this->currentFolderPath);
|
||||
if($dirHandler)
|
||||
{
|
||||
while(false !== ($file = readdir($dirHandler)))
|
||||
{
|
||||
if($file != '.' && $file != '..')
|
||||
{
|
||||
$flag = $this->flags['no'];
|
||||
|
||||
if($this->sessionAction->getFolder() == $this->currentFolderPath)
|
||||
{//check if any flag associated with this folder or file
|
||||
$folder = addTrailingSlash(backslashToSlash($this->currentFolderPath));
|
||||
if(in_array($folder . $file, $this->sessionAction->get()))
|
||||
{
|
||||
if($this->sessionAction->getAction() == "copy")
|
||||
{
|
||||
$flag = $this->flags['copy'];
|
||||
}else
|
||||
{
|
||||
$flag = $this->flags['cut'];
|
||||
}
|
||||
}
|
||||
}
|
||||
$path=$this->currentFolderPath.$file;
|
||||
if(is_dir($path) && isListingDocument($path) )
|
||||
{
|
||||
$this->currentFolderInfo['subdir']++;
|
||||
if(!$this->calculateSubdir)
|
||||
{
|
||||
}else
|
||||
{
|
||||
|
||||
$folder = $this->getFolderInfo($path);
|
||||
$folder['flag'] = $flag;
|
||||
$folders[$file] = $folder;
|
||||
$outputs[$file] = $folders[$file];
|
||||
}
|
||||
|
||||
|
||||
}elseif(is_file($path) && isListingDocument($path))
|
||||
{
|
||||
|
||||
$obj = new file($path);
|
||||
$tem = $obj->getFileInfo();
|
||||
if(sizeof($tem))
|
||||
{
|
||||
$fileType = $this->getFileType($file);
|
||||
foreach($fileType as $k=>$v)
|
||||
{
|
||||
$tem[$k] = $v;
|
||||
}
|
||||
$this->currentFolderInfo['size'] += $tem['size'];
|
||||
$this->currentFolderInfo['file']++;
|
||||
$tem['path'] = backslashToSlash($path);
|
||||
$tem['type'] = "file";
|
||||
$tem['flag'] = $flag;
|
||||
$files[$file] = $tem;
|
||||
$outputs[$file] = $tem;
|
||||
$tem = array();
|
||||
$obj->close();
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if($this->forceFolderOnTop)
|
||||
{
|
||||
uksort($folders, "strnatcasecmp");
|
||||
uksort($files, "strnatcasecmp");
|
||||
$outputs = array();
|
||||
foreach($folders as $v)
|
||||
{
|
||||
$outputs[] = $v;
|
||||
}
|
||||
foreach ($files as $v)
|
||||
{
|
||||
$outputs[] = $v;
|
||||
}
|
||||
}else
|
||||
{
|
||||
uksort($outputs, "strnatcasecmp");
|
||||
}
|
||||
|
||||
@closedir($dirHandler);
|
||||
}else
|
||||
{
|
||||
trigger_error('Unable to locate the folder ' . $this->currentFolderPath, E_NOTICE);
|
||||
}
|
||||
return $outputs;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* get current or the specified dir information
|
||||
*
|
||||
* @param string $path
|
||||
* @return array
|
||||
*/
|
||||
function getFolderInfo($path=null)
|
||||
{
|
||||
if(is_null($path))
|
||||
{
|
||||
return $this->currentFolderInfo;
|
||||
}else
|
||||
{
|
||||
$obj = new manager($path, false);
|
||||
$obj->setSessionAction($this->sessionAction);
|
||||
$obj->getFileList();
|
||||
return $obj->getFolderInfo();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* return the file type of a file.
|
||||
*
|
||||
* @param string file name
|
||||
* @return array
|
||||
*/
|
||||
function getFileType($fileName, $checkIfDir = false)
|
||||
{
|
||||
|
||||
$ext = strtolower($this->_getExtension($fileName, $checkIfDir));
|
||||
|
||||
foreach ($this->fileTypes as $fileType)
|
||||
{
|
||||
if(in_array($ext, $fileType[0]))
|
||||
{
|
||||
return array("cssClass" => $fileType[1], "fileType" => $fileType[2], "preview" => $fileType[3], 'test'=>5);
|
||||
}
|
||||
}
|
||||
if(!empty($fileName))
|
||||
{//this is folder
|
||||
if(empty($ext))
|
||||
{
|
||||
if(is_dir($fileName))
|
||||
{
|
||||
|
||||
return array("cssClass" => ($checkIfDir && $this->isDirEmpty($fileName)?'folderEmpty':"folder") , "fileType" => "Folder", "preview" => 0, 'test'=>1);
|
||||
}else
|
||||
{
|
||||
return array("cssClass" => "fileUnknown", "fileType" => SEARCH_TYPE_UNKNOWN, "preview" => 0, 'test'=>2);
|
||||
}
|
||||
}else
|
||||
{
|
||||
return array("cssClass" => "fileUnknown", "fileType" => SEARCH_TYPE_UNKNOWN, "preview" => 0, 'test'=>3, 'ext'=>$ext , 'filename'=>$fileName);
|
||||
}
|
||||
|
||||
}else
|
||||
{//this is unknown file
|
||||
return array("cssClass" => "fileUnknown", "fileType" => SEARCH_TYPE_UNKNOWN, "preview" => 0, 'test'=>4);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* return the predefined file types
|
||||
*
|
||||
* @return arrray
|
||||
*/
|
||||
function getFileTypes()
|
||||
{
|
||||
return $this->fileTypes;
|
||||
}
|
||||
/**
|
||||
* print out the file types
|
||||
*
|
||||
*/
|
||||
function printFileTypes()
|
||||
{
|
||||
foreach($fileTypes as $fileType)
|
||||
{
|
||||
if(isset($fileType[0]) && is_array($fileType[0]))
|
||||
{
|
||||
foreach($fileType[0] as $type)
|
||||
{
|
||||
echo $type. ",";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the extension of a file name
|
||||
*
|
||||
* @param string $file
|
||||
* @return string
|
||||
* @copyright this function originally come from Andy's php
|
||||
*/
|
||||
function _getExtension($file, $checkIfDir = false)
|
||||
{
|
||||
if($checkIfDir && file_exists($file) && is_dir($file))
|
||||
{
|
||||
return '';
|
||||
}else
|
||||
{
|
||||
return @substr(@strrchr($file, "."), 1);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
function isDirEmpty($path)
|
||||
{
|
||||
$dirHandler = @opendir($path);
|
||||
if($dirHandler)
|
||||
{
|
||||
while(false !== ($file = readdir($dirHandler)))
|
||||
{
|
||||
if($file != '.' && $file != '..')
|
||||
{
|
||||
@closedir($dirHandler);
|
||||
return false;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@closedir($dirHandler);
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -1,584 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Pagination Class
|
||||
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
|
||||
* @since 27/Nov/20006
|
||||
*
|
||||
*/
|
||||
class pagination
|
||||
{
|
||||
var $totalItems = 0;
|
||||
var $itemsPerPage = 30;
|
||||
var $currentPage = 1;
|
||||
var $friendlyUrl = false;
|
||||
var $baseUrl = "";
|
||||
var $pageIndex = "page";
|
||||
var $groupLimit = 5;
|
||||
var $excludedQueryStrings = array();
|
||||
var $totalPages = 0;
|
||||
var $url = "";
|
||||
var $previousText = "Previous";
|
||||
var $nextText = "Next";
|
||||
var $lastText = "Last";
|
||||
var $firstText = "First";
|
||||
var $limitIndex ='limit';
|
||||
var $limits = array(5, 10, 20, 30, 50, 80, 150, 999);
|
||||
|
||||
|
||||
/**
|
||||
* Contructor
|
||||
*
|
||||
* @param boolean $friendlyUrl set the returned url
|
||||
* as search engine friendly or Normal Url
|
||||
*/
|
||||
function pagination($friendlyUrl=false)
|
||||
{
|
||||
$this->friendlyUrl = $friendlyUrl;
|
||||
$this->__resetCurrentPage();
|
||||
}
|
||||
|
||||
/**
|
||||
* set maximum number of items per page
|
||||
*
|
||||
* @param integer $value maximum number of items per page
|
||||
*/
|
||||
function setLimit($value)
|
||||
{
|
||||
$this->itemsPerPage = (int)($value);
|
||||
}
|
||||
/**
|
||||
* get maximum number of items per page
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
function getLimit()
|
||||
{
|
||||
return $this->itemsPerPage;
|
||||
}
|
||||
|
||||
/**
|
||||
* set the total number of items
|
||||
*
|
||||
* @param integer $value the total number of items
|
||||
*/
|
||||
function setTotal($value)
|
||||
{
|
||||
$this->totalItems = (int)($value);
|
||||
}
|
||||
/**
|
||||
* get the total number of items
|
||||
*
|
||||
* @return integer total number of items
|
||||
*/
|
||||
function getTotal()
|
||||
{
|
||||
return $this->totalItems;
|
||||
}
|
||||
/**
|
||||
* get total pages will be used to display all records
|
||||
*
|
||||
*/
|
||||
function getTotalPages()
|
||||
{
|
||||
|
||||
$output = floor(($this->totalItems / $this->itemsPerPage ));
|
||||
if($this->totalItems % $this->itemsPerPage)
|
||||
{
|
||||
$output++;
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the index of URL Query String
|
||||
*
|
||||
* @param string $value e.g. page
|
||||
*/
|
||||
function setPageIndex($value)
|
||||
{
|
||||
$this->pageIndex = $value;
|
||||
$this->__resetCurrentPage();
|
||||
}
|
||||
|
||||
|
||||
function getPageIndex()
|
||||
{
|
||||
return $this->pageIndex;
|
||||
}
|
||||
/**
|
||||
* initiate or reset the current page number
|
||||
*
|
||||
*/
|
||||
function __resetCurrentPage()
|
||||
{
|
||||
$this->currentPage = ((isset($_GET[$this->pageIndex]) && (int)($_GET[$this->pageIndex]) > 0)?(int)($_GET[$this->pageIndex]):1);
|
||||
}
|
||||
|
||||
/**
|
||||
* set the base url used in the links, default is $PHP_SELF
|
||||
*
|
||||
* @param string $value the base url
|
||||
*/
|
||||
function setUrl($value="")
|
||||
{
|
||||
if(empty($value))
|
||||
{
|
||||
if($this->friendlyUrl)
|
||||
{
|
||||
$this->url = "http://" . $_SERVER['HTTP_HOST'] . "/";
|
||||
}else
|
||||
{
|
||||
$this->url = $_SERVER['PHP_SELF'];
|
||||
}
|
||||
}else
|
||||
{
|
||||
$this->url = $value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* get the base url variable
|
||||
*
|
||||
* @return string the base url
|
||||
*/
|
||||
function getUrl()
|
||||
{
|
||||
|
||||
if(empty($this->url))
|
||||
{
|
||||
$this->setUrl();
|
||||
|
||||
}
|
||||
return $this->url;
|
||||
}
|
||||
|
||||
/**
|
||||
* set base url for pagination links after exculed those keys
|
||||
* identified on excluded query strings
|
||||
*/
|
||||
function __setBaseUrl()
|
||||
{
|
||||
|
||||
if(empty($this->url))
|
||||
{
|
||||
$this->getUrl();
|
||||
}
|
||||
|
||||
if($this->friendlyUrl)
|
||||
{
|
||||
$this->baseUrl = $this->getUrl();
|
||||
}else
|
||||
{
|
||||
|
||||
$appendingQueryStrings = array();
|
||||
$this->excludedQueryStrings[$this->pageIndex] =$this->pageIndex;
|
||||
foreach($_GET as $k=>$v)
|
||||
{
|
||||
if((array_search($k, $this->excludedQueryStrings) === false ))
|
||||
{
|
||||
$appendingQueryStrings[$k] = $k . "=" . $v;
|
||||
}
|
||||
}
|
||||
if(sizeof($appendingQueryStrings))
|
||||
{
|
||||
$this->baseUrl = $this->__appendQueryString($this->url, implode("&", $appendingQueryStrings));
|
||||
}else
|
||||
{
|
||||
$this->baseUrl = $this->getUrl();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
/**
|
||||
* get base url for pagination links aftr excluded those key
|
||||
* identified on excluded query strings
|
||||
*
|
||||
*/
|
||||
function __getBaseUrl()
|
||||
{
|
||||
|
||||
if(empty($this->baseUrl))
|
||||
{
|
||||
|
||||
$this->__setBaseUrl();
|
||||
}
|
||||
return $this->baseUrl;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* get the first item number
|
||||
*
|
||||
* @return interger the first item number displayed within current page
|
||||
*/
|
||||
function getFirstItem()
|
||||
{
|
||||
$output = 0;
|
||||
$temStartItemNumber = (($this->currentPage - 1) * $this->itemsPerPage + 1);
|
||||
if($this->totalItems && $temStartItemNumber <= $this->totalItems )
|
||||
{
|
||||
|
||||
$output = $temStartItemNumber;
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
/**
|
||||
* get the last item number displayed within current page
|
||||
*
|
||||
* @return interger the last item number
|
||||
*/
|
||||
function getLastItem()
|
||||
{
|
||||
$output = 0;
|
||||
$temEndItemNumber = (($this->currentPage) * $this->itemsPerPage);
|
||||
if($this->totalItems)
|
||||
{
|
||||
if($temEndItemNumber <= $this->totalItems)
|
||||
{
|
||||
$output = $temEndItemNumber;
|
||||
}else
|
||||
{
|
||||
$output = $this->totalItems;
|
||||
}
|
||||
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
/**
|
||||
* set page groupings limit
|
||||
* used for previous 1 2 3 4 5 next
|
||||
*
|
||||
* @param unknown_type $value
|
||||
*/
|
||||
function setGroupLimit($value)
|
||||
{
|
||||
$this->groupLimit = (int)($value);
|
||||
}
|
||||
/**
|
||||
* get page grouping limit
|
||||
*
|
||||
* @return integer the page grouping limit
|
||||
*/
|
||||
function getGroupLimit()
|
||||
{
|
||||
return $this->groupLimit;
|
||||
}
|
||||
/**
|
||||
* get the page offset number
|
||||
* used for Query . e.g SELECT SQL_CALC_FOUND_ROWS *
|
||||
* FROM mytable LIMIT getPageOffset(), getItemsPerPage()
|
||||
*
|
||||
* @return iner
|
||||
*/
|
||||
function getPageOffset()
|
||||
{
|
||||
return (($this->currentPage - 1) * $this->itemsPerPage);
|
||||
}
|
||||
/**
|
||||
* get the last url if any
|
||||
* @return string the last url
|
||||
*/
|
||||
function getLastUrl()
|
||||
{
|
||||
|
||||
$url = "";
|
||||
$totalPages = $this->getTotalPages();
|
||||
if($this->currentPage < $totalPages)
|
||||
{
|
||||
$url = $this->__getBaseUrl();
|
||||
|
||||
if($this->friendlyUrl)
|
||||
{
|
||||
$url .= $this->pageIndex . $totalPages . "/";
|
||||
}else
|
||||
{
|
||||
$url = $this->__appendQueryString($url, $this->pageIndex . "=" . $totalPages);
|
||||
}
|
||||
$url = sprintf('<a href="%s" class="pagination_last"><span>%s</span></a>',
|
||||
$url,
|
||||
$this->lastText);
|
||||
}
|
||||
return $url;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* get the first url if any
|
||||
* @return string the first url
|
||||
*/
|
||||
|
||||
function getFirstUrl()
|
||||
{
|
||||
$url = "";
|
||||
if($this->currentPage > 1)
|
||||
{
|
||||
$url = $this->__getBaseUrl();
|
||||
if($this->friendlyUrl)
|
||||
{
|
||||
$url .= $this->pageIndex . "1/";
|
||||
}else
|
||||
{
|
||||
$url = $this->__appendQueryString($url, $this->pageIndex . "=1");
|
||||
}
|
||||
$url = sprintf('<a href="%s" class="pagination_first"><span>%s</span></a>',
|
||||
$url,
|
||||
$this->firstText);
|
||||
|
||||
}
|
||||
return $url;
|
||||
}
|
||||
|
||||
/**
|
||||
* get the previous page url if anywhere
|
||||
*
|
||||
* @param array $excludedQueryStrings excluded the value from $_GET
|
||||
* @return string the previous page url
|
||||
*/
|
||||
function getPreviousUrl()
|
||||
{
|
||||
$url = "";
|
||||
if($this->currentPage > 1 && $this->totalItems > 0 )
|
||||
{
|
||||
$url = $this->__getBaseUrl();
|
||||
if($this->friendlyUrl)
|
||||
{
|
||||
$url .= $this->pageIndex . ($this->currentPage - 1) . "/";
|
||||
}else
|
||||
{
|
||||
$url = $this->__appendQueryString($url, $this->pageIndex . "=" . ($this->currentPage -1));
|
||||
}
|
||||
$url = sprintf('<a href="%s" class="pagination_previous"><span>%s</span></a>',
|
||||
$url,
|
||||
$this->previousText);
|
||||
|
||||
}
|
||||
|
||||
return $url;
|
||||
}
|
||||
/**
|
||||
* get the next page url if anywhere
|
||||
*
|
||||
* @param array $excludedQueryStrings excluded the value from $_GET
|
||||
* @return string the next page url
|
||||
*/
|
||||
function getNextUrl()
|
||||
{
|
||||
$url = "";
|
||||
if($this->totalItems > ($this->currentPage * $this->itemsPerPage))
|
||||
{
|
||||
$url = $this->__getBaseUrl();
|
||||
if($this->friendlyUrl)
|
||||
{
|
||||
$url .= $this->pageIndex . ($this->currentPage + 1) . "/";
|
||||
}else
|
||||
{
|
||||
$url = $this->__appendQueryString($url, $this->pageIndex . "=" . ($this->currentPage + 1));
|
||||
}
|
||||
$url = sprintf('<a href="%s" class="pagination_next"><span>%s</span></a>',
|
||||
$url,
|
||||
$this->nextText);
|
||||
}
|
||||
return $url;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* get the group page links e.g. 1,2,3,4,5
|
||||
* return format
|
||||
* <a class="pagination_group" href='yoururl'>1</a>
|
||||
* <a class="pagination_group active" href='#'>2</a>
|
||||
* <a class="pagination_group" href='yoururl'>3</a>
|
||||
*/
|
||||
function getGroupUrls()
|
||||
{
|
||||
$output = "";
|
||||
if($this->totalItems > 0)
|
||||
{
|
||||
$displayedPages = 0;
|
||||
$url = $this->__getBaseUrl();
|
||||
$totalPages = $this->getTotalPages();
|
||||
// find halfway point
|
||||
$groupLimitHalf = floor($this->groupLimit / 2);
|
||||
// determine what item/page we start with
|
||||
$itemStart = $this->currentPage - $groupLimitHalf;
|
||||
$itemStart = ($itemStart > 0 && $itemStart <= $totalPages)?$itemStart:1;
|
||||
$itemEnd = $itemStart;
|
||||
|
||||
while($itemEnd < ($itemStart + $this->groupLimit - 1) && $itemEnd < $totalPages)
|
||||
{
|
||||
$itemEnd++;
|
||||
}
|
||||
|
||||
|
||||
if($totalPages > ($itemEnd - $itemStart))
|
||||
{
|
||||
for($i = $itemStart; $i > 1 && ($itemEnd - $itemStart + 1) < $this->groupLimit; $i--)
|
||||
{
|
||||
$itemStart--;
|
||||
}
|
||||
}
|
||||
|
||||
for($item = $itemStart; $item <= $itemEnd; $item++)
|
||||
{
|
||||
if($item != $this->currentPage)
|
||||
{//it is not the active link
|
||||
if($this->friendlyUrl)
|
||||
{
|
||||
$temUrl = $url . $this->pageIndex . $item . "/";
|
||||
}else
|
||||
{
|
||||
$temUrl = $this->__appendQueryString($url, $this->pageIndex . "=" . $item);
|
||||
}
|
||||
$output .= sprintf(' <a class="pagination_group" href="%s"><span>%d</span></a> ', $temUrl, $item);
|
||||
}else
|
||||
{//active link
|
||||
$output .= sprintf(' <a class="pagination_group pagination_active" href="#"><span>%d</span></a> ', $item);
|
||||
}
|
||||
}
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
/**
|
||||
* set the text of previous page link
|
||||
*
|
||||
* @param string $value
|
||||
*/
|
||||
function setPreviousText($value)
|
||||
{
|
||||
$this->previousText = $value;
|
||||
}
|
||||
/**
|
||||
* set the text of first page link
|
||||
*
|
||||
* @param string $value
|
||||
*/
|
||||
function setFirstText($value)
|
||||
{
|
||||
$this->firstText = $value;
|
||||
}
|
||||
/**
|
||||
* set the text of next page link
|
||||
*
|
||||
* @param string $value
|
||||
*/
|
||||
|
||||
function setNextText($value)
|
||||
{
|
||||
$this->nextText = $value;
|
||||
}
|
||||
/**
|
||||
* set the text of last page link
|
||||
*
|
||||
* @param string $value
|
||||
*/
|
||||
function setLastText($value)
|
||||
{
|
||||
$this->lastText = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* set the excluded query string from $_GET;
|
||||
*
|
||||
* @param array the lists of the query string keys
|
||||
*/
|
||||
|
||||
function setExcludedQueryString($values = array())
|
||||
{
|
||||
$this->excludedQueryStrings = $values;
|
||||
}
|
||||
|
||||
function getExcludedQueryString()
|
||||
{
|
||||
return $this->excludedQueryStrings;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* add extra query stiring to a url
|
||||
* @param string $baseUrl
|
||||
* @param string $extra the query string added to the base url
|
||||
*/
|
||||
function __appendQueryString($baseUrl, $extra)
|
||||
{
|
||||
$output = trim($baseUrl);
|
||||
if(strpos($baseUrl, "?") !== false)
|
||||
{
|
||||
$output .= "&" . $extra;
|
||||
}else
|
||||
{
|
||||
$output .= "?" . $extra;
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
/**
|
||||
* return the html
|
||||
*
|
||||
* @param integer $type
|
||||
*/
|
||||
function getPaginationHTML($type=1, $cssClass="pagination")
|
||||
{
|
||||
$output = '';
|
||||
$output .= "<div class=\"pagination_content\"><p class=\"$cssClass\">\n";
|
||||
switch($type)
|
||||
{
|
||||
case "2":
|
||||
$output .= "<span class=\"pagination_summany\">" . $this->getFirstItem() . " to " . $this->getLastItem() . " of " . $this->getTotal() . " results.</span> ";
|
||||
if($previousUrl = $this->getPreviousUrl())
|
||||
{
|
||||
$output .= " " . $previousUrl;
|
||||
}
|
||||
|
||||
if($nextUrl = $this->getNextUrl())
|
||||
{
|
||||
$output .= " " . $nextUrl;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
//get full summary pagination
|
||||
default:
|
||||
$output .= "<span class=\"pagination_summany\">" . $this->getFirstItem() . "/" . $this->getLastItem() . " (" . $this->getTotal() . ")</span> ";
|
||||
if($firstUrl = $this->getFirstUrl())
|
||||
{
|
||||
$output .= " " . $firstUrl;
|
||||
}
|
||||
if($previousUrl = $this->getPreviousUrl())
|
||||
{
|
||||
$output .= " " . $previousUrl;
|
||||
}
|
||||
|
||||
if($groupUrls = $this->getGroupUrls())
|
||||
{
|
||||
$output .= " " . $groupUrls;
|
||||
}
|
||||
if($nextUrl = $this->getNextUrl())
|
||||
{
|
||||
$output .= " " . $nextUrl;
|
||||
}
|
||||
if($lastUrl = $this->getLastUrl())
|
||||
{
|
||||
$output .= " " . $lastUrl;
|
||||
}
|
||||
$itemPerPage = '';
|
||||
$itemPerPage .= "<select name=\"" . $this->limitIndex . "\" id=\"limit\" class=\"input inputLimit\" onchange=\"changePaginationLimit();\">\n";
|
||||
foreach ($this->limits as $v)
|
||||
{
|
||||
$itemPerPage .= "<option value=\"" . $v . "\" " . ($v==$this->itemsPerPage?'selected="selected"':'') . ">" . $v . "</option>\n";
|
||||
}
|
||||
$itemPerPage .= "</select>\n";
|
||||
$output .= "<span class=\"pagination_items_per_page\">";
|
||||
$output .= sprintf(PAGINATION_ITEMS_PER_PAGE, $itemPerPage);
|
||||
$output .= "</span>";
|
||||
$output .= "<span class=\"pagination_parent\"><a href=\"#\" onclick=\"goParentFolder();\" id=\"pagination_parent_link\" title=\"" . PAGINATION_GO_PARENT . "\"> </a></span>";
|
||||
}
|
||||
|
||||
$output .= "</p></div>";
|
||||
return $output;
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
@@ -1,184 +0,0 @@
|
||||
<?php
|
||||
include_once(CLASS_FILE);
|
||||
require_once(CLASS_SESSION_ACTION);
|
||||
require_once(CLASS_MANAGER);
|
||||
class Search
|
||||
{
|
||||
var $rootFolder = '';
|
||||
var $files = array();
|
||||
var $rootFolderInfo = array();
|
||||
var $searchkeywords = array(
|
||||
'mtime_from'=>'',
|
||||
'mtime_to'=>'',
|
||||
'name'=>'',
|
||||
'size_from'=>'',
|
||||
'size_to'=>'',
|
||||
'recursive'=>'0',
|
||||
|
||||
);
|
||||
var $sessionAction = null;
|
||||
/**
|
||||
* constructor
|
||||
*
|
||||
* @param string $rootFolder
|
||||
*/
|
||||
function __construct($rootFolder)
|
||||
{
|
||||
$this->rootFolder = $rootFolder;
|
||||
$this->sessionAction = new SessionAction();
|
||||
$objRootFolder = new file($this->rootFolder);
|
||||
$tem = $objRootFolder->getFileInfo();
|
||||
$obj = new manager($this->rootFolder, false);
|
||||
$obj->setSessionAction($this->sessionAction);
|
||||
$selectedDocuments = $this->sessionAction->get();
|
||||
$fileType = $obj->getFolderInfo($this->rootFolder);
|
||||
|
||||
foreach($fileType as $k=>$v)
|
||||
{
|
||||
$tem[$k] = $v;
|
||||
}
|
||||
|
||||
$tem['path'] = backslashToSlash($this->rootFolder);
|
||||
$tem['type'] = (is_dir($this->rootFolder)?'folder':'file');
|
||||
$tem['size'] = (is_dir($this->rootFolder)?'':transformFileSize(@filesize($this->rootFolder)));
|
||||
//$tem['ctime'] = date(DATE_TIME_FORMAT, $tem['ctime']);
|
||||
//$tem['mtime'] = date(DATE_TIME_FORMAT, $tem['mtime']);
|
||||
$tem['flag'] = (array_search($tem['path'], $selectedDocuments) !== false?($this->sessionAction->getAction() == "copy"?'copyFlag':'cutFlag'):'noFlag');
|
||||
$tem['url'] = getFileUrl($this->rootFolder);
|
||||
$tem['friendly_path'] = transformFilePath($this->rootFolder);
|
||||
$tem['file'] = 0;
|
||||
$tem['subdir'] = 0;
|
||||
$manager = null;
|
||||
$this->rootFolderInfo = $tem;
|
||||
$tem = null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* constructor
|
||||
*
|
||||
* @param string $rootFolder
|
||||
*/
|
||||
function Search($rootFolder)
|
||||
{
|
||||
$this->__construct($rootFolder);
|
||||
}
|
||||
|
||||
/**
|
||||
* change the search keyword individually
|
||||
*
|
||||
* @param string $key
|
||||
* @param string $value
|
||||
*/
|
||||
function addSearchKeyword($key, $value)
|
||||
{
|
||||
$this->searchkeywords[$key] = $value;
|
||||
}
|
||||
/**
|
||||
* change the search keywords
|
||||
*
|
||||
* @param array $keywords
|
||||
*/
|
||||
function addSearchKeywords($keywords)
|
||||
{
|
||||
foreach($this->searchkeywords as $k=>$v)
|
||||
{
|
||||
if(array_key_exists($k, $keywords) !== false)
|
||||
{
|
||||
$this->searchkeywords[$k] = $keywords[$k];
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* get the file according to the search keywords
|
||||
*
|
||||
*/
|
||||
function doSearch($baseFolderPath = null)
|
||||
{
|
||||
|
||||
$baseFolderPath = addTrailingSlash(backslashToSlash((is_null($baseFolderPath)?$this->rootFolder:$baseFolderPath)));
|
||||
|
||||
$dirHandler = @opendir($baseFolderPath);
|
||||
if($dirHandler)
|
||||
{
|
||||
while(false !== ($file = readdir($dirHandler)))
|
||||
{
|
||||
if($file != '.' && $file != '..')
|
||||
{
|
||||
$path = $baseFolderPath . $file;
|
||||
if(is_file($path))
|
||||
{
|
||||
$isValid = true;
|
||||
|
||||
$fileTime = @filemtime($path);
|
||||
$fileSize = @filesize($path);
|
||||
if($this->searchkeywords['name'] !== '' && @eregi($this->searchkeywords['name'], $file) === false)
|
||||
{
|
||||
$isValid = false;
|
||||
}
|
||||
if($this->searchkeywords['mtime_from'] != '' && $fileTime < @strtotime($this->searchkeywords['mtime_from']))
|
||||
{
|
||||
$isValid = false;
|
||||
}
|
||||
if($this->searchkeywords['mtime_to'] != '' && $fileTime > @strtotime($this->searchkeywords['mtime_to']))
|
||||
{
|
||||
$isValid = false;
|
||||
}
|
||||
if($this->searchkeywords['size_from'] != '' && $fileSize < @strtotime($this->searchkeywords['size_from']))
|
||||
{
|
||||
$isValid = false;
|
||||
}
|
||||
if($this->searchkeywords['size_to'] != '' && $fileSize > @strtotime($this->searchkeywords['size_to']))
|
||||
{
|
||||
$isValid = false;
|
||||
}
|
||||
if($isValid && isListingDocument($path))
|
||||
{
|
||||
$finalPath = $path;
|
||||
$objFile = new file($finalPath);
|
||||
$tem = $objFile->getFileInfo();
|
||||
$obj = new manager($finalPath, false);
|
||||
$obj->setSessionAction($this->sessionAction);
|
||||
$selectedDocuments = $this->sessionAction->get();
|
||||
$fileType = $obj->getFileType($finalPath);
|
||||
|
||||
foreach($fileType as $k=>$v)
|
||||
{
|
||||
$tem[$k] = $v;
|
||||
}
|
||||
|
||||
$tem['path'] = backslashToSlash($finalPath);
|
||||
$tem['type'] = (is_dir($finalPath)?'folder':'file');
|
||||
$tem['size'] = transformFileSize($tem['size']);
|
||||
$tem['ctime'] = date(DATE_TIME_FORMAT, $tem['ctime']);
|
||||
$tem['mtime'] = date(DATE_TIME_FORMAT, $tem['mtime']);
|
||||
$tem['flag'] = (array_search($tem['path'], $selectedDocuments) !== false?($this->sessionAction->getAction() == "copy"?'copyFlag':'cutFlag'):'noFlag');
|
||||
$tem['url'] = getFileUrl($tem['path']);
|
||||
$this->rootFolderInfo['file']++;
|
||||
$manager = null;
|
||||
$this->files[] = $tem;
|
||||
$tem = null;
|
||||
}
|
||||
}elseif(is_dir($path) && $this->searchkeywords['recursive'])
|
||||
{
|
||||
$this->Search($baseFolderPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($dirHandler);
|
||||
}
|
||||
|
||||
function getFoundFiles()
|
||||
{
|
||||
return $this->files;
|
||||
}
|
||||
|
||||
function getRootFolderInfo()
|
||||
{
|
||||
|
||||
return $this->rootFolderInfo;
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -1,228 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* this class provide a function like session handling engine
|
||||
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
|
||||
* @link www.phpletter.com
|
||||
* @since 22/May/2007
|
||||
*
|
||||
*/
|
||||
|
||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "class.file.php");
|
||||
class Session
|
||||
{
|
||||
var $lifeTime;
|
||||
var $fp = null;
|
||||
var $dir = null;
|
||||
var $mTime = null;
|
||||
var $sessionDir = null;
|
||||
var $sessionFile = null;
|
||||
var $ext = '.txt';
|
||||
var $gcCounter = 5; //call gc to delete expired session each ten request
|
||||
var $gcCounterFileName = 'gc_counter.ajax.php';
|
||||
var $gcCounterFile = null;
|
||||
var $gcLogFileName = 'gc_log.ajax.php';
|
||||
var $gcLogFile = null;
|
||||
var $debug = true; //turn it on when you want to see gc log
|
||||
|
||||
|
||||
/**
|
||||
* constructor
|
||||
*
|
||||
*/
|
||||
function __construct()
|
||||
{
|
||||
//check if the session folder read and writable
|
||||
/*
|
||||
$dir = new file();
|
||||
if(!file_exists(CONFIG_SYS_DIR_SESSION_PATH))
|
||||
{
|
||||
if(!$dir->mkdir(CONFIG_SYS_DIR_SESSION_PATH))
|
||||
{
|
||||
die('Unable to create session folder.');
|
||||
}
|
||||
}
|
||||
if(!$dir->isReadable(CONFIG_SYS_DIR_SESSION_PATH))
|
||||
{
|
||||
die('Permission denied: ' . CONFIG_SYS_DIR_SESSION_PATH . " is not readable.");
|
||||
}
|
||||
if(!$dir->isWritable(CONFIG_SYS_DIR_SESSION_PATH))
|
||||
{
|
||||
die('Permission denied: ' . CONFIG_SYS_DIR_SESSION_PATH . " is not writable.");
|
||||
}
|
||||
$this->dir = backslashToSlash(addTrailingSlash(CONFIG_SYS_DIR_SESSION_PATH));
|
||||
$this->lifeTime = get_cfg_var("session.gc_maxlifetime");
|
||||
$this->gcCounterFile = $this->dir . $this->gcCounterFileName;
|
||||
$this->gcLogFile = $this->dir . $this->gcLogFileName;
|
||||
$this->sessionDir = backslashToSlash($this->dir.session_id().DIRECTORY_SEPARATOR);
|
||||
*/
|
||||
$this->init();
|
||||
}
|
||||
/**
|
||||
* constructor
|
||||
*
|
||||
*/
|
||||
function Session()
|
||||
{
|
||||
$this->__construct();
|
||||
}
|
||||
/**
|
||||
* session init
|
||||
* @return boolean
|
||||
*/
|
||||
function init()
|
||||
{
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
function gc()
|
||||
{
|
||||
//init the counter file
|
||||
$fp = @fopen($this->gcCounterFile, 'a+');
|
||||
if($fp)
|
||||
{
|
||||
$count = (int)(fgets($fp, 999999)) + 1;
|
||||
if($count > $this->gcCounter || rand(0, 23) == date('h'))
|
||||
{
|
||||
$this->_gc();
|
||||
$count = 0;
|
||||
}
|
||||
@ftruncate($fp, 0);
|
||||
if(!@fputs($fp, $count))
|
||||
{
|
||||
die(SESSION_COUNTER_FILE_WRITE_FAILED);
|
||||
}
|
||||
@fclose($fp);
|
||||
}else
|
||||
{
|
||||
die(SESSION_COUNTER_FILE_CREATE_FAILED);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function _gc()
|
||||
{
|
||||
//remove expired file from session folder
|
||||
$dirHandler = @opendir($this->dir);
|
||||
$output = '';
|
||||
$output .= "gc start at " . date('d/M/Y H:i:s') . "\n";
|
||||
$fo = new file();
|
||||
if($dirHandler)
|
||||
{
|
||||
while(false !== ($file = readdir($dirHandler)))
|
||||
{
|
||||
if($file != '.' && $file != '..' && $file != $this->gcCounterFileName && $file != $this->gcLogFileName && $file != session_id() )
|
||||
{
|
||||
$path=$this->dir.$file;
|
||||
$output .= $path ;
|
||||
//check if this is a expired session file
|
||||
if(filemtime($path) + $this->lifeTime < time())
|
||||
{
|
||||
if($fo->delete($path))
|
||||
{
|
||||
$output .= ' Deleted at ' . date('d/M/Y H:i:s');
|
||||
}else
|
||||
{
|
||||
$output .= " Failed at " . date('d/M/Y H:i:s');
|
||||
}
|
||||
}
|
||||
$output .= "\n";
|
||||
|
||||
}
|
||||
}
|
||||
if($this->debug)
|
||||
{
|
||||
$this->_log($output);
|
||||
}
|
||||
|
||||
@closedir($dirHandler);
|
||||
|
||||
}
|
||||
if(CONFIG_SYS_DEMO_ENABLE)
|
||||
{
|
||||
//remove expired files from uploaded folder
|
||||
$dirHandler = @opendir(CONFIG_SYS_ROOT_PATH);
|
||||
$output = '';
|
||||
$output .= "gc start at " . date('d/M/Y H:i:s') . "\n";
|
||||
$fo = new file();
|
||||
if($dirHandler)
|
||||
{
|
||||
while(false !== ($file = readdir($dirHandler)))
|
||||
{
|
||||
if($file != '.' && $file != '..')
|
||||
{
|
||||
$path=CONFIG_SYS_ROOT_PATH.$file;
|
||||
$output .= $path ;
|
||||
//check if this is a expired session file
|
||||
if(filemtime($path) + $this->lifeTime < time())
|
||||
{
|
||||
if($fo->delete($path))
|
||||
{
|
||||
$output .= ' Deleted at ' . date('d/M/Y H:i:s');
|
||||
}else
|
||||
{
|
||||
$output .= " Failed at " . date('d/M/Y H:i:s');
|
||||
}
|
||||
}
|
||||
$output .= "\n";
|
||||
|
||||
}
|
||||
}
|
||||
if($this->debug)
|
||||
{
|
||||
$this->_log($output);
|
||||
}
|
||||
|
||||
@closedir($dirHandler);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* log action taken by the gc
|
||||
*
|
||||
* @param unknown_type $msg
|
||||
*/
|
||||
function _log($msg)
|
||||
{
|
||||
$msg = "<?php die(); ?>\n" . $msg;
|
||||
$fp = @fopen($this->gcLogFile, 'w+');
|
||||
if($fp)
|
||||
{
|
||||
@ftruncate($fp, 0);
|
||||
!@fputs($fp, $msg);
|
||||
@fclose($fp);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* get the current session directory
|
||||
*
|
||||
* @return string return empty if failed
|
||||
*/
|
||||
function getSessionDir()
|
||||
{
|
||||
if(!file_exists($this->sessionDir) && !is_dir($this->sessionDir))
|
||||
{
|
||||
$dir = new file();
|
||||
if(!$dir->mkdir($this->sessionDir))
|
||||
{
|
||||
return '';
|
||||
}
|
||||
}else
|
||||
{
|
||||
if(!@is_dir($this->sessionDir))
|
||||
{
|
||||
return '';
|
||||
}
|
||||
}
|
||||
return $this->sessionDir;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
@@ -1,93 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
*Session Action Class
|
||||
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
|
||||
* @link www.phpletter.com
|
||||
* @since 22/May/2007
|
||||
*
|
||||
*/
|
||||
class SessionAction
|
||||
{
|
||||
var $actionIndex = 'ajax_file_action';
|
||||
var $selectedDocIndex = 'ajax_selected_doc';
|
||||
var $fromFolderIndex = 'ajax_from_folder';
|
||||
function __construct()
|
||||
{
|
||||
if(!isset($_SESSION[$this->actionIndex]))
|
||||
{
|
||||
$_SESSION[$this->actionIndex] = '';
|
||||
}
|
||||
if(!isset($_SESSION[$this->selectedDocIndex]) || !is_array($_SESSION[$this->selectedDocIndex]))
|
||||
{
|
||||
$_SESSION[$this->selectedDocIndex] = array();
|
||||
}
|
||||
if(!isset($_SESSION[$this->fromFolderIndex]))
|
||||
{
|
||||
$_SESSION[$this->fromFolderIndex] = '';
|
||||
}
|
||||
}
|
||||
|
||||
function SessionAction()
|
||||
{
|
||||
$this->__construct();
|
||||
}
|
||||
/**
|
||||
* count the number of selected documents
|
||||
*
|
||||
*/
|
||||
function count()
|
||||
{
|
||||
return (isset($_SESSION[$this->selectedDocIndex])?sizeof($_SESSION[$this->selectedDocIndex]):0);
|
||||
}
|
||||
/**
|
||||
* assign the selected documents
|
||||
*
|
||||
* @param array $selectedDocuments
|
||||
*/
|
||||
function set($selectedDocuments)
|
||||
{
|
||||
$_SESSION[$this->selectedDocIndex] = $selectedDocuments;
|
||||
|
||||
}
|
||||
/**
|
||||
* get the selected documents
|
||||
* @return array
|
||||
*/
|
||||
function get()
|
||||
{
|
||||
return (isset($_SESSION[$this->selectedDocIndex])?$_SESSION[$this->selectedDocIndex]:array());
|
||||
}
|
||||
|
||||
function setAction($action)
|
||||
{
|
||||
$_SESSION[$this->actionIndex] = $action;
|
||||
}
|
||||
/**
|
||||
* get the action
|
||||
*
|
||||
* @return unknown
|
||||
*/
|
||||
function getAction()
|
||||
{
|
||||
return (isset($_SESSION[$this->actionIndex])?$_SESSION[$this->actionIndex]:'');
|
||||
}
|
||||
/**
|
||||
* set the folder
|
||||
*
|
||||
* @param string $folder
|
||||
*/
|
||||
function setFolder($folder)
|
||||
{
|
||||
$_SESSION[$this->fromFolderIndex] = $folder;
|
||||
}
|
||||
/**
|
||||
* get the folder
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function getFolder()
|
||||
{
|
||||
return (isset($_SESSION[$this->fromFolderIndex])?$_SESSION[$this->fromFolderIndex]:'');
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -1,589 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* This class provide all file upload functionalities
|
||||
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
|
||||
* @link www.phpletter.com
|
||||
* @since 22/April/2007
|
||||
*
|
||||
*/
|
||||
class Upload
|
||||
{
|
||||
var $fileType = ""; //the file type
|
||||
var $originalFileName = "";
|
||||
var $fileName = ""; //the file final name
|
||||
var $fileExtension = "";
|
||||
var $img_x = 0;
|
||||
var $img_y = 0;
|
||||
var $img_new_x = 0;
|
||||
var $img_new_y = 0;
|
||||
var $imgHandler = null;
|
||||
var $fileBaseName = ""; //file name without the file extension and .
|
||||
var $filePath = ""; //the file path which the file uploaded to
|
||||
var $fileSize = 0;
|
||||
var $validImageExts = array("gif", "jpg", "png");
|
||||
var $errors = array();
|
||||
var $_value = null; //an array holding the uploaded file details
|
||||
var $dirPath = "";
|
||||
var $invalidFileExt = array(); //var $invalidFileExt = array('php,inc,asp,aspx');
|
||||
var $errCode = "";
|
||||
var $safeMode;
|
||||
var $uploadFileMode = 0755;
|
||||
var $errorCodes = array(
|
||||
0=>'the file uploaded with success',
|
||||
1=>'The uploaded file exceeds the upload_max_filesize directive in php.ini',
|
||||
2=>'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form',
|
||||
3=>'The uploaded file was only partially uploaded',
|
||||
4=>'No file was uploaded.',
|
||||
6=>'Missing a temporary folder',
|
||||
7=>'Failed to write file to disk',
|
||||
8=>'File upload stopped by extension',
|
||||
999=>'No error code avaiable',
|
||||
);
|
||||
|
||||
|
||||
function Upload()
|
||||
{
|
||||
//doing nothing
|
||||
}
|
||||
|
||||
function isFileUploaded($indexInPost="file")
|
||||
{
|
||||
|
||||
$this->errCode = isset($_FILES[$indexInPost]['error'])?$_FILES[$indexInPost]['error']:999;
|
||||
if((isset($_FILES[$indexInPost]['error']) && $_FILES[$indexInPost] == 0) ||
|
||||
(!empty($_FILES[$indexInPost]['tmp_name']) && $_FILES[$indexInPost]['tmp_name'] != 'none')
|
||||
)
|
||||
{
|
||||
$this->_value = $_FILES[$indexInPost];
|
||||
$this->fileSize = @filesize($this->_value['tmp_name']);
|
||||
$this->originalFileName = $this->_value['name'];
|
||||
$this->fileType = $this->_value['type'];
|
||||
|
||||
return true;
|
||||
}else
|
||||
{
|
||||
|
||||
array_push($this->errors, 'Unable to upload file');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function getErrorCodeMsg()
|
||||
{
|
||||
return (isset($this->errorCodes[$this->errCode])?$this->errorCodes[$this->errCode]:"");
|
||||
}
|
||||
/**
|
||||
* check if the uploaded file extension is allowed against the validFile Extension
|
||||
* or against the invalid extension list when the list of valid file extension is not set
|
||||
*
|
||||
* @param array $validFileExt
|
||||
* @return boolean
|
||||
*/
|
||||
function isPermittedFileExt($validFileExt = array())
|
||||
{
|
||||
$tem = array();
|
||||
|
||||
if(sizeof($validFileExt))
|
||||
{
|
||||
foreach($validFileExt as $k=>$v)
|
||||
{
|
||||
$tem[$k] = strtolower(trim($v));
|
||||
}
|
||||
}
|
||||
$validFileExt = $tem;
|
||||
|
||||
if(sizeof($validFileExt) && sizeof($this->invalidFileExt))
|
||||
{
|
||||
foreach($validFileExt as $k=>$ext)
|
||||
{
|
||||
if(array_search(strtolower($ext), $this->invalidFileExt) !== false)
|
||||
{
|
||||
unset($validFileExt[$k]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if(sizeof($validFileExt))
|
||||
{
|
||||
if(array_search(strtolower($this->getFileExt()), $validFileExt) !== false)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}elseif(array_search(strtolower($this->getFileExt()), $this->invalidFileExt) === false)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
$this->deleteUploadedFile();
|
||||
return false;
|
||||
|
||||
}
|
||||
/**
|
||||
* check if the uploaded file size is too big
|
||||
*
|
||||
* @param integer $maxSize
|
||||
*/
|
||||
function isSizeTooBig($maxSize="")
|
||||
{
|
||||
if($this->fileSize > $maxSize)
|
||||
{
|
||||
$this->deleteUploadedFile();
|
||||
return true;
|
||||
}else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* set the invali file extensions
|
||||
*
|
||||
* @param array $invalidFileExt
|
||||
*/
|
||||
function setInvalidFileExt($invalidFileExt=array())
|
||||
{
|
||||
$tem = array();
|
||||
if(sizeof($invalidFileExt))
|
||||
{
|
||||
foreach($invalidFileExt as $k=>$v)
|
||||
{
|
||||
$tem[$k]= strtolower(trim($v));
|
||||
}
|
||||
}
|
||||
|
||||
$this->invalidFileExt = $tem;
|
||||
}
|
||||
/**
|
||||
* get file type
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function getFileType()
|
||||
{
|
||||
return $this->fileType;
|
||||
}
|
||||
/**
|
||||
* get a file extension
|
||||
*
|
||||
* @param string $fileName the path to a file or just the file name
|
||||
*/
|
||||
function getFileExt()
|
||||
{
|
||||
//return strtolower(substr(strrchr($this->fileName, "."), 1));
|
||||
return substr(strrchr($this->originalFileName, "."), 1);
|
||||
}
|
||||
/**
|
||||
* move the uploaded file to a specific location
|
||||
*
|
||||
* @param string $dest the path to the directory which the uploaded file will be moved to
|
||||
* @param string $fileBaseName the base name which the uploaded file will be renamed to
|
||||
* @param unknown_type $overwrite
|
||||
* @return unknown
|
||||
*/
|
||||
function moveUploadedFile($dest, $fileBaseName = '', $overwrite=false)
|
||||
{
|
||||
|
||||
//ensure the directory path ending with /
|
||||
if ($dest != '' && substr($dest, -1) != '/') {
|
||||
$dest .= '/';
|
||||
}
|
||||
$this->dirPath = $dest;
|
||||
$fileName = basename($this->_value['name']);
|
||||
|
||||
$dotIndex = strrpos($fileName, '.');
|
||||
$this->fileExtension = '';
|
||||
if(is_int($dotIndex))
|
||||
{
|
||||
$this->fileExtension = substr($fileName, $dotIndex);
|
||||
$this->fileBaseName = substr($fileName, 0, $dotIndex);
|
||||
}
|
||||
if(!empty($fileBaseName))
|
||||
{
|
||||
$this->fileBaseName = $fileBaseName;
|
||||
}
|
||||
$fileName = $this->fileBaseName . $this->fileExtension;
|
||||
$filePath = $dest . $fileName;
|
||||
|
||||
if(!$overwrite && file_exists($filePath) && is_file($filePath))
|
||||
{//rename
|
||||
|
||||
$counter = 0;
|
||||
while(file_exists($dest.$fileName) && is_file($dest .$fileName))
|
||||
{
|
||||
$counter++;
|
||||
$fileName = $this->fileBaseName.'_'.$counter.$this->fileExtension;
|
||||
}
|
||||
$this->fileBaseName .= "_" . $counter;
|
||||
|
||||
}
|
||||
if (@move_uploaded_file($this->_value['tmp_name'], $dest . $fileName)) {
|
||||
@chmod($dest . $fileName, $this->uploadFileMode);
|
||||
$this->fileName = $fileName;
|
||||
$this->filePath = $dest . $fileName;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* check if the uploaded is permitted to upload
|
||||
*
|
||||
* @param mixed $invalidImageExts invalid image extension
|
||||
* @param bool $delete force to delete the uploaded file
|
||||
*/
|
||||
function isImage($invalidImageExts = array(), $delete = true)
|
||||
{
|
||||
if(!is_array($invalidImageExts) && !empty($invalidImageExts))
|
||||
{
|
||||
$invalidImageExts = explode(",", $invalidImageExts);
|
||||
}
|
||||
foreach ($invalidImageExts as $k=>$v)
|
||||
{
|
||||
$invalidImageExts[$k] = strtolower(trim($v));
|
||||
}
|
||||
foreach ($this->validImageExts as $k=>$v)
|
||||
{
|
||||
$ValidImageExts[$k] = strtolower(trim($v));
|
||||
}
|
||||
if(sizeof($invalidImageExts))
|
||||
{
|
||||
foreach ($ValidImageExts as $k=>$v)
|
||||
{
|
||||
if(array_search(strtolower($v), $invalidImageExts) !== false)
|
||||
{
|
||||
unset($ValidImageExts[$k]);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(array_search(strtolower($this->getFileExt()), $ValidImageExts)!==false)
|
||||
{
|
||||
$this->_get_image_details($this->filePath);
|
||||
if(!empty($this->fileType))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}else
|
||||
{
|
||||
if($delete)
|
||||
{
|
||||
$this->deleteUploadedFile();
|
||||
}
|
||||
}
|
||||
|
||||
array($this->errors, "This file is not a image type file.");
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resize the Image in the X and/or Y direction
|
||||
* If either is 0 it will be scaled proportionally
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @param mixed $new_x
|
||||
* @param mixed $new_y
|
||||
* @param string $thumb_suffix
|
||||
*
|
||||
* @return mixed none or PEAR_error
|
||||
*/
|
||||
function resize($filePath, $thumb_suffix="", $new_x = 0, $new_y = 0)
|
||||
{
|
||||
|
||||
if(empty($filePath))
|
||||
{
|
||||
$filePath = $this->dirPath . $this->fileBaseName . $thumb_suffix . $this->fileExtension;
|
||||
}
|
||||
// 0 means keep original size
|
||||
if ($this->img_x > $this->img_y)
|
||||
$new_y = (int)($new_y/$this->img_x*$this->img_y);
|
||||
else if ($this->img_y > $this->img_x)
|
||||
$new_x = (int)($new_x/$this->img_y*$this->img_x);
|
||||
// Now do the library specific resizing.
|
||||
return $this->_resize($filePath,$new_x, $new_y);
|
||||
} // End resize
|
||||
|
||||
/**
|
||||
* resize the image and return the thumbnail image details array("width"=>, "height"=>, "name")
|
||||
*
|
||||
* @param string $fileName
|
||||
* @param int $new_x the thumbnail width
|
||||
* @param int $new_y the thumbnail height
|
||||
* @return unknown
|
||||
*/
|
||||
function _resize($fileName, $new_x, $new_y) {
|
||||
$functionName = 'ImageCreateFrom' . $this->fileType;
|
||||
|
||||
|
||||
if(function_exists($functionName))
|
||||
{
|
||||
$this->imgHandler = $functionName($this->filePath);
|
||||
}else
|
||||
{
|
||||
array_push($this->errors, $functionName . " function is unavailable");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(function_exists('ImageCreateTrueColor')){
|
||||
$new_img =ImageCreateTrueColor($new_x,$new_y);
|
||||
} else {
|
||||
$new_img =ImageCreate($new_x,$new_y);
|
||||
}
|
||||
if(function_exists('ImageCopyResampled')){
|
||||
ImageCopyResampled($new_img, $this->imgHandler, 0, 0, 0, 0, $new_x, $new_y, $this->img_x, $this->img_y);
|
||||
} else {
|
||||
ImageCopyResized($new_img, $this->imgHandler, 0, 0, 0, 0, $new_x, $new_y, $this->img_x, $this->img_y);
|
||||
}
|
||||
if($this->_imageSave($new_img, $fileName, 80))
|
||||
{
|
||||
return array("width"=>$new_x, "height"=>$new_y, "name"=>basename($fileName));
|
||||
}else
|
||||
{
|
||||
|
||||
array_push($this->errors, "Unable to resize the image");
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* save the thumbnail file and destroy the opened image
|
||||
*
|
||||
* @param resource $newImageHandler
|
||||
* @param string $fileName
|
||||
* @param int $quality
|
||||
* @return boolean
|
||||
*/
|
||||
function _imageSave($newImageHandler, $fileName, $quality = 90)
|
||||
{
|
||||
$functionName = 'image' . $this->fileType;
|
||||
if($functionName($newImageHandler, $fileName, $quality))
|
||||
{
|
||||
imagedestroy($newImageHandler);
|
||||
return true;
|
||||
}else
|
||||
{
|
||||
imagedestroy($newImageHandler);
|
||||
array_push($this->errors, "Unable to save the thumbnail file.");
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function _get_image_details($image)
|
||||
{
|
||||
|
||||
//echo $image;
|
||||
$data = @GetImageSize($image);
|
||||
#1 = GIF, 2 = JPG, 3 = PNG, 4 = SWF, 5 = PSD, 6 = BMP, 7 = TIFF(intel byte order), 8 = TIFF(motorola byte order,
|
||||
# 9 = JPC, 10 = JP2, 11 = JPX, 12 = JB2, 13 = SWC
|
||||
if (is_array($data)){
|
||||
switch($data[2]){
|
||||
case 1:
|
||||
$type = 'gif';
|
||||
break;
|
||||
case 2:
|
||||
$type = 'jpeg';
|
||||
break;
|
||||
case 3:
|
||||
$type = 'png';
|
||||
break;
|
||||
case 4:
|
||||
$type = 'swf';
|
||||
break;
|
||||
case 5:
|
||||
$type = 'psd';
|
||||
case 6:
|
||||
$type = 'bmp';
|
||||
case 7:
|
||||
case 8:
|
||||
$type = 'tiff';
|
||||
default:
|
||||
array_push($this->errors, "We do not recognize this image format");
|
||||
|
||||
}
|
||||
$this->img_x = $data[0];
|
||||
$this->img_y = $data[1];
|
||||
$this->fileType = $type;
|
||||
|
||||
return true;
|
||||
} else {
|
||||
array_push($this->errors, "Cannot fetch image or images details.");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* caculate the thumbnail details from the original image file
|
||||
*
|
||||
* @param string $originalImageName
|
||||
* @param int $originaleImageWidth
|
||||
* @param int $originalImageHeight
|
||||
* @param string $thumbnailSuffix
|
||||
* @param int $thumbnailWidth
|
||||
* @param int $thumbnailHeight
|
||||
* @return array array("name"=>"image name", "width"=>"image width", "height"=>"image height")
|
||||
*/
|
||||
function getThumbInfo($originalImageName, $originaleImageWidth, $originalImageHeight, $thumbnailSuffix, $thumbnailWidth, $thumbnailHeight)
|
||||
{
|
||||
$outputs = array("name"=>"", "width"=>0, "height"=>0);
|
||||
$thumbnailWidth = (int)($thumbnailWidth);
|
||||
$thumbnailHeight = (int)($thumbnailHeight);
|
||||
if(!empty($originalImageName) && !empty($originaleImageWidth) && !empty($originalImageHeight))
|
||||
{
|
||||
$dotIndex = strrpos($originalImageName, '.');
|
||||
//begin to get the thumbnail image name
|
||||
$fileExtension = '';
|
||||
$fileBaseName = '';
|
||||
if(is_int($dotIndex))
|
||||
{
|
||||
$fileExtension = substr($originalImageName, $dotIndex);
|
||||
$fileBaseName = substr($originalImageName, 0, $dotIndex);
|
||||
}
|
||||
$outputs['name'] = $fileBaseName . $thumbnailSuffix . $fileExtension;
|
||||
//start to get the thumbnail width & height
|
||||
if($thumbnailWidth < 1 && $thumbnailHeight < 1)
|
||||
{
|
||||
$thumbnailWidth =$originaleImageWidth;
|
||||
$thumbnailHeight = $originalImageHeight;
|
||||
}elseif($thumbnailWidth < 1)
|
||||
{
|
||||
$thumbnailWidth = floor($thumbnailHeight / $originalImageHeight * $originaleImageWidth);
|
||||
|
||||
}elseif($thumbnailHeight < 1)
|
||||
{
|
||||
$thumbnailHeight = floor($thumbnailWidth / $originaleImageWidth * $originalImageHeight);
|
||||
}else
|
||||
{
|
||||
$scale = min($thumbnailWidth/$originaleImageWidth, $thumbnailHeight/$originalImageHeight);
|
||||
$thumbnailWidth = floor($scale*$originaleImageWidth);
|
||||
$thumbnailHeight = floor($scale*$originalImageHeight);
|
||||
}
|
||||
$outputs['width'] = $thumbnailWidth;
|
||||
$outputs['height'] = $thumbnailHeight;
|
||||
}
|
||||
return $outputs;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* get the uploaded file
|
||||
*/
|
||||
function deleteUploadedFile()
|
||||
{
|
||||
@unlink($this->filePath);
|
||||
}
|
||||
/**
|
||||
* destroy the tmp file
|
||||
*
|
||||
*/
|
||||
function finish()
|
||||
{
|
||||
@unlink($this->_value['tmp_name']);
|
||||
}
|
||||
|
||||
function displayError()
|
||||
{
|
||||
if(sizeof($this->errors))
|
||||
{
|
||||
echo "<pre>";
|
||||
print_r($this->errors);
|
||||
echo "</pre>";
|
||||
}
|
||||
}
|
||||
/**
|
||||
* get the path which the file uploaded to
|
||||
*
|
||||
*/
|
||||
function getFilePath()
|
||||
{
|
||||
return $this->filePath;
|
||||
}
|
||||
/**
|
||||
* return the directory path witch the file uploaded to
|
||||
*
|
||||
* @return unknown
|
||||
*/
|
||||
function getDirPath()
|
||||
{
|
||||
return $this->dirPath;
|
||||
}
|
||||
|
||||
function getFileBaseName()
|
||||
{
|
||||
return $this->fileBaseName;
|
||||
}
|
||||
|
||||
function getFileName()
|
||||
{
|
||||
return $this->fileName;
|
||||
}
|
||||
/**
|
||||
* get image width
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
function getImageWidth()
|
||||
{
|
||||
return $this->img_x;
|
||||
}
|
||||
/**
|
||||
* get image height
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
function getImageHeight()
|
||||
{
|
||||
return $this->img_y;
|
||||
}
|
||||
/**
|
||||
* get uploaded file size
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function getFileSize()
|
||||
{
|
||||
return $this->fileSize;
|
||||
}
|
||||
/**
|
||||
* delete the uploaded image file & associated thumnails
|
||||
*
|
||||
* @param string $dirPath
|
||||
* @param string $originalImageName
|
||||
* @param string $arrayThumbnailSuffix
|
||||
*/
|
||||
function deleteFileAndThumbs($dirPath, $originalImageName, $arrayThumbnailSuffix)
|
||||
{
|
||||
//ensure the directory path ending with /
|
||||
if ($dirPath != '' && substr($dirPath, -1) != '/') {
|
||||
$dirPath .= '/';
|
||||
}
|
||||
if(!empty($originalImageName) && file_exists($dirPath . $originalImageName) && is_file($dirPath . $originalImageName))
|
||||
{
|
||||
@unlink($dirPath . $originalImageName);
|
||||
foreach($arrayThumbnailSuffix as $v)
|
||||
{
|
||||
$dotIndex = strrpos($originalImageName, '.');
|
||||
//begin to get the thumbnail image name
|
||||
$fileExtension = '';
|
||||
$fileBaseName = '';
|
||||
if(is_int($dotIndex))
|
||||
{
|
||||
$fileExtension = substr($originalImageName, $dotIndex);
|
||||
$fileBaseName = substr($originalImageName, 0, $dotIndex);
|
||||
}
|
||||
@unlink($dirPath . $fileBaseName . $v . $fileExtension);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -1,135 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* sysem base config setting
|
||||
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
|
||||
* @link www.phpletter.com
|
||||
* @since 1/August/2007
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
//error_reporting(E_ALL);
|
||||
//error_reporting(E_ALL ^ E_NOTICE);
|
||||
|
||||
|
||||
|
||||
//Access Control Setting
|
||||
/**
|
||||
* turn off => false
|
||||
* by session => true
|
||||
*/
|
||||
define('CONFIG_ACCESS_CONTROL_MODE', false);
|
||||
define("CONFIG_LOGIN_USERNAME", 'sdfgdfgdfgdgfdgsdfsdfg3454dsfb5e');
|
||||
define('CONFIG_LOGIN_PASSWORD', 'ASDF@#%JHGSDFGasdkjfh3812764ksdjfbhkjxcf');
|
||||
define('CONFIG_LOGIN_PAGE', 'ajax_login.php'); //the url to the login page
|
||||
|
||||
|
||||
//SYSTEM MODE CONFIG
|
||||
/**
|
||||
* turn it on when you have this system for demo purpose
|
||||
* that means changes made to each image is not physically applied to it
|
||||
* and all uploaded files/created folders will be removed automatically
|
||||
*/
|
||||
define('CONFIG_SYS_DEMO_ENABLE', false);
|
||||
define('CONFIG_SYS_VIEW_ONLY', false); //diabled the system, view only
|
||||
define('CONFIG_SYS_THUMBNAIL_VIEW_ENABLE', true);//REMOVE THE thumbnail view if false
|
||||
|
||||
//User Permissions
|
||||
define('CONFIG_OPTIONS_DELETE', true);
|
||||
define('CONFIG_OPTIONS_CUT', true);
|
||||
define('CONFIG_OPTIONS_COPY', true);
|
||||
define('CONFIG_OPTIONS_NEWFOLDER', true);
|
||||
define('CONFIG_OPTIONS_RENAME', true);
|
||||
define('CONFIG_OPTIONS_UPLOAD', true); //
|
||||
define('CONFIG_OPTIONS_EDITABLE', true); //disable image editor and text editor
|
||||
//FILESYSTEM CONFIG
|
||||
/*
|
||||
* CONFIG_SYS_DEFAULT_PATH is the default folder where the files would be uploaded to
|
||||
and it must be a folder under the CONFIG_SYS_ROOT_PATH or the same folder
|
||||
these two paths accept relative path only, don't use absolute path
|
||||
*/
|
||||
//check if folder exist
|
||||
if (!is_dir('../../img/cms'))
|
||||
mkdir('../../img/cms');
|
||||
|
||||
define('CONFIG_SYS_DEFAULT_PATH', '../../img/cms'); //accept relative path only
|
||||
define('CONFIG_SYS_ROOT_PATH', '../../img/cms'); //accept relative path only
|
||||
define('CONFIG_SYS_FOLDER_SHOWN_ON_TOP', true); //show your folders on the top of list if true or order by name
|
||||
define("CONFIG_SYS_DIR_SESSION_PATH", 'session/');
|
||||
define("CONFIG_SYS_PATTERN_FORMAT", 'list'); //three options: reg ,csv, list, this option define the parttern format for the following patterns
|
||||
/**
|
||||
* reg => regulare expression
|
||||
* csv => a list of comma separated file/folder name, (exactly match the specified file/folders)
|
||||
* list => a list of comma spearated vague file/folder name (partially match the specified file/folders)
|
||||
*
|
||||
*/
|
||||
//more details about regular expression please visit http://nz.php.net/manual/en/function.eregi.php
|
||||
define('CONFIG_SYS_INC_DIR_PATTERN', ''); //force listing of folders with such pattern(s). separated by , if multiple
|
||||
define('CONFIG_SYS_EXC_DIR_PATTERN', 'CVS'); //will prevent listing of folders with such pattern(s). separated by , if multiple
|
||||
define('CONFIG_SYS_INC_FILE_PATTERN', ''); //force listing of fiels with such pattern(s). separated by , if multiple
|
||||
define('CONFIG_SYS_EXC_FILE_PATTERN', ''); //will prevent listing of files with such pattern(s). separated by , if multiple
|
||||
define('CONFIG_SYS_DELETE_RECURSIVE', 1); //delete all contents within a specific folder if set to be 1
|
||||
|
||||
//UPLOAD OPTIONS CONFIG
|
||||
define('CONFIG_UPLOAD_MAXSIZE', 5000 * 1024 ); //by bytes
|
||||
//define('CONFIG_UPLOAD_MAXSIZE', 2048); //by bytes
|
||||
//define('CONFIG_UPLOAD_VALID_EXTS', 'txt');//
|
||||
|
||||
define('CONFIG_EDITABLE_VALID_EXTS', 'txt,htm,html,xml,js,css'); //make you include all these extension in CONFIG_UPLOAD_VALID_EXTS if you want all valid
|
||||
|
||||
define('CONFIG_OVERWRITTEN', false); //overwirte when processing paste
|
||||
define('CONFIG_UPLOAD_VALID_EXTS', 'gif,jpg,png');// //
|
||||
//define('CONFIG_UPLOAD_VALID_EXTS', 'gif,jpg,png,bmp,tif,zip,sit,rar,gz,tar,htm,html,mov,mpg,avi,asf,mpeg,wmv,aif,aiff,wav,mp3,swf,ppt,rtf,doc,pdf,xls,txt,xml,xsl,dtd');//
|
||||
define("CONFIG_VIEWABLE_VALID_EXTS", 'gif,jpg,png');
|
||||
//define('CONFIG_UPLOAD_VALID_EXTS', 'gif,jpg,png,txt'); //
|
||||
define('CONFIG_UPLOAD_INVALID_EXTS', '');
|
||||
|
||||
//Preview
|
||||
define('CONFIG_IMG_THUMBNAIL_MAX_X', 100);
|
||||
define('CONFIG_IMG_THUMBNAIL_MAX_Y', 100);
|
||||
define('CONFIG_THICKBOX_MAX_WIDTH', 700);
|
||||
define('CONFIG_THICKBOX_MAX_HEIGHT', 430);
|
||||
|
||||
|
||||
/**
|
||||
* CONFIG_URL_PREVIEW_ROOT was replaced by CONFIG_WEBSITE_DOCUMENT_ROOT since v0.8
|
||||
* Normally, you don't need to bother with CONFIG_WEBSITE_DOCUMENT_ROOT
|
||||
* Howerver, some Web Hosts do not have standard php.ini setting
|
||||
* which you will find the file manager can not locate your files correctly
|
||||
* if you do have such issue, please change it to fit your system.
|
||||
* so what should you to do get it
|
||||
* 1. create a php script file (let's call it document_root.php)
|
||||
* 2. add the following codes in in
|
||||
* <?php
|
||||
* echo dirname(__FILE__);
|
||||
* ?>
|
||||
* 3. upload document_root.php to you website root folder which will only be reached when you visit http://www.domain-name.com or http://localhost/ at localhost computer
|
||||
* 4. run it via http://www.domain-name.com/document_root.php or http://localhost/docuent_root.php if localhost computer, the url has to be exactly like that
|
||||
* 5. the value shown on the screen is CONFIG_WEBSITE_DOCUMENT_ROOT should be
|
||||
* 6. enjoy it
|
||||
|
||||
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
define('CONFIG_WEBSITE_DOCUMENT_ROOT', '');
|
||||
//theme related setting
|
||||
/*
|
||||
* options avaialbe for CONFIG_EDITOR_NAME are:
|
||||
stand_alone
|
||||
tinymce
|
||||
fckeditor
|
||||
*/
|
||||
//CONFIG_EDITOR_NAME replaced CONFIG_THEME_MODE since @version 0.8
|
||||
define('CONFIG_EDITOR_NAME', (CONFIG_QUERY_STRING_ENABLE && !empty($_GET['editor'])?secureFileName($_GET['editor']):'tinymce'));
|
||||
define('CONFIG_THEME_NAME', (CONFIG_QUERY_STRING_ENABLE && !empty($_GET['theme'])?secureFileName($_GET['theme']):'default')); //change the theme to your custom theme rather than default
|
||||
define('CONFIG_DEFAULT_VIEW', (CONFIG_SYS_THUMBNAIL_VIEW_ENABLE?'detail':'detail')); //thumnail or detail
|
||||
define('CONFIG_DEFAULT_PAGINATION_LIMIT', 10);
|
||||
define('CONFIG_LOAD_DOC_LATTER', false); //all documents will be loaded up after the template has been loaded to the client
|
||||
|
||||
//General Option Declarations
|
||||
//LANGAUGAE DECLARATIONNS
|
||||
define('CONFIG_LANG_INDEX', 'language'); //the index in the session
|
||||
define('CONFIG_LANG_DEFAULT', (CONFIG_QUERY_STRING_ENABLE && !empty($_GET['language']) && file_exists(DIR_LANG . secureFileName($_GET['language']) . '.php')?secureFileName($_GET['language']):'en')); //change it to be your language file base name, such en
|
||||
?>
|
||||
@@ -1,107 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* sysem config setting
|
||||
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
|
||||
* @link www.phpletter.com
|
||||
* @version 1.0
|
||||
* @since 22/April/2007
|
||||
*
|
||||
*/
|
||||
|
||||
//FILESYSTEM CONFIG <br>
|
||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "class.auth.php");
|
||||
define('CONFIG_QUERY_STRING_ENABLE', true); //Enable passed query string to setting the system configuration
|
||||
if(!isset($_SESSION))
|
||||
{
|
||||
session_start();
|
||||
}
|
||||
if(!headers_sent())
|
||||
{
|
||||
header('Content-Type: text/html; charset=utf-8');
|
||||
}
|
||||
|
||||
/**
|
||||
* secure file name which retrieve from query string
|
||||
*
|
||||
* @param string $input
|
||||
* @return string
|
||||
*/
|
||||
function secureFileName($input)
|
||||
{
|
||||
return preg_replace('/[^a-zA-Z0-9\-_]/', '', $input);
|
||||
}
|
||||
//Directories Declarations
|
||||
|
||||
define('DIR_AJAX_ROOT', dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR) ; // the path to ajax file manager
|
||||
define('DIR_AJAX_INC', DIR_AJAX_ROOT . "inc" . DIRECTORY_SEPARATOR);
|
||||
define('DIR_AJAX_CLASSES', DIR_AJAX_ROOT . "classes" . DIRECTORY_SEPARATOR);
|
||||
define("DIR_AJAX_LANGS", DIR_AJAX_ROOT . "langs" . DIRECTORY_SEPARATOR);
|
||||
define('DIR_AJAX_JS', DIR_AJAX_ROOT . 'jscripts' . DIRECTORY_SEPARATOR);
|
||||
define('DIR_AJAX_EDIT_AREA', DIR_AJAX_JS . 'edit_area' . DIRECTORY_SEPARATOR);
|
||||
define('DIR_LANG', DIR_AJAX_ROOT . 'langs' . DIRECTORY_SEPARATOR);
|
||||
|
||||
|
||||
//Class Declarations
|
||||
define('CLASS_FILE', DIR_AJAX_INC .'class.file.php');
|
||||
define("CLASS_UPLOAD", DIR_AJAX_INC . 'class.upload.php');
|
||||
define('CLASS_MANAGER', DIR_AJAX_INC . 'class.manager.php');
|
||||
define('CLASS_IMAGE', DIR_AJAX_INC . "class.image.php");
|
||||
define('CLASS_HISTORY', DIR_AJAX_INC . "class.history.php");
|
||||
define('CLASS_SESSION_ACTION', DIR_AJAX_INC . "class.sessionaction.php");
|
||||
define('CLASS_PAGINATION', DIR_AJAX_INC . 'class.pagination.php');
|
||||
define('CLASS_SEARCH', DIR_AJAX_INC . "class.search.php");
|
||||
//SCRIPT FILES declarations
|
||||
define('SPT_FUNCTION_BASE', DIR_AJAX_INC . 'function.base.php');
|
||||
//include different config base file according to query string "config"
|
||||
$configBaseFileName = 'config.base.php';
|
||||
|
||||
if(CONFIG_QUERY_STRING_ENABLE && !empty($_GET['config']) && file_exists(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'config.' . secureFileName($_GET['config']) . ".php")
|
||||
{
|
||||
$configBaseFileName = 'config.' . secureFileName($_GET['config']) . ".php";
|
||||
}
|
||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . $configBaseFileName);
|
||||
|
||||
|
||||
require_once(DIR_AJAX_LANGS . CONFIG_LANG_DEFAULT . ".php");
|
||||
require_once(DIR_AJAX_INC . "function.base.php");
|
||||
|
||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "class.session.php");
|
||||
$session = new Session();
|
||||
$auth = new Auth();
|
||||
|
||||
if(CONFIG_ACCESS_CONTROL_MODE == 1)
|
||||
{//access control enabled
|
||||
if(!$auth->isLoggedIn() && strtolower(basename($_SERVER['PHP_SELF']) != strtolower(basename(CONFIG_LOGIN_PAGE))))
|
||||
{//
|
||||
header('Location: ' . appendQueryString(CONFIG_LOGIN_PAGE, makeQueryString()));
|
||||
exit;
|
||||
}
|
||||
}
|
||||
addNoCacheHeaders();
|
||||
//URL Declartions
|
||||
define('CONFIG_URL_IMAGE_PREVIEW', 'ajax_image_preview.php');
|
||||
define('CONFIG_URL_CREATE_FOLDER', 'ajax_create_folder.php');
|
||||
define('CONFIG_URL_DELETE', 'ajax_delete_file.php');
|
||||
define('CONFIG_URL_HOME', 'ajaxfilemanager.php');
|
||||
define("CONFIG_URL_UPLOAD", 'ajax_file_upload.php');
|
||||
define('CONFIG_URL_PREVIEW', 'ajax_preview.php');
|
||||
define('CONFIG_URL_SAVE_NAME', 'ajax_save_name.php');
|
||||
define('CONFIG_URL_IMAGE_EDITOR', 'ajax_image_editor.php');
|
||||
define('CONFIG_URL_IMAGE_SAVE', 'ajax_image_save.php');
|
||||
define('CONFIG_URL_IMAGE_RESET', 'ajax_editor_reset.php');
|
||||
define('CONFIG_URL_IMAGE_UNDO', 'ajax_image_undo.php');
|
||||
define('CONFIG_URL_CUT', 'ajax_file_cut.php');
|
||||
define('CONFIG_URL_COPY', 'ajax_file_copy.php');
|
||||
define('CONFIG_URL_LOAD_FOLDERS', '_ajax_load_folders.php');
|
||||
|
||||
define('CONFIG_URL_DOWNLOAD', 'ajax_download.php');
|
||||
define('CONFIG_URL_TEXT_EDITOR', 'ajax_text_editor.php');
|
||||
define('CONFIG_URL_GET_FOLDER_LIST', 'ajax_get_folder_listing.php');
|
||||
define('CONFIG_URL_SAVE_TEXT', 'ajax_save_text.php');
|
||||
define('CONFIG_URL_LIST_LISTING', 'ajax_get_file_listing.php');
|
||||
define('CONFIG_URL_IMG_THUMBNAIL', 'ajax_image_thumbnail.php');
|
||||
define('CONFIG_URL_FILEnIMAGE_MANAGER', 'ajaxfilemanager.php');
|
||||
define('CONFIG_URL_FILE_PASTE', 'ajax_file_paste.php');
|
||||
|
||||
|
||||
?>
|
||||
@@ -1,131 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* sysem base config setting
|
||||
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
|
||||
* @link www.phpletter.com
|
||||
* @since 1/August/2007
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
error_reporting(E_ALL);
|
||||
//error_reporting(E_ALL ^ E_NOTICE);
|
||||
|
||||
|
||||
|
||||
//Access Control Setting
|
||||
/**
|
||||
* turn off => false
|
||||
* by session => true
|
||||
*/
|
||||
define('CONFIG_ACCESS_CONTROL_MODE', false);
|
||||
define("CONFIG_LOGIN_USERNAME", 'ajax');
|
||||
define('CONFIG_LOGIN_PASSWORD', '123456');
|
||||
define('CONFIG_LOGIN_PAGE', 'ajax_login.php'); //the url to the login page
|
||||
|
||||
//SYSTEM MODE CONFIG
|
||||
/**
|
||||
* turn it on when you have this system for demo purpose
|
||||
* that means changes made to each image is not physically applied to it
|
||||
* and all uploaded files/created folders will be removed automatically
|
||||
*/
|
||||
define('CONFIG_SYS_DEMO_ENABLE', false);
|
||||
define('CONFIG_SYS_VIEW_ONLY', false); //diabled the system, view only
|
||||
define('CONFIG_SYS_THUMBNAIL_VIEW_ENABLE', true);//REMOVE THE thumbnail view if false
|
||||
|
||||
//User Permissions
|
||||
define('CONFIG_OPTIONS_DELETE', true);
|
||||
define('CONFIG_OPTIONS_CUT', true);
|
||||
define('CONFIG_OPTIONS_COPY', true);
|
||||
define('CONFIG_OPTIONS_NEWFOLDER', true);
|
||||
define('CONFIG_OPTIONS_RENAME', true);
|
||||
define('CONFIG_OPTIONS_UPLOAD', true); //
|
||||
define('CONFIG_OPTIONS_EDITABLE', true); //disable image editor and text editor
|
||||
//FILESYSTEM CONFIG
|
||||
/*
|
||||
* CONFIG_SYS_DEFAULT_PATH is the default folder where the files would be uploaded to
|
||||
and it must be a folder under the CONFIG_SYS_ROOT_PATH or the same folder
|
||||
these two paths accept relative path only, don't use absolute path
|
||||
*/
|
||||
|
||||
define('CONFIG_SYS_DEFAULT_PATH', '../uploaded/'); //accept relative path only
|
||||
define('CONFIG_SYS_ROOT_PATH', '../uploaded/'); //accept relative path only
|
||||
define('CONFIG_SYS_FOLDER_SHOWN_ON_TOP', true); //show your folders on the top of list if true or order by name
|
||||
define("CONFIG_SYS_DIR_SESSION_PATH", 'session/');
|
||||
define("CONFIG_SYS_PATTERN_FORMAT", 'list'); //three options: reg ,csv, list, this option define the parttern format for the following patterns
|
||||
/**
|
||||
* reg => regulare expression
|
||||
* csv => a list of comma separated file/folder name, (exactly match the specified file/folders)
|
||||
* list => a list of comma spearated vague file/folder name (partially match the specified file/folders)
|
||||
*
|
||||
*/
|
||||
//more details about regular expression please visit http://nz.php.net/manual/en/function.eregi.php
|
||||
define('CONFIG_SYS_INC_DIR_PATTERN', ''); //force listing of folders with such pattern(s). separated by , if multiple
|
||||
define('CONFIG_SYS_EXC_DIR_PATTERN', ''); //will prevent listing of folders with such pattern(s). separated by , if multiple
|
||||
define('CONFIG_SYS_INC_FILE_PATTERN', ''); //force listing of fiels with such pattern(s). separated by , if multiple
|
||||
define('CONFIG_SYS_EXC_FILE_PATTERN', ''); //will prevent listing of files with such pattern(s). separated by , if multiple
|
||||
define('CONFIG_SYS_DELETE_RECURSIVE', 1); //delete all contents within a specific folder if set to be 1
|
||||
|
||||
//UPLOAD OPTIONS CONFIG
|
||||
define('CONFIG_UPLOAD_MAXSIZE', 5000 * 1024 ); //by bytes
|
||||
//define('CONFIG_UPLOAD_MAXSIZE', 2048); //by bytes
|
||||
//define('CONFIG_UPLOAD_VALID_EXTS', 'txt');//
|
||||
|
||||
define('CONFIG_EDITABLE_VALID_EXTS', 'txt,htm,html,xml,js,css'); //make you include all these extension in CONFIG_UPLOAD_VALID_EXTS if you want all valid
|
||||
|
||||
define('CONFIG_OVERWRITTEN', false); //overwirte when processing paste
|
||||
define('CONFIG_UPLOAD_VALID_EXTS', 'gif,jpg,png,txt'); //
|
||||
//define('CONFIG_UPLOAD_VALID_EXTS', 'gif,jpg,png,bmp,tif,zip,sit,rar,gz,tar,htm,html,mov,mpg,avi,asf,mpeg,wmv,aif,aiff,wav,mp3,swf,ppt,rtf,doc,pdf,xls,txt,xml,xsl,dtd');//
|
||||
define("CONFIG_VIEWABLE_VALID_EXTS", 'gif,bmp,txt,jpg,png,tif,html,htm,js,css,xml,xsl,dtd,mp3,wav,wmv,wma,rm,rmvb,mov,swf');
|
||||
//define('CONFIG_UPLOAD_VALID_EXTS', 'gif,jpg,png,txt'); //
|
||||
define('CONFIG_UPLOAD_INVALID_EXTS', '');
|
||||
|
||||
//Preview
|
||||
define('CONFIG_IMG_THUMBNAIL_MAX_X', 100);
|
||||
define('CONFIG_IMG_THUMBNAIL_MAX_Y', 100);
|
||||
define('CONFIG_THICKBOX_MAX_WIDTH', 700);
|
||||
define('CONFIG_THICKBOX_MAX_HEIGHT', 430);
|
||||
|
||||
|
||||
/**
|
||||
* CONFIG_URL_PREVIEW_ROOT was replaced by CONFIG_WEBSITE_DOCUMENT_ROOT since v0.8
|
||||
* Normally, you don't need to bother with CONFIG_WEBSITE_DOCUMENT_ROOT
|
||||
* Howerver, some Web Hosts do not have standard php.ini setting
|
||||
* which you will find the file manager can not locate your files correctly
|
||||
* if you do have such issue, please change it to fit your system.
|
||||
* so what should you to do get it
|
||||
* 1. create a php script file (let's call it document_root.php)
|
||||
* 2. add the following codes in in
|
||||
* <?php
|
||||
* echo dirname(__FILE__);
|
||||
* ?>
|
||||
* 3. upload document_root.php to you website root folder which will only be reached when you visit http://www.domain-name.com or http://localhost/ at localhost computer
|
||||
* 4. run it via http://www.domain-name.com/document_root.php or http://localhost/docuent_root.php if localhost computer, the url has to be exactly like that
|
||||
* 5. the value shown on the screen is CONFIG_WEBSITE_DOCUMENT_ROOT should be
|
||||
* 6. enjoy it
|
||||
|
||||
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
define('CONFIG_WEBSITE_DOCUMENT_ROOT', '');
|
||||
//theme related setting
|
||||
/*
|
||||
* options avaialbe for CONFIG_EDITOR_NAME are:
|
||||
stand_alone
|
||||
tinymce
|
||||
fckeditor
|
||||
*/
|
||||
//CONFIG_EDITOR_NAME replaced CONFIG_THEME_MODE since @version 0.8
|
||||
define('CONFIG_EDITOR_NAME', (CONFIG_QUERY_STRING_ENABLE && !empty($_GET['editor'])?secureFileName($_GET['editor']):'stand_alone'));
|
||||
define('CONFIG_THEME_NAME', (CONFIG_QUERY_STRING_ENABLE && !empty($_GET['theme'])?secureFileName($_GET['theme']):'default')); //change the theme to your custom theme rather than default
|
||||
define('CONFIG_DEFAULT_VIEW', (CONFIG_SYS_THUMBNAIL_VIEW_ENABLE?'detail':'detail')); //thumnail or detail
|
||||
define('CONFIG_DEFAULT_PAGINATION_LIMIT', 10);
|
||||
define('CONFIG_LOAD_DOC_LATTER', false); //all documents will be loaded up after the template has been loaded to the client
|
||||
|
||||
//General Option Declarations
|
||||
//LANGAUGAE DECLARATIONNS
|
||||
define('CONFIG_LANG_INDEX', 'language'); //the index in the session
|
||||
define('CONFIG_LANG_DEFAULT', (CONFIG_QUERY_STRING_ENABLE && !empty($_GET['language']) && file_exists(DIR_LANG . secureFileName($_GET['language'] . '.php'))?secureFileName($_GET['language']):'en')); //change it to be your language file base name, such en
|
||||
?>
|
||||
@@ -1,8 +0,0 @@
|
||||
<pre>Array
|
||||
(
|
||||
[currentFolderPath] => ../uploaded/
|
||||
[new_folder] => Test
|
||||
)
|
||||
</pre>
|
||||
|
||||
22/Sep/2008 13:17:12
|
||||
@@ -1,225 +0,0 @@
|
||||
jQuery.extend({
|
||||
|
||||
createUploadIframe: function(id, uri)
|
||||
{
|
||||
//create frame
|
||||
var frameId = 'jUploadFrame' + id;
|
||||
|
||||
if(window.ActiveXObject) {
|
||||
var io = document.createElement('<iframe id="' + frameId + '" name="' + frameId + '" />');
|
||||
if(typeof uri== 'boolean'){
|
||||
io.src = 'javascript:false';
|
||||
}
|
||||
else if(typeof uri== 'string'){
|
||||
io.src = uri;
|
||||
}
|
||||
}
|
||||
else {
|
||||
var io = document.createElement('iframe');
|
||||
io.id = frameId;
|
||||
io.name = frameId;
|
||||
}
|
||||
io.style.position = 'absolute';
|
||||
io.style.top = '-1000px';
|
||||
io.style.left = '-1000px';
|
||||
|
||||
document.body.appendChild(io);
|
||||
|
||||
return io;
|
||||
},
|
||||
createUploadForm: function(id, fileElementId)
|
||||
{
|
||||
//create form
|
||||
var formId = 'jUploadForm' + id;
|
||||
var fileId = 'jUploadFile' + id;
|
||||
var form = jQuery('<form action="" method="POST" name="' + formId + '" id="' + formId + '" enctype="multipart/form-data"></form>');
|
||||
var oldElement = jQuery('#' + fileElementId);
|
||||
var newElement = jQuery(oldElement).clone();
|
||||
jQuery(oldElement).attr('id', fileId);
|
||||
jQuery(oldElement).before(newElement);
|
||||
jQuery(oldElement).appendTo(form);
|
||||
//set attributes
|
||||
jQuery(form).css('position', 'absolute');
|
||||
jQuery(form).css('top', '-1200px');
|
||||
jQuery(form).css('left', '-1200px');
|
||||
jQuery(form).appendTo('body');
|
||||
return form;
|
||||
},
|
||||
|
||||
ajaxFileUpload: function(s) {
|
||||
// TODO introduce global settings, allowing the client to modify them for all requests, not only timeout
|
||||
s = jQuery.extend({}, jQuery.ajaxSettings, s);
|
||||
var id = s.fileElementId;
|
||||
var form = jQuery.createUploadForm(id, s.fileElementId);
|
||||
var io = jQuery.createUploadIframe(id, s.secureuri);
|
||||
var frameId = 'jUploadFrame' + id;
|
||||
var formId = 'jUploadForm' + id;
|
||||
|
||||
if( s.global && ! jQuery.active++ )
|
||||
{
|
||||
// Watch for a new set of requests
|
||||
jQuery.event.trigger( "ajaxStart" );
|
||||
}
|
||||
var requestDone = false;
|
||||
// Create the request object
|
||||
var xml = {};
|
||||
if( s.global )
|
||||
{
|
||||
jQuery.event.trigger("ajaxSend", [xml, s]);
|
||||
}
|
||||
|
||||
var uploadCallback = function(isTimeout)
|
||||
{
|
||||
// Wait for a response to come back
|
||||
var io = document.getElementById(frameId);
|
||||
try
|
||||
{
|
||||
if(io.contentWindow)
|
||||
{
|
||||
xml.responseText = io.contentWindow.document.body?io.contentWindow.document.body.innerHTML:null;
|
||||
xml.responseXML = io.contentWindow.document.XMLDocument?io.contentWindow.document.XMLDocument:io.contentWindow.document;
|
||||
|
||||
}else if(io.contentDocument)
|
||||
{
|
||||
xml.responseText = io.contentDocument.document.body?io.contentDocument.document.body.innerHTML:null;
|
||||
xml.responseXML = io.contentDocument.document.XMLDocument?io.contentDocument.document.XMLDocument:io.contentDocument.document;
|
||||
}
|
||||
}catch(e)
|
||||
{
|
||||
jQuery.handleError(s, xml, null, e);
|
||||
}
|
||||
if( xml || isTimeout == "timeout")
|
||||
{
|
||||
requestDone = true;
|
||||
var status;
|
||||
try {
|
||||
status = isTimeout != "timeout" ? "success" : "error";
|
||||
// Make sure that the request was successful or notmodified
|
||||
if( status != "error" )
|
||||
{
|
||||
// process the data (runs the xml through httpData regardless of callback)
|
||||
var data = jQuery.uploadHttpData( xml, s.dataType );
|
||||
if( s.success )
|
||||
{
|
||||
// ifa local callback was specified, fire it and pass it the data
|
||||
s.success( data, status );
|
||||
};
|
||||
if( s.global )
|
||||
{
|
||||
// Fire the global callback
|
||||
jQuery.event.trigger( "ajaxSuccess", [xml, s] );
|
||||
};
|
||||
} else
|
||||
{
|
||||
jQuery.handleError(s, xml, status);
|
||||
}
|
||||
|
||||
} catch(e)
|
||||
{
|
||||
status = "error";
|
||||
jQuery.handleError(s, xml, status, e);
|
||||
};
|
||||
if( s.global )
|
||||
{
|
||||
// The request was completed
|
||||
jQuery.event.trigger( "ajaxComplete", [xml, s] );
|
||||
};
|
||||
|
||||
|
||||
// Handle the global AJAX counter
|
||||
if(s.global && ! --jQuery.active)
|
||||
{
|
||||
jQuery.event.trigger("ajaxStop");
|
||||
};
|
||||
if(s.complete)
|
||||
{
|
||||
s.complete(xml, status);
|
||||
} ;
|
||||
|
||||
jQuery(io).unbind();
|
||||
|
||||
setTimeout(function()
|
||||
{ try
|
||||
{
|
||||
jQuery(io).remove();
|
||||
jQuery(form).remove();
|
||||
|
||||
} catch(e)
|
||||
{
|
||||
jQuery.handleError(s, xml, null, e);
|
||||
}
|
||||
|
||||
}, 100);
|
||||
|
||||
xml = null;
|
||||
|
||||
};
|
||||
}
|
||||
// Timeout checker
|
||||
if( s.timeout > 0 )
|
||||
{
|
||||
setTimeout(function(){
|
||||
|
||||
if( !requestDone )
|
||||
{
|
||||
// Check to see ifthe request is still happening
|
||||
uploadCallback( "timeout" );
|
||||
}
|
||||
|
||||
}, s.timeout);
|
||||
}
|
||||
try
|
||||
{
|
||||
var form = jQuery('#' + formId);
|
||||
jQuery(form).attr('action', s.url);
|
||||
jQuery(form).attr('method', 'POST');
|
||||
jQuery(form).attr('target', frameId);
|
||||
if(form.encoding)
|
||||
{
|
||||
form.encoding = 'multipart/form-data';
|
||||
}
|
||||
else
|
||||
{
|
||||
form.enctype = 'multipart/form-data';
|
||||
}
|
||||
jQuery(form).submit();
|
||||
|
||||
} catch(e)
|
||||
{
|
||||
jQuery.handleError(s, xml, null, e);
|
||||
}
|
||||
if(window.attachEvent){
|
||||
document.getElementById(frameId).attachEvent('onload', uploadCallback);
|
||||
}
|
||||
else{
|
||||
document.getElementById(frameId).addEventListener('load', uploadCallback, false);
|
||||
}
|
||||
return {abort: function () {}};
|
||||
|
||||
},
|
||||
|
||||
uploadHttpData: function( r, type ) {
|
||||
var data = !type;
|
||||
data = type == "xml" || data ? r.responseXML : r.responseText;
|
||||
// ifthe type is "script", eval it in global context
|
||||
if( type == "script" )
|
||||
{
|
||||
jQuery.globalEval( data );
|
||||
}
|
||||
|
||||
// Get the JavaScript object, ifJSON is used.
|
||||
if( type == "json" )
|
||||
{
|
||||
eval( "data = " + data );
|
||||
}
|
||||
|
||||
// evaluate scripts within html
|
||||
if( type == "html" )
|
||||
{
|
||||
jQuery("<div>").html(data).evalScripts();
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,873 +0,0 @@
|
||||
/*
|
||||
* author: Logan Cai
|
||||
* Email: cailongqun [at] yahoo [dot] com [dot] cn
|
||||
* Website: www.phpletter.com
|
||||
* Created At: 21/April/2007
|
||||
*/
|
||||
|
||||
/**
|
||||
* get current selected mode value
|
||||
*/
|
||||
function getModeValue()
|
||||
{
|
||||
//check if an mode has been selected or selected first one be default
|
||||
var CheckedElem = null;
|
||||
for(var i = 0; i < document.formAction.mode.length; i++)
|
||||
{
|
||||
if(document.formAction.mode[i].checked || i == 0)
|
||||
{
|
||||
CheckedElem = document.formAction.mode[i];
|
||||
}
|
||||
}
|
||||
CheckedElem.checked = true;
|
||||
return CheckedElem.value;
|
||||
};
|
||||
/**
|
||||
* get fired when mode changed
|
||||
* fire according function
|
||||
*/
|
||||
function changeMode(restore, force)
|
||||
{
|
||||
|
||||
var mode = getModeValue();
|
||||
var imageMode = $('#image_mode');
|
||||
if(mode != $(imageMode).val() || (typeof(restore) == "boolean"))
|
||||
{
|
||||
/**
|
||||
* confirm it when there has been some changes before go further
|
||||
*/
|
||||
if(isImageHistoryExist() || typeof(force) == 'boolean')
|
||||
{
|
||||
if(typeof(restore) == "boolean" || typeof(force) == 'boolean' )
|
||||
{
|
||||
if(!restoreToOriginal(restore))
|
||||
{
|
||||
return false;
|
||||
|
||||
}
|
||||
clearImageHistory();
|
||||
}
|
||||
else if(!window.confirm(warningLostChanges))
|
||||
{
|
||||
cancelChangeMode();
|
||||
return false;
|
||||
}else
|
||||
{
|
||||
restoreToOriginal(false);
|
||||
clearImageHistory();
|
||||
}
|
||||
}else if((typeof(restore) == "boolean" && restore))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
initPositionHandler();
|
||||
switch(mode)
|
||||
{
|
||||
case "resize":
|
||||
switch($('#image_mode').val())
|
||||
{
|
||||
case "crop":
|
||||
disableCrop();
|
||||
break;
|
||||
case "rotate":
|
||||
disableRotate();
|
||||
break;
|
||||
case "flip":
|
||||
disableFlip();
|
||||
break;
|
||||
default:
|
||||
disableRotate();
|
||||
}
|
||||
enableResize(document.formAction.constraint.checked);
|
||||
break;
|
||||
case "crop":
|
||||
switch($('#image_mode').val())
|
||||
{
|
||||
case "resize":
|
||||
disableResize();
|
||||
break;
|
||||
case "rotate":
|
||||
disableRotate();
|
||||
break;
|
||||
case "flip":
|
||||
disableFlip();
|
||||
break;
|
||||
default:
|
||||
disableRotate();
|
||||
}
|
||||
enableCrop();
|
||||
|
||||
break;
|
||||
case "rotate":
|
||||
switch($('#image_mode').val())
|
||||
{
|
||||
case "resize":
|
||||
disableResize();
|
||||
break;
|
||||
case "crop":
|
||||
disableCrop();
|
||||
break;
|
||||
case "flip":
|
||||
disableFlip();
|
||||
break;
|
||||
default:
|
||||
//do nothing
|
||||
}
|
||||
enableRotate();
|
||||
break;
|
||||
case "flip":
|
||||
switch($('#image_mode').val())
|
||||
{
|
||||
case "resize":
|
||||
disableResize();
|
||||
break;
|
||||
case "crop":
|
||||
disableCrop();
|
||||
break;
|
||||
case "rotate":
|
||||
disableRotate();
|
||||
break;
|
||||
default:
|
||||
//do nothing
|
||||
}
|
||||
enableFlip();
|
||||
break;
|
||||
default:
|
||||
alert('Unexpected Operation!');
|
||||
return false;
|
||||
}
|
||||
$('#image_mode').val(mode);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
function resetEditor()
|
||||
{
|
||||
if(isImageHistoryExist())
|
||||
{
|
||||
changeMode(true);
|
||||
}else
|
||||
{
|
||||
alert(warningResetEmpty);
|
||||
}
|
||||
return false;
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* enable to crop function
|
||||
*/
|
||||
function enableCrop()
|
||||
{
|
||||
var widthField = $('#width');
|
||||
var heightField = $('#height');
|
||||
var topField = $('#y');
|
||||
var leftField = $('#x');
|
||||
var imageToResize = getImageElement();
|
||||
var imageWidth = $(imageToResize).attr('width');
|
||||
var imageHeight = $(imageToResize).attr('height');
|
||||
|
||||
var overlay = $('#resizeMe');
|
||||
var imageContainer = $('#imageContainer');
|
||||
var imageContainerTop = parseInt($(imageContainer).css('top').replace('px', ''));
|
||||
var imageContainerLeft = parseInt($(imageContainer).css('left').replace('px', ''));
|
||||
//Init Container
|
||||
$(imageContainer).css('width', imageWidth + 'px');
|
||||
$(imageContainer).css('height', imageHeight + 'px');
|
||||
$(imageToResize).css('opacity', '.5');
|
||||
|
||||
//Init Overlay
|
||||
overlay.css('background-image', 'url('+ $(imageToResize).attr('src')+')');
|
||||
overlay.css('width', imageWidth + 'px');
|
||||
overlay.css('height', imageHeight + 'px');
|
||||
|
||||
//Init Form
|
||||
widthField.val(imageWidth);
|
||||
heightField.val(imageHeight);
|
||||
topField.val(0);
|
||||
leftField.val(0);
|
||||
$(overlay).Resizable(
|
||||
{
|
||||
minWidth: 10,
|
||||
minHeight: 10,
|
||||
maxWidth: imageWidth,
|
||||
maxHeight: imageHeight,
|
||||
minTop: imageContainerTop,
|
||||
minLeft: imageContainerLeft,
|
||||
maxRight: (parseInt(imageWidth) + imageContainerLeft),
|
||||
maxBottom: (parseInt(imageHeight) + imageContainerTop),
|
||||
dragHandle: true,
|
||||
onDrag: function(x, y)
|
||||
{
|
||||
this.style.backgroundPosition = '-' + (x - imageContainerLeft) + 'px -' + (y - imageContainerTop) + 'px';
|
||||
$(topField).val(Math.round(y - imageContainerTop));
|
||||
$(leftField).val(Math.round(x - imageContainerLeft));
|
||||
addImageHistory();
|
||||
},
|
||||
handlers: {
|
||||
se: '#resizeSE',
|
||||
e: '#resizeE',
|
||||
ne: '#resizeNE',
|
||||
n: '#resizeN',
|
||||
nw: '#resizeNW',
|
||||
w: '#resizeW',
|
||||
sw: '#resizeSW',
|
||||
s: '#resizeS'
|
||||
},
|
||||
onResize : function(size, position) {
|
||||
this.style.backgroundPosition = '-' + (position.left - imageContainerLeft) + 'px -' + (position.top - imageContainerTop) + 'px';
|
||||
$(widthField).val(Math.round(size.width));
|
||||
$(heightField).val(Math.round(size.height));
|
||||
$(topField).val(Math.round(position.top - imageContainerTop));
|
||||
$(leftField).val(Math.round(position.left - imageContainerLeft));
|
||||
addImageHistory();
|
||||
$('#ratio').val($(overlay).ResizableRatio() );
|
||||
}
|
||||
}
|
||||
);
|
||||
enableConstraint();
|
||||
toggleConstraint();
|
||||
disableRotate();
|
||||
|
||||
};
|
||||
/*
|
||||
* disable crop function
|
||||
*/
|
||||
function disableCrop()
|
||||
{
|
||||
$('#resizeMe').ResizableDestroy();
|
||||
hideHandlers();
|
||||
};
|
||||
/**
|
||||
* disable resize function
|
||||
*/
|
||||
function disableResize()
|
||||
{
|
||||
$('#resizeMe').ResizableDestroy();
|
||||
|
||||
hideHandlers();
|
||||
};
|
||||
/**
|
||||
* hide all handlers
|
||||
*/
|
||||
function hideHandlers()
|
||||
{
|
||||
$('#resizeSE').hide();
|
||||
$('#resizeE').hide();
|
||||
$('#resizeNE').hide();
|
||||
$('#resizeN').hide();
|
||||
$('#resizeNW').hide();
|
||||
$('#resizeW').hide();
|
||||
$('#resizeSW').hide();
|
||||
$('#resizeS').hide();
|
||||
};
|
||||
/**
|
||||
*
|
||||
* enable to resize the image
|
||||
*/
|
||||
function enableResize(constraint)
|
||||
{
|
||||
hideHandlers();
|
||||
var imageToResize = getImageElement();
|
||||
var imageContainer = $('#imageContainer');
|
||||
var imageContainerTop = parseInt($(imageContainer).css('top').replace('px', ''));
|
||||
var imageContainerLeft = parseInt($(imageContainer).css('left').replace('px', ''));
|
||||
var resizeMe = $('#resizeMe');
|
||||
var width = $('#width');
|
||||
var height = $('#height');
|
||||
//ensure the container has same size with the image
|
||||
$(imageContainer).css('width', $(imageToResize).attr('width') + 'px');
|
||||
$(imageContainer).css('height', $(imageToResize).attr('height') + 'px');
|
||||
$(resizeMe).css('width', $(imageToResize).attr('width') + 'px');
|
||||
$(resizeMe).css('height', $(imageToResize).attr('height') + 'px');
|
||||
$('#width').val($(imageToResize).attr('width'));
|
||||
$('#height').val($(imageToResize).attr('height'));
|
||||
$('#x').val(0);
|
||||
$('#y').val(0);
|
||||
$(resizeMe).Resizable(
|
||||
{
|
||||
minWidth: 10,
|
||||
minHeight: 10,
|
||||
maxWidth: 2000,
|
||||
maxHeight: 2000,
|
||||
minTop: imageContainerTop,
|
||||
minLeft: imageContainerLeft,
|
||||
maxRight: 2000,
|
||||
maxBottom: 2000,
|
||||
handlers: {
|
||||
s: '#resizeS',
|
||||
se: '#resizeSE',
|
||||
e: '#resizeE'
|
||||
},
|
||||
onResize: function(size)
|
||||
{
|
||||
$(imageToResize).attr('height', Math.round(size.height).toString());
|
||||
$(imageToResize).attr('width', Math.round(size.width).toString());
|
||||
$(width).val(Math.round(size.width));
|
||||
$(height).val(Math.round(size.height));
|
||||
$(imageContainer).css('width', $(imageToResize).attr('width') + 'px');
|
||||
$(imageContainer).css('height', $(imageToResize).attr('height') + 'px');
|
||||
$('#ratio').val($(resizeMe).ResizableRatio() );
|
||||
addImageHistory();
|
||||
}
|
||||
|
||||
}
|
||||
);
|
||||
$(resizeMe).ResizeConstraint(constraint);
|
||||
if(typeof(constraint) == 'boolean' && constraint)
|
||||
{
|
||||
$('#resizeS').hide();
|
||||
$('#resizeE').hide();
|
||||
}else
|
||||
{
|
||||
$('#resizeS').show();
|
||||
$('#resizeE').show();
|
||||
}
|
||||
$('#resizeSE').show();
|
||||
$('#ratio').val($(resizeMe).ResizableRatio() );
|
||||
|
||||
|
||||
};
|
||||
/**
|
||||
* initiate the position of handler
|
||||
*/
|
||||
function initPositionHandler()
|
||||
{
|
||||
var widthField = $('#width');
|
||||
var heightField = $('#height');
|
||||
var topField = $('#x');
|
||||
var leftField = $('#y');
|
||||
|
||||
var imageToResize = getImageElement();
|
||||
var imageWidth = $(imageToResize).attr('width');
|
||||
var imageHeight = $(imageToResize).attr('height');
|
||||
|
||||
var overlay = $('#resizeMe');
|
||||
var imageContainer = $('#imageContainer');
|
||||
var imageContainerTop = parseInt($(imageContainer).css('top').replace('px', ''));
|
||||
var imageContainerLeft = parseInt($(imageContainer).css('left').replace('px', ''));
|
||||
//Init Container
|
||||
$(imageContainer).css('width', imageWidth + 'px');
|
||||
$(imageContainer).css('height', imageHeight + 'px');
|
||||
|
||||
//Init Overlay
|
||||
$(imageToResize).css('opacity', '100');
|
||||
$(overlay).css('width', imageWidth + 'px');
|
||||
$(overlay).css('height', imageHeight + 'px');
|
||||
$(overlay).css('background-image', '');
|
||||
$(overlay).css('backgroundPosition', '0 0');
|
||||
$(overlay).css('left', imageContainerLeft);
|
||||
$(overlay).css('top', imageContainerTop);
|
||||
|
||||
//Init Form
|
||||
$(widthField).val(imageWidth);
|
||||
$(heightField).val(imageHeight);
|
||||
$(topField).val(0);
|
||||
$(leftField).val(0);
|
||||
$('#angle').val(0);
|
||||
$('#flip_angle').val('');
|
||||
};
|
||||
/**
|
||||
* enable rotate function
|
||||
*/
|
||||
function enableRotate()
|
||||
{
|
||||
hideHandlers();
|
||||
toggleDisabledButton('actionRotateLeft', false);
|
||||
toggleDisabledButton('actionRotateRight', false);
|
||||
|
||||
};
|
||||
/**
|
||||
* disable rotation function
|
||||
*/
|
||||
function disableRotate()
|
||||
{
|
||||
toggleDisabledButton('actionRotateLeft', true);
|
||||
toggleDisabledButton('actionRotateRight', true);
|
||||
};
|
||||
|
||||
function enableConstraint()
|
||||
{
|
||||
$('#constraint').removeAttr('disabled');
|
||||
};
|
||||
|
||||
function disableConstraint()
|
||||
{
|
||||
$('#constraint').attr('disabled', 'disabled');
|
||||
};
|
||||
function ShowHandlers()
|
||||
{
|
||||
$('#resizeSE').show();
|
||||
$('#resizeE').show();
|
||||
$('#resizeNE').show();
|
||||
$('#resizeN').show();
|
||||
$('#resizeNW').show();
|
||||
$('#resizeW').show();
|
||||
$('#resizeSW').show();
|
||||
$('#resizeS').show();
|
||||
} ;
|
||||
|
||||
/**
|
||||
* turn constraint on or off
|
||||
*/
|
||||
function toggleConstraint()
|
||||
{
|
||||
hideHandlers();
|
||||
if(document.formAction.constraint.checked)
|
||||
{
|
||||
$('#resizeMe').ResizeConstraint(true);
|
||||
switch(getModeValue())
|
||||
{
|
||||
case "resize":
|
||||
$('#resizeSE').show();
|
||||
break;
|
||||
case "crop":
|
||||
$('#resizeSE').show();
|
||||
$('#resizeNE').show();
|
||||
$('#resizeNW').show();
|
||||
$('#resizeSW').show();
|
||||
|
||||
break;
|
||||
case "rotate":
|
||||
break;
|
||||
}
|
||||
|
||||
}else
|
||||
{
|
||||
$('#resizeMe').ResizeConstraint(false);
|
||||
switch(getModeValue())
|
||||
{
|
||||
case "resize":
|
||||
$('#resizeSE').show();
|
||||
$('#resizeE').show();
|
||||
$('#resizeS').show();
|
||||
break;
|
||||
case "crop":
|
||||
ShowHandlers();
|
||||
break;
|
||||
case "rotate":
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* restore to the state the image was
|
||||
*/
|
||||
function restoreToOriginal(warning)
|
||||
{
|
||||
if(typeof(warning) == "boolean" && warning)
|
||||
{
|
||||
if(!window.confirm(warningReset))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
$("#imageContainer").empty();
|
||||
$("#hiddenImage img").clone().appendTo("#imageContainer");
|
||||
return true;
|
||||
|
||||
|
||||
};
|
||||
/*
|
||||
* left rotate
|
||||
*/
|
||||
function leftRotate()
|
||||
{
|
||||
|
||||
var imageToResize = getImageElement();
|
||||
$(imageToResize).rotate(-90);
|
||||
swapWidthWithHeight();
|
||||
addImageHistory();
|
||||
var angle = $('#angle');
|
||||
|
||||
var angleDegree = (parseInt($(angle).val()) + 90);
|
||||
angleDegree = ((angleDegree == 360)?angleDegree:angleDegree%360);
|
||||
$(angle).val((angleDegree ));
|
||||
return false;
|
||||
|
||||
};
|
||||
/**
|
||||
* cancel mode change
|
||||
*/
|
||||
function cancelChangeMode()
|
||||
{
|
||||
$('#formAction input[@value=' + $('#image_mode').val() + ']').attr('checked', 'checked');
|
||||
};
|
||||
/**
|
||||
* get the image element which is going to be modified
|
||||
*/
|
||||
function getImageElement()
|
||||
{
|
||||
var imageElement = null;
|
||||
var imageContainer = document.getElementById('imageContainer');
|
||||
for(var i = 0; i < imageContainer.childNodes.length; i++)
|
||||
{
|
||||
if((typeof(imageContainer.childNodes[i].name) != "undefined" && imageContainer.childNodes[i].name.toLowerCase() == 'image') || (typeof(imageContainer.childNodes[i].tagName) != "undefined" && (imageContainer.childNodes[i].tagName.toLowerCase() == 'canvas' || imageContainer.childNodes[i].tagName.toLowerCase() == 'img')) )
|
||||
{
|
||||
imageElement = imageContainer.childNodes[i];
|
||||
}
|
||||
}
|
||||
return imageElement;
|
||||
};
|
||||
/*
|
||||
right rotate
|
||||
*/
|
||||
function rightRotate()
|
||||
{
|
||||
|
||||
var imageToResize = getImageElement();
|
||||
$(imageToResize).rotate(90);
|
||||
swapWidthWithHeight();
|
||||
addImageHistory();
|
||||
var angle = $('#angle');
|
||||
|
||||
|
||||
var angleDegree = (parseInt($(angle).val()) - 90 );
|
||||
if(angleDegree < 0)
|
||||
{
|
||||
angleDegree += 360;
|
||||
}
|
||||
angleDegree = ((angleDegree == 360)?angleDegree:angleDegree%360);
|
||||
$(angle).val((angleDegree ));
|
||||
return false;
|
||||
} ;
|
||||
/**
|
||||
* swap image width with height when rotation fired
|
||||
*/
|
||||
function swapWidthWithHeight()
|
||||
{
|
||||
var imageContainer = $('#imageContainer');
|
||||
var resizeMe = $('#resizeMe');
|
||||
var width = $('#width');
|
||||
var height = $('#height');
|
||||
var imageToResize = getImageElement();
|
||||
var newWidth = 0;
|
||||
var newHeight = 0;
|
||||
newWidth = $(imageToResize).attr('width');
|
||||
newHeight = $(imageToResize).attr('height');
|
||||
$(imageContainer).css('width', newWidth + 'px');
|
||||
$(imageContainer).css('height', newHeight + 'px');
|
||||
$(width).val(newWidth);
|
||||
$(height).val(newHeight);
|
||||
$(resizeMe).css('width', newWidth + 'px');
|
||||
$(resizeMe).css('height', newHeight + 'px');
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* records all change mede to the image
|
||||
* this features will be implemented next release
|
||||
*/
|
||||
function addImageHistory()
|
||||
{
|
||||
imageHistory = true;
|
||||
initDisabledButtons(false);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* cleare all records
|
||||
* this features will be implemented next release
|
||||
*/
|
||||
function clearImageHistory()
|
||||
{
|
||||
imageHistory = false;
|
||||
initDisabledButtons(true);
|
||||
|
||||
|
||||
};
|
||||
|
||||
function initDisabledButtons(forceDisable)
|
||||
{
|
||||
if(numSessionHistory)
|
||||
{
|
||||
toggleDisabledButton('actionUndo', false);
|
||||
}else
|
||||
{
|
||||
toggleDisabledButton('actionUndo', true);
|
||||
}
|
||||
if(imageHistory)
|
||||
{
|
||||
toggleDisabledButton('actionSave', false);
|
||||
toggleDisabledButton('actionReset', false);
|
||||
}else
|
||||
{
|
||||
toggleDisabledButton('actionSave', true);
|
||||
toggleDisabledButton('actionReset', true);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* return record
|
||||
* this features will be implemented next release
|
||||
*/
|
||||
function getImageHistory()
|
||||
{
|
||||
return imageHistory;
|
||||
};
|
||||
/**
|
||||
* check if there exists any changes
|
||||
* this features will be implemented next release
|
||||
*/
|
||||
function isImageHistoryExist()
|
||||
{
|
||||
return imageHistory;
|
||||
};
|
||||
|
||||
function flipHorizontal()
|
||||
{
|
||||
if(window.confirm(warningFlipHorizotal))
|
||||
{
|
||||
addImageHistory();
|
||||
$('#flip_angle').val('horizontal');
|
||||
$('#mode').val('flip');
|
||||
saveImage();
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
function flipVertical()
|
||||
{
|
||||
if(window.confirm(warningFlipVertical))
|
||||
{
|
||||
addImageHistory();
|
||||
$('#flip_angle').val('vertical');
|
||||
$('#mode').val('flip');
|
||||
saveImage();
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
function enableFlip()
|
||||
{
|
||||
toggleDisabledButton('actionFlipH', false);
|
||||
toggleDisabledButton('actionFlipV', false);
|
||||
};
|
||||
|
||||
function toggleDisabledButton(buttonId, forceDisable)
|
||||
{
|
||||
var disabledButton = $('#' + buttonId);
|
||||
var newClass = '';
|
||||
var changeRequired = true;
|
||||
var toBeDisabled = false;
|
||||
var currentClass = $(disabledButton).attr('class') ;
|
||||
if(typeof(forceDisable) == 'boolean')
|
||||
{
|
||||
|
||||
if(forceDisable && currentClass == 'button')
|
||||
{
|
||||
newClass = 'disabledButton';
|
||||
$(disabledButton).attr('disabled', 'disabled');
|
||||
}else if(!forceDisable && currentClass == 'disabledButton')
|
||||
{
|
||||
newClass = 'button';
|
||||
$(disabledButton).removeAttr('disabled');
|
||||
}else
|
||||
{
|
||||
changeRequired = false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else if(currentClass == 'button')
|
||||
{
|
||||
newClass = 'disabledButton';
|
||||
$(disabledButton).attr('disabled', 'disabled');
|
||||
}else
|
||||
{
|
||||
newClass = 'button';
|
||||
$(disabledButton).removeAttr('disabled');
|
||||
}
|
||||
if(changeRequired)
|
||||
{
|
||||
$(disabledButton).removeClass('button disabledButton');
|
||||
$(disabledButton).addClass(newClass);
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
function disableFlip()
|
||||
{
|
||||
toggleDisabledButton('actionFlipH', true);
|
||||
toggleDisabledButton('actionFlipV', true);
|
||||
};
|
||||
|
||||
function undoImage()
|
||||
{
|
||||
if(numSessionHistory < 1)
|
||||
{
|
||||
alert(warningResetEmpty);
|
||||
|
||||
}else
|
||||
{
|
||||
if(window.confirm(warningUndoImage))
|
||||
{
|
||||
processImage('formAction');
|
||||
}
|
||||
|
||||
}
|
||||
return false;
|
||||
|
||||
};
|
||||
|
||||
function processImage(formId)
|
||||
{
|
||||
$("#loading")
|
||||
.ajaxStart(function(){
|
||||
$(this).show();
|
||||
})
|
||||
.ajaxComplete(function(){
|
||||
$(this).hide();
|
||||
});
|
||||
var options =
|
||||
{
|
||||
dataType: 'json',
|
||||
error: function (data, status, e)
|
||||
{
|
||||
alert(e);
|
||||
},
|
||||
success: function(data)
|
||||
{
|
||||
if(typeof(data.error) == 'undefined')
|
||||
{
|
||||
alert('Unexpected information ');
|
||||
}
|
||||
else if(data.error != '')
|
||||
{
|
||||
|
||||
alert(data.error);
|
||||
}else
|
||||
{
|
||||
$("#loading").show();
|
||||
|
||||
currentFolder = data.folder_path;
|
||||
if(data.save_as == '1')
|
||||
{
|
||||
numSessionHistory = 0;
|
||||
}else
|
||||
{
|
||||
numSessionHistory = parseInt(data.history);
|
||||
}
|
||||
$('#file_path').val(data.path);
|
||||
$('#path').val(data.path);
|
||||
var preImage = new Image();
|
||||
preImage.width = data.width;
|
||||
preImage.height = data.height;
|
||||
preImage.onload = function()
|
||||
{
|
||||
|
||||
$('#hiddenImage').empty();
|
||||
$(preImage).appendTo('#hiddenImage');
|
||||
|
||||
changeMode(false, true);
|
||||
$('#loading').hide();
|
||||
$('#windowSaveAs').jqm({modal: true}).jqmHide();
|
||||
|
||||
};
|
||||
var now = new Date();
|
||||
preImage.src = data.path + "?" + now.getTime();
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
};
|
||||
$('#' + formId).ajaxSubmit(options);
|
||||
return false;
|
||||
};
|
||||
|
||||
function saveAsImagePre()
|
||||
{
|
||||
$('#windowSaveAs').jqm({modal: true}).jqmShow();
|
||||
var saveTo = $('#save_to');
|
||||
$(saveTo).removeOption(/./);
|
||||
$(saveTo).ajaxAddOption(urlGetFolderList, {}, false,
|
||||
function()
|
||||
{
|
||||
$(saveTo).selectOptions(currentFolder);
|
||||
});
|
||||
return false;
|
||||
};
|
||||
|
||||
function saveAsImage()
|
||||
{
|
||||
|
||||
var pattern=/^[A-Za-z0-9_ \-]+$/i;
|
||||
|
||||
var newName = $('#new_name');
|
||||
|
||||
var saveAs = $('#save_to').get(0);
|
||||
//alert($(saveAs).val());
|
||||
if(!pattern.test($(newName).val()))
|
||||
{
|
||||
alert(warningInvalidNewName);
|
||||
}else if(saveAs.selectedIndex < 0)
|
||||
{
|
||||
alert(warningNoFolderSelected);
|
||||
}else
|
||||
{
|
||||
|
||||
$('#hidden_new_name').val($(newName).val());
|
||||
$('#hidden_save_to').val(saveAs.options[saveAs.selectedIndex].value);
|
||||
if(saveImage(true))
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
function saveImage(saveAs)
|
||||
{
|
||||
if(typeof(saveAs) == 'boolean' && saveAs)
|
||||
{
|
||||
|
||||
}else
|
||||
{//remove new name if just normal save
|
||||
$('#hidden_new_name').val('');
|
||||
$('#hidden_save_to').val('');
|
||||
}
|
||||
if (!isImageHistoryExist() && (typeof(saveAs) == 'undefined' || !saveAs))
|
||||
{
|
||||
alert(noChangeMadeBeforeSave);
|
||||
}else
|
||||
{
|
||||
|
||||
if(processImage('formImageInfo'))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
function editorClose()
|
||||
{
|
||||
if(window.confirm(warningEditorClose))
|
||||
{
|
||||
window.close();
|
||||
}
|
||||
return false;
|
||||
};
|
||||
@@ -1,91 +0,0 @@
|
||||
function save(id, text)
|
||||
{
|
||||
jQuery('#text').val(text);
|
||||
jQuery('#save_as_request').val('0');
|
||||
jQuery('#name').val(currentName);
|
||||
jQuery('#folder').val(currentFolder);
|
||||
do_save(false);
|
||||
};
|
||||
function do_save(saveAsRequest)
|
||||
{
|
||||
jQuery('#windowProcessing').jqmShow();
|
||||
|
||||
var options =
|
||||
{
|
||||
dataType: 'json',
|
||||
error: function (data, status, e)
|
||||
{
|
||||
alert(e);
|
||||
},
|
||||
success: function(data)
|
||||
{
|
||||
if(typeof(data.error) == 'undefined')
|
||||
{
|
||||
alert('Unexpected information ');
|
||||
|
||||
if(typeof(saveAsRequest) == 'boolean' && saveAsRequest)
|
||||
{
|
||||
jQuery('#windowSaveAs').jqmShow();
|
||||
}
|
||||
}
|
||||
else if(data.error != '')
|
||||
{
|
||||
alert(data.error);
|
||||
jQuery('#windowProcessing').jqmHide();
|
||||
if(typeof(saveAsRequest) == 'boolean' && saveAsRequest)
|
||||
{
|
||||
jQuery('#windowSaveAs').jqmShow();
|
||||
}
|
||||
}else
|
||||
{
|
||||
jQuery('#windowProcessing').jqmHide();
|
||||
jQuery('#windowSaveAs').jqmHide();
|
||||
currentFolder = data.folder;
|
||||
currentName = data.name;
|
||||
}
|
||||
}
|
||||
};
|
||||
jQuery('#frmProcessing').ajaxSubmit(options);
|
||||
};
|
||||
function save_as(id, text)
|
||||
{
|
||||
|
||||
jQuery('#text').val(text);
|
||||
jQuery('#windowSaveAs').jqmShow();
|
||||
var saveTo = jQuery('#save_to');
|
||||
jQuery(saveTo).removeOption(/./);
|
||||
jQuery(saveTo).ajaxAddOption(urlGetFolderList, {}, false,
|
||||
function()
|
||||
{
|
||||
jQuery(saveTo).selectOptions(currentFolder);
|
||||
});
|
||||
|
||||
|
||||
};
|
||||
function do_save_as()
|
||||
{
|
||||
var pattern=/^[A-Za-z0-9_ \-]+$/i;
|
||||
var newName = jQuery('#new_name');
|
||||
var saveAs = jQuery('#save_to').get(0);
|
||||
var ext = jQuery('#ext').get(0);
|
||||
if(!pattern.test(jQuery(newName).val()))
|
||||
{
|
||||
alert(warningInvalidName);
|
||||
}else if(saveAs.selectedIndex < 0)
|
||||
{
|
||||
alert(waringFolderNotSelected);
|
||||
}else if(ext.selectedIndex < 0)
|
||||
{
|
||||
alert(warningExtNotSelected);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
jQuery('#name').val(jQuery(newName).val() + "." + ext.options[ext.selectedIndex].value);
|
||||
jQuery('#folder').val(saveAs.options[saveAs.selectedIndex].value);
|
||||
jQuery('#save_as_request').val('1');
|
||||
jQuery('#windowSaveAs').jqmHide();
|
||||
do_save(true);
|
||||
}
|
||||
return false;
|
||||
};
|
||||
@@ -1 +0,0 @@
|
||||
(function($){var menu,shadow,trigger,content,hash,currentTarget;var defaults={menuStyle:{width:'100px'},itemStyle:{},itemHoverStyle:{},eventPosX:'pageX',eventPosY:'pageY',shadow:true,onContextMenu:null,onShowMenu:null};$.fn.contextMenu=function(id,options){if(!menu){menu=$('<div id="jqContextMenu"></div>').hide().css({position:'absolute',zIndex:'500'}).appendTo('body').bind('click',function(e){e.stopPropagation()})}if(!shadow){shadow=$('<div></div>').css({zIndex:499}).appendTo('body').hide()}hash=hash||[];hash.push({id:id,menuStyle:$.extend({},defaults.menuStyle,options.menuStyle||{}),itemStyle:$.extend({},defaults.itemStyle,options.itemStyle||{}),itemHoverStyle:$.extend({},defaults.itemHoverStyle,options.itemHoverStyle||{}),bindings:options.bindings||{},shadow:options.shadow||options.shadow===false?options.shadow:defaults.shadow,onContextMenu:options.onContextMenu||defaults.onContextMenu,onShowMenu:options.onShowMenu||defaults.onShowMenu,eventPosX:options.eventPosX||defaults.eventPosX,eventPosY:options.eventPosY||defaults.eventPosY});var index=hash.length-1;$(this).bind('contextmenu',function(e){var bShowContext=(!!hash[index].onContextMenu)?hash[index].onContextMenu(e):true;if(bShowContext)display(index,this,e,options);return false});return this};function display(index,trigger,e,options){var cur=hash[index];content=$('#'+cur.id).find('ul:first').clone(true);content.css(cur.menuStyle).find('li').css(cur.itemStyle).hover(function(){$(this).css(cur.itemHoverStyle)},function(){$(this).css(cur.itemStyle)}).find('img').css({verticalAlign:'middle',paddingRight:'2px'});menu.html(content);if(!!cur.onShowMenu)menu=cur.onShowMenu(e,menu);$.each(cur.bindings,function(id,func){$('#'+id,menu).bind('click',function(e){hide();func(trigger,currentTarget)})});menu.css({'left':e[cur.eventPosX],'top':e[cur.eventPosY]}).show();if(cur.shadow)shadow.css({width:menu.width(),height:menu.height(),left:e.pageX+2,top:e.pageY+2}).show();$(document).one('click',hide)}function hide(){menu.hide();shadow.hide()}$.contextMenu={defaults:function(userDefaults){$.each(userDefaults,function(i,val){if(typeof val=='object'&&defaults[i]){$.extend(defaults[i],val)}else defaults[i]=val})}}})(jQuery);$(function(){$('div.contextMenu').hide()});
|
||||
@@ -1,352 +0,0 @@
|
||||
body, html{
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
height: 100%;
|
||||
border: none;
|
||||
overflow: hidden;
|
||||
background-color: #FFFFFF;
|
||||
}
|
||||
|
||||
body, html, table, form, textarea{
|
||||
font: 12px monospace, sans-serif;
|
||||
}
|
||||
|
||||
#editor{
|
||||
border: solid #888888 1px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
#result{
|
||||
z-index: 4;
|
||||
overflow: scroll;
|
||||
border-top: solid #888888 1px;
|
||||
border-bottom: solid #888888 1px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
#container{
|
||||
overflow: hidden;
|
||||
/*height: 100px;*/
|
||||
border: solid blue 0px;
|
||||
position: relative;
|
||||
padding: 0 5px 0px 0;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
#textarea{
|
||||
position: relative;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
padding: 0px 0px 0px 45px;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
/*position: absolute;*/
|
||||
overflow: hidden;
|
||||
z-index: 7;
|
||||
border: solid green 0px;
|
||||
/* background: none;
|
||||
background-color: transparent;*/
|
||||
}
|
||||
|
||||
#content_highlight{
|
||||
white-space: pre;
|
||||
/*background-color: #FFFFFF;*/
|
||||
padding: 1px 0 0 45px;
|
||||
position : absolute;
|
||||
z-index: 4;
|
||||
overflow: visible;
|
||||
border: solid yellow 0px;
|
||||
}
|
||||
|
||||
|
||||
#selection_field{
|
||||
padding: 0px 0px 0 45px;
|
||||
background-color: #FFFF99;
|
||||
height: 1px;
|
||||
position: absolute;
|
||||
z-index: 5;
|
||||
top: -100px;
|
||||
margin: 1px 0 0 0px;
|
||||
white-space: pre;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
#line_number{
|
||||
position: absolute;
|
||||
overflow: hidden;
|
||||
border-right: solid black 1px;
|
||||
z-index:8;
|
||||
width: 38px;
|
||||
padding-right: 5px;
|
||||
text-align: right;
|
||||
color: #AAAAAA;
|
||||
}
|
||||
|
||||
#test_font_size{
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
visibility: hidden;
|
||||
position: absolute;
|
||||
white-space: pre;
|
||||
}
|
||||
|
||||
pre{
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.hidden{
|
||||
opacity: 0.2;
|
||||
-moz-opacity: 0.2;
|
||||
filter:alpha(opacity=20);
|
||||
}
|
||||
|
||||
#result .edit_area_cursor{
|
||||
position: absolute;
|
||||
z-index:6;
|
||||
background-color: #FF6633;
|
||||
top: -100px;
|
||||
margin: 1px 0 0 0px;
|
||||
}
|
||||
|
||||
#result .edit_area_selection_field .overline{
|
||||
background-color: #996600;
|
||||
}
|
||||
|
||||
|
||||
/* area popup */
|
||||
.editarea_popup{
|
||||
border: solid 1px #888888;
|
||||
background-color: #ECE9D8;
|
||||
width: 250px;
|
||||
padding: 4px;
|
||||
position: absolute;
|
||||
visibility: hidden;
|
||||
/*display: none;*/
|
||||
z-index: 15;
|
||||
top: -500px;
|
||||
|
||||
/*font-family: Aria, Verdana, sans-serif;
|
||||
font-size: 10pt;*/
|
||||
}
|
||||
|
||||
.editarea_popup, .editarea_popup table{
|
||||
font-family: sans-serif;
|
||||
font-size: 10pt;
|
||||
}
|
||||
|
||||
.editarea_popup img{
|
||||
border: 0;
|
||||
}
|
||||
|
||||
.editarea_popup .close_popup{
|
||||
float: right;
|
||||
line-height: 16px;
|
||||
border: 0px;
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
.editarea_popup h1,.editarea_popup h2,.editarea_popup h3,.editarea_popup h4,.editarea_popup h5,.editarea_popup h6{
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
.editarea_popup .copyright{
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
/* Area_search */
|
||||
div#area_search_replace{
|
||||
/*width: 250px;*/
|
||||
}
|
||||
|
||||
div#area_search_replace img{
|
||||
border: 0px;
|
||||
}
|
||||
|
||||
div#area_search_replace div.button{
|
||||
text-align: center;
|
||||
line-height: 1.7em;
|
||||
}
|
||||
|
||||
div#area_search_replace .button a{
|
||||
cursor: pointer;
|
||||
border: solid 1px #888888;
|
||||
background-color: #DEDEDE;
|
||||
text-decoration: none;
|
||||
padding: 0 2px;
|
||||
color: #000000;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
div#area_search_replace a:hover{
|
||||
/*border: solid 1px #888888;*/
|
||||
background-color: #EDEDED;
|
||||
}
|
||||
|
||||
div#area_search_replace #move_area_search_replace{
|
||||
cursor: move;
|
||||
border: solid 1px #888888;
|
||||
}
|
||||
|
||||
div#area_search_replace #close_area_search_replace{
|
||||
text-align: right;
|
||||
vertical-align: top;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
div#area_search_replace #area_search_msg{
|
||||
height: 18px;
|
||||
overflow: hidden;
|
||||
border-top: solid 1px #888888;
|
||||
margin-top: 3px;
|
||||
}
|
||||
|
||||
/* area help */
|
||||
#edit_area_help{
|
||||
width: 350px;
|
||||
}
|
||||
|
||||
#edit_area_help div.close_popup{
|
||||
float: right;
|
||||
}
|
||||
|
||||
/* area_toolbar */
|
||||
.area_toolbar{
|
||||
/*font: 11px sans-serif;*/
|
||||
width: 100%;
|
||||
/*height: 21px; */
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
background-color: #ECE9D8;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.area_toolbar, .area_toolbar table{
|
||||
font: 11px sans-serif;
|
||||
}
|
||||
|
||||
.area_toolbar img{
|
||||
border: 0px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.area_toolbar input{
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
.area_toolbar select{
|
||||
font-family: 'MS Sans Serif',sans-serif,Verdana,Arial;
|
||||
font-size: 7pt;
|
||||
font-weight: normal;
|
||||
margin: 2px 0 0 0 ;
|
||||
padding: 0;
|
||||
vertical-align: top;
|
||||
background-color: #F0F0EE;
|
||||
}
|
||||
|
||||
table.statusbar{
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.area_toolbar td.infos{
|
||||
text-align: center;
|
||||
width: 130px;
|
||||
border-right: solid 1px #888888;
|
||||
border-width: 0 1px 0 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.area_toolbar td.total{
|
||||
text-align: right;
|
||||
width: 50px;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.area_toolbar td.resize{
|
||||
text-align: right;
|
||||
}
|
||||
/*
|
||||
.area_toolbar span{
|
||||
line-height: 1px;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}*/
|
||||
|
||||
.area_toolbar span#resize_area{
|
||||
cursor: nw-resize;
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
/* toolbar buttons */
|
||||
.editAreaButtonNormal, .editAreaButtonOver, .editAreaButtonDown, .editAreaSeparator, .editAreaSeparatorLine, .editAreaButtonDisabled, .editAreaButtonSelected {
|
||||
border: 0px; margin: 0px; padding: 0px; background: transparent;
|
||||
margin-top: 0px;
|
||||
margin-left: 1px;
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
.editAreaButtonNormal {
|
||||
border: 1px solid #ECE9D8 !important;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.editAreaButtonOver {
|
||||
border: 1px solid #0A246A !important;
|
||||
cursor: pointer;
|
||||
background-color: #B6BDD2;
|
||||
}
|
||||
|
||||
.editAreaButtonDown {
|
||||
cursor: pointer;
|
||||
border: 1px solid #0A246A !important;
|
||||
background-color: #8592B5;
|
||||
}
|
||||
|
||||
.editAreaButtonSelected {
|
||||
border: 1px solid #C0C0BB !important;
|
||||
cursor: pointer;
|
||||
background-color: #F4F2E8;
|
||||
}
|
||||
|
||||
.editAreaButtonDisabled {
|
||||
filter:progid:DXImageTransform.Microsoft.Alpha(opacity=30);
|
||||
-moz-opacity:0.3;
|
||||
opacity: 0.3;
|
||||
border: 1px solid #F0F0EE !important;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.editAreaSeparatorLine {
|
||||
margin: 1px 2px;
|
||||
background-color: #C0C0BB;
|
||||
width: 2px;
|
||||
height: 18px;
|
||||
}
|
||||
|
||||
/* waiting screen */
|
||||
#processing{
|
||||
display: none;
|
||||
background-color:#ECE9D8;
|
||||
border: solid #888888 1px;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 100;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#processing_text{
|
||||
position:absolute;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
width: 200px;
|
||||
height: 20px;
|
||||
margin-left: -100px;
|
||||
margin-top: -10px;
|
||||
text-align: center;
|
||||
}
|
||||
/* end */
|
||||
|
Before Width: | Height: | Size: 102 B |
|
Before Width: | Height: | Size: 198 B |
|
Before Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 295 B |
|
Before Width: | Height: | Size: 256 B |
|
Before Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 257 B |
|
Before Width: | Height: | Size: 170 B |
|
Before Width: | Height: | Size: 147 B |
|
Before Width: | Height: | Size: 825 B |
|
Before Width: | Height: | Size: 169 B |
|
Before Width: | Height: | Size: 168 B |
|
Before Width: | Height: | Size: 285 B |
|
Before Width: | Height: | Size: 203 B |
|
Before Width: | Height: | Size: 191 B |
|
Before Width: | Height: | Size: 174 B |
|
Before Width: | Height: | Size: 43 B |
|
Before Width: | Height: | Size: 79 B |
|
Before Width: | Height: | Size: 175 B |
@@ -1,45 +0,0 @@
|
||||
editAreaLoader.lang["de"]={
|
||||
new_document: "neues leeres Dokument",
|
||||
search_button: "suchen und ersetzen",
|
||||
search_command: "suche nächsten / öffne Suchfeld",
|
||||
search: "suche",
|
||||
replace: "ersetze",
|
||||
replace_command: "ersetze / öffne Suchfeld",
|
||||
find_next: "finde nächsten",
|
||||
replace_all: "ersetze alle Treffer",
|
||||
reg_exp: "reguläre Ausdrücke",
|
||||
match_case: "passt auf den Begriff<br />",
|
||||
not_found: "Nicht gefunden.",
|
||||
occurrence_replaced: "Die Vorkommen wurden ersetzt.",
|
||||
search_field_empty: "leeres Suchfeld",
|
||||
restart_search_at_begin: "Ende des zu durchsuchenden Bereiches erreicht. Es wird die Suche von Anfang an fortgesetzt.", //find a shorter translation
|
||||
move_popup: "Suchfenster bewegen",
|
||||
font_size: "--Schriftgröße--",
|
||||
go_to_line: "gehe zu Zeile",
|
||||
go_to_line_prompt: "gehe zu Zeilennummmer:",
|
||||
undo: "rückgängig machen",
|
||||
redo: "wiederherstellen",
|
||||
change_smooth_selection: "aktiviere/deaktiviere einige Features (weniger Bildschirmnutzung aber mehr CPU-Belastung)",
|
||||
highlight: "Syntax Highlighting an- und ausschalten",
|
||||
reset_highlight: "Highlighting zurücksetzen (falls mit Text nicht konform)",
|
||||
help: "über",
|
||||
save: "sichern",
|
||||
load: "öffnen",
|
||||
line_abbr: "Ln",
|
||||
char_abbr: "Ch",
|
||||
position: "Position",
|
||||
total: "Gesamt",
|
||||
close_popup: "Popup schließen",
|
||||
shortcuts: "Shortcuts",
|
||||
add_tab: "Tab zum Text hinzufügen",
|
||||
remove_tab: "Tab aus Text entfernen",
|
||||
about_notice: "Bemerkung: Syntax Highlighting ist nur für kurze Texte",
|
||||
toggle: "Editor an- und ausschalten",
|
||||
accesskey: "Accesskey",
|
||||
tab: "Tab",
|
||||
shift: "Shift",
|
||||
ctrl: "Ctrl",
|
||||
esc: "Esc",
|
||||
processing: "In Bearbeitung...",
|
||||
fullscreen: "fullscreen"
|
||||
};
|
||||
@@ -1,45 +0,0 @@
|
||||
editAreaLoader.lang["dk"]={
|
||||
new_document: "nyt tomt dokument",
|
||||
search_button: "søg og erstat",
|
||||
search_command: "find næste / åben søgefelt",
|
||||
search: "søg",
|
||||
replace: "erstat",
|
||||
replace_command: "erstat / åben søgefelt",
|
||||
find_next: "find næste",
|
||||
replace_all: "erstat alle",
|
||||
reg_exp: "regular expressions",
|
||||
match_case: "forskel på store/små bogstaver<br />",
|
||||
not_found: "not found.",
|
||||
occurrence_replaced: "occurences replaced.",
|
||||
search_field_empty: "Search field empty",
|
||||
restart_search_at_begin: "End of area reached. Restart at begin.",
|
||||
move_popup: "flyt søgepopup",
|
||||
font_size: "--Skriftstørrelse--",
|
||||
go_to_line: "gå til linie",
|
||||
go_to_line_prompt: "gå til linienummer:",
|
||||
undo: "fortryd",
|
||||
redo: "gentag",
|
||||
change_smooth_selection: "slå display funktioner til/fra (smartere display men mere CPU krævende)",
|
||||
highlight: "slå syntax highlight til/fra",
|
||||
reset_highlight: "nulstil highlight (hvis den er desynkroniseret fra teksten)",
|
||||
help: "om",
|
||||
save: "gem",
|
||||
load: "hent",
|
||||
line_abbr: "Ln",
|
||||
char_abbr: "Ch",
|
||||
position: "Position",
|
||||
total: "Total",
|
||||
close_popup: "luk popup",
|
||||
shortcuts: "Genveje",
|
||||
add_tab: "tilføj tabulation til tekst",
|
||||
remove_tab: "fjern tabulation fra tekst",
|
||||
about_notice: "Husk: syntax highlight funktionen bør kun bruge til små tekster",
|
||||
toggle: "Slå editor til / fra",
|
||||
accesskey: "Accesskey",
|
||||
tab: "Tab",
|
||||
shift: "Skift",
|
||||
ctrl: "Ctrl",
|
||||
esc: "Esc",
|
||||
processing: "Processing...",
|
||||
fullscreen: "fullscreen"
|
||||
};
|
||||
@@ -1,46 +0,0 @@
|
||||
editAreaLoader.lang["en"]={
|
||||
new_document: "new empty document",
|
||||
search_button: "search and replace",
|
||||
search_command: "search next / open search area",
|
||||
search: "search",
|
||||
replace: "replace",
|
||||
replace_command: "replace / open search area",
|
||||
find_next: "find next",
|
||||
replace_all: "replace all",
|
||||
reg_exp: "regular expressions",
|
||||
match_case: "match case",
|
||||
not_found: "not found.",
|
||||
occurrence_replaced: "occurences replaced.",
|
||||
search_field_empty: "Search field empty",
|
||||
restart_search_at_begin: "End of area reached. Restart at begin.",
|
||||
move_popup: "move search popup",
|
||||
font_size: "--Font size--",
|
||||
go_to_line: "go to line",
|
||||
go_to_line_prompt: "go to line number:",
|
||||
undo: "undo",
|
||||
redo: "redo",
|
||||
change_smooth_selection: "enable/disable some display features (smarter display but more CPU charge)",
|
||||
highlight: "toggle syntax highlight on/off",
|
||||
reset_highlight: "reset highlight (if desyncronized from text)",
|
||||
help: "about",
|
||||
save: "save",
|
||||
save_as: "save as",
|
||||
load: "load",
|
||||
line_abbr: "Ln",
|
||||
char_abbr: "Ch",
|
||||
position: "Position",
|
||||
total: "Total",
|
||||
close_popup: "close popup",
|
||||
shortcuts: "Shortcuts",
|
||||
add_tab: "add tabulation to text",
|
||||
remove_tab: "remove tabulation to text",
|
||||
about_notice: "Notice: syntax highlight function is only for small text",
|
||||
toggle: "Toggle editor",
|
||||
accesskey: "Accesskey",
|
||||
tab: "Tab",
|
||||
shift: "Shift",
|
||||
ctrl: "Ctrl",
|
||||
esc: "Esc",
|
||||
processing: "Processing...",
|
||||
fullscreen: "fullscreen"
|
||||
};
|
||||
@@ -1,45 +0,0 @@
|
||||
editAreaLoader.lang["fr"]={
|
||||
new_document: "nouveau document (efface le contenu)",
|
||||
search_button: "rechercher / remplacer",
|
||||
search_command: "rechercher suivant / ouvrir la fenêtre de recherche",
|
||||
search: "rechercher",
|
||||
replace: "remplacer",
|
||||
replace_command: "remplacer / ouvrir la fenêtre de recherche",
|
||||
find_next: "rechercher",
|
||||
replace_all: "tout remplacer",
|
||||
reg_exp: "expr. régulière",
|
||||
match_case: "respecter la casse",
|
||||
not_found: "pas trouvé.",
|
||||
occurrence_replaced: "remplacements éffectués.",
|
||||
search_field_empty: "Le champ de recherche est vide.",
|
||||
restart_search_at_begin: "Fin du texte atteint, poursuite au début.",
|
||||
move_popup: "déplacer la fenêtre de recherche",
|
||||
font_size: "--Taille police--",
|
||||
go_to_line: "aller à la ligne",
|
||||
go_to_line_prompt: "aller a la ligne numero:",
|
||||
undo: "annuler",
|
||||
redo: "refaire",
|
||||
change_smooth_selection: "activer/désactiver des fonctions d'affichage (meilleur affichage mais plus de charge processeur)",
|
||||
highlight: "activer/désactiver la coloration syntaxique",
|
||||
reset_highlight: "réinitialiser la coloration syntaxique (si désyncronisée du texte)",
|
||||
help: "à propos",
|
||||
save: "sauvegarder",
|
||||
load: "charger",
|
||||
line_abbr: "Ln",
|
||||
char_abbr: "Ch",
|
||||
position: "Position",
|
||||
total: "Total",
|
||||
close_popup: "fermer le popup",
|
||||
shortcuts: "Racourcis clavier",
|
||||
add_tab: "ajouter une tabulation dans le texte",
|
||||
remove_tab: "retirer une tabulation dans le texte",
|
||||
about_notice: "Note: la coloration syntaxique n'est prévue que pour de courts textes.",
|
||||
toggle: "basculer l'éditeur",
|
||||
accesskey: "Accesskey",
|
||||
tab: "Tab",
|
||||
shift: "Maj",
|
||||
ctrl: "Ctrl",
|
||||
esc: "Esc",
|
||||
processing: "chargement...",
|
||||
fullscreen: "plein écran"
|
||||
};
|
||||
@@ -1,45 +0,0 @@
|
||||
editAreaLoader.lang["hr"]={
|
||||
new_document: "Novi dokument",
|
||||
search_button: "Traži i izmijeni",
|
||||
search_command: "Traži dalje / Otvori prozor za traženje",
|
||||
search: "Traži",
|
||||
replace: "Izmijeni",
|
||||
replace_command: "Izmijeni / Otvori prozor za traženje",
|
||||
find_next: "Traži dalje",
|
||||
replace_all: "Izmjeni sve",
|
||||
reg_exp: "Regularni izrazi",
|
||||
match_case: "Bitna vel. slova",
|
||||
not_found: "nije naðeno.",
|
||||
occurrence_replaced: "izmjenjenih.",
|
||||
search_field_empty: "Prazno polje za traženje!",
|
||||
restart_search_at_begin: "Došao do kraja. Poèeo od poèetka.",
|
||||
move_popup: "Pomakni prozor",
|
||||
font_size: "--Velièina teksta--",
|
||||
go_to_line: "Odi na redak",
|
||||
go_to_line_prompt: "Odi na redak:",
|
||||
undo: "Vrati natrag",
|
||||
redo: "Napravi ponovo",
|
||||
change_smooth_selection: "Ukljuèi/iskljuèi neke moguænosti prikaza (pametniji prikaz, ali zagušeniji CPU)",
|
||||
highlight: "Ukljuèi/iskljuèi bojanje sintakse",
|
||||
reset_highlight: "Ponovi kolorizaciju (ako je nesinkronizirana s tekstom)",
|
||||
help: "O edit_area",
|
||||
save: "Spremi",
|
||||
load: "Uèitaj",
|
||||
line_abbr: "Ln",
|
||||
char_abbr: "Zn",
|
||||
position: "Pozicija",
|
||||
total: "Ukupno",
|
||||
close_popup: "Zatvori prozor",
|
||||
shortcuts: "Kratice",
|
||||
add_tab: "Dodaj tabulaciju",
|
||||
remove_tab: "Makni tabulaciju",
|
||||
about_notice: "Napomena: koloriziranje sintakse je samo za kratke kodove",
|
||||
toggle: "Prebaci naèin ureðivanja",
|
||||
accesskey: "Accesskey",
|
||||
tab: "Tab",
|
||||
shift: "Shift",
|
||||
ctrl: "Ctrl",
|
||||
esc: "Esc",
|
||||
processing: "Procesiram...",
|
||||
fullscreen: "Cijeli prozor"
|
||||
};
|
||||
@@ -1,45 +0,0 @@
|
||||
editAreaLoader.lang["it"]={
|
||||
new_document: "nuovo documento vuoto",
|
||||
search_button: "cerca e sostituisci",
|
||||
search_command: "trova successivo / apri finestra di ricerca",
|
||||
search: "cerca",
|
||||
replace: "sostituisci",
|
||||
replace_command: "sostituisci / apri finestra di ricerca",
|
||||
find_next: "trova successivo",
|
||||
replace_all: "sostituisci tutti",
|
||||
reg_exp: "espressioni regolari",
|
||||
match_case: "confronta maiuscole/minuscole<br />",
|
||||
not_found: "non trovato.",
|
||||
occurrence_replaced: "occorrenze sostituite.",
|
||||
search_field_empty: "Campo ricerca vuoto",
|
||||
restart_search_at_begin: "Fine del testo raggiunta. Ricomincio dall'inizio.",
|
||||
move_popup: "sposta popup di ricerca",
|
||||
font_size: "-- Dimensione --",
|
||||
go_to_line: "vai alla linea",
|
||||
go_to_line_prompt: "vai alla linea numero:",
|
||||
undo: "annulla",
|
||||
redo: "ripeti",
|
||||
change_smooth_selection: "abilita/disabilita alcune caratteristiche della visualizzazione",
|
||||
highlight: "abilita/disabilita colorazione della sintassi",
|
||||
reset_highlight: "aggiorna colorazione (se non sincronizzata)",
|
||||
help: "informazioni su...",
|
||||
save: "salva",
|
||||
load: "carica",
|
||||
line_abbr: "Ln",
|
||||
char_abbr: "Ch",
|
||||
position: "Posizione",
|
||||
total: "Totale",
|
||||
close_popup: "chiudi popup",
|
||||
shortcuts: "Scorciatoie",
|
||||
add_tab: "aggiungi tabulazione",
|
||||
remove_tab: "rimuovi tabulazione",
|
||||
about_notice: "Avviso: la colorazione della sintassi vale solo con testo piccolo",
|
||||
toggle: "Abilita/disabilita editor",
|
||||
accesskey: "Accesskey",
|
||||
tab: "Tab",
|
||||
shift: "Shift",
|
||||
ctrl: "Ctrl",
|
||||
esc: "Esc",
|
||||
processing: "In corso...",
|
||||
fullscreen: "fullscreen"
|
||||
};
|
||||
@@ -1,45 +0,0 @@
|
||||
editAreaLoader.lang["ja"]={
|
||||
new_document: "新規作成",
|
||||
search_button: "検索・置換",
|
||||
search_command: "次を検索 / 検索窓を表示",
|
||||
search: "検索",
|
||||
replace: "置換",
|
||||
replace_command: "置換 / 置換窓を表示",
|
||||
find_next: "次を検索",
|
||||
replace_all: "全置換",
|
||||
reg_exp: "正規表現",
|
||||
match_case: "大文字小文字の区別",
|
||||
not_found: "見つかりません。",
|
||||
occurrence_replaced: "置換しました。",
|
||||
search_field_empty: "検索対象文字列が空です。",
|
||||
restart_search_at_begin: "終端に達しました、始めに戻ります",
|
||||
move_popup: "検索窓を移動",
|
||||
font_size: "--フォントサイズ--",
|
||||
go_to_line: "指定行へ移動",
|
||||
go_to_line_prompt: "指定行へ移動します:",
|
||||
undo: "元に戻す",
|
||||
redo: "やり直し",
|
||||
change_smooth_selection: "スムース表示の切り替え(CPUを使います)",
|
||||
highlight: "構文強調表示の切り替え",
|
||||
reset_highlight: "構文強調表示のリセット",
|
||||
help: "ヘルプを表示",
|
||||
save: "保存",
|
||||
load: "読み込み",
|
||||
line_abbr: "行",
|
||||
char_abbr: "文字",
|
||||
position: "位置",
|
||||
total: "合計",
|
||||
close_popup: "ポップアップを閉じる",
|
||||
shortcuts: "ショートカット",
|
||||
add_tab: "タブを挿入する",
|
||||
remove_tab: "タブを削除する",
|
||||
about_notice: "注意:構文強調表示は短いテキストでしか有効に機能しません。",
|
||||
toggle: "テキストエリアとeditAreaの切り替え",
|
||||
accesskey: "アクセスキー",
|
||||
tab: "Tab",
|
||||
shift: "Shift",
|
||||
ctrl: "Ctrl",
|
||||
esc: "Esc",
|
||||
processing: "処理中です...",
|
||||
fullscreen: "fullscreen"
|
||||
};
|
||||
@@ -1,45 +0,0 @@
|
||||
editAreaLoader.lang["nl"]={
|
||||
new_document: "nieuw leeg document",
|
||||
search_button: "zoek en vervang",
|
||||
search_command: "zoek volgende / zoekscherm openen",
|
||||
search: "zoek",
|
||||
replace: "vervang",
|
||||
replace_command: "vervang / zoekscherm openen",
|
||||
find_next: "volgende vinden",
|
||||
replace_all: "alles vervangen",
|
||||
reg_exp: "reguliere expressies",
|
||||
match_case: "hoofdletter gevoelig",
|
||||
not_found: "niet gevonden.",
|
||||
occurrence_replaced: "object vervangen.",
|
||||
search_field_empty: "Zoek veld leeg",
|
||||
restart_search_at_begin: "Niet meer instanties gevonden, begin opnieuw",
|
||||
move_popup: "versleep zoek scherm",
|
||||
font_size: "--Letter grootte--",
|
||||
go_to_line: "Ga naar regel",
|
||||
go_to_line_prompt: "Ga naar regel nummer:",
|
||||
undo: "Ongedaan maken",
|
||||
redo: "Opnieuw doen",
|
||||
change_smooth_selection: "zet wat schermopties aan/uit (kan langzamer zijn)",
|
||||
highlight: "zet syntax highlight aan/uit",
|
||||
reset_highlight: "reset highlight (indien gedesynchronizeerd)",
|
||||
help: "informatie",
|
||||
save: "opslaan",
|
||||
load: "laden",
|
||||
line_abbr: "Ln",
|
||||
char_abbr: "Ch",
|
||||
position: "Positie",
|
||||
total: "Totaal",
|
||||
close_popup: "Popup sluiten",
|
||||
shortcuts: "Snelkoppelingen",
|
||||
add_tab: "voeg tabs toe in tekst",
|
||||
remove_tab: "verwijder tabs uit tekst",
|
||||
about_notice: "Notitie: syntax highlight functie is alleen voor kleine tekst",
|
||||
toggle: "geavanceerde bewerkingsopties",
|
||||
accesskey: "Accessknop",
|
||||
tab: "Tab",
|
||||
shift: "Shift",
|
||||
ctrl: "Ctrl",
|
||||
esc: "Esc",
|
||||
processing: "Verwerken...",
|
||||
fullscreen: "fullscreen"
|
||||
};
|
||||
@@ -1,45 +0,0 @@
|
||||
editAreaLoader.lang["pl"]={
|
||||
new_document: "nowy dokument",
|
||||
search_button: "znajdź i zamień",
|
||||
search_command: "znajdź następny",
|
||||
search: "znajdź",
|
||||
replace: "zamień",
|
||||
replace_command: "zamień",
|
||||
find_next: "następny",
|
||||
replace_all: "zamień wszystko",
|
||||
reg_exp: "wyrażenie regularne",
|
||||
match_case: "uwzględnij wielkość liter<br />",
|
||||
not_found: "nie znaleziono.",
|
||||
occurrence_replaced: "wystąpień zamieniono.",
|
||||
search_field_empty: "Nie wprowadzono tekstu",
|
||||
restart_search_at_begin: "Koniec dokumentu. Wyszukiwanie od początku.",
|
||||
move_popup: "przesuń okienko wyszukiwania",
|
||||
font_size: "Rozmiar",
|
||||
go_to_line: "idź do linii",
|
||||
go_to_line_prompt: "numer linii:",
|
||||
undo: "cofnij",
|
||||
redo: "przywróć",
|
||||
change_smooth_selection: "włącz/wyłącz niektóre opcje wyglądu (zaawansowane opcje wyglądu obciążają procesor)",
|
||||
highlight: "włącz/wyłącz podświetlanie składni",
|
||||
reset_highlight: "odśwież podświetlanie składni (jeśli rozsynchronizowało się z tekstem)",
|
||||
help: "o programie",
|
||||
save: "zapisz",
|
||||
load: "otwórz",
|
||||
line_abbr: "Ln",
|
||||
char_abbr: "Zn",
|
||||
position: "Pozycja",
|
||||
total: "W sumie",
|
||||
close_popup: "zamknij okienko",
|
||||
shortcuts: "Skróty klawiaturowe",
|
||||
add_tab: "dodaj wcięcie do zaznaczonego tekstu",
|
||||
remove_tab: "usuń wcięcie",
|
||||
about_notice: "Uwaga: podświetlanie składni nie jest zalecane dla długich tekstów",
|
||||
toggle: "Włącz/wyłącz edytor",
|
||||
accesskey: "Alt+",
|
||||
tab: "Tab",
|
||||
shift: "Shift",
|
||||
ctrl: "Ctrl",
|
||||
esc: "Esc",
|
||||
processing: "Przetwarzanie...",
|
||||
fullscreen: "fullscreen"
|
||||
};
|
||||
@@ -1,45 +0,0 @@
|
||||
editAreaLoader.lang["pt"]={
|
||||
new_document: "Novo documento",
|
||||
search_button: "Localizar e substituir",
|
||||
search_command: "Localizar próximo",
|
||||
search: "Localizar",
|
||||
replace: "Substituir",
|
||||
replace_command: "Substituir",
|
||||
find_next: "Localizar",
|
||||
replace_all: "Subst. tudo",
|
||||
reg_exp: "Expressões regulares",
|
||||
match_case: "Diferenciar maiúsculas e minúsculas",
|
||||
not_found: "Não encontrado.",
|
||||
occurrence_replaced: "Ocorrências substituidas",
|
||||
search_field_empty: "Campo localizar vazio.",
|
||||
restart_search_at_begin: "Fim das ocorrências. Recomeçar do inicio.",
|
||||
move_popup: "Mover janela",
|
||||
font_size: "--Tamanho da fonte--",
|
||||
go_to_line: "Ir para linha",
|
||||
go_to_line_prompt: "Ir para a linha:",
|
||||
undo: "Desfazer",
|
||||
redo: "Refazer",
|
||||
change_smooth_selection: "Opções visuais",
|
||||
highlight: "Cores de sintaxe",
|
||||
reset_highlight: "Resetar cores (se não sincronizado)",
|
||||
help: "Sobre",
|
||||
save: "Salvar",
|
||||
load: "Carregar",
|
||||
line_abbr: "Ln",
|
||||
char_abbr: "Ch",
|
||||
position: "Posição",
|
||||
total: "Total",
|
||||
close_popup: "Fechar",
|
||||
shortcuts: "Shortcuts",
|
||||
add_tab: "Adicionar tabulação",
|
||||
remove_tab: "Remover tabulação",
|
||||
about_notice: "Atenção: Cores de sintaxe são indicados somente para textos pequenos",
|
||||
toggle: "Exibir editor",
|
||||
accesskey: "Accesskey",
|
||||
tab: "Tab",
|
||||
shift: "Shift",
|
||||
ctrl: "Ctrl",
|
||||
esc: "Esc",
|
||||
processing: "Processando...",
|
||||
fullscreen: "fullscreen"
|
||||
};
|
||||
@@ -1,46 +0,0 @@
|
||||
editAreaLoader.lang["zh_cn"]={
|
||||
new_document: "新建文件",
|
||||
search_button: "查找与替换",
|
||||
search_command: "新查找/打开查找框",
|
||||
search: "查找",
|
||||
replace: "替换",
|
||||
replace_command: "替换/打开查找框",
|
||||
find_next: "查找下一个",
|
||||
replace_all: "替换全部",
|
||||
reg_exp: "正则表达式",
|
||||
match_case: "大小写区分",
|
||||
not_found: "无匹配.",
|
||||
occurrence_replaced: "被替换次数.",
|
||||
search_field_empty: "查找关键词为空",
|
||||
restart_search_at_begin: "已达文字框底,重新开始.",
|
||||
move_popup: "移动查找窗口",
|
||||
font_size: "--文字大小--",
|
||||
go_to_line: "指定行数",
|
||||
go_to_line_prompt: "移动到指定行数:",
|
||||
undo: "上一步",
|
||||
redo: "下一步",
|
||||
change_smooth_selection: "激活/禁止某些显示特效",
|
||||
highlight: "代码高亮开关",
|
||||
reset_highlight: "重设代码高亮",
|
||||
help: "关于",
|
||||
save: "保存",
|
||||
save_as: "别存为",
|
||||
load: "加载",
|
||||
line_abbr: "行数",
|
||||
char_abbr: "字节",
|
||||
position: "位置",
|
||||
total: "总共",
|
||||
close_popup: "关闭窗口",
|
||||
shortcuts: "快捷键",
|
||||
add_tab: "添加间隔号",
|
||||
remove_tab: "删除间隔号",
|
||||
about_notice: "提示:代码高度功能只适用于小文档",
|
||||
toggle: "转换编辑",
|
||||
accesskey: "可访问键",
|
||||
tab: "间隔号",
|
||||
shift: "Shift",
|
||||
ctrl: "Ctrl",
|
||||
esc: "Esc",
|
||||
processing: "处理中...",
|
||||
fullscreen: "全屏"
|
||||
};
|
||||
@@ -1,69 +0,0 @@
|
||||
editAreaLoader.load_syntax["basic"] = {
|
||||
'COMMENT_SINGLE' : {1 : "'", 2 : 'rem'}
|
||||
,'COMMENT_MULTI' : { }
|
||||
,'QUOTEMARKS' : {1: '"'}
|
||||
,'KEYWORD_CASE_SENSITIVE' : false
|
||||
,'KEYWORDS' : {
|
||||
'statements' : [
|
||||
'if','then','for','wend','while',
|
||||
'else','elseif','select','case','end select',
|
||||
'until','next','step','to','end if', 'call'
|
||||
]
|
||||
,'keywords' : [
|
||||
'sub', 'end sub', 'function', 'end function', 'exit',
|
||||
'exit function', 'dim', 'redim', 'shared', 'const',
|
||||
'is', 'absolute', 'access', 'any', 'append', 'as',
|
||||
'base', 'beep', 'binary', 'bload', 'bsave', 'chain',
|
||||
'chdir', 'circle', 'clear', 'close', 'cls', 'color',
|
||||
'com', 'common', 'data', 'date', 'declare', 'def',
|
||||
'defdbl', 'defint', 'deflng', 'defsng', 'defstr',
|
||||
'double', 'draw', 'environ', 'erase', 'error', 'field',
|
||||
'files', 'fn', 'get', 'gosub', 'goto', 'integer', 'key',
|
||||
'kill', 'let', 'line', 'list', 'locate', 'lock', 'long',
|
||||
'lprint', 'lset', 'mkdir', 'name', 'off', 'on', 'open',
|
||||
'option', 'out', 'output', 'paint', 'palette', 'pcopy',
|
||||
'poke', 'preset', 'print', 'pset', 'put', 'random',
|
||||
'randomize', 'read', 'reset', 'restore', 'resume',
|
||||
'return', 'rmdir', 'rset', 'run', 'screen', 'seg',
|
||||
'shell', 'single', 'sleep', 'sound', 'static', 'stop',
|
||||
'strig', 'string', 'swap', 'system', 'time', 'timer',
|
||||
'troff', 'tron', 'type', 'unlock', 'using', 'view',
|
||||
'wait', 'width', 'window', 'write'
|
||||
]
|
||||
,'functions' : [
|
||||
'abs', 'asc', 'atn', 'cdbl', 'chr', 'cint', 'clng',
|
||||
'cos', 'csng', 'csrlin', 'cvd', 'cvdmbf', 'cvi', 'cvl',
|
||||
'cvs', 'cvsmbf', 'eof', 'erdev', 'erl', 'err', 'exp',
|
||||
'fileattr', 'fix', 'fre', 'freefile', 'hex', 'inkey',
|
||||
'inp', 'input', 'instr', 'int', 'ioctl', 'lbound',
|
||||
'lcase', 'left', 'len', 'loc', 'lof', 'log', 'lpos',
|
||||
'ltrim', 'mid', 'mkd', 'mkdmbf', 'mki', 'mkl', 'mks',
|
||||
'mksmbf', 'oct', 'peek', 'pen', 'play', 'pmap', 'point',
|
||||
'pos', 'right', 'rnd', 'rtrim', 'seek', 'sgn', 'sin',
|
||||
'space', 'spc', 'sqr', 'stick', 'str', 'tab', 'tan',
|
||||
'ubound', 'ucase', 'val', 'varptr', 'varseg'
|
||||
]
|
||||
,'operators' : [
|
||||
'and', 'eqv', 'imp', 'mod', 'not', 'or', 'xor'
|
||||
]
|
||||
}
|
||||
,'OPERATORS' :[
|
||||
'+', '-', '/', '*', '=', '<', '>', '!', '&'
|
||||
]
|
||||
,'DELIMITERS' :[
|
||||
'(', ')', '[', ']', '{', '}'
|
||||
]
|
||||
,'STYLES' : {
|
||||
'COMMENTS': 'color: #99CC00;'
|
||||
,'QUOTESMARKS': 'color: #333399;'
|
||||
,'KEYWORDS' : {
|
||||
'keywords' : 'color: #3366FF;'
|
||||
,'functions' : 'color: #0000FF;'
|
||||
,'statements' : 'color: #3366FF;'
|
||||
,'operators' : 'color: #FF0000;'
|
||||
}
|
||||
,'OPERATORS' : 'color: #FF0000;'
|
||||
,'DELIMITERS' : 'color: #0000FF;'
|
||||
|
||||
}
|
||||
};
|
||||
@@ -1,44 +0,0 @@
|
||||
editAreaLoader.load_syntax["brainfuck"] = {
|
||||
'COMMENT_SINGLE' : {}
|
||||
,'COMMENT_MULTI' : {}
|
||||
,'QUOTEMARKS' : {}
|
||||
,'KEYWORD_CASE_SENSITIVE' : true
|
||||
,'OPERATORS' :[
|
||||
'+', '-'
|
||||
]
|
||||
,'DELIMITERS' :[
|
||||
'[', ']'
|
||||
]
|
||||
,'REGEXPS' : {
|
||||
'bfispis' : {
|
||||
'search' : '()(\\.)()'
|
||||
,'class' : 'bfispis'
|
||||
,'modifiers' : 'g'
|
||||
,'execute' : 'before'
|
||||
}
|
||||
,'bfupis' : {
|
||||
'search' : '()(\\,)()'
|
||||
,'class' : 'bfupis'
|
||||
,'modifiers' : 'g'
|
||||
,'execute' : 'before'
|
||||
}
|
||||
,'bfmemory' : {
|
||||
'search' : '()([<>])()'
|
||||
,'class' : 'bfmemory'
|
||||
,'modifiers' : 'g'
|
||||
,'execute' : 'before'
|
||||
}
|
||||
}
|
||||
,'STYLES' : {
|
||||
'COMMENTS': 'color: #AAAAAA;'
|
||||
,'QUOTESMARKS': 'color: #6381F8;'
|
||||
,'OPERATORS' : 'color: #88AA00;'
|
||||
,'DELIMITERS' : 'color: #00C138;'
|
||||
,'REGEXPS' : {
|
||||
'bfispis' : 'color: #EE0000;'
|
||||
,'bfupis' : 'color: #4455ee;'
|
||||
,'bfmemory' : 'color: #DD00DD;'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,62 +0,0 @@
|
||||
editAreaLoader.load_syntax["c"] = {
|
||||
'COMMENT_SINGLE' : {1 : '//'}
|
||||
,'COMMENT_MULTI' : {'/*' : '*/'}
|
||||
,'QUOTEMARKS' : {1: "'", 2: '"'}
|
||||
,'KEYWORD_CASE_SENSITIVE' : true
|
||||
,'KEYWORDS' : {
|
||||
'constants' : [
|
||||
'NULL', 'false', 'stdin', 'stdout', 'stderr', 'true'
|
||||
]
|
||||
,'types' : [
|
||||
'FILE', 'auto', 'char', 'const', 'double',
|
||||
'extern', 'float', 'inline', 'int', 'long', 'register',
|
||||
'short', 'signed', 'size_t', 'static', 'struct',
|
||||
'time_t', 'typedef', 'union', 'unsigned', 'void',
|
||||
'volatile'
|
||||
]
|
||||
,'statements' : [
|
||||
'do', 'else', 'enum', 'for', 'goto', 'if', 'sizeof',
|
||||
'switch', 'while'
|
||||
]
|
||||
,'keywords' : [
|
||||
'break', 'case', 'continue', 'default', 'delete',
|
||||
'return'
|
||||
]
|
||||
}
|
||||
,'OPERATORS' :[
|
||||
'+', '-', '/', '*', '=', '<', '>', '%', '!', '?', ':', '&'
|
||||
]
|
||||
,'DELIMITERS' :[
|
||||
'(', ')', '[', ']', '{', '}'
|
||||
]
|
||||
,'REGEXPS' : {
|
||||
'precompiler' : {
|
||||
'search' : '()(#[^\r\n]*)()'
|
||||
,'class' : 'precompiler'
|
||||
,'modifiers' : 'g'
|
||||
,'execute' : 'before'
|
||||
}
|
||||
/* ,'precompilerstring' : {
|
||||
'search' : '(#[\t ]*include[\t ]*)([^\r\n]*)([^\r\n]*[\r\n])'
|
||||
,'class' : 'precompilerstring'
|
||||
,'modifiers' : 'g'
|
||||
,'execute' : 'before'
|
||||
}*/
|
||||
}
|
||||
,'STYLES' : {
|
||||
'COMMENTS': 'color: #AAAAAA;'
|
||||
,'QUOTESMARKS': 'color: #6381F8;'
|
||||
,'KEYWORDS' : {
|
||||
'constants' : 'color: #EE0000;'
|
||||
,'types' : 'color: #0000EE;'
|
||||
,'statements' : 'color: #60CA00;'
|
||||
,'keywords' : 'color: #48BDDF;'
|
||||
}
|
||||
,'OPERATORS' : 'color: #FF00FF;'
|
||||
,'DELIMITERS' : 'color: #0038E1;'
|
||||
,'REGEXPS' : {
|
||||
'precompiler' : 'color: #009900;'
|
||||
,'precompilerstring' : 'color: #994400;'
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -1,65 +0,0 @@
|
||||
editAreaLoader.load_syntax["cpp"] = {
|
||||
'COMMENT_SINGLE' : {1 : '//'}
|
||||
,'COMMENT_MULTI' : {'/*' : '*/'}
|
||||
,'QUOTEMARKS' : {1: "'", 2: '"'}
|
||||
,'KEYWORD_CASE_SENSITIVE' : true
|
||||
,'KEYWORDS' : {
|
||||
'constants' : [
|
||||
'NULL', 'false', 'std', 'stdin', 'stdout', 'stderr',
|
||||
'true'
|
||||
]
|
||||
,'types' : [
|
||||
'FILE', 'auto', 'char', 'class', 'const', 'double',
|
||||
'extern', 'float', 'friend', 'inline', 'int',
|
||||
'iterator', 'long', 'map', 'operator', 'queue',
|
||||
'register', 'short', 'signed', 'size_t', 'stack',
|
||||
'static', 'string', 'struct', 'time_t', 'typedef',
|
||||
'union', 'unsigned', 'vector', 'void', 'volatile'
|
||||
]
|
||||
,'statements' : [
|
||||
'catch', 'do', 'else', 'enum', 'for', 'goto', 'if',
|
||||
'sizeof', 'switch', 'this', 'throw', 'try', 'while'
|
||||
]
|
||||
,'keywords' : [
|
||||
'break', 'case', 'continue', 'default', 'delete',
|
||||
'namespace', 'new', 'private', 'protected', 'public',
|
||||
'return', 'using'
|
||||
]
|
||||
}
|
||||
,'OPERATORS' :[
|
||||
'+', '-', '/', '*', '=', '<', '>', '%', '!', '?', ':', '&'
|
||||
]
|
||||
,'DELIMITERS' :[
|
||||
'(', ')', '[', ']', '{', '}'
|
||||
]
|
||||
,'REGEXPS' : {
|
||||
'precompiler' : {
|
||||
'search' : '()(#[^\r\n]*)()'
|
||||
,'class' : 'precompiler'
|
||||
,'modifiers' : 'g'
|
||||
,'execute' : 'before'
|
||||
}
|
||||
/* ,'precompilerstring' : {
|
||||
'search' : '(#[\t ]*include[\t ]*)([^\r\n]*)([^\r\n]*[\r\n])'
|
||||
,'class' : 'precompilerstring'
|
||||
,'modifiers' : 'g'
|
||||
,'execute' : 'before'
|
||||
}*/
|
||||
}
|
||||
,'STYLES' : {
|
||||
'COMMENTS': 'color: #AAAAAA;'
|
||||
,'QUOTESMARKS': 'color: #6381F8;'
|
||||
,'KEYWORDS' : {
|
||||
'constants' : 'color: #EE0000;'
|
||||
,'types' : 'color: #0000EE;'
|
||||
,'statements' : 'color: #60CA00;'
|
||||
,'keywords' : 'color: #48BDDF;'
|
||||
}
|
||||
,'OPERATORS' : 'color: #FF00FF;'
|
||||
,'DELIMITERS' : 'color: #0038E1;'
|
||||
,'REGEXPS' : {
|
||||
'precompiler' : 'color: #009900;'
|
||||
,'precompilerstring' : 'color: #994400;'
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -1,84 +0,0 @@
|
||||
editAreaLoader.load_syntax["css"] = {
|
||||
'COMMENT_SINGLE' : {1 : '@'}
|
||||
,'COMMENT_MULTI' : {'/*' : '*/'}
|
||||
,'QUOTEMARKS' : ['"', "'"]
|
||||
,'KEYWORD_CASE_SENSITIVE' : false
|
||||
,'KEYWORDS' : {
|
||||
'attributes' : [
|
||||
'aqua', 'azimuth', 'background-attachment', 'background-color',
|
||||
'background-image', 'background-position', 'background-repeat',
|
||||
'background', 'border-bottom-color', 'border-bottom-style',
|
||||
'border-bottom-width', 'border-left-color', 'border-left-style',
|
||||
'border-left-width', 'border-right', 'border-right-color',
|
||||
'border-right-style', 'border-right-width', 'border-top-color',
|
||||
'border-top-style', 'border-top-width','border-bottom', 'border-collapse',
|
||||
'border-left', 'border-width', 'border-color', 'border-spacing',
|
||||
'border-style', 'border-top', 'border', 'caption-side',
|
||||
'clear', 'clip', 'color', 'content', 'counter-increment', 'counter-reset',
|
||||
'cue-after', 'cue-before', 'cue', 'cursor', 'direction', 'display',
|
||||
'elevation', 'empty-cells', 'float', 'font-family', 'font-size',
|
||||
'font-size-adjust', 'font-stretch', 'font-style', 'font-variant',
|
||||
'font-weight', 'font', 'height', 'letter-spacing', 'line-height',
|
||||
'list-style', 'list-style-image', 'list-style-position', 'list-style-type',
|
||||
'margin-bottom', 'margin-left', 'margin-right', 'margin-top', 'margin',
|
||||
'marker-offset', 'marks', 'max-height', 'max-width', 'min-height',
|
||||
'min-width', 'opacity', 'orphans', 'outline', 'outline-color', 'outline-style',
|
||||
'outline-width', 'overflow', 'padding-bottom', 'padding-left',
|
||||
'padding-right', 'padding-top', 'padding', 'page', 'page-break-after',
|
||||
'page-break-before', 'page-break-inside', 'pause-after', 'pause-before',
|
||||
'pause', 'pitch', 'pitch-range', 'play-during', 'position', 'quotes',
|
||||
'richness', 'right', 'size', 'speak-header', 'speak-numeral', 'speak-punctuation',
|
||||
'speak', 'speech-rate', 'stress', 'table-layout', 'text-align', 'text-decoration',
|
||||
'text-indent', 'text-shadow', 'text-transform', 'top', 'unicode-bidi',
|
||||
'vertical-align', 'visibility', 'voice-family', 'volume', 'white-space', 'widows',
|
||||
'width', 'word-spacing', 'z-index', 'bottom', 'left'
|
||||
]
|
||||
,'values' : [
|
||||
'above', 'absolute', 'always', 'armenian', 'aural', 'auto', 'avoid',
|
||||
'baseline', 'behind', 'below', 'bidi-override', 'black', 'blue', 'blink', 'block', 'bold', 'bolder', 'both',
|
||||
'capitalize', 'center-left', 'center-right', 'center', 'circle', 'cjk-ideographic',
|
||||
'close-quote', 'collapse', 'condensed', 'continuous', 'crop', 'crosshair', 'cross', 'cursive',
|
||||
'dashed', 'decimal-leading-zero', 'decimal', 'default', 'digits', 'disc', 'dotted', 'double',
|
||||
'e-resize', 'embed', 'extra-condensed', 'extra-expanded', 'expanded',
|
||||
'fantasy', 'far-left', 'far-right', 'faster', 'fast', 'fixed', 'fuchsia',
|
||||
'georgian', 'gray', 'green', 'groove', 'hebrew', 'help', 'hidden', 'hide', 'higher',
|
||||
'high', 'hiragana-iroha', 'hiragana', 'icon', 'inherit', 'inline-table', 'inline',
|
||||
'inset', 'inside', 'invert', 'italic', 'justify', 'katakana-iroha', 'katakana',
|
||||
'landscape', 'larger', 'large', 'left-side', 'leftwards', 'level', 'lighter', 'lime', 'line-through', 'list-item', 'loud', 'lower-alpha', 'lower-greek', 'lower-roman', 'lowercase', 'ltr', 'lower', 'low',
|
||||
'maroon', 'medium', 'message-box', 'middle', 'mix', 'monospace',
|
||||
'n-resize', 'narrower', 'navy', 'ne-resize', 'no-close-quote', 'no-open-quote', 'no-repeat', 'none', 'normal', 'nowrap', 'nw-resize',
|
||||
'oblique', 'olive', 'once', 'open-quote', 'outset', 'outside', 'overline',
|
||||
'pointer', 'portrait', 'purple', 'px',
|
||||
'red', 'relative', 'repeat-x', 'repeat-y', 'repeat', 'rgb', 'ridge', 'right-side', 'rightwards',
|
||||
's-resize', 'sans-serif', 'scroll', 'se-resize', 'semi-condensed', 'semi-expanded', 'separate', 'serif', 'show', 'silent', 'silver', 'slow', 'slower', 'small-caps', 'small-caption', 'smaller', 'soft', 'solid', 'spell-out', 'square',
|
||||
'static', 'status-bar', 'super', 'sw-resize',
|
||||
'table-caption', 'table-cell', 'table-column', 'table-column-group', 'table-footer-group', 'table-header-group', 'table-row', 'table-row-group', 'teal', 'text', 'text-bottom', 'text-top', 'thick', 'thin', 'transparent',
|
||||
'ultra-condensed', 'ultra-expanded', 'underline', 'upper-alpha', 'upper-latin', 'upper-roman', 'uppercase', 'url',
|
||||
'visible',
|
||||
'w-resize', 'wait', 'white', 'wider',
|
||||
'x-fast', 'x-high', 'x-large', 'x-loud', 'x-low', 'x-small', 'x-soft', 'xx-large', 'xx-small',
|
||||
'yellow', 'yes'
|
||||
]
|
||||
,'specials' : [
|
||||
'important'
|
||||
]
|
||||
}
|
||||
,'OPERATORS' :[
|
||||
':', ';', '!', '.', '#'
|
||||
]
|
||||
,'DELIMITERS' :[
|
||||
'{', '}'
|
||||
]
|
||||
,'STYLES' : {
|
||||
'COMMENTS': 'color: #AAAAAA;'
|
||||
,'QUOTESMARKS': 'color: #6381F8;'
|
||||
,'KEYWORDS' : {
|
||||
'attributes' : 'color: #48BDDF;'
|
||||
,'values' : 'color: #2B60FF;'
|
||||
,'specials' : 'color: #FF0000;'
|
||||
}
|
||||
,'OPERATORS' : 'color: #FF00FF;'
|
||||
,'DELIMITERS' : 'color: #60CA00;'
|
||||
|
||||
}
|
||||
};
|
||||
@@ -1,50 +0,0 @@
|
||||
/*
|
||||
* last update: 2006-08-24
|
||||
*/
|
||||
|
||||
editAreaLoader.load_syntax["html"] = {
|
||||
'COMMENT_SINGLE' : {}
|
||||
,'COMMENT_MULTI' : {'<!--' : '-->'}
|
||||
,'QUOTEMARKS' : {1: "'", 2: '"'}
|
||||
,'KEYWORD_CASE_SENSITIVE' : false
|
||||
,'KEYWORDS' : {
|
||||
}
|
||||
,'OPERATORS' :[
|
||||
]
|
||||
,'DELIMITERS' :[
|
||||
]
|
||||
,'REGEXPS' : {
|
||||
'doctype' : {
|
||||
'search' : '()(<!DOCTYPE[^>]*>)()'
|
||||
,'class' : 'doctype'
|
||||
,'modifiers' : ''
|
||||
,'execute' : 'before' // before or after
|
||||
}
|
||||
,'tags' : {
|
||||
'search' : '(<)(/?[a-z][^ \r\n\t>]*)([^>]*>)'
|
||||
,'class' : 'tags'
|
||||
,'modifiers' : 'gi'
|
||||
,'execute' : 'before' // before or after
|
||||
}
|
||||
,'attributes' : {
|
||||
'search' : '( |\n|\r|\t)([^ \r\n\t=]+)(=)'
|
||||
,'class' : 'attributes'
|
||||
,'modifiers' : 'g'
|
||||
,'execute' : 'before' // before or after
|
||||
}
|
||||
}
|
||||
,'STYLES' : {
|
||||
'COMMENTS': 'color: #AAAAAA;'
|
||||
,'QUOTESMARKS': 'color: #6381F8;'
|
||||
,'KEYWORDS' : {
|
||||
}
|
||||
,'OPERATORS' : 'color: #E775F0;'
|
||||
,'DELIMITERS' : ''
|
||||
,'REGEXPS' : {
|
||||
'attributes': 'color: #B1AC41;'
|
||||
,'tags': 'color: #E62253;'
|
||||
,'doctype': 'color: #8DCFB5;'
|
||||
,'test': 'color: #00FF00;'
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -1,60 +0,0 @@
|
||||
editAreaLoader.load_syntax["js"] = {
|
||||
'COMMENT_SINGLE' : {1 : '//'}
|
||||
,'COMMENT_MULTI' : {'/*' : '*/'}
|
||||
,'QUOTEMARKS' : {1: "'", 2: '"'}
|
||||
,'KEYWORD_CASE_SENSITIVE' : true
|
||||
,'KEYWORDS' : {
|
||||
'statements' : [
|
||||
'as', 'break', 'case', 'catch', 'continue', 'decodeURI', 'delete', 'do',
|
||||
'else', 'encodeURI', 'eval', 'finally', 'for', 'if', 'in', 'is', 'item',
|
||||
'instanceof', 'return', 'switch', 'this', 'throw', 'try', 'typeof', 'void',
|
||||
'while', 'write', 'with'
|
||||
]
|
||||
,'keywords' : [
|
||||
'class', 'const', 'default', 'debugger', 'export', 'extends', 'false',
|
||||
'function', 'import', 'namespace', 'new', 'null', 'package', 'private',
|
||||
'protected', 'public', 'super', 'true', 'use', 'var', 'window', 'document',
|
||||
// the list below must be sorted and checked (if it is a keywords or a function and if it is not present twice
|
||||
'Link ', 'outerHeight ', 'Anchor', 'FileUpload',
|
||||
'location', 'outerWidth', 'Select', 'Area', 'find', 'Location', 'Packages', 'self',
|
||||
'arguments', 'locationbar', 'pageXoffset', 'Form',
|
||||
'Math', 'pageYoffset', 'setTimeout', 'assign', 'Frame', 'menubar', 'parent', 'status',
|
||||
'blur', 'frames', 'MimeType', 'parseFloat', 'statusbar', 'Boolean', 'Function', 'moveBy',
|
||||
'parseInt', 'stop', 'Button', 'getClass', 'moveTo', 'Password', 'String', 'callee', 'Hidden',
|
||||
'name', 'personalbar', 'Submit', 'caller', 'history', 'NaN', 'Plugin', 'sun', 'captureEvents',
|
||||
'History', 'navigate', 'print', 'taint', 'Checkbox', 'home', 'navigator', 'prompt', 'Text',
|
||||
'Image', 'Navigator', 'prototype', 'Textarea', 'clearTimeout', 'Infinity',
|
||||
'netscape', 'Radio', 'toolbar', 'close', 'innerHeight', 'Number', 'ref', 'top', 'closed',
|
||||
'innerWidth', 'Object', 'RegExp', 'toString', 'confirm', 'isFinite', 'onBlur', 'releaseEvents',
|
||||
'unescape', 'constructor', 'isNan', 'onError', 'Reset', 'untaint', 'Date', 'java', 'onFocus',
|
||||
'resizeBy', 'unwatch', 'defaultStatus', 'JavaArray', 'onLoad', 'resizeTo', 'valueOf', 'document',
|
||||
'JavaClass', 'onUnload', 'routeEvent', 'watch', 'Document', 'JavaObject', 'open', 'scroll', 'window',
|
||||
'Element', 'JavaPackage', 'opener', 'scrollbars', 'Window', 'escape', 'length', 'Option', 'scrollBy'
|
||||
]
|
||||
,'functions' : [
|
||||
// common functions for Window object
|
||||
'alert', 'Array', 'back', 'blur', 'clearInterval', 'close', 'confirm', 'eval ', 'focus', 'forward', 'home',
|
||||
'name', 'navigate', 'onblur', 'onerror', 'onfocus', 'onload', 'onmove',
|
||||
'onresize', 'onunload', 'open', 'print', 'prompt', 'scroll', 'scrollTo', 'setInterval', 'status',
|
||||
'stop'
|
||||
]
|
||||
}
|
||||
,'OPERATORS' :[
|
||||
'+', '-', '/', '*', '=', '<', '>', '%', '!'
|
||||
]
|
||||
,'DELIMITERS' :[
|
||||
'(', ')', '[', ']', '{', '}'
|
||||
]
|
||||
,'STYLES' : {
|
||||
'COMMENTS': 'color: #AAAAAA;'
|
||||
,'QUOTESMARKS': 'color: #6381F8;'
|
||||
,'KEYWORDS' : {
|
||||
'statements' : 'color: #60CA00;'
|
||||
,'keywords' : 'color: #48BDDF;'
|
||||
,'functions' : 'color: #2B60FF;'
|
||||
}
|
||||
,'OPERATORS' : 'color: #FF00FF;'
|
||||
,'DELIMITERS' : 'color: #0038E1;'
|
||||
|
||||
}
|
||||
};
|
||||
@@ -1,82 +0,0 @@
|
||||
editAreaLoader.load_syntax["pas"] = {
|
||||
'COMMENT_SINGLE' : {}
|
||||
,'COMMENT_MULTI' : {'{' : '}', '(*':'*)'}
|
||||
,'QUOTEMARKS' : {1: '"', 2: "'"}
|
||||
,'KEYWORD_CASE_SENSITIVE' : false
|
||||
,'KEYWORDS' : {
|
||||
'constants' : [
|
||||
'Blink', 'Black', 'Blue', 'Green', 'Cyan', 'Red',
|
||||
'Magenta', 'Brown', 'LightGray', 'DarkGray',
|
||||
'LightBlue', 'LightGreen', 'LightCyan', 'LightRed',
|
||||
'LightMagenta', 'Yellow', 'White', 'MaxSIntValue',
|
||||
'MaxUIntValue', 'maxint', 'maxLongint', 'maxSmallint',
|
||||
'erroraddr', 'errorcode', 'LineEnding'
|
||||
]
|
||||
,'keywords' : [
|
||||
'in', 'or', 'div', 'mod', 'and', 'shl', 'shr', 'xor',
|
||||
'pow', 'is', 'not','Absolute', 'And_then', 'Array',
|
||||
'Begin', 'Bindable', 'Case', 'Const', 'Do', 'Downto',
|
||||
'Else', 'End', 'Export', 'File', 'For', 'Function',
|
||||
'Goto', 'If', 'Import', 'Implementation', 'Inherited',
|
||||
'Inline', 'Interface', 'Label', 'Module', 'Nil',
|
||||
'Object', 'Of', 'Only', 'Operator', 'Or_else',
|
||||
'Otherwise', 'Packed', 'Procedure', 'Program',
|
||||
'Protected', 'Qualified', 'Record', 'Repeat',
|
||||
'Restricted', 'Set', 'Then', 'To', 'Type', 'Unit',
|
||||
'Until', 'Uses', 'Value', 'Var', 'Virtual', 'While',
|
||||
'With'
|
||||
]
|
||||
,'functions' : [
|
||||
'Abs', 'Addr', 'Append', 'Arctan', 'Assert', 'Assign',
|
||||
'Assigned', 'BinStr', 'Blockread', 'Blockwrite',
|
||||
'Break', 'Chdir', 'Chr', 'Close', 'CompareByte',
|
||||
'CompareChar', 'CompareDWord', 'CompareWord', 'Concat',
|
||||
'Continue', 'Copy', 'Cos', 'CSeg', 'Dec', 'Delete',
|
||||
'Dispose', 'DSeg', 'Eof', 'Eoln', 'Erase', 'Exclude',
|
||||
'Exit', 'Exp', 'Filepos', 'Filesize', 'FillByte',
|
||||
'Fillchar', 'FillDWord', 'Fillword', 'Flush', 'Frac',
|
||||
'Freemem', 'Getdir', 'Getmem', 'GetMemoryManager',
|
||||
'Halt', 'HexStr', 'Hi', 'High', 'Inc', 'Include',
|
||||
'IndexByte', 'IndexChar', 'IndexDWord', 'IndexWord',
|
||||
'Insert', 'IsMemoryManagerSet', 'Int', 'IOresult',
|
||||
'Length', 'Ln', 'Lo', 'LongJmp', 'Low', 'Lowercase',
|
||||
'Mark', 'Maxavail', 'Memavail', 'Mkdir', 'Move',
|
||||
'MoveChar0', 'New', 'Odd', 'OctStr', 'Ofs', 'Ord',
|
||||
'Paramcount', 'Paramstr', 'Pi', 'Pos', 'Power', 'Pred',
|
||||
'Ptr', 'Random', 'Randomize', 'Read', 'Readln',
|
||||
'Real2Double', 'Release', 'Rename', 'Reset', 'Rewrite',
|
||||
'Rmdir', 'Round', 'Runerror', 'Seek', 'SeekEof',
|
||||
'SeekEoln', 'Seg', 'SetMemoryManager', 'SetJmp',
|
||||
'SetLength', 'SetString', 'SetTextBuf', 'Sin', 'SizeOf',
|
||||
'Sptr', 'Sqr', 'Sqrt', 'SSeg', 'Str', 'StringOfChar',
|
||||
'Succ', 'Swap', 'Trunc', 'Truncate', 'Upcase', 'Val',
|
||||
'Write', 'WriteLn'
|
||||
]
|
||||
,'types' : [
|
||||
'Integer', 'Shortint', 'SmallInt', 'Longint',
|
||||
'Longword', 'Int64', 'Byte', 'Word', 'Cardinal',
|
||||
'QWord', 'Boolean', 'ByteBool', 'LongBool', 'Char',
|
||||
'Real', 'Single', 'Double', 'Extended', 'Comp',
|
||||
'String', 'ShortString', 'AnsiString', 'PChar'
|
||||
]
|
||||
}
|
||||
,'OPERATORS' :[
|
||||
'@', '*', '+', '-', '/', '^', ':=', '<', '=', '>'
|
||||
]
|
||||
,'DELIMITERS' :[
|
||||
'(', ')', '[', ']'
|
||||
]
|
||||
,'STYLES' : {
|
||||
'COMMENTS': 'color: #AAAAAA;'
|
||||
,'QUOTESMARKS': 'color: #6381F8;'
|
||||
,'KEYWORDS' : {
|
||||
'specials' : 'color: #EE0000;'
|
||||
,'constants' : 'color: #654321;'
|
||||
,'keywords' : 'color: #48BDDF;'
|
||||
,'functions' : 'color: #449922;'
|
||||
,'types' : 'color: #2B60FF;'
|
||||
}
|
||||
,'OPERATORS' : 'color: #FF00FF;'
|
||||
,'DELIMITERS' : 'color: #60CA00;'
|
||||
}
|
||||
};
|
||||
@@ -1,75 +0,0 @@
|
||||
editAreaLoader.load_syntax["php"] = {
|
||||
'COMMENT_SINGLE' : {1 : '//', 2 : '#'}
|
||||
,'COMMENT_MULTI' : {'/*' : '*/'}
|
||||
,'QUOTEMARKS' : {1: "'", 2: '"'}
|
||||
,'KEYWORD_CASE_SENSITIVE' : false
|
||||
,'KEYWORDS' : {
|
||||
'statements' : [
|
||||
'include', 'require', 'include_once', 'require_once',
|
||||
'for', 'foreach', 'as', 'if', 'elseif', 'else', 'while', 'do', 'endwhile',
|
||||
'endif', 'switch', 'case', 'endswitch',
|
||||
'return', 'break', 'continue'
|
||||
]
|
||||
,'reserved' : [
|
||||
'_GET', '_POST', '_SERVER', '_FILES', '_ENV', '_COOKIE', '_REQUEST',
|
||||
'null', '__LINE__', '__FILE__',
|
||||
'false', '<?php', '?>', '<?',
|
||||
'<script language', '</script>',
|
||||
'true', 'var', 'default',
|
||||
'function', 'class', 'new', '&new', 'this',
|
||||
'__FUNCTION__', '__CLASS__', '__METHOD__', 'PHP_VERSION',
|
||||
'PHP_OS', 'DEFAULT_INCLUDE_PATH', 'PEAR_INSTALL_DIR', 'PEAR_EXTENSION_DIR',
|
||||
'PHP_EXTENSION_DIR', 'PHP_BINDIR', 'PHP_LIBDIR', 'PHP_DATADIR', 'PHP_SYSCONFDIR',
|
||||
'PHP_LOCALSTATEDIR', 'PHP_CONFIG_FILE_PATH', 'PHP_OUTPUT_HANDLER_START', 'PHP_OUTPUT_HANDLER_CONT',
|
||||
'PHP_OUTPUT_HANDLER_END', 'E_ERROR', 'E_WARNING', 'E_PARSE', 'E_NOTICE',
|
||||
'E_CORE_ERROR', 'E_CORE_WARNING', 'E_COMPILE_ERROR', 'E_COMPILE_WARNING', 'E_USER_ERROR',
|
||||
'E_USER_WARNING', 'E_USER_NOTICE', 'E_ALL'
|
||||
|
||||
]
|
||||
,'functions' : [
|
||||
'func_num_args', 'func_get_arg', 'func_get_args', 'strlen', 'strcmp', 'strncmp', 'strcasecmp', 'strncasecmp', 'each', 'error_reporting', 'define', 'defined',
|
||||
'trigger_error', 'user_error', 'set_error_handler', 'restore_error_handler', 'get_declared_classes', 'get_loaded_extensions',
|
||||
'extension_loaded', 'get_extension_funcs', 'debug_backtrace',
|
||||
'constant', 'bin2hex', 'sleep', 'usleep', 'time', 'mktime', 'gmmktime', 'strftime', 'gmstrftime', 'strtotime', 'date', 'gmdate', 'getdate', 'localtime', 'checkdate', 'flush', 'wordwrap', 'htmlspecialchars', 'htmlentities', 'html_entity_decode', 'md5', 'md5_file', 'crc32', 'getimagesize', 'image_type_to_mime_type', 'phpinfo', 'phpversion', 'phpcredits', 'strnatcmp', 'strnatcasecmp', 'substr_count', 'strspn', 'strcspn', 'strtok', 'strtoupper', 'strtolower', 'strpos', 'strrpos', 'strrev', 'hebrev', 'hebrevc', 'nl2br', 'basename', 'dirname', 'pathinfo', 'stripslashes', 'stripcslashes', 'strstr', 'stristr', 'strrchr', 'str_shuffle', 'str_word_count', 'strcoll', 'substr', 'substr_replace', 'quotemeta', 'ucfirst', 'ucwords', 'strtr', 'addslashes', 'addcslashes', 'rtrim', 'str_replace', 'str_repeat', 'count_chars', 'chunk_split', 'trim', 'ltrim', 'strip_tags', 'similar_text', 'explode', 'implode', 'setlocale', 'localeconv',
|
||||
'parse_str', 'str_pad', 'chop', 'strchr', 'sprintf', 'printf', 'vprintf', 'vsprintf', 'sscanf', 'fscanf', 'parse_url', 'urlencode', 'urldecode', 'rawurlencode', 'rawurldecode', 'readlink', 'linkinfo', 'link', 'unlink', 'exec', 'system', 'escapeshellcmd', 'escapeshellarg', 'passthru', 'shell_exec', 'proc_open', 'proc_close', 'rand', 'srand', 'getrandmax', 'mt_rand', 'mt_srand', 'mt_getrandmax', 'base64_decode', 'base64_encode', 'abs', 'ceil', 'floor', 'round', 'is_finite', 'is_nan', 'is_infinite', 'bindec', 'hexdec', 'octdec', 'decbin', 'decoct', 'dechex', 'base_convert', 'number_format', 'fmod', 'ip2long', 'long2ip', 'getenv', 'putenv', 'getopt', 'microtime', 'gettimeofday', 'getrusage', 'uniqid', 'quoted_printable_decode', 'set_time_limit', 'get_cfg_var', 'magic_quotes_runtime', 'set_magic_quotes_runtime', 'get_magic_quotes_gpc', 'get_magic_quotes_runtime',
|
||||
'import_request_variables', 'error_log', 'serialize', 'unserialize', 'memory_get_usage', 'var_dump', 'var_export', 'debug_zval_dump', 'print_r','highlight_file', 'show_source', 'highlight_string', 'ini_get', 'ini_get_all', 'ini_set', 'ini_alter', 'ini_restore', 'get_include_path', 'set_include_path', 'restore_include_path', 'setcookie', 'header', 'headers_sent', 'connection_aborted', 'connection_status', 'ignore_user_abort', 'parse_ini_file', 'is_uploaded_file', 'move_uploaded_file', 'intval', 'floatval', 'doubleval', 'strval', 'gettype', 'settype', 'is_null', 'is_resource', 'is_bool', 'is_long', 'is_float', 'is_int', 'is_integer', 'is_double', 'is_real', 'is_numeric', 'is_string', 'is_array', 'is_object', 'is_scalar',
|
||||
'ereg', 'ereg_replace', 'eregi', 'eregi_replace', 'split', 'spliti', 'join', 'sql_regcase', 'dl', 'pclose', 'popen', 'readfile', 'rewind', 'rmdir', 'umask', 'fclose', 'feof', 'fgetc', 'fgets', 'fgetss', 'fread', 'fopen', 'fpassthru', 'ftruncate', 'fstat', 'fseek', 'ftell', 'fflush', 'fwrite', 'fputs', 'mkdir', 'rename', 'copy', 'tempnam', 'tmpfile', 'file', 'file_get_contents', 'stream_select', 'stream_context_create', 'stream_context_set_params', 'stream_context_set_option', 'stream_context_get_options', 'stream_filter_prepend', 'stream_filter_append', 'fgetcsv', 'flock', 'get_meta_tags', 'stream_set_write_buffer', 'set_file_buffer', 'set_socket_blocking', 'stream_set_blocking', 'socket_set_blocking', 'stream_get_meta_data', 'stream_register_wrapper', 'stream_wrapper_register', 'stream_set_timeout', 'socket_set_timeout', 'socket_get_status', 'realpath', 'fnmatch', 'fsockopen', 'pfsockopen', 'pack', 'unpack', 'get_browser', 'crypt', 'opendir', 'closedir', 'chdir', 'getcwd', 'rewinddir', 'readdir', 'dir', 'glob', 'fileatime', 'filectime', 'filegroup', 'fileinode', 'filemtime', 'fileowner', 'fileperms', 'filesize', 'filetype', 'file_exists', 'is_writable', 'is_writeable', 'is_readable', 'is_executable', 'is_file', 'is_dir', 'is_link', 'stat', 'lstat', 'chown',
|
||||
'touch', 'clearstatcache', 'mail', 'ob_start', 'ob_flush', 'ob_clean', 'ob_end_flush', 'ob_end_clean', 'ob_get_flush', 'ob_get_clean', 'ob_get_length', 'ob_get_level', 'ob_get_status', 'ob_get_contents', 'ob_implicit_flush', 'ob_list_handlers', 'ksort', 'krsort', 'natsort', 'natcasesort', 'asort', 'arsort', 'sort', 'rsort', 'usort', 'uasort', 'uksort', 'shuffle', 'array_walk', 'count', 'end', 'prev', 'next', 'reset', 'current', 'key', 'min', 'max', 'in_array', 'array_search', 'extract', 'compact', 'array_fill', 'range', 'array_multisort', 'array_push', 'array_pop', 'array_shift', 'array_unshift', 'array_splice', 'array_slice', 'array_merge', 'array_merge_recursive', 'array_keys', 'array_values', 'array_count_values', 'array_reverse', 'array_reduce', 'array_pad', 'array_flip', 'array_change_key_case', 'array_rand', 'array_unique', 'array_intersect', 'array_intersect_assoc', 'array_diff', 'array_diff_assoc', 'array_sum', 'array_filter', 'array_map', 'array_chunk', 'array_key_exists', 'pos', 'sizeof', 'key_exists', 'assert', 'assert_options', 'version_compare', 'ftok', 'str_rot13', 'aggregate',
|
||||
'session_name', 'session_module_name', 'session_save_path', 'session_id', 'session_regenerate_id', 'session_decode', 'session_register', 'session_unregister', 'session_is_registered', 'session_encode',
|
||||
'session_start', 'session_destroy', 'session_unset', 'session_set_save_handler', 'session_cache_limiter', 'session_cache_expire', 'session_set_cookie_params', 'session_get_cookie_params', 'session_write_close', 'preg_match', 'preg_match_all', 'preg_replace', 'preg_replace_callback', 'preg_split', 'preg_quote', 'preg_grep', 'overload', 'ctype_alnum', 'ctype_alpha', 'ctype_cntrl', 'ctype_digit', 'ctype_lower', 'ctype_graph', 'ctype_print', 'ctype_punct', 'ctype_space', 'ctype_upper', 'ctype_xdigit', 'virtual', 'apache_request_headers', 'apache_note', 'apache_lookup_uri', 'apache_child_terminate', 'apache_setenv', 'apache_response_headers', 'apache_get_version', 'getallheaders', 'mysql_connect', 'mysql_pconnect', 'mysql_close', 'mysql_select_db', 'mysql_create_db', 'mysql_drop_db', 'mysql_query', 'mysql_unbuffered_query', 'mysql_db_query', 'mysql_list_dbs', 'mysql_list_tables', 'mysql_list_fields', 'mysql_list_processes', 'mysql_error', 'mysql_errno', 'mysql_affected_rows', 'mysql_insert_id', 'mysql_result', 'mysql_num_rows', 'mysql_num_fields', 'mysql_fetch_row', 'mysql_fetch_array', 'mysql_fetch_assoc', 'mysql_fetch_object', 'mysql_data_seek', 'mysql_fetch_lengths', 'mysql_fetch_field', 'mysql_field_seek', 'mysql_free_result', 'mysql_field_name', 'mysql_field_table', 'mysql_field_len', 'mysql_field_type', 'mysql_field_flags', 'mysql_escape_string', 'mysql_real_escape_string', 'mysql_stat',
|
||||
'mysql_thread_id', 'mysql_client_encoding', 'mysql_get_client_info', 'mysql_get_host_info', 'mysql_get_proto_info', 'mysql_get_server_info', 'mysql_info', 'mysql', 'mysql_fieldname', 'mysql_fieldtable', 'mysql_fieldlen', 'mysql_fieldtype', 'mysql_fieldflags', 'mysql_selectdb', 'mysql_createdb', 'mysql_dropdb', 'mysql_freeresult', 'mysql_numfields', 'mysql_numrows', 'mysql_listdbs', 'mysql_listtables', 'mysql_listfields', 'mysql_db_name', 'mysql_dbname', 'mysql_tablename', 'mysql_table_name', 'pg_connect', 'pg_pconnect', 'pg_close', 'pg_connection_status', 'pg_connection_busy', 'pg_connection_reset', 'pg_host', 'pg_dbname', 'pg_port', 'pg_tty', 'pg_options', 'pg_ping', 'pg_query', 'pg_send_query', 'pg_cancel_query', 'pg_fetch_result', 'pg_fetch_row', 'pg_fetch_assoc', 'pg_fetch_array', 'pg_fetch_object', 'pg_fetch_all', 'pg_affected_rows', 'pg_get_result', 'pg_result_seek', 'pg_result_status', 'pg_free_result', 'pg_last_oid', 'pg_num_rows', 'pg_num_fields', 'pg_field_name', 'pg_field_num', 'pg_field_size', 'pg_field_type', 'pg_field_prtlen', 'pg_field_is_null', 'pg_get_notify', 'pg_get_pid', 'pg_result_error', 'pg_last_error', 'pg_last_notice', 'pg_put_line', 'pg_end_copy', 'pg_copy_to', 'pg_copy_from',
|
||||
'pg_trace', 'pg_untrace', 'pg_lo_create', 'pg_lo_unlink', 'pg_lo_open', 'pg_lo_close', 'pg_lo_read', 'pg_lo_write', 'pg_lo_read_all', 'pg_lo_import', 'pg_lo_export', 'pg_lo_seek', 'pg_lo_tell', 'pg_escape_string', 'pg_escape_bytea', 'pg_unescape_bytea', 'pg_client_encoding', 'pg_set_client_encoding', 'pg_meta_data', 'pg_convert', 'pg_insert', 'pg_update', 'pg_delete', 'pg_select', 'pg_exec', 'pg_getlastoid', 'pg_cmdtuples', 'pg_errormessage', 'pg_numrows', 'pg_numfields', 'pg_fieldname', 'pg_fieldsize', 'pg_fieldtype', 'pg_fieldnum', 'pg_fieldprtlen', 'pg_fieldisnull', 'pg_freeresult', 'pg_result', 'pg_loreadall', 'pg_locreate', 'pg_lounlink', 'pg_loopen', 'pg_loclose', 'pg_loread', 'pg_lowrite', 'pg_loimport', 'pg_loexport',
|
||||
'echo', 'print', 'global', 'static', 'exit', 'array', 'empty', 'eval', 'isset', 'unset', 'die'
|
||||
|
||||
]
|
||||
}
|
||||
,'OPERATORS' :[
|
||||
'+', '-', '/', '*', '=', '<', '>', '%', '!', '&&', '||'
|
||||
]
|
||||
,'DELIMITERS' :[
|
||||
'(', ')', '[', ']', '{', '}'
|
||||
]
|
||||
,'REGEXPS' : {
|
||||
// highlight all variables ($...)
|
||||
'variables' : {
|
||||
'search' : '()(\\$\\w+)()'
|
||||
,'class' : 'variables'
|
||||
,'modifiers' : 'g'
|
||||
,'execute' : 'before' // before or after
|
||||
}
|
||||
}
|
||||
,'STYLES' : {
|
||||
'COMMENTS': 'color: #AAAAAA;'
|
||||
,'QUOTESMARKS': 'color: #879EFA;'
|
||||
,'KEYWORDS' : {
|
||||
'reserved' : 'color: #48BDDF;'
|
||||
,'functions' : 'color: #0040FD;'
|
||||
,'statements' : 'color: #60CA00;'
|
||||
}
|
||||
,'OPERATORS' : 'color: #FF00FF;'
|
||||
,'DELIMITERS' : 'color: #2B60FF;'
|
||||
,'REGEXPS' : {
|
||||
'variables' : 'color: #E0BD54;'
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -1,144 +0,0 @@
|
||||
/**
|
||||
* Python syntax v 1.1
|
||||
*
|
||||
* v1.1 by Andre Roberge (2006/12/27)
|
||||
*
|
||||
**/
|
||||
editAreaLoader.load_syntax["python"] = {
|
||||
'COMMENT_SINGLE' : {1 : '#'}
|
||||
,'COMMENT_MULTI' : {}
|
||||
,'QUOTEMARKS' : {1: "'", 2: '"'}
|
||||
,'KEYWORD_CASE_SENSITIVE' : true
|
||||
,'KEYWORDS' : {
|
||||
/*
|
||||
** Set 1: reserved words
|
||||
** http://python.org/doc/current/ref/keywords.html
|
||||
** Note: 'as' and 'with' have been added starting with Python 2.5
|
||||
*/
|
||||
'reserved' : [
|
||||
'and', 'as', 'assert', 'break', 'class', 'continue', 'def', 'del', 'elif',
|
||||
'else', 'except', 'exec', 'finally', 'for', 'from', 'global', 'if',
|
||||
'import', 'is', 'in', 'lambda', 'not', 'or', 'pass', 'print', 'raise',
|
||||
'return', 'try', 'while', 'with', 'yield'
|
||||
//the following are *almost* reserved; we'll treat them as such
|
||||
, 'False', 'True', 'None'
|
||||
]
|
||||
/*
|
||||
** Set 2: builtins
|
||||
** http://python.org/doc/current/lib/built-in-funcs.html
|
||||
*/
|
||||
,'builtins' : [
|
||||
'__import__', 'abs', 'basestring', 'bool', 'callable', 'chr', 'classmethod', 'cmp',
|
||||
'compile', 'complex', 'delattr', 'dict', 'dir', 'divmod', 'enumerate', 'eval', 'execfile',
|
||||
'file', 'filter', 'float', 'frozenset', 'getattr', 'globals', 'hasattr', 'hash', 'help',
|
||||
'hex', 'id', 'input', 'int', 'isinstance', 'issubclass', 'iter', 'len', 'list', 'locals',
|
||||
'long', 'map', 'max', 'min', 'object', 'oct', 'open', 'ord', 'pow', 'property', 'range',
|
||||
'raw_input', 'reduce', 'reload', 'repr', 'reversed', 'round', 'set', 'setattr', 'slice',
|
||||
'sorted', 'staticmethod', 'str', 'sum', 'super', 'tuple', 'type', 'unichr', 'unicode',
|
||||
'vars', 'xrange', 'zip',
|
||||
// Built-in constants: http://www.python.org/doc/2.4.1/lib/node35.html
|
||||
//'False', 'True', 'None' have been included in 'reserved'
|
||||
'NotImplemented', 'Ellipsis',
|
||||
// Built-in Exceptions: http://python.org/doc/current/lib/module-exceptions.html
|
||||
'Exception', 'StandardError', 'ArithmeticError', 'LookupError', 'EnvironmentError',
|
||||
'AssertionError', 'AttributeError', 'EOFError', 'FloatingPointError', 'IOError',
|
||||
'ImportError', 'IndexError', 'KeyError', 'KeyboardInterrupt', 'MemoryError', 'NameError',
|
||||
'NotImplementedError', 'OSError', 'OverflowError', 'ReferenceError', 'RuntimeError',
|
||||
'StopIteration', 'SyntaxError', 'SystemError', 'SystemExit', 'TypeError',
|
||||
'UnboundlocalError', 'UnicodeError', 'UnicodeEncodeError', 'UnicodeDecodeError',
|
||||
'UnicodeTranslateError', 'ValueError', 'WindowsError', 'ZeroDivisionError', 'Warning',
|
||||
'UserWarning', 'DeprecationWarning', 'PendingDeprecationWarning', 'SyntaxWarning',
|
||||
'RuntimeWarning', 'FutureWarning',
|
||||
// we will include the string methods as well
|
||||
// http://python.org/doc/current/lib/string-methods.html
|
||||
'capitalize', 'center', 'count', 'decode', 'encode', 'endswith', 'expandtabs',
|
||||
'find', 'index', 'isalnum', 'isaplpha', 'isdigit', 'islower', 'isspace', 'istitle',
|
||||
'isupper', 'join', 'ljust', 'lower', 'lstrip', 'replace', 'rfind', 'rindex', 'rjust',
|
||||
'rsplit', 'rstrip', 'split', 'splitlines', 'startswith', 'strip', 'swapcase', 'title',
|
||||
'translate', 'upper', 'zfill'
|
||||
]
|
||||
/*
|
||||
** Set 3: standard library
|
||||
** http://python.org/doc/current/lib/modindex.html
|
||||
*/
|
||||
,'stdlib' : [
|
||||
'__builtin__', '__future__', '__main__', '_winreg', 'aifc', 'AL', 'al', 'anydbm',
|
||||
'array', 'asynchat', 'asyncore', 'atexit', 'audioop', 'base64', 'BaseHTTPServer',
|
||||
'Bastion', 'binascii', 'binhex', 'bisect', 'bsddb', 'bz2', 'calendar', 'cd', 'cgi',
|
||||
'CGIHTTPServer', 'cgitb', 'chunk', 'cmath', 'cmd', 'code', 'codecs', 'codeop',
|
||||
'collections', 'colorsys', 'commands', 'compileall', 'compiler', 'compiler',
|
||||
'ConfigParser', 'Cookie', 'cookielib', 'copy', 'copy_reg', 'cPickle', 'crypt',
|
||||
'cStringIO', 'csv', 'curses', 'datetime', 'dbhash', 'dbm', 'decimal', 'DEVICE',
|
||||
'difflib', 'dircache', 'dis', 'distutils', 'dl', 'doctest', 'DocXMLRPCServer', 'dumbdbm',
|
||||
'dummy_thread', 'dummy_threading', 'email', 'encodings', 'errno', 'exceptions', 'fcntl',
|
||||
'filecmp', 'fileinput', 'FL', 'fl', 'flp', 'fm', 'fnmatch', 'formatter', 'fpectl',
|
||||
'fpformat', 'ftplib', 'gc', 'gdbm', 'getopt', 'getpass', 'gettext', 'GL', 'gl', 'glob',
|
||||
'gopherlib', 'grp', 'gzip', 'heapq', 'hmac', 'hotshot', 'htmlentitydefs', 'htmllib',
|
||||
'HTMLParser', 'httplib', 'imageop', 'imaplib', 'imgfile', 'imghdr', 'imp', 'inspect',
|
||||
'itertools', 'jpeg', 'keyword', 'linecache', 'locale', 'logging', 'mailbox', 'mailcap',
|
||||
'marshal', 'math', 'md5', 'mhlib', 'mimetools', 'mimetypes', 'MimeWriter', 'mimify',
|
||||
'mmap', 'msvcrt', 'multifile', 'mutex', 'netrc', 'new', 'nis', 'nntplib', 'operator',
|
||||
'optparse', 'os', 'ossaudiodev', 'parser', 'pdb', 'pickle', 'pickletools', 'pipes',
|
||||
'pkgutil', 'platform', 'popen2', 'poplib', 'posix', 'posixfile', 'pprint', 'profile',
|
||||
'pstats', 'pty', 'pwd', 'py_compile', 'pyclbr', 'pydoc', 'Queue', 'quopri', 'random',
|
||||
're', 'readline', 'repr', 'resource', 'rexec', 'rfc822', 'rgbimg', 'rlcompleter',
|
||||
'robotparser', 'sched', 'ScrolledText', 'select', 'sets', 'sgmllib', 'sha', 'shelve',
|
||||
'shlex', 'shutil', 'signal', 'SimpleHTTPServer', 'SimpleXMLRPCServer', 'site', 'smtpd',
|
||||
'smtplib', 'sndhdr', 'socket', 'SocketServer', 'stat', 'statcache', 'statvfs', 'string',
|
||||
'StringIO', 'stringprep', 'struct', 'subprocess', 'sunau', 'SUNAUDIODEV', 'sunaudiodev',
|
||||
'symbol', 'sys', 'syslog', 'tabnanny', 'tarfile', 'telnetlib', 'tempfile', 'termios',
|
||||
'test', 'textwrap', 'thread', 'threading', 'time', 'timeit', 'Tix', 'Tkinter', 'token',
|
||||
'tokenize', 'traceback', 'tty', 'turtle', 'types', 'unicodedata', 'unittest', 'urllib2',
|
||||
'urllib', 'urlparse', 'user', 'UserDict', 'UserList', 'UserString', 'uu', 'warnings',
|
||||
'wave', 'weakref', 'webbrowser', 'whichdb', 'whrandom', 'winsound', 'xdrlib', 'xml',
|
||||
'xmllib', 'xmlrpclib', 'zipfile', 'zipimport', 'zlib'
|
||||
|
||||
]
|
||||
/*
|
||||
** Set 4: special methods
|
||||
** http://python.org/doc/current/ref/specialnames.html
|
||||
*/
|
||||
,'special' : [
|
||||
// Basic customization: http://python.org/doc/current/ref/customization.html
|
||||
'__new__', '__init__', '__del__', '__repr__', '__str__',
|
||||
'__lt__', '__le__', '__eq__', '__ne__', '__gt__', '__ge__', '__cmp__', '__rcmp__',
|
||||
'__hash__', '__nonzero__', '__unicode__', '__dict__',
|
||||
// Attribute access: http://python.org/doc/current/ref/attribute-access.html
|
||||
'__setattr__', '__delattr__', '__getattr__', '__getattribute__', '__get__', '__set__',
|
||||
'__delete__', '__slots__',
|
||||
// Class creation, callable objects
|
||||
'__metaclass__', '__call__',
|
||||
// Container types: http://python.org/doc/current/ref/sequence-types.html
|
||||
'__len__', '__getitem__', '__setitem__', '__delitem__', '__iter__', '__contains__',
|
||||
'__getslice__', '__setslice__', '__delslice__',
|
||||
// Numeric types: http://python.org/doc/current/ref/numeric-types.html
|
||||
'__abs__','__add__','__and__','__coerce__','__div__','__divmod__','__float__',
|
||||
'__hex__','__iadd__','__isub__','__imod__','__idiv__','__ipow__','__iand__',
|
||||
'__ior__','__ixor__', '__ilshift__','__irshift__','__invert__','__int__',
|
||||
'__long__','__lshift__',
|
||||
'__mod__','__mul__','__neg__','__oct__','__or__','__pos__','__pow__',
|
||||
'__radd__','__rdiv__','__rdivmod__','__rmod__','__rpow__','__rlshift__','__rrshift__',
|
||||
'__rshift__','__rsub__','__rmul__','__repr__','__rand__','__rxor__','__ror__',
|
||||
'__sub__','__xor__'
|
||||
]
|
||||
}
|
||||
,'OPERATORS' :[
|
||||
'+', '-', '/', '*', '=', '<', '>', '%', '!', '&', ';', '?', '`', ':', ','
|
||||
]
|
||||
,'DELIMITERS' :[
|
||||
'(', ')', '[', ']', '{', '}'
|
||||
]
|
||||
,'STYLES' : {
|
||||
'COMMENTS': 'color: #AAAAAA;'
|
||||
,'QUOTESMARKS': 'color: #660066;'
|
||||
,'KEYWORDS' : {
|
||||
'reserved' : 'color: #0000FF;'
|
||||
,'builtins' : 'color: #009900;'
|
||||
,'stdlib' : 'color: #009900;'
|
||||
,'special': 'color: #006666;'
|
||||
}
|
||||
,'OPERATORS' : 'color: #993300;'
|
||||
,'DELIMITERS' : 'color: #993300;'
|
||||
|
||||
}
|
||||
};
|
||||
@@ -1,52 +0,0 @@
|
||||
editAreaLoader.load_syntax["vb"] = {
|
||||
'COMMENT_SINGLE' : {1 : "'"}
|
||||
,'COMMENT_MULTI' : { }
|
||||
,'QUOTEMARKS' : {1: '"'}
|
||||
,'KEYWORD_CASE_SENSITIVE' : false
|
||||
,'KEYWORDS' : {
|
||||
'statements' : [
|
||||
'if','then','for','each','while','do','loop',
|
||||
'else','elseif','select','case','end select',
|
||||
'until','next','step','to','in','end if'
|
||||
]
|
||||
,'keywords' : [
|
||||
'empty','isempty','nothing','null','isnull','true','false',
|
||||
'set','call',
|
||||
'sub','end sub','function','end function','exit','exit function',
|
||||
'dim','Mod','In','private','public','shared','const'
|
||||
]
|
||||
|
||||
,'functions' : [
|
||||
'CDate','Date','DateAdd','DateDiff','DatePart','DateSerial','DateValue','Day','FormatDateTime',
|
||||
'Hour','IsDate','Minute','Month',
|
||||
'MonthName','Now','Second','Time','Timer','TimeSerial','TimeValue','Weekday','WeekdayName ','Year',
|
||||
'Asc','CBool','CByte','CCur','CDate','CDbl','Chr','CInt','CLng','CSng','CStr','Hex','Oct','FormatCurrency',
|
||||
'FormatDateTime','FormatNumber','FormatPercent','Abs','Atn','Cos','Exp','Hex','Int','Fix','Log','Oct',
|
||||
'Rnd','Sgn','Sin','Sqr','Tan',
|
||||
'Array','Filter','IsArray','Join','LBound','Split','UBound',
|
||||
'InStr','InStrRev','LCase','Left','Len','LTrim','RTrim','Trim','Mid','Replace','Right','Space','StrComp',
|
||||
'String','StrReverse','UCase',
|
||||
'CreateObject','Eval','GetLocale','GetObject','GetRef','InputBox','IsEmpty','IsNull','IsNumeric',
|
||||
'IsObject','LoadPicture','MsgBox','RGB','Round','ScriptEngine','ScriptEngineBuildVersion','ScriptEngineMajorVersion',
|
||||
'ScriptEngineMinorVersion','SetLocale','TypeName','VarType'
|
||||
]
|
||||
}
|
||||
,'OPERATORS' :[
|
||||
'+', '-', '/', '*', '=', '<', '>', '!', '&'
|
||||
]
|
||||
,'DELIMITERS' :[
|
||||
'(', ')', '[', ']', '{', '}'
|
||||
]
|
||||
,'STYLES' : {
|
||||
'COMMENTS': 'color: #99CC00;'
|
||||
,'QUOTESMARKS': 'color: #333399;'
|
||||
,'KEYWORDS' : {
|
||||
'keywords' : 'color: #3366FF;'
|
||||
,'functions' : 'color: #0000FF;'
|
||||
,'statements' : 'color: #3366FF;'
|
||||
}
|
||||
,'OPERATORS' : 'color: #FF0000;'
|
||||
,'DELIMITERS' : 'color: #0000FF;'
|
||||
|
||||
}
|
||||
};
|
||||
@@ -1,56 +0,0 @@
|
||||
/*
|
||||
* last update: 2006-08-24
|
||||
*/
|
||||
|
||||
editAreaLoader.load_syntax["xml"] = {
|
||||
'COMMENT_SINGLE' : {}
|
||||
,'COMMENT_MULTI' : {'<!--' : '-->'}
|
||||
,'QUOTEMARKS' : {1: "'", 2: '"'}
|
||||
,'KEYWORD_CASE_SENSITIVE' : false
|
||||
,'KEYWORDS' : {
|
||||
}
|
||||
,'OPERATORS' :[
|
||||
]
|
||||
,'DELIMITERS' :[
|
||||
]
|
||||
,'REGEXPS' : {
|
||||
'xml' : {
|
||||
'search' : '()(<\\?[^>]*?\\?>)()'
|
||||
,'class' : 'xml'
|
||||
,'modifiers' : 'g'
|
||||
,'execute' : 'before' // before or after
|
||||
}
|
||||
,'cdatas' : {
|
||||
'search' : '()(<!\\[CDATA\\[.*?\\]\\]>)()'
|
||||
,'class' : 'cdata'
|
||||
,'modifiers' : 'g'
|
||||
,'execute' : 'before' // before or after
|
||||
}
|
||||
,'tags' : {
|
||||
'search' : '(<)(/?[a-z][^ \r\n\t>]*)([^>]*>)'
|
||||
,'class' : 'tags'
|
||||
,'modifiers' : 'gi'
|
||||
,'execute' : 'before' // before or after
|
||||
}
|
||||
,'attributes' : {
|
||||
'search' : '( |\n|\r|\t)([^ \r\n\t=]+)(=)'
|
||||
,'class' : 'attributes'
|
||||
,'modifiers' : 'g'
|
||||
,'execute' : 'before' // before or after
|
||||
}
|
||||
}
|
||||
,'STYLES' : {
|
||||
'COMMENTS': 'color: #AAAAAA;'
|
||||
,'QUOTESMARKS': 'color: #6381F8;'
|
||||
,'KEYWORDS' : {
|
||||
}
|
||||
,'OPERATORS' : 'color: #E775F0;'
|
||||
,'DELIMITERS' : ''
|
||||
,'REGEXPS' : {
|
||||
'attributes': 'color: #B1AC41;'
|
||||
,'tags': 'color: #E62253;'
|
||||
,'xml': 'color: #8DCFB5;'
|
||||
,'cdata': 'color: #50B020;'
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -1,27 +0,0 @@
|
||||
//function below added by logan (cailongqun [at] yahoo [dot] com [dot] cn) from www.phpletter.com
|
||||
function selectFile()
|
||||
{
|
||||
var selectedFileRowNum = $('#selectedFileRowNum').val();
|
||||
if(selectedFileRowNum != '' && $('#row' + selectedFileRowNum))
|
||||
{
|
||||
|
||||
// insert information now
|
||||
var url = $('#fileUrl'+selectedFileRowNum).val();
|
||||
window.opener.SetUrl( url ) ;
|
||||
window.close() ;
|
||||
|
||||
}else
|
||||
{
|
||||
alert(noFileSelected);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
function cancelSelectFile()
|
||||
{
|
||||
// close popup window
|
||||
window.close() ;
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
function selectFile(url)
|
||||
{
|
||||
window.opener.document.getElementById(elementId).value = url;
|
||||
window.close() ;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
function cancelSelectFile()
|
||||
{
|
||||
// close popup window
|
||||
window.close() ;
|
||||
}
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
function cancelSelectFile()
|
||||
{
|
||||
// close popup window
|
||||
window.close();
|
||||
}
|
||||
@@ -1,248 +0,0 @@
|
||||
// Some global instances
|
||||
var tinymce = null, tinyMCEPopup, tinyMCE;
|
||||
|
||||
tinyMCEPopup = {
|
||||
init : function() {
|
||||
var t = this, w = t.getWin(), ti;
|
||||
|
||||
// Find API
|
||||
tinymce = w.tinymce;
|
||||
tinyMCE = w.tinyMCE;
|
||||
t.editor = tinymce.EditorManager.activeEditor;
|
||||
t.params = t.editor.windowManager.params;
|
||||
|
||||
// Setup local DOM
|
||||
t.dom = t.editor.windowManager.createInstance('tinymce.dom.DOMUtils', document);
|
||||
t.dom.loadCSS(t.editor.settings.popup_css);
|
||||
|
||||
// Setup on init listeners
|
||||
t.listeners = [];
|
||||
t.onInit = {
|
||||
add : function(f, s) {
|
||||
t.listeners.push({func : f, scope : s});
|
||||
}
|
||||
};
|
||||
|
||||
t.isWindow = !t.getWindowArg('mce_inline');
|
||||
t.id = t.getWindowArg('mce_window_id');
|
||||
t.editor.windowManager.onOpen.dispatch(t.editor.windowManager, window);
|
||||
},
|
||||
|
||||
getWin : function() {
|
||||
return window.dialogArguments || opener || parent || top;
|
||||
},
|
||||
|
||||
getWindowArg : function(n, dv) {
|
||||
var v = this.params[n];
|
||||
|
||||
return tinymce.is(v) ? v : dv;
|
||||
},
|
||||
|
||||
getParam : function(n, dv) {
|
||||
return this.editor.getParam(n, dv);
|
||||
},
|
||||
|
||||
getLang : function(n, dv) {
|
||||
return this.editor.getLang(n, dv);
|
||||
},
|
||||
|
||||
execCommand : function(cmd, ui, val) {
|
||||
this.restoreSelection();
|
||||
return this.editor.execCommand(cmd, ui, val);
|
||||
},
|
||||
|
||||
resizeToInnerSize : function() {
|
||||
var t = this, n, b = document.body, vp = t.dom.getViewPort(window), dw, dh;
|
||||
|
||||
dw = t.getWindowArg('mce_width') - vp.w;
|
||||
dh = t.getWindowArg('mce_height') - vp.h;
|
||||
|
||||
if (t.isWindow)
|
||||
window.resizeBy(dw, dh);
|
||||
else
|
||||
t.editor.windowManager.resizeBy(dw, dh, t.id);
|
||||
},
|
||||
|
||||
executeOnLoad : function(s) {
|
||||
this.onInit.add(function() {
|
||||
eval(s);
|
||||
});
|
||||
},
|
||||
|
||||
storeSelection : function() {
|
||||
this.editor.windowManager.bookmark = tinyMCEPopup.editor.selection.getBookmark('simple');
|
||||
},
|
||||
|
||||
restoreSelection : function() {
|
||||
var t = tinyMCEPopup;
|
||||
|
||||
if (!t.isWindow && tinymce.isIE)
|
||||
t.editor.selection.moveToBookmark(t.editor.windowManager.bookmark);
|
||||
},
|
||||
|
||||
requireLangPack : function() {
|
||||
var u = this.getWindowArg('plugin_url') || this.getWindowArg('theme_url');
|
||||
|
||||
if (u)
|
||||
document.write('<script type="text/javascript" src="' + u + '/langs/' + this.editor.settings.language + '_dlg.js' + '"></script>');
|
||||
},
|
||||
|
||||
pickColor : function(e, element_id) {
|
||||
this.execCommand('mceColorPicker', true, {
|
||||
color : document.getElementById(element_id).value,
|
||||
func : function(c) {
|
||||
document.getElementById(element_id).value = c;
|
||||
|
||||
if (tinymce.is(document.getElementById(element_id).onchange, 'function'))
|
||||
document.getElementById(element_id).onchange();
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
openBrowser : function(element_id, type, option) {
|
||||
tinyMCEPopup.restoreSelection();
|
||||
this.editor.execCallback('file_browser_callback', element_id, document.getElementById(element_id).value, type, window);
|
||||
},
|
||||
|
||||
close : function() {
|
||||
var t = this;
|
||||
|
||||
t.dom = t.dom.doc = null; // Cleanup
|
||||
t.editor.windowManager.close(window, t.id);
|
||||
},
|
||||
|
||||
// Internal functions
|
||||
|
||||
_restoreSelection : function() {
|
||||
var e = window.event.srcElement;
|
||||
|
||||
if (e.nodeName == 'INPUT' && (e.type == 'submit' || e.type == 'button'))
|
||||
tinyMCEPopup.restoreSelection();
|
||||
},
|
||||
|
||||
/* _restoreSelection : function() {
|
||||
var e = window.event.srcElement;
|
||||
|
||||
// If user focus a non text input or textarea
|
||||
if ((e.nodeName != 'INPUT' && e.nodeName != 'TEXTAREA') || e.type != 'text')
|
||||
tinyMCEPopup.restoreSelection();
|
||||
},*/
|
||||
|
||||
_onDOMLoaded : function() {
|
||||
var t = this, ti = document.title, bm, h;
|
||||
|
||||
// Translate page
|
||||
h = document.body.innerHTML;
|
||||
|
||||
// Replace a=x with a="x" in IE
|
||||
if (tinymce.isIE)
|
||||
h = h.replace(/ (value|title|alt)=([^\s>]+)/gi, ' $1="$2"');
|
||||
|
||||
document.body.innerHTML = t.editor.translate(h);
|
||||
document.title = ti = t.editor.translate(ti);
|
||||
document.body.style.display = '';
|
||||
|
||||
// Restore selection in IE when focus is placed on a non textarea or input element of the type text
|
||||
if (tinymce.isIE)
|
||||
document.attachEvent('onmouseup', tinyMCEPopup._restoreSelection);
|
||||
|
||||
t.restoreSelection();
|
||||
|
||||
// Call onInit
|
||||
tinymce.each(t.listeners, function(o) {
|
||||
o.func.call(o.scope, t.editor);
|
||||
});
|
||||
|
||||
t.resizeToInnerSize();
|
||||
|
||||
if (t.isWindow)
|
||||
window.focus();
|
||||
else
|
||||
t.editor.windowManager.setTitle(ti, t.id);
|
||||
|
||||
if (!tinymce.isIE && !t.isWindow) {
|
||||
tinymce.dom.Event._add(document, 'focus', function() {
|
||||
t.editor.windowManager.focus(t.id)
|
||||
});
|
||||
}
|
||||
|
||||
// Patch for accessibility
|
||||
tinymce.each(t.dom.select('select'), function(e) {
|
||||
e.onkeydown = tinyMCEPopup._accessHandler;
|
||||
});
|
||||
|
||||
// Move focus to window
|
||||
window.focus();
|
||||
},
|
||||
|
||||
_accessHandler : function(e) {
|
||||
var e = e || window.event;
|
||||
|
||||
if (e.keyCode == 13 || e.keyCode == 32) {
|
||||
e = e.target || e.srcElement;
|
||||
|
||||
if (e.onchange)
|
||||
e.onchange();
|
||||
|
||||
return tinymce.dom.Event.cancel(e);
|
||||
}
|
||||
},
|
||||
|
||||
_wait : function() {
|
||||
var t = this, ti;
|
||||
|
||||
if (tinymce.isIE && document.location.protocol != 'https:') {
|
||||
// Fake DOMContentLoaded on IE
|
||||
document.write('<script id=__ie_onload defer src=\'javascript:""\';><\/script>');
|
||||
document.getElementById("__ie_onload").onreadystatechange = function() {
|
||||
if (this.readyState == "complete") {
|
||||
t._onDOMLoaded();
|
||||
document.getElementById("__ie_onload").onreadystatechange = null; // Prevent leak
|
||||
}
|
||||
};
|
||||
} else {
|
||||
if (tinymce.isIE || tinymce.isWebKit) {
|
||||
ti = setInterval(function() {
|
||||
if (/loaded|complete/.test(document.readyState)) {
|
||||
clearInterval(ti);
|
||||
t._onDOMLoaded();
|
||||
}
|
||||
}, 10);
|
||||
} else {
|
||||
window.addEventListener('DOMContentLoaded', function() {
|
||||
t._onDOMLoaded();
|
||||
}, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
tinyMCEPopup.init();
|
||||
//tinyMCEPopup._wait(); // Wait for DOM Content Loaded
|
||||
|
||||
//tinyMCEPopup.requireLangPack();
|
||||
|
||||
function selectFile(url)
|
||||
{
|
||||
if(typeof(url) != 'undefined')
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
if(url != '')
|
||||
{
|
||||
var win = tinyMCEPopup.getWindowArg("window");
|
||||
win.document.getElementById(tinyMCEPopup.getWindowArg("input")).value = url;
|
||||
//for image browsers
|
||||
try { win.ImageDialog.showPreviewImage(url); }
|
||||
catch (e) { void(e); }
|
||||
tinyMCEPopup.close();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function cancelSelectFile()
|
||||
{
|
||||
// close popup window
|
||||
tinyMCEPopup.close();
|
||||
}
|
||||
@@ -1,807 +0,0 @@
|
||||
/*
|
||||
* jQuery form plugin
|
||||
* @requires jQuery v1.1 or later
|
||||
*
|
||||
* Examples at: http://malsup.com/jquery/form/
|
||||
* Dual licensed under the MIT and GPL licenses:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
* Revision: $Id: form.js,v 1.3 2008/10/13 07:24:50 cvs Exp $
|
||||
* Version: 1.0.3
|
||||
*/
|
||||
(function($) {
|
||||
/**
|
||||
* ajaxSubmit() provides a mechanism for submitting an HTML form using AJAX.
|
||||
*
|
||||
* ajaxSubmit accepts a single argument which can be either a success callback function
|
||||
* or an options Object. If a function is provided it will be invoked upon successful
|
||||
* completion of the submit and will be passed the response from the server.
|
||||
* If an options Object is provided, the following attributes are supported:
|
||||
*
|
||||
* target: Identifies the element(s) in the page to be updated with the server response.
|
||||
* This value may be specified as a jQuery selection string, a jQuery object,
|
||||
* or a DOM element.
|
||||
* default value: null
|
||||
*
|
||||
* url: URL to which the form data will be submitted.
|
||||
* default value: value of form's 'action' attribute
|
||||
*
|
||||
* type: The method in which the form data should be submitted, 'GET' or 'POST'.
|
||||
* default value: value of form's 'method' attribute (or 'GET' if none found)
|
||||
*
|
||||
* beforeSubmit: Callback method to be invoked before the form is submitted.
|
||||
* default value: null
|
||||
*
|
||||
* success: Callback method to be invoked after the form has been successfully submitted
|
||||
* and the response has been returned from the server
|
||||
* default value: null
|
||||
*
|
||||
* dataType: Expected dataType of the response. One of: null, 'xml', 'script', or 'json'
|
||||
* default value: null
|
||||
*
|
||||
* semantic: Boolean flag indicating whether data must be submitted in semantic order (slower).
|
||||
* default value: false
|
||||
*
|
||||
* resetForm: Boolean flag indicating whether the form should be reset if the submit is successful
|
||||
*
|
||||
* clearForm: Boolean flag indicating whether the form should be cleared if the submit is successful
|
||||
*
|
||||
*
|
||||
* The 'beforeSubmit' callback can be provided as a hook for running pre-submit logic or for
|
||||
* validating the form data. If the 'beforeSubmit' callback returns false then the form will
|
||||
* not be submitted. The 'beforeSubmit' callback is invoked with three arguments: the form data
|
||||
* in array format, the jQuery object, and the options object passed into ajaxSubmit.
|
||||
* The form data array takes the following form:
|
||||
*
|
||||
* [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ]
|
||||
*
|
||||
* If a 'success' callback method is provided it is invoked after the response has been returned
|
||||
* from the server. It is passed the responseText or responseXML value (depending on dataType).
|
||||
* See jQuery.ajax for further details.
|
||||
*
|
||||
*
|
||||
* The dataType option provides a means for specifying how the server response should be handled.
|
||||
* This maps directly to the jQuery.httpData method. The following values are supported:
|
||||
*
|
||||
* 'xml': if dataType == 'xml' the server response is treated as XML and the 'success'
|
||||
* callback method, if specified, will be passed the responseXML value
|
||||
* 'json': if dataType == 'json' the server response will be evaluted and passed to
|
||||
* the 'success' callback, if specified
|
||||
* 'script': if dataType == 'script' the server response is evaluated in the global context
|
||||
*
|
||||
*
|
||||
* Note that it does not make sense to use both the 'target' and 'dataType' options. If both
|
||||
* are provided the target will be ignored.
|
||||
*
|
||||
* The semantic argument can be used to force form serialization in semantic order.
|
||||
* This is normally true anyway, unless the form contains input elements of type='image'.
|
||||
* If your form must be submitted with name/value pairs in semantic order and your form
|
||||
* contains an input of type='image" then pass true for this arg, otherwise pass false
|
||||
* (or nothing) to avoid the overhead for this logic.
|
||||
*
|
||||
*
|
||||
* When used on its own, ajaxSubmit() is typically bound to a form's submit event like this:
|
||||
*
|
||||
* $("#form-id").submit(function() {
|
||||
* $(this).ajaxSubmit(options);
|
||||
* return false; // cancel conventional submit
|
||||
* });
|
||||
*
|
||||
* When using ajaxForm(), however, this is done for you.
|
||||
*
|
||||
* @example
|
||||
* $('#myForm').ajaxSubmit(function(data) {
|
||||
* alert('Form submit succeeded! Server returned: ' + data);
|
||||
* });
|
||||
* @desc Submit form and alert server response
|
||||
*
|
||||
*
|
||||
* @example
|
||||
* var options = {
|
||||
* target: '#myTargetDiv'
|
||||
* };
|
||||
* $('#myForm').ajaxSubmit(options);
|
||||
* @desc Submit form and update page element with server response
|
||||
*
|
||||
*
|
||||
* @example
|
||||
* var options = {
|
||||
* success: function(responseText) {
|
||||
* alert(responseText);
|
||||
* }
|
||||
* };
|
||||
* $('#myForm').ajaxSubmit(options);
|
||||
* @desc Submit form and alert the server response
|
||||
*
|
||||
*
|
||||
* @example
|
||||
* var options = {
|
||||
* beforeSubmit: function(formArray, jqForm) {
|
||||
* if (formArray.length == 0) {
|
||||
* alert('Please enter data.');
|
||||
* return false;
|
||||
* }
|
||||
* }
|
||||
* };
|
||||
* $('#myForm').ajaxSubmit(options);
|
||||
* @desc Pre-submit validation which aborts the submit operation if form data is empty
|
||||
*
|
||||
*
|
||||
* @example
|
||||
* var options = {
|
||||
* url: myJsonUrl.php,
|
||||
* dataType: 'json',
|
||||
* success: function(data) {
|
||||
* // 'data' is an object representing the the evaluated json data
|
||||
* }
|
||||
* };
|
||||
* $('#myForm').ajaxSubmit(options);
|
||||
* @desc json data returned and evaluated
|
||||
*
|
||||
*
|
||||
* @example
|
||||
* var options = {
|
||||
* url: myXmlUrl.php,
|
||||
* dataType: 'xml',
|
||||
* success: function(responseXML) {
|
||||
* // responseXML is XML document object
|
||||
* var data = $('myElement', responseXML).text();
|
||||
* }
|
||||
* };
|
||||
* $('#myForm').ajaxSubmit(options);
|
||||
* @desc XML data returned from server
|
||||
*
|
||||
*
|
||||
* @example
|
||||
* var options = {
|
||||
* resetForm: true
|
||||
* };
|
||||
* $('#myForm').ajaxSubmit(options);
|
||||
* @desc submit form and reset it if successful
|
||||
*
|
||||
* @example
|
||||
* $('#myForm).submit(function() {
|
||||
* $(this).ajaxSubmit();
|
||||
* return false;
|
||||
* });
|
||||
* @desc Bind form's submit event to use ajaxSubmit
|
||||
*
|
||||
*
|
||||
* @name ajaxSubmit
|
||||
* @type jQuery
|
||||
* @param options object literal containing options which control the form submission process
|
||||
* @cat Plugins/Form
|
||||
* @return jQuery
|
||||
*/
|
||||
$.fn.ajaxSubmit = function(options) {
|
||||
if (typeof options == 'function')
|
||||
options = { success: options };
|
||||
|
||||
options = $.extend({
|
||||
url: this.attr('action') || window.location,
|
||||
type: this.attr('method') || 'GET'
|
||||
}, options || {});
|
||||
|
||||
var a = this.formToArray(options.semantic);
|
||||
|
||||
// give pre-submit callback an opportunity to abort the submit
|
||||
if (options.beforeSubmit && options.beforeSubmit(a, this, options) === false) return this;
|
||||
|
||||
// fire vetoable 'validate' event
|
||||
var veto = {};
|
||||
$.event.trigger('form.submit.validate', [a, this, options, veto]);
|
||||
if (veto.veto)
|
||||
return this;
|
||||
|
||||
var q = $.param(a);//.replace(/%20/g,'+');
|
||||
|
||||
if (options.type.toUpperCase() == 'GET') {
|
||||
options.url += (options.url.indexOf('?') >= 0 ? '&' : '?') + q;
|
||||
options.data = null; // data is null for 'get'
|
||||
}
|
||||
else
|
||||
options.data = q; // data is the query string for 'post'
|
||||
|
||||
var $form = this, callbacks = [];
|
||||
if (options.resetForm) callbacks.push(function() { $form.resetForm(); });
|
||||
if (options.clearForm) callbacks.push(function() { $form.clearForm(); });
|
||||
|
||||
// perform a load on the target only if dataType is not provided
|
||||
if (!options.dataType && options.target) {
|
||||
var oldSuccess = options.success;// || function(){};
|
||||
callbacks.push(function(data) {
|
||||
$(options.target).attr("innerHTML", data).evalScripts().each(oldSuccess, arguments);
|
||||
});
|
||||
}
|
||||
else if (options.success)
|
||||
callbacks.push(options.success);
|
||||
|
||||
options.success = function(data, status) {
|
||||
for (var i=0, max=callbacks.length; i < max; i++)
|
||||
callbacks[i](data, status, $form);
|
||||
};
|
||||
|
||||
// are there files to upload?
|
||||
var files = $('input:file', this).fieldValue();
|
||||
var found = false;
|
||||
for (var j=0; j < files.length; j++)
|
||||
if (files[j])
|
||||
found = true;
|
||||
|
||||
if (options.iframe || found) // options.iframe allows user to force iframe mode
|
||||
fileUpload();
|
||||
else
|
||||
$.ajax(options);
|
||||
|
||||
// fire 'notify' event
|
||||
$.event.trigger('form.submit.notify', [this, options]);
|
||||
return this;
|
||||
|
||||
|
||||
// private function for handling file uploads (hat tip to YAHOO!)
|
||||
function fileUpload() {
|
||||
var form = $form[0];
|
||||
var opts = $.extend({}, $.ajaxSettings, options);
|
||||
|
||||
var id = 'jqFormIO' + $.fn.ajaxSubmit.counter++;
|
||||
var $io = $('<iframe id="' + id + '" name="' + id + '" />');
|
||||
var io = $io[0];
|
||||
var op8 = $.browser.opera && window.opera.version() < 9;
|
||||
if ($.browser.msie || op8) io.src = 'javascript:false;document.write("");';
|
||||
$io.css({ position: 'absolute', top: '-1000px', left: '-1000px' });
|
||||
|
||||
var xhr = { // mock object
|
||||
responseText: null,
|
||||
responseXML: null,
|
||||
status: 0,
|
||||
statusText: 'n/a',
|
||||
getAllResponseHeaders: function() {},
|
||||
getResponseHeader: function() {},
|
||||
setRequestHeader: function() {}
|
||||
};
|
||||
|
||||
var g = opts.global;
|
||||
// trigger ajax global events so that activity/block indicators work like normal
|
||||
if (g && ! $.active++) $.event.trigger("ajaxStart");
|
||||
if (g) $.event.trigger("ajaxSend", [xhr, opts]);
|
||||
|
||||
var cbInvoked = 0;
|
||||
var timedOut = 0;
|
||||
|
||||
// take a breath so that pending repaints get some cpu time before the upload starts
|
||||
setTimeout(function() {
|
||||
$io.appendTo('body');
|
||||
// jQuery's event binding doesn't work for iframe events in IE
|
||||
io.attachEvent ? io.attachEvent('onload', cb) : io.addEventListener('load', cb, false);
|
||||
|
||||
// make sure form attrs are set
|
||||
var encAttr = form.encoding ? 'encoding' : 'enctype';
|
||||
var t = $form.attr('target');
|
||||
$form.attr({
|
||||
target: id,
|
||||
method: 'POST',
|
||||
encAttr: 'multipart/form-data',
|
||||
action: opts.url
|
||||
});
|
||||
|
||||
// support timout
|
||||
if (opts.timeout)
|
||||
setTimeout(function() { timedOut = true; cb(); }, opts.timeout);
|
||||
|
||||
form.submit();
|
||||
$form.attr('target', t); // reset target
|
||||
}, 10);
|
||||
|
||||
function cb() {
|
||||
if (cbInvoked++) return;
|
||||
|
||||
io.detachEvent ? io.detachEvent('onload', cb) : io.removeEventListener('load', cb, false);
|
||||
|
||||
var ok = true;
|
||||
try {
|
||||
if (timedOut) throw 'timeout';
|
||||
// extract the server response from the iframe
|
||||
var data, doc;
|
||||
doc = io.contentWindow ? io.contentWindow.document : io.contentDocument ? io.contentDocument : io.document;
|
||||
xhr.responseText = doc.body ? doc.body.innerHTML : null;
|
||||
xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc;
|
||||
|
||||
if (opts.dataType == 'json' || opts.dataType == 'script') {
|
||||
var ta = doc.getElementsByTagName('textarea')[0];
|
||||
data = ta ? ta.value : xhr.responseText;
|
||||
if (opts.dataType == 'json')
|
||||
eval("data = " + data);
|
||||
else
|
||||
$.globalEval(data);
|
||||
}
|
||||
else if (opts.dataType == 'xml') {
|
||||
data = xhr.responseXML;
|
||||
if (!data && xhr.responseText != null)
|
||||
data = toXml(xhr.responseText);
|
||||
}
|
||||
else {
|
||||
data = xhr.responseText;
|
||||
}
|
||||
}
|
||||
catch(e){
|
||||
ok = false;
|
||||
$.handleError(opts, xhr, 'error', e);
|
||||
}
|
||||
|
||||
// ordering of these callbacks/triggers is odd, but that's how $.ajax does it
|
||||
if (ok) {
|
||||
opts.success(data, 'success');
|
||||
if (g) $.event.trigger("ajaxSuccess", [xhr, opts]);
|
||||
}
|
||||
if (g) $.event.trigger("ajaxComplete", [xhr, opts]);
|
||||
if (g && ! --$.active) $.event.trigger("ajaxStop");
|
||||
if (opts.complete) opts.complete(xhr, ok ? 'success' : 'error');
|
||||
|
||||
// clean up
|
||||
setTimeout(function() {
|
||||
$io.remove();
|
||||
xhr.responseXML = null;
|
||||
}, 100);
|
||||
};
|
||||
|
||||
function toXml(s, doc) {
|
||||
if (window.ActiveXObject) {
|
||||
doc = new ActiveXObject('Microsoft.XMLDOM');
|
||||
doc.async = 'false';
|
||||
doc.loadXML(s);
|
||||
}
|
||||
else
|
||||
doc = (new DOMParser()).parseFromString(s, 'text/xml');
|
||||
return (doc && doc.documentElement && doc.documentElement.tagName != 'parsererror') ? doc : null;
|
||||
};
|
||||
};
|
||||
};
|
||||
$.fn.ajaxSubmit.counter = 0; // used to create unique iframe ids
|
||||
|
||||
/**
|
||||
* ajaxForm() provides a mechanism for fully automating form submission.
|
||||
*
|
||||
* The advantages of using this method instead of ajaxSubmit() are:
|
||||
*
|
||||
* 1: This method will include coordinates for <input type="image" /> elements (if the element
|
||||
* is used to submit the form).
|
||||
* 2. This method will include the submit element's name/value data (for the element that was
|
||||
* used to submit the form).
|
||||
* 3. This method binds the submit() method to the form for you.
|
||||
*
|
||||
* Note that for accurate x/y coordinates of image submit elements in all browsers
|
||||
* you need to also use the "dimensions" plugin (this method will auto-detect its presence).
|
||||
*
|
||||
* The options argument for ajaxForm works exactly as it does for ajaxSubmit. ajaxForm merely
|
||||
* passes the options argument along after properly binding events for submit elements and
|
||||
* the form itself. See ajaxSubmit for a full description of the options argument.
|
||||
*
|
||||
*
|
||||
* @example
|
||||
* var options = {
|
||||
* target: '#myTargetDiv'
|
||||
* };
|
||||
* $('#myForm').ajaxSForm(options);
|
||||
* @desc Bind form's submit event so that 'myTargetDiv' is updated with the server response
|
||||
* when the form is submitted.
|
||||
*
|
||||
*
|
||||
* @example
|
||||
* var options = {
|
||||
* success: function(responseText) {
|
||||
* alert(responseText);
|
||||
* }
|
||||
* };
|
||||
* $('#myForm').ajaxSubmit(options);
|
||||
* @desc Bind form's submit event so that server response is alerted after the form is submitted.
|
||||
*
|
||||
*
|
||||
* @example
|
||||
* var options = {
|
||||
* beforeSubmit: function(formArray, jqForm) {
|
||||
* if (formArray.length == 0) {
|
||||
* alert('Please enter data.');
|
||||
* return false;
|
||||
* }
|
||||
* }
|
||||
* };
|
||||
* $('#myForm').ajaxSubmit(options);
|
||||
* @desc Bind form's submit event so that pre-submit callback is invoked before the form
|
||||
* is submitted.
|
||||
*
|
||||
*
|
||||
* @name ajaxForm
|
||||
* @param options object literal containing options which control the form submission process
|
||||
* @return jQuery
|
||||
* @cat Plugins/Form
|
||||
* @type jQuery
|
||||
*/
|
||||
$.fn.ajaxForm = function(options) {
|
||||
return this.ajaxFormUnbind().submit(submitHandler).each(function() {
|
||||
// store options in hash
|
||||
this.formPluginId = $.fn.ajaxForm.counter++;
|
||||
$.fn.ajaxForm.optionHash[this.formPluginId] = options;
|
||||
$(":submit,input:image", this).click(clickHandler);
|
||||
});
|
||||
};
|
||||
|
||||
$.fn.ajaxForm.counter = 1;
|
||||
$.fn.ajaxForm.optionHash = {};
|
||||
|
||||
function clickHandler(e) {
|
||||
var $form = this.form;
|
||||
$form.clk = this;
|
||||
if (this.type == 'image') {
|
||||
if (e.offsetX != undefined) {
|
||||
$form.clk_x = e.offsetX;
|
||||
$form.clk_y = e.offsetY;
|
||||
} else if (typeof $.fn.offset == 'function') { // try to use dimensions plugin
|
||||
var offset = $(this).offset();
|
||||
$form.clk_x = e.pageX - offset.left;
|
||||
$form.clk_y = e.pageY - offset.top;
|
||||
} else {
|
||||
$form.clk_x = e.pageX - this.offsetLeft;
|
||||
$form.clk_y = e.pageY - this.offsetTop;
|
||||
}
|
||||
}
|
||||
// clear form vars
|
||||
setTimeout(function() { $form.clk = $form.clk_x = $form.clk_y = null; }, 10);
|
||||
};
|
||||
|
||||
function submitHandler() {
|
||||
// retrieve options from hash
|
||||
var id = this.formPluginId;
|
||||
var options = $.fn.ajaxForm.optionHash[id];
|
||||
$(this).ajaxSubmit(options);
|
||||
return false;
|
||||
};
|
||||
|
||||
/**
|
||||
* ajaxFormUnbind unbinds the event handlers that were bound by ajaxForm
|
||||
*
|
||||
* @name ajaxFormUnbind
|
||||
* @return jQuery
|
||||
* @cat Plugins/Form
|
||||
* @type jQuery
|
||||
*/
|
||||
$.fn.ajaxFormUnbind = function() {
|
||||
this.unbind('submit', submitHandler);
|
||||
return this.each(function() {
|
||||
$(":submit,input:image", this).unbind('click', clickHandler);
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* formToArray() gathers form element data into an array of objects that can
|
||||
* be passed to any of the following ajax functions: $.get, $.post, or load.
|
||||
* Each object in the array has both a 'name' and 'value' property. An example of
|
||||
* an array for a simple login form might be:
|
||||
*
|
||||
* [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ]
|
||||
*
|
||||
* It is this array that is passed to pre-submit callback functions provided to the
|
||||
* ajaxSubmit() and ajaxForm() methods.
|
||||
*
|
||||
* The semantic argument can be used to force form serialization in semantic order.
|
||||
* This is normally true anyway, unless the form contains input elements of type='image'.
|
||||
* If your form must be submitted with name/value pairs in semantic order and your form
|
||||
* contains an input of type='image" then pass true for this arg, otherwise pass false
|
||||
* (or nothing) to avoid the overhead for this logic.
|
||||
*
|
||||
* @example var data = $("#myForm").formToArray();
|
||||
* $.post( "myscript.cgi", data );
|
||||
* @desc Collect all the data from a form and submit it to the server.
|
||||
*
|
||||
* @name formToArray
|
||||
* @param semantic true if serialization must maintain strict semantic ordering of elements (slower)
|
||||
* @type Array<Object>
|
||||
* @cat Plugins/Form
|
||||
*/
|
||||
$.fn.formToArray = function(semantic) {
|
||||
var a = [];
|
||||
if (this.length == 0) return a;
|
||||
|
||||
var form = this[0];
|
||||
var els = semantic ? form.getElementsByTagName('*') : form.elements;
|
||||
if (!els) return a;
|
||||
for(var i=0, max=els.length; i < max; i++) {
|
||||
var el = els[i];
|
||||
var n = el.name;
|
||||
if (!n) continue;
|
||||
|
||||
if (semantic && form.clk && el.type == "image") {
|
||||
// handle image inputs on the fly when semantic == true
|
||||
if(!el.disabled && form.clk == el)
|
||||
a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
|
||||
continue;
|
||||
}
|
||||
|
||||
var v = $.fieldValue(el, true);
|
||||
if (v && v.constructor == Array) {
|
||||
for(var j=0, jmax=v.length; j < jmax; j++)
|
||||
a.push({name: n, value: v[j]});
|
||||
}
|
||||
else if (v !== null && typeof v != 'undefined')
|
||||
a.push({name: n, value: v});
|
||||
}
|
||||
|
||||
if (!semantic && form.clk) {
|
||||
// input type=='image' are not found in elements array! handle them here
|
||||
var inputs = form.getElementsByTagName("input");
|
||||
for(var i=0, max=inputs.length; i < max; i++) {
|
||||
var input = inputs[i];
|
||||
var n = input.name;
|
||||
if(n && !input.disabled && input.type == "image" && form.clk == input)
|
||||
a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
|
||||
}
|
||||
}
|
||||
return a;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Serializes form data into a 'submittable' string. This method will return a string
|
||||
* in the format: name1=value1&name2=value2
|
||||
*
|
||||
* The semantic argument can be used to force form serialization in semantic order.
|
||||
* If your form must be submitted with name/value pairs in semantic order then pass
|
||||
* true for this arg, otherwise pass false (or nothing) to avoid the overhead for
|
||||
* this logic (which can be significant for very large forms).
|
||||
*
|
||||
* @example var data = $("#myForm").formSerialize();
|
||||
* $.ajax('POST', "myscript.cgi", data);
|
||||
* @desc Collect all the data from a form into a single string
|
||||
*
|
||||
* @name formSerialize
|
||||
* @param semantic true if serialization must maintain strict semantic ordering of elements (slower)
|
||||
* @type String
|
||||
* @cat Plugins/Form
|
||||
*/
|
||||
$.fn.formSerialize = function(semantic) {
|
||||
//hand off to jQuery.param for proper encoding
|
||||
return $.param(this.formToArray(semantic));
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Serializes all field elements in the jQuery object into a query string.
|
||||
* This method will return a string in the format: name1=value1&name2=value2
|
||||
*
|
||||
* The successful argument controls whether or not serialization is limited to
|
||||
* 'successful' controls (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).
|
||||
* The default value of the successful argument is true.
|
||||
*
|
||||
* @example var data = $("input").formSerialize();
|
||||
* @desc Collect the data from all successful input elements into a query string
|
||||
*
|
||||
* @example var data = $(":radio").formSerialize();
|
||||
* @desc Collect the data from all successful radio input elements into a query string
|
||||
*
|
||||
* @example var data = $("#myForm :checkbox").formSerialize();
|
||||
* @desc Collect the data from all successful checkbox input elements in myForm into a query string
|
||||
*
|
||||
* @example var data = $("#myForm :checkbox").formSerialize(false);
|
||||
* @desc Collect the data from all checkbox elements in myForm (even the unchecked ones) into a query string
|
||||
*
|
||||
* @example var data = $(":input").formSerialize();
|
||||
* @desc Collect the data from all successful input, select, textarea and button elements into a query string
|
||||
*
|
||||
* @name fieldSerialize
|
||||
* @param successful true if only successful controls should be serialized (default is true)
|
||||
* @type String
|
||||
* @cat Plugins/Form
|
||||
*/
|
||||
$.fn.fieldSerialize = function(successful) {
|
||||
var a = [];
|
||||
this.each(function() {
|
||||
var n = this.name;
|
||||
if (!n) return;
|
||||
var v = $.fieldValue(this, successful);
|
||||
if (v && v.constructor == Array) {
|
||||
for (var i=0,max=v.length; i < max; i++)
|
||||
a.push({name: n, value: v[i]});
|
||||
}
|
||||
else if (v !== null && typeof v != 'undefined')
|
||||
a.push({name: this.name, value: v});
|
||||
});
|
||||
//hand off to jQuery.param for proper encoding
|
||||
return $.param(a);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Returns the value(s) of the element in the matched set. For example, consider the following form:
|
||||
*
|
||||
* <form><fieldset>
|
||||
* <input name="A" type="text" />
|
||||
* <input name="A" type="text" />
|
||||
* <input name="B" type="checkbox" value="B1" />
|
||||
* <input name="B" type="checkbox" value="B2"/>
|
||||
* <input name="C" type="radio" value="C1" />
|
||||
* <input name="C" type="radio" value="C2" />
|
||||
* </fieldset></form>
|
||||
*
|
||||
* var v = $(':text').fieldValue();
|
||||
* // if no values are entered into the text inputs
|
||||
* v == ['','']
|
||||
* // if values entered into the text inputs are 'foo' and 'bar'
|
||||
* v == ['foo','bar']
|
||||
*
|
||||
* var v = $(':checkbox').fieldValue();
|
||||
* // if neither checkbox is checked
|
||||
* v === undefined
|
||||
* // if both checkboxes are checked
|
||||
* v == ['B1', 'B2']
|
||||
*
|
||||
* var v = $(':radio').fieldValue();
|
||||
* // if neither radio is checked
|
||||
* v === undefined
|
||||
* // if first radio is checked
|
||||
* v == ['C1']
|
||||
*
|
||||
* The successful argument controls whether or not the field element must be 'successful'
|
||||
* (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).
|
||||
* The default value of the successful argument is true. If this value is false the value(s)
|
||||
* for each element is returned.
|
||||
*
|
||||
* Note: This method *always* returns an array. If no valid value can be determined the
|
||||
* array will be empty, otherwise it will contain one or more values.
|
||||
*
|
||||
* @example var data = $("#myPasswordElement").fieldValue();
|
||||
* alert(data[0]);
|
||||
* @desc Alerts the current value of the myPasswordElement element
|
||||
*
|
||||
* @example var data = $("#myForm :input").fieldValue();
|
||||
* @desc Get the value(s) of the form elements in myForm
|
||||
*
|
||||
* @example var data = $("#myForm :checkbox").fieldValue();
|
||||
* @desc Get the value(s) for the successful checkbox element(s) in the jQuery object.
|
||||
*
|
||||
* @example var data = $("#mySingleSelect").fieldValue();
|
||||
* @desc Get the value(s) of the select control
|
||||
*
|
||||
* @example var data = $(':text').fieldValue();
|
||||
* @desc Get the value(s) of the text input or textarea elements
|
||||
*
|
||||
* @example var data = $("#myMultiSelect").fieldValue();
|
||||
* @desc Get the values for the select-multiple control
|
||||
*
|
||||
* @name fieldValue
|
||||
* @param Boolean successful true if only the values for successful controls should be returned (default is true)
|
||||
* @type Array<String>
|
||||
* @cat Plugins/Form
|
||||
*/
|
||||
$.fn.fieldValue = function(successful) {
|
||||
for (var val=[], i=0, max=this.length; i < max; i++) {
|
||||
var el = this[i];
|
||||
var v = $.fieldValue(el, successful);
|
||||
if (v === null || typeof v == 'undefined' || (v.constructor == Array && !v.length))
|
||||
continue;
|
||||
v.constructor == Array ? $.merge(val, v) : val.push(v);
|
||||
}
|
||||
return val;
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the value of the field element.
|
||||
*
|
||||
* The successful argument controls whether or not the field element must be 'successful'
|
||||
* (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).
|
||||
* The default value of the successful argument is true. If the given element is not
|
||||
* successful and the successful arg is not false then the returned value will be null.
|
||||
*
|
||||
* Note: If the successful flag is true (default) but the element is not successful, the return will be null
|
||||
* Note: The value returned for a successful select-multiple element will always be an array.
|
||||
* Note: If the element has no value the return value will be undefined.
|
||||
*
|
||||
* @example var data = jQuery.fieldValue($("#myPasswordElement")[0]);
|
||||
* @desc Gets the current value of the myPasswordElement element
|
||||
*
|
||||
* @name fieldValue
|
||||
* @param Element el The DOM element for which the value will be returned
|
||||
* @param Boolean successful true if value returned must be for a successful controls (default is true)
|
||||
* @type String or Array<String> or null or undefined
|
||||
* @cat Plugins/Form
|
||||
*/
|
||||
$.fieldValue = function(el, successful) {
|
||||
var n = el.name, t = el.type, tag = el.tagName.toLowerCase();
|
||||
if (typeof successful == 'undefined') successful = true;
|
||||
|
||||
if (successful && (!n || el.disabled || t == 'reset' || t == 'button' ||
|
||||
(t == 'checkbox' || t == 'radio') && !el.checked ||
|
||||
(t == 'submit' || t == 'image') && el.form && el.form.clk != el ||
|
||||
tag == 'select' && el.selectedIndex == -1))
|
||||
return null;
|
||||
|
||||
if (tag == 'select') {
|
||||
var index = el.selectedIndex;
|
||||
if (index < 0) return null;
|
||||
var a = [], ops = el.options;
|
||||
var one = (t == 'select-one');
|
||||
var max = (one ? index+1 : ops.length);
|
||||
for(var i=(one ? index : 0); i < max; i++) {
|
||||
var op = ops[i];
|
||||
if (op.selected) {
|
||||
// extra pain for IE...
|
||||
var v = $.browser.msie && !(op.attributes['value'].specified) ? op.text : op.value;
|
||||
if (one) return v;
|
||||
a.push(v);
|
||||
}
|
||||
}
|
||||
return a;
|
||||
}
|
||||
return el.value;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Clears the form data. Takes the following actions on the form's input fields:
|
||||
* - input text fields will have their 'value' property set to the empty string
|
||||
* - select elements will have their 'selectedIndex' property set to -1
|
||||
* - checkbox and radio inputs will have their 'checked' property set to false
|
||||
* - inputs of type submit, button, reset, and hidden will *not* be effected
|
||||
* - button elements will *not* be effected
|
||||
*
|
||||
* @example $('form').clearForm();
|
||||
* @desc Clears all forms on the page.
|
||||
*
|
||||
* @name clearForm
|
||||
* @type jQuery
|
||||
* @cat Plugins/Form
|
||||
*/
|
||||
$.fn.clearForm = function() {
|
||||
return this.each(function() {
|
||||
$('input,select,textarea', this).clearFields();
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Clears the selected form elements. Takes the following actions on the matched elements:
|
||||
* - input text fields will have their 'value' property set to the empty string
|
||||
* - select elements will have their 'selectedIndex' property set to -1
|
||||
* - checkbox and radio inputs will have their 'checked' property set to false
|
||||
* - inputs of type submit, button, reset, and hidden will *not* be effected
|
||||
* - button elements will *not* be effected
|
||||
*
|
||||
* @example $('.myInputs').clearFields();
|
||||
* @desc Clears all inputs with class myInputs
|
||||
*
|
||||
* @name clearFields
|
||||
* @type jQuery
|
||||
* @cat Plugins/Form
|
||||
*/
|
||||
$.fn.clearFields = $.fn.clearInputs = function() {
|
||||
return this.each(function() {
|
||||
var t = this.type, tag = this.tagName.toLowerCase();
|
||||
if (t == 'text' || t == 'password' || tag == 'textarea')
|
||||
this.value = '';
|
||||
else if (t == 'checkbox' || t == 'radio')
|
||||
this.checked = false;
|
||||
else if (tag == 'select')
|
||||
this.selectedIndex = -1;
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Resets the form data. Causes all form elements to be reset to their original value.
|
||||
*
|
||||
* @example $('form').resetForm();
|
||||
* @desc Resets all forms on the page.
|
||||
*
|
||||
* @name resetForm
|
||||
* @type jQuery
|
||||
* @cat Plugins/Form
|
||||
*/
|
||||
$.fn.resetForm = function() {
|
||||
return this.each(function() {
|
||||
// guard against an input with the name of 'reset'
|
||||
// note that IE reports the reset function as an 'object'
|
||||
if (typeof this.reset == 'function' || (typeof this.reset == 'object' && !this.reset.nodeType))
|
||||
this.reset();
|
||||
});
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
@@ -1,764 +0,0 @@
|
||||
|
||||
jQuery.iUtil = {
|
||||
getPosition : function(e)
|
||||
{
|
||||
var x = 0;
|
||||
var y = 0;
|
||||
var es = e.style;
|
||||
var restoreStyles = false;
|
||||
if (jQuery(e).css('display') == 'none') {
|
||||
var oldVisibility = es.visibility;
|
||||
var oldPosition = es.position;
|
||||
restoreStyles = true;
|
||||
es.visibility = 'hidden';
|
||||
es.display = 'block';
|
||||
es.position = 'absolute';
|
||||
}
|
||||
var el = e;
|
||||
while (el){
|
||||
x += el.offsetLeft + (el.currentStyle && !jQuery.browser.opera ?parseInt(el.currentStyle.borderLeftWidth)||0:0);
|
||||
y += el.offsetTop + (el.currentStyle && !jQuery.browser.opera ?parseInt(el.currentStyle.borderTopWidth)||0:0);
|
||||
el = el.offsetParent;
|
||||
}
|
||||
el = e;
|
||||
while (el && el.tagName && el.tagName.toLowerCase() != 'body')
|
||||
{
|
||||
x -= el.scrollLeft||0;
|
||||
y -= el.scrollTop||0;
|
||||
el = el.parentNode;
|
||||
}
|
||||
if (restoreStyles == true) {
|
||||
es.display = 'none';
|
||||
es.position = oldPosition;
|
||||
es.visibility = oldVisibility;
|
||||
}
|
||||
return {x:x, y:y};
|
||||
},
|
||||
getPositionLite : function(el)
|
||||
{
|
||||
var x = 0, y = 0;
|
||||
while(el) {
|
||||
x += el.offsetLeft || 0;
|
||||
y += el.offsetTop || 0;
|
||||
el = el.offsetParent;
|
||||
}
|
||||
return {x:x, y:y};
|
||||
},
|
||||
getSize : function(e)
|
||||
{
|
||||
var w = jQuery.css(e,'width');
|
||||
var h = jQuery.css(e,'height');
|
||||
var wb = 0;
|
||||
var hb = 0;
|
||||
var es = e.style;
|
||||
if (jQuery(e).css('display') != 'none') {
|
||||
wb = e.offsetWidth;
|
||||
hb = e.offsetHeight;
|
||||
} else {
|
||||
var oldVisibility = es.visibility;
|
||||
var oldPosition = es.position;
|
||||
es.visibility = 'hidden';
|
||||
es.display = 'block';
|
||||
es.position = 'absolute';
|
||||
wb = e.offsetWidth;
|
||||
hb = e.offsetHeight;
|
||||
es.display = 'none';
|
||||
es.position = oldPosition;
|
||||
es.visibility = oldVisibility;
|
||||
}
|
||||
return {w:w, h:h, wb:wb, hb:hb};
|
||||
},
|
||||
getSizeLite : function(el)
|
||||
{
|
||||
return {
|
||||
wb:el.offsetWidth||0,
|
||||
hb:el.offsetHeight||0
|
||||
};
|
||||
},
|
||||
getClient : function(e)
|
||||
{
|
||||
var h, w, de;
|
||||
if (e) {
|
||||
w = e.clientWidth;
|
||||
h = e.clientHeight;
|
||||
} else {
|
||||
de = document.documentElement;
|
||||
w = window.innerWidth || self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth;
|
||||
h = window.innerHeight || self.innerHeight || (de&&de.clientHeight) || document.body.clientHeight;
|
||||
}
|
||||
return {w:w,h:h};
|
||||
},
|
||||
getScroll : function (e)
|
||||
{
|
||||
var t=0, l=0, w=0, h=0, iw=0, ih=0;
|
||||
if (e && e.nodeName.toLowerCase() != 'body') {
|
||||
t = e.scrollTop;
|
||||
l = e.scrollLeft;
|
||||
w = e.scrollWidth;
|
||||
h = e.scrollHeight;
|
||||
iw = 0;
|
||||
ih = 0;
|
||||
} else {
|
||||
if (document.documentElement) {
|
||||
t = document.documentElement.scrollTop;
|
||||
l = document.documentElement.scrollLeft;
|
||||
w = document.documentElement.scrollWidth;
|
||||
h = document.documentElement.scrollHeight;
|
||||
} else if (document.body) {
|
||||
t = document.body.scrollTop;
|
||||
l = document.body.scrollLeft;
|
||||
w = document.body.scrollWidth;
|
||||
h = document.body.scrollHeight;
|
||||
}
|
||||
iw = self.innerWidth||document.documentElement.clientWidth||document.body.clientWidth||0;
|
||||
ih = self.innerHeight||document.documentElement.clientHeight||document.body.clientHeight||0;
|
||||
}
|
||||
return { t: t, l: l, w: w, h: h, iw: iw, ih: ih };
|
||||
},
|
||||
getMargins : function(e, toInteger)
|
||||
{
|
||||
var el = jQuery(e);
|
||||
var t = el.css('marginTop') || '';
|
||||
var r = el.css('marginRight') || '';
|
||||
var b = el.css('marginBottom') || '';
|
||||
var l = el.css('marginLeft') || '';
|
||||
if (toInteger)
|
||||
return {
|
||||
t: parseInt(t)||0,
|
||||
r: parseInt(r)||0,
|
||||
b: parseInt(b)||0,
|
||||
l: parseInt(l)
|
||||
};
|
||||
else
|
||||
return {t: t, r: r, b: b, l: l};
|
||||
},
|
||||
getPadding : function(e, toInteger)
|
||||
{
|
||||
var el = jQuery(e);
|
||||
var t = el.css('paddingTop') || '';
|
||||
var r = el.css('paddingRight') || '';
|
||||
var b = el.css('paddingBottom') || '';
|
||||
var l = el.css('paddingLeft') || '';
|
||||
if (toInteger)
|
||||
return {
|
||||
t: parseInt(t)||0,
|
||||
r: parseInt(r)||0,
|
||||
b: parseInt(b)||0,
|
||||
l: parseInt(l)
|
||||
};
|
||||
else
|
||||
return {t: t, r: r, b: b, l: l};
|
||||
},
|
||||
getBorder : function(e, toInteger)
|
||||
{
|
||||
var el = jQuery(e);
|
||||
var t = el.css('borderTopWidth') || '';
|
||||
var r = el.css('borderRightWidth') || '';
|
||||
var b = el.css('borderBottomWidth') || '';
|
||||
var l = el.css('borderLeftWidth') || '';
|
||||
if (toInteger)
|
||||
return {
|
||||
t: parseInt(t)||0,
|
||||
r: parseInt(r)||0,
|
||||
b: parseInt(b)||0,
|
||||
l: parseInt(l)||0
|
||||
};
|
||||
else
|
||||
return {t: t, r: r, b: b, l: l};
|
||||
},
|
||||
getPointer : function(event)
|
||||
{
|
||||
var x = event.pageX || (event.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft)) || 0;
|
||||
var y = event.pageY || (event.clientY + (document.documentElement.scrollTop || document.body.scrollTop)) || 0;
|
||||
return {x:x, y:y};
|
||||
},
|
||||
traverseDOM : function(nodeEl, func)
|
||||
{
|
||||
func(nodeEl);
|
||||
nodeEl = nodeEl.firstChild;
|
||||
while(nodeEl){
|
||||
jQuery.iUtil.traverseDOM(nodeEl, func);
|
||||
nodeEl = nodeEl.nextSibling;
|
||||
}
|
||||
},
|
||||
purgeEvents : function(nodeEl)
|
||||
{
|
||||
jQuery.iUtil.traverseDOM(
|
||||
nodeEl,
|
||||
function(el)
|
||||
{
|
||||
for(var attr in el){
|
||||
if(typeof el[attr] === 'function') {
|
||||
el[attr] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
},
|
||||
centerEl : function(el, axis)
|
||||
{
|
||||
var clientScroll = jQuery.iUtil.getScroll();
|
||||
var windowSize = jQuery.iUtil.getSize(el);
|
||||
if (!axis || axis == 'vertically')
|
||||
jQuery(el).css(
|
||||
{
|
||||
top: clientScroll.t + ((Math.max(clientScroll.h,clientScroll.ih) - clientScroll.t - windowSize.hb)/2) + 'px'
|
||||
}
|
||||
);
|
||||
if (!axis || axis == 'horizontally')
|
||||
jQuery(el).css(
|
||||
{
|
||||
left: clientScroll.l + ((Math.max(clientScroll.w,clientScroll.iw) - clientScroll.l - windowSize.wb)/2) + 'px'
|
||||
}
|
||||
);
|
||||
},
|
||||
fixPNG : function (el, emptyGIF) {
|
||||
var images = jQuery('img[@src*="png"]', el||document), png;
|
||||
images.each( function() {
|
||||
png = this.src;
|
||||
this.src = emptyGIF;
|
||||
this.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + png + "')";
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
// Helper function to support older browsers!
|
||||
[].indexOf || (Array.prototype.indexOf = function(v, n){
|
||||
n = (n == null) ? 0 : n;
|
||||
var m = this.length;
|
||||
for (var i=n; i<m; i++)
|
||||
if (this[i] == v)
|
||||
return i;
|
||||
return -1;
|
||||
});
|
||||
|
||||
|
||||
|
||||
//iresizable show below
|
||||
/**
|
||||
* Interface Elements for jQuery
|
||||
* Resizable
|
||||
*
|
||||
* http://interface.eyecon.ro
|
||||
*
|
||||
* Copyright (c) 2006 Stefan Petre
|
||||
* Dual licensed under the MIT (MIT-LICENSE.txt)
|
||||
* and GPL (GPL-LICENSE.txt) licenses.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
jQuery.iResize = {
|
||||
resizeElement: null,
|
||||
resizeDirection: null,
|
||||
dragged: null,
|
||||
pointer: null,
|
||||
sizes: null,
|
||||
position: null,
|
||||
/**
|
||||
* internal: Start function
|
||||
*/
|
||||
startDrag: function(e) {
|
||||
jQuery.iResize.dragged = (this.dragEl) ? this.dragEl: this;
|
||||
jQuery.iResize.pointer = jQuery.iUtil.getPointer(e);
|
||||
|
||||
// Save original size
|
||||
jQuery.iResize.sizes = {
|
||||
width: parseInt(jQuery(jQuery.iResize.dragged).css('width')) || 0,
|
||||
height: parseInt(jQuery(jQuery.iResize.dragged).css('height')) || 0
|
||||
};
|
||||
|
||||
// Save original position
|
||||
jQuery.iResize.position = {
|
||||
top: parseInt(jQuery(jQuery.iResize.dragged).css('top')) || 0,
|
||||
left: parseInt(jQuery(jQuery.iResize.dragged).css('left')) || 0
|
||||
};
|
||||
|
||||
// Assign event handlers
|
||||
jQuery(document)
|
||||
.bind('mousemove', jQuery.iResize.moveDrag)
|
||||
.bind('mouseup', jQuery.iResize.stopDrag);
|
||||
|
||||
// Callback?
|
||||
if (typeof jQuery.iResize.dragged.resizeOptions.onDragStart === 'function') {
|
||||
jQuery.iResize.dragged.resizeOptions.onDragStart.apply(jQuery.iResize.dragged);
|
||||
}
|
||||
return false;
|
||||
},
|
||||
/**
|
||||
* internal: Stop function
|
||||
*/
|
||||
stopDrag: function(e) {
|
||||
// Unbind event handlers
|
||||
jQuery(document)
|
||||
.unbind('mousemove', jQuery.iResize.moveDrag)
|
||||
.unbind('mouseup', jQuery.iResize.stopDrag);
|
||||
|
||||
// Callback?
|
||||
if (typeof jQuery.iResize.dragged.resizeOptions.onDragStop === 'function') {
|
||||
jQuery.iResize.dragged.resizeOptions.onDragStop.apply(jQuery.iResize.dragged);
|
||||
}
|
||||
|
||||
// Remove dragged element
|
||||
jQuery.iResize.dragged = null;
|
||||
},
|
||||
/**
|
||||
* internal: Move function
|
||||
*/
|
||||
moveDrag: function(e) {
|
||||
if (!jQuery.iResize.dragged) {
|
||||
return;
|
||||
}
|
||||
|
||||
pointer = jQuery.iUtil.getPointer(e);
|
||||
|
||||
// Calculate new positions
|
||||
newTop = jQuery.iResize.position.top - jQuery.iResize.pointer.y + pointer.y;
|
||||
newLeft = jQuery.iResize.position.left - jQuery.iResize.pointer.x + pointer.x;
|
||||
newTop = Math.max(
|
||||
Math.min(newTop, jQuery.iResize.dragged.resizeOptions.maxBottom - jQuery.iResize.sizes.height),
|
||||
jQuery.iResize.dragged.resizeOptions.minTop
|
||||
);
|
||||
newLeft = Math.max(
|
||||
Math.min(newLeft, jQuery.iResize.dragged.resizeOptions.maxRight- jQuery.iResize.sizes.width),
|
||||
jQuery.iResize.dragged.resizeOptions.minLeft
|
||||
);
|
||||
|
||||
// Callback
|
||||
if (typeof jQuery.iResize.dragged.resizeOptions.onDrag === 'function') {
|
||||
var newPos = jQuery.iResize.dragged.resizeOptions.onDrag.apply(jQuery.iResize.dragged, [newLeft, newTop]);
|
||||
if (typeof newPos == 'array' && newPos.length == 2) {
|
||||
newLeft = newPos[0];
|
||||
newTop = newPos[1];
|
||||
}
|
||||
}
|
||||
|
||||
// Update the element
|
||||
jQuery.iResize.dragged.style.top = newTop + 'px';
|
||||
jQuery.iResize.dragged.style.left = newLeft + 'px';
|
||||
|
||||
return false;
|
||||
},
|
||||
start: function(e) {
|
||||
// Bind event handlers
|
||||
jQuery(document)
|
||||
.bind('mousemove', jQuery.iResize.move)
|
||||
.bind('mouseup', jQuery.iResize.stop);
|
||||
|
||||
// Initialize resizable
|
||||
jQuery.iResize.resizeElement = this.resizeElement;
|
||||
jQuery.iResize.resizeDirection = this.resizeDirection;
|
||||
jQuery.iResize.pointer = jQuery.iUtil.getPointer(e);
|
||||
jQuery.iResize.sizes = {
|
||||
width: parseInt(jQuery(this.resizeElement).css('width'))||0,
|
||||
height: parseInt(jQuery(this.resizeElement).css('height'))||0
|
||||
};
|
||||
jQuery.iResize.position = {
|
||||
top: parseInt(jQuery(this.resizeElement).css('top'))||0,
|
||||
left: parseInt(jQuery(this.resizeElement).css('left'))||0
|
||||
};
|
||||
|
||||
// Callback function
|
||||
if (jQuery.iResize.resizeElement.resizeOptions.onStart) {
|
||||
jQuery.iResize.resizeElement.resizeOptions.onStart.apply(jQuery.iResize.resizeElement, [this]);
|
||||
}
|
||||
|
||||
return false;
|
||||
},
|
||||
stop: function() {
|
||||
// Unbind event handlers
|
||||
jQuery(document)
|
||||
.unbind('mousemove', jQuery.iResize.move)
|
||||
.unbind('mouseup', jQuery.iResize.stop);
|
||||
|
||||
// Callback function
|
||||
if (jQuery.iResize.resizeElement.resizeOptions.onStop) {
|
||||
jQuery.iResize.resizeElement.resizeOptions.onStop.apply(jQuery.iResize.resizeElement, [jQuery.iResize.resizeDirection]);
|
||||
}
|
||||
|
||||
// Unbind
|
||||
jQuery.iResize.resizeElement = null;
|
||||
jQuery.iResize.resizeDirection = null;
|
||||
},
|
||||
getWidth: function(dx, side) {
|
||||
return Math.min(
|
||||
Math.max(jQuery.iResize.sizes.width + dx * side, jQuery.iResize.resizeElement.resizeOptions.minWidth),
|
||||
jQuery.iResize.resizeElement.resizeOptions.maxWidth
|
||||
);
|
||||
},
|
||||
getHeight: function(dy, side) {
|
||||
return Math.min(
|
||||
Math.max(jQuery.iResize.sizes.height + dy * side, jQuery.iResize.resizeElement.resizeOptions.minHeight),
|
||||
jQuery.iResize.resizeElement.resizeOptions.maxHeight
|
||||
);
|
||||
},
|
||||
getHeightMinMax: function(height) {
|
||||
return Math.min(
|
||||
Math.max(height, jQuery.iResize.resizeElement.resizeOptions.minHeight),
|
||||
jQuery.iResize.resizeElement.resizeOptions.maxHeight
|
||||
);
|
||||
},
|
||||
|
||||
/**
|
||||
* setting and getting the ratio value
|
||||
* defined by Logan Cai cailongqun [at] yahoo [dot] com [dot] cn
|
||||
*/
|
||||
ResizeRatio: function(value)
|
||||
{
|
||||
var ratio;
|
||||
this.each(
|
||||
function() {
|
||||
var el = this;
|
||||
if(typeof(value) == 'integer')
|
||||
{//setting new ratio
|
||||
el.resizeOptions.ratio = value;
|
||||
}else
|
||||
{//getting the ratio
|
||||
if(el.resizeOptions.ratio)
|
||||
{
|
||||
ratio = el.resizeOptions.ratio;
|
||||
}else
|
||||
{
|
||||
var width = parseInt(jQuery(el).css('width')) || 0;
|
||||
var height = parseInt(jQuery(el).css('height'))|| 0;
|
||||
if(width > 0 && height > 0)
|
||||
{
|
||||
ratio = (Math.round(height/width * 10000)/10000);
|
||||
}else
|
||||
{
|
||||
ratio = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
);
|
||||
return ratio;
|
||||
|
||||
},
|
||||
/**
|
||||
* setting and getting the ratio value
|
||||
* defined by Logan Cai cailongqun [at] yahoo [dot] com [dot] cn
|
||||
*/
|
||||
ResizeConstraint: function(OnOrOff)
|
||||
{
|
||||
var ratio;
|
||||
|
||||
this.each(
|
||||
function()
|
||||
{
|
||||
var el = this;
|
||||
if(typeof(OnOrOff) != 'boolean' || !OnOrOff)
|
||||
{//turn off resize constraint
|
||||
el.resizeOptions.ratio = null;
|
||||
}else
|
||||
{//turn on the resize constraint and set the ratio calculated from current image width & height
|
||||
var width = parseInt(jQuery(el).css('width')) || 0;
|
||||
var height = parseInt(jQuery(el).css('height'))|| 0;
|
||||
if(width > 0 && height > 0)
|
||||
{
|
||||
el.resizeOptions.ratio = (Math.round(height/width * 10000)/10000);
|
||||
}else
|
||||
{
|
||||
el.resizeOptions.ratio = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
);
|
||||
|
||||
},
|
||||
|
||||
move: function(e) {
|
||||
if (jQuery.iResize.resizeElement == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
pointer = jQuery.iUtil.getPointer(e);
|
||||
dx = pointer.x - jQuery.iResize.pointer.x;
|
||||
dy = pointer.y - jQuery.iResize.pointer.y;
|
||||
|
||||
newSizes = {
|
||||
width: jQuery.iResize.sizes.width,
|
||||
height: jQuery.iResize.sizes.height
|
||||
};
|
||||
newPosition = {
|
||||
top: jQuery.iResize.position.top,
|
||||
left: jQuery.iResize.position.left
|
||||
};
|
||||
|
||||
switch (jQuery.iResize.resizeDirection){
|
||||
case 'e':
|
||||
newSizes.width = jQuery.iResize.getWidth(dx,1);
|
||||
break;
|
||||
case 'se':
|
||||
newSizes.width = jQuery.iResize.getWidth(dx,1);
|
||||
newSizes.height = jQuery.iResize.getHeight(dy,1);
|
||||
break;
|
||||
case 'w':
|
||||
newSizes.width = jQuery.iResize.getWidth(dx,-1);
|
||||
newPosition.left = jQuery.iResize.position.left - newSizes.width + jQuery.iResize.sizes.width;
|
||||
break;
|
||||
case 'sw':
|
||||
newSizes.width = jQuery.iResize.getWidth(dx,-1);
|
||||
newPosition.left = jQuery.iResize.position.left - newSizes.width + jQuery.iResize.sizes.width;
|
||||
newSizes.height = jQuery.iResize.getHeight(dy,1);
|
||||
break;
|
||||
case 'nw':
|
||||
newSizes.height = jQuery.iResize.getHeight(dy,-1);
|
||||
newPosition.top = jQuery.iResize.position.top - newSizes.height + jQuery.iResize.sizes.height;
|
||||
newSizes.width = jQuery.iResize.getWidth(dx,-1);
|
||||
newPosition.left = jQuery.iResize.position.left - newSizes.width + jQuery.iResize.sizes.width;
|
||||
break;
|
||||
case 'n':
|
||||
newSizes.height = jQuery.iResize.getHeight(dy,-1);
|
||||
newPosition.top = jQuery.iResize.position.top - newSizes.height + jQuery.iResize.sizes.height;
|
||||
break;
|
||||
case 'ne':
|
||||
newSizes.height = jQuery.iResize.getHeight(dy,-1);
|
||||
newPosition.top = jQuery.iResize.position.top - newSizes.height + jQuery.iResize.sizes.height;
|
||||
newSizes.width = jQuery.iResize.getWidth(dx,1);
|
||||
break;
|
||||
case 's':
|
||||
newSizes.height = jQuery.iResize.getHeight(dy,1);
|
||||
break;
|
||||
}
|
||||
|
||||
if (jQuery.iResize.resizeElement.resizeOptions.ratio) {
|
||||
if (jQuery.iResize.resizeDirection == 'n' || jQuery.iResize.resizeDirection == 's')
|
||||
nWidth = newSizes.height * jQuery.iResize.resizeElement.resizeOptions.ratio;
|
||||
else
|
||||
nWidth = newSizes.width;
|
||||
nHeight = jQuery.iResize.getHeightMinMax(nWidth * jQuery.iResize.resizeElement.resizeOptions.ratio);
|
||||
nWidth = nHeight / jQuery.iResize.resizeElement.resizeOptions.ratio;
|
||||
|
||||
switch (jQuery.iResize.resizeDirection){
|
||||
case 'n':
|
||||
case 'nw':
|
||||
case 'ne':
|
||||
newPosition.top += newSizes.height - nHeight;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (jQuery.iResize.resizeDirection){
|
||||
case 'nw':
|
||||
case 'w':
|
||||
case 'sw':
|
||||
newPosition.left += newSizes.width - nWidth;
|
||||
break;
|
||||
}
|
||||
|
||||
newSizes.height = nHeight;
|
||||
newSizes.width = nWidth;
|
||||
}
|
||||
|
||||
if (newPosition.top < jQuery.iResize.resizeElement.resizeOptions.minTop) {
|
||||
nHeight = newSizes.height + newPosition.top - jQuery.iResize.resizeElement.resizeOptions.minTop;
|
||||
newPosition.top = jQuery.iResize.resizeElement.resizeOptions.minTop;
|
||||
|
||||
if (jQuery.iResize.resizeElement.resizeOptions.ratio) {
|
||||
nWidth = nHeight / jQuery.iResize.resizeElement.resizeOptions.ratio;
|
||||
switch (jQuery.iResize.resizeDirection){
|
||||
case 'nw':
|
||||
case 'w':
|
||||
case 'sw':
|
||||
newPosition.left += newSizes.width - nWidth;
|
||||
break;
|
||||
}
|
||||
newSizes.width = nWidth;
|
||||
}
|
||||
newSizes.height = nHeight;
|
||||
}
|
||||
|
||||
if (newPosition.left < jQuery.iResize.resizeElement.resizeOptions.minLeft ) {
|
||||
nWidth = newSizes.width + newPosition.left - jQuery.iResize.resizeElement.resizeOptions.minLeft;
|
||||
newPosition.left = jQuery.iResize.resizeElement.resizeOptions.minLeft;
|
||||
|
||||
if (jQuery.iResize.resizeElement.resizeOptions.ratio) {
|
||||
nHeight = nWidth * jQuery.iResize.resizeElement.resizeOptions.ratio;
|
||||
switch (jQuery.iResize.resizeDirection){
|
||||
case 'n':
|
||||
case 'nw':
|
||||
case 'ne':
|
||||
newPosition.top += newSizes.height - nHeight;
|
||||
break;
|
||||
}
|
||||
newSizes.height = nHeight;
|
||||
}
|
||||
newSizes.width = nWidth;
|
||||
}
|
||||
|
||||
if (newPosition.top + newSizes.height > jQuery.iResize.resizeElement.resizeOptions.maxBottom) {
|
||||
newSizes.height = jQuery.iResize.resizeElement.resizeOptions.maxBottom - newPosition.top;
|
||||
if (jQuery.iResize.resizeElement.resizeOptions.ratio) {
|
||||
newSizes.width = newSizes.height / jQuery.iResize.resizeElement.resizeOptions.ratio;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (newPosition.left + newSizes.width > jQuery.iResize.resizeElement.resizeOptions.maxRight) {
|
||||
newSizes.width = jQuery.iResize.resizeElement.resizeOptions.maxRight - newPosition.left;
|
||||
if (jQuery.iResize.resizeElement.resizeOptions.ratio) {
|
||||
newSizes.height = newSizes.width * jQuery.iResize.resizeElement.resizeOptions.ratio;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
var newDimensions = false;
|
||||
if (jQuery.iResize.resizeElement.resizeOptions.onResize) {
|
||||
newDimensions = jQuery.iResize.resizeElement.resizeOptions.onResize.apply( jQuery.iResize.resizeElement, [ newSizes, newPosition ] );
|
||||
if (newDimensions) {
|
||||
if (newDimensions.sizes) {
|
||||
jQuery.extend(newSizes, newDimensions.sizes);
|
||||
}
|
||||
|
||||
if (newDimensions.position) {
|
||||
jQuery.extend(newPosition, newDimensions.position);
|
||||
}
|
||||
}
|
||||
}
|
||||
elS = jQuery.iResize.resizeElement.style;
|
||||
elS.left = newPosition.left + 'px';
|
||||
elS.top = newPosition.top + 'px';
|
||||
elS.width = newSizes.width + 'px';
|
||||
elS.height = newSizes.height + 'px';
|
||||
|
||||
return false;
|
||||
},
|
||||
/**
|
||||
* Builds the resizable
|
||||
*/
|
||||
build: function(options) {
|
||||
if (!options || !options.handlers || options.handlers.constructor != Object) {
|
||||
return;
|
||||
}
|
||||
|
||||
return this.each(
|
||||
function() {
|
||||
var el = this;
|
||||
el.resizeOptions = options;
|
||||
el.resizeOptions.minWidth = options.minWidth || 10;
|
||||
el.resizeOptions.minHeight = options.minHeight || 10;
|
||||
el.resizeOptions.maxWidth = options.maxWidth || 3000;
|
||||
el.resizeOptions.maxHeight = options.maxHeight || 3000;
|
||||
el.resizeOptions.minTop = options.minTop || -1000;
|
||||
el.resizeOptions.minLeft = options.minLeft || -1000;
|
||||
el.resizeOptions.maxRight = options.maxRight || 3000;
|
||||
el.resizeOptions.maxBottom = options.maxBottom || 3000;
|
||||
elPosition = jQuery(el).css('position');
|
||||
if (!(elPosition == 'relative' || elPosition == 'absolute')) {
|
||||
el.style.position = 'relative';
|
||||
}
|
||||
|
||||
directions = /n|ne|e|se|s|sw|w|nw/g;
|
||||
for (i in el.resizeOptions.handlers) {
|
||||
if (i.toLowerCase().match(directions) != null) {
|
||||
if (el.resizeOptions.handlers[i].constructor == String) {
|
||||
handle = jQuery(el.resizeOptions.handlers[i]);
|
||||
if (handle.size() > 0) {
|
||||
el.resizeOptions.handlers[i] = handle.get(0);
|
||||
}
|
||||
}
|
||||
|
||||
if (el.resizeOptions.handlers[i].tagName) {
|
||||
el.resizeOptions.handlers[i].resizeElement = el;
|
||||
el.resizeOptions.handlers[i].resizeDirection = i;
|
||||
jQuery(el.resizeOptions.handlers[i]).bind('mousedown', jQuery.iResize.start);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (el.resizeOptions.dragHandle) {
|
||||
if (typeof el.resizeOptions.dragHandle === 'string') {
|
||||
handleEl = jQuery(el.resizeOptions.dragHandle);
|
||||
if (handleEl.size() > 0) {
|
||||
handleEl.each(function() {
|
||||
this.dragEl = el;
|
||||
});
|
||||
handleEl.bind('mousedown', jQuery.iResize.startDrag);
|
||||
}
|
||||
} else if (el.resizeOptions.dragHandle == true) {
|
||||
jQuery(this).bind('mousedown', jQuery.iResize.startDrag);
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
},
|
||||
|
||||
/**
|
||||
* Destroys the resizable
|
||||
*/
|
||||
destroy: function() {
|
||||
return this.each(
|
||||
function() {
|
||||
var el = this;
|
||||
|
||||
// Unbind the handlers
|
||||
for (i in el.resizeOptions.handlers) {
|
||||
el.resizeOptions.handlers[i].resizeElement = null;
|
||||
el.resizeOptions.handlers[i].resizeDirection = null;
|
||||
jQuery(el.resizeOptions.handlers[i]).unbind('mousedown', jQuery.iResize.start);
|
||||
}
|
||||
|
||||
// Remove the draghandle
|
||||
if (el.resizeOptions.dragHandle) {
|
||||
if (typeof el.resizeOptions.dragHandle === 'string') {
|
||||
handle = jQuery(el.resizeOptions.dragHandle);
|
||||
if (handle.size() > 0) {
|
||||
handle.unbind('mousedown', jQuery.iResize.startDrag);
|
||||
}
|
||||
} else if (el.resizeOptions.dragHandle == true) {
|
||||
jQuery(this).unbind('mousedown', jQuery.iResize.startDrag);
|
||||
}
|
||||
}
|
||||
|
||||
// Reset the options
|
||||
el.resizeOptions = null;
|
||||
}
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
jQuery.fn.extend ({
|
||||
/**
|
||||
* Create a resizable element with a number of advanced options including callback, dragging
|
||||
*
|
||||
* @name Resizable
|
||||
* @description Create a resizable element with a number of advanced options including callback, dragging
|
||||
* @param Hash hash A hash of parameters. All parameters are optional.
|
||||
* @option Hash handlers hash with keys for each resize direction (e, es, s, sw, w, nw, n) and value string selection
|
||||
* @option Integer minWidth (optional) the minimum width that element can be resized to
|
||||
* @option Integer maxWidth (optional) the maximum width that element can be resized to
|
||||
* @option Integer minHeight (optional) the minimum height that element can be resized to
|
||||
* @option Integer maxHeight (optional) the maximum height that element can be resized to
|
||||
* @option Integer minTop (optional) the minmum top position to wich element can be moved to
|
||||
* @option Integer minLeft (optional) the minmum left position to wich element can be moved to
|
||||
* @option Integer maxRight (optional) the maximum right position to wich element can be moved to
|
||||
* @option Integer maxBottom (optional) the maximum bottom position to wich element can be moved to
|
||||
* @option Float ratio (optional) the ratio between width and height to constrain elements sizes to that ratio
|
||||
* @option Mixed dragHandle (optional) true to make the element draggable, string selection for drag handle
|
||||
* @option Function onDragStart (optional) A function to be executed whenever the dragging starts
|
||||
* @option Function onDragStop (optional) A function to be executed whenever the dragging stops
|
||||
* @option Function onDrag (optional) A function to be executed whenever the element is dragged
|
||||
* @option Function onStart (optional) A function to be executed whenever the element starts to be resized
|
||||
* @option Function onStop (optional) A function to be executed whenever the element stops to be resized
|
||||
* @option Function onResize (optional) A function to be executed whenever the element is resized
|
||||
* @type jQuery
|
||||
* @cat Plugins/Interface
|
||||
* @author Stefan Petre
|
||||
*/
|
||||
Resizable: jQuery.iResize.build,
|
||||
ResizableRatio: jQuery.iResize.ResizeRatio,
|
||||
ResizeConstraint: jQuery.iResize.ResizeConstraint,
|
||||
/**
|
||||
* Destroy a resizable
|
||||
*
|
||||
* @name ResizableDestroy
|
||||
* @description Destroy a resizable
|
||||
* @type jQuery
|
||||
* @cat Plugins/Interface
|
||||
* @author Stefan Petre
|
||||
*/
|
||||
ResizableDestroy: jQuery.iResize.destroy
|
||||
});
|
||||
@@ -1,527 +0,0 @@
|
||||
/**
|
||||
* Interface Elements for jQuery
|
||||
* Resizable
|
||||
*
|
||||
* http://interface.eyecon.ro
|
||||
*
|
||||
* Copyright (c) 2006 Stefan Petre
|
||||
* Dual licensed under the MIT (MIT-LICENSE.txt)
|
||||
* and GPL (GPL-LICENSE.txt) licenses.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
jQuery.iResize = {
|
||||
resizeElement: null,
|
||||
resizeDirection: null,
|
||||
dragged: null,
|
||||
pointer: null,
|
||||
sizes: null,
|
||||
position: null,
|
||||
/**
|
||||
* internal: Start function
|
||||
*/
|
||||
startDrag: function(e) {
|
||||
jQuery.iResize.dragged = (this.dragEl) ? this.dragEl: this;
|
||||
jQuery.iResize.pointer = jQuery.iUtil.getPointer(e);
|
||||
|
||||
// Save original size
|
||||
jQuery.iResize.sizes = {
|
||||
width: parseInt(jQuery(jQuery.iResize.dragged).css('width')) || 0,
|
||||
height: parseInt(jQuery(jQuery.iResize.dragged).css('height')) || 0
|
||||
};
|
||||
|
||||
// Save original position
|
||||
jQuery.iResize.position = {
|
||||
top: parseInt(jQuery(jQuery.iResize.dragged).css('top')) || 0,
|
||||
left: parseInt(jQuery(jQuery.iResize.dragged).css('left')) || 0
|
||||
};
|
||||
|
||||
// Assign event handlers
|
||||
jQuery(document)
|
||||
.bind('mousemove', jQuery.iResize.moveDrag)
|
||||
.bind('mouseup', jQuery.iResize.stopDrag);
|
||||
|
||||
// Callback?
|
||||
if (typeof jQuery.iResize.dragged.resizeOptions.onDragStart === 'function') {
|
||||
jQuery.iResize.dragged.resizeOptions.onDragStart.apply(jQuery.iResize.dragged);
|
||||
}
|
||||
return false;
|
||||
},
|
||||
/**
|
||||
* internal: Stop function
|
||||
*/
|
||||
stopDrag: function(e) {
|
||||
// Unbind event handlers
|
||||
jQuery(document)
|
||||
.unbind('mousemove', jQuery.iResize.moveDrag)
|
||||
.unbind('mouseup', jQuery.iResize.stopDrag);
|
||||
|
||||
// Callback?
|
||||
if (typeof jQuery.iResize.dragged.resizeOptions.onDragStop === 'function') {
|
||||
jQuery.iResize.dragged.resizeOptions.onDragStop.apply(jQuery.iResize.dragged);
|
||||
}
|
||||
|
||||
// Remove dragged element
|
||||
jQuery.iResize.dragged = null;
|
||||
},
|
||||
/**
|
||||
* internal: Move function
|
||||
*/
|
||||
moveDrag: function(e) {
|
||||
if (!jQuery.iResize.dragged) {
|
||||
return;
|
||||
}
|
||||
|
||||
pointer = jQuery.iUtil.getPointer(e);
|
||||
|
||||
// Calculate new positions
|
||||
newTop = jQuery.iResize.position.top - jQuery.iResize.pointer.y + pointer.y;
|
||||
newLeft = jQuery.iResize.position.left - jQuery.iResize.pointer.x + pointer.x;
|
||||
newTop = Math.max(
|
||||
Math.min(newTop, jQuery.iResize.dragged.resizeOptions.maxBottom - jQuery.iResize.sizes.height),
|
||||
jQuery.iResize.dragged.resizeOptions.minTop
|
||||
);
|
||||
newLeft = Math.max(
|
||||
Math.min(newLeft, jQuery.iResize.dragged.resizeOptions.maxRight- jQuery.iResize.sizes.width),
|
||||
jQuery.iResize.dragged.resizeOptions.minLeft
|
||||
);
|
||||
|
||||
// Callback
|
||||
if (typeof jQuery.iResize.dragged.resizeOptions.onDrag === 'function') {
|
||||
var newPos = jQuery.iResize.dragged.resizeOptions.onDrag.apply(jQuery.iResize.dragged, [newLeft, newTop]);
|
||||
if (typeof newPos == 'array' && newPos.length == 2) {
|
||||
newLeft = newPos[0];
|
||||
newTop = newPos[1];
|
||||
}
|
||||
}
|
||||
|
||||
// Update the element
|
||||
jQuery.iResize.dragged.style.top = newTop + 'px';
|
||||
jQuery.iResize.dragged.style.left = newLeft + 'px';
|
||||
|
||||
return false;
|
||||
},
|
||||
start: function(e) {
|
||||
// Bind event handlers
|
||||
jQuery(document)
|
||||
.bind('mousemove', jQuery.iResize.move)
|
||||
.bind('mouseup', jQuery.iResize.stop);
|
||||
|
||||
// Initialize resizable
|
||||
jQuery.iResize.resizeElement = this.resizeElement;
|
||||
jQuery.iResize.resizeDirection = this.resizeDirection;
|
||||
jQuery.iResize.pointer = jQuery.iUtil.getPointer(e);
|
||||
jQuery.iResize.sizes = {
|
||||
width: parseInt(jQuery(this.resizeElement).css('width'))||0,
|
||||
height: parseInt(jQuery(this.resizeElement).css('height'))||0
|
||||
};
|
||||
jQuery.iResize.position = {
|
||||
top: parseInt(jQuery(this.resizeElement).css('top'))||0,
|
||||
left: parseInt(jQuery(this.resizeElement).css('left'))||0
|
||||
};
|
||||
|
||||
// Callback function
|
||||
if (jQuery.iResize.resizeElement.resizeOptions.onStart) {
|
||||
jQuery.iResize.resizeElement.resizeOptions.onStart.apply(jQuery.iResize.resizeElement, [this]);
|
||||
}
|
||||
|
||||
return false;
|
||||
},
|
||||
stop: function() {
|
||||
// Unbind event handlers
|
||||
jQuery(document)
|
||||
.unbind('mousemove', jQuery.iResize.move)
|
||||
.unbind('mouseup', jQuery.iResize.stop);
|
||||
|
||||
// Callback function
|
||||
if (jQuery.iResize.resizeElement.resizeOptions.onStop) {
|
||||
jQuery.iResize.resizeElement.resizeOptions.onStop.apply(jQuery.iResize.resizeElement, [jQuery.iResize.resizeDirection]);
|
||||
}
|
||||
|
||||
// Unbind
|
||||
jQuery.iResize.resizeElement = null;
|
||||
jQuery.iResize.resizeDirection = null;
|
||||
},
|
||||
getWidth: function(dx, side) {
|
||||
return Math.min(
|
||||
Math.max(jQuery.iResize.sizes.width + dx * side, jQuery.iResize.resizeElement.resizeOptions.minWidth),
|
||||
jQuery.iResize.resizeElement.resizeOptions.maxWidth
|
||||
);
|
||||
},
|
||||
getHeight: function(dy, side) {
|
||||
return Math.min(
|
||||
Math.max(jQuery.iResize.sizes.height + dy * side, jQuery.iResize.resizeElement.resizeOptions.minHeight),
|
||||
jQuery.iResize.resizeElement.resizeOptions.maxHeight
|
||||
);
|
||||
},
|
||||
getHeightMinMax: function(height) {
|
||||
return Math.min(
|
||||
Math.max(height, jQuery.iResize.resizeElement.resizeOptions.minHeight),
|
||||
jQuery.iResize.resizeElement.resizeOptions.maxHeight
|
||||
);
|
||||
},
|
||||
|
||||
/**
|
||||
* setting and getting the ratio value
|
||||
* defined by Logan Cai cailongqun [at] yahoo [dot] com [dot] cn
|
||||
*/
|
||||
ResizeRatio: function(value)
|
||||
{
|
||||
var ratio;
|
||||
this.each(
|
||||
function() {
|
||||
var el = this;
|
||||
if(typeof(value) == 'integer')
|
||||
{//setting new ratio
|
||||
el.resizeOptions.ratio = value;
|
||||
}else
|
||||
{//getting the ratio
|
||||
if(el.resizeOptions.ratio)
|
||||
{
|
||||
ratio = el.resizeOptions.ratio;
|
||||
}else
|
||||
{
|
||||
var width = parseInt(jQuery(el).css('width')) || 0;
|
||||
var height = parseInt(jQuery(el).css('height'))|| 0;
|
||||
if(width > 0 && height > 0)
|
||||
{
|
||||
ratio = (Math.round(height/width * 10000)/10000);
|
||||
}else
|
||||
{
|
||||
ratio = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
);
|
||||
return ratio;
|
||||
|
||||
},
|
||||
/**
|
||||
* setting and getting the ratio value
|
||||
* defined by Logan Cai cailongqun [at] yahoo [dot] com [dot] cn
|
||||
*/
|
||||
ResizeConstraint: function(OnOrOff)
|
||||
{
|
||||
var ratio;
|
||||
|
||||
this.each(
|
||||
function()
|
||||
{
|
||||
var el = this;
|
||||
if(typeof(OnOrOff) != 'boolean' || !OnOrOff)
|
||||
{//turn off resize constraint
|
||||
el.resizeOptions.ratio = null;
|
||||
}else
|
||||
{//turn on the resize constraint and set the ratio calculated from current image width & height
|
||||
var width = parseInt(jQuery(el).css('width')) || 0;
|
||||
var height = parseInt(jQuery(el).css('height'))|| 0;
|
||||
if(width > 0 && height > 0)
|
||||
{
|
||||
el.resizeOptions.ratio = (Math.round(height/width * 10000)/10000);
|
||||
}else
|
||||
{
|
||||
el.resizeOptions.ratio = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
);
|
||||
|
||||
},
|
||||
|
||||
move: function(e) {
|
||||
if (jQuery.iResize.resizeElement == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
pointer = jQuery.iUtil.getPointer(e);
|
||||
dx = pointer.x - jQuery.iResize.pointer.x;
|
||||
dy = pointer.y - jQuery.iResize.pointer.y;
|
||||
|
||||
newSizes = {
|
||||
width: jQuery.iResize.sizes.width,
|
||||
height: jQuery.iResize.sizes.height
|
||||
};
|
||||
newPosition = {
|
||||
top: jQuery.iResize.position.top,
|
||||
left: jQuery.iResize.position.left
|
||||
};
|
||||
|
||||
switch (jQuery.iResize.resizeDirection){
|
||||
case 'e':
|
||||
newSizes.width = jQuery.iResize.getWidth(dx,1);
|
||||
break;
|
||||
case 'se':
|
||||
newSizes.width = jQuery.iResize.getWidth(dx,1);
|
||||
newSizes.height = jQuery.iResize.getHeight(dy,1);
|
||||
break;
|
||||
case 'w':
|
||||
newSizes.width = jQuery.iResize.getWidth(dx,-1);
|
||||
newPosition.left = jQuery.iResize.position.left - newSizes.width + jQuery.iResize.sizes.width;
|
||||
break;
|
||||
case 'sw':
|
||||
newSizes.width = jQuery.iResize.getWidth(dx,-1);
|
||||
newPosition.left = jQuery.iResize.position.left - newSizes.width + jQuery.iResize.sizes.width;
|
||||
newSizes.height = jQuery.iResize.getHeight(dy,1);
|
||||
break;
|
||||
case 'nw':
|
||||
newSizes.height = jQuery.iResize.getHeight(dy,-1);
|
||||
newPosition.top = jQuery.iResize.position.top - newSizes.height + jQuery.iResize.sizes.height;
|
||||
newSizes.width = jQuery.iResize.getWidth(dx,-1);
|
||||
newPosition.left = jQuery.iResize.position.left - newSizes.width + jQuery.iResize.sizes.width;
|
||||
break;
|
||||
case 'n':
|
||||
newSizes.height = jQuery.iResize.getHeight(dy,-1);
|
||||
newPosition.top = jQuery.iResize.position.top - newSizes.height + jQuery.iResize.sizes.height;
|
||||
break;
|
||||
case 'ne':
|
||||
newSizes.height = jQuery.iResize.getHeight(dy,-1);
|
||||
newPosition.top = jQuery.iResize.position.top - newSizes.height + jQuery.iResize.sizes.height;
|
||||
newSizes.width = jQuery.iResize.getWidth(dx,1);
|
||||
break;
|
||||
case 's':
|
||||
newSizes.height = jQuery.iResize.getHeight(dy,1);
|
||||
break;
|
||||
}
|
||||
|
||||
if (jQuery.iResize.resizeElement.resizeOptions.ratio) {
|
||||
if (jQuery.iResize.resizeDirection == 'n' || jQuery.iResize.resizeDirection == 's')
|
||||
nWidth = newSizes.height * jQuery.iResize.resizeElement.resizeOptions.ratio;
|
||||
else
|
||||
nWidth = newSizes.width;
|
||||
nHeight = jQuery.iResize.getHeightMinMax(nWidth * jQuery.iResize.resizeElement.resizeOptions.ratio);
|
||||
nWidth = nHeight / jQuery.iResize.resizeElement.resizeOptions.ratio;
|
||||
|
||||
switch (jQuery.iResize.resizeDirection){
|
||||
case 'n':
|
||||
case 'nw':
|
||||
case 'ne':
|
||||
newPosition.top += newSizes.height - nHeight;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (jQuery.iResize.resizeDirection){
|
||||
case 'nw':
|
||||
case 'w':
|
||||
case 'sw':
|
||||
newPosition.left += newSizes.width - nWidth;
|
||||
break;
|
||||
}
|
||||
|
||||
newSizes.height = nHeight;
|
||||
newSizes.width = nWidth;
|
||||
}
|
||||
|
||||
if (newPosition.top < jQuery.iResize.resizeElement.resizeOptions.minTop) {
|
||||
nHeight = newSizes.height + newPosition.top - jQuery.iResize.resizeElement.resizeOptions.minTop;
|
||||
newPosition.top = jQuery.iResize.resizeElement.resizeOptions.minTop;
|
||||
|
||||
if (jQuery.iResize.resizeElement.resizeOptions.ratio) {
|
||||
nWidth = nHeight / jQuery.iResize.resizeElement.resizeOptions.ratio;
|
||||
switch (jQuery.iResize.resizeDirection){
|
||||
case 'nw':
|
||||
case 'w':
|
||||
case 'sw':
|
||||
newPosition.left += newSizes.width - nWidth;
|
||||
break;
|
||||
}
|
||||
newSizes.width = nWidth;
|
||||
}
|
||||
newSizes.height = nHeight;
|
||||
}
|
||||
|
||||
if (newPosition.left < jQuery.iResize.resizeElement.resizeOptions.minLeft ) {
|
||||
nWidth = newSizes.width + newPosition.left - jQuery.iResize.resizeElement.resizeOptions.minLeft;
|
||||
newPosition.left = jQuery.iResize.resizeElement.resizeOptions.minLeft;
|
||||
|
||||
if (jQuery.iResize.resizeElement.resizeOptions.ratio) {
|
||||
nHeight = nWidth * jQuery.iResize.resizeElement.resizeOptions.ratio;
|
||||
switch (jQuery.iResize.resizeDirection){
|
||||
case 'n':
|
||||
case 'nw':
|
||||
case 'ne':
|
||||
newPosition.top += newSizes.height - nHeight;
|
||||
break;
|
||||
}
|
||||
newSizes.height = nHeight;
|
||||
}
|
||||
newSizes.width = nWidth;
|
||||
}
|
||||
|
||||
if (newPosition.top + newSizes.height > jQuery.iResize.resizeElement.resizeOptions.maxBottom) {
|
||||
newSizes.height = jQuery.iResize.resizeElement.resizeOptions.maxBottom - newPosition.top;
|
||||
if (jQuery.iResize.resizeElement.resizeOptions.ratio) {
|
||||
newSizes.width = newSizes.height / jQuery.iResize.resizeElement.resizeOptions.ratio;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (newPosition.left + newSizes.width > jQuery.iResize.resizeElement.resizeOptions.maxRight) {
|
||||
newSizes.width = jQuery.iResize.resizeElement.resizeOptions.maxRight - newPosition.left;
|
||||
if (jQuery.iResize.resizeElement.resizeOptions.ratio) {
|
||||
newSizes.height = newSizes.width * jQuery.iResize.resizeElement.resizeOptions.ratio;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
var newDimensions = false;
|
||||
if (jQuery.iResize.resizeElement.resizeOptions.onResize) {
|
||||
newDimensions = jQuery.iResize.resizeElement.resizeOptions.onResize.apply( jQuery.iResize.resizeElement, [ newSizes, newPosition ] );
|
||||
if (newDimensions) {
|
||||
if (newDimensions.sizes) {
|
||||
jQuery.extend(newSizes, newDimensions.sizes);
|
||||
}
|
||||
|
||||
if (newDimensions.position) {
|
||||
jQuery.extend(newPosition, newDimensions.position);
|
||||
}
|
||||
}
|
||||
}
|
||||
elS = jQuery.iResize.resizeElement.style;
|
||||
elS.left = newPosition.left + 'px';
|
||||
elS.top = newPosition.top + 'px';
|
||||
elS.width = newSizes.width + 'px';
|
||||
elS.height = newSizes.height + 'px';
|
||||
|
||||
return false;
|
||||
},
|
||||
/**
|
||||
* Builds the resizable
|
||||
*/
|
||||
build: function(options) {
|
||||
if (!options || !options.handlers || options.handlers.constructor != Object) {
|
||||
return;
|
||||
}
|
||||
|
||||
return this.each(
|
||||
function() {
|
||||
var el = this;
|
||||
el.resizeOptions = options;
|
||||
el.resizeOptions.minWidth = options.minWidth || 10;
|
||||
el.resizeOptions.minHeight = options.minHeight || 10;
|
||||
el.resizeOptions.maxWidth = options.maxWidth || 3000;
|
||||
el.resizeOptions.maxHeight = options.maxHeight || 3000;
|
||||
el.resizeOptions.minTop = options.minTop || -1000;
|
||||
el.resizeOptions.minLeft = options.minLeft || -1000;
|
||||
el.resizeOptions.maxRight = options.maxRight || 3000;
|
||||
el.resizeOptions.maxBottom = options.maxBottom || 3000;
|
||||
elPosition = jQuery(el).css('position');
|
||||
if (!(elPosition == 'relative' || elPosition == 'absolute')) {
|
||||
el.style.position = 'relative';
|
||||
}
|
||||
|
||||
directions = /n|ne|e|se|s|sw|w|nw/g;
|
||||
for (i in el.resizeOptions.handlers) {
|
||||
if (i.toLowerCase().match(directions) != null) {
|
||||
if (el.resizeOptions.handlers[i].constructor == String) {
|
||||
handle = jQuery(el.resizeOptions.handlers[i]);
|
||||
if (handle.size() > 0) {
|
||||
el.resizeOptions.handlers[i] = handle.get(0);
|
||||
}
|
||||
}
|
||||
|
||||
if (el.resizeOptions.handlers[i].tagName) {
|
||||
el.resizeOptions.handlers[i].resizeElement = el;
|
||||
el.resizeOptions.handlers[i].resizeDirection = i;
|
||||
jQuery(el.resizeOptions.handlers[i]).bind('mousedown', jQuery.iResize.start);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (el.resizeOptions.dragHandle) {
|
||||
if (typeof el.resizeOptions.dragHandle === 'string') {
|
||||
handleEl = jQuery(el.resizeOptions.dragHandle);
|
||||
if (handleEl.size() > 0) {
|
||||
handleEl.each(function() {
|
||||
this.dragEl = el;
|
||||
});
|
||||
handleEl.bind('mousedown', jQuery.iResize.startDrag);
|
||||
}
|
||||
} else if (el.resizeOptions.dragHandle == true) {
|
||||
jQuery(this).bind('mousedown', jQuery.iResize.startDrag);
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
},
|
||||
|
||||
/**
|
||||
* Destroys the resizable
|
||||
*/
|
||||
destroy: function() {
|
||||
return this.each(
|
||||
function() {
|
||||
var el = this;
|
||||
|
||||
// Unbind the handlers
|
||||
for (i in el.resizeOptions.handlers) {
|
||||
el.resizeOptions.handlers[i].resizeElement = null;
|
||||
el.resizeOptions.handlers[i].resizeDirection = null;
|
||||
jQuery(el.resizeOptions.handlers[i]).unbind('mousedown', jQuery.iResize.start);
|
||||
}
|
||||
|
||||
// Remove the draghandle
|
||||
if (el.resizeOptions.dragHandle) {
|
||||
if (typeof el.resizeOptions.dragHandle === 'string') {
|
||||
handle = jQuery(el.resizeOptions.dragHandle);
|
||||
if (handle.size() > 0) {
|
||||
handle.unbind('mousedown', jQuery.iResize.startDrag);
|
||||
}
|
||||
} else if (el.resizeOptions.dragHandle == true) {
|
||||
jQuery(this).unbind('mousedown', jQuery.iResize.startDrag);
|
||||
}
|
||||
}
|
||||
|
||||
// Reset the options
|
||||
el.resizeOptions = null;
|
||||
}
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
jQuery.fn.extend ({
|
||||
/**
|
||||
* Create a resizable element with a number of advanced options including callback, dragging
|
||||
*
|
||||
* @name Resizable
|
||||
* @description Create a resizable element with a number of advanced options including callback, dragging
|
||||
* @param Hash hash A hash of parameters. All parameters are optional.
|
||||
* @option Hash handlers hash with keys for each resize direction (e, es, s, sw, w, nw, n) and value string selection
|
||||
* @option Integer minWidth (optional) the minimum width that element can be resized to
|
||||
* @option Integer maxWidth (optional) the maximum width that element can be resized to
|
||||
* @option Integer minHeight (optional) the minimum height that element can be resized to
|
||||
* @option Integer maxHeight (optional) the maximum height that element can be resized to
|
||||
* @option Integer minTop (optional) the minmum top position to wich element can be moved to
|
||||
* @option Integer minLeft (optional) the minmum left position to wich element can be moved to
|
||||
* @option Integer maxRight (optional) the maximum right position to wich element can be moved to
|
||||
* @option Integer maxBottom (optional) the maximum bottom position to wich element can be moved to
|
||||
* @option Float ratio (optional) the ratio between width and height to constrain elements sizes to that ratio
|
||||
* @option Mixed dragHandle (optional) true to make the element draggable, string selection for drag handle
|
||||
* @option Function onDragStart (optional) A function to be executed whenever the dragging starts
|
||||
* @option Function onDragStop (optional) A function to be executed whenever the dragging stops
|
||||
* @option Function onDrag (optional) A function to be executed whenever the element is dragged
|
||||
* @option Function onStart (optional) A function to be executed whenever the element starts to be resized
|
||||
* @option Function onStop (optional) A function to be executed whenever the element stops to be resized
|
||||
* @option Function onResize (optional) A function to be executed whenever the element is resized
|
||||
* @type jQuery
|
||||
* @cat Plugins/Interface
|
||||
* @author Stefan Petre
|
||||
*/
|
||||
Resizable: jQuery.iResize.build,
|
||||
ResizableRatio: jQuery.iResize.ResizeRatio,
|
||||
ResizeConstraint: jQuery.iResize.ResizeConstraint,
|
||||
/**
|
||||
* Destroy a resizable
|
||||
*
|
||||
* @name ResizableDestroy
|
||||
* @description Destroy a resizable
|
||||
* @type jQuery
|
||||
* @cat Plugins/Interface
|
||||
* @author Stefan Petre
|
||||
*/
|
||||
ResizableDestroy: jQuery.iResize.destroy
|
||||
});
|
||||