mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
MINOR: Fixed newlines and set svn:eol-style to native
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@79474 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
d82ba048bf
commit
1dd80edb8a
@ -1,265 +1,265 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* This Controller handles all operation needed for ImageEditor to work(expect for GD operations).
|
* This Controller handles all operation needed for ImageEditor to work(expect for GD operations).
|
||||||
* @package cms
|
* @package cms
|
||||||
* @subpackage assets
|
* @subpackage assets
|
||||||
*/
|
*/
|
||||||
class ImageEditor extends Controller {
|
class ImageEditor extends Controller {
|
||||||
|
|
||||||
static $allowed_actions = array(
|
static $allowed_actions = array(
|
||||||
'*' => 'CMS_ACCESS_CMSMain'
|
'*' => 'CMS_ACCESS_CMSMain'
|
||||||
);
|
);
|
||||||
|
|
||||||
public $fileToEdit = "";
|
public $fileToEdit = "";
|
||||||
|
|
||||||
public $fileToEditOnlyName = "";
|
public $fileToEditOnlyName = "";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Includes all JS required for ImageEditor. This method requires setting
|
* Includes all JS required for ImageEditor. This method requires setting
|
||||||
* a fileToEdit URL in POST.
|
* a fileToEdit URL in POST.
|
||||||
*
|
*
|
||||||
* @return String
|
* @return String
|
||||||
*/
|
*/
|
||||||
public function index() {
|
public function index() {
|
||||||
Requirements::clear();
|
Requirements::clear();
|
||||||
Requirements::javascript(THIRDPARTY_DIR . '/prototype.js');
|
Requirements::javascript(THIRDPARTY_DIR . '/prototype.js');
|
||||||
Requirements::javascript(THIRDPARTY_DIR . '/scriptaculous/scriptaculous.js');
|
Requirements::javascript(THIRDPARTY_DIR . '/scriptaculous/scriptaculous.js');
|
||||||
Requirements::javascript(CMS_DIR . '/javascript/ImageEditor/Utils.js');
|
Requirements::javascript(CMS_DIR . '/javascript/ImageEditor/Utils.js');
|
||||||
//Requirements::javascript(CMS_DIR . '/javascript/ImageEditor/ImageHistory.js');
|
//Requirements::javascript(CMS_DIR . '/javascript/ImageEditor/ImageHistory.js');
|
||||||
Requirements::javascript(CMS_DIR . '/javascript/ImageEditor/Image.js');
|
Requirements::javascript(CMS_DIR . '/javascript/ImageEditor/Image.js');
|
||||||
//Requirements::javascript(CMS_DIR . '/javascript/ImageEditor/ImageTransformation.js');
|
//Requirements::javascript(CMS_DIR . '/javascript/ImageEditor/ImageTransformation.js');
|
||||||
Requirements::javascript(CMS_DIR . '/javascript/ImageEditor/Resizeable.js');
|
Requirements::javascript(CMS_DIR . '/javascript/ImageEditor/Resizeable.js');
|
||||||
Requirements::javascript(CMS_DIR . '/javascript/ImageEditor/Effects.js');
|
Requirements::javascript(CMS_DIR . '/javascript/ImageEditor/Effects.js');
|
||||||
Requirements::javascript(CMS_DIR . '/javascript/ImageEditor/Environment.js');
|
Requirements::javascript(CMS_DIR . '/javascript/ImageEditor/Environment.js');
|
||||||
Requirements::javascript(CMS_DIR . '/javascript/ImageEditor/Crop.js');
|
Requirements::javascript(CMS_DIR . '/javascript/ImageEditor/Crop.js');
|
||||||
Requirements::javascript(CMS_DIR . '/javascript/ImageEditor/Resize.js');
|
Requirements::javascript(CMS_DIR . '/javascript/ImageEditor/Resize.js');
|
||||||
Requirements::javascript(CMS_DIR . '/javascript/ImageEditor/ImageBox.js');
|
Requirements::javascript(CMS_DIR . '/javascript/ImageEditor/ImageBox.js');
|
||||||
Requirements::javascript(CMS_DIR . '/javascript/ImageEditor/ImageEditor.js');
|
Requirements::javascript(CMS_DIR . '/javascript/ImageEditor/ImageEditor.js');
|
||||||
Requirements::javascript(CMS_DIR . '/javascript/ImageEditor/DocumentBody.js');
|
Requirements::javascript(CMS_DIR . '/javascript/ImageEditor/DocumentBody.js');
|
||||||
|
|
||||||
Requirements::javascript(THIRDPARTY_DIR . '/loader.js');
|
Requirements::javascript(THIRDPARTY_DIR . '/loader.js');
|
||||||
Requirements::javascript(THIRDPARTY_DIR . '/behaviour.js');
|
Requirements::javascript(THIRDPARTY_DIR . '/behaviour.js');
|
||||||
Requirements::javascript(CMS_DIR . '/javascript/LeftAndMain.js');
|
Requirements::javascript(CMS_DIR . '/javascript/LeftAndMain.js');
|
||||||
Requirements::css(CMS_DIR . 'css/ImageEditor/ImageEditor.css');
|
Requirements::css(CMS_DIR . 'css/ImageEditor/ImageEditor.css');
|
||||||
|
|
||||||
if(!isset($this->requestParams['fileToEdit'])) $this->raiseError();
|
if(!isset($this->requestParams['fileToEdit'])) $this->raiseError();
|
||||||
$fileWithPath = $this->requestParams['fileToEdit'];
|
$fileWithPath = $this->requestParams['fileToEdit'];
|
||||||
$this->fileToEdit = $this->file2Origin($fileWithPath);
|
$this->fileToEdit = $this->file2Origin($fileWithPath);
|
||||||
$this->fileToEditOnlyName = $this->urlToFilename($this->fileToEdit);
|
$this->fileToEditOnlyName = $this->urlToFilename($this->fileToEdit);
|
||||||
return $this->renderWith(__CLASS__);
|
return $this->renderWith(__CLASS__);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method is used for manipulating photos.
|
* Method is used for manipulating photos.
|
||||||
* Method requires two params set in POST
|
* Method requires two params set in POST
|
||||||
* file - file on which operation will be performed
|
* file - file on which operation will be performed
|
||||||
* command - name of operation(crop|rotate|resize)
|
* command - name of operation(crop|rotate|resize)
|
||||||
*
|
*
|
||||||
* Each operation requires additional parameters.
|
* Each operation requires additional parameters.
|
||||||
*
|
*
|
||||||
* @return String - JSON array with image properties (width,height,url).
|
* @return String - JSON array with image properties (width,height,url).
|
||||||
*/
|
*/
|
||||||
public function manipulate() {
|
public function manipulate() {
|
||||||
$fileName = $this->requestParams['file'];
|
$fileName = $this->requestParams['file'];
|
||||||
if(strpos($fileName,'?') !== false) $fileName = substr($fileName,0,strpos($fileName,'?'));
|
if(strpos($fileName,'?') !== false) $fileName = substr($fileName,0,strpos($fileName,'?'));
|
||||||
$command = $this->requestParams['command'];
|
$command = $this->requestParams['command'];
|
||||||
$this->checkFileExists($fileName);
|
$this->checkFileExists($fileName);
|
||||||
$fileInfo = pathinfo($fileName);
|
$fileInfo = pathinfo($fileName);
|
||||||
$gd = new GD($this->url2File($fileName));
|
$gd = new GD($this->url2File($fileName));
|
||||||
switch($command) {
|
switch($command) {
|
||||||
case 'rotate':
|
case 'rotate':
|
||||||
$gd = $gd->rotate(90);
|
$gd = $gd->rotate(90);
|
||||||
break;
|
break;
|
||||||
case 'resize':
|
case 'resize':
|
||||||
$imageNewWidth = $_POST['newImageWidth'];
|
$imageNewWidth = $_POST['newImageWidth'];
|
||||||
$imageNewHeight = $_POST['newImageHeight'];
|
$imageNewHeight = $_POST['newImageHeight'];
|
||||||
$gd = $gd->resize($imageNewWidth,$imageNewHeight);
|
$gd = $gd->resize($imageNewWidth,$imageNewHeight);
|
||||||
break;
|
break;
|
||||||
case 'crop':
|
case 'crop':
|
||||||
$top = $_POST['top'];
|
$top = $_POST['top'];
|
||||||
$left = $_POST['left'];
|
$left = $_POST['left'];
|
||||||
$width = $_POST['width'];
|
$width = $_POST['width'];
|
||||||
$height = $_POST['height'];
|
$height = $_POST['height'];
|
||||||
$gd = $gd->crop($top,$left,$width,$height);
|
$gd = $gd->crop($top,$left,$width,$height);
|
||||||
break;
|
break;
|
||||||
case 'greyscale':
|
case 'greyscale':
|
||||||
$gd = $gd->greyscale();
|
$gd = $gd->greyscale();
|
||||||
break;
|
break;
|
||||||
case 'sepia':
|
case 'sepia':
|
||||||
$gd = $gd->sepia();
|
$gd = $gd->sepia();
|
||||||
break;
|
break;
|
||||||
case 'blur':
|
case 'blur':
|
||||||
$gd = $gd->blur();
|
$gd = $gd->blur();
|
||||||
break;
|
break;
|
||||||
case 'adjust-contrast':
|
case 'adjust-contrast':
|
||||||
$value = intval($_POST['value']);
|
$value = intval($_POST['value']);
|
||||||
$gd = $gd->contrast($value);
|
$gd = $gd->contrast($value);
|
||||||
break;
|
break;
|
||||||
case 'adjust-brightness':
|
case 'adjust-brightness':
|
||||||
$value = intval($_POST['value']);
|
$value = intval($_POST['value']);
|
||||||
$gd = $gd->brightness($value);
|
$gd = $gd->brightness($value);
|
||||||
break;
|
break;
|
||||||
case 'adjust-gamma':
|
case 'adjust-gamma':
|
||||||
$value = floatval($_POST['value']);
|
$value = floatval($_POST['value']);
|
||||||
$gd = $gd->gamma($value);
|
$gd = $gd->gamma($value);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$rand = md5(rand(1,100000));
|
$rand = md5(rand(1,100000));
|
||||||
$gd->writeTo(ASSETS_PATH . '/_tmp/' . $rand . '.' . $fileInfo['extension']);
|
$gd->writeTo(ASSETS_PATH . '/_tmp/' . $rand . '.' . $fileInfo['extension']);
|
||||||
return $this->getImageInfoInJSON($gd,ASSETS_PATH . '/_tmp/' . $rand . '.' . $fileInfo['extension']);
|
return $this->getImageInfoInJSON($gd,ASSETS_PATH . '/_tmp/' . $rand . '.' . $fileInfo['extension']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method is used for saving photos.
|
* Method is used for saving photos.
|
||||||
* Method requires two params set in POST
|
* Method requires two params set in POST
|
||||||
* originalFile - this file will be replaced by second file
|
* originalFile - this file will be replaced by second file
|
||||||
* editedFile - this file will replace first file.
|
* editedFile - this file will replace first file.
|
||||||
*
|
*
|
||||||
* After replacing original file all thumbnails created from it are removed.
|
* After replacing original file all thumbnails created from it are removed.
|
||||||
*
|
*
|
||||||
* @return String - Message that everything went ok.
|
* @return String - Message that everything went ok.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public function save() {
|
public function save() {
|
||||||
if(isset($this->requestParams['originalFile']) && isset($this->requestParams['editedFile'])) {
|
if(isset($this->requestParams['originalFile']) && isset($this->requestParams['editedFile'])) {
|
||||||
$originalFile = $this->requestParams['originalFile'];
|
$originalFile = $this->requestParams['originalFile'];
|
||||||
$editedFile = $this->requestParams['editedFile'];
|
$editedFile = $this->requestParams['editedFile'];
|
||||||
if(strpos($originalFile,'?') !== false) $originalFile = substr($originalFile,0,strpos($originalFile,'?'));
|
if(strpos($originalFile,'?') !== false) $originalFile = substr($originalFile,0,strpos($originalFile,'?'));
|
||||||
if($this->checkFileExists($originalFile) && $this->checkFileExists($editedFile)) {
|
if($this->checkFileExists($originalFile) && $this->checkFileExists($editedFile)) {
|
||||||
if($editedFile != $originalFile && copy($this->url2File($editedFile),$this->url2File($originalFile))) {
|
if($editedFile != $originalFile && copy($this->url2File($editedFile),$this->url2File($originalFile))) {
|
||||||
$image = DataObject::get_one('File','"Filename" = \'' . substr($this->url2File($originalFile),3) . '\'');
|
$image = DataObject::get_one('File','"Filename" = \'' . substr($this->url2File($originalFile),3) . '\'');
|
||||||
$image->deleteFormattedImages();
|
$image->deleteFormattedImages();
|
||||||
$image->generateFormattedImage('AssetLibraryPreview');
|
$image->generateFormattedImage('AssetLibraryPreview');
|
||||||
} else {
|
} else {
|
||||||
$this->raiseError();
|
$this->raiseError();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$this->raiseError();
|
$this->raiseError();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$this->raiseError();
|
$this->raiseError();
|
||||||
}
|
}
|
||||||
return 'parent.parent.parent.statusMessage(\'Image saved\',\'good\',false);';
|
return 'parent.parent.parent.statusMessage(\'Image saved\',\'good\',false);';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method is invoked when ImageEditor is closed whether image is saved or not.
|
* Method is invoked when ImageEditor is closed whether image is saved or not.
|
||||||
*
|
*
|
||||||
* /assets/tmp is folder where we store temporary images created during editing so
|
* /assets/tmp is folder where we store temporary images created during editing so
|
||||||
* after closing they are no necessity to keep them.
|
* after closing they are no necessity to keep them.
|
||||||
*
|
*
|
||||||
* @return null
|
* @return null
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public function close() {
|
public function close() {
|
||||||
$tmpDir = ASSETS_PATH . '/_tmp';
|
$tmpDir = ASSETS_PATH . '/_tmp';
|
||||||
if(file_exists($tmpDir)) {
|
if(file_exists($tmpDir)) {
|
||||||
Filesystem::removeFolder($tmpDir);
|
Filesystem::removeFolder($tmpDir);
|
||||||
mkdir($tmpDir, Filesystem::$folder_create_mask);
|
mkdir($tmpDir, Filesystem::$folder_create_mask);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method return JSON array containing info about image.
|
* Method return JSON array containing info about image.
|
||||||
*
|
*
|
||||||
* @param gd - GD object used for retrieving info about image
|
* @param gd - GD object used for retrieving info about image
|
||||||
* @param file
|
* @param file
|
||||||
*
|
*
|
||||||
* @return string JSON array explained in manipulate method comment
|
* @return string JSON array explained in manipulate method comment
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private function getImageInfoInJSON(GD $gd,$file) {
|
private function getImageInfoInJSON(GD $gd,$file) {
|
||||||
return '{"fileName":"' . $file . '","width":' . $gd->getWidth() . ',"height":' . $gd->getHeight() . '}';
|
return '{"fileName":"' . $file . '","width":' . $gd->getWidth() . ',"height":' . $gd->getHeight() . '}';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method converts thumbnail file name to file name of it's "parent"
|
* Method converts thumbnail file name to file name of it's "parent"
|
||||||
*
|
*
|
||||||
* @param file - name of thumbnail file
|
* @param file - name of thumbnail file
|
||||||
*
|
*
|
||||||
* @return string name of parent file.
|
* @return string name of parent file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private function file2Origin($file) {
|
private function file2Origin($file) {
|
||||||
$file = str_replace('_resampled/','',$file);
|
$file = str_replace('_resampled/','',$file);
|
||||||
$file = str_replace('_resampled/','',$file);
|
$file = str_replace('_resampled/','',$file);
|
||||||
$file = str_replace('AssetLibraryPreview-','',$file);
|
$file = str_replace('AssetLibraryPreview-','',$file);
|
||||||
$this->checkFileExists($file);
|
$this->checkFileExists($file);
|
||||||
return $file;
|
return $file;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Method converts URL of file to file path in file system.
|
* Method converts URL of file to file path in file system.
|
||||||
*
|
*
|
||||||
* @param url - url of file
|
* @param url - url of file
|
||||||
*
|
*
|
||||||
* @return string path of file in file system
|
* @return string path of file in file system
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private function url2File($url) {
|
private function url2File($url) {
|
||||||
return '..' . substr($url,strpos($url,'/assets'));
|
return '..' . substr($url,strpos($url,'/assets'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method checks if file exists and have proper name and extension.
|
* Method checks if file exists and have proper name and extension.
|
||||||
*
|
*
|
||||||
* If any of constraints aren't fulfilled method will generate error.
|
* If any of constraints aren't fulfilled method will generate error.
|
||||||
*
|
*
|
||||||
* @param url - url of file
|
* @param url - url of file
|
||||||
*
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private function checkFileExists($url) {
|
private function checkFileExists($url) {
|
||||||
if(strpos($url,'?') !== false) $url = substr($url,0,strpos($url,'?'));
|
if(strpos($url,'?') !== false) $url = substr($url,0,strpos($url,'?'));
|
||||||
$pathInfo = pathinfo($url);
|
$pathInfo = pathinfo($url);
|
||||||
if(count($pathInfo) < 3) $this->raiseError();
|
if(count($pathInfo) < 3) $this->raiseError();
|
||||||
if(!in_array($pathInfo['extension'],array('jpeg','jpg','jpe','png','gif','JPEG','JPG','JPE','PNG','GIF'))) $this->raiseError();
|
if(!in_array($pathInfo['extension'],array('jpeg','jpg','jpe','png','gif','JPEG','JPG','JPE','PNG','GIF'))) $this->raiseError();
|
||||||
$path = explode('/',$pathInfo['dirname']);
|
$path = explode('/',$pathInfo['dirname']);
|
||||||
if(count($path) > 1) {
|
if(count($path) > 1) {
|
||||||
$assetId = array_search('assets',$path);
|
$assetId = array_search('assets',$path);
|
||||||
if($assetId > 0) {
|
if($assetId > 0) {
|
||||||
$realPath = '../' . implode('/',array_slice($path,$assetId,count($path) - $assetId));
|
$realPath = '../' . implode('/',array_slice($path,$assetId,count($path) - $assetId));
|
||||||
if(strpos($pathInfo['basename'],'AssetLibraryPreview') !== false) {
|
if(strpos($pathInfo['basename'],'AssetLibraryPreview') !== false) {
|
||||||
$realPath .= '/' . substr($pathInfo['basename'],strpos($pathInfo['basename'],'-'));
|
$realPath .= '/' . substr($pathInfo['basename'],strpos($pathInfo['basename'],'-'));
|
||||||
} else {
|
} else {
|
||||||
$realPath .= '/' . $pathInfo['basename'];
|
$realPath .= '/' . $pathInfo['basename'];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$this->raiseError();
|
$this->raiseError();
|
||||||
}
|
}
|
||||||
if(file_exists($realPath)) {
|
if(file_exists($realPath)) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
$this->raiseError();
|
$this->raiseError();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$this->raiseError();
|
$this->raiseError();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method raiser error. Error is showed using statusMessage function.
|
* Method raiser error. Error is showed using statusMessage function.
|
||||||
*
|
*
|
||||||
* @param message - error message
|
* @param message - error message
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private function raiseError($message = "") {
|
private function raiseError($message = "") {
|
||||||
echo "parent.parent.parent.statusMessage('Error: " . $message . "','bad',false);";
|
echo "parent.parent.parent.statusMessage('Error: " . $message . "','bad',false);";
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method converts retrieves filename from url
|
* Method converts retrieves filename from url
|
||||||
*
|
*
|
||||||
* @param url
|
* @param url
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private function urlToFilename($url) {
|
private function urlToFilename($url) {
|
||||||
$path = pathinfo($url);
|
$path = pathinfo($url);
|
||||||
return $path['filename'] . "." . substr($path['extension'],0,strpos($path['extension'],'?'));
|
return $path['filename'] . "." . substr($path['extension'],0,strpos($path['extension'],'?'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
@ -1,525 +1,525 @@
|
|||||||
*
|
*
|
||||||
{
|
{
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
a, a:visited
|
a, a:visited
|
||||||
{
|
{
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
width: 0;
|
width: 0;
|
||||||
height: 0;
|
height: 0;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
}
|
}
|
||||||
|
|
||||||
.clickBox
|
.clickBox
|
||||||
{
|
{
|
||||||
width: 7px;
|
width: 7px;
|
||||||
height: 7px;
|
height: 7px;
|
||||||
background-image: url(../../images/ImageEditor/clickBox.png);
|
background-image: url(../../images/ImageEditor/clickBox.png);
|
||||||
position: absolute;
|
position: absolute;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
.leftUpperClickBox
|
.leftUpperClickBox
|
||||||
{
|
{
|
||||||
cursor: nw-resize;
|
cursor: nw-resize;
|
||||||
}
|
}
|
||||||
|
|
||||||
.leftMiddleClickBox
|
.leftMiddleClickBox
|
||||||
{
|
{
|
||||||
cursor: e-resize;
|
cursor: e-resize;
|
||||||
}
|
}
|
||||||
|
|
||||||
.leftLowerClickBox
|
.leftLowerClickBox
|
||||||
{
|
{
|
||||||
cursor: ne-resize;
|
cursor: ne-resize;
|
||||||
}
|
}
|
||||||
|
|
||||||
.rightUpperClickBox
|
.rightUpperClickBox
|
||||||
{
|
{
|
||||||
cursor: ne-resize;
|
cursor: ne-resize;
|
||||||
}
|
}
|
||||||
|
|
||||||
.rightMiddleClickBox
|
.rightMiddleClickBox
|
||||||
{
|
{
|
||||||
cursor: w-resize;
|
cursor: w-resize;
|
||||||
}
|
}
|
||||||
|
|
||||||
.rightLowerClickBox
|
.rightLowerClickBox
|
||||||
{
|
{
|
||||||
cursor: nw-resize;
|
cursor: nw-resize;
|
||||||
}
|
}
|
||||||
|
|
||||||
.upperMiddleClickBox
|
.upperMiddleClickBox
|
||||||
{
|
{
|
||||||
cursor: n-resize;
|
cursor: n-resize;
|
||||||
}
|
}
|
||||||
|
|
||||||
.lowerMiddleClickBox
|
.lowerMiddleClickBox
|
||||||
{
|
{
|
||||||
cursor: n-resize;
|
cursor: n-resize;
|
||||||
}
|
}
|
||||||
.inline
|
.inline
|
||||||
{
|
{
|
||||||
display: inline;
|
display: inline;
|
||||||
}
|
}
|
||||||
.displayNone
|
.displayNone
|
||||||
{
|
{
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
#imageContainer
|
#imageContainer
|
||||||
{
|
{
|
||||||
position: absolute;
|
position: absolute;
|
||||||
}
|
}
|
||||||
#MenuBar
|
#MenuBar
|
||||||
{
|
{
|
||||||
height: 132px;
|
height: 132px;
|
||||||
background-image: url(../../images/ImageEditor/topLeft.png);
|
background-image: url(../../images/ImageEditor/topLeft.png);
|
||||||
}
|
}
|
||||||
#TopLeft {
|
#TopLeft {
|
||||||
float: left;
|
float: left;
|
||||||
width: 584px;
|
width: 584px;
|
||||||
height: 132px;
|
height: 132px;
|
||||||
background-image: url(../../images/ImageEditor/topLeft.png);
|
background-image: url(../../images/ImageEditor/topLeft.png);
|
||||||
display: inline;
|
display: inline;
|
||||||
}
|
}
|
||||||
#TopRight {
|
#TopRight {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
width: 180px;
|
width: 180px;
|
||||||
height: 132px;
|
height: 132px;
|
||||||
background-image: url(../../images/ImageEditor/topRight.png);
|
background-image: url(../../images/ImageEditor/topRight.png);
|
||||||
}
|
}
|
||||||
|
|
||||||
#image
|
#image
|
||||||
{
|
{
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
.floatLeft
|
.floatLeft
|
||||||
{
|
{
|
||||||
float: left;
|
float: left;
|
||||||
}
|
}
|
||||||
#loadingIndicatorContainer
|
#loadingIndicatorContainer
|
||||||
{
|
{
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: -1000px;
|
top: -1000px;
|
||||||
left: -1000px;
|
left: -1000px;
|
||||||
}
|
}
|
||||||
#loadingIndicatorContainer2
|
#loadingIndicatorContainer2
|
||||||
{
|
{
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: -1000px;
|
top: -1000px;
|
||||||
left: -1000px;
|
left: -1000px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#fakeImg
|
#fakeImg
|
||||||
{
|
{
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
#cropBox
|
#cropBox
|
||||||
{
|
{
|
||||||
position: absolute;
|
position: absolute;
|
||||||
display: inline;
|
display: inline;
|
||||||
}
|
}
|
||||||
.greyBox
|
.greyBox
|
||||||
{
|
{
|
||||||
background-color: black;
|
background-color: black;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
opacity: .5;
|
opacity: .5;
|
||||||
filter: alpha(opacity=50);
|
filter: alpha(opacity=50);
|
||||||
overflow:hidden;
|
overflow:hidden;
|
||||||
}
|
}
|
||||||
body
|
body
|
||||||
{
|
{
|
||||||
height: 100%;
|
height: 100%;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
#Main
|
#Main
|
||||||
{
|
{
|
||||||
position: absolute;
|
position: absolute;
|
||||||
border-color: black;
|
border-color: black;
|
||||||
border-style: solid;
|
border-style: solid;
|
||||||
height: 95%;
|
height: 95%;
|
||||||
width: 99%;
|
width: 99%;
|
||||||
background-color: white;
|
background-color: white;
|
||||||
}
|
}
|
||||||
#imageEditorContainer
|
#imageEditorContainer
|
||||||
{
|
{
|
||||||
position: relative;
|
position: relative;
|
||||||
top: 15px;
|
top: 15px;
|
||||||
left: 15px;
|
left: 15px;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
background-image: url(../../images/ImageEditor/back.png);
|
background-image: url(../../images/ImageEditor/back.png);
|
||||||
}
|
}
|
||||||
#Actions
|
#Actions
|
||||||
{
|
{
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 10px;
|
left: 10px;
|
||||||
top: 38px;
|
top: 38px;
|
||||||
width: 211px;
|
width: 211px;
|
||||||
height: 73px;
|
height: 73px;
|
||||||
background-image: url(../../images/ImageEditor/c1.png);
|
background-image: url(../../images/ImageEditor/c1.png);
|
||||||
}
|
}
|
||||||
#SaveText
|
#SaveText
|
||||||
{
|
{
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 40px;
|
top: 40px;
|
||||||
left: 13px;
|
left: 13px;
|
||||||
}
|
}
|
||||||
#SaveIcon
|
#SaveIcon
|
||||||
{
|
{
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 33px;
|
left: 33px;
|
||||||
top: 10px;
|
top: 10px;
|
||||||
width: 30px;
|
width: 30px;
|
||||||
height: 30px;
|
height: 30px;
|
||||||
background-image: url(../../images/ImageEditor/c1Save.png);
|
background-image: url(../../images/ImageEditor/c1Save.png);
|
||||||
cursor: hand;/* IE Hack, because <a> have 0 width/height.*/
|
cursor: hand;/* IE Hack, because <a> have 0 width/height.*/
|
||||||
}
|
}
|
||||||
#ExitText
|
#ExitText
|
||||||
{
|
{
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 40px;
|
top: 40px;
|
||||||
left: 95px;
|
left: 95px;
|
||||||
}
|
}
|
||||||
#ExitIcon
|
#ExitIcon
|
||||||
{
|
{
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 97px;
|
left: 97px;
|
||||||
top: 15px;
|
top: 15px;
|
||||||
width: 26px;
|
width: 26px;
|
||||||
height: 26px;
|
height: 26px;
|
||||||
background-image: url(../../images/ImageEditor/c1Exit.png);
|
background-image: url(../../images/ImageEditor/c1Exit.png);
|
||||||
cursor: hand;/* IE Hack, because <a> have 0 width/height.*/
|
cursor: hand;/* IE Hack, because <a> have 0 width/height.*/
|
||||||
}
|
}
|
||||||
#UndoText
|
#UndoText
|
||||||
{
|
{
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 14px;
|
top: 14px;
|
||||||
left: 175px;
|
left: 175px;
|
||||||
}
|
}
|
||||||
#UndoIcon
|
#UndoIcon
|
||||||
{
|
{
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 145px;
|
left: 145px;
|
||||||
top: 15px;
|
top: 15px;
|
||||||
width: 24px;
|
width: 24px;
|
||||||
height: 14px;
|
height: 14px;
|
||||||
background-image: url(../../images/ImageEditor/c1Undo.png);
|
background-image: url(../../images/ImageEditor/c1Undo.png);
|
||||||
background-repeat: no-repeat;/* IE hack */
|
background-repeat: no-repeat;/* IE hack */
|
||||||
cursor: hand;/* IE Hack, because <a> have 0 width/height.*/
|
cursor: hand;/* IE Hack, because <a> have 0 width/height.*/
|
||||||
}
|
}
|
||||||
#RedoText
|
#RedoText
|
||||||
{
|
{
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 38px;
|
top: 38px;
|
||||||
left: 175px;
|
left: 175px;
|
||||||
}
|
}
|
||||||
#RedoIcon
|
#RedoIcon
|
||||||
{
|
{
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 143px;
|
left: 143px;
|
||||||
top: 38px;
|
top: 38px;
|
||||||
width: 25px;
|
width: 25px;
|
||||||
height: 13px;
|
height: 13px;
|
||||||
background-image: url(../../images/ImageEditor/c1Redo.png);
|
background-image: url(../../images/ImageEditor/c1Redo.png);
|
||||||
background-repeat: no-repeat;/* IE hack */
|
background-repeat: no-repeat;/* IE hack */
|
||||||
cursor: hand;/* IE Hack, because <a> have width/height.*/
|
cursor: hand;/* IE Hack, because <a> have width/height.*/
|
||||||
}
|
}
|
||||||
#ActionsDescription
|
#ActionsDescription
|
||||||
{
|
{
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 57px;
|
top: 57px;
|
||||||
left: 85px;
|
left: 85px;
|
||||||
}
|
}
|
||||||
.menuText
|
.menuText
|
||||||
{
|
{
|
||||||
color: #6C889E;
|
color: #6C889E;
|
||||||
font-family: sans-serif;
|
font-family: sans-serif;
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
}
|
}
|
||||||
#Functions
|
#Functions
|
||||||
{
|
{
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 480px;
|
left: 480px;
|
||||||
top: 38px;
|
top: 38px;
|
||||||
height: 73px;
|
height: 73px;
|
||||||
width: 220px;
|
width: 220px;
|
||||||
background-image: url(../../images/ImageEditor/c2.png);
|
background-image: url(../../images/ImageEditor/c2.png);
|
||||||
}
|
}
|
||||||
#RotateIcon
|
#RotateIcon
|
||||||
{
|
{
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 17px;
|
left: 17px;
|
||||||
top: 11px;
|
top: 11px;
|
||||||
height: 26px;
|
height: 26px;
|
||||||
width: 30px;
|
width: 30px;
|
||||||
background-image: url(../../images/ImageEditor/c2Rotate.png);
|
background-image: url(../../images/ImageEditor/c2Rotate.png);
|
||||||
cursor: hand;/* IE Hack, because <a> have width/height.*/
|
cursor: hand;/* IE Hack, because <a> have width/height.*/
|
||||||
}
|
}
|
||||||
#RotateText
|
#RotateText
|
||||||
{
|
{
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 39px;
|
top: 39px;
|
||||||
left: 15px;
|
left: 15px;
|
||||||
}
|
}
|
||||||
#CropIcon
|
#CropIcon
|
||||||
{
|
{
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 66px;
|
left: 66px;
|
||||||
top: 11px;
|
top: 11px;
|
||||||
height: 28px;
|
height: 28px;
|
||||||
width: 31px;
|
width: 31px;
|
||||||
background-image: url(../../images/ImageEditor/c2Crop.png);
|
background-image: url(../../images/ImageEditor/c2Crop.png);
|
||||||
cursor: hand;/* IE Hack, because <a> have width/height.*/
|
cursor: hand;/* IE Hack, because <a> have width/height.*/
|
||||||
|
|
||||||
}
|
}
|
||||||
#CropText
|
#CropText
|
||||||
{
|
{
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 38px;
|
top: 38px;
|
||||||
left: 67px;
|
left: 67px;
|
||||||
}
|
}
|
||||||
#ImageWidthLabel
|
#ImageWidthLabel
|
||||||
{
|
{
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 11px;
|
top: 11px;
|
||||||
left: 114px;
|
left: 114px;
|
||||||
}
|
}
|
||||||
#ImageHeightLabel
|
#ImageHeightLabel
|
||||||
{
|
{
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 33px;
|
top: 33px;
|
||||||
left: 114px;
|
left: 114px;
|
||||||
}
|
}
|
||||||
#ImageWidth
|
#ImageWidth
|
||||||
{
|
{
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 14px;
|
top: 14px;
|
||||||
left: 157px;
|
left: 157px;
|
||||||
color: #7A7D80;
|
color: #7A7D80;
|
||||||
font-size: 9px;
|
font-size: 9px;
|
||||||
|
|
||||||
}
|
}
|
||||||
#ImageHeight
|
#ImageHeight
|
||||||
{
|
{
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 36px;
|
top: 36px;
|
||||||
left: 157px;
|
left: 157px;
|
||||||
color: #7A7D80;
|
color: #7A7D80;
|
||||||
font-size: 9px;
|
font-size: 9px;
|
||||||
}
|
}
|
||||||
#FunctionsDescription
|
#FunctionsDescription
|
||||||
{
|
{
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 57px;
|
top: 57px;
|
||||||
left: 70px;
|
left: 70px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#TopRuler
|
#TopRuler
|
||||||
{
|
{
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 38px;
|
top: 38px;
|
||||||
left: 720px;
|
left: 720px;
|
||||||
width: 106px;
|
width: 106px;
|
||||||
height: 73px;
|
height: 73px;
|
||||||
background-image: url(../../images/ImageEditor/c3.png);
|
background-image: url(../../images/ImageEditor/c3.png);
|
||||||
}
|
}
|
||||||
#LeftRuler
|
#LeftRuler
|
||||||
{
|
{
|
||||||
position: absolute;
|
position: absolute;
|
||||||
width: 15px;
|
width: 15px;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
top: 147px;
|
top: 147px;
|
||||||
background-image: url(../../images/ImageEditor/leftRuler.png);
|
background-image: url(../../images/ImageEditor/leftRuler.png);
|
||||||
}
|
}
|
||||||
#Effects
|
#Effects
|
||||||
{
|
{
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 240px;
|
left: 240px;
|
||||||
top: 38px;
|
top: 38px;
|
||||||
height: 73px;
|
height: 73px;
|
||||||
width: 220px;
|
width: 220px;
|
||||||
z-index: 1234;
|
z-index: 1234;
|
||||||
background-image: url(../../images/ImageEditor/c4.png);
|
background-image: url(../../images/ImageEditor/c4.png);
|
||||||
}
|
}
|
||||||
#GreyscaleText
|
#GreyscaleText
|
||||||
{
|
{
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 42px;
|
top: 42px;
|
||||||
left: 7px;
|
left: 7px;
|
||||||
}
|
}
|
||||||
#SepiaText
|
#SepiaText
|
||||||
{
|
{
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 42px;
|
top: 42px;
|
||||||
left: 70px;
|
left: 70px;
|
||||||
}
|
}
|
||||||
#BlurText
|
#BlurText
|
||||||
{
|
{
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 42px;
|
top: 42px;
|
||||||
left: 125px;
|
left: 125px;
|
||||||
}
|
}
|
||||||
#AdjustText
|
#AdjustText
|
||||||
{
|
{
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 42px;
|
top: 42px;
|
||||||
left: 173px;
|
left: 173px;
|
||||||
}
|
}
|
||||||
#AdjustMenu
|
#AdjustMenu
|
||||||
{
|
{
|
||||||
position: absolute;
|
position: absolute;
|
||||||
width: 211px;
|
width: 211px;
|
||||||
height: 74px;
|
height: 74px;
|
||||||
background-color: rgb(201, 229, 232);
|
background-color: rgb(201, 229, 232);
|
||||||
top: 60px;
|
top: 60px;
|
||||||
left: 5px;
|
left: 5px;
|
||||||
z-index: 1234;
|
z-index: 1234;
|
||||||
background-image: url(../../images/ImageEditor/c1.png);
|
background-image: url(../../images/ImageEditor/c1.png);
|
||||||
}
|
}
|
||||||
#AdjustMenuDescription
|
#AdjustMenuDescription
|
||||||
{
|
{
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 57px;
|
top: 57px;
|
||||||
left: 85px;
|
left: 85px;
|
||||||
}
|
}
|
||||||
.sliderTrack
|
.sliderTrack
|
||||||
{
|
{
|
||||||
width: 86px;
|
width: 86px;
|
||||||
height: 6px;
|
height: 6px;
|
||||||
left: 95px;
|
left: 95px;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
background-image: url(../../images/ImageEditor/slider2.png);
|
background-image: url(../../images/ImageEditor/slider2.png);
|
||||||
}
|
}
|
||||||
.sliderTrackHandler
|
.sliderTrackHandler
|
||||||
{
|
{
|
||||||
width: 13px;
|
width: 13px;
|
||||||
height: 11px;
|
height: 11px;
|
||||||
top: -2px;
|
top: -2px;
|
||||||
cursor:move;
|
cursor:move;
|
||||||
background-image: url(../../images/ImageEditor/slider.png);
|
background-image: url(../../images/ImageEditor/slider.png);
|
||||||
}
|
}
|
||||||
#AdjustMenuContrastSliderTrack
|
#AdjustMenuContrastSliderTrack
|
||||||
{
|
{
|
||||||
top: 8px;
|
top: 8px;
|
||||||
}
|
}
|
||||||
.effectDescription
|
.effectDescription
|
||||||
{
|
{
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 15px;
|
left: 15px;
|
||||||
}
|
}
|
||||||
#AdjustMenuConstrastDescription
|
#AdjustMenuConstrastDescription
|
||||||
{
|
{
|
||||||
top: 2px;
|
top: 2px;
|
||||||
}
|
}
|
||||||
#AdjustMenuBrightnessSliderTrack
|
#AdjustMenuBrightnessSliderTrack
|
||||||
{
|
{
|
||||||
top: 25px;
|
top: 25px;
|
||||||
}
|
}
|
||||||
#AdjustMenuBrightnessDescription
|
#AdjustMenuBrightnessDescription
|
||||||
{
|
{
|
||||||
top: 22px;
|
top: 22px;
|
||||||
}
|
}
|
||||||
#AdjustMenuGammaSliderTrack
|
#AdjustMenuGammaSliderTrack
|
||||||
{
|
{
|
||||||
top: 42px;
|
top: 42px;
|
||||||
}
|
}
|
||||||
#AdjustMenuGammaDescription
|
#AdjustMenuGammaDescription
|
||||||
{
|
{
|
||||||
top: 42px;
|
top: 42px;
|
||||||
}
|
}
|
||||||
#EffectsDescription
|
#EffectsDescription
|
||||||
{
|
{
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 58px;
|
top: 58px;
|
||||||
left: 90px;
|
left: 90px;
|
||||||
}
|
}
|
||||||
#Filename p
|
#Filename p
|
||||||
{
|
{
|
||||||
position: absolute;
|
position: absolute;
|
||||||
color: white;
|
color: white;
|
||||||
left: 20px;
|
left: 20px;
|
||||||
top: 7px;
|
top: 7px;
|
||||||
font-family: sans-serif;
|
font-family: sans-serif;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#CurrentAction
|
#CurrentAction
|
||||||
{
|
{
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 38px;
|
top: 38px;
|
||||||
left: 479px;
|
left: 479px;
|
||||||
width: 106px;
|
width: 106px;
|
||||||
height: 73px;
|
height: 73px;
|
||||||
background-image: url(../../images/ImageEditor/c3.png);
|
background-image: url(../../images/ImageEditor/c3.png);
|
||||||
}
|
}
|
||||||
#ApplyIcon
|
#ApplyIcon
|
||||||
{
|
{
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left:59px;
|
left:59px;
|
||||||
top: 14px;
|
top: 14px;
|
||||||
width: 24px;
|
width: 24px;
|
||||||
height: 23px;
|
height: 23px;
|
||||||
background-image: url(../../images/ImageEditor/c3Apply.png);
|
background-image: url(../../images/ImageEditor/c3Apply.png);
|
||||||
}
|
}
|
||||||
#ApplyText
|
#ApplyText
|
||||||
{
|
{
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 39px;
|
top: 39px;
|
||||||
left: 57px;
|
left: 57px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#CancelIcon
|
#CancelIcon
|
||||||
{
|
{
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left:18px;
|
left:18px;
|
||||||
top: 13px;
|
top: 13px;
|
||||||
width: 26px;
|
width: 26px;
|
||||||
height: 25px;
|
height: 25px;
|
||||||
background-image: url(../../images/ImageEditor/c3Cancel.png);
|
background-image: url(../../images/ImageEditor/c3Cancel.png);
|
||||||
}
|
}
|
||||||
#CancelText
|
#CancelText
|
||||||
{
|
{
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 39px;
|
top: 39px;
|
||||||
left: 12px;
|
left: 12px;
|
||||||
}
|
}
|
||||||
#CurrentActionDescription
|
#CurrentActionDescription
|
||||||
{
|
{
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 57px;
|
top: 57px;
|
||||||
left: 12px;
|
left: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Status, Directly copied from cms_right.css
|
* Status, Directly copied from cms_right.css
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#statusMessage {
|
#statusMessage {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
z-index: 500;
|
z-index: 500;
|
||||||
bottom: 30px;
|
bottom: 30px;
|
||||||
left: 30px;
|
left: 30px;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
padding: 1px 1px 1px 40px;
|
padding: 1px 1px 1px 40px;
|
||||||
|
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
|
||||||
/* border: 1px solid #cc9; */
|
/* border: 1px solid #cc9; */
|
||||||
color: #660;
|
color: #660;
|
||||||
/* background-color: #F9F9E3; */
|
/* background-color: #F9F9E3; */
|
||||||
margin: 2px;
|
margin: 2px;
|
||||||
}
|
}
|
||||||
#statusMessage.good {
|
#statusMessage.good {
|
||||||
border-color: #9c9;
|
border-color: #9c9;
|
||||||
color: #060;
|
color: #060;
|
||||||
background: url(../../images/alert-good.gif) /*#E2F9E3*/ 7px no-repeat;
|
background: url(../../images/alert-good.gif) /*#E2F9E3*/ 7px no-repeat;
|
||||||
}
|
}
|
||||||
#statusMessage.bad {
|
#statusMessage.bad {
|
||||||
border-color: #c99;
|
border-color: #c99;
|
||||||
color: #c00;
|
color: #c00;
|
||||||
background: url(../../images/alert-bad.gif) #fff 7px no-repeat;
|
background: url(../../images/alert-bad.gif) #fff 7px no-repeat;
|
||||||
max-height: 300px;
|
max-height: 300px;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
}
|
}
|
@ -1,20 +1,20 @@
|
|||||||
.contentPanel .group {
|
.contentPanel .group {
|
||||||
display: inline;
|
display: inline;
|
||||||
margin-left: 2px;
|
margin-left: 2px;
|
||||||
}
|
}
|
||||||
.contentPanel .middleColumn {
|
.contentPanel .middleColumn {
|
||||||
margin-bottom: 2px;
|
margin-bottom: 2px;
|
||||||
}
|
}
|
||||||
.contentPanel .link {
|
.contentPanel .link {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
margin-left: 2px;
|
margin-left: 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.contentPanel .tree_holder {
|
.contentPanel .tree_holder {
|
||||||
display: inline;
|
display: inline;
|
||||||
}
|
}
|
||||||
.contentPanel #NewFolderName {
|
.contentPanel #NewFolderName {
|
||||||
width: 120px;
|
width: 120px;
|
||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
}
|
}
|
||||||
|
@ -1,34 +1,34 @@
|
|||||||
* {
|
* {
|
||||||
font-family: Arial, Helvetica, sans-serif;
|
font-family: Arial, Helvetica, sans-serif;
|
||||||
font-size: 10px;
|
font-size: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
p, ul, td, th {
|
p, ul, td, th {
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
h1, h2 {
|
h1, h2 {
|
||||||
line-height: 2;
|
line-height: 2;
|
||||||
color: #333;
|
color: #333;
|
||||||
}
|
}
|
||||||
h1 {
|
h1 {
|
||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
}
|
}
|
||||||
h2 {
|
h2 {
|
||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
}
|
}
|
||||||
|
|
||||||
a {
|
a {
|
||||||
font-size: inherit;
|
font-size: inherit;
|
||||||
color: #0074C6;
|
color: #0074C6;
|
||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
}
|
}
|
||||||
|
|
||||||
a:hover {
|
a:hover {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
background: #ccc;
|
background: #ccc;
|
||||||
}
|
}
|
||||||
|
|
||||||
a img {
|
a img {
|
||||||
border-style: none;
|
border-style: none;
|
||||||
}
|
}
|
||||||
|
@ -1,43 +1,43 @@
|
|||||||
ImageEditor = {};
|
ImageEditor = {};
|
||||||
|
|
||||||
ImageEditor.Activator = {
|
ImageEditor.Activator = {
|
||||||
initialize: function() {
|
initialize: function() {
|
||||||
this.onOpen = ImageEditor.Activator.onOpen.bind(this);
|
this.onOpen = ImageEditor.Activator.onOpen.bind(this);
|
||||||
},
|
},
|
||||||
|
|
||||||
onOpen: function() {
|
onOpen: function() {
|
||||||
var windowWidth = Element.getDimensions(window.top.document.body).width;
|
var windowWidth = Element.getDimensions(window.top.document.body).width;
|
||||||
var windowHeight = Element.getDimensions(window.top.document.body).height;
|
var windowHeight = Element.getDimensions(window.top.document.body).height;
|
||||||
var iframe = window.top.document.getElementById('imageEditorIframe');
|
var iframe = window.top.document.getElementById('imageEditorIframe');
|
||||||
if(iframe != null) {
|
if(iframe != null) {
|
||||||
iframe.parentNode.removeChild(iframe);
|
iframe.parentNode.removeChild(iframe);
|
||||||
}
|
}
|
||||||
iframe = window.top.document.createElement('iframe');
|
iframe = window.top.document.createElement('iframe');
|
||||||
var fileToEdit = $('ImageEditorActivator').firstChild.src;
|
var fileToEdit = $('ImageEditorActivator').firstChild.src;
|
||||||
iframe.setAttribute("src","admin/ImageEditor?fileToEdit=" + fileToEdit);
|
iframe.setAttribute("src","admin/ImageEditor?fileToEdit=" + fileToEdit);
|
||||||
iframe.id = 'imageEditorIframe';
|
iframe.id = 'imageEditorIframe';
|
||||||
iframe.style.width = windowWidth - 6 + 'px';
|
iframe.style.width = windowWidth - 6 + 'px';
|
||||||
iframe.style.height = windowHeight + 10 + 'px';
|
iframe.style.height = windowHeight + 10 + 'px';
|
||||||
iframe.style.zIndex = "1000";
|
iframe.style.zIndex = "1000";
|
||||||
iframe.style.position = "absolute";
|
iframe.style.position = "absolute";
|
||||||
iframe.style.top = "8px";
|
iframe.style.top = "8px";
|
||||||
iframe.style.left = "8px";
|
iframe.style.left = "8px";
|
||||||
window.top.document.body.appendChild(iframe);
|
window.top.document.body.appendChild(iframe);
|
||||||
var divLeft = window.top.document.createElement('div');
|
var divLeft = window.top.document.createElement('div');
|
||||||
var divRight = window.top.document.createElement('div');
|
var divRight = window.top.document.createElement('div');
|
||||||
divLeft.style.width = "8px";
|
divLeft.style.width = "8px";
|
||||||
divLeft.style.height = "300%";
|
divLeft.style.height = "300%";
|
||||||
divLeft.style.zIndex = "1000";
|
divLeft.style.zIndex = "1000";
|
||||||
divLeft.style.top = "0";
|
divLeft.style.top = "0";
|
||||||
divLeft.style.position = "absolute";
|
divLeft.style.position = "absolute";
|
||||||
divRight.style.width = "10px";
|
divRight.style.width = "10px";
|
||||||
divRight.style.height = "300%";
|
divRight.style.height = "300%";
|
||||||
divRight.style.zIndex = "1000";
|
divRight.style.zIndex = "1000";
|
||||||
divRight.style.top = "0";
|
divRight.style.top = "0";
|
||||||
divRight.style.position = "absolute";
|
divRight.style.position = "absolute";
|
||||||
divRight.style.left = Element.getDimensions(divLeft).width + Element.getDimensions(iframe).width - 4 + 'px';
|
divRight.style.left = Element.getDimensions(divLeft).width + Element.getDimensions(iframe).width - 4 + 'px';
|
||||||
window.top.document.body.appendChild(divLeft);
|
window.top.document.body.appendChild(divLeft);
|
||||||
window.top.document.body.appendChild(divRight);
|
window.top.document.body.appendChild(divRight);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* @author Mateusz
|
* @author Mateusz
|
||||||
*/
|
*/
|
||||||
ImageEditor.Crop = {
|
ImageEditor.Crop = {
|
||||||
|
|
||||||
initialize: function() {
|
initialize: function() {
|
||||||
@ -95,7 +95,7 @@ ImageEditor.Crop = {
|
|||||||
this.cropBox.style.width = Element.getDimensions(this.imageContainer).width + "px";
|
this.cropBox.style.width = Element.getDimensions(this.imageContainer).width + "px";
|
||||||
width = Element.getDimensions(this.imageContainer).width;
|
width = Element.getDimensions(this.imageContainer).width;
|
||||||
}
|
}
|
||||||
this.placeGreyBox(width,height);
|
this.placeGreyBox(width,height);
|
||||||
},
|
},
|
||||||
|
|
||||||
getMousePos: function(event) {
|
getMousePos: function(event) {
|
||||||
@ -105,7 +105,7 @@ ImageEditor.Crop = {
|
|||||||
if(y <= this.topBoxConstraint) y = this.topBoxConstraint;
|
if(y <= this.topBoxConstraint) y = this.topBoxConstraint;
|
||||||
if(x >= this.rightBoxConstraint) x = this.rightBoxConstraint;
|
if(x >= this.rightBoxConstraint) x = this.rightBoxConstraint;
|
||||||
if(y >= this.bottomBoxConstraint) y = this.bottomBoxConstraint;
|
if(y >= this.bottomBoxConstraint) y = this.bottomBoxConstraint;
|
||||||
return {x: x,y: y};
|
return {x: x,y: y};
|
||||||
},
|
},
|
||||||
|
|
||||||
doCrop: function() {
|
doCrop: function() {
|
||||||
@ -123,7 +123,7 @@ ImageEditor.Crop = {
|
|||||||
this.disable();
|
this.disable();
|
||||||
} else {
|
} else {
|
||||||
ImageEditor.statusMessageWrapper.statusMessage("Crop area too small","bad");
|
ImageEditor.statusMessageWrapper.statusMessage("Crop area too small","bad");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$('image').style.visibility = 'visible';//hack for IE for not selecting image during crop
|
$('image').style.visibility = 'visible';//hack for IE for not selecting image during crop
|
||||||
return true;
|
return true;
|
||||||
@ -199,5 +199,5 @@ ImageEditor.Crop = {
|
|||||||
onImageLoadCallback: function() {
|
onImageLoadCallback: function() {
|
||||||
ImageEditor.crop.setVisible(false);
|
ImageEditor.crop.setVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* @author Mateusz
|
* @author Mateusz
|
||||||
*/
|
*/
|
||||||
ImageEditor.DocumentBody = {
|
ImageEditor.DocumentBody = {
|
||||||
initialize: function() {
|
initialize: function() {
|
||||||
this.placeUI = ImageEditor.DocumentBody.placeUI.bind(this);
|
this.placeUI = ImageEditor.DocumentBody.placeUI.bind(this);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* @author Mateusz
|
* @author Mateusz
|
||||||
*/
|
*/
|
||||||
ImageEditor.Environment = {
|
ImageEditor.Environment = {
|
||||||
initialize: function (imageFile) {
|
initialize: function (imageFile) {
|
||||||
ImageEditor.imageBox = new ImageEditor.ImageBox.initialize();
|
ImageEditor.imageBox = new ImageEditor.ImageBox.initialize();
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* @author Mateusz
|
* @author Mateusz
|
||||||
*/
|
*/
|
||||||
ImageEditor.ImageBox = {
|
ImageEditor.ImageBox = {
|
||||||
|
|
||||||
initialize: function() {
|
initialize: function() {
|
||||||
|
@ -132,7 +132,7 @@ ImageEditor.ImageHistory = {
|
|||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* @author Mateusz
|
* @author Mateusz
|
||||||
*/
|
*/
|
||||||
ImageEditor.ImageHistory = {
|
ImageEditor.ImageHistory = {
|
||||||
|
|
||||||
initialize: function() {
|
initialize: function() {
|
||||||
@ -164,14 +164,14 @@ ImageEditor.ImageHistory = {
|
|||||||
var operation = this.history[this.historyPointer].operation;
|
var operation = this.history[this.historyPointer].operation;
|
||||||
if(operation == 'rotate' || operation == 'crop') {
|
if(operation == 'rotate' || operation == 'crop') {
|
||||||
if(this.operationMade(this.historyPointer-1,'rotate') || this.operationMade(this.historyPointer-1,'crop'))
|
if(this.operationMade(this.historyPointer-1,'rotate') || this.operationMade(this.historyPointer-1,'crop'))
|
||||||
this.modifiedOriginalImage = true; else this.modifiedOriginalImage = false;
|
this.modifiedOriginalImage = true; else this.modifiedOriginalImage = false;
|
||||||
}
|
}
|
||||||
Event.observe('image','load',this.onImageLoad);
|
Event.observe('image','load',this.onImageLoad);
|
||||||
this.historyPointer = this.historyPointer - 1;
|
this.historyPointer = this.historyPointer - 1;
|
||||||
this.image.src = this.history[this.historyPointer].fileUrl;
|
this.image.src = this.history[this.historyPointer].fileUrl;
|
||||||
} else {
|
} else {
|
||||||
ImageEditor.statusMessageWrapper.statusMessage("No more undo","bad");
|
ImageEditor.statusMessageWrapper.statusMessage("No more undo","bad");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
redo: function() {
|
redo: function() {
|
||||||
@ -183,7 +183,7 @@ ImageEditor.ImageHistory = {
|
|||||||
this.image.src = this.history[this.historyPointer].fileUrl;
|
this.image.src = this.history[this.historyPointer].fileUrl;
|
||||||
} else {
|
} else {
|
||||||
ImageEditor.statusMessageWrapper.statusMessage("No more redo","bad");
|
ImageEditor.statusMessageWrapper.statusMessage("No more redo","bad");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
add: function(operation,url) {
|
add: function(operation,url) {
|
||||||
@ -202,16 +202,16 @@ ImageEditor.ImageHistory = {
|
|||||||
|
|
||||||
addListeners: function() {
|
addListeners: function() {
|
||||||
this.undoListener = Event.observe('UndoButton','click',this.undo);
|
this.undoListener = Event.observe('UndoButton','click',this.undo);
|
||||||
this.redoListener = Event.observe('RedoButton','click',this.redo);
|
this.redoListener = Event.observe('RedoButton','click',this.redo);
|
||||||
},
|
},
|
||||||
|
|
||||||
operationMade: function(historyPointer,operation) {
|
operationMade: function(historyPointer,operation) {
|
||||||
for(i=historyPointer;i>=0;i--) {
|
for(i=historyPointer;i>=0;i--) {
|
||||||
if(this.history[i].operation == operation) {
|
if(this.history[i].operation == operation) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|
||||||
enable: function() {
|
enable: function() {
|
||||||
@ -226,7 +226,7 @@ ImageEditor.ImageHistory = {
|
|||||||
Event.stopObserving($('UndoButton'),'click', this.undo);
|
Event.stopObserving($('UndoButton'),'click', this.undo);
|
||||||
Event.stopObserving($('RedoButton'),'click', this.redo);
|
Event.stopObserving($('RedoButton'),'click', this.redo);
|
||||||
this.isEnabled = false;
|
this.isEnabled = false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
clear: function() {
|
clear: function() {
|
||||||
|
@ -284,7 +284,7 @@ ImageEditor.Resizeable = {
|
|||||||
this.rightLowerClickBox,
|
this.rightLowerClickBox,
|
||||||
this.upperMiddleClickBox,
|
this.upperMiddleClickBox,
|
||||||
this.lowerMiddleClickBox);
|
this.lowerMiddleClickBox);
|
||||||
this.removeDraging();
|
this.removeDraging();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -5,23 +5,23 @@ ImageEditor = {};
|
|||||||
ImageEditor.Point = {
|
ImageEditor.Point = {
|
||||||
initialize: function(x,y) {
|
initialize: function(x,y) {
|
||||||
this.x = x;
|
this.x = x;
|
||||||
this.y = y;
|
this.y = y;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ImageEditor.EventStack = {
|
ImageEditor.EventStack = {
|
||||||
lastEventElement: null,
|
lastEventElement: null,
|
||||||
getLastEventElement: function(){
|
getLastEventElement: function(){
|
||||||
return ImageEditor.EventStack.lastEventElement;
|
return ImageEditor.EventStack.lastEventElement;
|
||||||
},
|
},
|
||||||
|
|
||||||
addEvent: function(event) {
|
addEvent: function(event) {
|
||||||
ImageEditor.EventStack.lastEventElement = Event.element(event);
|
ImageEditor.EventStack.lastEventElement = Event.element(event);
|
||||||
},
|
},
|
||||||
|
|
||||||
clearStack: function() {
|
clearStack: function() {
|
||||||
this.lastEventElement = null;
|
this.lastEventElement = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ImageEditor.Positioning = {
|
ImageEditor.Positioning = {
|
||||||
@ -39,24 +39,24 @@ ImageEditor.Positioning = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
getTop: function() {
|
getTop: function() {
|
||||||
return Position.positionedOffset(this.element)[1];
|
return Position.positionedOffset(this.element)[1];
|
||||||
},
|
},
|
||||||
|
|
||||||
getLeft: function() {
|
getLeft: function() {
|
||||||
return parseInt(this.element.style.left);
|
return parseInt(this.element.style.left);
|
||||||
},
|
},
|
||||||
|
|
||||||
getWidth: function() {
|
getWidth: function() {
|
||||||
return Element.getDimensions(this.element).width;
|
return Element.getDimensions(this.element).width;
|
||||||
},
|
},
|
||||||
|
|
||||||
getHeight: function() {
|
getHeight: function() {
|
||||||
return Element.getDimensions(this.element).height;
|
return Element.getDimensions(this.element).height;
|
||||||
},
|
},
|
||||||
|
|
||||||
getParentLeft: function() {
|
getParentLeft: function() {
|
||||||
var parentLeft = Position.cumulativeOffset(Position.offsetParent(this.element))[0];
|
var parentLeft = Position.cumulativeOffset(Position.offsetParent(this.element))[0];
|
||||||
return parentLeft;
|
return parentLeft;
|
||||||
},
|
},
|
||||||
|
|
||||||
getParentTop: function() {
|
getParentTop: function() {
|
||||||
@ -65,11 +65,11 @@ ImageEditor.Positioning = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
getParentHeight: function() {
|
getParentHeight: function() {
|
||||||
return Element.getDimensions(Position.offsetParent(this.element)).height;
|
return Element.getDimensions(Position.offsetParent(this.element)).height;
|
||||||
},
|
},
|
||||||
|
|
||||||
getParentWidth: function() {
|
getParentWidth: function() {
|
||||||
return Element.getDimensions(Position.offsetParent(this.element)).width
|
return Element.getDimensions(Position.offsetParent(this.element)).width
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,254 +1,254 @@
|
|||||||
/**
|
/**
|
||||||
* This class is used for upload in TinyMCE editor.
|
* This class is used for upload in TinyMCE editor.
|
||||||
* If one of methods is not commented look for comment in Upload.js.
|
* If one of methods is not commented look for comment in Upload.js.
|
||||||
*/
|
*/
|
||||||
TinyMCEImageEnhancement = Class.create();
|
TinyMCEImageEnhancement = Class.create();
|
||||||
TinyMCEImageEnhancement.prototype = {
|
TinyMCEImageEnhancement.prototype = {
|
||||||
initialize: function() {
|
initialize: function() {
|
||||||
this.filesUploaded = 0;
|
this.filesUploaded = 0;
|
||||||
this.processInProgress = false;
|
this.processInProgress = false;
|
||||||
Event.observe(window,'load',this.onWindowLoad.bind(this));
|
Event.observe(window,'load',this.onWindowLoad.bind(this));
|
||||||
},
|
},
|
||||||
|
|
||||||
addListeners: function() {
|
addListeners: function() {
|
||||||
$('Form_EditorToolbarImageForm_FolderID').value = "";
|
$('Form_EditorToolbarImageForm_FolderID').value = "";
|
||||||
Event.observe($('AddFolder'),'click',this.onAddFolder.bind(this));
|
Event.observe($('AddFolder'),'click',this.onAddFolder.bind(this));
|
||||||
Event.observe($('FolderOk'),'click',this.onFolderOk.bind(this));
|
Event.observe($('FolderOk'),'click',this.onFolderOk.bind(this));
|
||||||
Event.observe($('FolderCancel'),'click',this.onFolderCancel.bind(this));
|
Event.observe($('FolderCancel'),'click',this.onFolderCancel.bind(this));
|
||||||
Event.observe($('UploadFiles'),'click',this.onUpload.bind(this));
|
Event.observe($('UploadFiles'),'click',this.onUpload.bind(this));
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method creates HTML element, only reason for this method is DRY.
|
* Method creates HTML element, only reason for this method is DRY.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
addElement: function(tag, className, parent, properties) {
|
addElement: function(tag, className, parent, properties) {
|
||||||
var e = document.createElement(tag);
|
var e = document.createElement(tag);
|
||||||
Element.addClassName(e,className);
|
Element.addClassName(e,className);
|
||||||
parent.appendChild(e);
|
parent.appendChild(e);
|
||||||
Object.extend(e,properties);
|
Object.extend(e,properties);
|
||||||
return e;
|
return e;
|
||||||
},
|
},
|
||||||
|
|
||||||
onUpload: function(event) {
|
onUpload: function(event) {
|
||||||
Event.stop(event);
|
Event.stop(event);
|
||||||
if(!this.processInProgress) {
|
if(!this.processInProgress) {
|
||||||
if(this.getParentID() != 'root') {
|
if(this.getParentID() != 'root') {
|
||||||
this.upload.browse();
|
this.upload.browse();
|
||||||
} else {
|
} else {
|
||||||
statusMessage("Please choose folder","bad");
|
statusMessage("Please choose folder","bad");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when user clicks "add folder" anchor.
|
* Called when user clicks "add folder" anchor.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
onAddFolder: function(event) {
|
onAddFolder: function(event) {
|
||||||
Event.stop(event);
|
Event.stop(event);
|
||||||
Element.hide('AddFolder');
|
Element.hide('AddFolder');
|
||||||
Element.show('NewFolderName','FolderOk','FolderCancel');
|
Element.show('NewFolderName','FolderOk','FolderCancel');
|
||||||
this.applyIE6Hack();
|
this.applyIE6Hack();
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The user clicks the "ok" anchor link, the click event calls up
|
* The user clicks the "ok" anchor link, the click event calls up
|
||||||
* this function which creates a new AJAX request to add a new folder
|
* this function which creates a new AJAX request to add a new folder
|
||||||
* using the addfolder function in AssetAdmin.php (admin/assets/addfolder).
|
* using the addfolder function in AssetAdmin.php (admin/assets/addfolder).
|
||||||
*/
|
*/
|
||||||
onFolderOk: function(event) {
|
onFolderOk: function(event) {
|
||||||
Event.stop(event);
|
Event.stop(event);
|
||||||
var folderName = $('NewFolderName').value;
|
var folderName = $('NewFolderName').value;
|
||||||
var options = {
|
var options = {
|
||||||
method: 'post',
|
method: 'post',
|
||||||
postBody: 'ParentID=' + this.getParentID() + '&ajax=1&returnID=1&Name=' + folderName + ($('SecurityID') ? '&SecurityID=' + $('SecurityID').value : ''),
|
postBody: 'ParentID=' + this.getParentID() + '&ajax=1&returnID=1&Name=' + folderName + ($('SecurityID') ? '&SecurityID=' + $('SecurityID').value : ''),
|
||||||
onSuccess: this.onFolderGetSuccess.bind(this),
|
onSuccess: this.onFolderGetSuccess.bind(this),
|
||||||
onFailure: function(transport) {
|
onFailure: function(transport) {
|
||||||
errorMessage('Error: Folder not added', transport);
|
errorMessage('Error: Folder not added', transport);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
new Ajax.Request('admin/assets/addfolder', options);
|
new Ajax.Request('admin/assets/addfolder', options);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If the "addFolderOk" function does a successful AJAX post, call this
|
* If the "addFolderOk" function does a successful AJAX post, call this
|
||||||
* function. Take the folder ID that was created in "addFolderOk"
|
* function. Take the folder ID that was created in "addFolderOk"
|
||||||
* via ajax and send data to modify that folder record.
|
* via ajax and send data to modify that folder record.
|
||||||
*/
|
*/
|
||||||
onFolderGetSuccess: function(transport) {
|
onFolderGetSuccess: function(transport) {
|
||||||
var folderID = transport.responseText;
|
var folderID = transport.responseText;
|
||||||
|
|
||||||
var date = new Date();
|
var date = new Date();
|
||||||
var year = date.getFullYear();
|
var year = date.getFullYear();
|
||||||
var month = date.getMonth() < 10 ? '0' + date.getMonth() : date.getMonth();
|
var month = date.getMonth() < 10 ? '0' + date.getMonth() : date.getMonth();
|
||||||
var day = date.getDay() < 10 ? '0' + date.getDay() : date.getDay();
|
var day = date.getDay() < 10 ? '0' + date.getDay() : date.getDay();
|
||||||
var hours = date.getHours() < 10 ? '0' + date.getHours() : date.getHours();
|
var hours = date.getHours() < 10 ? '0' + date.getHours() : date.getHours();
|
||||||
var minutes = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes();
|
var minutes = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes();
|
||||||
var seconds = date.getSeconds() < 10 == 1 ? '0' + date.getSeconds() : date.getSeconds();
|
var seconds = date.getSeconds() < 10 == 1 ? '0' + date.getSeconds() : date.getSeconds();
|
||||||
var currentDate = year + '-' + month + '-' + day + ' ' + hours + ':' + minutes + ':' + seconds;
|
var currentDate = year + '-' + month + '-' + day + ' ' + hours + ':' + minutes + ':' + seconds;
|
||||||
|
|
||||||
var folderName = $('NewFolderName').value;
|
var folderName = $('NewFolderName').value;
|
||||||
|
|
||||||
this.folderID = folderID;
|
this.folderID = folderID;
|
||||||
|
|
||||||
statusMessage('Creating new folder');
|
statusMessage('Creating new folder');
|
||||||
$('TreeDropdownField_Form_EditorToolbarImageForm_FolderID').itemTree = null;
|
$('TreeDropdownField_Form_EditorToolbarImageForm_FolderID').itemTree = null;
|
||||||
$('TreeDropdownField_Form_EditorToolbarImageForm_FolderID').setValue(this.folderID);
|
$('TreeDropdownField_Form_EditorToolbarImageForm_FolderID').setValue(this.folderID);
|
||||||
$('NewFolderName').value = '';
|
$('NewFolderName').value = '';
|
||||||
Element.show('AddFolder');
|
Element.show('AddFolder');
|
||||||
Element.hide('NewFolderName','FolderOk','FolderCancel');
|
Element.hide('NewFolderName','FolderOk','FolderCancel');
|
||||||
this.removeIE6Hack();
|
this.removeIE6Hack();
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If user doesn't want to add folder return to default UI.
|
* If user doesn't want to add folder return to default UI.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
onFolderCancel: function(event) {
|
onFolderCancel: function(event) {
|
||||||
$('NewFolderName').value = '';
|
$('NewFolderName').value = '';
|
||||||
Element.show('AddFolder');
|
Element.show('AddFolder');
|
||||||
Element.hide('NewFolderName','FolderOk','FolderCancel');
|
Element.hide('NewFolderName','FolderOk','FolderCancel');
|
||||||
this.removeIE6Hack();
|
this.removeIE6Hack();
|
||||||
Event.stop(event);
|
Event.stop(event);
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called on window.onload
|
* Called on window.onload
|
||||||
*/
|
*/
|
||||||
|
|
||||||
onWindowLoad: function() {
|
onWindowLoad: function() {
|
||||||
// Due to a bug in the flash plugin on Linux and Mac,
|
// Due to a bug in the flash plugin on Linux and Mac,
|
||||||
//we need at least version 9.0.64 to use SWFUpload
|
//we need at least version 9.0.64 to use SWFUpload
|
||||||
// see http://open.silverstripe.com/ticket/3023
|
// see http://open.silverstripe.com/ticket/3023
|
||||||
pv = getFlashPlayerVersion();
|
pv = getFlashPlayerVersion();
|
||||||
if(pv.major < 9 || pv.major > 9 || (pv.major == 9 && pv.minor == 0 && pv.rev < 64)) {
|
if(pv.major < 9 || pv.major > 9 || (pv.major == 9 && pv.minor == 0 && pv.rev < 64)) {
|
||||||
if($('AddFolderGroup')) $('AddFolderGroup').style.display = 'none';
|
if($('AddFolderGroup')) $('AddFolderGroup').style.display = 'none';
|
||||||
if($('PipeSeparator')) $('PipeSeparator').style.display = 'none';
|
if($('PipeSeparator')) $('PipeSeparator').style.display = 'none';
|
||||||
if($('UploadGroup')) $('UploadGroup').style.display = 'none';
|
if($('UploadGroup')) $('UploadGroup').style.display = 'none';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($('FolderID') != null) {
|
if($('FolderID') != null) {
|
||||||
if($('SecurityID')) var securityid=$('SecurityID').value;
|
if($('SecurityID')) var securityid=$('SecurityID').value;
|
||||||
else var securityid=null;
|
else var securityid=null;
|
||||||
this.upload = new Upload(
|
this.upload = new Upload(
|
||||||
{
|
{
|
||||||
fileTypes : '*.jpeg;*.jpg;*.jpe;*.png;*.gif;',
|
fileTypes : '*.jpeg;*.jpg;*.jpe;*.png;*.gif;',
|
||||||
fileTypesDescription : 'Image files',
|
fileTypesDescription : 'Image files',
|
||||||
fileUploadLimit : '100',
|
fileUploadLimit : '100',
|
||||||
securityID : securityid,
|
securityID : securityid,
|
||||||
beginUploadOnQueue : true,
|
beginUploadOnQueue : true,
|
||||||
buildUI : this.addListeners.bind(this),
|
buildUI : this.addListeners.bind(this),
|
||||||
fileQueued : this.uploadFileQueuedCallback.bind(this),
|
fileQueued : this.uploadFileQueuedCallback.bind(this),
|
||||||
fileComplete : this.uploadFileCompleteCallback.bind(this),
|
fileComplete : this.uploadFileCompleteCallback.bind(this),
|
||||||
queueComplete : this.uploadQueueCompleteCallback.bind(this)
|
queueComplete : this.uploadQueueCompleteCallback.bind(this)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
uploadFileQueuedCallback: function(file,queueLength) {
|
uploadFileQueuedCallback: function(file,queueLength) {
|
||||||
this.processInProgress = true;
|
this.processInProgress = true;
|
||||||
this.upload.setFolderID(this.getParentID());
|
this.upload.setFolderID(this.getParentID());
|
||||||
$('UploadFiles').innerHTML = "Uploading ... 1/" + this.upload.getFilesToUpload();
|
$('UploadFiles').innerHTML = "Uploading ... 1/" + this.upload.getFilesToUpload();
|
||||||
this.upload.startUpload();
|
this.upload.startUpload();
|
||||||
},
|
},
|
||||||
|
|
||||||
uploadFileCompleteCallback: function(file,serverData) {
|
uploadFileCompleteCallback: function(file,serverData) {
|
||||||
Element.addClassName($('UploadFiles'),'link');//Safari hack
|
Element.addClassName($('UploadFiles'),'link');//Safari hack
|
||||||
$('UploadFiles').innerHTML = 'Uploading ... ' + this.upload.getFilesUploaded() + "/" + this.upload.getFilesToUpload();
|
$('UploadFiles').innerHTML = 'Uploading ... ' + this.upload.getFilesUploaded() + "/" + this.upload.getFilesToUpload();
|
||||||
},
|
},
|
||||||
|
|
||||||
uploadQueueCompleteCallback: function() {
|
uploadQueueCompleteCallback: function() {
|
||||||
this.filesUploaded = this.upload.getFilesUploaded();
|
this.filesUploaded = this.upload.getFilesUploaded();
|
||||||
$('UploadFiles').innerHTML = "upload";
|
$('UploadFiles').innerHTML = "upload";
|
||||||
statusMessage('Uploaded ' + this.upload.getFilesUploaded() + ' files','good');
|
statusMessage('Uploaded ' + this.upload.getFilesUploaded() + ' files','good');
|
||||||
if(this.getParentID() != 'root') {
|
if(this.getParentID() != 'root') {
|
||||||
$('Image').ajaxGetFiles(this.getParentID(), null, this.insertImages.bind(this));
|
$('Image').ajaxGetFiles(this.getParentID(), null, this.insertImages.bind(this));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Iterates over all uploaded images and add them to TinyMCE editor
|
* Iterates over all uploaded images and add them to TinyMCE editor
|
||||||
*
|
*
|
||||||
* @param transport object
|
* @param transport object
|
||||||
*/
|
*/
|
||||||
insertImages: function(transport) {
|
insertImages: function(transport) {
|
||||||
//HACK FOR STRANGE ERROR OCCURING UNDER SAFARI
|
//HACK FOR STRANGE ERROR OCCURING UNDER SAFARI
|
||||||
if(transport.responseText == '') {
|
if(transport.responseText == '') {
|
||||||
$('Image').ajaxGetFiles(this.getParentID(), null, this.insertImages.bind(this));
|
$('Image').ajaxGetFiles(this.getParentID(), null, this.insertImages.bind(this));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//END OF HACK
|
//END OF HACK
|
||||||
|
|
||||||
$('Image').reapplyBehaviour();
|
$('Image').reapplyBehaviour();
|
||||||
|
|
||||||
this.addToTinyMCE = this.addToTinyMCE.bind(this);
|
this.addToTinyMCE = this.addToTinyMCE.bind(this);
|
||||||
|
|
||||||
this.processInProgress = false;
|
this.processInProgress = false;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds particular image to TinyMCE. Most of code has been copied from tiny_mce_improvements.js / ImageThumbnail.onclick
|
* Adds particular image to TinyMCE. Most of code has been copied from tiny_mce_improvements.js / ImageThumbnail.onclick
|
||||||
* Sorry for not following DRY, I didn't want to break smth in tiny_mce_improvements.
|
* Sorry for not following DRY, I didn't want to break smth in tiny_mce_improvements.
|
||||||
*
|
*
|
||||||
* @param target object
|
* @param target object
|
||||||
*/
|
*/
|
||||||
|
|
||||||
addToTinyMCE: function(target) {
|
addToTinyMCE: function(target) {
|
||||||
var formObj = $('Form_EditorToolbarImageForm');
|
var formObj = $('Form_EditorToolbarImageForm');
|
||||||
var altText = formObj.elements.AltText.value;
|
var altText = formObj.elements.AltText.value;
|
||||||
var cssClass = formObj.elements.CSSClass.value;
|
var cssClass = formObj.elements.CSSClass.value;
|
||||||
var baseURL = document.getElementsByTagName('base')[0].href;
|
var baseURL = document.getElementsByTagName('base')[0].href;
|
||||||
var relativeHref = target.href.substr(baseURL.length)
|
var relativeHref = target.href.substr(baseURL.length)
|
||||||
if(!tinyMCE.selectedInstance) tinyMCE.selectedInstance = Toolbar.instance().editor;
|
if(!tinyMCE.selectedInstance) tinyMCE.selectedInstance = Toolbar.instance().editor;
|
||||||
if(tinyMCE.selectedInstance.contentWindow.focus) tinyMCE.selectedInstance.contentWindow.focus();
|
if(tinyMCE.selectedInstance.contentWindow.focus) tinyMCE.selectedInstance.contentWindow.focus();
|
||||||
// Extract dest width and dest height from the class name
|
// Extract dest width and dest height from the class name
|
||||||
var destWidth = null;
|
var destWidth = null;
|
||||||
var destHeight = null;
|
var destHeight = null;
|
||||||
try {
|
try {
|
||||||
var imgTag = target.getElementsByTagName('img')[0];
|
var imgTag = target.getElementsByTagName('img')[0];
|
||||||
destWidth = imgTag.className.match(/destwidth=([0-9.\-]+)([, ]|$)/) ? RegExp.$1 : null;
|
destWidth = imgTag.className.match(/destwidth=([0-9.\-]+)([, ]|$)/) ? RegExp.$1 : null;
|
||||||
destHeight = imgTag.className.match(/destheight=([0-9.\-]+)([, ]|$)/) ? RegExp.$1 : null;
|
destHeight = imgTag.className.match(/destheight=([0-9.\-]+)([, ]|$)/) ? RegExp.$1 : null;
|
||||||
} catch(er) {
|
} catch(er) {
|
||||||
}
|
}
|
||||||
TinyMCE_AdvancedTheme._insertImage(relativeHref, altText, 0, '', '', destWidth, destHeight, '', '', cssClass);
|
TinyMCE_AdvancedTheme._insertImage(relativeHref, altText, 0, '', '', destWidth, destHeight, '', '', cssClass);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Under IE6 when we click on "add folder" anchor, rest of anchors loose their correct position
|
* Under IE6 when we click on "add folder" anchor, rest of anchors loose their correct position
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
applyIE6Hack: function() {
|
applyIE6Hack: function() {
|
||||||
if(/msie/i.test(navigator.userAgent)) {
|
if(/msie/i.test(navigator.userAgent)) {
|
||||||
elements = [$('FolderOk'),$('FolderCancel'),$('UploadFiles')];
|
elements = [$('FolderOk'),$('FolderCancel'),$('UploadFiles')];
|
||||||
$A(elements).each(function(element) {
|
$A(elements).each(function(element) {
|
||||||
element.style.position = "relative";
|
element.style.position = "relative";
|
||||||
element.style.top = "-3px";
|
element.style.top = "-3px";
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
removeIE6Hack: function() {
|
removeIE6Hack: function() {
|
||||||
if(/msie/i.test(navigator.userAgent)) {
|
if(/msie/i.test(navigator.userAgent)) {
|
||||||
elements = [$('FolderOk'),$('FolderCancel'),$('UploadFiles')];
|
elements = [$('FolderOk'),$('FolderCancel'),$('UploadFiles')];
|
||||||
$A(elements).each(function(element) {
|
$A(elements).each(function(element) {
|
||||||
element.style.position = "";
|
element.style.position = "";
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns id of upload folder.
|
* Returns id of upload folder.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
getParentID: function() {
|
getParentID: function() {
|
||||||
return $('Form_EditorToolbarImageForm_FolderID').value == '' ? 'root' : $('Form_EditorToolbarImageForm_FolderID').value;
|
return $('Form_EditorToolbarImageForm_FolderID').value == '' ? 'root' : $('Form_EditorToolbarImageForm_FolderID').value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tinyMCEImageEnhancement = new TinyMCEImageEnhancement();
|
tinyMCEImageEnhancement = new TinyMCEImageEnhancement();
|
||||||
|
@ -1,256 +1,256 @@
|
|||||||
/*
|
/*
|
||||||
This class is wrapper for SWFUpload class.
|
This class is wrapper for SWFUpload class.
|
||||||
If you want use SWFUpload, please use this class becuase it will take care of configuration
|
If you want use SWFUpload, please use this class becuase it will take care of configuration
|
||||||
error handling and other things.
|
error handling and other things.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Upload = Class.create();
|
Upload = Class.create();
|
||||||
Upload.prototype = {
|
Upload.prototype = {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets configuration data provided from user if smth is missing sets default value.
|
* Sets configuration data provided from user if smth is missing sets default value.
|
||||||
*
|
*
|
||||||
* @param params object contains all configuration data for upload.
|
* @param params object contains all configuration data for upload.
|
||||||
*/
|
*/
|
||||||
initialize: function(params) {
|
initialize: function(params) {
|
||||||
this.filesUploaded = 0;
|
this.filesUploaded = 0;
|
||||||
this.filesToUpload = 0;
|
this.filesToUpload = 0;
|
||||||
this.folderID = 'root';
|
this.folderID = 'root';
|
||||||
this.uploadInProgress = false;
|
this.uploadInProgress = false;
|
||||||
this.uploadMessage = '';
|
this.uploadMessage = '';
|
||||||
if(typeof params.fileSizeLimit != 'undefined') this.setFileSizeLimit = params.fileSizeLimit; else this.fileSizeLimit = '30720';
|
if(typeof params.fileSizeLimit != 'undefined') this.setFileSizeLimit = params.fileSizeLimit; else this.fileSizeLimit = '30720';
|
||||||
if(typeof params.fileTypes != 'undefined') this.fileTypes = params.fileTypes; else this.fileTypes = '*.*';
|
if(typeof params.fileTypes != 'undefined') this.fileTypes = params.fileTypes; else this.fileTypes = '*.*';
|
||||||
if(typeof params.fileTypesDescription != 'undefined') this.fileTypesDescription = params.fileTypesDescription; else this.fileTypesDescription = 'All Files';
|
if(typeof params.fileTypesDescription != 'undefined') this.fileTypesDescription = params.fileTypesDescription; else this.fileTypesDescription = 'All Files';
|
||||||
if(typeof params.fileUploadLimit != 'undefined') this.fileUploadLimit = params.fileUploadLimit; else this.fileUploadLimit = '6';
|
if(typeof params.fileUploadLimit != 'undefined') this.fileUploadLimit = params.fileUploadLimit; else this.fileUploadLimit = '6';
|
||||||
if(typeof params.beginUploadOnQueue != 'undefined') this.beginUploadOnQueue = params.beginUploadOnQueue; else this.beginUploadOnQueue = false;
|
if(typeof params.beginUploadOnQueue != 'undefined') this.beginUploadOnQueue = params.beginUploadOnQueue; else this.beginUploadOnQueue = false;
|
||||||
if(typeof params.fileQueued != 'undefined') this.fileQueued = params.fileQueued;
|
if(typeof params.fileQueued != 'undefined') this.fileQueued = params.fileQueued;
|
||||||
if(typeof params.fileProgress != 'undefined') this.fileProgress = params.fileProgress; else this.fileProgress = Prototype.emptyFunction;
|
if(typeof params.fileProgress != 'undefined') this.fileProgress = params.fileProgress; else this.fileProgress = Prototype.emptyFunction;
|
||||||
if(typeof params.fileCancelled != 'undefined') this.fileCancelled = params.fileCancelled;
|
if(typeof params.fileCancelled != 'undefined') this.fileCancelled = params.fileCancelled;
|
||||||
if(typeof params.fileComplete != 'undefined') this.fileComplete = params.fileComplete ;
|
if(typeof params.fileComplete != 'undefined') this.fileComplete = params.fileComplete ;
|
||||||
if(typeof params.queueComplete != 'undefined') this.queueComplete = params.queueComplete;
|
if(typeof params.queueComplete != 'undefined') this.queueComplete = params.queueComplete;
|
||||||
if(typeof params.buildUI != 'undefined') this.customBuildUI = params.buildUI;
|
if(typeof params.buildUI != 'undefined') this.customBuildUI = params.buildUI;
|
||||||
if(typeof params.securityID != 'undefined') this.securityID = params.securityID;
|
if(typeof params.securityID != 'undefined') this.securityID = params.securityID;
|
||||||
this.onLoad();
|
this.onLoad();
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates SWFUpload object for uploading files.
|
* Creates SWFUpload object for uploading files.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
onLoad: function() {
|
onLoad: function() {
|
||||||
path = this.getBasePath();
|
path = this.getBasePath();
|
||||||
sessId = this.getSessionId();//Because flash doesn't send proper cookies, we need to set session id in URL.
|
sessId = this.getSessionId();//Because flash doesn't send proper cookies, we need to set session id in URL.
|
||||||
this.swfu = new SWFUpload({
|
this.swfu = new SWFUpload({
|
||||||
upload_url: path + 'admin/assets/UploadForm?SecurityID=' + this.securityID + '&PHPSESSID=' + sessId, // Relative to the SWF file
|
upload_url: path + 'admin/assets/UploadForm?SecurityID=' + this.securityID + '&PHPSESSID=' + sessId, // Relative to the SWF file
|
||||||
file_post_name: 'Files',
|
file_post_name: 'Files',
|
||||||
file_size_limit : this.fileSizeLimit,
|
file_size_limit : this.fileSizeLimit,
|
||||||
file_types : this.fileTypes,
|
file_types : this.fileTypes,
|
||||||
file_types_description : this.fileTypesDescription,
|
file_types_description : this.fileTypesDescription,
|
||||||
file_upload_limit : this.fileUploadLimit,
|
file_upload_limit : this.fileUploadLimit,
|
||||||
begin_upload_on_queue : this.beginUploadOnQueue,
|
begin_upload_on_queue : this.beginUploadOnQueue,
|
||||||
use_server_data_event : true,
|
use_server_data_event : true,
|
||||||
validate_files: false,
|
validate_files: false,
|
||||||
|
|
||||||
file_queued_handler : this.uploadFileQueuedCallback.bind(this),
|
file_queued_handler : this.uploadFileQueuedCallback.bind(this),
|
||||||
upload_success_handler : this.uploadFileCompleteCallback.bind(this),
|
upload_success_handler : this.uploadFileCompleteCallback.bind(this),
|
||||||
upload_progress_handler: this.uploadFileProgressCallback.bind(this),
|
upload_progress_handler: this.uploadFileProgressCallback.bind(this),
|
||||||
error_handler : this.uploadErrorCallback.bind(this),
|
error_handler : this.uploadErrorCallback.bind(this),
|
||||||
file_validation_handler : Prototype.emptyFunction,
|
file_validation_handler : Prototype.emptyFunction,
|
||||||
file_cancelled_handler: Prototype.emptyFunction,
|
file_cancelled_handler: Prototype.emptyFunction,
|
||||||
|
|
||||||
flash_url : 'jsparty/SWFUpload/swfupload_f9.swf', // Relative to this file
|
flash_url : 'jsparty/SWFUpload/swfupload_f9.swf', // Relative to this file
|
||||||
swfupload_loaded_handler: this.buildUI.bind(this),
|
swfupload_loaded_handler: this.buildUI.bind(this),
|
||||||
debug: false
|
debug: false
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves base path from URL.
|
* Retrieves base path from URL.
|
||||||
* TODO: Use base tag.
|
* TODO: Use base tag.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
getBasePath: function() {
|
getBasePath: function() {
|
||||||
var path = 'http://' + window.location.host + window.location.pathname;
|
var path = 'http://' + window.location.host + window.location.pathname;
|
||||||
|
|
||||||
if(path.match(/^(.*\/)admin/i)) return RegExp.$1;
|
if(path.match(/^(.*\/)admin/i)) return RegExp.$1;
|
||||||
else return path;
|
else return path;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves sessionId from cookie.
|
* Retrieves sessionId from cookie.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
getSessionId: function() {
|
getSessionId: function() {
|
||||||
var start = document.cookie.indexOf('PHPSESSID')+10;
|
var start = document.cookie.indexOf('PHPSESSID')+10;
|
||||||
var end = document.cookie.indexOf(';',start);
|
var end = document.cookie.indexOf(';',start);
|
||||||
if(end == -1) end = document.cookie.length;
|
if(end == -1) end = document.cookie.length;
|
||||||
return document.cookie.substring(start,end);
|
return document.cookie.substring(start,end);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calls method defined by user, method should create user interface.
|
* Calls method defined by user, method should create user interface.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
buildUI: function() {
|
buildUI: function() {
|
||||||
this.customBuildUI();
|
this.customBuildUI();
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when new file is added to the queue
|
* Called when new file is added to the queue
|
||||||
*
|
*
|
||||||
* @param file object
|
* @param file object
|
||||||
* @param queueLength int
|
* @param queueLength int
|
||||||
*/
|
*/
|
||||||
|
|
||||||
uploadFileQueuedCallback: function(file,queueLength) {
|
uploadFileQueuedCallback: function(file,queueLength) {
|
||||||
this.filesToUpload++;
|
this.filesToUpload++;
|
||||||
this.fileQueued(file, queueLength);
|
this.fileQueued(file, queueLength);
|
||||||
this.addFileParam(file);
|
this.addFileParam(file);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when uploading of particular file has finished
|
* Called when uploading of particular file has finished
|
||||||
*
|
*
|
||||||
* @param file object
|
* @param file object
|
||||||
* @param servedData string
|
* @param servedData string
|
||||||
*/
|
*/
|
||||||
uploadFileCompleteCallback: function(file,serverData) {
|
uploadFileCompleteCallback: function(file,serverData) {
|
||||||
this.filesUploaded++;
|
this.filesUploaded++;
|
||||||
if(serverData) {
|
if(serverData) {
|
||||||
var toEval = serverData.substr(serverData.indexOf('<script'));
|
var toEval = serverData.substr(serverData.indexOf('<script'));
|
||||||
toEval = toEval.replace('<script type="text/javascript">','');
|
toEval = toEval.replace('<script type="text/javascript">','');
|
||||||
toEval = toEval.replace('</script>','');
|
toEval = toEval.replace('</script>','');
|
||||||
this.uploadMessage = toEval;
|
this.uploadMessage = toEval;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.fileComplete(file, serverData);
|
this.fileComplete(file, serverData);
|
||||||
|
|
||||||
// Run the next file in the queue, if there is one
|
// Run the next file in the queue, if there is one
|
||||||
if(this.swfu.getStats().files_queued > 0) this.startUpload();
|
if(this.swfu.getStats().files_queued > 0) this.startUpload();
|
||||||
// Otherwise indicate that the queue is finished
|
// Otherwise indicate that the queue is finished
|
||||||
else {
|
else {
|
||||||
this.queueComplete();
|
this.queueComplete();
|
||||||
this.uploadInProgress = false;
|
this.uploadInProgress = false;
|
||||||
this.filesUploaded = 0;
|
this.filesUploaded = 0;
|
||||||
this.filesToUpload = 0;
|
this.filesToUpload = 0;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called during uploading file.
|
* Called during uploading file.
|
||||||
*
|
*
|
||||||
* @param file object
|
* @param file object
|
||||||
* @param bytes_complete int
|
* @param bytes_complete int
|
||||||
*/
|
*/
|
||||||
|
|
||||||
uploadFileProgressCallback: function(file, bytes_complete) {
|
uploadFileProgressCallback: function(file, bytes_complete) {
|
||||||
this.uploadInProgress = true;
|
this.uploadInProgress = true;
|
||||||
this.fileProgress(file, bytes_complete);
|
this.fileProgress(file, bytes_complete);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called on error.
|
* Called on error.
|
||||||
* @param error_code int
|
* @param error_code int
|
||||||
* @param file object
|
* @param file object
|
||||||
* @param message string
|
* @param message string
|
||||||
*/
|
*/
|
||||||
|
|
||||||
uploadErrorCallback: function(error_code, file, message) {
|
uploadErrorCallback: function(error_code, file, message) {
|
||||||
this.swfu.cancelQueue();
|
this.swfu.cancelQueue();
|
||||||
switch(error_code) {
|
switch(error_code) {
|
||||||
case SWFUpload.ERROR_CODE_HTTP_ERROR:
|
case SWFUpload.ERROR_CODE_HTTP_ERROR:
|
||||||
alert('You have encountered an error. File hasn\'t been uploaded. Please hit the "Refresh" button in your web browser. Error Code: HTTP Error, File name: ' + file.name + ', Message: ' + msg);
|
alert('You have encountered an error. File hasn\'t been uploaded. Please hit the "Refresh" button in your web browser. Error Code: HTTP Error, File name: ' + file.name + ', Message: ' + msg);
|
||||||
break;
|
break;
|
||||||
case SWFUpload.ERROR_CODE_IO_ERROR:
|
case SWFUpload.ERROR_CODE_IO_ERROR:
|
||||||
alert('You have encountered an error. File hasn\'t been uploaded. Please hit the "Refresh" button in your web browser. Error Code: IO Error, File name: ' + file.name + ', Message: ' + msg);
|
alert('You have encountered an error. File hasn\'t been uploaded. Please hit the "Refresh" button in your web browser. Error Code: IO Error, File name: ' + file.name + ', Message: ' + msg);
|
||||||
break;
|
break;
|
||||||
case SWFUpload.ERROR_CODE_SECURITY_ERROR:
|
case SWFUpload.ERROR_CODE_SECURITY_ERROR:
|
||||||
alert('You have encountered an error. File hasn\'t been uploaded. Please hit the "Refresh" button in your web browser. Error Code: Security Error, File name: ' + file.name + ', Message: ' + msg);
|
alert('You have encountered an error. File hasn\'t been uploaded. Please hit the "Refresh" button in your web browser. Error Code: Security Error, File name: ' + file.name + ', Message: ' + msg);
|
||||||
break;
|
break;
|
||||||
case SWFUpload.ERROR_CODE_FILE_EXCEEDS_SIZE_LIMIT:
|
case SWFUpload.ERROR_CODE_FILE_EXCEEDS_SIZE_LIMIT:
|
||||||
alert('Files cannot be bigger than ' + this.fileSizeLimit/1024 + ' MB.');
|
alert('Files cannot be bigger than ' + this.fileSizeLimit/1024 + ' MB.');
|
||||||
break;
|
break;
|
||||||
case SWFUpload.ERROR_CODE_ZERO_BYTE_FILE:
|
case SWFUpload.ERROR_CODE_ZERO_BYTE_FILE:
|
||||||
alert('Files cannot be empty');
|
alert('Files cannot be empty');
|
||||||
break;
|
break;
|
||||||
case SWFUpload.ERROR_CODE_QUEUE_LIMIT_EXCEEDED:
|
case SWFUpload.ERROR_CODE_QUEUE_LIMIT_EXCEEDED:
|
||||||
alert('You can only have six files in queue');
|
alert('You can only have six files in queue');
|
||||||
break;
|
break;
|
||||||
case SWFUpload.ERROR_CODE_UPLOAD_FAILED:
|
case SWFUpload.ERROR_CODE_UPLOAD_FAILED:
|
||||||
alert('You have encountered an error. File hasn\'t has been uploaded. Please hit the "Refresh" button in your web browser');
|
alert('You have encountered an error. File hasn\'t has been uploaded. Please hit the "Refresh" button in your web browser');
|
||||||
break;
|
break;
|
||||||
case SWFUpload.ERROR_CODE_SPECIFIED_FILE_NOT_FOUND:
|
case SWFUpload.ERROR_CODE_SPECIFIED_FILE_NOT_FOUND:
|
||||||
alert('You have encountered an error. File hasn\'t has been uploaded. Please hit the "Refresh" button in your web browser');
|
alert('You have encountered an error. File hasn\'t has been uploaded. Please hit the "Refresh" button in your web browser');
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
alert('You have encountered an error. File hasn\'t has been uploaded. Please hit the "Refresh" button in your web browser');
|
alert('You have encountered an error. File hasn\'t has been uploaded. Please hit the "Refresh" button in your web browser');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Because we are on top of standard upload we need to add some POST vars that
|
* Because we are on top of standard upload we need to add some POST vars that
|
||||||
* normally are being sent as part of form.
|
* normally are being sent as part of form.
|
||||||
*
|
*
|
||||||
* @param file object
|
* @param file object
|
||||||
*/
|
*/
|
||||||
|
|
||||||
addFileParam: function(file) {
|
addFileParam: function(file) {
|
||||||
this.swfu.addFileParam(file.id,'ID',this.folderID);
|
this.swfu.addFileParam(file.id,'ID',this.folderID);
|
||||||
this.swfu.addFileParam(file.id,'action_doUpload','1');
|
this.swfu.addFileParam(file.id,'action_doUpload','1');
|
||||||
this.swfu.addFileParam(file.id,'Files',file.name);
|
this.swfu.addFileParam(file.id,'Files',file.name);
|
||||||
this.swfu.addFileParam(file.id,'MAX_FILE_SIZE','31457280');
|
this.swfu.addFileParam(file.id,'MAX_FILE_SIZE','31457280');
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Starts file explorer.
|
* Starts file explorer.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
browse: function() {
|
browse: function() {
|
||||||
this.swfu.selectFiles();
|
this.swfu.selectFiles();
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Starts upload
|
* Starts upload
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
startUpload: function() {
|
startUpload: function() {
|
||||||
this.swfu.startUpload();
|
this.swfu.startUpload();
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cancels uploading of file.
|
* Cancels uploading of file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
cancelUpload: function(fileId) {
|
cancelUpload: function(fileId) {
|
||||||
this.filesToUpload--;
|
this.filesToUpload--;
|
||||||
this.swfu.cancelUpload(fileId);
|
this.swfu.cancelUpload(fileId);
|
||||||
},
|
},
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Getters and setters.
|
* Getters and setters.
|
||||||
*/
|
*/
|
||||||
setFolderID: function(id) {
|
setFolderID: function(id) {
|
||||||
this.folderID = id;
|
this.folderID = id;
|
||||||
},
|
},
|
||||||
|
|
||||||
getFilesUploaded: function() {
|
getFilesUploaded: function() {
|
||||||
return this.filesUploaded;
|
return this.filesUploaded;
|
||||||
},
|
},
|
||||||
|
|
||||||
getFilesToUpload: function() {
|
getFilesToUpload: function() {
|
||||||
return this.filesToUpload;
|
return this.filesToUpload;
|
||||||
},
|
},
|
||||||
|
|
||||||
getUploadMessage: function() {
|
getUploadMessage: function() {
|
||||||
return this.uploadMessage;
|
return this.uploadMessage;
|
||||||
},
|
},
|
||||||
|
|
||||||
isUploadInProgress: function() {
|
isUploadInProgress: function() {
|
||||||
return this.uploadInProgress;
|
return this.uploadInProgress;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user