OSB enhancements to date
@ -2,7 +2,7 @@
|
||||
RewriteEngine On
|
||||
|
||||
# Installation directory
|
||||
RewriteBase /kohana/
|
||||
RewriteBase /osb/
|
||||
|
||||
# Protect hidden files from being viewed
|
||||
<Files .*>
|
||||
@ -11,11 +11,11 @@ RewriteBase /kohana/
|
||||
</Files>
|
||||
|
||||
# Protect application and system files from being viewed
|
||||
RewriteRule ^(?:application|modules|system)\b.* index.php/$0 [L]
|
||||
RewriteRule ^(?:application|modules|includes/kohana)\b.* kh.php/$0 [L]
|
||||
|
||||
# Allow any files or directories that exist to be displayed directly
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
|
||||
# Rewrite all other URLs to index.php/URL
|
||||
RewriteRule .* index.php/$0 [PT]
|
||||
# Rewrite all other URLs to kh.php/URL
|
||||
RewriteRule .* kh.php/$0 [PT]
|
||||
|
@ -8,7 +8,7 @@
|
||||
* @see http://kohanaframework.org/guide/using.configuration
|
||||
* @see http://php.net/timezones
|
||||
*/
|
||||
date_default_timezone_set('America/Chicago');
|
||||
date_default_timezone_set('Australia/Melbourne');
|
||||
|
||||
/**
|
||||
* Set the default locale.
|
||||
@ -50,7 +50,8 @@ ini_set('unserialize_callback_func', 'spl_autoload_call');
|
||||
* - boolean caching enable or disable internal caching FALSE
|
||||
*/
|
||||
Kohana::init(array(
|
||||
'base_url' => '/',
|
||||
'base_url' => '/osb',
|
||||
'index_file' => '',
|
||||
));
|
||||
|
||||
/**
|
||||
@ -67,16 +68,32 @@ Kohana::$config->attach(new Kohana_Config_File);
|
||||
* Enable modules. Modules are referenced by a relative or absolute path.
|
||||
*/
|
||||
Kohana::modules(array(
|
||||
// 'auth' => SMDPATH.'auth', // Basic authentication
|
||||
// 'cache' => SMDPATH.'cache', // Caching with multiple backends
|
||||
'auth' => SMDPATH.'auth', // Basic authentication
|
||||
'cache' => SMDPATH.'cache', // Caching with multiple backends
|
||||
// 'codebench' => SMDPATH.'codebench', // Benchmarking tool
|
||||
// 'database' => SMDPATH.'database', // Database access
|
||||
'database' => SMDPATH.'database', // Database access
|
||||
// 'image' => SMDPATH.'image', // Image manipulation
|
||||
// 'orm' => SMDPATH.'orm', // Object Relationship Mapping
|
||||
'orm' => SMDPATH.'orm', // Object Relationship Mapping
|
||||
// 'oauth' => SMDPATH.'oauth', // OAuth authentication
|
||||
// 'pagination' => SMDPATH.'pagination', // Paging of results
|
||||
// 'unittest' => SMDPATH.'unittest', // Unit testing
|
||||
// 'userguide' => SMDPATH.'userguide', // User guide and API documentation
|
||||
'xml' => SMDPATH.'xml', // XML module for Kohana 3 PHP Framework
|
||||
'email' => SMDPATH.'email', // Email module for Kohana 3 PHP Framework
|
||||
'gchart' => MODPATH.'gchart', // Google Chart Module
|
||||
));
|
||||
|
||||
/**
|
||||
* Load our modules defined in the DB
|
||||
*/
|
||||
Kohana::modules(array_merge(Kohana::modules(),Config::appmodules()));
|
||||
|
||||
/**
|
||||
* Enable admin, user (account), reseller and affiliate interfaces
|
||||
*/
|
||||
Route::set('sections', '<directory>/<controller>(/<action>(/<id>(/<sid>)))',
|
||||
array(
|
||||
'directory' => '('.implode('|',Kohana::config('config.method_directory')).')' //(account|admin|affiliate|reseller|task)'
|
||||
));
|
||||
|
||||
/**
|
||||
@ -89,6 +106,20 @@ Route::set('default', '(<controller>(/<action>(/<id>)))')
|
||||
'action' => 'index',
|
||||
));
|
||||
|
||||
// Static file serving (CSS, JS, images)
|
||||
Route::set('default/media', 'media(/<file>)', array('file' => '.+'))
|
||||
->defaults(array(
|
||||
'controller' => 'welcome',
|
||||
'action' => 'media',
|
||||
'file' => NULL,
|
||||
));
|
||||
|
||||
// Make sure their PHP version is current enough
|
||||
if (strcmp(phpversion(),'5.3') < 0) {
|
||||
echo 'This application requires PHP 5.3 or newer to run';
|
||||
die();
|
||||
}
|
||||
|
||||
if ( ! defined('SUPPRESS_REQUEST'))
|
||||
{
|
||||
/**
|
||||
|
2
application/cache/.htaccess
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
order allow,deny
|
||||
deny from all
|
4
application/classes/block.php
Normal file
@ -0,0 +1,4 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
class Block extends lnApp_Block {}
|
||||
?>
|
4
application/classes/breadcrumb.php
Normal file
@ -0,0 +1,4 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
class Breadcrumb extends lnApp_Breadcrumb {}
|
||||
?>
|
50
application/classes/company.php
Normal file
@ -0,0 +1,50 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* This class is for access company informaiton.
|
||||
*
|
||||
* @package OSB
|
||||
* @subpackage Page
|
||||
* @category Helpers
|
||||
* @author Deon George
|
||||
* @copyright (c) 2010 Deon George
|
||||
* @license http://dev.leenooks.net/license.html
|
||||
*/
|
||||
class Company {
|
||||
public static function instance() {
|
||||
return new Company;
|
||||
}
|
||||
|
||||
public static function address($ln='<br/>') {
|
||||
// @todo Company address should be calculated
|
||||
return implode($ln,array('PO Box 149','Bendigo, VIC 3550'));
|
||||
}
|
||||
|
||||
public static function contacts() {
|
||||
// @todo Company phone should be calculated
|
||||
return 'Tel: 03 5410 1135';
|
||||
}
|
||||
|
||||
public static function render() {
|
||||
echo static::name();
|
||||
echo static::address();
|
||||
echo static::contacts();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the HTML to render the company address
|
||||
*/
|
||||
public function __toString() {
|
||||
try {
|
||||
return static::render();
|
||||
}
|
||||
|
||||
// Display the exception message
|
||||
catch (Exception $e) {
|
||||
Kohana::exception_handler($e);
|
||||
|
||||
return '';
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
4
application/classes/config.php
Normal file
@ -0,0 +1,4 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
class Config extends lnApp_Config {}
|
||||
?>
|
4
application/classes/controller/default.php
Normal file
@ -0,0 +1,4 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
class Controller_Default extends Controller_lnApp_Default {}
|
||||
?>
|
75
application/classes/controller/lnapp/default.php
Normal file
@ -0,0 +1,75 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* This class provides the default controller for rendering pages.
|
||||
*
|
||||
* @package lnApp
|
||||
* @subpackage Page
|
||||
* @category Abstract/Controllers
|
||||
* @author Deon George
|
||||
* @copyright (c) 2010 Deon George
|
||||
* @license http://dev.leenooks.net/license.html
|
||||
*/
|
||||
abstract class Controller_lnApp_Default extends Controller {
|
||||
/**
|
||||
* Controls access to this controller.
|
||||
* Can be set to a string or an array, for example 'login' or array('login', 'admin')
|
||||
* Note that in second(array) example, user must have both 'login' AND 'admin' roles set in database
|
||||
*
|
||||
* @var boolean is authenticate required with this controller
|
||||
*/
|
||||
protected $auth_required = FALSE;
|
||||
/**
|
||||
* If redirecting to a login page, which page to redirect to
|
||||
*/
|
||||
protected $noauth_redirect = 'login';
|
||||
/**
|
||||
* Controls access for separate actions, eg:
|
||||
* 'adminpanel' => 'admin' will only allow users with the role admin to access action_adminpanel
|
||||
* 'moderatorpanel' => array('login', 'moderator') will only allow users with the roles login and moderator to access action_moderatorpanel
|
||||
*
|
||||
* @var array actions that require a valid user
|
||||
*/
|
||||
protected $secure_actions = array();
|
||||
|
||||
/**
|
||||
* Check and see if this controller needs authentication
|
||||
*
|
||||
* if $this->auth_required is TRUE, then the user must be logged in only.
|
||||
* if $this->auth_required is FALSE, AND $this->secure_actions has an array of
|
||||
* methods set to TRUE, then the user must be logged in AND a member of the
|
||||
* role.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
protected function _auth_required() {
|
||||
// If our global configurable is disabled, then continue
|
||||
if (! Kohana::Config('config.method_security'))
|
||||
return FALSE;
|
||||
|
||||
return (($this->auth_required !== FALSE && Auth::instance()->logged_in() === FALSE) ||
|
||||
(is_array($this->secure_actions) && array_key_exists($this->request->action,$this->secure_actions) &&
|
||||
Auth::instance()->logged_in($this->secure_actions[$this->request->action]) === FALSE));
|
||||
}
|
||||
|
||||
public function before() {
|
||||
parent::before();
|
||||
|
||||
// Check user auth and role
|
||||
if ($this->_auth_required()) {
|
||||
// For AJAX/JSON requests, authorisation is controlled in the method.
|
||||
if (Request::$is_ajax && $this->request->action === 'json') {
|
||||
// Nothing required.
|
||||
|
||||
// For no AJAX/JSON requests, display an access page
|
||||
} elseif (Auth::instance()->logged_in(NULL,get_class($this).'|'.__METHOD__)) {
|
||||
Request::instance()->redirect('login/noaccess');
|
||||
|
||||
} else {
|
||||
Session::instance()->set('afterlogin',Request::instance()->uri());
|
||||
Request::instance()->redirect($this->noauth_redirect);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
26
application/classes/controller/lnapp/logout.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* This class provides logout capability
|
||||
*
|
||||
* @package lnApp
|
||||
* @subpackage Page/Logout
|
||||
* @category Controllers
|
||||
* @author Deon George
|
||||
* @copyright (c) 2010 Deon George
|
||||
* @license http://dev.leenooks.net/license.html
|
||||
* @also [login]
|
||||
*/
|
||||
class Controller_lnApp_Logout extends Controller {
|
||||
public function action_index() {
|
||||
# If user already signed-in
|
||||
if (Auth::instance()->logged_in()!= 0) {
|
||||
Auth::instance()->logout();
|
||||
|
||||
Request::instance()->redirect('login');
|
||||
}
|
||||
|
||||
Request::instance()->redirect('welcome/index');
|
||||
}
|
||||
}
|
||||
?>
|
279
application/classes/controller/lnapp/templatedefault.php
Normal file
@ -0,0 +1,279 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* This class provides the default template controller for rendering pages.
|
||||
*
|
||||
* @package lnApp
|
||||
* @subpackage Page/Template
|
||||
* @category Controllers
|
||||
* @author Deon George
|
||||
* @copyright (c) 2010 Deon George
|
||||
* @license http://dev.leenooks.net/license.html
|
||||
*/
|
||||
abstract class Controller_lnApp_TemplateDefault extends Controller_Template {
|
||||
/**
|
||||
* @var string page template
|
||||
*/
|
||||
public $template = 'lnapp/default';
|
||||
/**
|
||||
* @var string page media route as per [Route]
|
||||
*/
|
||||
protected $mediaroute = 'default/media';
|
||||
/**
|
||||
* @var object meta object information as per [meta]
|
||||
*/
|
||||
protected $meta;
|
||||
/**
|
||||
* Controls access to this controller.
|
||||
* Can be set to a string or an array, for example 'login' or array('login', 'admin')
|
||||
* Note that in second(array) example, user must have both 'login' AND 'admin' roles set in database
|
||||
*
|
||||
* @var boolean is authenticate required with this controller
|
||||
*/
|
||||
protected $auth_required = FALSE;
|
||||
/**
|
||||
* If redirecting to a login page, which page to redirect to
|
||||
*/
|
||||
protected $noauth_redirect = 'login';
|
||||
/**
|
||||
* Controls access for separate actions, eg:
|
||||
* 'adminpanel' => 'admin' will only allow users with the role admin to access action_adminpanel
|
||||
* 'moderatorpanel' => array('login', 'moderator') will only allow users with the roles login and moderator to access action_moderatorpanel
|
||||
*
|
||||
* @var array actions that require a valid user
|
||||
*/
|
||||
protected $secure_actions = array(
|
||||
'menu' => TRUE,
|
||||
);
|
||||
|
||||
/**
|
||||
* Check and see if this controller needs authentication
|
||||
*
|
||||
* if $this->auth_required is TRUE, then the user must be logged in only.
|
||||
* if $this->auth_required is FALSE, AND $this->secure_actions has an array of
|
||||
* methods set to TRUE, then the user must be logged in AND a member of the
|
||||
* role.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
protected function _auth_required() {
|
||||
// If our global configurable is disabled, then continue
|
||||
if (! Kohana::Config('config.method_security'))
|
||||
return FALSE;
|
||||
|
||||
return (($this->auth_required !== FALSE && Auth::instance()->logged_in() === FALSE) ||
|
||||
(is_array($this->secure_actions) && array_key_exists($this->request->action,$this->secure_actions) &&
|
||||
Auth::instance()->logged_in($this->secure_actions[$this->request->action]) === FALSE));
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the template [View] object.
|
||||
*
|
||||
* Page information is provided by [meta].
|
||||
* @uses meta
|
||||
*/
|
||||
public function before() {
|
||||
// Do not template media files
|
||||
if ($this->request->action === 'media') {
|
||||
$this->auto_render = FALSE;
|
||||
return;
|
||||
}
|
||||
|
||||
parent::before();
|
||||
|
||||
// Check user auth and role
|
||||
if ($this->_auth_required()) {
|
||||
if (Kohana::$is_cli)
|
||||
throw new Kohana_Exception('Cant run :method, authentication not possible',array(':method'=>$this->request->action));
|
||||
|
||||
// If auth is required and the user is logged in, then they dont have access.
|
||||
// (We have already checked authorisation.)
|
||||
if (Auth::instance()->logged_in(NULL,get_class($this).'|'.__METHOD__)) {
|
||||
if (Config::sitemode() == Kohana::DEVELOPMENT)
|
||||
SystemMessage::add(array(
|
||||
'title'=>_('Insufficient Access'),
|
||||
'type'=>'debug',
|
||||
'body'=>Kohana::debug(array('required'=>$this->auth_required,'action'=>$this->request->action,'user'=>Auth::instance()->get_user()->username)),
|
||||
));
|
||||
|
||||
// @todo Login No Access redirects are not handled in JS?
|
||||
if (Request::$is_ajax) {
|
||||
echo _('You dont have enough permissions.');
|
||||
die();
|
||||
} else
|
||||
Request::instance()->redirect('login/noaccess');
|
||||
|
||||
} else {
|
||||
Session::instance()->set('afterlogin',Request::instance()->uri());
|
||||
Request::instance()->redirect($this->noauth_redirect);
|
||||
}
|
||||
}
|
||||
|
||||
// For AJAX calls, we dont need to render the complete page.
|
||||
if (Request::$is_ajax) {
|
||||
$this->auto_render = FALSE;
|
||||
return;
|
||||
}
|
||||
|
||||
// Bind our template meta variable
|
||||
$this->meta = new meta;
|
||||
View::bind_global('meta',$this->meta);
|
||||
|
||||
// Our default style sheet
|
||||
Style::add(array(
|
||||
'type'=>'file',
|
||||
'data'=>'css/default.css',
|
||||
));
|
||||
|
||||
// Our default scripts
|
||||
// This is in a reverse list, since we push them to the beginging of the scripts to render.
|
||||
foreach (array('file'=>array(
|
||||
'js/jquery.cookie.js',
|
||||
'js/jquery.jstree-1.0rc.js',
|
||||
'js/jquery-1.4.2.js',
|
||||
)) as $type => $datas) {
|
||||
|
||||
foreach ($datas as $data) {
|
||||
Script::add(array(
|
||||
'type'=>$type,
|
||||
'data'=>$data,
|
||||
),TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
// Initialise our content
|
||||
$this->template->left = '';
|
||||
$this->template->content = '';
|
||||
$this->template->right = '';
|
||||
}
|
||||
|
||||
public function after() {
|
||||
if ($this->auto_render) {
|
||||
// Application Title
|
||||
$this->meta->title = 'Application Title';
|
||||
$this->template->title = '';
|
||||
|
||||
// Style Sheets Properties
|
||||
$this->meta->styles = Style::factory();
|
||||
|
||||
// Script Properties
|
||||
$this->meta->scripts = Script::factory();
|
||||
|
||||
// Application logo
|
||||
$this->template->logo = Config::logo();
|
||||
|
||||
// Link images on the header line
|
||||
$this->template->headimages = $this->_headimages();
|
||||
|
||||
// Control Line
|
||||
$this->template->control = $this->_control();
|
||||
|
||||
// System Messages line
|
||||
$this->template->sysmsg = $this->_sysmsg();
|
||||
|
||||
// Left Item
|
||||
$this->template->left = $this->_left();
|
||||
|
||||
// Right Item
|
||||
$this->template->right = $this->_right();
|
||||
|
||||
// Footer
|
||||
$this->template->footer = $this->_footer();
|
||||
|
||||
// For any ajax rendered actions, we'll need to capture the content and put it in the response
|
||||
} elseif (Request::$is_ajax && isset($this->template->content) && ! $this->request->response) {
|
||||
// @todo move this formatting to a view?
|
||||
if ($s = $this->_sysmsg() AND (string)$s) {
|
||||
$this->request->response = sprintf('<table class="sysmsg"><tr><td>%s</td></tr></table>',$s);
|
||||
} else
|
||||
$this->request->response = '';
|
||||
|
||||
# In case there any style sheets or scrpits for this render.
|
||||
$this->request->response .= Style::factory();
|
||||
|
||||
# Get the response body
|
||||
$this->request->response .= sprintf('<table class="content"><tr><td>%s</td></tr></table>',$this->template->content);
|
||||
}
|
||||
|
||||
parent::after();
|
||||
}
|
||||
|
||||
/**
|
||||
* Default Method to call from the tree menu
|
||||
*/
|
||||
public function action_menu() {
|
||||
$this->template->content = 'See menu on tree';
|
||||
}
|
||||
|
||||
protected function _headimages() {
|
||||
HeadImages::add(array(
|
||||
'url'=>'http://dev.leenooks.net',
|
||||
'img'=>'img/forum-big.png',
|
||||
'attrs'=>array('onclick'=>"target='_blank';",'title'=>'Link')
|
||||
));
|
||||
|
||||
return HeadImages::factory();
|
||||
}
|
||||
|
||||
/**
|
||||
* Render our control menu bar
|
||||
*/
|
||||
protected function _control() {
|
||||
return Breadcrumb::factory();
|
||||
}
|
||||
|
||||
protected function _sysmsg() {
|
||||
return SystemMessage::factory();
|
||||
}
|
||||
|
||||
protected function _left() {
|
||||
return empty($this->template->left) ? Controller_Tree::js() : $this->template->left;
|
||||
}
|
||||
|
||||
protected function _right() {
|
||||
return empty($this->template->right) ? '' : $this->template->right;
|
||||
}
|
||||
|
||||
public function _footer() {
|
||||
return sprintf('© %s',Config::SiteName());
|
||||
}
|
||||
|
||||
/**
|
||||
* This action will render all the media related files for a page
|
||||
* @return void
|
||||
*/
|
||||
final public function action_media() {
|
||||
// Generate and check the ETag for this file
|
||||
$this->request->check_cache(sha1($this->request->uri));
|
||||
|
||||
// Get the file path from the request
|
||||
$file = $this->request->param('file');
|
||||
|
||||
// Find the file extension
|
||||
$ext = pathinfo($file, PATHINFO_EXTENSION);
|
||||
|
||||
// Remove the extension from the filename
|
||||
$file = substr($file, 0, -(strlen($ext) + 1));
|
||||
|
||||
// First try and find media files for the site_id
|
||||
if ($f = Kohana::find_file(sprintf('media/%s',Config::siteid()), $file, $ext)) {
|
||||
// Send the file content as the response
|
||||
$this->request->response = file_get_contents($f);
|
||||
|
||||
// If not found try a default media file
|
||||
} elseif ($f = Kohana::find_file('media', $file, $ext)) {
|
||||
// Send the file content as the response
|
||||
$this->request->response = file_get_contents($f);
|
||||
|
||||
} else {
|
||||
// Return a 404 status
|
||||
$this->request->status = 404;
|
||||
}
|
||||
|
||||
// Set the proper headers to allow caching
|
||||
$this->request->headers['Content-Type'] = File::mime_by_ext($ext);
|
||||
$this->request->headers['Content-Length'] = filesize($f);
|
||||
$this->request->headers['Last-Modified'] = date('r', filemtime($f));
|
||||
}
|
||||
}
|
||||
?>
|
110
application/classes/controller/lnapp/tree.php
Normal file
@ -0,0 +1,110 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* This class extends renders OSB menu tree.
|
||||
*
|
||||
* @package lnApp
|
||||
* @subpackage Tree
|
||||
* @category Controllers
|
||||
* @author Deon George
|
||||
* @copyright (c) 2010 Open Source Billing
|
||||
* @license http://dev.osbill.net/license.html
|
||||
*/
|
||||
class Controller_lnApp_Tree extends Controller_Default {
|
||||
// Our tree data
|
||||
protected $treedata;
|
||||
/**
|
||||
* @var string page media route as per [Route]
|
||||
*/
|
||||
protected static $mediaroute = 'default/media';
|
||||
|
||||
public function after() {
|
||||
parent::after();
|
||||
|
||||
$this->request->headers['Content-Type'] = 'application/json';
|
||||
$this->request->response = sprintf('[%s]',json_encode($this->treedata));
|
||||
}
|
||||
|
||||
public static function js() {
|
||||
$mediapath = Route::get(static::$mediaroute);
|
||||
|
||||
return '
|
||||
<div id="tree" class=""></div>
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
$("#tree").jstree({
|
||||
themes : {
|
||||
"theme" : "default",
|
||||
"url" : "'.URL::site($mediapath->uri(array('file'=>'css/jquery.jstree.css'))).'",
|
||||
},
|
||||
ui : {
|
||||
"select_limit" : 1,
|
||||
"select_node" : false,
|
||||
},
|
||||
cookies : {
|
||||
"save_selected" : false,
|
||||
},
|
||||
json_data : {
|
||||
"correct_state" : "true",
|
||||
"progressive_render" : "true",
|
||||
"ajax" : {
|
||||
"url" : "'.URL::site('/tree/json').'",
|
||||
"data" : function (n) {
|
||||
return { id : n.attr ? n.attr("id") : "N_"+0 };
|
||||
}
|
||||
}
|
||||
},
|
||||
plugins : [ "themes", "json_data", "ui", "cookies" ],
|
||||
});
|
||||
|
||||
// On selection
|
||||
$("#tree").bind("select_node.jstree", function (e, data) {
|
||||
if (a = data.rslt.obj.attr(\'id\').indexOf(\'_\')) {
|
||||
id = data.rslt.obj.attr(\'id\').substr(a+1);
|
||||
|
||||
if (href = $("#N_"+id).attr("href"))
|
||||
$("#ajBODY").load(href, function(r,s,x) {
|
||||
if (s == "error") {
|
||||
var msg = "Sorry but there was an error: ";
|
||||
$("#ajBODY").html(msg + x.status + " " + x.statusText + r);
|
||||
}
|
||||
});
|
||||
else
|
||||
alert("Unknown: "+id+" HREF:"+href);
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw the Tree Menu
|
||||
*
|
||||
* The incoming ID is either a Branch B_x or a Node N_x
|
||||
* Where X is actually the module.
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
public function action_json($id=null) {
|
||||
if ($this->_auth_required()) {
|
||||
$this->treedata = array('attr'=>array('id'=>'a_login'),
|
||||
'data'=>array('title'=>_('Please Login').'...','attr'=>array('id'=>'login','href'=>URL::site('/login'))));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$this->treedata = array();
|
||||
$data = array();
|
||||
|
||||
foreach ($data as $branch) {
|
||||
array_push($this->treedata,array(
|
||||
'attr'=>array('id'=>sprintf('B_%s',$branch['id'])),
|
||||
'state'=>$branch['state'],
|
||||
'data'=>array('title'=>$branch['name']),
|
||||
'attr'=>array('id'=>sprintf('N_%s',$branch['id']),'href'=>empty($branch['attr_href']) ? URL::site(sprintf('/%s/menu',$branch['name'])) : $branch['attr_href']),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
209
application/classes/controller/login.php
Normal file
@ -0,0 +1,209 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* This class provides login capability
|
||||
*
|
||||
* @package lnApp
|
||||
* @subpackage Page/Login
|
||||
* @category Controllers
|
||||
* @author Deon George
|
||||
* @copyright (c) 2010 Deon George
|
||||
* @license http://dev.leenooks.net/license.html
|
||||
* @also [logout]
|
||||
*/
|
||||
class Controller_Login extends Controller_TemplateDefault {
|
||||
public function action_index() {
|
||||
// If user already signed-in
|
||||
if (Auth::instance()->logged_in()!= 0) {
|
||||
// Redirect to the user account
|
||||
Request::instance()->redirect('welcome/index');
|
||||
}
|
||||
|
||||
// If there is a post and $_POST is not empty
|
||||
if ($_POST) {
|
||||
// Instantiate a new user
|
||||
$user = ORM::factory('account');
|
||||
|
||||
// Check Auth
|
||||
$status = $user->login($_POST);
|
||||
|
||||
// If the post data validates using the rules setup in the user model
|
||||
if ($status) {
|
||||
// Redirect to the user account
|
||||
if ($redir = Session::instance()->get('afterlogin')) {
|
||||
Session::instance()->delete('afterlogin');
|
||||
Request::instance()->redirect($redir);
|
||||
|
||||
} else
|
||||
Request::instance()->redirect('welcome/index');
|
||||
|
||||
} else {
|
||||
SystemMessage::add(array(
|
||||
'title'=>_('Invalid username or password'),
|
||||
'type'=>'error',
|
||||
'body'=>_('The username or password was invalid.')
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
Block::add(array(
|
||||
'title'=>_('Login to server'),
|
||||
'body'=>View::factory('login'),
|
||||
'style'=>array('css/login.css'=>'screen'),
|
||||
));
|
||||
|
||||
$this->template->control = HTML::anchor($this->request->uri(),'Login',array('id'=>'ajxbody'));
|
||||
$this->template->content = Block::factory();
|
||||
|
||||
Script::add(array('type'=>'stdin','data'=>'
|
||||
$(document).ready(function() {
|
||||
$("#ajxbody").click(function() {$("#ajBODY").load("'.$this->request->uri().'/"); return false;});
|
||||
});'
|
||||
));
|
||||
}
|
||||
|
||||
public function action_register() {
|
||||
// If user already signed-in
|
||||
if (Auth::instance()->logged_in()!= 0) {
|
||||
// Redirect to the user account
|
||||
Request::instance()->redirect('welcome/index');
|
||||
}
|
||||
|
||||
// Instantiate a new user
|
||||
$account = ORM::factory('account');
|
||||
|
||||
// If there is a post and $_POST is not empty
|
||||
if ($_POST) {
|
||||
// Check Auth
|
||||
$status = $account->values($_POST)->check();
|
||||
|
||||
if (! $status) {
|
||||
foreach ($account->validate()->errors() as $f=>$r) {
|
||||
// $r[0] has our reason for validation failure
|
||||
switch ($r[0]) {
|
||||
// Generic validation reason
|
||||
default:
|
||||
SystemMessage::add(array(
|
||||
'title'=>_('Validation failed'),
|
||||
'type'=>'error',
|
||||
'body'=>sprintf(_('The defaults on your submission were not valid for field %s (%s).'),$f,$r[0])
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$ido = ORM::factory('module')
|
||||
->where('name','=','account')
|
||||
->find();
|
||||
|
||||
$account->id = $ido->record_id->next_id($ido->id);
|
||||
// Save the user details
|
||||
if ($account->save()) {}
|
||||
|
||||
}
|
||||
|
||||
SystemMessage::add(array(
|
||||
'title'=>_('Already have an account?'),
|
||||
'type'=>'info',
|
||||
'body'=>_('If you already have an account, please login..')
|
||||
));
|
||||
|
||||
Block::add(array(
|
||||
'title'=>_('Register'),
|
||||
'body'=>View::factory('bregister')
|
||||
->set('account',$account)
|
||||
->set('errors',$account->validate()->errors()),
|
||||
'style'=>array('css/bregister.css'=>'screen'),
|
||||
));
|
||||
|
||||
$this->template->control = HTML::anchor($this->request->uri(),'Register',array('id'=>'ajxbody'));
|
||||
$this->template->content = Block::factory();
|
||||
$this->template->left = HTML::anchor('login','Login').'...';
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable user password reset
|
||||
*/
|
||||
public function action_reset() {
|
||||
// If user already signed-in
|
||||
if (Auth::instance()->logged_in()!= 0) {
|
||||
// Redirect to the user account
|
||||
Request::instance()->redirect('welcome/index');
|
||||
}
|
||||
|
||||
// If the user posted their details to reset their password
|
||||
if ($_POST) {
|
||||
// If the email address is correct, create a method token
|
||||
if (! empty($_POST['email']) AND ($ao=ORM::factory('account',array('email'=>$_POST['email']))) AND $ao->loaded()) {
|
||||
$mt = ORM::factory('module_method_token');
|
||||
|
||||
// Find out our password reset method id
|
||||
// @todo move this to a more generic method, so that it can be called by other methods
|
||||
$mo = ORM::factory('module',array('name'=>'account'));
|
||||
$mmo = ORM::factory('module_method',array('name'=>'user_resetpassword','module_id'=>$mo->id));
|
||||
|
||||
// Check to see if there is already a token, if so, do nothing.
|
||||
if ($mt->where('account_id','=',$ao->id)->and_where('method_id','=',$mmo->id)->find()) {
|
||||
if ($mt->date_expire < time()) {
|
||||
$mt->delete();
|
||||
$mt->clear();
|
||||
}
|
||||
}
|
||||
|
||||
if (! $mt->loaded()) {
|
||||
$mt->account_id = $ao->id;
|
||||
$mt->method_id = $mmo->id;
|
||||
$mt->date_expire = time() + 15*3600;
|
||||
$mt->token = md5(sprintf('%s:%s:%s',$mt->account_id,$mt->method_id,$mt->date_expire));
|
||||
$mt->save();
|
||||
|
||||
// Send our email with the token
|
||||
$et = EmailTemplate::instance('account_reset_password');
|
||||
$et->to = array($mt->account->email=>sprintf('%s %s',$mt->account->first_name,$mt->account->last_name));
|
||||
$et->variables = array(
|
||||
'SITE'=>URL::base(TRUE,TRUE),
|
||||
'SITE_ADMIN'=>Config::sitename(),
|
||||
'SITE_NAME'=>Config::sitename(),
|
||||
'TOKEN'=>$mt->token,
|
||||
'USER_NAME'=>sprintf('%s %s',$mt->account->first_name,$mt->account->last_name),
|
||||
);
|
||||
$et->send();
|
||||
}
|
||||
|
||||
// Redirect to our password reset, the Auth will validate the token.
|
||||
} elseif (! empty($_REQUEST['token'])) {
|
||||
Request::instance()->redirect(sprintf('user/account/resetpassword?token=%s',$_REQUEST['token']));
|
||||
}
|
||||
|
||||
// Show our token screen even if the email was invalid.
|
||||
if (isset($_POST['email']))
|
||||
Block::add(array(
|
||||
'title'=>_('Reset your password'),
|
||||
'body'=>View::factory('login_reset_sent'),
|
||||
'style'=>array('css/login.css'=>'screen'),
|
||||
));
|
||||
else
|
||||
Request::instance()->redirect('login');
|
||||
|
||||
} else {
|
||||
Block::add(array(
|
||||
'title'=>_('Reset your password'),
|
||||
'body'=>View::factory('login_reset'),
|
||||
'style'=>array('css/login.css'=>'screen'),
|
||||
));
|
||||
}
|
||||
|
||||
$this->template->content = Block::factory();
|
||||
}
|
||||
|
||||
public function action_noaccess() {
|
||||
$this->template->content = ' ';
|
||||
|
||||
SystemMessage::add(array(
|
||||
'title'=>_('No access to requested resource'),
|
||||
'type'=>'error',
|
||||
'body'=>_('You do not have access to the requested resource, please contact your administrator.')
|
||||
));
|
||||
}
|
||||
}
|
||||
?>
|
4
application/classes/controller/logout.php
Normal file
@ -0,0 +1,4 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
class Controller_Logout extends Controller_lnApp_Logout {}
|
||||
?>
|
56
application/classes/controller/templatedefault.php
Normal file
@ -0,0 +1,56 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* This class provides the default template controller for rendering pages.
|
||||
*
|
||||
* @package lnApp
|
||||
* @subpackage Page/Template
|
||||
* @category Controllers
|
||||
* @author Deon George
|
||||
* @copyright (c) 2010 Deon George
|
||||
* @license http://dev.leenooks.net/license.html
|
||||
*/
|
||||
class Controller_TemplateDefault extends Controller_lnApp_TemplateDefault {
|
||||
/**
|
||||
* Check and see if this controller needs authentication
|
||||
*
|
||||
* if $this->auth_required is TRUE, then the user must be logged in only.
|
||||
* if $this->auth_required is FALSE, AND $this->secure_actions has an array of
|
||||
* methods set to TRUE, then the user must be logged in AND a member of the
|
||||
* role.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
protected function _auth_required() {
|
||||
// If our global configurable is disabled, then continue
|
||||
if (! Kohana::Config('config.method_security'))
|
||||
return FALSE;
|
||||
|
||||
return (($this->auth_required !== FALSE && Auth::instance()->logged_in(NULL,get_class($this).'|'.__METHOD__) === FALSE) ||
|
||||
(is_array($this->secure_actions) && array_key_exists($this->request->action,$this->secure_actions) &&
|
||||
Auth::instance()->logged_in($this->secure_actions[$this->request->action],get_class($this).'|'.__METHOD__) === FALSE));
|
||||
}
|
||||
|
||||
protected function _left() {
|
||||
if ($this->template->left)
|
||||
return $this->template->left;
|
||||
|
||||
elseif (Auth::instance()->logged_in(NULL,get_class($this).'|'.__METHOD__))
|
||||
return Controller_Tree::js();
|
||||
}
|
||||
|
||||
protected function _right() {
|
||||
if ($this->template->right)
|
||||
return $this->template->right;
|
||||
else
|
||||
return $this->_cart();
|
||||
}
|
||||
|
||||
private function _cart() {
|
||||
if (! Cart::instance()->contents()->reset(FALSE)->count_all())
|
||||
return '';
|
||||
|
||||
return Cart::instance()->cart_block();
|
||||
}
|
||||
}
|
||||
?>
|
90
application/classes/controller/tree.php
Normal file
@ -0,0 +1,90 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* This class extends renders OSB menu tree.
|
||||
*
|
||||
* @package lnApp
|
||||
* @subpackage Tree
|
||||
* @category Controllers
|
||||
* @author Deon George
|
||||
* @copyright (c) 2010 Open Source Billing
|
||||
* @license http://dev.osbill.net/license.html
|
||||
*/
|
||||
class Controller_Tree extends Controller_lnApp_Tree {
|
||||
protected $auth_required = TRUE;
|
||||
|
||||
/**
|
||||
* Draw the Tree Menu
|
||||
*
|
||||
* The incoming ID is either a Branch B_x or a Node N_x
|
||||
* Where X is actually the module.
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
public function action_json($id=null) {
|
||||
if ($this->_auth_required()) {
|
||||
$this->treedata = array('attr'=>array('id'=>'a_login'),
|
||||
'data'=>array('title'=>_('Please Login').'...','attr'=>array('id'=>'N_login','href'=>URL::site('login'))));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Get the user details
|
||||
$id = (is_null($id) && isset($_REQUEST['id'])) ? substr($_REQUEST['id'],2) : $id;
|
||||
$user = Auth::instance()->get_user();
|
||||
|
||||
if (! $id) {
|
||||
$modules = array();
|
||||
foreach ($user->groups() as $go)
|
||||
$modules = array_merge($modules,Module_Method::groupmodules($go->id));
|
||||
|
||||
ksort($modules);
|
||||
|
||||
$data = array();
|
||||
foreach ($modules as $module => $details)
|
||||
if (! $details['parent_id'])
|
||||
array_push($data,
|
||||
array('id'=>$details['id'],'name'=>$module,'state'=>'closed')
|
||||
);
|
||||
|
||||
} else {
|
||||
$module = preg_replace('/^N_/','',$id);
|
||||
$methods = array();
|
||||
foreach ($user->groups() as $go)
|
||||
$methods = array_merge($methods,Module_Method::groupmethods($go->id,$module));
|
||||
|
||||
ksort($methods);
|
||||
|
||||
$data = array();
|
||||
foreach ($methods as $method => $details) {
|
||||
if (preg_match('/_/',$method)) {
|
||||
list($mode,$action) = explode('_',$method);
|
||||
$url = URL::site(sprintf('/%s/%s/%s',$mode,$details['module'],$action));
|
||||
} else {
|
||||
$url = URL::site(sprintf('/%s/%s',$details['module'],$method));
|
||||
}
|
||||
|
||||
array_push($data,array(
|
||||
'id'=>sprintf('%s_%s',$module,$details['id']),
|
||||
'name'=>$method,
|
||||
'state'=>'none',
|
||||
'attr_id'=>sprintf('%s_%s',$module,$details['id']),
|
||||
'attr_href'=>(empty($details['page']) ? $url : $details['page'])
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
$this->treedata = array();
|
||||
|
||||
foreach ($data as $branch) {
|
||||
array_push($this->treedata,array(
|
||||
'attr'=>array('id'=>sprintf('B_%s',$branch['id'])),
|
||||
'state'=>$branch['state'],
|
||||
'data'=>array('title'=>$branch['name']),
|
||||
'attr'=>array('id'=>sprintf('N_%s',$branch['id']),'href'=>empty($branch['attr_href']) ? URL::site(sprintf('/%s/menu',$branch['name'])) : $branch['attr_href']),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
@ -1,10 +1,39 @@
|
||||
<?php defined('SYSPATH') or die('No direct script access.');
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
class Controller_Welcome extends Controller {
|
||||
/**
|
||||
* OSB Main home page
|
||||
*
|
||||
* @package OSB
|
||||
* @subpackage Page/Home
|
||||
* @category Controllers
|
||||
* @author Deon George
|
||||
* @copyright (c) 2010 Deon George
|
||||
* @license http://dev.leenooks.net/license.html
|
||||
*/
|
||||
class Controller_Welcome extends Controller_TemplateDefault {
|
||||
public function action_index() {
|
||||
$block = new block;
|
||||
$block->add(array(
|
||||
'title'=>'Welcome to lnApp (public)!',
|
||||
'subtitle'=>'Using lnApp',
|
||||
'body'=>'Sample lnApp application',
|
||||
'footer'=>'lnApp makes building websites easy! '.time(),
|
||||
));
|
||||
|
||||
public function action_index()
|
||||
{
|
||||
$this->request->response = 'hello, world!';
|
||||
if (Auth::instance()->logged_in()) {
|
||||
$this->template->control = HTML::anchor('/logout',_('Logout'),array('id'=>'ajxbody'));
|
||||
} else {
|
||||
$this->template->control = HTML::anchor('/login',_('Login'),array('id'=>'ajxbody'));
|
||||
|
||||
Script::add(array('type'=>'stdin','data'=>'
|
||||
$(document).ready(function() {
|
||||
$("#ajxbody").click(function() {$("#ajBODY").load("'.URL::site('/login').'",null,function(x,s,r) {}); return false;});
|
||||
$("#ajBODY").ajaxSend(function() {$(this).html(\''.sprintf('%s <span class="ajaxmsg">%s<\/span>...',HTML::image('media/img/ajax-progress.gif',array('alt'=>_('Loading Login').'...')),_('Loading Login')).'\');return true;});
|
||||
});'
|
||||
));
|
||||
}
|
||||
|
||||
$this->template->content = $block;
|
||||
}
|
||||
|
||||
} // End Welcome
|
||||
}
|
||||
?>
|
||||
|
20
application/classes/database/mysql.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* MySQL database connection.
|
||||
*
|
||||
* Modified for OSB, so that ORM can use enhanced SQL queries. This has been
|
||||
* achieved by simply removing the identifier backtick.
|
||||
*
|
||||
* @package OSB/Modifications
|
||||
* @subpackage Database
|
||||
* @category Drivers
|
||||
* @author Deon George
|
||||
* @copyright (c) 2010 Open Source Billing
|
||||
* @license http://dev.osbill.net/license
|
||||
*/
|
||||
class Database_MySQL extends Kohana_Database_MySQL {
|
||||
// MySQL uses a backtick for identifiers
|
||||
protected $_identifier = '';
|
||||
}
|
||||
?>
|
4
application/classes/headimages.php
Normal file
@ -0,0 +1,4 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
class HeadImages extends lnApp_HeadImages {}
|
||||
?>
|
4
application/classes/htmlrender.php
Normal file
@ -0,0 +1,4 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
class HTMLRender extends lnApp_HTMLRender {}
|
||||
?>
|
81
application/classes/lnapp/block.php
Normal file
@ -0,0 +1,81 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* This class is for rendering HTML body blocks (left, center, right).
|
||||
*
|
||||
* It will provide a header, body and footer.
|
||||
*
|
||||
* @package lnApp
|
||||
* @subpackage Page
|
||||
* @category Helpers
|
||||
* @author Deon George
|
||||
* @copyright (c) 2010 Deon George
|
||||
* @license http://dev.leenooks.net/license.html
|
||||
* @uses Style
|
||||
*/
|
||||
class lnApp_Block extends HTMLRender {
|
||||
protected static $_data = array();
|
||||
protected static $_spacer = '<table><tr class="spacer"><td> </td></tr></table>';
|
||||
protected static $_required_keys = array('body');
|
||||
|
||||
/**
|
||||
* Add a block to be rendered
|
||||
*
|
||||
* @param array Block attributes
|
||||
*/
|
||||
public static function add($block,$prepend=FALSE) {
|
||||
parent::add($block);
|
||||
|
||||
// Detect any style sheets.
|
||||
if (! empty($block['style']) && is_array($block['style']))
|
||||
foreach ($block['style'] as $data=>$media)
|
||||
Style::add(array(
|
||||
'type'=>'file',
|
||||
'data'=>$data,
|
||||
'media'=>$media,
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an instance of this class
|
||||
*
|
||||
* @return Block
|
||||
*/
|
||||
public static function factory() {
|
||||
return new Block;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render this block
|
||||
*
|
||||
* @see HTMLRender::render()
|
||||
*/
|
||||
protected function render() {
|
||||
$output = '';
|
||||
$styles = array();
|
||||
|
||||
$i = 0;
|
||||
foreach (static::$_data as $value) {
|
||||
if ($i++)
|
||||
$output .= static::$_spacer;
|
||||
|
||||
$output .= '<table class="block" border="0">';
|
||||
|
||||
if (! empty($value['title']))
|
||||
$output .= sprintf('<tr class="title"><td>%s</td></tr>',$value['title']);
|
||||
|
||||
if (! empty($value['subtitle']))
|
||||
$output .= sprintf('<tr class="subtitle"><td>%s</td></tr>',$value['subtitle']);
|
||||
|
||||
$output .= sprintf('<tr class="body"><td>%s</td></tr>',$value['body']);
|
||||
|
||||
if (! empty($value['footer']))
|
||||
$output .= sprintf('<tr class="footer"><td>%s</td></tr>',$value['footer']);
|
||||
|
||||
$output .= '</table>';
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
?>
|
64
application/classes/lnapp/breadcrumb.php
Normal file
@ -0,0 +1,64 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* This class is for rendering a breadcrumb menu.
|
||||
*
|
||||
* @package lnApp
|
||||
* @subpackage Page
|
||||
* @category Helpers
|
||||
* @author Deon George
|
||||
* @copyright (c) 2010 Deon George
|
||||
* @license http://dev.leenooks.net/license.html
|
||||
*/
|
||||
class lnApp_Breadcrumb extends HTMLRender {
|
||||
protected static $_data = array();
|
||||
protected static $_spacer = ' » ';
|
||||
protected static $_required_keys = array('body');
|
||||
|
||||
/**
|
||||
* Set the breadcrumb path
|
||||
*
|
||||
* @param array Block attributes
|
||||
*/
|
||||
public static function set($path) {
|
||||
if (is_string($path))
|
||||
static::$_data['path'] = explode('/',$path);
|
||||
else
|
||||
static::$_data['path'] = $path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable a friendly name to be used for a path
|
||||
*/
|
||||
public static function name($path,$name) {
|
||||
static::$_data['name'][$path] = $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an instance of this class
|
||||
*
|
||||
* @return Breadcrumb
|
||||
*/
|
||||
public static function factory() {
|
||||
return new Breadcrumb;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render this Breadcrumb
|
||||
*/
|
||||
protected function render() {
|
||||
$output = HTML::anchor('/',_('Home'));
|
||||
|
||||
$data = empty(static::$_data['path']) ? explode('/',Request::instance()->uri) : static::$_data['path'];
|
||||
|
||||
foreach ($data as $k => $v) {
|
||||
$output .= static::$_spacer;
|
||||
|
||||
$p = join('/',array_slice($data,0,$k+1));
|
||||
$output .= HTML::anchor($p,empty(static::$_data['name'][$p]) ? ucfirst($v) : static::$_data['name'][$p]);
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
?>
|
129
application/classes/lnapp/config.php
Normal file
@ -0,0 +1,129 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* This class extends the core Kohana class by adding some core application
|
||||
* specific functions, and configuration.
|
||||
*
|
||||
* @package lnApp
|
||||
* @subpackage Core
|
||||
* @category Overrides
|
||||
* @author Deon George
|
||||
* @copyright (c) 2010 Deon George
|
||||
* @license http://dev.leenooks.net/license.html
|
||||
*/
|
||||
abstract class lnApp_Config extends Kohana {
|
||||
/**
|
||||
* Find a list of all database enabled modules
|
||||
*
|
||||
* @uses cache
|
||||
*/
|
||||
public static function appmodules() {
|
||||
$cacheable = TRUE;
|
||||
|
||||
if (array_key_exists('cache',Kohana::modules())) {
|
||||
$cache = Cache::instance(static::cachetype());
|
||||
|
||||
if ($cacheable AND $cache->get('modules'))
|
||||
return $cache->get('modules');
|
||||
|
||||
} else
|
||||
$cache = '';
|
||||
|
||||
$modules = array();
|
||||
$module_table = 'module';
|
||||
|
||||
if (class_exists('Model_'.ucfirst($module_table))) {
|
||||
$mo = ORM::factory($module_table)->where('status','=',1)->find_all()->as_array();
|
||||
|
||||
foreach ($mo as $o)
|
||||
$modules[$o->name] = MODPATH.$o->name;
|
||||
}
|
||||
|
||||
if ($cache)
|
||||
$cache->set('modules',$modules);
|
||||
|
||||
return $modules;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return our site name
|
||||
*/
|
||||
public static function site() {
|
||||
if (! empty($_SERVER['SERVER_NAME']))
|
||||
return $_SERVER['SERVER_NAME'];
|
||||
|
||||
if (! $site = CLI::options('site'))
|
||||
throw new Kohana_Exception(_('Cant figure out the site, use --site= for CLI'));
|
||||
|
||||
return $site['site'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Work out our site ID for multiehosting
|
||||
* @todo Change this to query the DB for site number.
|
||||
*/
|
||||
public static function siteid() {
|
||||
$sites = Kohana::config('config.site');
|
||||
|
||||
// If we havent been configured for sites
|
||||
if (is_null($sites) OR ! is_array($sites) OR ! isset($sites[static::site()]))
|
||||
return 0;
|
||||
else
|
||||
return $sites[static::site()];
|
||||
}
|
||||
|
||||
/**
|
||||
* Work out our site mode (dev,test,prod)
|
||||
* @todo Change this to query the DB for mode.
|
||||
*/
|
||||
public static function sitemode() {
|
||||
$sites = Kohana::config('config.site_mode');
|
||||
|
||||
// If we havent been configured for sites
|
||||
if (is_null($sites) OR ! is_array($sites) OR ! isset($sites[static::site()]))
|
||||
return Kohana::PRODUCTION;
|
||||
else
|
||||
return $sites[static::site()];
|
||||
}
|
||||
|
||||
public static function sitename() {
|
||||
return Kohana::config('config.site_name');
|
||||
}
|
||||
|
||||
public static function logo() {
|
||||
$mediapath = Route::get('default/media');
|
||||
$logo = $mediapath->uri(array('file'=>'img/logo-small.png'),array('alt'=>static::sitename()));
|
||||
|
||||
return HTML::image($logo,array('class'=>'headlogo','alt'=>_('Logo')));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return our caching mechanism
|
||||
*/
|
||||
public static function cachetype() {
|
||||
return is_null(Kohana::config('config.cache_type')) ? 'file' : Kohana::config('config.cache_type');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show a date using a site configured format
|
||||
*/
|
||||
public static function date($date) {
|
||||
return date(Kohana::config('config.date_format'),$date);
|
||||
}
|
||||
|
||||
/**
|
||||
* See if our emails for the template should be sent to configured admin(s)
|
||||
*
|
||||
* @param string template - Template to test for
|
||||
* @return mixed|array - Email to send test emails to
|
||||
*/
|
||||
public static function testmail($template) {
|
||||
$config = Kohana::config('config.email_admin_only');
|
||||
|
||||
if (is_null($config) OR ! is_array($config) OR empty($config[$template]))
|
||||
return FALSE;
|
||||
else
|
||||
return $config[$template];
|
||||
}
|
||||
}
|
||||
?>
|
45
application/classes/lnapp/headimages.php
Normal file
@ -0,0 +1,45 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* This class is for all image icons shown on the page header.
|
||||
*
|
||||
* @package lnApp
|
||||
* @subpackage Page
|
||||
* @category Helpers
|
||||
* @author Deon George
|
||||
* @copyright (c) 2010 Deon George
|
||||
* @license http://dev.leenooks.net/license.html
|
||||
*/
|
||||
class lnApp_HeadImages extends HTMLRender {
|
||||
protected static $_data = array();
|
||||
protected static $_spacer = ' ';
|
||||
protected static $_required_keys = array('url','img');
|
||||
|
||||
/**
|
||||
* Return an instance of this class
|
||||
*
|
||||
* @return HeadImage
|
||||
*/
|
||||
public static function factory() {
|
||||
return new HeadImages;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render this Header Image
|
||||
*
|
||||
* @see HTMLRender::render()
|
||||
*/
|
||||
protected function render() {
|
||||
$output = '';
|
||||
$mediapath = Route::get(static::$_media_path);
|
||||
|
||||
foreach (static::$_data as $value) {
|
||||
$i = HTML::image($mediapath->uri(array('file'=>$value['img'])),array('alt'=>isset($value['attrs']['title']) ? $value['attrs']['title'] : ''));
|
||||
$output .= HTML::anchor($value['url'],$i,(isset($value['attrs']) && is_array($value['attrs'])) ? $value['attrs'] : null);
|
||||
$output .= static::$_spacer;
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
?>
|
94
application/classes/lnapp/htmlrender.php
Normal file
@ -0,0 +1,94 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* This class is the base used for common static methods that are used
|
||||
* for rendering.
|
||||
*
|
||||
* @package lnApp
|
||||
* @subpackage Page
|
||||
* @category Abstract/Helpers
|
||||
* @author Deon George
|
||||
* @copyright (c) 2010 Deon George
|
||||
* @license http://dev.leenooks.net/license.html
|
||||
*/
|
||||
abstract class lnApp_HTMLRender {
|
||||
protected static $_media_path = 'default/media';
|
||||
protected static $_required_keys = array();
|
||||
protected static $_unique_vals = array();
|
||||
|
||||
public function __construct() {
|
||||
if (! isset(static::$_data))
|
||||
throw new Kohana_Exception(':class is missing important static variables',array(':class'=>get_called_class()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an item to be rendered
|
||||
*
|
||||
* @param array Item to be added
|
||||
*/
|
||||
public static function add($item,$prepend=FALSE) {
|
||||
foreach (static::$_required_keys as $key)
|
||||
if (! isset($item[$key]))
|
||||
throw new Kohana_Exception('Missing key :key for image',array(':key'=>$key));
|
||||
|
||||
// Check for unique keys
|
||||
if (static::$_unique_vals)
|
||||
foreach (static::$_unique_vals as $v=>$u)
|
||||
foreach (static::$_data as $d)
|
||||
if (isset($d[$u]) && $d['data'] == $item['data'])
|
||||
return;
|
||||
|
||||
if ($prepend)
|
||||
array_unshift(static::$_data,$item);
|
||||
else
|
||||
array_push(static::$_data,$item);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the space used between rendering output
|
||||
*/
|
||||
public static function setSpacer($spacer) {
|
||||
static::$_spacer = $spacer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the Kohana Media Path, used to determine where to find additional
|
||||
* HTML content required for rendering.
|
||||
*/
|
||||
public static function setMediaPath($path) {
|
||||
static::$_media_path = $path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Factory instance method must be declared by the child class
|
||||
*/
|
||||
public static function factory() {
|
||||
throw new Kohana_Exception(':class is calling :method, when it should have its own method',
|
||||
array(':class'=>get_called_class(),':method'=>__METHOD__));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the HTML to render the header images
|
||||
*/
|
||||
public function __toString() {
|
||||
try {
|
||||
return static::render();
|
||||
}
|
||||
|
||||
// Display the exception message
|
||||
catch (Exception $e) {
|
||||
Kohana::exception_handler($e);
|
||||
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Rendering must be declared by the child class
|
||||
*/
|
||||
protected function render() {
|
||||
throw new Kohana_Exception(':class is calling :method, when it should have its own method',
|
||||
array(':class'=>get_called_class(),':method'=>__METHOD__));
|
||||
}
|
||||
}
|
||||
?>
|
34
application/classes/lnapp/meta.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* This is class is for all HTML page attributes.
|
||||
*
|
||||
* @package lnApp
|
||||
* @subpackage Page
|
||||
* @category Helpers
|
||||
* @author Deon George
|
||||
* @copyright (c) 2010 Deon George
|
||||
* @license http://dev.leenooks.net/license.html
|
||||
*/
|
||||
class lnApp_Meta {
|
||||
private $_data = array();
|
||||
private $_array_keys = array();
|
||||
|
||||
public function __get($key) {
|
||||
if (in_array($key,$this->_array_keys) && empty($this->_data[$key]))
|
||||
return array();
|
||||
|
||||
if (empty($this->_data[$key]))
|
||||
return null;
|
||||
else
|
||||
return $this->_data[$key];
|
||||
}
|
||||
|
||||
public function __set($key,$value) {
|
||||
if (in_array($key,$this->_array_keys) && ! is_array($value))
|
||||
throw new Kohana_Exception('Key :key must be an array',array(':key'=>$key));
|
||||
|
||||
$this->_data[$key] = $value;
|
||||
}
|
||||
}
|
||||
?>
|
59
application/classes/lnapp/script.php
Normal file
@ -0,0 +1,59 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* This class is for rendering HTML script tags
|
||||
*
|
||||
* @package lnApp
|
||||
* @subpackage Page
|
||||
* @category Helpers
|
||||
* @author Deon George
|
||||
* @copyright (c) 2010 Deon George
|
||||
* @license http://dev.leenooks.net/license.html
|
||||
*/
|
||||
class lnApp_Script extends HTMLRender {
|
||||
protected static $_data = array();
|
||||
protected static $_spacer = "\n";
|
||||
protected static $_required_keys = array('type','data');
|
||||
protected static $_unique_vals = array('file'=>'type');
|
||||
|
||||
/**
|
||||
* Return an instance of this class
|
||||
*
|
||||
* @return Script
|
||||
*/
|
||||
public static function factory() {
|
||||
return new Script;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the script tag
|
||||
*
|
||||
* @see HTMLRender::render()
|
||||
*/
|
||||
protected function render() {
|
||||
$foutput = $soutput = '';
|
||||
$mediapath = Route::get(static::$_media_path);
|
||||
|
||||
$i = $j = 0;
|
||||
foreach (static::$_data as $value) {
|
||||
|
||||
switch ($value['type']) {
|
||||
case 'file':
|
||||
$foutput .= HTML::script($mediapath->uri(array('file'=>$value['data'])));
|
||||
if ($i++)
|
||||
$foutput .= static::$_spacer;
|
||||
break;
|
||||
case 'stdin':
|
||||
$soutput .= sprintf("<script type=\"text/javascript\">//<![CDATA[\n%s\n//]]></script>",$value['data']);
|
||||
if ($j++)
|
||||
$soutput .= static::$_spacer;
|
||||
break;
|
||||
default:
|
||||
throw new Kohana_Exception('Unknown style type :type',array(':type'=>$value['type']));
|
||||
}
|
||||
}
|
||||
|
||||
return $foutput.static::$_spacer.$soutput;
|
||||
}
|
||||
}
|
||||
?>
|
54
application/classes/lnapp/style.php
Normal file
@ -0,0 +1,54 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* This class is for rendering HTML style tags
|
||||
*
|
||||
* @package lnApp
|
||||
* @subpackage Page
|
||||
* @category Helpers
|
||||
* @author Deon George
|
||||
* @copyright (c) 2010 Deon George
|
||||
* @license http://dev.leenooks.net/license.html
|
||||
*/
|
||||
class lnApp_Style extends HTMLRender {
|
||||
protected static $_data = array();
|
||||
protected static $_spacer = "\n";
|
||||
protected static $_required_keys = array('type','data');
|
||||
|
||||
/**
|
||||
* Return an instance of this class
|
||||
*
|
||||
* @return Style
|
||||
*/
|
||||
public static function factory() {
|
||||
return new Style;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the style tag
|
||||
*
|
||||
* @see HTMLRender::render()
|
||||
*/
|
||||
protected function render() {
|
||||
$output = '';
|
||||
$mediapath = Route::get(static::$_media_path);
|
||||
|
||||
$i = 0;
|
||||
foreach (static::$_data as $value) {
|
||||
if ($i++)
|
||||
$output .= static::$_spacer;
|
||||
|
||||
switch ($value['type']) {
|
||||
case 'file':
|
||||
$output .= HTML::style($mediapath->uri(array('file'=>$value['data'])),
|
||||
array('media'=>(! empty($value['media'])) ? $value['media'] : 'screen'),TRUE);
|
||||
break;
|
||||
default:
|
||||
throw new Kohana_Exception('Unknown style type :type',array(':type'=>$value['type']));
|
||||
}
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
?>
|
129
application/classes/lnapp/systemmessage.php
Normal file
@ -0,0 +1,129 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* This class is for rendering system information messages.
|
||||
*
|
||||
* @package lnApp
|
||||
* @subpackage SystemMessage
|
||||
* @category Helpers
|
||||
* @author Deon George
|
||||
* @copyright (c) 2010 Deon George
|
||||
* @license http://dev.leenooks.net/license.html
|
||||
*/
|
||||
class lnApp_SystemMessage extends HTMLRender {
|
||||
protected static $_data = array();
|
||||
protected static $_spacer = '<table><tr class="spacer"><td> </td></tr></table>';
|
||||
protected static $_required_keys = array('title','body','type');
|
||||
|
||||
/**
|
||||
* Add a system message to be rendered
|
||||
*
|
||||
* @param array System Message attributes
|
||||
*/
|
||||
public static function add($msg,$prepend=FALSE) {
|
||||
if ($msgs = Session::instance()->get('sessionmsgs')) {
|
||||
static::$_data = $msgs;
|
||||
}
|
||||
|
||||
parent::add($msg);
|
||||
|
||||
// Add a gribber popup
|
||||
Style::add(array(
|
||||
'type'=>'file',
|
||||
'data'=>'css/jquery.gritter.css',
|
||||
'media'=>'screen',
|
||||
));
|
||||
Script::add(array(
|
||||
'type'=>'file',
|
||||
'data'=>'js/jquery.gritter-1.5.js',
|
||||
));
|
||||
Script::add(array(
|
||||
'type'=>'stdin',
|
||||
'data'=>sprintf(
|
||||
'$(document).ready(function() {
|
||||
$.extend($.gritter.options, {
|
||||
fade_in_speed: "medium",
|
||||
fade_out_speed: 2000,
|
||||
time: "3000",
|
||||
sticky: false,
|
||||
});
|
||||
$.gritter.add({
|
||||
title: "%s",
|
||||
text: "%s",
|
||||
image: "%s",
|
||||
});});',$msg['title'],$msg['body'],URL::site().static::image($msg['type'],true))));
|
||||
|
||||
// Save our messages in our session, so that we get them for redirects
|
||||
Session::instance()->set('sessionmsgs',static::$_data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an instance of this class
|
||||
*
|
||||
* @return SystemMessage
|
||||
*/
|
||||
public static function factory() {
|
||||
return new SystemMessage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render an image for the System Message
|
||||
*/
|
||||
private static function image($type,$raw=false,$big=false,$alt='') {
|
||||
$mediapath = Route::get(static::$_media_path);
|
||||
|
||||
switch ($type) {
|
||||
case 'error':
|
||||
$file = sprintf('img/dialog-error%s.png',$big ? '-big' : '');
|
||||
break;
|
||||
case 'info':
|
||||
$file = sprintf('img/dialog-information%s.png',$big ? '-big' : '');
|
||||
break;
|
||||
case 'warning':
|
||||
$file = sprintf('img/dialog-warning%s.png',$big ? '-big' : '');
|
||||
break;
|
||||
case 'debug':
|
||||
$file = sprintf('img/dialog-question%s.png',$big ? '-big' : '');
|
||||
break;
|
||||
default:
|
||||
throw new Kohana_Exception('Unknown system message type :type',array(':type'=>$value['type']));
|
||||
}
|
||||
|
||||
if ($raw)
|
||||
return $mediapath->uri(array('file'=>$file));
|
||||
else
|
||||
return HTML::image($mediapath->uri(array('file'=>$file)),array('alt'=>$alt ? $alt : '','class'=>'sysicon'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Render this system message
|
||||
*
|
||||
* @see HTMLRender::render()
|
||||
*/
|
||||
protected function render() {
|
||||
$output = '';
|
||||
$mediapath = Route::get(static::$_media_path);
|
||||
|
||||
// Reload our message from the session
|
||||
if ($msgs = Session::instance()->get('sessionmsgs')) {
|
||||
Session::instance()->delete('sessionmsgs');
|
||||
static::$_data = $msgs;
|
||||
}
|
||||
|
||||
$i = 0;
|
||||
foreach (static::$_data as $value) {
|
||||
if ($i++)
|
||||
$output .= static::$_spacer;
|
||||
|
||||
$output .= '<table><tr>';
|
||||
$output .= sprintf('<td class="icon" rowspan="2">%s</td>',static::image($value['type'],false,false,isset($value['alt']) ? $value['alt'] : ''));
|
||||
$output .= sprintf('<td class="head">%s</td>',$value['title']);
|
||||
$output .= '</tr><tr>';
|
||||
$output .= sprintf('<td class="body">%s</td>',$value['body']);
|
||||
$output .= '</tr></table>';
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
?>
|
4
application/classes/meta.php
Normal file
@ -0,0 +1,4 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
class Meta extends lnApp_Meta {}
|
||||
?>
|
2
application/classes/model/.htaccess
Normal file
@ -0,0 +1,2 @@
|
||||
order allow,deny
|
||||
deny from all
|
34
application/classes/model/module.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* OSB Application Module Model
|
||||
*
|
||||
* This module must remain in applications/ as it is used very early in the
|
||||
* OSB initialisation.
|
||||
*
|
||||
* @package OSB
|
||||
* @subpackage Modules
|
||||
* @category Models
|
||||
* @author Deon George
|
||||
* @copyright (c) 2010 Deon George
|
||||
* @license http://dev.leenooks.net/license.html
|
||||
*/
|
||||
class Model_Module extends ORMOSB {
|
||||
// Relationships
|
||||
protected $_has_many = array(
|
||||
'module_method'=>array(),
|
||||
);
|
||||
protected $_has_one = array(
|
||||
'record_id'=>array()
|
||||
);
|
||||
|
||||
protected $_sorting = array(
|
||||
'status'=>'DESC',
|
||||
'name'=>'ASC',
|
||||
);
|
||||
|
||||
protected $_formats = array(
|
||||
'status'=>array('StaticList_YesNo::display'=>array()),
|
||||
);
|
||||
}
|
||||
?>
|
153
application/classes/ormosb.php
Normal file
@ -0,0 +1,153 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* This class extends Kohana's [ORM] class to create defaults for OSB.
|
||||
*
|
||||
* @package OSB
|
||||
* @subpackage Core
|
||||
* @category ORM
|
||||
* @author Deon George
|
||||
* @copyright (c) 2010 Open Source Billing
|
||||
* @license http://dev.osbill.net/license.html
|
||||
*/
|
||||
abstract class ORMOSB extends ORM {
|
||||
/**
|
||||
* @var string Database to connect to
|
||||
*/
|
||||
protected $_db = 'default';
|
||||
protected $_object_formated = array();
|
||||
protected $_formated = FALSE;
|
||||
protected $_formats = array();
|
||||
|
||||
/**
|
||||
* @var boolean Database names plural configuration
|
||||
*/
|
||||
protected $_table_names_plural = false;
|
||||
|
||||
protected $_created_column = array('column'=>'date_orig','format'=>TRUE);
|
||||
protected $_updated_column = array('column'=>'date_last','format'=>TRUE);
|
||||
|
||||
protected $_callbacks = array(
|
||||
'id'=>array('get_next_id'),
|
||||
'site_id'=>array('set_site_id'),
|
||||
);
|
||||
|
||||
/**
|
||||
* Format fields for display purposes
|
||||
*
|
||||
* @param string column name
|
||||
* @return mixed
|
||||
*/
|
||||
protected function _format() {
|
||||
$format = Validate::factory($this->_object);
|
||||
|
||||
foreach ($this->_formats as $column => $formats)
|
||||
$format->filters($column,$formats);
|
||||
|
||||
if ($format->check())
|
||||
foreach ($format as $column => $value)
|
||||
$this->_object_formated[$column] = $value;
|
||||
|
||||
$this->_formated = TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a formated columns, as per the model definition
|
||||
*/
|
||||
public function display($column) {
|
||||
// Trigger a load of the record.
|
||||
$value = $this->__get($column);
|
||||
|
||||
// If some of our fields need to be formated for display purposes.
|
||||
if ($this->_loaded AND ! $this->_formated AND $this->_formats)
|
||||
$this->_format();
|
||||
|
||||
if (isset($this->_object_formated[$column]))
|
||||
return $this->_object_formated[$column];
|
||||
else
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Our child models should provide an invoice display, this is shown
|
||||
* on printed invoices.
|
||||
*/
|
||||
public function invoice_display() {
|
||||
throw new Kohana_Exception(':module has not configured an :method, but has made the call',array(':module'=>get_class($this),'method'=>__METHOD__));
|
||||
}
|
||||
|
||||
/**
|
||||
* Override the _load_result() function so that our site ID is automatically
|
||||
* added to the SQL query
|
||||
* @todo This is not picked up by all queries. Need to investigate why
|
||||
* @todo This is not being done by inserts
|
||||
*/
|
||||
protected function _load_result($multiple = FALSE)
|
||||
{
|
||||
$this->_db_builder->where($this->_table_name.'.site_id','=',Config::siteid());
|
||||
|
||||
return parent::_load_result($multiple);
|
||||
}
|
||||
|
||||
/**
|
||||
* This function will enhance the [Validate::filter], since it always passes
|
||||
* the value as the first argument and sometimes functions need that to not
|
||||
* be the first argument.
|
||||
*
|
||||
* Currently this implements:
|
||||
* [date()][date-ref]
|
||||
*
|
||||
* [date-ref]: http://www.php.net/date
|
||||
*
|
||||
* This function will throw an exception if called without a function
|
||||
* defined.
|
||||
*
|
||||
* @param mixed $val Value to be processed
|
||||
* @param string $func Name of function to call
|
||||
* @param string $arg Other arguments for the function
|
||||
*/
|
||||
final public static function _filters($val,$func,$arg) {
|
||||
switch ($func) {
|
||||
case 'date':
|
||||
return date($arg,$val);
|
||||
default:
|
||||
throw new Exception(sprintf(_('Unknown function: %s (%s,%s)'),$func,$arg,$val));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Next record id
|
||||
*
|
||||
* @param array Validate object
|
||||
* @param string Primary Key
|
||||
*/
|
||||
public function get_next_id(Validate $array,$field) {
|
||||
if (! is_null($array[$field]))
|
||||
return TRUE;
|
||||
|
||||
$this->_changed[$field] = $field;
|
||||
|
||||
$ido = ORM::factory('module')
|
||||
->where('name','=',$this->_table_name)
|
||||
->find();
|
||||
|
||||
if (! $ido->loaded())
|
||||
throw new Kohana_Exception('Problem getting record_id for :table',array(':table'=>$this->_table_name));
|
||||
|
||||
$array[$field] = $ido->record_id->next_id($ido->id);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
public function set_site_id(Validate $array,$field) {
|
||||
if (! is_null($array[$field]))
|
||||
return TRUE;
|
||||
|
||||
// @todo This should be a config item
|
||||
$this->_changed[$field] = $field;
|
||||
$array[$field] = Config::siteid();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
?>
|
124
application/classes/period.php
Normal file
@ -0,0 +1,124 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* This is class is for calculating date periods.
|
||||
*
|
||||
* @package OSB
|
||||
* @subpackage Utilities
|
||||
* @category Helpers
|
||||
* @author Deon George
|
||||
* @copyright (c) 2010 Deon George
|
||||
* @license http://dev.leenooks.net/license.html
|
||||
*/
|
||||
class Period {
|
||||
/**
|
||||
* Calculate both the start and end dates for a billing period
|
||||
* and the pro-rata percentage.
|
||||
*
|
||||
* See [StaticList_RecurSchedule]
|
||||
*
|
||||
* @param StaticList_RecurSchedule Period Type [StaticList_RecurSchedule]
|
||||
* @param int Starting date if recurring must start on a day of the month
|
||||
* @param datetime Date to start calculating from, otherwise now() is used
|
||||
* @param boolean Show dates in 'Y-m-d' format
|
||||
* @return array
|
||||
*/
|
||||
public static function details($type,$weekday=NULL,$start=NULL,$df=FALSE) {
|
||||
// Our precision for the pro-rata percentage
|
||||
$precision = 4;
|
||||
// Make the period consistent, eg: Quarterly = Jan-Mar,Apr-Jun; HalfYearly = Jan-Jun,Jul-Dec
|
||||
$strict = FALSE;
|
||||
|
||||
// Round the time integer to a whole day.
|
||||
if (is_null($start))
|
||||
$start = strtotime('today');
|
||||
else
|
||||
$start = strtotime(date('Y-m-d',$start));
|
||||
|
||||
switch ($type) {
|
||||
// Weekly
|
||||
// @todo Make Weekly pro-rata to a day of the week
|
||||
case 0:
|
||||
$period_end = $start+(86400*(7-1));
|
||||
return array('start'=>$start,'date'=>$start,'end'=>$period_end,'prorate'=>1);
|
||||
|
||||
# Monthly
|
||||
case 1:
|
||||
$inc_months = 1;
|
||||
break;
|
||||
|
||||
# Quarterly
|
||||
case 2:
|
||||
# @todo Make this configurable.
|
||||
$strict = TRUE;
|
||||
$inc_months = 3;
|
||||
break;
|
||||
|
||||
# Half Yearly
|
||||
case 3:
|
||||
# @todo Make this configurable.
|
||||
$strict = TRUE;
|
||||
$inc_months = 6;
|
||||
break;
|
||||
|
||||
# Yearly
|
||||
case 4:
|
||||
$inc_months = 12;
|
||||
break;
|
||||
|
||||
# Biennial
|
||||
case 5:
|
||||
$inc_months = 24;
|
||||
break;
|
||||
|
||||
# Triennial
|
||||
case 6:
|
||||
$inc_months = 36;
|
||||
break;
|
||||
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// If workout a day of week we calculate to.
|
||||
if (is_null($weekday))
|
||||
$weekday = date('d',$start);
|
||||
|
||||
$used_months = 0;
|
||||
if ($strict && $type > 0 && $type < 5)
|
||||
$used_months = $inc_months-(($inc_months-(date('n',$start)%$inc_months))%$inc_months+1);
|
||||
|
||||
$d = mktime(0,0,0,date('m',$start)-$used_months,$weekday,date('y',$start));
|
||||
if ($d <= $start)
|
||||
$period_start = $d;
|
||||
else
|
||||
$period_start = mktime(0,0,0,date('m',$d)-1-$used_months,$weekday,date('y',$d));
|
||||
|
||||
$period_end = mktime(0,0,0,date('m',$period_start)+$inc_months,$weekday,date('y',$period_start));
|
||||
|
||||
$total_time = $period_end-$period_start;
|
||||
$remain_time = $period_end-$start;
|
||||
$used_time = $start-$period_start;
|
||||
|
||||
// Change our end date to the day before
|
||||
$period_end -= 86400;
|
||||
|
||||
$return = array(
|
||||
'start'=>$period_start,
|
||||
'date'=>$start,
|
||||
'end'=>$period_end,
|
||||
'weekday'=>$weekday,
|
||||
'prorata'=>round($remain_time/$total_time,$precision),
|
||||
'total_time'=>sprintf('%3.1f',$total_time/86400),
|
||||
'remain_time'=>sprintf('%3.1f',$remain_time/86400),
|
||||
'used_time'=>sprintf('%3.1f',$used_time/86400));
|
||||
|
||||
// @todo Use the configured data format
|
||||
if ($df)
|
||||
foreach (array('start','date','end') as $key)
|
||||
$return[$key] = date('Y-m-d',$return[$key]);
|
||||
|
||||
return $return;
|
||||
}
|
||||
}
|
||||
?>
|
4
application/classes/script.php
Normal file
@ -0,0 +1,4 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
class Script extends lnApp_Script {}
|
||||
?>
|
63
application/classes/staticlist.php
Normal file
@ -0,0 +1,63 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* This is class renders standard lists and their values
|
||||
*
|
||||
* @package OSB
|
||||
* @subpackage Utilities
|
||||
* @category Helpers
|
||||
* @author Deon George
|
||||
* @copyright (c) 2010 Deon George
|
||||
* @license http://dev.leenooks.net/license.html
|
||||
*/
|
||||
abstract class StaticList {
|
||||
// This is our list of items that will be rendered
|
||||
protected $list = array();
|
||||
|
||||
/**
|
||||
* Each static list type must provide the table function that contains
|
||||
* the table of list and values.
|
||||
*/
|
||||
abstract protected function table();
|
||||
|
||||
public static function factory() {
|
||||
throw new Kohana_Exception(':class is calling :method, when it should have its own method',
|
||||
array(':class'=>get_called_class(),':method'=>__METHOD__));
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a static name for a value
|
||||
*
|
||||
* @param key $id value to render
|
||||
* @see _display()
|
||||
*/
|
||||
public static function display($value) {
|
||||
return static::_display($value);
|
||||
}
|
||||
|
||||
// Due to static scope, sometimes we need to call this function from the child class.
|
||||
protected static function _display($id) {
|
||||
$table = static::factory()->table();
|
||||
|
||||
if (! $table OR empty($table[$id]))
|
||||
return sprintf('No Value (%s)',$id);
|
||||
else
|
||||
return $table[$id];
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders form input
|
||||
*
|
||||
* @param string Form name to render
|
||||
* @param string Default value to populate in the Form input.
|
||||
*/
|
||||
public static function form($name,$default='',$addblank=FALSE) {
|
||||
$table = static::factory()->table();
|
||||
|
||||
if ($addblank)
|
||||
$table = array_merge(array(''=>' '),$table);
|
||||
|
||||
return Form::Select($name,$table,$default);
|
||||
}
|
||||
}
|
||||
?>
|
23
application/classes/staticlist/module.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* This is class renders responses and forms based on the values from a module.
|
||||
*
|
||||
* @package OSB
|
||||
* @subpackage Utilities
|
||||
* @category Helpers
|
||||
* @author Deon George
|
||||
* @copyright (c) 2010 Deon George
|
||||
* @license http://dev.leenooks.net/license.html
|
||||
*/
|
||||
class StaticList_Module extends StaticListModule {
|
||||
protected function table($module=NULL) {
|
||||
if (is_null($module))
|
||||
throw new Kohana_Exception('Module is a required attribute.');
|
||||
}
|
||||
|
||||
public static function factory() {
|
||||
return new StaticList_Module;
|
||||
}
|
||||
}
|
||||
?>
|
30
application/classes/staticlist/pricetype.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* This is class renders Price Type responses and forms.
|
||||
*
|
||||
* @package OSB
|
||||
* @subpackage Utilities
|
||||
* @category Helpers
|
||||
* @author Deon George
|
||||
* @copyright (c) 2010 Deon George
|
||||
* @license http://dev.leenooks.net/license.html
|
||||
*/
|
||||
class StaticList_PriceType extends StaticList {
|
||||
protected function table() {
|
||||
return array(
|
||||
0=>_('One-time Charge'),
|
||||
1=>_('Recurring Membership/Subscription'),
|
||||
2=>_('Trial for Membership/Subscription')
|
||||
);
|
||||
}
|
||||
|
||||
public static function factory() {
|
||||
return new StaticList_PriceType;
|
||||
}
|
||||
|
||||
public static function display($value) {
|
||||
return static::_display($value);
|
||||
}
|
||||
}
|
||||
?>
|
56
application/classes/staticlist/recurschedule.php
Normal file
@ -0,0 +1,56 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* This is class renders Recurring Schedule Times on responses and forms.
|
||||
*
|
||||
* @package OSB
|
||||
* @subpackage Utilities
|
||||
* @category Helpers
|
||||
* @author Deon George
|
||||
* @copyright (c) 2010 Deon George
|
||||
* @license http://dev.leenooks.net/license.html
|
||||
*/
|
||||
class StaticList_RecurSchedule extends StaticList {
|
||||
protected function table() {
|
||||
return array(
|
||||
0=>_('Weekly'),
|
||||
1=>_('Monthly'),
|
||||
2=>_('Quarterly'),
|
||||
3=>_('Semi-Annually'),
|
||||
4=>_('Annually'),
|
||||
5=>_('Two years'),
|
||||
6=>_('Three Years')
|
||||
);
|
||||
}
|
||||
|
||||
public static function factory() {
|
||||
return new StaticList_RecurSchedule;
|
||||
}
|
||||
|
||||
public static function display($value) {
|
||||
return static::_display($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the price display for a product
|
||||
*
|
||||
* @uses product
|
||||
*/
|
||||
public static function form($name,$product='',$addblank=FALSE) {
|
||||
if (empty($product))
|
||||
throw new Kohana_Exception('Product is a required field for :method',array(':method'=>__METHOD__));
|
||||
|
||||
$x = '';
|
||||
$table = static::factory()->table();
|
||||
|
||||
foreach ($product->get_price_array() as $term => $price) {
|
||||
$x[$term] = sprintf('%s %s',Currency::display($price['price_base']),$table[$term]);
|
||||
|
||||
if ($price['price_setup'] > 0)
|
||||
$x[$term] .= sprintf(' + %s %s',Currency::display($price['price_setup']),_('Setup'));
|
||||
}
|
||||
|
||||
return Form::select($name,$x,$product->price_recurr_default);
|
||||
}
|
||||
}
|
||||
?>
|
29
application/classes/staticlist/title.php
Normal file
@ -0,0 +1,29 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* This is class renders Person Title responses and forms.
|
||||
*
|
||||
* @package OSB
|
||||
* @subpackage Utilities
|
||||
* @category Helpers
|
||||
* @author Deon George
|
||||
* @copyright (c) 2010 Deon George
|
||||
* @license http://dev.leenooks.net/license.html
|
||||
*/
|
||||
class StaticList_Title extends StaticList {
|
||||
protected function table() {
|
||||
return array(
|
||||
'mr'=>_('Mr'),
|
||||
'ms'=>_('Ms'),
|
||||
'mrs'=>_('Mrs'),
|
||||
'miss'=>_('Miss'),
|
||||
'dr'=>_('Dr'),
|
||||
'prof'=>_('Prof')
|
||||
);
|
||||
}
|
||||
|
||||
public static function factory() {
|
||||
return new StaticList_Title;
|
||||
}
|
||||
}
|
||||
?>
|
29
application/classes/staticlist/yesno.php
Normal file
@ -0,0 +1,29 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* This is class renders Yes/No responses and forms.
|
||||
*
|
||||
* @package OSB
|
||||
* @subpackage Utilities
|
||||
* @category Helpers
|
||||
* @author Deon George
|
||||
* @copyright (c) 2010 Deon George
|
||||
* @license http://dev.leenooks.net/license.html
|
||||
*/
|
||||
class StaticList_YesNo extends StaticList {
|
||||
protected function table() {
|
||||
return array(
|
||||
0=>_('No'),
|
||||
1=>_('Yes'),
|
||||
);
|
||||
}
|
||||
|
||||
public static function factory() {
|
||||
return new StaticList_YesNo;
|
||||
}
|
||||
|
||||
public static function display($value) {
|
||||
return static::_display($value);
|
||||
}
|
||||
}
|
||||
?>
|
83
application/classes/staticlistmodule.php
Normal file
@ -0,0 +1,83 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* This is class is renders standard values based on DB table row values.
|
||||
*
|
||||
* @package OSB
|
||||
* @subpackage Utilities
|
||||
* @category Helpers
|
||||
* @author Deon George
|
||||
* @copyright (c) 2010 Deon George
|
||||
* @license http://dev.leenooks.net/license.html
|
||||
*/
|
||||
abstract class StaticListModule extends StaticList {
|
||||
protected static $record = array();
|
||||
|
||||
/**
|
||||
* Display a static name for a value
|
||||
*/
|
||||
public static function display($id) {
|
||||
// Override our argument list as defined in parent
|
||||
list($table,$key,$skey,$value) = func_get_args();
|
||||
$db = DB::select($key)->from($table)->where($skey,'=',$value)->execute();
|
||||
|
||||
if ($db->count() !== 1)
|
||||
return sprintf('No Value (%s)',$value);
|
||||
else
|
||||
return $db->get($key);
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is to return the cached value of the current active record
|
||||
* This is so that a follow up call to get an attribute of a value retrieved
|
||||
* can reuse the active record values.
|
||||
* This gets over a limitation where the query to form() to get a default
|
||||
* no longer exists (or is invalid) and you want other attributes of the
|
||||
* remaining active record, which may not be the default record.
|
||||
*/
|
||||
public static function record($table,$attribute,$skey,$value) {
|
||||
if (empty(static::$record[$table]))
|
||||
return static::display($table,$attribute,$skey,$value);
|
||||
else
|
||||
return static::$record[$table][$attribute];
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders form input
|
||||
*/
|
||||
public static function form($name,$default='',$addblank=FALSE) {
|
||||
// Override our argument list as defined in parent
|
||||
list($name,$table,$default,$key,$value,$where) = func_get_args();
|
||||
|
||||
// @todo - our query type should come from our configuration?
|
||||
$db = DB::select()->from($table);
|
||||
|
||||
foreach ($where as $k=>$v) {
|
||||
list ($op,$v) = explode(':',$v);
|
||||
$db->where($k,$op,$v);
|
||||
}
|
||||
|
||||
$db = $db->execute();
|
||||
|
||||
// If we only have one record, dont make a select list
|
||||
if ($db->count() == 1) {
|
||||
static::$record[$table] = $db->as_array();
|
||||
static::$record[$table] = array_shift(static::$record[$table]);
|
||||
|
||||
return Form::hidden($name,$db->get($key)).$db->get($value);
|
||||
}
|
||||
|
||||
// Else we return a select list
|
||||
$x = array();
|
||||
foreach ($db as $record) {
|
||||
$x[$record[$key]] = $record[$value];
|
||||
|
||||
// Save our static record, in case we reference this item again.
|
||||
if ($record[$key] == $default)
|
||||
static::$record[$table] = $record;
|
||||
}
|
||||
|
||||
return Form::select($name,$x,$default);
|
||||
}
|
||||
}
|
||||
?>
|
4
application/classes/style.php
Normal file
@ -0,0 +1,4 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
class Style extends lnApp_Style {}
|
||||
?>
|
4
application/classes/systemmessage.php
Normal file
@ -0,0 +1,4 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
class SystemMessage extends lnApp_SystemMessage {}
|
||||
?>
|
29
application/classes/validate.php
Normal file
@ -0,0 +1,29 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* Array and variable validation.
|
||||
*
|
||||
* @package OSB/Modifications
|
||||
* @category Classes
|
||||
* @author Deon George
|
||||
* @copyright (c) 2010 Deon George
|
||||
* @license http://dev.leenooks.net/license.html
|
||||
*/
|
||||
class Validate extends Kohana_Validate {
|
||||
/**
|
||||
* Checks if a field matches the value of another field, if it is set.
|
||||
* Field is ignored if it is blank.
|
||||
*
|
||||
* This function is only invoked anyway when the value is set as per
|
||||
* $this->_empty_rules
|
||||
*
|
||||
* @param string field value
|
||||
* @param string field name to match
|
||||
* @return boolean
|
||||
*/
|
||||
protected function matches_ifset($value, $match)
|
||||
{
|
||||
return ($value === $this[$match]);
|
||||
}
|
||||
}
|
||||
?>
|
2
application/config/.htaccess
Normal file
@ -0,0 +1,2 @@
|
||||
order allow,deny
|
||||
deny from all
|
19
application/config/auth.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* OSB authentication configuration
|
||||
*
|
||||
* @package OSB
|
||||
* @category Configuration
|
||||
* @author Deon George
|
||||
* @copyright (c) 2010 Open Source Billing
|
||||
* @license http://dev.osbill.net/license.html
|
||||
*/
|
||||
return array(
|
||||
'driver' => 'OSB',
|
||||
'hash_method' => 'md5',
|
||||
'salt_pattern' => null,
|
||||
'lifetime' => 1209600,
|
||||
'session_key' => 'auth_user',
|
||||
);
|
||||
?>
|
10
application/config/cache.php
Normal file
@ -0,0 +1,10 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
return array
|
||||
(
|
||||
'file' => array
|
||||
(
|
||||
'driver' => 'file',
|
||||
'cache_dir' => '/dev/shm/osb',
|
||||
'default_expire' => 3600,
|
||||
)
|
||||
);
|
37
application/config/config.php
Normal file
@ -0,0 +1,37 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* OSB system default configurable items.
|
||||
*
|
||||
* @package OSB
|
||||
* @category Configuration
|
||||
* @author Deon George
|
||||
* @copyright (c) 2010 Open Source Billing
|
||||
* @license http://dev.osbill.net/license.html
|
||||
*/
|
||||
return array(
|
||||
'cache_type' => 'file',
|
||||
'date_format' => 'd-M-Y',
|
||||
'email_admin_only'=> array(
|
||||
'adsl_traffic_notice'=>array('deon@c5t61p.leenooks.vpn'=>'Deon George'),
|
||||
),
|
||||
'method_directory'=> array( // Out method paths for the different functions
|
||||
'admin',
|
||||
'affiliate',
|
||||
'reseller',
|
||||
'task',
|
||||
'user',
|
||||
),
|
||||
'method_security' => TRUE, // Enables Method Security. Setting to false means any method can be run without authentication
|
||||
'site' => array(
|
||||
'172.31.9.4'=>1,
|
||||
'www.graytech.net.au'=>1,
|
||||
),
|
||||
'site_debug' => FALSE,
|
||||
'site_mode' => array(
|
||||
'172.31.10.200'=>Kohana::DEVELOPMENT,
|
||||
'www.graytech.net.au'=>Kohana::PRODUCTION,
|
||||
),
|
||||
'site_name' => 'Graytech Hosting Pty Ltd', // @todo This should come from the DB
|
||||
);
|
||||
?>
|
30
application/config/database.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* OSB Database configuration
|
||||
*
|
||||
* @package OSB
|
||||
* @category Configuration
|
||||
* @author Deon George
|
||||
* @copyright (c) 2010 Open Source Billing
|
||||
* @license http://dev.osbill.net/license.html
|
||||
*/
|
||||
return array
|
||||
(
|
||||
'default' => array
|
||||
(
|
||||
'type' => 'mysql',
|
||||
'connection' => array(
|
||||
'hostname' => 'mysql.leenooks.vpn',
|
||||
'username' => 'gh-webbill',
|
||||
'password' => 'ws0593',
|
||||
'persistent' => FALSE,
|
||||
'database' => 'webghosb',
|
||||
),
|
||||
'table_prefix' => 'ab_',
|
||||
'charset' => 'utf8',
|
||||
'caching' => FALSE,
|
||||
'profiling' => TRUE,
|
||||
),
|
||||
);
|
||||
?>
|
2
application/i18n/.htaccess
Normal file
@ -0,0 +1,2 @@
|
||||
order allow,deny
|
||||
deny from all
|
BIN
application/media/1/img/logo-small.png
Normal file
After Width: | Height: | Size: 2.2 KiB |
292
application/media/css/default.css
Normal file
@ -0,0 +1,292 @@
|
||||
/* Default Template CSS */
|
||||
|
||||
table.box-left { border: 1px solid #AAAACC; margin-right: auto; }
|
||||
table.box-center { border: 1px solid #AAAACC; margin-left: auto; margin-right: auto; }
|
||||
table.box-full { border: 1px solid #AAAACC; width: 100%; }
|
||||
tr.head { font-weight: bold; }
|
||||
td.head { font-weight: bold; }
|
||||
td.bold { font-weight: bold; }
|
||||
td.bold-right { font-weight: bold; text-align: right; }
|
||||
td.right { text-align: right; }
|
||||
tr.odd { background-color: #FCFCFE; }
|
||||
tr.even { background-color: #F6F6F8; }
|
||||
|
||||
/* Global Page */
|
||||
table.page {
|
||||
width: 100%;
|
||||
border: 0px solid #000000;
|
||||
font-weight: normal;
|
||||
color: #000000;
|
||||
|
||||
font-family: "bitstream vera sans","luxi sans",verdana,geneva,arial,helvetica,sans-serif;
|
||||
background-color: #FFFFFF;
|
||||
font-size: 13px;
|
||||
empty-cells: hide;
|
||||
}
|
||||
|
||||
/* Page Header - Logo & Title */
|
||||
table.page tr.pagehead td table.pagehead {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
table.page tr.pagehead td table.pagehead td.headlogo {
|
||||
width: 100px;
|
||||
height: 50px;
|
||||
vertical-align: bottom;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
table.page tr.pagehead td table.pagehead img.headlogo {
|
||||
border: 0px;
|
||||
max-width: 100px;
|
||||
max-height: 50px;
|
||||
}
|
||||
|
||||
table.page tr.pagehead td table.pagehead td.headtitle {
|
||||
vertical-align: bottom;
|
||||
text-align: left;
|
||||
padding-left: 5px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
table.page tr.pagehead td table.pagehead td.headimages {
|
||||
vertical-align: bottom;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
table.page tr.pagehead td table.pagehead td.headimages img {
|
||||
border: 0px;
|
||||
}
|
||||
|
||||
/* Page Control */
|
||||
table.page tr.pagecontrol td {
|
||||
border-top: 1px solid #AAAACC;
|
||||
border-bottom: 1px solid #AAAACC;
|
||||
}
|
||||
|
||||
table.page tr.pagecontrol td table.pagecontrol {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
table.page tr.pagecontrol td table.pagecontrol td.none {
|
||||
border-top: 0px;
|
||||
border-bottom: 0px;
|
||||
font-size: 11px;
|
||||
text-align: left;
|
||||
vertical-align: top;
|
||||
font-weight: bold;
|
||||
color: #000000;
|
||||
|
||||
padding: 0px;
|
||||
padding-top: 0px;
|
||||
padding-bottom: 0px;
|
||||
}
|
||||
|
||||
table.page tr.pagecontrol td table.pagecontrol a {
|
||||
text-decoration: none;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
table.page tr.pagecontrol td table.pagecontrol a:hover {
|
||||
text-decoration: none;
|
||||
background-color: #FFFFFF;
|
||||
color: #0000AA;
|
||||
}
|
||||
|
||||
/* Main Page */
|
||||
/** LEFT **/
|
||||
table.page tr.pagemain td.pageleft {
|
||||
background-color: #FCFCFE;
|
||||
/* display: show; */
|
||||
vertical-align: top;
|
||||
border-right: 1px solid #88AACC;
|
||||
}
|
||||
|
||||
table.page tr.pagemain td.pageleft table.pageleft table {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
table.page tr.pagemain td.pageleft table.pageleft tr.title {
|
||||
text-align: center;
|
||||
margin: 0px;
|
||||
padding: 10px;
|
||||
border: 1px solid #000000;
|
||||
font-weight: bold;
|
||||
font-size: 110%;
|
||||
}
|
||||
|
||||
table.page tr.pagemain td.pageleft table.pageleft tr.footer {
|
||||
font-size: 75%;
|
||||
}
|
||||
|
||||
table.page tr.pagemain td.pageleft table.pageleft tr.footer td {
|
||||
border-top: 1px solid #AAAACC;
|
||||
border-bottom: 1px solid #AAAACC;
|
||||
}
|
||||
|
||||
table.page tr.pagemain td.pageleft table.pageleft tr.spacer {
|
||||
font-size: 5px;
|
||||
}
|
||||
|
||||
table.page tr.pagemain td.pageleft table.pageleft tr.spacer td {
|
||||
border-top: 2px solid #AAAACC;
|
||||
}
|
||||
|
||||
/** BODY **/
|
||||
table.page tr.pagemain td.pagebody {
|
||||
background-color: #FCFCFE;
|
||||
width: 85%;
|
||||
vertical-align: top;
|
||||
font-size: 8pt;
|
||||
}
|
||||
|
||||
/*** Body System Message ***/
|
||||
table.page tr.pagemain td.pagebody table.sysmsg {
|
||||
border-bottom: 1px solid #88AACC;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
table.page tr.pagemain td.pagebody table.sysmsg table {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
table.page tr.pagemain td.pagebody table.sysmsg td.icon {
|
||||
text-align: center;
|
||||
vertical-align: top;
|
||||
width: 25px;
|
||||
height: 50px;
|
||||
}
|
||||
|
||||
table.page tr.pagemain td.pagebody table.sysmsg td.icon img.sysicon {
|
||||
border: 5px;
|
||||
max-width: 25px;
|
||||
max-height: 50px;
|
||||
}
|
||||
|
||||
table.page tr.pagemain td.pagebody table.sysmsg td.head {
|
||||
font-size: small;
|
||||
text-align: left;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
table.page tr.pagemain td.pagebody table.sysmsg td.body {
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
table.page tr.pagemain td.pagebody table.sysmsg tr.spacer {
|
||||
font-size: 5px;
|
||||
}
|
||||
|
||||
table.page tr.pagemain td.pagebody table.sysmsg tr.spacer td {
|
||||
border-top: 1px solid #AAAACC;
|
||||
}
|
||||
|
||||
/*** Body Content ***/
|
||||
table.page tr.pagemain td.pagebody table.content {
|
||||
font-weight: normal;
|
||||
background-color: #FCFCFE;
|
||||
width: 100%;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
table.page tr.pagemain td.pagebody table.content table.block {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
table.page tr.pagemain td.pagebody table.content tr.title {
|
||||
text-align: left;
|
||||
margin: 0px;
|
||||
color: #000000;
|
||||
background-color: #F8F8FA;
|
||||
border: 1px solid #000000;
|
||||
font-weight: bold;
|
||||
font-size: 150%;
|
||||
}
|
||||
|
||||
table.page tr.pagemain td.pagebody table.content tr.title td {
|
||||
padding: 5px;
|
||||
border-bottom: 1px solid #AAAACC;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
table.page tr.pagemain td.pagebody table.content tr.subtitle {
|
||||
text-align: left;
|
||||
margin: 0px;
|
||||
margin-bottom: 15px;
|
||||
font-size: 75%;
|
||||
color: #000000;
|
||||
border-bottom: 1px solid #000000;
|
||||
border-left: 1px solid #000000;
|
||||
border-right: 1px solid #000000;
|
||||
background: #FFFFFF;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
table.page tr.pagemain td.pagebody table.content tr.subtitle td {
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
table.page tr.pagemain td.pagebody table.content tr.footer {
|
||||
font-size: 75%;
|
||||
}
|
||||
|
||||
table.page tr.pagemain td.pagebody table.content tr.footer td {
|
||||
border-top: 1px solid #AAAACC;
|
||||
border-bottom: 1px solid #AAAACC;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
table.page tr.pagemain td.pagebody table.content tr.spacer {
|
||||
font-size: 5px;
|
||||
}
|
||||
|
||||
table.page tr.pagemain td.pagebody table.content tr.spacer td {
|
||||
border: 0px solid #AAAACC;
|
||||
}
|
||||
|
||||
/** RIGHT **/
|
||||
table.page tr.pagemain td.pageright {
|
||||
background-color: #FCFCFE;
|
||||
/* display: none; */
|
||||
vertical-align: top;
|
||||
border-left: 1px solid #88AACC;
|
||||
}
|
||||
|
||||
table.page tr.pagemain td.pageright table.pageright table {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
table.page tr.pagemain td.pageright table.pageright tr.title {
|
||||
text-align: center;
|
||||
margin: 0px;
|
||||
padding: 10px;
|
||||
border: 1px solid #000000;
|
||||
font-weight: bold;
|
||||
font-size: 110%;
|
||||
}
|
||||
|
||||
table.page tr.pagemain td.pageright table.pageright tr.footer {
|
||||
font-size: 75%;
|
||||
}
|
||||
|
||||
table.page tr.pagemain td.pageright table.pageright tr.footer td {
|
||||
border-top: 1px solid #AAAACC;
|
||||
border-bottom: 1px solid #AAAACC;
|
||||
}
|
||||
|
||||
table.page tr.pagemain td.pageright table.pageright tr.spacer {
|
||||
font-size: 5px;
|
||||
}
|
||||
|
||||
table.page tr.pagemain td.pageright table.pageright tr.spacer td {
|
||||
border-top: 2px solid #AAAACC;
|
||||
}
|
||||
|
||||
/* Footer */
|
||||
table.page tr.pagefoot td {
|
||||
border-top: 1px solid #AAAACC;
|
||||
font-weight: bold;
|
||||
font-size: 10px;
|
||||
text-align: right;
|
||||
color: #000000;
|
||||
}
|
92
application/media/css/jquery.gritter.css
Normal file
@ -0,0 +1,92 @@
|
||||
/* ie6 trash */
|
||||
* html #gritter-notice-wrapper {
|
||||
position:absolute;
|
||||
}
|
||||
* html .gritter-top {
|
||||
margin-bottom:-10px;
|
||||
}
|
||||
* html .gritter-item {
|
||||
padding-bottom:0;
|
||||
}
|
||||
* html .gritter-bottom {
|
||||
margin-bottom:0;
|
||||
}
|
||||
* html .gritter-close {
|
||||
background:url(../img/jquery.gritter-close-ie6.gif);
|
||||
width:22px;
|
||||
height:22px;
|
||||
top:7px;
|
||||
left:7px;
|
||||
}
|
||||
|
||||
/* the norm */
|
||||
#gritter-notice-wrapper {
|
||||
position:fixed;
|
||||
top:20px;
|
||||
right:20px;
|
||||
width:301px;
|
||||
z-index:9999;
|
||||
}
|
||||
.gritter-item-wrapper {
|
||||
position:relative;
|
||||
margin:0 0 10px 0;
|
||||
}
|
||||
.gritter-top {
|
||||
background:url(../img/jquery.gritter.png) no-repeat left -30px;
|
||||
height:10px;
|
||||
}
|
||||
.hover .gritter-top {
|
||||
background-position:right -30px;
|
||||
}
|
||||
.gritter-bottom {
|
||||
background:url(../img/jquery.gritter.png) no-repeat left bottom;
|
||||
height:8px;
|
||||
margin:0;
|
||||
}
|
||||
.hover .gritter-bottom {
|
||||
background-position: bottom right;
|
||||
}
|
||||
.gritter-item {
|
||||
display:block;
|
||||
background:url(../img/jquery.gritter.png) no-repeat left -40px;
|
||||
color:#eee;
|
||||
padding:2px 11px 8px 11px;
|
||||
font-size: 11px;
|
||||
font-family:verdana;
|
||||
}
|
||||
.hover .gritter-item {
|
||||
background-position:right -40px;
|
||||
}
|
||||
.gritter-item p {
|
||||
padding:0;
|
||||
margin:0;
|
||||
}
|
||||
.gritter-close {
|
||||
position:absolute;
|
||||
top:5px;
|
||||
left:3px;
|
||||
background:url(../img/jquery.gritter.png) no-repeat left top;
|
||||
cursor:pointer;
|
||||
width:30px;
|
||||
height:30px;
|
||||
}
|
||||
.gritter-title {
|
||||
font-size:14px;
|
||||
font-weight:bold;
|
||||
padding:0 0 7px 0;
|
||||
display:block;
|
||||
text-shadow:1px 1px #000; /* Not supported by IE :( */
|
||||
}
|
||||
.gritter-image {
|
||||
width:24px;
|
||||
height:24px;
|
||||
float:left;
|
||||
}
|
||||
.gritter-with-image,
|
||||
.gritter-without-image {
|
||||
padding:0 0 0px 0;
|
||||
}
|
||||
.gritter-with-image {
|
||||
width:250px;
|
||||
float:right;
|
||||
}
|
56
application/media/css/jquery.jstree.css
Normal file
@ -0,0 +1,56 @@
|
||||
/*
|
||||
* jsTree default theme 1.0
|
||||
* Supported features: dots/no-dots, icons/no-icons, focused, loading
|
||||
* Supported plugins: ui (hovered, clicked), checkbox, contextmenu, search
|
||||
*/
|
||||
|
||||
.jstree-default li,
|
||||
.jstree-default ins { background-image:url("../img/jquery.jstree.d.png"); background-repeat:no-repeat; background-color:transparent; }
|
||||
.jstree-default li { background-position:-90px 0; background-repeat:repeat-y; }
|
||||
.jstree-default li.jstree-last { background:transparent; }
|
||||
.jstree-default .jstree-open > ins { background-position:-72px 0; }
|
||||
.jstree-default .jstree-closed > ins { background-position:-54px 0; }
|
||||
.jstree-default .jstree-leaf > ins { background-position:-36px 0; }
|
||||
|
||||
.jstree-default .jstree-hovered { background:#FFF0C0; border:1px solid #841212; padding:0 2px 0 1px; color: #841212;}
|
||||
.jstree-default .jstree-clicked { background:#FCFCFC; border:1px solid #FCFCFC; padding:0 2px 0 1px; color: #841212;}
|
||||
.jstree-default a .jstree-icon { background-position:-56px -19px; }
|
||||
.jstree-default a.jstree-loading .jstree-icon { background:url("../img/jquery.jstree.throbber.gif") center center no-repeat !important; }
|
||||
|
||||
.jstree-default.jstree-focused { background:#FCFCFC; }
|
||||
|
||||
.jstree-default .jstree-no-dots li,
|
||||
.jstree-default .jstree-no-dots .jstree-leaf > ins { background:transparent; }
|
||||
.jstree-default .jstree-no-dots .jstree-open > ins { background-position:-18px 0; }
|
||||
.jstree-default .jstree-no-dots .jstree-closed > ins { background-position:0 0; }
|
||||
|
||||
.jstree-default .jstree-no-icons a .jstree-icon { display:none; }
|
||||
|
||||
.jstree-default .jstree-search { font-style:italic; }
|
||||
|
||||
.jstree-default .jstree-no-icons .checkbox { display:inline-block; }
|
||||
.jstree-default .jstree-no-checkboxes .checkbox { display:none !important; }
|
||||
.jstree-default .jstree-checked > a > .checkbox { background-position:-38px -19px; }
|
||||
.jstree-default .jstree-unchecked > a > .checkbox { background-position:-2px -19px; }
|
||||
.jstree-default .jstree-undetermined > a > .checkbox { background-position:-20px -19px; }
|
||||
.jstree-default .jstree-checked > a > .checkbox:hover { background-position:-38px -37px; }
|
||||
.jstree-default .jstree-unchecked > a > .checkbox:hover { background-position:-2px -37px; }
|
||||
.jstree-default .jstree-undetermined > a > .checkbox:hover { background-position:-20px -37px; }
|
||||
|
||||
#vakata-dragged.jstree-default ins { background:transparent !important; }
|
||||
#vakata-dragged.jstree-default .jstree-ok { background:url("../img/jquery.jstree.d.png") -2px -53px no-repeat !important; }
|
||||
#vakata-dragged.jstree-default .jstree-invalid { background:url("../img/jquery.jstree.d.png") -18px -53px no-repeat !important; }
|
||||
#jstree-marker.jstree-default { background:url("../img/jquery.jstree.d.png") -41px -57px no-repeat !important; }
|
||||
|
||||
.jstree-default a.jstree-search { color:aqua; }
|
||||
|
||||
#vakata-contextmenu.jstree-default-context,
|
||||
#vakata-contextmenu.jstree-default-context li ul { background:#f0f0f0; border:1px solid #979797; -moz-box-shadow: 1px 1px 2px #999; -webkit-box-shadow: 1px 1px 2px #999; box-shadow: 1px 1px 2px #999; }
|
||||
#vakata-contextmenu.jstree-default-context li { }
|
||||
#vakata-contextmenu.jstree-default-context a { color:black; }
|
||||
#vakata-contextmenu.jstree-default-context a:hover,
|
||||
#vakata-contextmenu.jstree-default-context .vakata-hover > a { padding:0 5px; background:#e8eff7; border:1px solid #aecff7; color:black; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; }
|
||||
#vakata-contextmenu.jstree-default-context li.vakata-separator { background:white; border-top:1px solid #e0e0e0; margin:0; }
|
||||
#vakata-contextmenu.jstree-default-context li ul { margin-left:-4px; }
|
||||
|
||||
/* TODO: IE6 support - the `>` selectors */
|
33
application/media/css/list.css
Normal file
@ -0,0 +1,33 @@
|
||||
/* CSS for Output Lists */
|
||||
|
||||
table.list {
|
||||
width: 100%;
|
||||
border: 0px solid #505050;
|
||||
font-weight: normal;
|
||||
color: #000000;
|
||||
|
||||
font-family: "bitstream vera sans","luxi sans",verdana,geneva,arial,helvetica,sans-serif;
|
||||
background-color: #99999B;
|
||||
font-size: 13px;
|
||||
empty-cells: hide;
|
||||
}
|
||||
|
||||
table.list tr.heading {
|
||||
color: #FFFFFF;
|
||||
background-color: #11111A;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
table.list tr td.title {
|
||||
color: #000000;
|
||||
background-color: #0777DD;
|
||||
|
||||
}
|
||||
|
||||
table.list tr.odd {
|
||||
background-color: #EEEEEF;
|
||||
}
|
||||
|
||||
table.list tr.even {
|
||||
background-color: #FFFFFF;
|
||||
}
|
43
application/media/css/login.css
Normal file
@ -0,0 +1,43 @@
|
||||
/** Login Style Sheet **/
|
||||
|
||||
table.login {
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
background-color: #F9F9FA;
|
||||
border: 1px solid #AAAACC;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
#login-uid {
|
||||
background: url('../img/login.user.png') no-repeat 0 1px;
|
||||
background-color: #FAFAFF;
|
||||
color: #000000;
|
||||
padding-left: 24px;
|
||||
}
|
||||
|
||||
#login-uid:focus {
|
||||
background-color: #F0F0FF;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
#login-uid:disabled {
|
||||
background-color: #DDDDFF;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
#login-pwd {
|
||||
background: url('../img/dialog-password.png') no-repeat 0 1px;
|
||||
background-color: #FAFAFF;
|
||||
color: #000000;
|
||||
padding-left: 24px;
|
||||
}
|
||||
|
||||
#login-pwd:focus {
|
||||
background-color: #F0F0FF;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
#login-pwd:disabled {
|
||||
background-color: #DDDDFF;
|
||||
color: #000000;
|
||||
}
|
BIN
application/media/img/ajax-progress.gif
Normal file
After Width: | Height: | Size: 7.5 KiB |
BIN
application/media/img/dialog-error-big.png
Normal file
After Width: | Height: | Size: 2.3 KiB |
BIN
application/media/img/dialog-error.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
application/media/img/dialog-information-big.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
application/media/img/dialog-information.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
application/media/img/dialog-password-big.png
Normal file
After Width: | Height: | Size: 2.9 KiB |
BIN
application/media/img/dialog-password.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
application/media/img/dialog-question-big.png
Normal file
After Width: | Height: | Size: 2.4 KiB |
BIN
application/media/img/dialog-question.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
application/media/img/dialog-warning-big.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
application/media/img/dialog-warning.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
application/media/img/forum-big.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
application/media/img/jquery.gritter.close-ie6.gif
Normal file
After Width: | Height: | Size: 718 B |
BIN
application/media/img/jquery.gritter.png
Normal file
After Width: | Height: | Size: 4.8 KiB |
BIN
application/media/img/jquery.jstree.d.png
Normal file
After Width: | Height: | Size: 7.5 KiB |
BIN
application/media/img/jquery.jstree.throbber.gif
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
application/media/img/login.user.png
Normal file
After Width: | Height: | Size: 654 B |
BIN
application/media/img/logo-small.png
Normal file
After Width: | Height: | Size: 3.9 KiB |
BIN
application/media/img/logo.png
Normal file
After Width: | Height: | Size: 10 KiB |
BIN
application/media/img/toggle-closed.png
Normal file
After Width: | Height: | Size: 102 B |
BIN
application/media/img/toggle-open.png
Normal file
After Width: | Height: | Size: 98 B |
154
application/media/js/jquery-1.4.2.js
vendored
Normal file
@ -0,0 +1,154 @@
|
||||
/*!
|
||||
* jQuery JavaScript Library v1.4.2
|
||||
* http://jquery.com/
|
||||
*
|
||||
* Copyright 2010, John Resig
|
||||
* Dual licensed under the MIT or GPL Version 2 licenses.
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* Includes Sizzle.js
|
||||
* http://sizzlejs.com/
|
||||
* Copyright 2010, The Dojo Foundation
|
||||
* Released under the MIT, BSD, and GPL Licenses.
|
||||
*
|
||||
* Date: Sat Feb 13 22:33:48 2010 -0500
|
||||
*/
|
||||
(function(A,w){function ma(){if(!c.isReady){try{s.documentElement.doScroll("left")}catch(a){setTimeout(ma,1);return}c.ready()}}function Qa(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}function X(a,b,d,f,e,j){var i=a.length;if(typeof b==="object"){for(var o in b)X(a,o,b[o],f,e,d);return a}if(d!==w){f=!j&&f&&c.isFunction(d);for(o=0;o<i;o++)e(a[o],b,f?d.call(a[o],o,e(a[o],b)):d,j);return a}return i?
|
||||
e(a[0],b):w}function J(){return(new Date).getTime()}function Y(){return false}function Z(){return true}function na(a,b,d){d[0].type=a;return c.event.handle.apply(b,d)}function oa(a){var b,d=[],f=[],e=arguments,j,i,o,k,n,r;i=c.data(this,"events");if(!(a.liveFired===this||!i||!i.live||a.button&&a.type==="click")){a.liveFired=this;var u=i.live.slice(0);for(k=0;k<u.length;k++){i=u[k];i.origType.replace(O,"")===a.type?f.push(i.selector):u.splice(k--,1)}j=c(a.target).closest(f,a.currentTarget);n=0;for(r=
|
||||
j.length;n<r;n++)for(k=0;k<u.length;k++){i=u[k];if(j[n].selector===i.selector){o=j[n].elem;f=null;if(i.preType==="mouseenter"||i.preType==="mouseleave")f=c(a.relatedTarget).closest(i.selector)[0];if(!f||f!==o)d.push({elem:o,handleObj:i})}}n=0;for(r=d.length;n<r;n++){j=d[n];a.currentTarget=j.elem;a.data=j.handleObj.data;a.handleObj=j.handleObj;if(j.handleObj.origHandler.apply(j.elem,e)===false){b=false;break}}return b}}function pa(a,b){return"live."+(a&&a!=="*"?a+".":"")+b.replace(/\./g,"`").replace(/ /g,
|
||||
"&")}function qa(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function ra(a,b){var d=0;b.each(function(){if(this.nodeName===(a[d]&&a[d].nodeName)){var f=c.data(a[d++]),e=c.data(this,f);if(f=f&&f.events){delete e.handle;e.events={};for(var j in f)for(var i in f[j])c.event.add(this,j,f[j][i],f[j][i].data)}}})}function sa(a,b,d){var f,e,j;b=b&&b[0]?b[0].ownerDocument||b[0]:s;if(a.length===1&&typeof a[0]==="string"&&a[0].length<512&&b===s&&!ta.test(a[0])&&(c.support.checkClone||!ua.test(a[0]))){e=
|
||||
true;if(j=c.fragments[a[0]])if(j!==1)f=j}if(!f){f=b.createDocumentFragment();c.clean(a,b,f,d)}if(e)c.fragments[a[0]]=j?f:1;return{fragment:f,cacheable:e}}function K(a,b){var d={};c.each(va.concat.apply([],va.slice(0,b)),function(){d[this]=a});return d}function wa(a){return"scrollTo"in a&&a.document?a:a.nodeType===9?a.defaultView||a.parentWindow:false}var c=function(a,b){return new c.fn.init(a,b)},Ra=A.jQuery,Sa=A.$,s=A.document,T,Ta=/^[^<]*(<[\w\W]+>)[^>]*$|^#([\w-]+)$/,Ua=/^.[^:#\[\.,]*$/,Va=/\S/,
|
||||
Wa=/^(\s|\u00A0)+|(\s|\u00A0)+$/g,Xa=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,P=navigator.userAgent,xa=false,Q=[],L,$=Object.prototype.toString,aa=Object.prototype.hasOwnProperty,ba=Array.prototype.push,R=Array.prototype.slice,ya=Array.prototype.indexOf;c.fn=c.prototype={init:function(a,b){var d,f;if(!a)return this;if(a.nodeType){this.context=this[0]=a;this.length=1;return this}if(a==="body"&&!b){this.context=s;this[0]=s.body;this.selector="body";this.length=1;return this}if(typeof a==="string")if((d=Ta.exec(a))&&
|
||||
(d[1]||!b))if(d[1]){f=b?b.ownerDocument||b:s;if(a=Xa.exec(a))if(c.isPlainObject(b)){a=[s.createElement(a[1])];c.fn.attr.call(a,b,true)}else a=[f.createElement(a[1])];else{a=sa([d[1]],[f]);a=(a.cacheable?a.fragment.cloneNode(true):a.fragment).childNodes}return c.merge(this,a)}else{if(b=s.getElementById(d[2])){if(b.id!==d[2])return T.find(a);this.length=1;this[0]=b}this.context=s;this.selector=a;return this}else if(!b&&/^\w+$/.test(a)){this.selector=a;this.context=s;a=s.getElementsByTagName(a);return c.merge(this,
|
||||
a)}else return!b||b.jquery?(b||T).find(a):c(b).find(a);else if(c.isFunction(a))return T.ready(a);if(a.selector!==w){this.selector=a.selector;this.context=a.context}return c.makeArray(a,this)},selector:"",jquery:"1.4.2",length:0,size:function(){return this.length},toArray:function(){return R.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this.slice(a)[0]:this[a]},pushStack:function(a,b,d){var f=c();c.isArray(a)?ba.apply(f,a):c.merge(f,a);f.prevObject=this;f.context=this.context;if(b===
|
||||
"find")f.selector=this.selector+(this.selector?" ":"")+d;else if(b)f.selector=this.selector+"."+b+"("+d+")";return f},each:function(a,b){return c.each(this,a,b)},ready:function(a){c.bindReady();if(c.isReady)a.call(s,c);else Q&&Q.push(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(R.apply(this,arguments),"slice",R.call(arguments).join(","))},map:function(a){return this.pushStack(c.map(this,
|
||||
function(b,d){return a.call(b,d,b)}))},end:function(){return this.prevObject||c(null)},push:ba,sort:[].sort,splice:[].splice};c.fn.init.prototype=c.fn;c.extend=c.fn.extend=function(){var a=arguments[0]||{},b=1,d=arguments.length,f=false,e,j,i,o;if(typeof a==="boolean"){f=a;a=arguments[1]||{};b=2}if(typeof a!=="object"&&!c.isFunction(a))a={};if(d===b){a=this;--b}for(;b<d;b++)if((e=arguments[b])!=null)for(j in e){i=a[j];o=e[j];if(a!==o)if(f&&o&&(c.isPlainObject(o)||c.isArray(o))){i=i&&(c.isPlainObject(i)||
|
||||
c.isArray(i))?i:c.isArray(o)?[]:{};a[j]=c.extend(f,i,o)}else if(o!==w)a[j]=o}return a};c.extend({noConflict:function(a){A.$=Sa;if(a)A.jQuery=Ra;return c},isReady:false,ready:function(){if(!c.isReady){if(!s.body)return setTimeout(c.ready,13);c.isReady=true;if(Q){for(var a,b=0;a=Q[b++];)a.call(s,c);Q=null}c.fn.triggerHandler&&c(s).triggerHandler("ready")}},bindReady:function(){if(!xa){xa=true;if(s.readyState==="complete")return c.ready();if(s.addEventListener){s.addEventListener("DOMContentLoaded",
|
||||
L,false);A.addEventListener("load",c.ready,false)}else if(s.attachEvent){s.attachEvent("onreadystatechange",L);A.attachEvent("onload",c.ready);var a=false;try{a=A.frameElement==null}catch(b){}s.documentElement.doScroll&&a&&ma()}}},isFunction:function(a){return $.call(a)==="[object Function]"},isArray:function(a){return $.call(a)==="[object Array]"},isPlainObject:function(a){if(!a||$.call(a)!=="[object Object]"||a.nodeType||a.setInterval)return false;if(a.constructor&&!aa.call(a,"constructor")&&!aa.call(a.constructor.prototype,
|
||||
"isPrototypeOf"))return false;var b;for(b in a);return b===w||aa.call(a,b)},isEmptyObject:function(a){for(var b in a)return false;return true},error:function(a){throw a;},parseJSON:function(a){if(typeof a!=="string"||!a)return null;a=c.trim(a);if(/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return A.JSON&&A.JSON.parse?A.JSON.parse(a):(new Function("return "+
|
||||
a))();else c.error("Invalid JSON: "+a)},noop:function(){},globalEval:function(a){if(a&&Va.test(a)){var b=s.getElementsByTagName("head")[0]||s.documentElement,d=s.createElement("script");d.type="text/javascript";if(c.support.scriptEval)d.appendChild(s.createTextNode(a));else d.text=a;b.insertBefore(d,b.firstChild);b.removeChild(d)}},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,b,d){var f,e=0,j=a.length,i=j===w||c.isFunction(a);if(d)if(i)for(f in a){if(b.apply(a[f],
|
||||
d)===false)break}else for(;e<j;){if(b.apply(a[e++],d)===false)break}else if(i)for(f in a){if(b.call(a[f],f,a[f])===false)break}else for(d=a[0];e<j&&b.call(d,e,d)!==false;d=a[++e]);return a},trim:function(a){return(a||"").replace(Wa,"")},makeArray:function(a,b){b=b||[];if(a!=null)a.length==null||typeof a==="string"||c.isFunction(a)||typeof a!=="function"&&a.setInterval?ba.call(b,a):c.merge(b,a);return b},inArray:function(a,b){if(b.indexOf)return b.indexOf(a);for(var d=0,f=b.length;d<f;d++)if(b[d]===
|
||||
a)return d;return-1},merge:function(a,b){var d=a.length,f=0;if(typeof b.length==="number")for(var e=b.length;f<e;f++)a[d++]=b[f];else for(;b[f]!==w;)a[d++]=b[f++];a.length=d;return a},grep:function(a,b,d){for(var f=[],e=0,j=a.length;e<j;e++)!d!==!b(a[e],e)&&f.push(a[e]);return f},map:function(a,b,d){for(var f=[],e,j=0,i=a.length;j<i;j++){e=b(a[j],j,d);if(e!=null)f[f.length]=e}return f.concat.apply([],f)},guid:1,proxy:function(a,b,d){if(arguments.length===2)if(typeof b==="string"){d=a;a=d[b];b=w}else if(b&&
|
||||
!c.isFunction(b)){d=b;b=w}if(!b&&a)b=function(){return a.apply(d||this,arguments)};if(a)b.guid=a.guid=a.guid||b.guid||c.guid++;return b},uaMatch:function(a){a=a.toLowerCase();a=/(webkit)[ \/]([\w.]+)/.exec(a)||/(opera)(?:.*version)?[ \/]([\w.]+)/.exec(a)||/(msie) ([\w.]+)/.exec(a)||!/compatible/.test(a)&&/(mozilla)(?:.*? rv:([\w.]+))?/.exec(a)||[];return{browser:a[1]||"",version:a[2]||"0"}},browser:{}});P=c.uaMatch(P);if(P.browser){c.browser[P.browser]=true;c.browser.version=P.version}if(c.browser.webkit)c.browser.safari=
|
||||
true;if(ya)c.inArray=function(a,b){return ya.call(b,a)};T=c(s);if(s.addEventListener)L=function(){s.removeEventListener("DOMContentLoaded",L,false);c.ready()};else if(s.attachEvent)L=function(){if(s.readyState==="complete"){s.detachEvent("onreadystatechange",L);c.ready()}};(function(){c.support={};var a=s.documentElement,b=s.createElement("script"),d=s.createElement("div"),f="script"+J();d.style.display="none";d.innerHTML=" <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";
|
||||
var e=d.getElementsByTagName("*"),j=d.getElementsByTagName("a")[0];if(!(!e||!e.length||!j)){c.support={leadingWhitespace:d.firstChild.nodeType===3,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/red/.test(j.getAttribute("style")),hrefNormalized:j.getAttribute("href")==="/a",opacity:/^0.55$/.test(j.style.opacity),cssFloat:!!j.style.cssFloat,checkOn:d.getElementsByTagName("input")[0].value==="on",optSelected:s.createElement("select").appendChild(s.createElement("option")).selected,
|
||||
parentNode:d.removeChild(d.appendChild(s.createElement("div"))).parentNode===null,deleteExpando:true,checkClone:false,scriptEval:false,noCloneEvent:true,boxModel:null};b.type="text/javascript";try{b.appendChild(s.createTextNode("window."+f+"=1;"))}catch(i){}a.insertBefore(b,a.firstChild);if(A[f]){c.support.scriptEval=true;delete A[f]}try{delete b.test}catch(o){c.support.deleteExpando=false}a.removeChild(b);if(d.attachEvent&&d.fireEvent){d.attachEvent("onclick",function k(){c.support.noCloneEvent=
|
||||
false;d.detachEvent("onclick",k)});d.cloneNode(true).fireEvent("onclick")}d=s.createElement("div");d.innerHTML="<input type='radio' name='radiotest' checked='checked'/>";a=s.createDocumentFragment();a.appendChild(d.firstChild);c.support.checkClone=a.cloneNode(true).cloneNode(true).lastChild.checked;c(function(){var k=s.createElement("div");k.style.width=k.style.paddingLeft="1px";s.body.appendChild(k);c.boxModel=c.support.boxModel=k.offsetWidth===2;s.body.removeChild(k).style.display="none"});a=function(k){var n=
|
||||
s.createElement("div");k="on"+k;var r=k in n;if(!r){n.setAttribute(k,"return;");r=typeof n[k]==="function"}return r};c.support.submitBubbles=a("submit");c.support.changeBubbles=a("change");a=b=d=e=j=null}})();c.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};var G="jQuery"+J(),Ya=0,za={};c.extend({cache:{},expando:G,noData:{embed:true,object:true,
|
||||
applet:true},data:function(a,b,d){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var f=a[G],e=c.cache;if(!f&&typeof b==="string"&&d===w)return null;f||(f=++Ya);if(typeof b==="object"){a[G]=f;e[f]=c.extend(true,{},b)}else if(!e[f]){a[G]=f;e[f]={}}a=e[f];if(d!==w)a[b]=d;return typeof b==="string"?a[b]:a}},removeData:function(a,b){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var d=a[G],f=c.cache,e=f[d];if(b){if(e){delete e[b];c.isEmptyObject(e)&&c.removeData(a)}}else{if(c.support.deleteExpando)delete a[c.expando];
|
||||
else a.removeAttribute&&a.removeAttribute(c.expando);delete f[d]}}}});c.fn.extend({data:function(a,b){if(typeof a==="undefined"&&this.length)return c.data(this[0]);else if(typeof a==="object")return this.each(function(){c.data(this,a)});var d=a.split(".");d[1]=d[1]?"."+d[1]:"";if(b===w){var f=this.triggerHandler("getData"+d[1]+"!",[d[0]]);if(f===w&&this.length)f=c.data(this[0],a);return f===w&&d[1]?this.data(d[0]):f}else return this.trigger("setData"+d[1]+"!",[d[0],b]).each(function(){c.data(this,
|
||||
a,b)})},removeData:function(a){return this.each(function(){c.removeData(this,a)})}});c.extend({queue:function(a,b,d){if(a){b=(b||"fx")+"queue";var f=c.data(a,b);if(!d)return f||[];if(!f||c.isArray(d))f=c.data(a,b,c.makeArray(d));else f.push(d);return f}},dequeue:function(a,b){b=b||"fx";var d=c.queue(a,b),f=d.shift();if(f==="inprogress")f=d.shift();if(f){b==="fx"&&d.unshift("inprogress");f.call(a,function(){c.dequeue(a,b)})}}});c.fn.extend({queue:function(a,b){if(typeof a!=="string"){b=a;a="fx"}if(b===
|
||||
w)return c.queue(this[0],a);return this.each(function(){var d=c.queue(this,a,b);a==="fx"&&d[0]!=="inprogress"&&c.dequeue(this,a)})},dequeue:function(a){return this.each(function(){c.dequeue(this,a)})},delay:function(a,b){a=c.fx?c.fx.speeds[a]||a:a;b=b||"fx";return this.queue(b,function(){var d=this;setTimeout(function(){c.dequeue(d,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])}});var Aa=/[\n\t]/g,ca=/\s+/,Za=/\r/g,$a=/href|src|style/,ab=/(button|input)/i,bb=/(button|input|object|select|textarea)/i,
|
||||
cb=/^(a|area)$/i,Ba=/radio|checkbox/;c.fn.extend({attr:function(a,b){return X(this,a,b,true,c.attr)},removeAttr:function(a){return this.each(function(){c.attr(this,a,"");this.nodeType===1&&this.removeAttribute(a)})},addClass:function(a){if(c.isFunction(a))return this.each(function(n){var r=c(this);r.addClass(a.call(this,n,r.attr("class")))});if(a&&typeof a==="string")for(var b=(a||"").split(ca),d=0,f=this.length;d<f;d++){var e=this[d];if(e.nodeType===1)if(e.className){for(var j=" "+e.className+" ",
|
||||
i=e.className,o=0,k=b.length;o<k;o++)if(j.indexOf(" "+b[o]+" ")<0)i+=" "+b[o];e.className=c.trim(i)}else e.className=a}return this},removeClass:function(a){if(c.isFunction(a))return this.each(function(k){var n=c(this);n.removeClass(a.call(this,k,n.attr("class")))});if(a&&typeof a==="string"||a===w)for(var b=(a||"").split(ca),d=0,f=this.length;d<f;d++){var e=this[d];if(e.nodeType===1&&e.className)if(a){for(var j=(" "+e.className+" ").replace(Aa," "),i=0,o=b.length;i<o;i++)j=j.replace(" "+b[i]+" ",
|
||||
" ");e.className=c.trim(j)}else e.className=""}return this},toggleClass:function(a,b){var d=typeof a,f=typeof b==="boolean";if(c.isFunction(a))return this.each(function(e){var j=c(this);j.toggleClass(a.call(this,e,j.attr("class"),b),b)});return this.each(function(){if(d==="string")for(var e,j=0,i=c(this),o=b,k=a.split(ca);e=k[j++];){o=f?o:!i.hasClass(e);i[o?"addClass":"removeClass"](e)}else if(d==="undefined"||d==="boolean"){this.className&&c.data(this,"__className__",this.className);this.className=
|
||||
this.className||a===false?"":c.data(this,"__className__")||""}})},hasClass:function(a){a=" "+a+" ";for(var b=0,d=this.length;b<d;b++)if((" "+this[b].className+" ").replace(Aa," ").indexOf(a)>-1)return true;return false},val:function(a){if(a===w){var b=this[0];if(b){if(c.nodeName(b,"option"))return(b.attributes.value||{}).specified?b.value:b.text;if(c.nodeName(b,"select")){var d=b.selectedIndex,f=[],e=b.options;b=b.type==="select-one";if(d<0)return null;var j=b?d:0;for(d=b?d+1:e.length;j<d;j++){var i=
|
||||
e[j];if(i.selected){a=c(i).val();if(b)return a;f.push(a)}}return f}if(Ba.test(b.type)&&!c.support.checkOn)return b.getAttribute("value")===null?"on":b.value;return(b.value||"").replace(Za,"")}return w}var o=c.isFunction(a);return this.each(function(k){var n=c(this),r=a;if(this.nodeType===1){if(o)r=a.call(this,k,n.val());if(typeof r==="number")r+="";if(c.isArray(r)&&Ba.test(this.type))this.checked=c.inArray(n.val(),r)>=0;else if(c.nodeName(this,"select")){var u=c.makeArray(r);c("option",this).each(function(){this.selected=
|
||||
c.inArray(c(this).val(),u)>=0});if(!u.length)this.selectedIndex=-1}else this.value=r}})}});c.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(a,b,d,f){if(!a||a.nodeType===3||a.nodeType===8)return w;if(f&&b in c.attrFn)return c(a)[b](d);f=a.nodeType!==1||!c.isXMLDoc(a);var e=d!==w;b=f&&c.props[b]||b;if(a.nodeType===1){var j=$a.test(b);if(b in a&&f&&!j){if(e){b==="type"&&ab.test(a.nodeName)&&a.parentNode&&c.error("type property can't be changed");
|
||||
a[b]=d}if(c.nodeName(a,"form")&&a.getAttributeNode(b))return a.getAttributeNode(b).nodeValue;if(b==="tabIndex")return(b=a.getAttributeNode("tabIndex"))&&b.specified?b.value:bb.test(a.nodeName)||cb.test(a.nodeName)&&a.href?0:w;return a[b]}if(!c.support.style&&f&&b==="style"){if(e)a.style.cssText=""+d;return a.style.cssText}e&&a.setAttribute(b,""+d);a=!c.support.hrefNormalized&&f&&j?a.getAttribute(b,2):a.getAttribute(b);return a===null?w:a}return c.style(a,b,d)}});var O=/\.(.*)$/,db=function(a){return a.replace(/[^\w\s\.\|`]/g,
|
||||
function(b){return"\\"+b})};c.event={add:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){if(a.setInterval&&a!==A&&!a.frameElement)a=A;var e,j;if(d.handler){e=d;d=e.handler}if(!d.guid)d.guid=c.guid++;if(j=c.data(a)){var i=j.events=j.events||{},o=j.handle;if(!o)j.handle=o=function(){return typeof c!=="undefined"&&!c.event.triggered?c.event.handle.apply(o.elem,arguments):w};o.elem=a;b=b.split(" ");for(var k,n=0,r;k=b[n++];){j=e?c.extend({},e):{handler:d,data:f};if(k.indexOf(".")>-1){r=k.split(".");
|
||||
k=r.shift();j.namespace=r.slice(0).sort().join(".")}else{r=[];j.namespace=""}j.type=k;j.guid=d.guid;var u=i[k],z=c.event.special[k]||{};if(!u){u=i[k]=[];if(!z.setup||z.setup.call(a,f,r,o)===false)if(a.addEventListener)a.addEventListener(k,o,false);else a.attachEvent&&a.attachEvent("on"+k,o)}if(z.add){z.add.call(a,j);if(!j.handler.guid)j.handler.guid=d.guid}u.push(j);c.event.global[k]=true}a=null}}},global:{},remove:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){var e,j=0,i,o,k,n,r,u,z=c.data(a),
|
||||
C=z&&z.events;if(z&&C){if(b&&b.type){d=b.handler;b=b.type}if(!b||typeof b==="string"&&b.charAt(0)==="."){b=b||"";for(e in C)c.event.remove(a,e+b)}else{for(b=b.split(" ");e=b[j++];){n=e;i=e.indexOf(".")<0;o=[];if(!i){o=e.split(".");e=o.shift();k=new RegExp("(^|\\.)"+c.map(o.slice(0).sort(),db).join("\\.(?:.*\\.)?")+"(\\.|$)")}if(r=C[e])if(d){n=c.event.special[e]||{};for(B=f||0;B<r.length;B++){u=r[B];if(d.guid===u.guid){if(i||k.test(u.namespace)){f==null&&r.splice(B--,1);n.remove&&n.remove.call(a,u)}if(f!=
|
||||
null)break}}if(r.length===0||f!=null&&r.length===1){if(!n.teardown||n.teardown.call(a,o)===false)Ca(a,e,z.handle);delete C[e]}}else for(var B=0;B<r.length;B++){u=r[B];if(i||k.test(u.namespace)){c.event.remove(a,n,u.handler,B);r.splice(B--,1)}}}if(c.isEmptyObject(C)){if(b=z.handle)b.elem=null;delete z.events;delete z.handle;c.isEmptyObject(z)&&c.removeData(a)}}}}},trigger:function(a,b,d,f){var e=a.type||a;if(!f){a=typeof a==="object"?a[G]?a:c.extend(c.Event(e),a):c.Event(e);if(e.indexOf("!")>=0){a.type=
|
||||
e=e.slice(0,-1);a.exclusive=true}if(!d){a.stopPropagation();c.event.global[e]&&c.each(c.cache,function(){this.events&&this.events[e]&&c.event.trigger(a,b,this.handle.elem)})}if(!d||d.nodeType===3||d.nodeType===8)return w;a.result=w;a.target=d;b=c.makeArray(b);b.unshift(a)}a.currentTarget=d;(f=c.data(d,"handle"))&&f.apply(d,b);f=d.parentNode||d.ownerDocument;try{if(!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()]))if(d["on"+e]&&d["on"+e].apply(d,b)===false)a.result=false}catch(j){}if(!a.isPropagationStopped()&&
|
||||
f)c.event.trigger(a,b,f,true);else if(!a.isDefaultPrevented()){f=a.target;var i,o=c.nodeName(f,"a")&&e==="click",k=c.event.special[e]||{};if((!k._default||k._default.call(d,a)===false)&&!o&&!(f&&f.nodeName&&c.noData[f.nodeName.toLowerCase()])){try{if(f[e]){if(i=f["on"+e])f["on"+e]=null;c.event.triggered=true;f[e]()}}catch(n){}if(i)f["on"+e]=i;c.event.triggered=false}}},handle:function(a){var b,d,f,e;a=arguments[0]=c.event.fix(a||A.event);a.currentTarget=this;b=a.type.indexOf(".")<0&&!a.exclusive;
|
||||
if(!b){d=a.type.split(".");a.type=d.shift();f=new RegExp("(^|\\.)"+d.slice(0).sort().join("\\.(?:.*\\.)?")+"(\\.|$)")}e=c.data(this,"events");d=e[a.type];if(e&&d){d=d.slice(0);e=0;for(var j=d.length;e<j;e++){var i=d[e];if(b||f.test(i.namespace)){a.handler=i.handler;a.data=i.data;a.handleObj=i;i=i.handler.apply(this,arguments);if(i!==w){a.result=i;if(i===false){a.preventDefault();a.stopPropagation()}}if(a.isImmediatePropagationStopped())break}}}return a.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),
|
||||
fix:function(a){if(a[G])return a;var b=a;a=c.Event(b);for(var d=this.props.length,f;d;){f=this.props[--d];a[f]=b[f]}if(!a.target)a.target=a.srcElement||s;if(a.target.nodeType===3)a.target=a.target.parentNode;if(!a.relatedTarget&&a.fromElement)a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement;if(a.pageX==null&&a.clientX!=null){b=s.documentElement;d=s.body;a.pageX=a.clientX+(b&&b.scrollLeft||d&&d.scrollLeft||0)-(b&&b.clientLeft||d&&d.clientLeft||0);a.pageY=a.clientY+(b&&b.scrollTop||
|
||||
d&&d.scrollTop||0)-(b&&b.clientTop||d&&d.clientTop||0)}if(!a.which&&(a.charCode||a.charCode===0?a.charCode:a.keyCode))a.which=a.charCode||a.keyCode;if(!a.metaKey&&a.ctrlKey)a.metaKey=a.ctrlKey;if(!a.which&&a.button!==w)a.which=a.button&1?1:a.button&2?3:a.button&4?2:0;return a},guid:1E8,proxy:c.proxy,special:{ready:{setup:c.bindReady,teardown:c.noop},live:{add:function(a){c.event.add(this,a.origType,c.extend({},a,{handler:oa}))},remove:function(a){var b=true,d=a.origType.replace(O,"");c.each(c.data(this,
|
||||
"events").live||[],function(){if(d===this.origType.replace(O,""))return b=false});b&&c.event.remove(this,a.origType,oa)}},beforeunload:{setup:function(a,b,d){if(this.setInterval)this.onbeforeunload=d;return false},teardown:function(a,b){if(this.onbeforeunload===b)this.onbeforeunload=null}}}};var Ca=s.removeEventListener?function(a,b,d){a.removeEventListener(b,d,false)}:function(a,b,d){a.detachEvent("on"+b,d)};c.Event=function(a){if(!this.preventDefault)return new c.Event(a);if(a&&a.type){this.originalEvent=
|
||||
a;this.type=a.type}else this.type=a;this.timeStamp=J();this[G]=true};c.Event.prototype={preventDefault:function(){this.isDefaultPrevented=Z;var a=this.originalEvent;if(a){a.preventDefault&&a.preventDefault();a.returnValue=false}},stopPropagation:function(){this.isPropagationStopped=Z;var a=this.originalEvent;if(a){a.stopPropagation&&a.stopPropagation();a.cancelBubble=true}},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=Z;this.stopPropagation()},isDefaultPrevented:Y,isPropagationStopped:Y,
|
||||
isImmediatePropagationStopped:Y};var Da=function(a){var b=a.relatedTarget;try{for(;b&&b!==this;)b=b.parentNode;if(b!==this){a.type=a.data;c.event.handle.apply(this,arguments)}}catch(d){}},Ea=function(a){a.type=a.data;c.event.handle.apply(this,arguments)};c.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){c.event.special[a]={setup:function(d){c.event.add(this,b,d&&d.selector?Ea:Da,a)},teardown:function(d){c.event.remove(this,b,d&&d.selector?Ea:Da)}}});if(!c.support.submitBubbles)c.event.special.submit=
|
||||
{setup:function(){if(this.nodeName.toLowerCase()!=="form"){c.event.add(this,"click.specialSubmit",function(a){var b=a.target,d=b.type;if((d==="submit"||d==="image")&&c(b).closest("form").length)return na("submit",this,arguments)});c.event.add(this,"keypress.specialSubmit",function(a){var b=a.target,d=b.type;if((d==="text"||d==="password")&&c(b).closest("form").length&&a.keyCode===13)return na("submit",this,arguments)})}else return false},teardown:function(){c.event.remove(this,".specialSubmit")}};
|
||||
if(!c.support.changeBubbles){var da=/textarea|input|select/i,ea,Fa=function(a){var b=a.type,d=a.value;if(b==="radio"||b==="checkbox")d=a.checked;else if(b==="select-multiple")d=a.selectedIndex>-1?c.map(a.options,function(f){return f.selected}).join("-"):"";else if(a.nodeName.toLowerCase()==="select")d=a.selectedIndex;return d},fa=function(a,b){var d=a.target,f,e;if(!(!da.test(d.nodeName)||d.readOnly)){f=c.data(d,"_change_data");e=Fa(d);if(a.type!=="focusout"||d.type!=="radio")c.data(d,"_change_data",
|
||||
e);if(!(f===w||e===f))if(f!=null||e){a.type="change";return c.event.trigger(a,b,d)}}};c.event.special.change={filters:{focusout:fa,click:function(a){var b=a.target,d=b.type;if(d==="radio"||d==="checkbox"||b.nodeName.toLowerCase()==="select")return fa.call(this,a)},keydown:function(a){var b=a.target,d=b.type;if(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(d==="checkbox"||d==="radio")||d==="select-multiple")return fa.call(this,a)},beforeactivate:function(a){a=a.target;c.data(a,
|
||||
"_change_data",Fa(a))}},setup:function(){if(this.type==="file")return false;for(var a in ea)c.event.add(this,a+".specialChange",ea[a]);return da.test(this.nodeName)},teardown:function(){c.event.remove(this,".specialChange");return da.test(this.nodeName)}};ea=c.event.special.change.filters}s.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(f){f=c.event.fix(f);f.type=b;return c.event.handle.call(this,f)}c.event.special[b]={setup:function(){this.addEventListener(a,
|
||||
d,true)},teardown:function(){this.removeEventListener(a,d,true)}}});c.each(["bind","one"],function(a,b){c.fn[b]=function(d,f,e){if(typeof d==="object"){for(var j in d)this[b](j,f,d[j],e);return this}if(c.isFunction(f)){e=f;f=w}var i=b==="one"?c.proxy(e,function(k){c(this).unbind(k,i);return e.apply(this,arguments)}):e;if(d==="unload"&&b!=="one")this.one(d,f,e);else{j=0;for(var o=this.length;j<o;j++)c.event.add(this[j],d,i,f)}return this}});c.fn.extend({unbind:function(a,b){if(typeof a==="object"&&
|
||||
!a.preventDefault)for(var d in a)this.unbind(d,a[d]);else{d=0;for(var f=this.length;d<f;d++)c.event.remove(this[d],a,b)}return this},delegate:function(a,b,d,f){return this.live(b,d,f,a)},undelegate:function(a,b,d){return arguments.length===0?this.unbind("live"):this.die(b,null,d,a)},trigger:function(a,b){return this.each(function(){c.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0]){a=c.Event(a);a.preventDefault();a.stopPropagation();c.event.trigger(a,b,this[0]);return a.result}},
|
||||
toggle:function(a){for(var b=arguments,d=1;d<b.length;)c.proxy(a,b[d++]);return this.click(c.proxy(a,function(f){var e=(c.data(this,"lastToggle"+a.guid)||0)%d;c.data(this,"lastToggle"+a.guid,e+1);f.preventDefault();return b[e].apply(this,arguments)||false}))},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}});var Ga={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};c.each(["live","die"],function(a,b){c.fn[b]=function(d,f,e,j){var i,o=0,k,n,r=j||this.selector,
|
||||
u=j?this:c(this.context);if(c.isFunction(f)){e=f;f=w}for(d=(d||"").split(" ");(i=d[o++])!=null;){j=O.exec(i);k="";if(j){k=j[0];i=i.replace(O,"")}if(i==="hover")d.push("mouseenter"+k,"mouseleave"+k);else{n=i;if(i==="focus"||i==="blur"){d.push(Ga[i]+k);i+=k}else i=(Ga[i]||i)+k;b==="live"?u.each(function(){c.event.add(this,pa(i,r),{data:f,selector:r,handler:e,origType:i,origHandler:e,preType:n})}):u.unbind(pa(i,r),e)}}return this}});c.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error".split(" "),
|
||||
function(a,b){c.fn[b]=function(d){return d?this.bind(b,d):this.trigger(b)};if(c.attrFn)c.attrFn[b]=true});A.attachEvent&&!A.addEventListener&&A.attachEvent("onunload",function(){for(var a in c.cache)if(c.cache[a].handle)try{c.event.remove(c.cache[a].handle.elem)}catch(b){}});(function(){function a(g){for(var h="",l,m=0;g[m];m++){l=g[m];if(l.nodeType===3||l.nodeType===4)h+=l.nodeValue;else if(l.nodeType!==8)h+=a(l.childNodes)}return h}function b(g,h,l,m,q,p){q=0;for(var v=m.length;q<v;q++){var t=m[q];
|
||||
if(t){t=t[g];for(var y=false;t;){if(t.sizcache===l){y=m[t.sizset];break}if(t.nodeType===1&&!p){t.sizcache=l;t.sizset=q}if(t.nodeName.toLowerCase()===h){y=t;break}t=t[g]}m[q]=y}}}function d(g,h,l,m,q,p){q=0;for(var v=m.length;q<v;q++){var t=m[q];if(t){t=t[g];for(var y=false;t;){if(t.sizcache===l){y=m[t.sizset];break}if(t.nodeType===1){if(!p){t.sizcache=l;t.sizset=q}if(typeof h!=="string"){if(t===h){y=true;break}}else if(k.filter(h,[t]).length>0){y=t;break}}t=t[g]}m[q]=y}}}var f=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,
|
||||
e=0,j=Object.prototype.toString,i=false,o=true;[0,0].sort(function(){o=false;return 0});var k=function(g,h,l,m){l=l||[];var q=h=h||s;if(h.nodeType!==1&&h.nodeType!==9)return[];if(!g||typeof g!=="string")return l;for(var p=[],v,t,y,S,H=true,M=x(h),I=g;(f.exec(""),v=f.exec(I))!==null;){I=v[3];p.push(v[1]);if(v[2]){S=v[3];break}}if(p.length>1&&r.exec(g))if(p.length===2&&n.relative[p[0]])t=ga(p[0]+p[1],h);else for(t=n.relative[p[0]]?[h]:k(p.shift(),h);p.length;){g=p.shift();if(n.relative[g])g+=p.shift();
|
||||
t=ga(g,t)}else{if(!m&&p.length>1&&h.nodeType===9&&!M&&n.match.ID.test(p[0])&&!n.match.ID.test(p[p.length-1])){v=k.find(p.shift(),h,M);h=v.expr?k.filter(v.expr,v.set)[0]:v.set[0]}if(h){v=m?{expr:p.pop(),set:z(m)}:k.find(p.pop(),p.length===1&&(p[0]==="~"||p[0]==="+")&&h.parentNode?h.parentNode:h,M);t=v.expr?k.filter(v.expr,v.set):v.set;if(p.length>0)y=z(t);else H=false;for(;p.length;){var D=p.pop();v=D;if(n.relative[D])v=p.pop();else D="";if(v==null)v=h;n.relative[D](y,v,M)}}else y=[]}y||(y=t);y||k.error(D||
|
||||
g);if(j.call(y)==="[object Array]")if(H)if(h&&h.nodeType===1)for(g=0;y[g]!=null;g++){if(y[g]&&(y[g]===true||y[g].nodeType===1&&E(h,y[g])))l.push(t[g])}else for(g=0;y[g]!=null;g++)y[g]&&y[g].nodeType===1&&l.push(t[g]);else l.push.apply(l,y);else z(y,l);if(S){k(S,q,l,m);k.uniqueSort(l)}return l};k.uniqueSort=function(g){if(B){i=o;g.sort(B);if(i)for(var h=1;h<g.length;h++)g[h]===g[h-1]&&g.splice(h--,1)}return g};k.matches=function(g,h){return k(g,null,null,h)};k.find=function(g,h,l){var m,q;if(!g)return[];
|
||||
for(var p=0,v=n.order.length;p<v;p++){var t=n.order[p];if(q=n.leftMatch[t].exec(g)){var y=q[1];q.splice(1,1);if(y.substr(y.length-1)!=="\\"){q[1]=(q[1]||"").replace(/\\/g,"");m=n.find[t](q,h,l);if(m!=null){g=g.replace(n.match[t],"");break}}}}m||(m=h.getElementsByTagName("*"));return{set:m,expr:g}};k.filter=function(g,h,l,m){for(var q=g,p=[],v=h,t,y,S=h&&h[0]&&x(h[0]);g&&h.length;){for(var H in n.filter)if((t=n.leftMatch[H].exec(g))!=null&&t[2]){var M=n.filter[H],I,D;D=t[1];y=false;t.splice(1,1);if(D.substr(D.length-
|
||||
1)!=="\\"){if(v===p)p=[];if(n.preFilter[H])if(t=n.preFilter[H](t,v,l,p,m,S)){if(t===true)continue}else y=I=true;if(t)for(var U=0;(D=v[U])!=null;U++)if(D){I=M(D,t,U,v);var Ha=m^!!I;if(l&&I!=null)if(Ha)y=true;else v[U]=false;else if(Ha){p.push(D);y=true}}if(I!==w){l||(v=p);g=g.replace(n.match[H],"");if(!y)return[];break}}}if(g===q)if(y==null)k.error(g);else break;q=g}return v};k.error=function(g){throw"Syntax error, unrecognized expression: "+g;};var n=k.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF-]|\\.)+)/,
|
||||
CLASS:/\.((?:[\w\u00c0-\uFFFF-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(g){return g.getAttribute("href")}},
|
||||
relative:{"+":function(g,h){var l=typeof h==="string",m=l&&!/\W/.test(h);l=l&&!m;if(m)h=h.toLowerCase();m=0;for(var q=g.length,p;m<q;m++)if(p=g[m]){for(;(p=p.previousSibling)&&p.nodeType!==1;);g[m]=l||p&&p.nodeName.toLowerCase()===h?p||false:p===h}l&&k.filter(h,g,true)},">":function(g,h){var l=typeof h==="string";if(l&&!/\W/.test(h)){h=h.toLowerCase();for(var m=0,q=g.length;m<q;m++){var p=g[m];if(p){l=p.parentNode;g[m]=l.nodeName.toLowerCase()===h?l:false}}}else{m=0;for(q=g.length;m<q;m++)if(p=g[m])g[m]=
|
||||
l?p.parentNode:p.parentNode===h;l&&k.filter(h,g,true)}},"":function(g,h,l){var m=e++,q=d;if(typeof h==="string"&&!/\W/.test(h)){var p=h=h.toLowerCase();q=b}q("parentNode",h,m,g,p,l)},"~":function(g,h,l){var m=e++,q=d;if(typeof h==="string"&&!/\W/.test(h)){var p=h=h.toLowerCase();q=b}q("previousSibling",h,m,g,p,l)}},find:{ID:function(g,h,l){if(typeof h.getElementById!=="undefined"&&!l)return(g=h.getElementById(g[1]))?[g]:[]},NAME:function(g,h){if(typeof h.getElementsByName!=="undefined"){var l=[];
|
||||
h=h.getElementsByName(g[1]);for(var m=0,q=h.length;m<q;m++)h[m].getAttribute("name")===g[1]&&l.push(h[m]);return l.length===0?null:l}},TAG:function(g,h){return h.getElementsByTagName(g[1])}},preFilter:{CLASS:function(g,h,l,m,q,p){g=" "+g[1].replace(/\\/g,"")+" ";if(p)return g;p=0;for(var v;(v=h[p])!=null;p++)if(v)if(q^(v.className&&(" "+v.className+" ").replace(/[\t\n]/g," ").indexOf(g)>=0))l||m.push(v);else if(l)h[p]=false;return false},ID:function(g){return g[1].replace(/\\/g,"")},TAG:function(g){return g[1].toLowerCase()},
|
||||
CHILD:function(g){if(g[1]==="nth"){var h=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(g[2]==="even"&&"2n"||g[2]==="odd"&&"2n+1"||!/\D/.test(g[2])&&"0n+"+g[2]||g[2]);g[2]=h[1]+(h[2]||1)-0;g[3]=h[3]-0}g[0]=e++;return g},ATTR:function(g,h,l,m,q,p){h=g[1].replace(/\\/g,"");if(!p&&n.attrMap[h])g[1]=n.attrMap[h];if(g[2]==="~=")g[4]=" "+g[4]+" ";return g},PSEUDO:function(g,h,l,m,q){if(g[1]==="not")if((f.exec(g[3])||"").length>1||/^\w/.test(g[3]))g[3]=k(g[3],null,null,h);else{g=k.filter(g[3],h,l,true^q);l||m.push.apply(m,
|
||||
g);return false}else if(n.match.POS.test(g[0])||n.match.CHILD.test(g[0]))return true;return g},POS:function(g){g.unshift(true);return g}},filters:{enabled:function(g){return g.disabled===false&&g.type!=="hidden"},disabled:function(g){return g.disabled===true},checked:function(g){return g.checked===true},selected:function(g){return g.selected===true},parent:function(g){return!!g.firstChild},empty:function(g){return!g.firstChild},has:function(g,h,l){return!!k(l[3],g).length},header:function(g){return/h\d/i.test(g.nodeName)},
|
||||
text:function(g){return"text"===g.type},radio:function(g){return"radio"===g.type},checkbox:function(g){return"checkbox"===g.type},file:function(g){return"file"===g.type},password:function(g){return"password"===g.type},submit:function(g){return"submit"===g.type},image:function(g){return"image"===g.type},reset:function(g){return"reset"===g.type},button:function(g){return"button"===g.type||g.nodeName.toLowerCase()==="button"},input:function(g){return/input|select|textarea|button/i.test(g.nodeName)}},
|
||||
setFilters:{first:function(g,h){return h===0},last:function(g,h,l,m){return h===m.length-1},even:function(g,h){return h%2===0},odd:function(g,h){return h%2===1},lt:function(g,h,l){return h<l[3]-0},gt:function(g,h,l){return h>l[3]-0},nth:function(g,h,l){return l[3]-0===h},eq:function(g,h,l){return l[3]-0===h}},filter:{PSEUDO:function(g,h,l,m){var q=h[1],p=n.filters[q];if(p)return p(g,l,h,m);else if(q==="contains")return(g.textContent||g.innerText||a([g])||"").indexOf(h[3])>=0;else if(q==="not"){h=
|
||||
h[3];l=0;for(m=h.length;l<m;l++)if(h[l]===g)return false;return true}else k.error("Syntax error, unrecognized expression: "+q)},CHILD:function(g,h){var l=h[1],m=g;switch(l){case "only":case "first":for(;m=m.previousSibling;)if(m.nodeType===1)return false;if(l==="first")return true;m=g;case "last":for(;m=m.nextSibling;)if(m.nodeType===1)return false;return true;case "nth":l=h[2];var q=h[3];if(l===1&&q===0)return true;h=h[0];var p=g.parentNode;if(p&&(p.sizcache!==h||!g.nodeIndex)){var v=0;for(m=p.firstChild;m;m=
|
||||
m.nextSibling)if(m.nodeType===1)m.nodeIndex=++v;p.sizcache=h}g=g.nodeIndex-q;return l===0?g===0:g%l===0&&g/l>=0}},ID:function(g,h){return g.nodeType===1&&g.getAttribute("id")===h},TAG:function(g,h){return h==="*"&&g.nodeType===1||g.nodeName.toLowerCase()===h},CLASS:function(g,h){return(" "+(g.className||g.getAttribute("class"))+" ").indexOf(h)>-1},ATTR:function(g,h){var l=h[1];g=n.attrHandle[l]?n.attrHandle[l](g):g[l]!=null?g[l]:g.getAttribute(l);l=g+"";var m=h[2];h=h[4];return g==null?m==="!=":m===
|
||||
"="?l===h:m==="*="?l.indexOf(h)>=0:m==="~="?(" "+l+" ").indexOf(h)>=0:!h?l&&g!==false:m==="!="?l!==h:m==="^="?l.indexOf(h)===0:m==="$="?l.substr(l.length-h.length)===h:m==="|="?l===h||l.substr(0,h.length+1)===h+"-":false},POS:function(g,h,l,m){var q=n.setFilters[h[2]];if(q)return q(g,l,h,m)}}},r=n.match.POS;for(var u in n.match){n.match[u]=new RegExp(n.match[u].source+/(?![^\[]*\])(?![^\(]*\))/.source);n.leftMatch[u]=new RegExp(/(^(?:.|\r|\n)*?)/.source+n.match[u].source.replace(/\\(\d+)/g,function(g,
|
||||
h){return"\\"+(h-0+1)}))}var z=function(g,h){g=Array.prototype.slice.call(g,0);if(h){h.push.apply(h,g);return h}return g};try{Array.prototype.slice.call(s.documentElement.childNodes,0)}catch(C){z=function(g,h){h=h||[];if(j.call(g)==="[object Array]")Array.prototype.push.apply(h,g);else if(typeof g.length==="number")for(var l=0,m=g.length;l<m;l++)h.push(g[l]);else for(l=0;g[l];l++)h.push(g[l]);return h}}var B;if(s.documentElement.compareDocumentPosition)B=function(g,h){if(!g.compareDocumentPosition||
|
||||
!h.compareDocumentPosition){if(g==h)i=true;return g.compareDocumentPosition?-1:1}g=g.compareDocumentPosition(h)&4?-1:g===h?0:1;if(g===0)i=true;return g};else if("sourceIndex"in s.documentElement)B=function(g,h){if(!g.sourceIndex||!h.sourceIndex){if(g==h)i=true;return g.sourceIndex?-1:1}g=g.sourceIndex-h.sourceIndex;if(g===0)i=true;return g};else if(s.createRange)B=function(g,h){if(!g.ownerDocument||!h.ownerDocument){if(g==h)i=true;return g.ownerDocument?-1:1}var l=g.ownerDocument.createRange(),m=
|
||||
h.ownerDocument.createRange();l.setStart(g,0);l.setEnd(g,0);m.setStart(h,0);m.setEnd(h,0);g=l.compareBoundaryPoints(Range.START_TO_END,m);if(g===0)i=true;return g};(function(){var g=s.createElement("div"),h="script"+(new Date).getTime();g.innerHTML="<a name='"+h+"'/>";var l=s.documentElement;l.insertBefore(g,l.firstChild);if(s.getElementById(h)){n.find.ID=function(m,q,p){if(typeof q.getElementById!=="undefined"&&!p)return(q=q.getElementById(m[1]))?q.id===m[1]||typeof q.getAttributeNode!=="undefined"&&
|
||||
q.getAttributeNode("id").nodeValue===m[1]?[q]:w:[]};n.filter.ID=function(m,q){var p=typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id");return m.nodeType===1&&p&&p.nodeValue===q}}l.removeChild(g);l=g=null})();(function(){var g=s.createElement("div");g.appendChild(s.createComment(""));if(g.getElementsByTagName("*").length>0)n.find.TAG=function(h,l){l=l.getElementsByTagName(h[1]);if(h[1]==="*"){h=[];for(var m=0;l[m];m++)l[m].nodeType===1&&h.push(l[m]);l=h}return l};g.innerHTML="<a href='#'></a>";
|
||||
if(g.firstChild&&typeof g.firstChild.getAttribute!=="undefined"&&g.firstChild.getAttribute("href")!=="#")n.attrHandle.href=function(h){return h.getAttribute("href",2)};g=null})();s.querySelectorAll&&function(){var g=k,h=s.createElement("div");h.innerHTML="<p class='TEST'></p>";if(!(h.querySelectorAll&&h.querySelectorAll(".TEST").length===0)){k=function(m,q,p,v){q=q||s;if(!v&&q.nodeType===9&&!x(q))try{return z(q.querySelectorAll(m),p)}catch(t){}return g(m,q,p,v)};for(var l in g)k[l]=g[l];h=null}}();
|
||||
(function(){var g=s.createElement("div");g.innerHTML="<div class='test e'></div><div class='test'></div>";if(!(!g.getElementsByClassName||g.getElementsByClassName("e").length===0)){g.lastChild.className="e";if(g.getElementsByClassName("e").length!==1){n.order.splice(1,0,"CLASS");n.find.CLASS=function(h,l,m){if(typeof l.getElementsByClassName!=="undefined"&&!m)return l.getElementsByClassName(h[1])};g=null}}})();var E=s.compareDocumentPosition?function(g,h){return!!(g.compareDocumentPosition(h)&16)}:
|
||||
function(g,h){return g!==h&&(g.contains?g.contains(h):true)},x=function(g){return(g=(g?g.ownerDocument||g:0).documentElement)?g.nodeName!=="HTML":false},ga=function(g,h){var l=[],m="",q;for(h=h.nodeType?[h]:h;q=n.match.PSEUDO.exec(g);){m+=q[0];g=g.replace(n.match.PSEUDO,"")}g=n.relative[g]?g+"*":g;q=0;for(var p=h.length;q<p;q++)k(g,h[q],l);return k.filter(m,l)};c.find=k;c.expr=k.selectors;c.expr[":"]=c.expr.filters;c.unique=k.uniqueSort;c.text=a;c.isXMLDoc=x;c.contains=E})();var eb=/Until$/,fb=/^(?:parents|prevUntil|prevAll)/,
|
||||
gb=/,/;R=Array.prototype.slice;var Ia=function(a,b,d){if(c.isFunction(b))return c.grep(a,function(e,j){return!!b.call(e,j,e)===d});else if(b.nodeType)return c.grep(a,function(e){return e===b===d});else if(typeof b==="string"){var f=c.grep(a,function(e){return e.nodeType===1});if(Ua.test(b))return c.filter(b,f,!d);else b=c.filter(b,f)}return c.grep(a,function(e){return c.inArray(e,b)>=0===d})};c.fn.extend({find:function(a){for(var b=this.pushStack("","find",a),d=0,f=0,e=this.length;f<e;f++){d=b.length;
|
||||
c.find(a,this[f],b);if(f>0)for(var j=d;j<b.length;j++)for(var i=0;i<d;i++)if(b[i]===b[j]){b.splice(j--,1);break}}return b},has:function(a){var b=c(a);return this.filter(function(){for(var d=0,f=b.length;d<f;d++)if(c.contains(this,b[d]))return true})},not:function(a){return this.pushStack(Ia(this,a,false),"not",a)},filter:function(a){return this.pushStack(Ia(this,a,true),"filter",a)},is:function(a){return!!a&&c.filter(a,this).length>0},closest:function(a,b){if(c.isArray(a)){var d=[],f=this[0],e,j=
|
||||
{},i;if(f&&a.length){e=0;for(var o=a.length;e<o;e++){i=a[e];j[i]||(j[i]=c.expr.match.POS.test(i)?c(i,b||this.context):i)}for(;f&&f.ownerDocument&&f!==b;){for(i in j){e=j[i];if(e.jquery?e.index(f)>-1:c(f).is(e)){d.push({selector:i,elem:f});delete j[i]}}f=f.parentNode}}return d}var k=c.expr.match.POS.test(a)?c(a,b||this.context):null;return this.map(function(n,r){for(;r&&r.ownerDocument&&r!==b;){if(k?k.index(r)>-1:c(r).is(a))return r;r=r.parentNode}return null})},index:function(a){if(!a||typeof a===
|
||||
"string")return c.inArray(this[0],a?c(a):this.parent().children());return c.inArray(a.jquery?a[0]:a,this)},add:function(a,b){a=typeof a==="string"?c(a,b||this.context):c.makeArray(a);b=c.merge(this.get(),a);return this.pushStack(qa(a[0])||qa(b[0])?b:c.unique(b))},andSelf:function(){return this.add(this.prevObject)}});c.each({parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},parents:function(a){return c.dir(a,"parentNode")},parentsUntil:function(a,b,d){return c.dir(a,"parentNode",
|
||||
d)},next:function(a){return c.nth(a,2,"nextSibling")},prev:function(a){return c.nth(a,2,"previousSibling")},nextAll:function(a){return c.dir(a,"nextSibling")},prevAll:function(a){return c.dir(a,"previousSibling")},nextUntil:function(a,b,d){return c.dir(a,"nextSibling",d)},prevUntil:function(a,b,d){return c.dir(a,"previousSibling",d)},siblings:function(a){return c.sibling(a.parentNode.firstChild,a)},children:function(a){return c.sibling(a.firstChild)},contents:function(a){return c.nodeName(a,"iframe")?
|
||||
a.contentDocument||a.contentWindow.document:c.makeArray(a.childNodes)}},function(a,b){c.fn[a]=function(d,f){var e=c.map(this,b,d);eb.test(a)||(f=d);if(f&&typeof f==="string")e=c.filter(f,e);e=this.length>1?c.unique(e):e;if((this.length>1||gb.test(f))&&fb.test(a))e=e.reverse();return this.pushStack(e,a,R.call(arguments).join(","))}});c.extend({filter:function(a,b,d){if(d)a=":not("+a+")";return c.find.matches(a,b)},dir:function(a,b,d){var f=[];for(a=a[b];a&&a.nodeType!==9&&(d===w||a.nodeType!==1||!c(a).is(d));){a.nodeType===
|
||||
1&&f.push(a);a=a[b]}return f},nth:function(a,b,d){b=b||1;for(var f=0;a;a=a[d])if(a.nodeType===1&&++f===b)break;return a},sibling:function(a,b){for(var d=[];a;a=a.nextSibling)a.nodeType===1&&a!==b&&d.push(a);return d}});var Ja=/ jQuery\d+="(?:\d+|null)"/g,V=/^\s+/,Ka=/(<([\w:]+)[^>]*?)\/>/g,hb=/^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i,La=/<([\w:]+)/,ib=/<tbody/i,jb=/<|&#?\w+;/,ta=/<script|<object|<embed|<option|<style/i,ua=/checked\s*(?:[^=]|=\s*.checked.)/i,Ma=function(a,b,d){return hb.test(d)?
|
||||
a:b+"></"+d+">"},F={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]};F.optgroup=F.option;F.tbody=F.tfoot=F.colgroup=F.caption=F.thead;F.th=F.td;if(!c.support.htmlSerialize)F._default=[1,"div<div>","</div>"];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d=
|
||||
c(this);d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==w)return this.empty().append((this[0]&&this[0].ownerDocument||s).createTextNode(a));return c.text(this)},wrapAll:function(a){if(c.isFunction(a))return this.each(function(d){c(this).wrapAll(a.call(this,d))});if(this[0]){var b=c(a,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var d=this;d.firstChild&&d.firstChild.nodeType===1;)d=d.firstChild;return d}).append(this)}return this},
|
||||
wrapInner:function(a){if(c.isFunction(a))return this.each(function(b){c(this).wrapInner(a.call(this,b))});return this.each(function(){var b=c(this),d=b.contents();d.length?d.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){c(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){c.nodeName(this,"body")||c(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.appendChild(a)})},
|
||||
prepend:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this)});else if(arguments.length){var a=c(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,
|
||||
this.nextSibling)});else if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,c(arguments[0]).toArray());return a}},remove:function(a,b){for(var d=0,f;(f=this[d])!=null;d++)if(!a||c.filter(a,[f]).length){if(!b&&f.nodeType===1){c.cleanData(f.getElementsByTagName("*"));c.cleanData([f])}f.parentNode&&f.parentNode.removeChild(f)}return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++)for(b.nodeType===1&&c.cleanData(b.getElementsByTagName("*"));b.firstChild;)b.removeChild(b.firstChild);
|
||||
return this},clone:function(a){var b=this.map(function(){if(!c.support.noCloneEvent&&!c.isXMLDoc(this)){var d=this.outerHTML,f=this.ownerDocument;if(!d){d=f.createElement("div");d.appendChild(this.cloneNode(true));d=d.innerHTML}return c.clean([d.replace(Ja,"").replace(/=([^="'>\s]+\/)>/g,'="$1">').replace(V,"")],f)[0]}else return this.cloneNode(true)});if(a===true){ra(this,b);ra(this.find("*"),b.find("*"))}return b},html:function(a){if(a===w)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(Ja,
|
||||
""):null;else if(typeof a==="string"&&!ta.test(a)&&(c.support.leadingWhitespace||!V.test(a))&&!F[(La.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Ka,Ma);try{for(var b=0,d=this.length;b<d;b++)if(this[b].nodeType===1){c.cleanData(this[b].getElementsByTagName("*"));this[b].innerHTML=a}}catch(f){this.empty().append(a)}}else c.isFunction(a)?this.each(function(e){var j=c(this),i=j.html();j.empty().append(function(){return a.call(this,e,i)})}):this.empty().append(a);return this},replaceWith:function(a){if(this[0]&&
|
||||
this[0].parentNode){if(c.isFunction(a))return this.each(function(b){var d=c(this),f=d.html();d.replaceWith(a.call(this,b,f))});if(typeof a!=="string")a=c(a).detach();return this.each(function(){var b=this.nextSibling,d=this.parentNode;c(this).remove();b?c(b).before(a):c(d).append(a)})}else return this.pushStack(c(c.isFunction(a)?a():a),"replaceWith",a)},detach:function(a){return this.remove(a,true)},domManip:function(a,b,d){function f(u){return c.nodeName(u,"table")?u.getElementsByTagName("tbody")[0]||
|
||||
u.appendChild(u.ownerDocument.createElement("tbody")):u}var e,j,i=a[0],o=[],k;if(!c.support.checkClone&&arguments.length===3&&typeof i==="string"&&ua.test(i))return this.each(function(){c(this).domManip(a,b,d,true)});if(c.isFunction(i))return this.each(function(u){var z=c(this);a[0]=i.call(this,u,b?z.html():w);z.domManip(a,b,d)});if(this[0]){e=i&&i.parentNode;e=c.support.parentNode&&e&&e.nodeType===11&&e.childNodes.length===this.length?{fragment:e}:sa(a,this,o);k=e.fragment;if(j=k.childNodes.length===
|
||||
1?(k=k.firstChild):k.firstChild){b=b&&c.nodeName(j,"tr");for(var n=0,r=this.length;n<r;n++)d.call(b?f(this[n],j):this[n],n>0||e.cacheable||this.length>1?k.cloneNode(true):k)}o.length&&c.each(o,Qa)}return this}});c.fragments={};c.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){c.fn[a]=function(d){var f=[];d=c(d);var e=this.length===1&&this[0].parentNode;if(e&&e.nodeType===11&&e.childNodes.length===1&&d.length===1){d[b](this[0]);
|
||||
return this}else{e=0;for(var j=d.length;e<j;e++){var i=(e>0?this.clone(true):this).get();c.fn[b].apply(c(d[e]),i);f=f.concat(i)}return this.pushStack(f,a,d.selector)}}});c.extend({clean:function(a,b,d,f){b=b||s;if(typeof b.createElement==="undefined")b=b.ownerDocument||b[0]&&b[0].ownerDocument||s;for(var e=[],j=0,i;(i=a[j])!=null;j++){if(typeof i==="number")i+="";if(i){if(typeof i==="string"&&!jb.test(i))i=b.createTextNode(i);else if(typeof i==="string"){i=i.replace(Ka,Ma);var o=(La.exec(i)||["",
|
||||
""])[1].toLowerCase(),k=F[o]||F._default,n=k[0],r=b.createElement("div");for(r.innerHTML=k[1]+i+k[2];n--;)r=r.lastChild;if(!c.support.tbody){n=ib.test(i);o=o==="table"&&!n?r.firstChild&&r.firstChild.childNodes:k[1]==="<table>"&&!n?r.childNodes:[];for(k=o.length-1;k>=0;--k)c.nodeName(o[k],"tbody")&&!o[k].childNodes.length&&o[k].parentNode.removeChild(o[k])}!c.support.leadingWhitespace&&V.test(i)&&r.insertBefore(b.createTextNode(V.exec(i)[0]),r.firstChild);i=r.childNodes}if(i.nodeType)e.push(i);else e=
|
||||
c.merge(e,i)}}if(d)for(j=0;e[j];j++)if(f&&c.nodeName(e[j],"script")&&(!e[j].type||e[j].type.toLowerCase()==="text/javascript"))f.push(e[j].parentNode?e[j].parentNode.removeChild(e[j]):e[j]);else{e[j].nodeType===1&&e.splice.apply(e,[j+1,0].concat(c.makeArray(e[j].getElementsByTagName("script"))));d.appendChild(e[j])}return e},cleanData:function(a){for(var b,d,f=c.cache,e=c.event.special,j=c.support.deleteExpando,i=0,o;(o=a[i])!=null;i++)if(d=o[c.expando]){b=f[d];if(b.events)for(var k in b.events)e[k]?
|
||||
c.event.remove(o,k):Ca(o,k,b.handle);if(j)delete o[c.expando];else o.removeAttribute&&o.removeAttribute(c.expando);delete f[d]}}});var kb=/z-?index|font-?weight|opacity|zoom|line-?height/i,Na=/alpha\([^)]*\)/,Oa=/opacity=([^)]*)/,ha=/float/i,ia=/-([a-z])/ig,lb=/([A-Z])/g,mb=/^-?\d+(?:px)?$/i,nb=/^-?\d/,ob={position:"absolute",visibility:"hidden",display:"block"},pb=["Left","Right"],qb=["Top","Bottom"],rb=s.defaultView&&s.defaultView.getComputedStyle,Pa=c.support.cssFloat?"cssFloat":"styleFloat",ja=
|
||||
function(a,b){return b.toUpperCase()};c.fn.css=function(a,b){return X(this,a,b,true,function(d,f,e){if(e===w)return c.curCSS(d,f);if(typeof e==="number"&&!kb.test(f))e+="px";c.style(d,f,e)})};c.extend({style:function(a,b,d){if(!a||a.nodeType===3||a.nodeType===8)return w;if((b==="width"||b==="height")&&parseFloat(d)<0)d=w;var f=a.style||a,e=d!==w;if(!c.support.opacity&&b==="opacity"){if(e){f.zoom=1;b=parseInt(d,10)+""==="NaN"?"":"alpha(opacity="+d*100+")";a=f.filter||c.curCSS(a,"filter")||"";f.filter=
|
||||
Na.test(a)?a.replace(Na,b):b}return f.filter&&f.filter.indexOf("opacity=")>=0?parseFloat(Oa.exec(f.filter)[1])/100+"":""}if(ha.test(b))b=Pa;b=b.replace(ia,ja);if(e)f[b]=d;return f[b]},css:function(a,b,d,f){if(b==="width"||b==="height"){var e,j=b==="width"?pb:qb;function i(){e=b==="width"?a.offsetWidth:a.offsetHeight;f!=="border"&&c.each(j,function(){f||(e-=parseFloat(c.curCSS(a,"padding"+this,true))||0);if(f==="margin")e+=parseFloat(c.curCSS(a,"margin"+this,true))||0;else e-=parseFloat(c.curCSS(a,
|
||||
"border"+this+"Width",true))||0})}a.offsetWidth!==0?i():c.swap(a,ob,i);return Math.max(0,Math.round(e))}return c.curCSS(a,b,d)},curCSS:function(a,b,d){var f,e=a.style;if(!c.support.opacity&&b==="opacity"&&a.currentStyle){f=Oa.test(a.currentStyle.filter||"")?parseFloat(RegExp.$1)/100+"":"";return f===""?"1":f}if(ha.test(b))b=Pa;if(!d&&e&&e[b])f=e[b];else if(rb){if(ha.test(b))b="float";b=b.replace(lb,"-$1").toLowerCase();e=a.ownerDocument.defaultView;if(!e)return null;if(a=e.getComputedStyle(a,null))f=
|
||||
a.getPropertyValue(b);if(b==="opacity"&&f==="")f="1"}else if(a.currentStyle){d=b.replace(ia,ja);f=a.currentStyle[b]||a.currentStyle[d];if(!mb.test(f)&&nb.test(f)){b=e.left;var j=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;e.left=d==="fontSize"?"1em":f||0;f=e.pixelLeft+"px";e.left=b;a.runtimeStyle.left=j}}return f},swap:function(a,b,d){var f={};for(var e in b){f[e]=a.style[e];a.style[e]=b[e]}d.call(a);for(e in b)a.style[e]=f[e]}});if(c.expr&&c.expr.filters){c.expr.filters.hidden=function(a){var b=
|
||||
a.offsetWidth,d=a.offsetHeight,f=a.nodeName.toLowerCase()==="tr";return b===0&&d===0&&!f?true:b>0&&d>0&&!f?false:c.curCSS(a,"display")==="none"};c.expr.filters.visible=function(a){return!c.expr.filters.hidden(a)}}var sb=J(),tb=/<script(.|\s)*?\/script>/gi,ub=/select|textarea/i,vb=/color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week/i,N=/=\?(&|$)/,ka=/\?/,wb=/(\?|&)_=.*?(&|$)/,xb=/^(\w+:)?\/\/([^\/?#]+)/,yb=/%20/g,zb=c.fn.load;c.fn.extend({load:function(a,b,d){if(typeof a!==
|
||||
"string")return zb.call(this,a);else if(!this.length)return this;var f=a.indexOf(" ");if(f>=0){var e=a.slice(f,a.length);a=a.slice(0,f)}f="GET";if(b)if(c.isFunction(b)){d=b;b=null}else if(typeof b==="object"){b=c.param(b,c.ajaxSettings.traditional);f="POST"}var j=this;c.ajax({url:a,type:f,dataType:"html",data:b,complete:function(i,o){if(o==="success"||o==="notmodified")j.html(e?c("<div />").append(i.responseText.replace(tb,"")).find(e):i.responseText);d&&j.each(d,[i.responseText,o,i])}});return this},
|
||||
serialize:function(){return c.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?c.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||ub.test(this.nodeName)||vb.test(this.type))}).map(function(a,b){a=c(this).val();return a==null?null:c.isArray(a)?c.map(a,function(d){return{name:b.name,value:d}}):{name:b.name,value:a}}).get()}});c.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),
|
||||
function(a,b){c.fn[b]=function(d){return this.bind(b,d)}});c.extend({get:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b=null}return c.ajax({type:"GET",url:a,data:b,success:d,dataType:f})},getScript:function(a,b){return c.get(a,null,b,"script")},getJSON:function(a,b,d){return c.get(a,b,d,"json")},post:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b={}}return c.ajax({type:"POST",url:a,data:b,success:d,dataType:f})},ajaxSetup:function(a){c.extend(c.ajaxSettings,a)},ajaxSettings:{url:location.href,
|
||||
global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:A.XMLHttpRequest&&(A.location.protocol!=="file:"||!A.ActiveXObject)?function(){return new A.XMLHttpRequest}:function(){try{return new A.ActiveXObject("Microsoft.XMLHTTP")}catch(a){}},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},etag:{},ajax:function(a){function b(){e.success&&
|
||||
e.success.call(k,o,i,x);e.global&&f("ajaxSuccess",[x,e])}function d(){e.complete&&e.complete.call(k,x,i);e.global&&f("ajaxComplete",[x,e]);e.global&&!--c.active&&c.event.trigger("ajaxStop")}function f(q,p){(e.context?c(e.context):c.event).trigger(q,p)}var e=c.extend(true,{},c.ajaxSettings,a),j,i,o,k=a&&a.context||e,n=e.type.toUpperCase();if(e.data&&e.processData&&typeof e.data!=="string")e.data=c.param(e.data,e.traditional);if(e.dataType==="jsonp"){if(n==="GET")N.test(e.url)||(e.url+=(ka.test(e.url)?
|
||||
"&":"?")+(e.jsonp||"callback")+"=?");else if(!e.data||!N.test(e.data))e.data=(e.data?e.data+"&":"")+(e.jsonp||"callback")+"=?";e.dataType="json"}if(e.dataType==="json"&&(e.data&&N.test(e.data)||N.test(e.url))){j=e.jsonpCallback||"jsonp"+sb++;if(e.data)e.data=(e.data+"").replace(N,"="+j+"$1");e.url=e.url.replace(N,"="+j+"$1");e.dataType="script";A[j]=A[j]||function(q){o=q;b();d();A[j]=w;try{delete A[j]}catch(p){}z&&z.removeChild(C)}}if(e.dataType==="script"&&e.cache===null)e.cache=false;if(e.cache===
|
||||
false&&n==="GET"){var r=J(),u=e.url.replace(wb,"$1_="+r+"$2");e.url=u+(u===e.url?(ka.test(e.url)?"&":"?")+"_="+r:"")}if(e.data&&n==="GET")e.url+=(ka.test(e.url)?"&":"?")+e.data;e.global&&!c.active++&&c.event.trigger("ajaxStart");r=(r=xb.exec(e.url))&&(r[1]&&r[1]!==location.protocol||r[2]!==location.host);if(e.dataType==="script"&&n==="GET"&&r){var z=s.getElementsByTagName("head")[0]||s.documentElement,C=s.createElement("script");C.src=e.url;if(e.scriptCharset)C.charset=e.scriptCharset;if(!j){var B=
|
||||
false;C.onload=C.onreadystatechange=function(){if(!B&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){B=true;b();d();C.onload=C.onreadystatechange=null;z&&C.parentNode&&z.removeChild(C)}}}z.insertBefore(C,z.firstChild);return w}var E=false,x=e.xhr();if(x){e.username?x.open(n,e.url,e.async,e.username,e.password):x.open(n,e.url,e.async);try{if(e.data||a&&a.contentType)x.setRequestHeader("Content-Type",e.contentType);if(e.ifModified){c.lastModified[e.url]&&x.setRequestHeader("If-Modified-Since",
|
||||
c.lastModified[e.url]);c.etag[e.url]&&x.setRequestHeader("If-None-Match",c.etag[e.url])}r||x.setRequestHeader("X-Requested-With","XMLHttpRequest");x.setRequestHeader("Accept",e.dataType&&e.accepts[e.dataType]?e.accepts[e.dataType]+", */*":e.accepts._default)}catch(ga){}if(e.beforeSend&&e.beforeSend.call(k,x,e)===false){e.global&&!--c.active&&c.event.trigger("ajaxStop");x.abort();return false}e.global&&f("ajaxSend",[x,e]);var g=x.onreadystatechange=function(q){if(!x||x.readyState===0||q==="abort"){E||
|
||||
d();E=true;if(x)x.onreadystatechange=c.noop}else if(!E&&x&&(x.readyState===4||q==="timeout")){E=true;x.onreadystatechange=c.noop;i=q==="timeout"?"timeout":!c.httpSuccess(x)?"error":e.ifModified&&c.httpNotModified(x,e.url)?"notmodified":"success";var p;if(i==="success")try{o=c.httpData(x,e.dataType,e)}catch(v){i="parsererror";p=v}if(i==="success"||i==="notmodified")j||b();else c.handleError(e,x,i,p);d();q==="timeout"&&x.abort();if(e.async)x=null}};try{var h=x.abort;x.abort=function(){x&&h.call(x);
|
||||
g("abort")}}catch(l){}e.async&&e.timeout>0&&setTimeout(function(){x&&!E&&g("timeout")},e.timeout);try{x.send(n==="POST"||n==="PUT"||n==="DELETE"?e.data:null)}catch(m){c.handleError(e,x,null,m);d()}e.async||g();return x}},handleError:function(a,b,d,f){if(a.error)a.error.call(a.context||a,b,d,f);if(a.global)(a.context?c(a.context):c.event).trigger("ajaxError",[b,a,f])},active:0,httpSuccess:function(a){try{return!a.status&&location.protocol==="file:"||a.status>=200&&a.status<300||a.status===304||a.status===
|
||||
1223||a.status===0}catch(b){}return false},httpNotModified:function(a,b){var d=a.getResponseHeader("Last-Modified"),f=a.getResponseHeader("Etag");if(d)c.lastModified[b]=d;if(f)c.etag[b]=f;return a.status===304||a.status===0},httpData:function(a,b,d){var f=a.getResponseHeader("content-type")||"",e=b==="xml"||!b&&f.indexOf("xml")>=0;a=e?a.responseXML:a.responseText;e&&a.documentElement.nodeName==="parsererror"&&c.error("parsererror");if(d&&d.dataFilter)a=d.dataFilter(a,b);if(typeof a==="string")if(b===
|
||||
"json"||!b&&f.indexOf("json")>=0)a=c.parseJSON(a);else if(b==="script"||!b&&f.indexOf("javascript")>=0)c.globalEval(a);return a},param:function(a,b){function d(i,o){if(c.isArray(o))c.each(o,function(k,n){b||/\[\]$/.test(i)?f(i,n):d(i+"["+(typeof n==="object"||c.isArray(n)?k:"")+"]",n)});else!b&&o!=null&&typeof o==="object"?c.each(o,function(k,n){d(i+"["+k+"]",n)}):f(i,o)}function f(i,o){o=c.isFunction(o)?o():o;e[e.length]=encodeURIComponent(i)+"="+encodeURIComponent(o)}var e=[];if(b===w)b=c.ajaxSettings.traditional;
|
||||
if(c.isArray(a)||a.jquery)c.each(a,function(){f(this.name,this.value)});else for(var j in a)d(j,a[j]);return e.join("&").replace(yb,"+")}});var la={},Ab=/toggle|show|hide/,Bb=/^([+-]=)?([\d+-.]+)(.*)$/,W,va=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];c.fn.extend({show:function(a,b){if(a||a===0)return this.animate(K("show",3),a,b);else{a=0;for(b=this.length;a<b;a++){var d=c.data(this[a],"olddisplay");
|
||||
this[a].style.display=d||"";if(c.css(this[a],"display")==="none"){d=this[a].nodeName;var f;if(la[d])f=la[d];else{var e=c("<"+d+" />").appendTo("body");f=e.css("display");if(f==="none")f="block";e.remove();la[d]=f}c.data(this[a],"olddisplay",f)}}a=0;for(b=this.length;a<b;a++)this[a].style.display=c.data(this[a],"olddisplay")||"";return this}},hide:function(a,b){if(a||a===0)return this.animate(K("hide",3),a,b);else{a=0;for(b=this.length;a<b;a++){var d=c.data(this[a],"olddisplay");!d&&d!=="none"&&c.data(this[a],
|
||||
"olddisplay",c.css(this[a],"display"))}a=0;for(b=this.length;a<b;a++)this[a].style.display="none";return this}},_toggle:c.fn.toggle,toggle:function(a,b){var d=typeof a==="boolean";if(c.isFunction(a)&&c.isFunction(b))this._toggle.apply(this,arguments);else a==null||d?this.each(function(){var f=d?a:c(this).is(":hidden");c(this)[f?"show":"hide"]()}):this.animate(K("toggle",3),a,b);return this},fadeTo:function(a,b,d){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,d)},
|
||||
animate:function(a,b,d,f){var e=c.speed(b,d,f);if(c.isEmptyObject(a))return this.each(e.complete);return this[e.queue===false?"each":"queue"](function(){var j=c.extend({},e),i,o=this.nodeType===1&&c(this).is(":hidden"),k=this;for(i in a){var n=i.replace(ia,ja);if(i!==n){a[n]=a[i];delete a[i];i=n}if(a[i]==="hide"&&o||a[i]==="show"&&!o)return j.complete.call(this);if((i==="height"||i==="width")&&this.style){j.display=c.css(this,"display");j.overflow=this.style.overflow}if(c.isArray(a[i])){(j.specialEasing=
|
||||
j.specialEasing||{})[i]=a[i][1];a[i]=a[i][0]}}if(j.overflow!=null)this.style.overflow="hidden";j.curAnim=c.extend({},a);c.each(a,function(r,u){var z=new c.fx(k,j,r);if(Ab.test(u))z[u==="toggle"?o?"show":"hide":u](a);else{var C=Bb.exec(u),B=z.cur(true)||0;if(C){u=parseFloat(C[2]);var E=C[3]||"px";if(E!=="px"){k.style[r]=(u||1)+E;B=(u||1)/z.cur(true)*B;k.style[r]=B+E}if(C[1])u=(C[1]==="-="?-1:1)*u+B;z.custom(B,u,E)}else z.custom(B,u,"")}});return true})},stop:function(a,b){var d=c.timers;a&&this.queue([]);
|
||||
this.each(function(){for(var f=d.length-1;f>=0;f--)if(d[f].elem===this){b&&d[f](true);d.splice(f,1)}});b||this.dequeue();return this}});c.each({slideDown:K("show",1),slideUp:K("hide",1),slideToggle:K("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(a,b){c.fn[a]=function(d,f){return this.animate(b,d,f)}});c.extend({speed:function(a,b,d){var f=a&&typeof a==="object"?a:{complete:d||!d&&b||c.isFunction(a)&&a,duration:a,easing:d&&b||b&&!c.isFunction(b)&&b};f.duration=c.fx.off?0:typeof f.duration===
|
||||
"number"?f.duration:c.fx.speeds[f.duration]||c.fx.speeds._default;f.old=f.complete;f.complete=function(){f.queue!==false&&c(this).dequeue();c.isFunction(f.old)&&f.old.call(this)};return f},easing:{linear:function(a,b,d,f){return d+f*a},swing:function(a,b,d,f){return(-Math.cos(a*Math.PI)/2+0.5)*f+d}},timers:[],fx:function(a,b,d){this.options=b;this.elem=a;this.prop=d;if(!b.orig)b.orig={}}});c.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this);(c.fx.step[this.prop]||
|
||||
c.fx.step._default)(this);if((this.prop==="height"||this.prop==="width")&&this.elem.style)this.elem.style.display="block"},cur:function(a){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];return(a=parseFloat(c.css(this.elem,this.prop,a)))&&a>-10000?a:parseFloat(c.curCSS(this.elem,this.prop))||0},custom:function(a,b,d){function f(j){return e.step(j)}this.startTime=J();this.start=a;this.end=b;this.unit=d||this.unit||"px";this.now=this.start;
|
||||
this.pos=this.state=0;var e=this;f.elem=this.elem;if(f()&&c.timers.push(f)&&!W)W=setInterval(c.fx.tick,13)},show:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());c(this.elem).show()},hide:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(a){var b=J(),d=true;if(a||b>=this.options.duration+this.startTime){this.now=
|
||||
this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var f in this.options.curAnim)if(this.options.curAnim[f]!==true)d=false;if(d){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;a=c.data(this.elem,"olddisplay");this.elem.style.display=a?a:this.options.display;if(c.css(this.elem,"display")==="none")this.elem.style.display="block"}this.options.hide&&c(this.elem).hide();if(this.options.hide||this.options.show)for(var e in this.options.curAnim)c.style(this.elem,
|
||||
e,this.options.orig[e]);this.options.complete.call(this.elem)}return false}else{e=b-this.startTime;this.state=e/this.options.duration;a=this.options.easing||(c.easing.swing?"swing":"linear");this.pos=c.easing[this.options.specialEasing&&this.options.specialEasing[this.prop]||a](this.state,e,0,1,this.options.duration);this.now=this.start+(this.end-this.start)*this.pos;this.update()}return true}};c.extend(c.fx,{tick:function(){for(var a=c.timers,b=0;b<a.length;b++)a[b]()||a.splice(b--,1);a.length||
|
||||
c.fx.stop()},stop:function(){clearInterval(W);W=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){c.style(a.elem,"opacity",a.now)},_default:function(a){if(a.elem.style&&a.elem.style[a.prop]!=null)a.elem.style[a.prop]=(a.prop==="width"||a.prop==="height"?Math.max(0,a.now):a.now)+a.unit;else a.elem[a.prop]=a.now}}});if(c.expr&&c.expr.filters)c.expr.filters.animated=function(a){return c.grep(c.timers,function(b){return a===b.elem}).length};c.fn.offset="getBoundingClientRect"in s.documentElement?
|
||||
function(a){var b=this[0];if(a)return this.each(function(e){c.offset.setOffset(this,a,e)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return c.offset.bodyOffset(b);var d=b.getBoundingClientRect(),f=b.ownerDocument;b=f.body;f=f.documentElement;return{top:d.top+(self.pageYOffset||c.support.boxModel&&f.scrollTop||b.scrollTop)-(f.clientTop||b.clientTop||0),left:d.left+(self.pageXOffset||c.support.boxModel&&f.scrollLeft||b.scrollLeft)-(f.clientLeft||b.clientLeft||0)}}:function(a){var b=
|
||||
this[0];if(a)return this.each(function(r){c.offset.setOffset(this,a,r)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return c.offset.bodyOffset(b);c.offset.initialize();var d=b.offsetParent,f=b,e=b.ownerDocument,j,i=e.documentElement,o=e.body;f=(e=e.defaultView)?e.getComputedStyle(b,null):b.currentStyle;for(var k=b.offsetTop,n=b.offsetLeft;(b=b.parentNode)&&b!==o&&b!==i;){if(c.offset.supportsFixedPosition&&f.position==="fixed")break;j=e?e.getComputedStyle(b,null):b.currentStyle;
|
||||
k-=b.scrollTop;n-=b.scrollLeft;if(b===d){k+=b.offsetTop;n+=b.offsetLeft;if(c.offset.doesNotAddBorder&&!(c.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(b.nodeName))){k+=parseFloat(j.borderTopWidth)||0;n+=parseFloat(j.borderLeftWidth)||0}f=d;d=b.offsetParent}if(c.offset.subtractsBorderForOverflowNotVisible&&j.overflow!=="visible"){k+=parseFloat(j.borderTopWidth)||0;n+=parseFloat(j.borderLeftWidth)||0}f=j}if(f.position==="relative"||f.position==="static"){k+=o.offsetTop;n+=o.offsetLeft}if(c.offset.supportsFixedPosition&&
|
||||
f.position==="fixed"){k+=Math.max(i.scrollTop,o.scrollTop);n+=Math.max(i.scrollLeft,o.scrollLeft)}return{top:k,left:n}};c.offset={initialize:function(){var a=s.body,b=s.createElement("div"),d,f,e,j=parseFloat(c.curCSS(a,"marginTop",true))||0;c.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"});b.innerHTML="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";
|
||||
a.insertBefore(b,a.firstChild);d=b.firstChild;f=d.firstChild;e=d.nextSibling.firstChild.firstChild;this.doesNotAddBorder=f.offsetTop!==5;this.doesAddBorderForTableAndCells=e.offsetTop===5;f.style.position="fixed";f.style.top="20px";this.supportsFixedPosition=f.offsetTop===20||f.offsetTop===15;f.style.position=f.style.top="";d.style.overflow="hidden";d.style.position="relative";this.subtractsBorderForOverflowNotVisible=f.offsetTop===-5;this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==j;a.removeChild(b);
|
||||
c.offset.initialize=c.noop},bodyOffset:function(a){var b=a.offsetTop,d=a.offsetLeft;c.offset.initialize();if(c.offset.doesNotIncludeMarginInBodyOffset){b+=parseFloat(c.curCSS(a,"marginTop",true))||0;d+=parseFloat(c.curCSS(a,"marginLeft",true))||0}return{top:b,left:d}},setOffset:function(a,b,d){if(/static/.test(c.curCSS(a,"position")))a.style.position="relative";var f=c(a),e=f.offset(),j=parseInt(c.curCSS(a,"top",true),10)||0,i=parseInt(c.curCSS(a,"left",true),10)||0;if(c.isFunction(b))b=b.call(a,
|
||||
d,e);d={top:b.top-e.top+j,left:b.left-e.left+i};"using"in b?b.using.call(a,d):f.css(d)}};c.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),d=this.offset(),f=/^body|html$/i.test(b[0].nodeName)?{top:0,left:0}:b.offset();d.top-=parseFloat(c.curCSS(a,"marginTop",true))||0;d.left-=parseFloat(c.curCSS(a,"marginLeft",true))||0;f.top+=parseFloat(c.curCSS(b[0],"borderTopWidth",true))||0;f.left+=parseFloat(c.curCSS(b[0],"borderLeftWidth",true))||0;return{top:d.top-
|
||||
f.top,left:d.left-f.left}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||s.body;a&&!/^body|html$/i.test(a.nodeName)&&c.css(a,"position")==="static";)a=a.offsetParent;return a})}});c.each(["Left","Top"],function(a,b){var d="scroll"+b;c.fn[d]=function(f){var e=this[0],j;if(!e)return null;if(f!==w)return this.each(function(){if(j=wa(this))j.scrollTo(!a?f:c(j).scrollLeft(),a?f:c(j).scrollTop());else this[d]=f});else return(j=wa(e))?"pageXOffset"in j?j[a?"pageYOffset":
|
||||
"pageXOffset"]:c.support.boxModel&&j.document.documentElement[d]||j.document.body[d]:e[d]}});c.each(["Height","Width"],function(a,b){var d=b.toLowerCase();c.fn["inner"+b]=function(){return this[0]?c.css(this[0],d,false,"padding"):null};c.fn["outer"+b]=function(f){return this[0]?c.css(this[0],d,false,f?"margin":"border"):null};c.fn[d]=function(f){var e=this[0];if(!e)return f==null?null:this;if(c.isFunction(f))return this.each(function(j){var i=c(this);i[d](f.call(this,j,i[d]()))});return"scrollTo"in
|
||||
e&&e.document?e.document.compatMode==="CSS1Compat"&&e.document.documentElement["client"+b]||e.document.body["client"+b]:e.nodeType===9?Math.max(e.documentElement["client"+b],e.body["scroll"+b],e.documentElement["scroll"+b],e.body["offset"+b],e.documentElement["offset"+b]):f===w?c.css(e,d):this.css(d,typeof f==="string"?f:f+"px")}});A.jQuery=A.$=c})(window);
|
96
application/media/js/jquery.cookie.js
Normal file
@ -0,0 +1,96 @@
|
||||
/**
|
||||
* Cookie plugin
|
||||
*
|
||||
* Copyright (c) 2006 Klaus Hartl (stilbuero.de)
|
||||
* Dual licensed under the MIT and GPL licenses:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Create a cookie with the given name and value and other optional parameters.
|
||||
*
|
||||
* @example $.cookie('the_cookie', 'the_value');
|
||||
* @desc Set the value of a cookie.
|
||||
* @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true });
|
||||
* @desc Create a cookie with all available options.
|
||||
* @example $.cookie('the_cookie', 'the_value');
|
||||
* @desc Create a session cookie.
|
||||
* @example $.cookie('the_cookie', null);
|
||||
* @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain
|
||||
* used when the cookie was set.
|
||||
*
|
||||
* @param String name The name of the cookie.
|
||||
* @param String value The value of the cookie.
|
||||
* @param Object options An object literal containing key/value pairs to provide optional cookie attributes.
|
||||
* @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object.
|
||||
* If a negative value is specified (e.g. a date in the past), the cookie will be deleted.
|
||||
* If set to null or omitted, the cookie will be a session cookie and will not be retained
|
||||
* when the the browser exits.
|
||||
* @option String path The value of the path atribute of the cookie (default: path of page that created the cookie).
|
||||
* @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie).
|
||||
* @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will
|
||||
* require a secure protocol (like HTTPS).
|
||||
* @type undefined
|
||||
*
|
||||
* @name $.cookie
|
||||
* @cat Plugins/Cookie
|
||||
* @author Klaus Hartl/klaus.hartl@stilbuero.de
|
||||
*/
|
||||
|
||||
/**
|
||||
* Get the value of a cookie with the given name.
|
||||
*
|
||||
* @example $.cookie('the_cookie');
|
||||
* @desc Get the value of a cookie.
|
||||
*
|
||||
* @param String name The name of the cookie.
|
||||
* @return The value of the cookie.
|
||||
* @type String
|
||||
*
|
||||
* @name $.cookie
|
||||
* @cat Plugins/Cookie
|
||||
* @author Klaus Hartl/klaus.hartl@stilbuero.de
|
||||
*/
|
||||
jQuery.cookie = function(name, value, options) {
|
||||
if (typeof value != 'undefined') { // name and value given, set cookie
|
||||
options = options || {};
|
||||
if (value === null) {
|
||||
value = '';
|
||||
options.expires = -1;
|
||||
}
|
||||
var expires = '';
|
||||
if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
|
||||
var date;
|
||||
if (typeof options.expires == 'number') {
|
||||
date = new Date();
|
||||
date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
|
||||
} else {
|
||||
date = options.expires;
|
||||
}
|
||||
expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
|
||||
}
|
||||
// CAUTION: Needed to parenthesize options.path and options.domain
|
||||
// in the following expressions, otherwise they evaluate to undefined
|
||||
// in the packed version for some reason...
|
||||
var path = options.path ? '; path=' + (options.path) : '';
|
||||
var domain = options.domain ? '; domain=' + (options.domain) : '';
|
||||
var secure = options.secure ? '; secure' : '';
|
||||
document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
|
||||
} else { // only name given, get cookie
|
||||
var cookieValue = null;
|
||||
if (document.cookie && document.cookie != '') {
|
||||
var cookies = document.cookie.split(';');
|
||||
for (var i = 0; i < cookies.length; i++) {
|
||||
var cookie = jQuery.trim(cookies[i]);
|
||||
// Does this cookie string begin with the name we want?
|
||||
if (cookie.substring(0, name.length + 1) == (name + '=')) {
|
||||
cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return cookieValue;
|
||||
}
|
||||
};
|
21
application/media/js/jquery.gritter-1.5.js
Normal file
@ -0,0 +1,21 @@
|
||||
(function($){$.gritter={};$.gritter.options={fade_in_speed:'medium',fade_out_speed:2000,time:6000}
|
||||
$.gritter.add=function(params){try{if(!params.title||!params.text){throw'You need to fill out the first 2 params: "title" and "text"';}}catch(e){alert('Gritter Error: '+e);}
|
||||
return Gritter.add(params);}
|
||||
$.gritter.remove=function(id,params){Gritter.removeSpecific(id,params||'');}
|
||||
$.gritter.removeAll=function(params){Gritter.stop(params||'');}
|
||||
var Gritter={fade_in_speed:'',fade_out_speed:'',time:'',_custom_timer:0,_item_count:0,_is_setup:0,_tpl_close:'<div class="gritter-close"></div>',_tpl_item:'<div id="gritter-item-[[number]]" class="gritter-item-wrapper" style="display:none"><div class="gritter-top"></div><div class="gritter-item">[[image]]<div class="[[class_name]]"><span class="gritter-title">[[username]]</span><p>[[text]]</p></div><div style="clear:both"></div></div><div class="gritter-bottom"></div></div>',_tpl_wrap:'<div id="gritter-notice-wrapper"></div>',add:function(params){if(!this._is_setup){this._runSetup();}
|
||||
var user=params.title,text=params.text,image=params.image||'',sticky=params.sticky||false,time_alive=params.time||'';this._verifyWrapper();this._item_count++;var number=this._item_count,tmp=this._tpl_item;this['_before_open_'+number]=($.isFunction(params.before_open))?params.before_open:function(){};this['_after_open_'+number]=($.isFunction(params.after_open))?params.after_open:function(){};this['_before_close_'+number]=($.isFunction(params.before_close))?params.before_close:function(){};this['_after_close_'+number]=($.isFunction(params.after_close))?params.after_close:function(){};this._custom_timer=0;if(time_alive){this._custom_timer=time_alive;}
|
||||
var image_str=(image!='')?'<img src="'+image+'" class="gritter-image" />':'',class_name=(image!='')?'gritter-with-image':'gritter-without-image';tmp=this._str_replace(['[[username]]','[[text]]','[[image]]','[[number]]','[[class_name]]'],[user,text,image_str,this._item_count,class_name],tmp);this['_before_open_'+number]();$('#gritter-notice-wrapper').append(tmp);var item=$('#gritter-item-'+this._item_count);item.fadeIn(this.fade_in_speed,function(){Gritter['_after_open_'+number]($(this));});if(!sticky){this._setFadeTimer(item,number);}
|
||||
$(item).bind('mouseenter mouseleave',function(event){if(event.type=='mouseenter'){if(!sticky){Gritter.restoreItemIfFading(this,number);}}
|
||||
else{if(!sticky){Gritter._setFadeTimer(this,number);}}
|
||||
Gritter._hoverState(this,event.type);});return number;},_countRemoveWrapper:function(unique_id){this['_after_close_'+unique_id]($('#gritter-item-'+unique_id));if($('.gritter-item-wrapper').length==0){$('#gritter-notice-wrapper').remove();}},_fade:function(e,unique_id){Gritter['_before_close_'+unique_id]($(e));$(e).animate({opacity:0},Gritter.fade_out_speed,function(){$(e).animate({height:0},300,function(){$(e).remove();Gritter._countRemoveWrapper(unique_id);})})},_hoverState:function(e,type){if(type=='mouseenter'){$(e).addClass('hover');if($(e).find('img').length){$(e).find('img').before(this._tpl_close);}
|
||||
else{$(e).find('span').before(this._tpl_close);}
|
||||
$(e).find('.gritter-close').click(function(){Gritter._remove(this);});}
|
||||
else{$(e).removeClass('hover');$(e).find('.gritter-close').remove();}},_remove:function(e){var gritter_wrap=$(e).parents('.gritter-item-wrapper');var unique_id=gritter_wrap.attr('id').split('-')[2];this['_before_close_'+unique_id](gritter_wrap);gritter_wrap.fadeOut('medium',function(){$(this).remove();Gritter._countRemoveWrapper(unique_id);});},removeSpecific:function(unique_id,params){var e=$('#gritter-item-'+unique_id);this['_before_close_'+unique_id](e);if(typeof(params)==='object'){if(params.fade){var speed=this.fade_out_speed;if(params.speed){speed=params.speed;}
|
||||
e.fadeOut(speed,function(){e.remove();});}}
|
||||
else{e.remove();}
|
||||
this._countRemoveWrapper(unique_id);},restoreItemIfFading:function(e,number){window.clearTimeout(Gritter['_int_id_'+number]);$(e).stop().css({opacity:1});},_runSetup:function(){for(opt in $.gritter.options){this[opt]=$.gritter.options[opt];}
|
||||
this._is_setup=1;},_setFadeTimer:function(item,number){var timer_str=(this._custom_timer)?this._custom_timer:this.time;Gritter['_int_id_'+number]=window.setTimeout(function(){Gritter._fade(item,number);},timer_str);},stop:function(params){var before_close=($.isFunction(params.before_close))?params.before_close:function(){};var after_close=($.isFunction(params.after_close))?params.after_close:function(){};var wrap=$('#gritter-notice-wrapper');before_close(wrap);wrap.fadeOut(function(){$(this).remove();after_close();});},_str_replace:function(search,replace,subject,count){var i=0,j=0,temp='',repl='',sl=0,fl=0,f=[].concat(search),r=[].concat(replace),s=subject,ra=r instanceof Array,sa=s instanceof Array;s=[].concat(s);if(count){this.window[count]=0;}
|
||||
for(i=0,sl=s.length;i<sl;i++){if(s[i]===''){continue;}
|
||||
for(j=0,fl=f.length;j<fl;j++){temp=s[i]+'';repl=ra?(r[j]!==undefined?r[j]:''):r[0];s[i]=(temp).split(f[j]).join(repl);if(count&&s[i]!==temp){this.window[count]+=(temp.length-s[i].length)/f[j].length;}}}
|
||||
return sa?s:s[0];},_verifyWrapper:function(){if($('#gritter-notice-wrapper').length==0){$('body').append(this._tpl_wrap);}}}})(jQuery);
|
142
application/media/js/jquery.jstree-1.0rc.js
Normal file
@ -0,0 +1,142 @@
|
||||
(function(c){c.vakata={};c.vakata.css={get_css:function(a,d,g){a=a.toLowerCase();var f=g.cssRules||g.rules,b=0;do{if(f.length&&b>f.length+5)return false;if(f[b].selectorText&&f[b].selectorText.toLowerCase()==a)if(d===true){g.removeRule&&g.removeRule(b);g.deleteRule&&g.deleteRule(b);return true}else return f[b]}while(f[++b]);return false},add_css:function(a,d){if(c.jstree.css.get_css(a,false,d))return false;d.insertRule?d.insertRule(a+" { }",0):d.addRule(a,null,0);return c.vakata.css.get_css(a)},remove_css:function(a,
|
||||
d){return c.vakata.css.get_css(a,true,d)},add_sheet:function(a){var d;if(a.str){d=document.createElement("style");d.setAttribute("type","text/css");if(d.styleSheet){document.getElementsByTagName("head")[0].appendChild(d);d.styleSheet.cssText=a.str}else{d.appendChild(document.createTextNode(a.str));document.getElementsByTagName("head")[0].appendChild(d)}return d.sheet||d.styleSheet}if(a.url)if(document.createStyleSheet)try{document.createStyleSheet(a.url)}catch(g){}else{d=document.createElement("link");
|
||||
d.rel="stylesheet";d.type="text/css";d.media="all";d.href=a.url;document.getElementsByTagName("head")[0].appendChild(d);return d.styleSheet}}}})(jQuery);
|
||||
(function(c){var a=[],d=-1,g={},f={};c.fn.jstree=function(b){var e=typeof b=="string",h=Array.prototype.slice.call(arguments,1),k=this;!e&&c.meta&&h.push(c.metadata.get(this).jstree);b=!e&&h.length?c.extend.apply(null,[true,b].concat(h)):b;if(e&&b.substring(0,1)=="_")return k;e?this.each(function(){var j=a[c.data(this,"jstree-instance-id")];j=j&&c.isFunction(j[b])?j[b].apply(j,h):j;if(typeof j!=="undefined"&&j!==true&&j!==false){k=j;return false}}):this.each(function(){var j=c.data(this,"jstree-instance-id"),
|
||||
i=false;j&&a[j]&&a[j].destroy();j=parseInt(a.push({}),10)-1;c.data(this,"jstree-instance-id",j);b.plugins=c.isArray(b.plugins)?b.plugins:c.jstree.defaults.plugins;c.inArray("core",b.plugins)===-1&&b.plugins.unshift("core");i=c.extend(true,{},c.jstree.defaults,b);i.plugins=b.plugins;a[j]=new c.jstree._instance(j,c(this).addClass("jstree jstree-"+j),i);c.each(a[j].get_settings().plugins,function(m,l){a[j].data[l]={}});c.each(a[j].get_settings().plugins,function(m,l){g[l]&&g[l].__init.apply(a[j])});
|
||||
a[j].init()});return k};c.jstree={defaults:{plugins:[]},_focused:function(){return a[d]||null},_reference:function(b){if(a[b])return a[b];var e=c(b);if(!e.length&&typeof b==="string")e=c("#"+b);if(!e.length)return null;return a[e.closest(".jstree").data("jstree-instance-id")]||null},_instance:function(b,e,h){this.data={core:{}};this.get_settings=function(){return c.extend(true,{},h)};this.get_index=function(){return b};this.get_container=function(){return e};this._set_settings=function(k){h=c.extend(true,
|
||||
{},h,k)}},_fn:{},plugin:function(b,e){e=c.extend({},{__init:c.noop,__destroy:c.noop,_fn:{},defaults:false},e);g[b]=e;c.jstree.defaults[b]=e.defaults;c.each(e._fn,function(h,k){k.plugin=b;k.old=c.jstree._fn[h];c.jstree._fn[h]=function(){var j,i=k,m=Array.prototype.slice.call(arguments);j=this.get_settings();var l=new c.Event("before.jstree"),o=false;do{if(i&&i.plugin&&c.inArray(i.plugin,j.plugins)!==-1)break;i=i.old}while(i);if(i){j=this.get_container().triggerHandler(l,{func:h,inst:this,args:m});
|
||||
if(j!==false){if(typeof j!=="undefined")m=j;return j=i.apply(c.extend({},this,{__callback:function(n){this.get_container().triggerHandler(h+".jstree",{inst:this,args:m,rslt:n,rlbk:o})},__rollback:function(){return o=this.get_rollback()},__call_old:function(n){return i.old.apply(this,n?Array.prototype.slice.call(arguments,1):m)}}),m)}}};c.jstree._fn[h].old=k.old;c.jstree._fn[h].plugin=b})},rollback:function(b){if(b){c.isArray(b)||(b=[b]);c.each(b,function(e,h){a[h.i].set_rollback(h.h,h.d)})}}};c.jstree._fn=
|
||||
c.jstree._instance.prototype={};c(function(){var b=navigator.userAgent.toLowerCase(),e=(b.match(/.+?(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[0,"0"])[1],h=".jstree ul, .jstree li { display:block; margin:0 0 0 0; padding:0 0 0 0; list-style-type:none; } .jstree li { display:block; min-height:18px; line-height:18px; white-space:nowrap; margin-left:18px; } .jstree > ul > li { margin-left:0px; } .jstree ins { display:inline-block; text-decoration:none; width:18px; height:18px; margin:0 0 0 0; padding:0; } .jstree a { display:inline-block; line-height:16px; height:16px; color:black; white-space:nowrap; text-decoration:none; padding:1px 2px; margin:0; } .jstree a:focus { outline: none; } .jstree a > ins { height:16px; width:16px; } .jstree a > .jstree-icon { margin-right:3px; } li.jstree-open > ul { display:block; } li.jstree-closed > ul { display:none; } ";
|
||||
if(/msie/.test(b)&&parseInt(e,10)==6)h+=".jstree li { height:18px; margin-left:0; } .jstree li li { margin-left:18px; } li.jstree-open ul { display:block; } li.jstree-closed ul { display:none !important; } .jstree li a { display:inline; } .jstree li a ins { height:16px; width:16px; margin-right:3px; } ";c.vakata.css.add_sheet({str:h})});c.jstree.plugin("core",{__init:function(){this.data.core.to_open=c.map(c.makeArray(this.get_settings().core.initially_open),function(b){return"#"+b.toString().replace(/^#/,
|
||||
"").replace("\\/","/").replace("/","\\/")})},defaults:{html_titles:false,animation:500,initially_open:[]},_fn:{init:function(){this.set_focus();this.get_container().html("<ul><li class='jstree-last jstree-leaf'><ins> </ins><a class='jstree-loading' href='#'><ins class='jstree-icon'> </ins>Loading ...</a></li></ul>");this.data.core.li_height=this.get_container().find("ul li.jstree-closed, ul li.jstree-leaf").eq(0).height()||18;this.get_container().delegate("li > ins","click.jstree",c.proxy(function(b){var e=
|
||||
c(b.target);e.is("ins")&&b.pageY-e.offset().top<this.data.core.li_height&&this.toggle_node(e)},this)).bind("mousedown.jstree",c.proxy(function(){this.set_focus()},this)).bind("dblclick.jstree",function(){var b;if(document.selection&&document.selection.empty)document.selection.empty();else if(window.getSelection){b=window.getSelection();try{b.removeAllRanges();b.collapse()}catch(e){}}});this.__callback();this.load_node(-1,function(){this.loaded();this.reopen()})},destroy:function(){var b,e=this.get_index(),
|
||||
h=this.get_settings(),k=this;c.each(h.plugins,function(j,i){g[i].__destroy.apply(k)});this.__callback();if(this.is_focused())for(b in a)if(a.hasOwnProperty(b)&&b!=e){a[b].set_focus();break}if(e===d)d=-1;this.get_container().unbind(".jstree").undelegate(".jstree").removeData("jstree-instance-id").find("[class^='jstree']").andSelf().attr("class",function(){return this.className.replace(/jstree[^ ]*|$/ig,"")});a[e]=null;delete a[e]},save_opened:function(){var b=this;this.data.core.to_open=[];this.get_container().find(".jstree-open").each(function(){b.data.core.to_open.push("#"+
|
||||
this.id.toString().replace(/^#/,"").replace("\\/","/").replace("/","\\/"))});this.__callback(b.data.core.to_open)},reopen:function(b){var e=this,h=true,k=[],j=[];if(!b){this.data.core.reopen=false;this.data.core.refreshing=true}if(this.data.core.to_open.length){c.each(this.data.core.to_open,function(i,m){if(m=="#")return true;c(m).length&&c(m).is(".jstree-closed")?k.push(m):j.push(m)});if(k.length){this.data.core.to_open=j;c.each(k,function(i,m){e.open_node(m,function(){e.reopen(true)},true)});h=
|
||||
false}}if(h){this.data.core.reopen&&clearTimeout(this.data.core.reopen);this.data.core.reopen=setTimeout(function(){e.__callback({},e)},50);this.data.core.refreshing=false}},refresh:function(b){var e=this;this.save_opened();b||(b=-1);this.load_node(b,function(){e.__callback({});e.reopen()})},loaded:function(){this.__callback()},set_focus:function(){var b=c.jstree._focused();b&&b!==this&&b.get_container().removeClass("jstree-focused");if(b!==this){this.get_container().addClass("jstree-focused");d=
|
||||
this.get_index()}this.__callback()},is_focused:function(){return d==this.get_index()},_get_node:function(b){var e=c(b,this.get_container());if(e.is(".jstree")||b==-1)return-1;e=e.closest("li",this.get_container());return e.length?e:false},_get_next:function(b,e){b=this._get_node(b);if(b===-1)return this.get_container().find("> ul > li:first-child");if(!b.length)return false;if(e)return b.nextAll("li").size()>0?b.nextAll("li:eq(0)"):false;return b.hasClass("jstree-open")?b.find("li:eq(0)"):b.nextAll("li").size()>
|
||||
0?b.nextAll("li:eq(0)"):b.parentsUntil(this.get_container(),"li").next("li").eq(0)},_get_prev:function(b,e){b=this._get_node(b);if(b===-1)return this.get_container().find("> ul > li:last-child");if(!b.length)return false;if(e)return b.prevAll("li").length>0?b.prevAll("li:eq(0)"):false;if(b.prev("li").length){for(b=b.prev("li").eq(0);b.hasClass("jstree-open");)b=b.children("ul:eq(0)").children("li:last");return b}else{var h=b.parentsUntil(this.get_container(),"li:eq(0)");return h.length?h:false}},
|
||||
_get_parent:function(b){b=this._get_node(b);if(b==-1||!b.length)return false;b=b.parentsUntil(this.get_container(),"li:eq(0)");return b.length?b:-1},_get_children:function(b){b=this._get_node(b);if(b===-1)return this.get_container().children("ul:eq(0)").children("li");if(!b.length)return false;return b.children("ul:eq(0)").children("li")},get_path:function(b,e){var h=[],k=this;b=this._get_node(b);if(b===-1||!b||!b.length)return false;b.parentsUntil(this.get_container(),"li").each(function(){h.push(e?
|
||||
this.id:k.get_text(this))});h.reverse();h.push(e?b.attr("id"):this.get_text(b));return h},open_node:function(b,e,h){b=this._get_node(b);if(!b.length)return false;var k=h?0:this.get_settings().core.animation,j=this;if(this._is_loaded(b)){k&&b.children("ul").css("display","none");b.removeClass("jstree-closed").addClass("jstree-open").children("a").removeClass("jstree-loading");k&&b.children("ul").slideDown(k,function(){this.style.display=""});this.__callback({obj:b});e&&e.call()}else{b.children("a").addClass("jstree-loading");
|
||||
this.load_node(b,function(){j.open_node(b,e,h)},e)}},close_node:function(b,e){b=this._get_node(b);var h=e?0:this.get_settings().core.animation;if(!b.length)return false;h&&b.children("ul").attr("style","display:block !important");b.removeClass("jstree-open").addClass("jstree-closed");h&&b.children("ul").slideUp(h,function(){this.style.display=""});this.__callback({obj:b})},toggle_node:function(b){b=this._get_node(b);if(b.hasClass("jstree-closed"))return this.open_node(b);if(b.hasClass("jstree-open"))return this.close_node(b)},
|
||||
open_all:function(b,e){b=b?this._get_node(b):this.get_container();if(e)b=b.find("li.jstree-closed");else{e=b;b=b.is(".jstree-closed")?b.find("li.jstree-closed").andSelf():b.find("li.jstree-closed")}var h=this;b.each(function(){var k=this;h._is_loaded(this)?h.open_node(this,false,true):h.open_node(this,function(){h.open_all(k,e)},true)});e.find("li.jstree-closed").length===0&&this.__callback({obj:e})},close_all:function(b){var e=this;b=b?this._get_node(b):this.get_container();b.find("li.jstree-open").andSelf().each(function(){e.close_node(this)});
|
||||
this.__callback({obj:b})},clean_node:function(b){b=b&&b!=-1?c(b):this.get_container();b=b.is("li")?b.find("li").andSelf():b.find("li");b.removeClass("jstree-last").filter("li:last-child").addClass("jstree-last").end().filter(":has(ul)").not(".jstree-open").removeClass("jstree-leaf").addClass("jstree-closed");b.not(".jstree-open, .jstree-closed").addClass("jstree-leaf");this.__callback({obj:b})},get_rollback:function(){this.__callback();return{i:this.get_index(),h:this.get_container().children("ul").clone(true),
|
||||
d:this.data}},set_rollback:function(b,e){this.get_container().empty().append(b);this.data=e;this.__callback()},load_node:function(b){this.__callback({obj:b})},_is_loaded:function(){return true},create_node:function(b,e,h,k,j){b=this._get_node(b);e=typeof e==="undefined"?"last":e;var i=c("<li>"),m=this.get_settings().core.html_titles,l;if(b!==-1&&!b.length)return false;if(!j&&!this._is_loaded(b)){this.load_node(b,function(){this.create_node(b,e,h,k,true)});return false}this.__rollback();if(typeof h===
|
||||
"string")h={data:h};h||(h={});h.attr&&i.attr(h.attr);h.state&&i.addClass("jstree-"+h.state);if(!h.data)h.data="New node";if(!c.isArray(h.data)){l=h.data;h.data=[];h.data.push(l)}c.each(h.data,function(o,n){l=c("<a>");if(c.isFunction(n))n=n.call(this,h);if(typeof n=="string")l.attr("href","#")[m?"html":"text"](n);else{if(!n.attr)n.attr={};if(!n.attr.href)n.attr.href="#";l.attr(n.attr)[m?"html":"text"](n.title);n.language&&l.addClass(n.language)}l.prepend("<ins class='jstree-icon'> </ins>");if(n.icon)n.icon.indexOf("/")===
|
||||
-1?l.children("ins").addClass(n.icon):l.children("ins").css("background","url('"+n.icon+"') center center no-repeat;");i.append(l)});i.prepend("<ins class='jstree-icon'> </ins>");if(b===-1){b=this.get_container();if(e==="before")e="first";if(e==="after")e="last"}switch(e){case "before":b.before(i);l=this._get_parent(b);break;case "after":b.after(i);l=this._get_parent(b);break;case "inside":case "first":b.children("ul").length||b.append("<ul>");b.children("ul").prepend(i);l=b;break;case "last":b.children("ul").length||
|
||||
b.append("<ul>");b.children("ul").append(i);l=b;break;default:b.children("ul").length||b.append("<ul>");e||(e=0);l=b.children("ul").children("li").eq(e);l.length?l.before(i):b.children("ul").append(i);l=b;break}if(l===-1||l.get(0)===this.get_container().get(0))l=-1;this.clean_node(l);this.__callback({obj:i,parent:l});k&&k.call(this,i);return i},get_text:function(b){b=this._get_node(b);if(!b.length)return false;var e=this.get_settings().core.html_titles;b=b.children("a:eq(0)");if(e){b=b.clone();b.children("INS").remove();
|
||||
return b.html()}else{b=b.contents().filter(function(){return this.nodeType==3})[0];return b.nodeValue}},set_text:function(b,e){b=this._get_node(b);if(!b.length)return false;b=b.children("a:eq(0)");if(this.get_settings().core.html_titles){var h=b.children("INS").clone();b.html(e).prepend(h);this.__callback({obj:b,name:e});return true}else{b=b.contents().filter(function(){return this.nodeType==3})[0];this.__callback({obj:b,name:e});return b.nodeValue=e}},rename_node:function(b,e){b=this._get_node(b);
|
||||
this.__rollback();b&&b.length&&this.set_text.apply(this,Array.prototype.slice.call(arguments))&&this.__callback({obj:b,name:e})},delete_node:function(b){b=this._get_node(b);if(!b.length)return false;this.__rollback();var e=this._get_parent(b);this.deselect_node(b);b=b.remove();e!==-1&&e.find("> ul > li").length===0&&e.removeClass("jstree-open, jstree-closed").addClass("jstree-leaf");this.clean_node(e);this.__callback({obj:b});return b},prepare_move:function(b,e,h,k,j){var i={};i.ot=c.jstree._reference(i.o)||
|
||||
this;i.o=i.ot._get_node(b);i.r=e===-1?-1:this._get_node(e);i.p=typeof i==="undefined"?"last":h;if(!(!j&&f.o&&f.o[0]===i.o[0]&&f.r[0]===i.r[0]&&f.p===i.p)){i.ot=c.jstree._reference(i.o)||this;i.rt=e===-1?i.ot:c.jstree._reference(i.r)||this;if(i.r===-1){i.cr=-1;switch(i.p){case "first":case "before":case "inside":i.cp=0;break;case "after":case "last":i.cp=i.rt.get_container().find(" > ul > li").length;break;default:i.cp=i.p;break}}else{if(!/^(before|after)$/.test(i.p)&&!this._is_loaded(i.r))return this.load_node(i.r,
|
||||
function(){this.prepare_move(b,e,i,k,true)});switch(i.p){case "before":i.cp=i.r.index();i.cr=i.rt._get_parent(i.r);break;case "after":i.cp=i.r.index()+1;i.cr=i.rt._get_parent(i.r);break;case "inside":case "first":i.cp=0;i.cr=i.r;break;case "last":i.cp=i.r.find(" > ul > li").length;i.cr=i.r;break;default:i.cp=i.p;i.cr=i.r;break}}i.np=i.cr==-1?i.rt.get_container():i.cr;i.op=i.ot._get_parent(i.o);i.or=i.np.find(" > ul > li:nth-child("+(i.cp+1)+")");f=i}this.__callback(f);k&&k.call(this,f)},check_move:function(){var b=
|
||||
f;if(b.or[0]===b.o[0]||b.r.parentsUntil(".jstree").andSelf().filter("li").index(b.o)!==-1)return false;return true},move_node:function(b,e,h,k,j,i){if(!j)return this.prepare_move(b,e,h,function(l){this.move_node(l,false,false,k,true,i)});if(!i&&!this.check_move())return false;this.__rollback();e=false;if(k){e=b.o.clone();e.find("*[id]").andSelf().each(function(){if(this.id)this.id="copy_"+this.id})}else e=b.o;if(b.or.length)b.or.before(e);else{b.np.children("ul").length||c("<ul>").appendTo(b.np);
|
||||
b.np.children("ul:eq(0)").append(e)}try{b.ot.clean_node(b.op);b.rt.clean_node(b.np);b.op.find("> ul > li").length||b.op.removeClass("jstree-open jstree-closed").addClass("jstree-leaf").children("ul").remove()}catch(m){}if(k){f.cy=true;f.oc=e}this.__callback(f);return f},_get_move:function(){return f}}})})(jQuery);
|
||||
(function(c){c.jstree.plugin("ui",{__init:function(){this.data.ui.selected=c();this.data.ui.last_selected=false;this.data.ui.hovered=null;this.data.ui.to_select=this.get_settings().ui.initially_select;this.get_container().delegate("a","click.jstree",c.proxy(function(a){a.preventDefault();this.select_node(a.currentTarget,true,a)},this)).delegate("a","mouseenter.jstree",c.proxy(function(a){this.hover_node(a.target)},this)).delegate("a","mouseleave.jstree",c.proxy(function(a){this.dehover_node(a.target)},
|
||||
this)).bind("reopen.jstree",c.proxy(function(){this.reselect()},this)).bind("get_rollback.jstree",c.proxy(function(){this.dehover_node();this.save_selected()},this)).bind("set_rollback.jstree",c.proxy(function(){this.reselect()},this)).bind("close_node.jstree",c.proxy(function(a,d){var g=this.get_settings().ui,f=this._get_node(d.args[0]),b=f&&f.length?f.find(".jstree-clicked"):[],e=this;g.selected_parent_close===false||!b.length||b.each(function(){e.deselect_node(this);g.selected_parent_close==="select_parent"&&
|
||||
e.select_node(f)})},this)).bind("delete_node.jstree",c.proxy(function(a,d){var g=this._get_node(d.rslt.obj),f=this;(g&&g.length?g.find(".jstree-clicked"):[]).each(function(){f.deselect_node(this)})},this)).bind("move_node.jstree",c.proxy(function(a,d){d.rslt.cy&&d.rslt.oc.find(".jstree-clicked").removeClass("jstree-clicked")},this))},defaults:{select_limit:-1,select_multiple_modifier:"ctrl",selected_parent_close:"select_parent",initially_select:[]},_fn:{_get_node:function(a,d){if(typeof a==="undefined"||
|
||||
a===null)return d?this.data.ui.selected:this.data.ui.last_selected;return this.__call_old()},save_selected:function(){var a=this;this.data.ui.to_select=[];this.data.ui.selected.each(function(){a.data.ui.to_select.push("#"+this.id.toString().replace(/^#/,"").replace("\\/","/").replace("/","\\/"))});this.__callback(this.data.ui.to_select)},reselect:function(){var a=this,d=this.data.ui.to_select;d=c.map(c.makeArray(d),function(g){return"#"+g.toString().replace(/^#/,"").replace("\\/","/").replace("/",
|
||||
"\\/")});this.deselect_all();c.each(d,function(g,f){f&&f!=="#"&&a.select_node(f)});this.__callback()},refresh:function(){this.save_selected();return this.__call_old()},hover_node:function(a){a=this._get_node(a);if(!a.length)return false;a.hasClass("jstree-hovered")||this.dehover_node();this.data.ui.hovered=a.children("a").addClass("jstree-hovered").parent();this.__callback({obj:a})},dehover_node:function(){var a=this.data.ui.hovered;if(!a||!a.length)return false;if(this.data.ui.hovered[0]===a.children("a").removeClass("jstree-hovered").parent()[0])this.data.ui.hovered=
|
||||
null;this.__callback({obj:a})},select_node:function(a,d,g){a=this._get_node(a);if(!a.length)return false;var f=this.get_settings().ui;g=f.select_multiple_modifier=="on"||f.select_multiple_modifier!==false&&g&&g[f.select_multiple_modifier+"Key"];var b=this.is_selected(a),e=true;if(d){e=false;switch(true){case b&&!g:break;case !b&&!g:if(f.select_limit==-1||f.select_limit>0){this.deselect_all();e=true}break;case b&&g:this.deselect_node(a);break;case !b&&g:if(f.select_limit==-1||this.data.ui.selected.length+
|
||||
1<=f.select_limit)e=true;break}}if(e&&!b){a.children("a").addClass("jstree-clicked");this.data.ui.selected=this.data.ui.selected.add(a);this.data.ui.last_selected=a;this.__callback({obj:a})}},deselect_node:function(a){a=this._get_node(a);if(!a.length)return false;if(this.is_selected(a)){a.children("a").removeClass("jstree-clicked");this.data.ui.selected=this.data.ui.selected.not(a);if(this.data.ui.last_selected.get(0)===a.get(0))this.data.ui.last_selected=this.data.ui.selected.eq(0);this.__callback({obj:a})}},
|
||||
toggle_select:function(a){a=this._get_node(a);if(!a.length)return false;this.is_selected(a)?this.deselect_node(a):this.select_node(a)},is_selected:function(a){return this.data.ui.selected.index(this._get_node(a))>=0},get_selected:function(a){return a?c(a).find(".jstree-clicked").parent():this.data.ui.selected},deselect_all:function(a){a?c(a).find(".jstree-clicked").removeClass("jstree-clicked"):this.get_container().find(".jstree-clicked").removeClass("jstree-clicked");this.data.ui.selected=c([]);
|
||||
this.data.ui.last_selected=false;this.__callback()}}});c.jstree.defaults.plugins.push("ui")})(jQuery);
|
||||
(function(c){c.jstree.plugin("crrm",{__init:function(){this.get_container().bind("move_node.jstree",c.proxy(function(a,d){if(this.get_settings().crrm.move.open_onmove){var g=this;d.rslt.np.parentsUntil(".jstree").andSelf().filter(".jstree-closed").each(function(){g.open_node(this,false,true)})}},this))},defaults:{input_width_limit:200,move:{always_copy:false,open_onmove:true,default_position:"last",check_move:function(){return true}}},_fn:{_show_input:function(a,d){a=this._get_node(a);var g=this.get_settings().crrm.input_width_limit,
|
||||
f=a.children("ins").width(),b=a.find("> a:visible > ins").width()*a.find("> a:visible > ins").length,e=this.get_text(a),h=c("<div>",{css:{position:"absolute",top:"-200px",left:"-1000px",visibility:"hidden"}}).appendTo("body"),k=a.css("position","relative").append(c("<input>",{value:e,css:{padding:"0",border:"1px solid silver",position:"absolute",left:f+b+4+"px",top:"0px",height:this.data.core.li_height-2+"px",lineHeight:this.data.core.li_height-2+"px",width:"150px"},blur:c.proxy(function(){var j=
|
||||
a.children("input"),i=j.val();if(i==="")i=e;this.rename_node(a,i);d.call(this,a,i,e);j.remove();a.css("position","")},this),keyup:function(j){j=j.keyCode||j.which;if(j==27){this.value=e;this.blur()}else j==13?this.blur():k.width(Math.min(h.text("pW"+this.value).width(),g))}})).children("input");this.set_text(a,"");h.css({fontFamily:k.css("fontFamily")||"",fontSize:k.css("fontSize")||"",fontWeight:k.css("fontWeight")||"",fontStyle:k.css("fontStyle")||"",fontStretch:k.css("fontStretch")||"",fontVariant:k.css("fontVariant")||
|
||||
"",letterSpacing:k.css("letterSpacing")||"",wordSpacing:k.css("wordSpacing")||""});k.width(Math.min(h.text("pW"+k[0].value).width(),g))[0].select()},rename:function(a){a=this._get_node(a);this.__rollback();var d=this.__callback;this._show_input(a,function(g,f,b){d.call(this,{obj:g,new_name:f,old_name:b})})},create:function(a,d,g,f,b){var e=this;(a=this._get_node(a))||(a=-1);this.__rollback();return this.create_node(a,d,g,function(h){var k=this._get_parent(h),j=c(h).index();f&&f.call(this,h);k.length&&
|
||||
k.hasClass("jstree-closed")&&this.open_node(k,false,true);b?e.__callback({obj:h,name:this.get_text(h),parent:k,position:j}):this._show_input(h,function(i,m){e.__callback({obj:i,name:m,parent:k,position:j})})})},remove:function(a){a=this._get_node(a,true);this.__rollback();this.delete_node(a);this.__callback({obj:a})},check_move:function(){if(!this.__call_old())return false;if(!this.get_settings().crrm.move.check_move.call(this,this._get_move()))return false;return true},move_node:function(a,d,g,f,
|
||||
b,e){var h=this.get_settings().crrm.move;if(!b){if(!g)g=h.default_position;return this.__call_old(true,a,d,g,f,false,e)}if(h.always_copy===true||h.always_copy==="multitree"&&a.rt.get_index()===a.ot.get_index())f=true;this.__call_old(true,a,d,g,f,true,e)},cut:function(a){a=this._get_node(a);this.data.crrm.cp_nodes=false;this.data.crrm.ct_nodes=false;if(!a||!a.length)return false;this.data.crrm.ct_nodes=a},copy:function(a){a=this._get_node(a);this.data.crrm.cp_nodes=false;this.data.crrm.ct_nodes=false;
|
||||
if(!a||!a.length)return false;this.data.crrm.cp_nodes=a},paste:function(a){a=this._get_node(a);if(!a||!a.length)return false;if(!this.data.crrm.ct_nodes&&!this.data.crrm.cp_nodes)return false;this.data.crrm.ct_nodes&&this.move_node(this.data.crrm.ct_nodes,a);this.data.crrm.cp_nodes&&this.move_node(this.data.crrm.cp_nodes,a,false,true)}}});c.jstree.defaults.plugins.push("crrm")})(jQuery);
|
||||
(function(c){var a=[];c.jstree._themes=false;c.jstree.plugin("themes",{__init:function(){this.get_container().bind("init.jstree",c.proxy(function(){var d=this.get_settings().themes;this.data.themes.dots=d.dots;this.data.themes.icons=d.icons;this.set_theme(d.theme,d.url)},this)).bind("loaded.jstree",c.proxy(function(){this.data.themes.dots?this.show_dots():this.hide_dots();this.data.themes.icons?this.show_icons():this.hide_icons()},this))},defaults:{theme:"default",url:false,dots:true,icons:true},
|
||||
_fn:{set_theme:function(d,g){if(!d)return false;g||(g=c.jstree._themes+d+"/style.css");if(c.inArray(g,a)==-1){c.vakata.css.add_sheet({url:g,rel:"jstree"});a.push(g)}if(this.data.theme!=d){this.get_container().removeClass("jstree-"+this.data.theme);this.data.themes.theme=d}this.get_container().addClass("jstree-"+d);this.data.themes.dots?this.show_dots():this.hide_dots();this.data.themes.icons?this.show_icons():this.hide_icons();this.__callback()},get_theme:function(){return this.data.themes.theme},
|
||||
show_dots:function(){this.data.themes.dots=true;this.get_container().children("ul").removeClass("jstree-no-dots")},hide_dots:function(){this.data.themes.dots=false;this.get_container().children("ul").addClass("jstree-no-dots")},toggle_dots:function(){this.data.themes.dots?this.hide_dots():this.show_dots()},show_icons:function(){this.data.themes.icons=true;this.get_container().children("ul").removeClass("jstree-no-icons")},hide_icons:function(){this.data.themes.icons=false;this.get_container().children("ul").addClass("jstree-no-icons")},
|
||||
toggle_icons:function(){this.data.themes.icons?this.hide_icons():this.show_icons()}}});c(function(){c.jstree._themes===false&&c("script").each(function(){if(this.src.toString().match(/jquery\.jstree[^\/]*?\.js(\?.*)?$/)){c.jstree._themes=this.src.toString().replace(/jquery\.jstree[^\/]*?\.js(\?.*)?$/,"")+"themes/";return false}});if(c.jstree._themes===false)c.jstree._themes="themes/"});c.jstree.defaults.plugins.push("themes")})(jQuery);
|
||||
(function(c){c.jstree.plugin("html_data",{__init:function(){this.data.html_data.original_container_html=this.get_container().html().replace(/<\/([^>]+)>\s+</ig,"</$1><").replace(/>\s+<([a-z]{1})/ig,"><$1")},defaults:{data:false,ajax:false,correct_state:false},_fn:{load_node:function(a,d,g){var f=this;this.load_node_html(a,function(){f.__callback({obj:a});d.call(this)},g)},_is_loaded:function(a){a=this._get_node(a);return a==-1||!a||!this.get_settings().html_data.ajax||a.is(".jstree-open, .jstree-leaf")||
|
||||
a.children("ul").children("li").size()>0},load_node_html:function(a,d,g){var f,b=this.get_settings().html_data,e=function(){};switch(true){case !b.data&&!b.ajax:if(!a||a==-1){this.get_container().html(this.data.html_data.original_container_html).find("li, a").filter(function(){return this.firstChild.tagName!=="INS"}).prepend("<ins class='jstree-icon'> </ins>");this.clean_node()}d&&d.call(this);break;case !!b.data&&!b.ajax||!!b.data&&!!b.ajax&&(!a||a===-1):if(!a||a==-1){f=c(b.data);f.is("ul")||
|
||||
(f=c("<ul>").append(f));this.get_container().children("ul").empty().append(f.children()).find("li, a").filter(function(){return this.firstChild.tagName!=="INS"}).prepend("<ins class='jstree-icon'> </ins>");this.clean_node()}d&&d.call(this);break;case !b.data&&!!b.ajax||!!b.data&&!!b.ajax&&a&&a!==-1:a=this._get_node(a);e=function(h,k,j){var i=this.get_settings().html_data.ajax.error;i&&i.call(this,h,k,j);if(a!=-1&&a.length){a.children(".jstree-loading").removeClass("jstree-loading");b.correct_state&&
|
||||
a.removeClass("jstree-open jstree-closed").addClass("jstree-leaf")}g&&g.call(this)};b.ajax.context=this;b.ajax.error=e;b.ajax.success=function(h,k,j){if(j.responseText=="")return e.call(this,j,k,"");var i=this.get_settings().html_data.ajax.success;if(i)h=i.call(this,h,k,j)||h;if(h){h=c(h);h.is("ul")||(h=c("<ul>").append(h));if(a==-1||!a)this.get_container().children("ul").empty().append(h.children()).find("li, a").filter(function(){return this.firstChild.tagName!=="INS"}).prepend("<ins class='jstree-icon'> </ins>");
|
||||
else{a.children(".jstree-loading").removeClass("jstree-loading");a.append(h).find("li, a").filter(function(){return this.firstChild.tagName!=="INS"}).prepend("<ins class='jstree-icon'> </ins>")}this.clean_node(a);d&&d.call(this)}else{a.children(".jstree-loading").removeClass("jstree-loading");b.correct_state&&a.removeClass("jstree-open jstree-closed").addClass("jstree-leaf")}};if(c.isFunction(b.ajax.data))b.ajax.data=b.ajax.data.call(this,a);c.ajax(b.ajax);break}}}});c.jstree.defaults.plugins.push("html_data")})(jQuery);
|
||||
(function(c){var a=[];c.jstree.plugin("hotkeys",{__init:function(){if(typeof c.hotkeys==="undefined")throw"jsTree hotkeys: jQuery hotkeys plugin not included.";if(!this.data.ui)throw"jsTree hotkeys: jsTree UI plugin not included.";c.each(this.get_settings().hotkeys,function(d){if(c.inArray(d,a)==-1){c(document).bind("keydown",d,function(g){var f;var b=c.jstree._focused();if(b&&b.data&&b.data.hotkeys&&b.data.hotkeys.enabled)if(b.get_settings().hotkeys[d])f=b.get_settings().hotkeys[d].call(b,g);return f});
|
||||
a.push(d)}});this.enable_hotkeys()},defaults:{up:function(){this.hover_node(this._get_prev(this.data.ui.hovered||this.data.ui.last_selected||-1));return false},down:function(){this.hover_node(this._get_next(this.data.ui.hovered||this.data.ui.last_selected||-1));return false},left:function(){var d=this.data.ui.hovered||this.data.ui.last_selected;if(d)d.hasClass("jstree-open")?this.close_node(d):this.hover_node(this._get_prev(d));return false},right:function(){var d=this.data.ui.hovered||this.data.ui.last_selected;
|
||||
if(d&&d.length)d.hasClass("jstree-closed")?this.open_node(d):this.hover_node(this._get_next(d));return false},space:function(){this.data.ui.hovered&&this.data.ui.hovered.children("a:eq(0)").click();return false},"ctrl+space":function(d){d.type="click";this.data.ui.hovered&&this.data.ui.hovered.children("a:eq(0)").trigger(d);return false},f2:function(){this.rename(this.data.ui.hovered||this.data.ui.last_selected)},del:function(){this.remove(this.data.ui.hovered||this._get_node(null))}},_fn:{enable_hotkeys:function(){this.data.hotkeys.enabled=
|
||||
true},disable_hotkeys:function(){this.data.hotkeys.enabled=false}}})})(jQuery);
|
||||
(function(c){c.jstree.plugin("json_data",{defaults:{data:false,ajax:false,correct_state:false,progressive_render:false},_fn:{load_node:function(a,d,g){var f=this;this.load_node_json(a,function(){f.__callback({obj:a});d.call(this)},g)},_is_loaded:function(a){var d=this.get_settings().json_data;if((a=this._get_node(a))&&a!==-1&&d.progressive_render){a.append(this.parse_json(a.data("jstree-children")));c.removeData(a,"jstree-children");this.clean_node(a)}return a==-1||!a||!d.ajax||a.is(".jstree-open, .jstree-leaf")||
|
||||
a.children("ul").children("li").size()>0},load_node_json:function(a,d,g){var f=this.get_settings().json_data,b=function(){};switch(true){case !f.data&&!f.ajax:throw"Neither data nor ajax settings supplied.";case !!f.data&&!f.ajax||!!f.data&&!!f.ajax&&(!a||a===-1):if(!a||a==-1){this.get_container().children("ul").empty().append(this.parse_json(f.data).children());this.clean_node()}d&&d.call(this);break;case !f.data&&!!f.ajax||!!f.data&&!!f.ajax&&a&&a!==-1:a=this._get_node(a);b=function(e,h,k){var j=
|
||||
this.get_settings().json_data.ajax.error;j&&j.call(this,e,h,k);if(a!=-1&&a.length){a.children(".jstree-loading").removeClass("jstree-loading");f.correct_state&&a.removeClass("jstree-open jstree-closed").addClass("jstree-leaf")}g&&g.call(this)};f.ajax.context=this;f.ajax.error=b;f.ajax.success=function(e,h,k){if(k.responseText==""||!c.isArray(e)&&!c.isPlainObject(e))return b.call(this,k,h,"");var j=this.get_settings().json_data.ajax.success;if(j)e=j.call(this,e,h,k)||e;if(e=this.parse_json(e)){a==
|
||||
-1||!a?this.get_container().children("ul").empty().append(e.children()):a.append(e).children(".jstree-loading").removeClass("jstree-loading");this.clean_node(a);d&&d.call(this)}else{a.children(".jstree-loading").removeClass("jstree-loading");f.correct_state&&a.removeClass("jstree-open jstree-closed").addClass("jstree-leaf")}};if(c.isFunction(f.ajax.data))f.ajax.data=f.ajax.data.call(this,a);c.ajax(f.ajax);break}},parse_json:function(a,d){var g=c(),f,b,e;b=this.get_settings().json_data;var h=this.get_settings().core.html_titles;
|
||||
if(!a)return g;if(c.isFunction(a))a=a.call(this);if(c.isArray(a)){if(!a.length)return false;b=0;for(e=a.length;b<e;b++){f=this.parse_json(a[b],true);if(f.length)g=g.add(f)}}else{if(typeof a=="string")a={data:a};if(!a.data&&a.data!=="")return g;g=c("<li>");a.attr&&g.attr(a.attr);a.metadata&&g.data("jstree",a.metadata);a.state&&g.addClass("jstree-"+a.state);if(!c.isArray(a.data)){f=a.data;a.data=[];a.data.push(f)}c.each(a.data,function(k,j){f=c("<a>");if(c.isFunction(j))j=j.call(this,a);if(typeof j==
|
||||
"string")f.attr("href","#")[h?"html":"text"](j);else{if(!j.attr)j.attr={};if(!j.attr.href)j.attr.href="#";f.attr(j.attr)[h?"html":"text"](j.title);j.language&&f.addClass(j.language)}f.prepend("<ins class='jstree-icon'> </ins>");if(j.icon)j.icon.indexOf("/")===-1?f.children("ins").addClass(j.icon):f.children("ins").css("background","url('"+j.icon+"') center center no-repeat;");g.append(f)});g.prepend("<ins class='jstree-icon'> </ins>");if(a.children)if(b.progressive_render&&a.state!=="open")g.addClass("jstree-closed").data("jstree-children",
|
||||
a.children);else{if(c.isFunction(a.children))a.children=a.children.call(this,a);if(c.isArray(a.children)&&a.children.length){f=this.parse_json(a.children,true);if(f.length){b=c("<ul>");b.append(f);g.append(b)}}}}if(!d){b=c("<ul>");b.append(g);g=b}return g},get_json:function(a,d,g){var f=[],b=this.get_settings(),e=this,h,k,j,i,m,l;a=this._get_node(a);if(!a||a===-1)a=this.get_container().find("> ul > li");d=c.isArray(d)?d:["id","class"];this.data.types&&d.push(b.types.type_attr);g=c.isArray(g)?g:[];
|
||||
a.each(function(){j=c(this);h={data:[]};if(d.length)h.attr={};c.each(d,function(o,n){if((k=j.attr(n))&&k.length&&k.replace(/jstree[^ ]*|$/ig,"").length)h.attr[n]=k.replace(/jstree[^ ]*|$/ig,"")});if(j.hasClass("jstree-open"))h.state="open";if(j.hasClass("jstree-closed"))h.state="closed";i=j.children("a");i.each(function(){m=c(this);if(g.length||c.inArray("languages",b.plugins)!==-1||m.children("ins").get(0).style.backgroundImage.length||m.children("ins").get(0).className&&m.children("ins").get(0).className.replace(/jstree[^ ]*|$/ig,
|
||||
"").length){l=false;c.inArray("languages",b.plugins)!==-1&&c.isArray(b.languages)&&b.languages.length&&c.each(b.languages,function(o,n){if(m.hasClass(n)){l=n;return false}});k={attr:{},title:e.get_text(m,l)};c.each(g,function(o,n){h.attr[n]=j.attr(n).replace(/jstree[^ ]*|$/ig,"")});c.each(b.languages,function(o,n){if(m.hasClass(n)){k.language=n;return true}});if(m.children("ins").get(0).className.replace(/jstree[^ ]*|$/ig,"").replace(/^\s+$/ig,"").length)k.icon=m.children("ins").get(0).className.replace(/jstree[^ ]*|$/ig,
|
||||
"").replace(/^\s+$/ig,"");if(m.children("ins").get(0).style.backgroundImage.length)k.icon=m.children("ins").get(0).style.backgroundImage.replace("url(","").replace(")","")}else k=e.get_text(m);if(i.length>1)h.data.push(k);else h.data=k});j=j.find("> ul > li");if(j.length)h.children=e.get_json(j,d,g);f.push(h)});return f}}})})(jQuery);
|
||||
(function(c){c.jstree.plugin("languages",{__init:function(){this._load_css()},defaults:[],_fn:{set_lang:function(a){var d=this.get_settings().languages,g=false,f=".jstree-"+this.get_index()+" a";if(!c.isArray(d)||d.length===0)return false;if(c.inArray(a,d)==-1)if(d[a])a=d[a];else return false;if(a==this.data.languages.current_language)return true;g=c.vakata.css.get_css(f+"."+this.data.languages.current_language,false,this.data.languages.language_css);if(g!==false)g.style.display="none";g=c.vakata.css.get_css(f+
|
||||
"."+a,false,this.data.languages.language_css);if(g!==false)g.style.display="";this.data.languages.current_language=a;this.__callback(a);return true},get_lang:function(){return this.data.languages.current_language},get_text:function(a,d){a=this._get_node(a)||this.data.ui.last_selected;if(!a.size())return false;var g=this.get_settings().languages,f=this.get_settings().core.html_titles;if(c.isArray(g)&&g.length){d=d&&c.inArray(d,g)!=-1?d:this.data.languages.current_language;a=a.children("a."+d)}else a=
|
||||
a.children("a:eq(0)");if(f){a=a.clone();a.children("INS").remove();return a.html()}else{a=a.contents().filter(function(){return this.nodeType==3})[0];return a.nodeValue}},set_text:function(a,d,g){a=this._get_node(a)||this.data.ui.last_selected;if(!a.size())return false;var f=this.get_settings().languages,b=this.get_settings().core.html_titles;if(c.isArray(f)&&f.length){g=g&&c.inArray(g,f)!=-1?g:this.data.languages.current_language;a=a.children("a."+g)}else a=a.children("a:eq(0)");if(b){f=a.children("INS").clone();
|
||||
a.html(d).prepend(f);this.__callback({obj:a,name:d,lang:g});return true}else{a=a.contents().filter(function(){return this.nodeType==3})[0];this.__callback({obj:a,name:d,lang:g});return a.nodeValue=d}},_load_css:function(){var a=this.get_settings().languages,d="/* languages css */",g=".jstree-"+this.get_index()+" a",f;if(c.isArray(a)&&a.length){this.data.languages.current_language=a[0];for(f=0;f<a.length;f++){d+=g+"."+a[f]+" {";if(a[f]!=this.data.languages.current_language)d+=" display:none; ";d+=
|
||||
" } "}this.data.languages.language_css=c.vakata.css.add_sheet({str:d})}},create_node:function(a,d,g,f){return this.__call_old(true,a,d,g,function(b){var e=this.get_settings().languages,h=b.children("a"),k;if(c.isArray(e)&&e.length){for(k=0;k<e.length;k++)h.is("."+e[k])||b.append(h.eq(0).clone().removeClass(e.join(" ")).addClass(e[k]));h.not("."+e.join(", .")).remove()}f&&f.call(this,b)})}}})})(jQuery);
|
||||
(function(c){c.jstree.plugin("cookies",{__init:function(){if(typeof c.cookie==="undefined")throw"jsTree cookie: jQuery cookie plugin not included.";var a=this.get_settings().cookies,d;if(a.save_opened)if((d=c.cookie(a.save_opened))&&d.length)this.data.core.to_open=d.split(",");if(a.save_selected)if((d=c.cookie(a.save_selected))&&d.length)this.data.ui.to_select=d.split(",");this.get_container().one((this.data.ui?"reselect":"reopen")+".jstree",c.proxy(function(){this.get_container().bind("open_node.jstree close_node.jstree select_node.jstree deselect_node.jstree",
|
||||
c.proxy(function(g){this.get_settings().cookies.auto_save&&this.save_cookie((g.handleObj.namespace+g.handleObj.type).replace("jstree",""))},this))},this))},defaults:{save_opened:"jstree_open",save_selected:"jstree_select",auto_save:true,cookie_options:{}},_fn:{save_cookie:function(a){if(!this.data.core.refreshing){var d=this.get_settings().cookies;if(a)switch(a){case "open_node":case "close_node":if(d.save_opened){this.save_opened();c.cookie(d.save_opened,this.data.core.to_open.join(","),d.cookie_options)}break;
|
||||
case "select_node":case "deselect_node":if(d.save_selected&&this.data.ui){this.save_selected();c.cookie(d.save_selected,this.data.ui.to_select.join(","),d.cookie_options)}break}else{if(d.save_opened){this.save_opened();c.cookie(d.save_opened,this.data.core.to_open.join(","),d.cookie_options)}if(d.save_selected&&this.data.ui){this.save_selected();c.cookie(d.save_selected,this.data.ui.to_select.join(","),d.cookie_options)}}}}}});c.jstree.defaults.plugins.push("cookies")})(jQuery);
|
||||
(function(c){c.jstree.plugin("sort",{__init:function(){this.get_container().bind("load_node.jstree",c.proxy(function(a,d){var g=this._get_node(d.rslt.obj);g=g===-1?this.get_container().children("ul"):g.children("ul");this.sort(g)},this)).bind("rename_node.jstree",c.proxy(function(a,d){this.sort(d.rslt.obj.parent())},this)).bind("move_node.jstree",c.proxy(function(a,d){this.sort((d.rslt.np==-1?this.get_container():d.rslt.np).children("ul"))},this))},defaults:function(a,d){return this.get_text(a)>this.get_text(d)?
|
||||
1:-1},_fn:{sort:function(a){var d=this.get_settings().sort,g=this;a.append(c.makeArray(a.children("li")).sort(c.proxy(d,g)));a.find("> li > ul").each(function(){g.sort(c(this))});this.clean_node(a)}}})})(jQuery);
|
||||
(function(c){var a=false,d=false,g=false;c.vakata.dnd={is_down:false,is_drag:false,helper:false,init_x:0,init_y:0,threshold:5,user_data:{},drag_start:function(f,b,e){c.vakata.dnd.is_drag&&c.vakata.drag_stop({});try{f.currentTarget.unselectable="on";f.currentTarget.onselectstart=function(){return false};if(f.currentTarget.style)f.currentTarget.style.MozUserSelect="none"}catch(h){}c.vakata.dnd.init_x=f.pageX;c.vakata.dnd.init_y=f.pageY;c.vakata.dnd.user_data=b;c.vakata.dnd.is_down=true;c.vakata.dnd.helper=
|
||||
c("<div id='vakata-dragged'>").html(e).css("opacity","0.75");c(document).bind("mousemove",c.vakata.dnd.drag);c(document).bind("mouseup",c.vakata.dnd.drag_stop);return false},drag:function(f){if(c.vakata.dnd.is_down){if(!c.vakata.dnd.is_drag)if(Math.abs(f.pageX-c.vakata.dnd.init_x)>5||Math.abs(f.pageY-c.vakata.dnd.init_y)>5){c.vakata.dnd.helper.appendTo("body");c.vakata.dnd.is_drag=true;c(document).triggerHandler("vakata.drag_start",{event:f,data:c.vakata.dnd.user_data})}else return;c.vakata.dnd.helper.css({left:f.pageX+
|
||||
5+"px",top:f.pageY+10+"px"});c(document).triggerHandler("vakata.drag",{event:f,data:c.vakata.dnd.user_data})}},drag_stop:function(f){c(document).unbind("mousemove",c.vakata.dnd.drag);c(document).unbind("mouseup",c.vakata.dnd.drag_stop);c(document).triggerHandler("vakata.drag_stop",{event:f,data:c.vakata.dnd.user_data});c.vakata.dnd.helper.remove();c.vakata.dnd.init_x=0;c.vakata.dnd.init_y=0;c.vakata.dnd.user_data={};c.vakata.dnd.is_down=false;c.vakata.dnd.is_drag=false}};c(function(){c.vakata.css.add_sheet({str:"#vakata-dragged { display:block; margin:0 0 0 0; padding:4px 4px 4px 24px; position:absolute; left:-2000px; top:-2000px; line-height:16px; } "})});
|
||||
c.jstree.plugin("dnd",{__init:function(){this.data.dnd={active:false,after:false,inside:false,before:false,off:false,prepared:false,w:0,to1:false,to2:false,cof:false,cw:false,ch:false,i1:false,i2:false};this.get_container().bind("mouseenter.jstree",c.proxy(function(){if(c.vakata.dnd.is_drag&&c.vakata.dnd.user_data.jstree&&this.data.themes){g.attr("class","jstree-"+this.data.themes.theme);c.vakata.dnd.helper.attr("class","jstree-dnd-helper jstree-"+this.data.themes.theme)}},this)).bind("mouseleave.jstree",
|
||||
c.proxy(function(){if(c.vakata.dnd.is_drag&&c.vakata.dnd.user_data.jstree){this.data.dnd.i1&&clearInterval(this.data.dnd.i1);this.data.dnd.i2&&clearInterval(this.data.dnd.i2)}},this)).bind("mousemove.jstree",c.proxy(function(b){if(c.vakata.dnd.is_drag&&c.vakata.dnd.user_data.jstree){var e=this.get_container()[0];if(b.pageX+20>this.data.dnd.cof.left+this.data.dnd.cw){this.data.dnd.i1&&clearInterval(this.data.dnd.i1);this.data.dnd.i1=setInterval(c.proxy(function(){this.scrollLeft+=5},e),100)}else if(b.pageX-
|
||||
20<this.data.dnd.cof.left){this.data.dnd.i1&&clearInterval(this.data.dnd.i1);this.data.dnd.i1=setInterval(c.proxy(function(){this.scrollLeft-=5},e),100)}else this.data.dnd.i1&&clearInterval(this.data.dnd.i1);if(b.pageY+20>this.data.dnd.cof.top+this.data.dnd.ch){this.data.dnd.i2&&clearInterval(this.data.dnd.i2);this.data.dnd.i2=setInterval(c.proxy(function(){this.scrollTop+=5},e),100)}else if(b.pageY-20<this.data.dnd.cof.top){this.data.dnd.i2&&clearInterval(this.data.dnd.i2);this.data.dnd.i2=setInterval(c.proxy(function(){this.scrollTop-=
|
||||
5},e),100)}else this.data.dnd.i2&&clearInterval(this.data.dnd.i2)}},this)).delegate("a","mousedown.jstree",c.proxy(function(b){this.start_drag(b.currentTarget,b);return false},this)).delegate("a","mouseenter.jstree",c.proxy(function(b){c.vakata.dnd.is_drag&&c.vakata.dnd.user_data.jstree&&this.dnd_enter(b.currentTarget)},this)).delegate("a","mousemove.jstree",c.proxy(function(b){if(c.vakata.dnd.is_drag&&c.vakata.dnd.user_data.jstree){if(typeof this.data.dnd.off.top==="undefined")this.data.dnd.off=
|
||||
c(b.target).offset();this.data.dnd.w=(b.pageY-(this.data.dnd.off.top||0))%this.data.core.li_height;if(this.data.dnd.w<0)this.data.dnd.w+=this.data.core.li_height;this.dnd_show()}},this)).delegate("a","mouseleave.jstree",c.proxy(function(b){if(c.vakata.dnd.is_drag&&c.vakata.dnd.user_data.jstree){this.data.dnd.after=false;this.data.dnd.before=false;this.data.dnd.inside=false;c.vakata.dnd.helper.children("ins").attr("class","jstree-invalid");g.hide();if(d&&d[0]===b.target.parentNode){if(this.data.dnd.to1){clearTimeout(this.data.dnd.to1);
|
||||
this.data.dnd.to1=false}if(this.data.dnd.to2){clearTimeout(this.data.dnd.to2);this.data.dnd.to2=false}}}},this)).delegate("a","mouseup.jstree",c.proxy(function(b){c.vakata.dnd.is_drag&&c.vakata.dnd.user_data.jstree&&this.dnd_finish(b)},this));c(document).bind("vakata.drag_stop",c.proxy(function(){this.data.dnd.after=false;this.data.dnd.before=false;this.data.dnd.inside=false;this.data.dnd.off=false;this.data.dnd.prepared=false;this.data.dnd.w=false;this.data.dnd.to1=false;this.data.dnd.to2=false;
|
||||
this.data.dnd.active=false;this.data.dnd.foreign=false;g&&g.css({left:"-2000px",top:"-2000px"})},this)).bind("vakata.drag_start",c.proxy(function(b,e){if(e.data.jstree){var h=c(e.event.target);h.closest(".jstree").hasClass("jstree-"+this.get_index())&&this.dnd_enter(h)}},this));var f=this.get_settings().dnd;f.drag_target&&c(document).delegate(f.drag_target,"mousedown.jstree",c.proxy(function(b){a=b.target;c.vakata.dnd.drag_start(b,{jstree:true,obj:b.target},"<ins class='jstree-icon'></ins>"+c(b.target).text());
|
||||
if(this.data.themes){g.attr("class","jstree-"+this.data.themes.theme);c.vakata.dnd.helper.attr("class","jstree-dnd-helper jstree-"+this.data.themes.theme)}c.vakata.dnd.helper.children("ins").attr("class","jstree-invalid");b=this.get_container();this.data.dnd.cof=b.children("ul").offset();this.data.dnd.cw=parseInt(b.width(),10);this.data.dnd.ch=parseInt(b.height(),10);this.data.dnd.foreign=true;return false},this));f.drop_target&&c(document).delegate(f.drop_target,"mouseenter.jstree",c.proxy(function(b){this.data.dnd.active&&
|
||||
this.get_settings().dnd.drop_check.call(this,{o:a,r:c(b.target)})&&c.vakata.dnd.helper.children("ins").attr("class","jstree-ok")},this)).delegate(f.drop_target,"mouseleave.jstree",c.proxy(function(){this.data.dnd.active&&c.vakata.dnd.helper.children("ins").attr("class","jstree-invalid")},this)).delegate(f.drop_target,"mouseup.jstree",c.proxy(function(b){this.data.dnd.active&&c.vakata.dnd.helper.children("ins").hasClass("jstree-ok")&&this.get_settings().dnd.drop_finish.call(this,{o:a,r:c(b.target)})},
|
||||
this))},defaults:{copy_modifier:"ctrl",check_timeout:200,open_timeout:500,drop_target:".jstree-drop",drop_check:function(){return true},drop_finish:c.noop,drag_target:".jstree-draggable",drag_finish:c.noop,drag_check:function(){return{after:false,before:false,inside:true}}},_fn:{dnd_prepare:function(){this.data.dnd.off=d.offset();if(this.data.dnd.foreign){var f=this.get_settings().dnd.drag_check.call(this,{o:a,r:d});this.data.dnd.after=f.after;this.data.dnd.before=f.before;this.data.dnd.inside=f.inside;
|
||||
this.data.dnd.prepared=true;return this.dnd_show()}this.prepare_move(a,d,"before");this.data.dnd.before=this.check_move();this.prepare_move(a,d,"after");this.data.dnd.after=this.check_move();if(this._is_loaded(d)){this.prepare_move(a,d,"inside");this.data.dnd.inside=this.check_move()}else this.data.dnd.inside=false;this.data.dnd.prepared=true;return this.dnd_show()},dnd_show:function(){if(this.data.dnd.prepared){var f=["before","inside","after"],b=false;f=this.data.dnd.w<this.data.core.li_height/
|
||||
3?["before","inside","after"]:this.data.dnd.w<=this.data.core.li_height*2/3?this.data.dnd.w<this.data.core.li_height/2?["inside","before","after"]:["inside","after","before"]:["after","inside","before"];c.each(f,c.proxy(function(e,h){if(this.data.dnd[h]){c.vakata.dnd.helper.children("ins").attr("class","jstree-ok");b=h;return false}},this));b===false&&c.vakata.dnd.helper.children("ins").attr("class","jstree-invalid");switch(b){case "before":g.css({left:this.data.dnd.off.left+10+"px",top:this.data.dnd.off.top-
|
||||
6+"px"}).show();break;case "after":g.css({left:this.data.dnd.off.left+10+"px",top:this.data.dnd.off.top+this.data.core.li_height-7+"px"}).show();break;case "inside":g.css({left:this.data.dnd.off.left+14+"px",top:this.data.dnd.off.top+this.data.core.li_height/2-5+"px"}).show();break;default:g.hide();break}return b}},dnd_open:function(){this.data.dnd.to2=false;this.open_node(d,c.proxy(this.dnd_prepare,this),true)},dnd_finish:function(f){if(this.data.dnd.foreign){if(this.data.dnd.after||this.data.dnd.before||
|
||||
this.data.dnd.inside)this.get_settings().dnd.drag_finish.call(this,{o:a,r:d})}else{this.dnd_prepare();this.move_node(a,d,this.dnd_show(),f[this.get_settings().dnd.copy_modifier+"Key"])}d=a=false;g.hide()},dnd_enter:function(f){var b=this.get_settings().dnd;this.data.dnd.prepared=false;d=this._get_node(f);if(b.check_timeout){this.data.dnd.to1&&clearTimeout(this.data.dnd.to1);this.data.dnd.to1=setTimeout(c.proxy(this.dnd_prepare,this),b.check_timeout)}else this.dnd_prepare();if(b.open_timeout){this.data.dnd.to2&&
|
||||
clearTimeout(this.data.dnd.to2);if(d.hasClass("jstree-closed"))this.data.dnd.to2=setTimeout(c.proxy(this.dnd_open,this),b.open_timeout)}else d.hasClass("jstree-closed")&&this.dnd_open()},start_drag:function(f,b){a=this._get_node(f);if(this.data.ui&&this.is_selected(a))a=this._get_node(null,true);c.vakata.dnd.drag_start(b,{jstree:true,obj:a},"<ins class='jstree-icon'></ins>"+(a.length>1?"Multiple selection":this.get_text(a)));if(this.data.themes){g.attr("class","jstree-"+this.data.themes.theme);c.vakata.dnd.helper.attr("class",
|
||||
"jstree-dnd-helper jstree-"+this.data.themes.theme)}var e=this.get_container();this.data.dnd.cof=e.children("ul").offset();this.data.dnd.cw=parseInt(e.width(),10);this.data.dnd.ch=parseInt(e.height(),10);this.data.dnd.active=true}}});c(function(){c.vakata.css.add_sheet({str:"#vakata-dragged ins { display:block; text-decoration:none; width:16px; height:16px; margin:0 0 0 0; padding:0; position:absolute; top:4px; left:4px; } #vakata-dragged .jstree-ok { background:green; } #vakata-dragged .jstree-invalid { background:red; } #jstree-marker { padding:0; margin:0; line-height:12px; font-size:1px; overflow:hidden; height:12px; width:8px; position:absolute; left:-45px; top:-30px; z-index:1000; background-repeat:no-repeat; display:none; background-color:silver; } "});
|
||||
g=c("<div>").attr({id:"jstree-marker"}).hide().appendTo("body");c(document).bind("vakata.drag_start",function(f,b){b.data.jstree&&g.show()});c(document).bind("vakata.drag_stop",function(f,b){b.data.jstree&&g.hide()})})})(jQuery);
|
||||
(function(c){c.jstree.plugin("checkbox",{__init:function(){if(!this.data.ui)throw"jsTree checkboxes: jsTree UI plugin not included";this.select_node=this.deselect_node=this.deselect_all=c.noop;this.get_selected=this.get_checked;this.get_container().bind("open_node.jstree create_node.jstree",c.proxy(function(a,d){this._prepare_checkboxes(d.rslt.obj)},this)).bind("loaded.jstree",c.proxy(function(){this._prepare_checkboxes()},this)).bind("clean_node.jstree",c.proxy(function(a,d){this._repair_state(d.args[0])},
|
||||
this)).delegate("a","click.jstree",c.proxy(function(a){this.change_state(a.target);this.save_selected();this.data.cookies&&this.save_cookie("select_node");a.preventDefault()},this))},_fn:{_prepare_checkboxes:function(a){a=!a||a==-1?this.get_container():this._get_node(a);var d=a.is("li")&&a.hasClass("jstree-checked")?"jstree-checked":"jstree-unchecked";a.find("a").not(":has(.checkbox)").prepend("<ins class='checkbox'> </ins>").parent().addClass(d)},change_state:function(a,d){a=this._get_node(a);
|
||||
if(d=d===false||d===true?d:a.hasClass("jstree-checked"))a.find("li").andSelf().removeClass("jstree-checked jstree-undetermined").addClass("jstree-unchecked");else{a.find("li").andSelf().removeClass("jstree-unchecked jstree-undetermined").addClass("jstree-checked");this.data.ui.last_selected=a}var g=this;a.parentsUntil(this.get_container(),"li").each(function(){var f=c(this);if(d)if(f.children("ul").children(".jstree-checked, .jstree-undetermined").length){f.parentsUntil(g.get_container(),"li").andSelf().removeClass("jstree-checked jstree-unchecked").addClass("jstree-undetermined");
|
||||
return false}else f.removeClass("jstree-checked jstree-undetermined").addClass("jstree-unchecked");else if(f.children("ul").children(".jstree-unchecked, .jstree-undetermined").length){f.parentsUntil(g.get_container(),"li").andSelf().removeClass("jstree-checked jstree-unchecked").addClass("jstree-undetermined");return false}else f.removeClass("jstree-unchecked jstree-undetermined").addClass("jstree-checked")});this.data.ui.selected=this.get_checked();this.__callback(a)},check_node:function(a){this.change_state(a,
|
||||
false)},uncheck_node:function(a){this.change_state(a,true)},check_all:function(){var a=this;this.get_container().children("ul").children("li").each(function(){a.check_node(this,false)})},uncheck_all:function(){var a=this;this.get_container().children("ul").children("li").each(function(){a.change_state(this,true)})},is_checked:function(a){a=this._get_node(a);return a.length?a.is(".jstree-checked"):false},get_checked:function(a){a=!a||a===-1?this.get_container():this._get_node(a);return a.find("> ul > .jstree-checked, .jstree-undetermined > ul > .jstree-checked")},
|
||||
get_unchecked:function(a){a=!a||a===-1?this.get_container():this._get_node(a);return a.find("> ul > .jstree-unchecked, .jstree-undetermined > ul > .jstree-unchecked")},show_checkboxes:function(){this.get_container().children("ul").removeClass("jstree-no-checkboxes")},hide_checkboxes:function(){this.get_container().children("ul").addClass("jstree-no-checkboxes")},_repair_state:function(a){a=this._get_node(a);if(a.length){var d=a.find("> ul > .jstree-checked").length,g=a.find("> ul > .jstree-undetermined").length,
|
||||
f=a.find("> ul > li").length;if(f===0)a.hasClass("jstree-undetermined")&&this.check_node(a);else if(d===0&&g===0)this.uncheck_node(a);else d===f?this.check_node(a):a.parentsUntil(this.get_container(),"li").andSelf().removeClass("jstree-checked jstree-unchecked").addClass("jstree-undetermined")}},reselect:function(){var a=this,d=this.data.ui.to_select;d=c.map(c.makeArray(d),function(g){return"#"+g.toString().replace(/^#/,"").replace("\\/","/").replace("/","\\/")});this.deselect_all();c.each(d,function(g,
|
||||
f){a.check_node(f)});this.__callback()}}})})(jQuery);
|
||||
(function(c){c.vakata.xslt=function(d,g){var f="",b,e;if(document.recalc){b=document.createElement("xml");e=document.createElement("xml");b.innerHTML=d;e.innerHTML=g;c("body").append(b).append(e);f=b.transformNode(e.XMLDocument);c("body").remove(b).remove(e);return f}if(typeof window.DOMParser!=="undefined"&&typeof window.XMLHttpRequest!=="undefined"&&typeof window.XSLTProcessor!=="undefined"){b=new XSLTProcessor;f=c.isFunction(b.transformDocument)?typeof window.XMLSerializer!=="undefined":true;if(!f)return false;
|
||||
d=(new DOMParser).parseFromString(d,"text/xml");g=(new DOMParser).parseFromString(g,"text/xml");if(c.isFunction(b.transformDocument)){f=document.implementation.createDocument("","",null);b.transformDocument(d,g,f,null);return(new XMLSerializer).serializeToString(f)}else{b.importStylesheet(g);f=b.transformToFragment(d,document);return c("<div>").append(f).html()}}return false};var a={nest:'<?xml version="1.0" encoding="utf-8" ?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" ><xsl:output method="html" encoding="utf-8" omit-xml-declaration="yes" standalone="no" indent="no" media-type="text/html" /><xsl:template match="/">\t<xsl:call-template name="nodes">\t\t<xsl:with-param name="node" select="/root" />\t</xsl:call-template></xsl:template><xsl:template name="nodes">\t<xsl:param name="node" />\t<ul>\t<xsl:for-each select="$node/item">\t\t<xsl:variable name="children" select="count(./item) > 0" />\t\t<li>\t\t\t<xsl:attribute name="class">\t\t\t\t<xsl:if test="position() = last()">jstree-last </xsl:if>\t\t\t\t<xsl:choose>\t\t\t\t\t<xsl:when test="@state = \'open\'">jstree-open </xsl:when>\t\t\t\t\t<xsl:when test="$children or @hasChildren or @state = \'closed\'">jstree-closed </xsl:when>\t\t\t\t\t<xsl:otherwise>jstree-leaf </xsl:otherwise>\t\t\t\t</xsl:choose>\t\t\t\t<xsl:value-of select="@class" />\t\t\t</xsl:attribute>\t\t\t<xsl:for-each select="@*">\t\t\t\t<xsl:if test="name() != \'class\' and name() != \'state\' and name() != \'hasChildren\'">\t\t\t\t\t<xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute>\t\t\t\t</xsl:if>\t\t\t</xsl:for-each>\t<ins class="jstree-icon"><xsl:text> </xsl:text></ins>\t\t\t<xsl:for-each select="content/name">\t\t\t\t<a>\t\t\t\t<xsl:attribute name="href">\t\t\t\t\t<xsl:choose>\t\t\t\t\t<xsl:when test="@href"><xsl:value-of select="@href" /></xsl:when>\t\t\t\t\t<xsl:otherwise>#</xsl:otherwise>\t\t\t\t\t</xsl:choose>\t\t\t\t</xsl:attribute>\t\t\t\t<xsl:attribute name="class"><xsl:value-of select="@lang" /> <xsl:value-of select="@class" /></xsl:attribute>\t\t\t\t<xsl:attribute name="style"><xsl:value-of select="@style" /></xsl:attribute>\t\t\t\t<xsl:for-each select="@*">\t\t\t\t\t<xsl:if test="name() != \'style\' and name() != \'class\' and name() != \'href\'">\t\t\t\t\t\t<xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute>\t\t\t\t\t</xsl:if>\t\t\t\t</xsl:for-each>\t\t\t\t\t<ins>\t\t\t\t\t\t<xsl:attribute name="class">jstree-icon \t\t\t\t\t\t\t<xsl:if test="string-length(attribute::icon) > 0 and not(contains(@icon,\'/\'))"><xsl:value-of select="@icon" /></xsl:if>\t\t\t\t\t\t</xsl:attribute>\t\t\t\t\t\t<xsl:if test="string-length(attribute::icon) > 0 and contains(@icon,\'/\')"><xsl:attribute name="style">background:url(<xsl:value-of select="@icon" />) center center no-repeat;</xsl:attribute></xsl:if>\t\t\t\t\t\t<xsl:text> </xsl:text>\t\t\t\t\t</ins>\t\t\t\t\t<xsl:value-of select="current()" />\t\t\t\t</a>\t\t\t</xsl:for-each>\t\t\t<xsl:if test="$children or @hasChildren"><xsl:call-template name="nodes"><xsl:with-param name="node" select="current()" /></xsl:call-template></xsl:if>\t\t</li>\t</xsl:for-each>\t</ul></xsl:template></xsl:stylesheet>',
|
||||
flat:'<?xml version="1.0" encoding="utf-8" ?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" ><xsl:output method="html" encoding="utf-8" omit-xml-declaration="yes" standalone="no" indent="no" media-type="text/xml" /><xsl:template match="/">\t<ul>\t<xsl:for-each select="//item[not(@parent_id) or @parent_id=0]">\t\t<xsl:call-template name="nodes">\t\t\t<xsl:with-param name="node" select="." />\t\t\t<xsl:with-param name="is_last" select="number(position() = last())" />\t\t</xsl:call-template>\t</xsl:for-each>\t</ul></xsl:template><xsl:template name="nodes">\t<xsl:param name="node" />\t<xsl:param name="is_last" />\t<xsl:variable name="children" select="count(//item[@parent_id=$node/attribute::id]) > 0" />\t<li>\t<xsl:attribute name="class">\t\t<xsl:if test="$is_last = true()">jstree-last </xsl:if>\t\t<xsl:choose>\t\t\t<xsl:when test="@state = \'open\'">jstree-open </xsl:when>\t\t\t<xsl:when test="$children or @hasChildren or @state = \'closed\'">jstree-closed </xsl:when>\t\t\t<xsl:otherwise>jstree-leaf </xsl:otherwise>\t\t</xsl:choose>\t\t<xsl:value-of select="@class" />\t</xsl:attribute>\t<xsl:for-each select="@*">\t\t<xsl:if test="name() != \'parent_id\' and name() != \'hasChildren\' and name() != \'class\' and name() != \'state\'">\t\t<xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute>\t\t</xsl:if>\t</xsl:for-each>\t<ins class="jstree-icon"><xsl:text> </xsl:text></ins>\t<xsl:for-each select="content/name">\t\t<a>\t\t<xsl:attribute name="href">\t\t\t<xsl:choose>\t\t\t<xsl:when test="@href"><xsl:value-of select="@href" /></xsl:when>\t\t\t<xsl:otherwise>#</xsl:otherwise>\t\t\t</xsl:choose>\t\t</xsl:attribute>\t\t<xsl:attribute name="class"><xsl:value-of select="@lang" /> <xsl:value-of select="@class" /></xsl:attribute>\t\t<xsl:attribute name="style"><xsl:value-of select="@style" /></xsl:attribute>\t\t<xsl:for-each select="@*">\t\t\t<xsl:if test="name() != \'style\' and name() != \'class\' and name() != \'href\'">\t\t\t\t<xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute>\t\t\t</xsl:if>\t\t</xsl:for-each>\t\t\t<ins>\t\t\t\t<xsl:attribute name="class">jstree-icon \t\t\t\t\t<xsl:if test="string-length(attribute::icon) > 0 and not(contains(@icon,\'/\'))"><xsl:value-of select="@icon" /></xsl:if>\t\t\t\t</xsl:attribute>\t\t\t\t<xsl:if test="string-length(attribute::icon) > 0 and contains(@icon,\'/\')"><xsl:attribute name="style">background:url(<xsl:value-of select="@icon" />) center center no-repeat;</xsl:attribute></xsl:if>\t\t\t\t<xsl:text> </xsl:text>\t\t\t</ins>\t\t\t<xsl:value-of select="current()" />\t\t</a>\t</xsl:for-each>\t<xsl:if test="$children">\t\t<ul>\t\t<xsl:for-each select="//item[@parent_id=$node/attribute::id]">\t\t\t<xsl:call-template name="nodes">\t\t\t\t<xsl:with-param name="node" select="." />\t\t\t\t<xsl:with-param name="is_last" select="number(position() = last())" />\t\t\t</xsl:call-template>\t\t</xsl:for-each>\t\t</ul>\t</xsl:if>\t</li></xsl:template></xsl:stylesheet>'};
|
||||
c.jstree.plugin("xml_data",{defaults:{data:false,ajax:false,xsl:"flat",clean_node:false},_fn:{load_node:function(d,g,f){var b=this;this.load_node_xml(d,function(){b.__callback({obj:d});g.call(this)},f)},_is_loaded:function(d){var g=this.get_settings().xml_data;return d==-1||!d||!g.ajax||d.is(".jstree-open, .jstree-leaf")||d.children("ul").children("li").size()>0},load_node_xml:function(d,g,f){var b=this.get_settings().xml_data,e=function(){};switch(true){case !b.data&&!b.ajax:throw"Neither data nor ajax settings supplied.";
|
||||
case !!b.data&&!b.ajax||!!b.data&&!!b.ajax&&(!d||d===-1):if(!d||d==-1){this.get_container().children("ul").empty().append(this.parse_xml(b.data).children());b.clean_node&&this.clean_node(d)}g&&g.call(this);break;case !b.data&&!!b.ajax||!!b.data&&!!b.ajax&&d&&d!==-1:d=this._get_node(d);e=function(h,k,j){var i=this.get_settings().xml_data.ajax.error;i&&i.call(this,h,k,j);if(d!==-1&&d.length){d.children(".jstree-loading").removeClass("jstree-loading");b.correct_state&&d.removeClass("jstree-open jstree-closed").addClass("jstree-leaf")}f&&
|
||||
f.call(this)};b.ajax.context=this;b.ajax.error=e;b.ajax.success=function(h,k,j){if(j.responseText=="")return e.call(this,j,k,"");h=j.responseText;var i=this.get_settings().xml_data.ajax.success;if(i)h=i.call(this,h,k,j)||h;if(h=this.parse_xml(h)){d===-1||!d?this.get_container().children("ul").empty().append(this.parse_xml(j.responseText).children()):d.append(this.parse_xml(j.responseText)).children(".jstree-loading").removeClass("jstree-loading");b.clean_node&&this.clean_node(d);g&&g.call(this)}else{d.children(".jstree-loading").removeClass("jstree-loading");
|
||||
b.correct_state&&d.removeClass("jstree-open jstree-closed").addClass("jstree-leaf")}};if(c.isFunction(b.ajax.data))b.ajax.data=b.ajax.data.call(null,d);c.ajax(b.ajax);break}},parse_xml:function(d){var g=this.get_settings().xml_data;d=c.vakata.xslt(d,a[g.xsl]);if(d!==false)d=c(d);return d},get_xml:function(d,g,f,b,e){var h="",k=this.get_settings(),j=this,i,m,l,o,n;d||(d="flat");e||(e=0);g=this._get_node(g);if(!g||g===-1)g=this.get_container().find("> ul > li");f=c.isArray(f)?f:["id","class"];this.data.types&&
|
||||
f.push(k.types.type_attr);b=c.isArray(b)?b:[];e||(h+="<root>");g.each(function(){h+="<item";l=c(this);c.each(f,function(q,p){h+=" "+p+'="'+l.attr(p).replace(/jstree[^ ]*|$/ig,"").replace(/^\s+$/ig,"")+'"'});if(l.hasClass("jstree-open"))h+=' state="open"';if(l.hasClass("jstree-closed"))h+=' state="closed"';if(d==="flat")h+=' parent_id="'+e+'"';h+=">";h+="<content>";o=l.children("a");o.each(function(){i=c(this);n=false;h+="<name";c.inArray("languages",k.plugins)!==-1&&c.each(k.languages,function(q,
|
||||
p){if(i.hasClass(p)){h+=' lang="'+p+'"';n=p;return false}});b.length&&c.each(b,function(q,p){h+=" "+p+'="'+l.attr(p).replace(/jstree[^ ]*|$/ig,"")+'"'});if(i.children("ins").get(0).className.replace(/jstree[^ ]*|$/ig,"").replace(/^\s+$/ig,"").length)h+=' icon="'+i.children("ins").get(0).className.replace(/jstree[^ ]*|$/ig,"").replace(/^\s+$/ig,"")+'"';if(i.children("ins").get(0).style.backgroundImage.length)h+=' icon="'+i.children("ins").get(0).style.backgroundImage.replace("url(","").replace(")",
|
||||
"")+'"';h+=">";h+="<![CDATA["+j.get_text(i,n)+"]]\>";h+="</name>"});h+="</content>";m=l[0].id;l=l.find("> ul > li");if(l.length)m=j.get_xml(d,l,f,b,m);if(d=="nest")h+=m;h+="</item>";if(d=="flat")h+=m});e||(h+="</root>");return h}}})})(jQuery);
|
||||
(function(c){c.expr[":"].jstree_contains=function(a,d,g){return(a.textContent||a.innerText||"").toLowerCase().indexOf(g[3].toLowerCase())>=0};c.jstree.plugin("search",{__init:function(){this.data.search.str="";this.data.search.result=c()},defaults:{ajax:false,case_insensitive:false},_fn:{search:function(a,d){var g=this.get_settings().search,f=this;this.data.search.str=a;if(!d&&g.ajax!==false&&this.get_container().find(".jstree-closed:eq(0)").length>0){this.search.supress_callback=true;g.ajax.context=
|
||||
this;g.ajax.error=function(){};g.ajax.success=function(b,e,h){var k=this.get_settings().search.ajax.success;if(k)b=k.call(this,b,e,h)||b;this.data.search.to_open=b;this._search_open()};if(c.isFunction(g.ajax.data))g.ajax.data=g.ajax.data.call(this,a);if(!g.ajax.data)g.ajax.data={search_string:a};if(!g.ajax.dataType||/^json/.exec(g.ajax.dataType))g.ajax.dataType="json";c.ajax(g.ajax)}else{this.data.search.result.length&&this.clear_search();this.data.search.result=this.get_container().find("a"+(this.data.languages?
|
||||
"."+this.get_lang():"")+":"+(g.case_insensitive?"jstree_contains":"contains")+"("+this.data.search.str+")");this.data.search.result.addClass("jstree-search").parents(".jstree-closed").each(function(){f.open_node(this,false,true)});this.__callback({nodes:this.data.search.result,str:a})}},clear_search:function(){this.data.search.result.removeClass("jstree-search");this.__callback(this.data.search.result);this.data.search.result=c()},_search_open:function(){var a=this,d=true,g=[],f=[];if(this.data.search.to_open.length){c.each(this.data.search.to_open,
|
||||
function(b,e){if(e=="#")return true;c(e).length&&c(e).is(".jstree-closed")?g.push(e):f.push(e)});if(g.length){this.data.search.to_open=f;c.each(g,function(b,e){a.open_node(e,function(){a._search_open(true)})});d=false}}d&&this.search(this.data.search.str,true)}}})})(jQuery);
|
||||
(function(c){c.vakata.context={cnt:c("<div id='vakata-contextmenu'>"),vis:false,tgt:false,func:false,data:false,show:function(a,d,g,f,b){if(a=c.vakata.context.parse(a)){c.vakata.context.vis=true;c.vakata.context.tgt=d;c.vakata.context.data=b||null;c.vakata.context.cnt.html(a).css({visibility:"hidden",display:"block",left:0,top:0});b=c.vakata.context.cnt.height();a=c.vakata.context.cnt.width();if(g+a>c(document).width()){g=c(document).width()-(a+5);c.vakata.context.cnt.find("li > ul").addClass("right")}if(f+
|
||||
b>c(document).height()){f-=b+d[0].offsetHeight;c.vakata.context.cnt.find("li > ul").addClass("bottom")}c.vakata.context.cnt.css({left:g,top:f}).find("li:has(ul)").bind("mouseenter",function(){var e=c(document).width(),h=c(document).height(),k=c(this).children("ul").show();e!==c(document).width()&&k.toggleClass("right");h!==c(document).height()&&k.toggleClass("bottom")}).bind("mouseleave",function(){c(this).children("ul").hide()}).end().css({visibility:"visible"}).show();c(document).triggerHandler("vakata.context_show")}},
|
||||
hide:function(){c.vakata.context.vis=false;c.vakata.context.cnt.attr("class","").hide();c(document).triggerHandler("vakata.context_hide")},parse:function(a,d){var g="",f=false;if(!d)c.vakata.context.func={};g+="<ul>";c.each(a,function(b,e){if(!e)return true;c.vakata.context.func[b]=e.action;if(e.separator_before)g+="<li class='vakata-separator vakata-separator-before'></li>";g+="<li><ins ";if(e.icon&&e.icon.indexOf("/")===-1)g+=" class='"+e.icon+"' ";if(e.icon&&e.icon.indexOf("/")!==-1)g+=" style='background:url("+
|
||||
e.icon+") center center no-repeat;' ";g+="> </ins><a href='#' rel='"+b+"'>"+e.label;if(e.submenu)g+="<span style='float:right;'>»</span>";g+="</a>";if(e.submenu)if(f=c.vakata.context.parse(e.submenu,true))g+=f;g+="</li>";if(e.separator_after)g+="<li class='vakata-separator vakata-separator-after'></li>"});g+="</ul>";return g.length>10?g:false},exec:function(a){if(c.isFunction(c.vakata.context.func[a])){c.vakata.context.func[a].call(c.vakata.context.data,c.vakata.context.tgt);return true}else return false}};
|
||||
c(function(){c.vakata.css.add_sheet({str:"#vakata-contextmenu { display:none; position:absolute; margin:0; padding:0; min-width:180px; background:#ebebeb; border:1px solid silver; } #vakata-contextmenu ul { min-width:180px; } #vakata-contextmenu ul, #vakata-contextmenu li { margin:0; padding:0; list-style-type:none; display:block; } #vakata-contextmenu li { line-height:20px; min-height:20px; position:relative; padding:0px; } #vakata-contextmenu li a { padding:1px 6px; line-height:17px; display:block; text-decoration:none; margin:1px 1px 0 1px; } #vakata-contextmenu li ins { float:left; width:16px; height:16px; text-decoration:none; margin-right:2px; } #vakata-contextmenu li a:hover, #vakata-contextmenu li.vakata-hover > a { background:gray; color:white; } #vakata-contextmenu li ul { display:none; position:absolute; top:-2px; left:100%; background:#ebebeb; border:1px solid gray; } #vakata-contextmenu .right { right:100%; left:auto; } #vakata-contextmenu .bottom { bottom:-1px; top:auto; } #vakata-contextmenu li.vakata-separator { min-height:0; height:1px; line-height:1px; font-size:1px; overflow:hidden; margin:0 2px; background:silver; /* border-top:1px solid #fefefe; */ padding:0; } "});
|
||||
c.vakata.context.cnt.delegate("a","click",function(a){a.preventDefault()}).delegate("a","mouseup",function(){c.vakata.context.exec(c(this).attr("rel"))&&c.vakata.context.hide()}).delegate("a","mouseover",function(){c.vakata.context.cnt.find(".vakata-hover").removeClass("vakata-hover")}).appendTo("body");c(document).bind("mousedown",function(a){c.vakata.context.vis&&!c.contains(c.vakata.context.cnt[0],a.target)&&c.vakata.context.hide()});typeof c.hotkeys!=="undefined"&&c(document).bind("keydown","up",
|
||||
function(a){if(c.vakata.context.vis){var d=c.vakata.context.cnt.find("ul:visible").last().children(".vakata-hover").removeClass("vakata-hover").prevAll("li:not(.vakata-separator)").first();d.length||(d=c.vakata.context.cnt.find("ul:visible").last().children("li:not(.vakata-separator)").last());d.addClass("vakata-hover");a.stopImmediatePropagation();a.preventDefault()}}).bind("keydown","down",function(a){if(c.vakata.context.vis){var d=c.vakata.context.cnt.find("ul:visible").last().children(".vakata-hover").removeClass("vakata-hover").nextAll("li:not(.vakata-separator)").first();
|
||||
d.length||(d=c.vakata.context.cnt.find("ul:visible").last().children("li:not(.vakata-separator)").first());d.addClass("vakata-hover");a.stopImmediatePropagation();a.preventDefault()}}).bind("keydown","right",function(a){if(c.vakata.context.vis){c.vakata.context.cnt.find(".vakata-hover").children("ul").show().children("li:not(.vakata-separator)").removeClass("vakata-hover").first().addClass("vakata-hover");a.stopImmediatePropagation();a.preventDefault()}}).bind("keydown","left",function(a){if(c.vakata.context.vis){c.vakata.context.cnt.find(".vakata-hover").children("ul").hide().children(".vakata-separator").removeClass("vakata-hover");
|
||||
a.stopImmediatePropagation();a.preventDefault()}}).bind("keydown","esc",function(a){c.vakata.context.hide();a.preventDefault()}).bind("keydown","space",function(a){c.vakata.context.cnt.find(".vakata-hover").last().children("a").click();a.preventDefault()})});c.jstree.plugin("contextmenu",{__init:function(){this.get_container().delegate("a","contextmenu.jstree",c.proxy(function(a){a.preventDefault();this.show_contextmenu(a.currentTarget,a.pageX,a.pageY)},this))},defaults:{show_at_node:true,items:{create:{separator_before:false,
|
||||
separator_after:true,label:"Create",action:function(a){this.create(a)}},rename:{separator_before:false,separator_after:false,label:"Rename",action:function(a){this.rename(a)}},remove:{separator_before:false,icon:false,separator_after:false,label:"Delete",action:function(a){this.remove(a)}},ccp:{separator_before:true,icon:false,separator_after:false,label:"Edit",action:function(a){this.remove(a)},submenu:{cut:{separator_before:false,separator_after:false,label:"Cut",action:function(a){this.cut(a)}},
|
||||
copy:{separator_before:false,icon:false,separator_after:false,label:"Copy",action:function(a){this.copy(a)}},paste:{separator_before:false,icon:false,separator_after:false,label:"Paste",action:function(a){this.paste(a)}}}}}},_fn:{show_contextmenu:function(a,d,g){a=this._get_node(a);var f=this.get_settings().contextmenu,b=a.children("a:visible:eq(0)"),e=false;if(f.show_at_node||typeof d==="undefined"||typeof g==="undefined"){e=b.offset();d=e.left;g=e.top+this.data.core.li_height}if(c.isFunction(f.items))f.items=
|
||||
f.items.call(this,a);c.vakata.context.show(f.items,b,d,g,this);this.data.themes&&c.vakata.context.cnt.attr("class","jstree-"+this.data.themes.theme+"-context")}}})})(jQuery);
|
||||
(function(c){c.jstree.plugin("types",{__init:function(){var a=this.get_settings().types;this.data.types.attach_to=[];this.get_container().bind("init.jstree",c.proxy(function(){var d=a.type_attr,g="",f=this;c.each(a.types,function(b,e){c.each(e,function(h){/^(max_depth|max_children|icon|valid_children)$/.test(h)||f.data.types.attach_to.push(h)});if(!e.icon)return true;if(e.icon.image||e.icon.position){g+=b=="default"?".jstree-"+f.get_index()+" a > .jstree-icon { ":".jstree-"+f.get_index()+" li["+d+
|
||||
"="+b+"] > a > .jstree-icon { ";if(e.icon.image)g+=" background-image:url("+e.icon.image+"); ";g+=e.icon.position?" background-position:"+e.icon.position+"; ":" background-position:0 0; ";g+="} "}});g!=""&&c.vakata.css.add_sheet({str:g})},this)).bind("before.jstree",c.proxy(function(d,g){if(c.inArray(g.func,this.data.types.attach_to)!==-1){var f=this.get_settings().types.types,b=this._get_type(g.args[0]);if(f[b]&&typeof f[b][g.func]!=="undefined"&&!this._check(g.func,g.args[0])){d.stopImmediatePropagation();
|
||||
return false}}},this))},defaults:{max_children:-1,max_depth:-1,valid_children:"all",type_attr:"rel",types:{"default":{max_children:-1,max_depth:-1,valid_children:"all"}}},_fn:{_get_type:function(a){a=this._get_node(a);return!a||!a.length?false:a.attr(this.get_settings().types.type_attr)||"default"},set_type:function(a,d){d=this._get_node(d);return!d.length||!a?false:d.attr(this.get_settings().types.type_attr,a)},_check:function(a,d,g){var f=false,b=this._get_type(d),e=0,h=this,k=this.get_settings().types;
|
||||
if(d===-1)if(k[a])f=k[a];else return;else{if(b===false)return;if(k.types[b]&&k.types[b][a])f=k.types[b][a];else if(k.types["default"]&&k.types["default"][a])f=k.types["default"][a]}if(c.isFunction(f))f=f.call(this,d);a==="max_depth"&&d!==-1&&g!==false&&k.max_depth!==-2&&f!==0&&this._get_node(d).parentsUntil(this.get_container(),"li").each(function(j){e=h._check(a,this,false);if(e!==-1&&e-(j+1)<=0){f=0;return false}if(e>=0&&(e-(j+1)<f||f<0))f=e-(j+1)});return f},check_move:function(){if(!this.__call_old())return false;
|
||||
var a=this._get_move(),d=a.rt.get_settings().types,g=a.rt._check("max_children",a.cr),f=a.rt._check("max_depth",a.cr),b=a.rt._check("valid_children",a.cr),e=0,h=1;if(b==="none")return false;if(c.isArray(b)&&a.ot&&a.ot._get_type){a.o.each(function(){if(c.inArray(a.ot._get_type(this),b)===-1)return h=false});if(h===false)return false}if(d.max_children!==-2&&g!==-1){e=a.cr===-1?this.get_container().children("> ul > li").not(a.o).length:a.cr.children("> ul > li").not(a.o).length;if(e+a.o.length>g)return false}if(d.max_depth!==
|
||||
-2&&f!==-1){h=0;if(f===0)return false;if(typeof a.o.d==="undefined"){for(d=a.o;d.length>0;){d=d.find("> ul > li");h++}a.o.d=h}if(f-a.o.d<0)return false}return true},create_node:function(a,d,g,f,b,e){if(!e&&(b||this._is_loaded(a))){var h=d&&d.match(/^before|after$/i)?this._get_parent(a):this._get_node(a),k=this.get_settings().types,j=this._check("max_children",h),i=this._check("max_depth",h),m=this._check("valid_children",h);g||(g={});if(m==="none")return false;if(c.isArray(m))if(!g.attr||!g.attr[k.type_attr]){if(!g.attr)g.attr=
|
||||
{};g.attr[k.type_attr]=m[0]}else if(c.inArray(g.attr[k.type_attr],m)===-1)return false;if(k.max_children!==-2&&j!==-1){h=h===-1?this.get_container().children("> ul > li").length:h.children("> ul > li").length;if(h+1>j)return false}if(k.max_depth!==-2&&i!==-1&&i-1<=0)return false}return this.__call_old(true,a,d,g,f,b,e)}}})})(jQuery);
|
48
application/media/js/jquery.stickyfloat-1.0.js
Normal file
@ -0,0 +1,48 @@
|
||||
/*
|
||||
* stickyfloat - jQuery plugin for verticaly floating anything in a constrained area
|
||||
*
|
||||
* Example: jQuery('#menu').stickyfloat({duration: 400});
|
||||
* parameters:
|
||||
* duration - the duration of the animation
|
||||
* startOffset - the amount of scroll offset after it the animations kicks in
|
||||
* offsetY - the offset from the top when the object is animated
|
||||
* lockBottom - 'true' by default, set to false if you don't want your floating box to stop at parent's bottom
|
||||
* $Version: 05.16.2009 r1
|
||||
* Copyright (c) 2009 Yair Even-Or
|
||||
* vsync.design@gmail.com
|
||||
*/
|
||||
|
||||
$.fn.stickyfloat = function(options, lockBottom) {
|
||||
var $obj = this;
|
||||
var parentPaddingTop = parseInt($obj.parent().css('padding-top'));
|
||||
var startOffset = $obj.parent().offset().top;
|
||||
var opts = $.extend({ startOffset: startOffset, offsetY: parentPaddingTop, duration: 200, lockBottom:true }, options);
|
||||
|
||||
$obj.css({ position: 'absolute' });
|
||||
|
||||
if(opts.lockBottom){
|
||||
var bottomPos = $obj.parent().height() - $obj.height() + parentPaddingTop; //get the maximum scrollTop value
|
||||
if( bottomPos < 0 )
|
||||
bottomPos = 0;
|
||||
}
|
||||
|
||||
$(window).scroll(function () {
|
||||
$obj.stop(); // stop all calculations on scroll event
|
||||
|
||||
var pastStartOffset = $(document).scrollTop() > opts.startOffset; // check if the window was scrolled down more than the start offset declared.
|
||||
var objFartherThanTopPos = $obj.offset().top > startOffset; // check if the object is at it's top position (starting point)
|
||||
var objBiggerThanWindow = $obj.outerHeight() < $(window).height(); // if the window size is smaller than the Obj size, then do not animate.
|
||||
|
||||
// if window scrolled down more than startOffset OR obj position is greater than
|
||||
// the top position possible (+ offsetY) AND window size must be bigger than Obj size
|
||||
if( (pastStartOffset || objFartherThanTopPos) && objBiggerThanWindow ){
|
||||
var newpos = ($(document).scrollTop() -startOffset + opts.offsetY );
|
||||
if ( newpos > bottomPos )
|
||||
newpos = bottomPos;
|
||||
if ( $(document).scrollTop() < opts.startOffset ) // if window scrolled < starting offset, then reset Obj position (opts.offsetY);
|
||||
newpos = parentPaddingTop;
|
||||
|
||||
$obj.animate({ top: newpos }, opts.duration );
|
||||
}
|
||||
});
|
||||
};
|
BIN
application/media/js/themes/default/dot_for_ie.gif
Normal file
After Width: | Height: | Size: 43 B |
2
application/messages/.htaccess
Normal file
@ -0,0 +1,2 @@
|
||||
order allow,deny
|
||||
deny from all
|
2
application/views/.htaccess
Normal file
@ -0,0 +1,2 @@
|
||||
order allow,deny
|
||||
deny from all
|
93
application/views/lnapp/default.php
Normal file
@ -0,0 +1,93 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<!-- Default Template Layout for lnApp -->
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="auto" lang="auto">
|
||||
<head>
|
||||
<title><?php echo $meta->title; ?></title>
|
||||
<link rel="shortcut icon" href="<?php echo $meta->shortcut_icon ? $meta->shortcut_icon : '#'; ?>" type="image/vnd.microsoft.icon" />
|
||||
<meta http-equiv="Content-type" content="text/html; charset=UTF-8" />
|
||||
<meta http-equiv="Content-Language" content="<?php echo $meta->language; ?>" />
|
||||
<meta name="keywords" content="<?php echo $meta->keywords; ?>" />
|
||||
<meta name="description" content="<?php echo $meta->description; ?>" />
|
||||
<meta name="copyright" content="<?php echo $meta->copywrite; ?>" />
|
||||
<?php echo $meta->styles; ?>
|
||||
<?php echo $meta->scripts; ?>
|
||||
</head>
|
||||
<body>
|
||||
<table class="page">
|
||||
<tr class="pagehead">
|
||||
<td colspan="3">
|
||||
<div id="ajHEAD">
|
||||
<table class="pagehead">
|
||||
<tr>
|
||||
<td class="headlogo">
|
||||
<a href="<?php echo URL::site(); ?>" class="headlogo"><?php echo $logo;?></a>
|
||||
</td>
|
||||
<td class="headtitle"><?php echo $title; ?></td>
|
||||
<td class="headimages"><?php echo $headimages; ?></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="pagecontrol">
|
||||
<td colspan="3">
|
||||
<div id="ajCONTROL">
|
||||
<table class="pagecontrol">
|
||||
<tr>
|
||||
<td class="none"><?php echo $control; ?></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="pagemain">
|
||||
<!-- Left Pane -->
|
||||
<td class="pageleft" <?php echo $left ? '' : 'style="display: none;"'?>>
|
||||
<div id="ajLEFT">
|
||||
<table class="pageleft" width="100%">
|
||||
<tr>
|
||||
<td><?php echo $left; ?></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</td>
|
||||
<!-- Main Body Pane -->
|
||||
<td class="pagebody">
|
||||
<div id="ajBODY">
|
||||
<?php if ((string)$sysmsg) {?>
|
||||
<table class="sysmsg">
|
||||
<tr>
|
||||
<td><?php echo $sysmsg; ?></td>
|
||||
</tr>
|
||||
</table>
|
||||
<?php }?>
|
||||
<table class="content">
|
||||
<tr>
|
||||
<td><?php echo $content; ?></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</td>
|
||||
<!-- Right Pane -->
|
||||
<td class="pageright" <?php echo trim($right) ? '' : 'style="display: none;"'?>>
|
||||
<div id="ajRIGHT">
|
||||
<table class="pageright" width="100%">
|
||||
<tr>
|
||||
<td><?php echo $right; ?></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="pagefoot">
|
||||
<td colspan="3">
|
||||
<div id="ajFOOT"><?php echo $footer; ?></div>
|
||||
<?php if (Config::sitemode() == Kohana::DEVELOPMENT) { ?>
|
||||
<div id="kohana-profiler" style="display: none;"><?php echo View::factory('profiler/stats'); ?></div>
|
||||
<script type="text/javascript">$("#ajFOOT").click(function() {$('#kohana-profiler').toggle();});</script>
|
||||
<?php }?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
15
application/views/login.php
Normal file
@ -0,0 +1,15 @@
|
||||
<br/>
|
||||
<?php echo Form::open(); ?>
|
||||
<table class="login">
|
||||
<tr><td><b>User Name:</b></td></tr>
|
||||
<tr><td><?php echo Form::input('username',null,array('id'=>'login-uid','size'=>40));?></td></tr>
|
||||
<tr><td colspan="2"> </td></tr>
|
||||
<tr><td><b>Password:</b></td></tr>
|
||||
<tr><td><?php echo Form::password('password',null,array('id'=>'login-pwd','size'=>40));?></td></tr>
|
||||
<tr><td colspan="2"> </td></tr>
|
||||
<tr><td colspan="2"><?echo HTML::anchor('login/reset',_('Forgot your password?')); ?></td></tr>
|
||||
<tr><td colspan="2" style="text-align: center;"><?php echo Form::submit('submit',_('Authenticate'));?></td></tr>
|
||||
</table>
|
||||
<?php echo Form::close(); ?>
|
||||
<!-- @todo The following focus() is not ajax/jscript friendly -->
|
||||
<script type="text/javascript">document.getElementById('login-uid').focus();</script>
|
14
application/views/login_reset.php
Normal file
@ -0,0 +1,14 @@
|
||||
<div style="text-align: center;">
|
||||
<p>If you have forgotten your password, we can issue you a temporary access code via email that will allow you to change your password.</p>
|
||||
<p>To start this process, please enter your email address.</p>
|
||||
</div>
|
||||
|
||||
<?php echo Form::open(); ?>
|
||||
<table class="login">
|
||||
<tr><td><b>Email Address</b></td></tr>
|
||||
<tr><td><?php echo Form::input('email',null,array('id'=>'login-uid','size'=>40));?></td></tr>
|
||||
<tr><td colspan="2" style="text-align: center;"><?php echo Form::submit('submit',_('Reset'));?></td></tr>
|
||||
</table>
|
||||
<?php echo Form::close(); ?>
|
||||
<!-- @todo The following focus() is not ajax/jscript friendly -->
|
||||
<script type="text/javascript">document.getElementById('login-uid').focus();</script>
|
13
application/views/login_reset_sent.php
Normal file
@ -0,0 +1,13 @@
|
||||
<div style="text-align: center;">
|
||||
<p>You should have received an email with a pass code. Please enter that pass code here.</p>
|
||||
</div>
|
||||
|
||||
<?php echo Form::open(); ?>
|
||||
<table class="login">
|
||||
<tr><td><b>Pass code</b></td></tr>
|
||||
<tr><td><?php echo Form::input('token',null,array('id'=>'login-pwd','size'=>40));?></td></tr>
|
||||
<tr><td colspan="2" style="text-align: center;"><?php echo Form::submit('submit',_('Reset'));?></td></tr>
|
||||
</table>
|
||||
<?php echo Form::close(); ?>
|
||||
<!-- @todo The following focus() is not ajax/jscript friendly -->
|
||||
<script type="text/javascript">document.getElementById('login-pwd').focus();</script>
|
1
application/views/template.php
Normal file
@ -0,0 +1 @@
|
||||
<!-- This template is shown via CLI tasks -->
|
@ -1,3 +1,71 @@
|
||||
<!--
|
||||
# this file must be writable by php to proceed with installation
|
||||
-->
|
||||
<?php
|
||||
# Main path settings, iclude trailing slashes!
|
||||
define ('PATH_AGILE', '/afs/local/home/gh/.web/au.net.graytech.www/osb/');
|
||||
|
||||
# Base site for cookies, example: '.domain.com'
|
||||
define ('AGILE_COOKIE', '');
|
||||
|
||||
# Enable multiple simultaneous sessions for a single user
|
||||
define ('ALLOW_MULTI_LOGIN', false);
|
||||
|
||||
# Database settings
|
||||
define ('AGILE_DB_LIMIT', '25');
|
||||
define ('AGILE_DB_TYPE', 'mysql');
|
||||
define ('AGILE_DB_HOST', 'mysql.leenooks.vpn');
|
||||
define ('AGILE_DB_DATABASE', 'webghosb');
|
||||
define ('AGILE_DB_USERNAME', 'gh-webbill');
|
||||
define ('AGILE_DB_PASSWORD', 'ws0593');
|
||||
define ('AGILE_DB_PREFIX', 'ab_');
|
||||
define ('AGILE_DB_PORT', '');
|
||||
define ('AGILE_DB_PCONNECT', false);
|
||||
|
||||
# No need to change anything after this line!
|
||||
switch ($_SERVER['SERVER_NAME']) {
|
||||
case 'demo.osbill.net':
|
||||
define ('DEFAULT_SITE', '3');
|
||||
break;
|
||||
|
||||
default:
|
||||
define ('DEFAULT_SITE', '1');
|
||||
define ('SITE_TAXID', 'ABN: 49 106 229 476');
|
||||
break;
|
||||
}
|
||||
|
||||
define ('DEFAULT_PAGE', '');
|
||||
define ('DEF_THEME_N', 'default');
|
||||
define ('DEF_LANGUAGE', 'auto');
|
||||
define ('PATH_CORE', PATH_AGILE.'modules/core/');
|
||||
define ('PATH_MODULES', PATH_AGILE.'modules/');
|
||||
define ('PATH_LANGUAGE', PATH_AGILE.'language/');
|
||||
define ('PATH_THEMES', PATH_AGILE.'themes/');
|
||||
define ('PATH_PLUGINS', PATH_AGILE.'plugins/');
|
||||
define ('PATH_INCLUDES', PATH_AGILE.'includes/');
|
||||
define ('AGILE_PDF_INVOICE_PATH',PATH_AGILE.'includes/files/');
|
||||
define ('PATH_FILES', PATH_AGILE.'includes/files/');
|
||||
define ('PATH_IMAGES', PATH_AGILE.'includes/images/');
|
||||
define ('URL_IMAGES', 'includes/images/');
|
||||
define ('PATH_ADODB', PATH_AGILE.'includes/adodb/');
|
||||
$ADODB_CACHE_DIR = PATH_ADODB.'cache';
|
||||
define ('PATH_SMARTY', PATH_AGILE.'includes/smarty/');
|
||||
define ('PATH_GRAPH', PATH_AGILE.'includes/jpgraph/');
|
||||
//define('SMARTY_DIR', PATH_SMARTY);
|
||||
|
||||
if (isset($REMOTE_ADDR)) define('USER_IP',$REMOTE_ADDR);
|
||||
elseif (isset($REMOTE_HOST)) define('USER_IP',$REMOTE_HOST);
|
||||
elseif (getenv('HTTP_X_FORWARDED_FOR')) define('USER_IP',getenv('HTTP_X_FORWARDED_FOR'));
|
||||
else define('USER_IP',getenv('REMOTE_ADDR'));
|
||||
|
||||
if (!extension_loaded('gd')) define('GD',false);
|
||||
else define('GD',true);
|
||||
|
||||
$_PAGE_SHORTCUTS = array( array('s' => '_news', 'p' => 'newsletter:newsletter'),
|
||||
array('s' => '_affiliate','p' => 'affiliate:affiliate'),
|
||||
array('s' => '_contact', 'p' => 'staff:staff'),
|
||||
array('s' => '_account', 'p' => 'account:account'),
|
||||
array('s' => '_products', 'p' => 'product:cat'),
|
||||
array('s' => '_product', 'p' => 'product:details'),
|
||||
array('s' => '_cart', 'p' => 'cart:cart'),
|
||||
array('s' => '_checkout', 'p' => 'checkout:checkout'),
|
||||
array('s' => '_static', 'p' => 'static_page:show')
|
||||
);
|
||||
?>
|
||||
|
@ -0,0 +1,975 @@
|
||||
<?php
|
||||
/*******************************************************************************
|
||||
Version: 1.11 ($Rev: 175 $)
|
||||
Website: http://sourceforge.net/projects/simplehtmldom/
|
||||
Author: S.C. Chen <me578022@gmail.com>
|
||||
Acknowledge: Jose Solorzano (https://sourceforge.net/projects/php-html/)
|
||||
Contributions by:
|
||||
Yousuke Kumakura (Attribute filters)
|
||||
Vadim Voituk (Negative indexes supports of "find" method)
|
||||
Antcs (Constructor with automatically load contents either text or file/url)
|
||||
Licensed under The MIT License
|
||||
Redistributions of files must retain the above copyright notice.
|
||||
*******************************************************************************/
|
||||
|
||||
define('HDOM_TYPE_ELEMENT', 1);
|
||||
define('HDOM_TYPE_COMMENT', 2);
|
||||
define('HDOM_TYPE_TEXT', 3);
|
||||
define('HDOM_TYPE_ENDTAG', 4);
|
||||
define('HDOM_TYPE_ROOT', 5);
|
||||
define('HDOM_TYPE_UNKNOWN', 6);
|
||||
define('HDOM_QUOTE_DOUBLE', 0);
|
||||
define('HDOM_QUOTE_SINGLE', 1);
|
||||
define('HDOM_QUOTE_NO', 3);
|
||||
define('HDOM_INFO_BEGIN', 0);
|
||||
define('HDOM_INFO_END', 1);
|
||||
define('HDOM_INFO_QUOTE', 2);
|
||||
define('HDOM_INFO_SPACE', 3);
|
||||
define('HDOM_INFO_TEXT', 4);
|
||||
define('HDOM_INFO_INNER', 5);
|
||||
define('HDOM_INFO_OUTER', 6);
|
||||
define('HDOM_INFO_ENDSPACE',7);
|
||||
|
||||
// helper functions
|
||||
// -----------------------------------------------------------------------------
|
||||
// get html dom form file
|
||||
function file_get_html() {
|
||||
$dom = new simple_html_dom;
|
||||
$args = func_get_args();
|
||||
$dom->load(call_user_func_array('file_get_contents', $args), true);
|
||||
return $dom;
|
||||
}
|
||||
|
||||
// get html dom form string
|
||||
function str_get_html($str, $lowercase=true) {
|
||||
$dom = new simple_html_dom;
|
||||
$dom->load($str, $lowercase);
|
||||
return $dom;
|
||||
}
|
||||
|
||||
// dump html dom tree
|
||||
function dump_html_tree($node, $show_attr=true, $deep=0) {
|
||||
$lead = str_repeat(' ', $deep);
|
||||
echo $lead.$node->tag;
|
||||
if ($show_attr && count($node->attr)>0) {
|
||||
echo '(';
|
||||
foreach($node->attr as $k=>$v)
|
||||
echo "[$k]=>\"".$node->$k.'", ';
|
||||
echo ')';
|
||||
}
|
||||
echo "\n";
|
||||
|
||||
foreach($node->nodes as $c)
|
||||
dump_html_tree($c, $show_attr, $deep+1);
|
||||
}
|
||||
|
||||
// get dom form file (deprecated)
|
||||
function file_get_dom() {
|
||||
$dom = new simple_html_dom;
|
||||
$args = func_get_args();
|
||||
$dom->load(call_user_func_array('file_get_contents', $args), true);
|
||||
return $dom;
|
||||
}
|
||||
|
||||
// get dom form string (deprecated)
|
||||
function str_get_dom($str, $lowercase=true) {
|
||||
$dom = new simple_html_dom;
|
||||
$dom->load($str, $lowercase);
|
||||
return $dom;
|
||||
}
|
||||
|
||||
// simple html dom node
|
||||
// -----------------------------------------------------------------------------
|
||||
class simple_html_dom_node {
|
||||
public $nodetype = HDOM_TYPE_TEXT;
|
||||
public $tag = 'text';
|
||||
public $attr = array();
|
||||
public $children = array();
|
||||
public $nodes = array();
|
||||
public $parent = null;
|
||||
public $_ = array();
|
||||
private $dom = null;
|
||||
|
||||
function __construct($dom) {
|
||||
$this->dom = $dom;
|
||||
$dom->nodes[] = $this;
|
||||
}
|
||||
|
||||
function __destruct() {
|
||||
$this->clear();
|
||||
}
|
||||
|
||||
function __toString() {
|
||||
return $this->outertext();
|
||||
}
|
||||
|
||||
// clean up memory due to php5 circular references memory leak...
|
||||
function clear() {
|
||||
$this->dom = null;
|
||||
$this->nodes = null;
|
||||
$this->parent = null;
|
||||
$this->children = null;
|
||||
}
|
||||
|
||||
// dump node's tree
|
||||
function dump($show_attr=true) {
|
||||
dump_html_tree($this, $show_attr);
|
||||
}
|
||||
|
||||
// returns the parent of node
|
||||
function parent() {
|
||||
return $this->parent;
|
||||
}
|
||||
|
||||
// returns children of node
|
||||
function children($idx=-1) {
|
||||
if ($idx===-1) return $this->children;
|
||||
if (isset($this->children[$idx])) return $this->children[$idx];
|
||||
return null;
|
||||
}
|
||||
|
||||
// returns the first child of node
|
||||
function first_child() {
|
||||
if (count($this->children)>0) return $this->children[0];
|
||||
return null;
|
||||
}
|
||||
|
||||
// returns the last child of node
|
||||
function last_child() {
|
||||
if (($count=count($this->children))>0) return $this->children[$count-1];
|
||||
return null;
|
||||
}
|
||||
|
||||
// returns the next sibling of node
|
||||
function next_sibling() {
|
||||
if ($this->parent===null) return null;
|
||||
$idx = 0;
|
||||
$count = count($this->parent->children);
|
||||
while ($idx<$count && $this!==$this->parent->children[$idx])
|
||||
++$idx;
|
||||
if (++$idx>=$count) return null;
|
||||
return $this->parent->children[$idx];
|
||||
}
|
||||
|
||||
// returns the previous sibling of node
|
||||
function prev_sibling() {
|
||||
if ($this->parent===null) return null;
|
||||
$idx = 0;
|
||||
$count = count($this->parent->children);
|
||||
while ($idx<$count && $this!==$this->parent->children[$idx])
|
||||
++$idx;
|
||||
if (--$idx<0) return null;
|
||||
return $this->parent->children[$idx];
|
||||
}
|
||||
|
||||
// get dom node's inner html
|
||||
function innertext() {
|
||||
if (isset($this->_[HDOM_INFO_INNER])) return $this->_[HDOM_INFO_INNER];
|
||||
if (isset($this->_[HDOM_INFO_TEXT])) return $this->dom->restore_noise($this->_[HDOM_INFO_TEXT]);
|
||||
|
||||
$ret = '';
|
||||
foreach($this->nodes as $n)
|
||||
$ret .= $n->outertext();
|
||||
return $ret;
|
||||
}
|
||||
|
||||
// get dom node's outer text (with tag)
|
||||
function outertext() {
|
||||
if ($this->tag==='root') return $this->innertext();
|
||||
|
||||
// trigger callback
|
||||
if ($this->dom->callback!==null)
|
||||
call_user_func_array($this->dom->callback, array($this));
|
||||
|
||||
if (isset($this->_[HDOM_INFO_OUTER])) return $this->_[HDOM_INFO_OUTER];
|
||||
if (isset($this->_[HDOM_INFO_TEXT])) return $this->dom->restore_noise($this->_[HDOM_INFO_TEXT]);
|
||||
|
||||
// render begin tag
|
||||
$ret = $this->dom->nodes[$this->_[HDOM_INFO_BEGIN]]->makeup();
|
||||
|
||||
// render inner text
|
||||
if (isset($this->_[HDOM_INFO_INNER]))
|
||||
$ret .= $this->_[HDOM_INFO_INNER];
|
||||
else {
|
||||
foreach($this->nodes as $n)
|
||||
$ret .= $n->outertext();
|
||||
}
|
||||
|
||||
// render end tag
|
||||
if(isset($this->_[HDOM_INFO_END]) && $this->_[HDOM_INFO_END]!=0)
|
||||
$ret .= '</'.$this->tag.'>';
|
||||
return $ret;
|
||||
}
|
||||
|
||||
// get dom node's plain text
|
||||
function text() {
|
||||
if (isset($this->_[HDOM_INFO_INNER])) return $this->_[HDOM_INFO_INNER];
|
||||
switch ($this->nodetype) {
|
||||
case HDOM_TYPE_TEXT: return $this->dom->restore_noise($this->_[HDOM_INFO_TEXT]);
|
||||
case HDOM_TYPE_COMMENT: return '';
|
||||
case HDOM_TYPE_UNKNOWN: return '';
|
||||
}
|
||||
if (strcasecmp($this->tag, 'script')===0) return '';
|
||||
if (strcasecmp($this->tag, 'style')===0) return '';
|
||||
|
||||
$ret = '';
|
||||
foreach($this->nodes as $n)
|
||||
$ret .= $n->text();
|
||||
return $ret;
|
||||
}
|
||||
|
||||
function xmltext() {
|
||||
$ret = $this->innertext();
|
||||
$ret = str_ireplace('<![CDATA[', '', $ret);
|
||||
$ret = str_replace(']]>', '', $ret);
|
||||
return $ret;
|
||||
}
|
||||
|
||||
// build node's text with tag
|
||||
function makeup() {
|
||||
// text, comment, unknown
|
||||
if (isset($this->_[HDOM_INFO_TEXT])) return $this->dom->restore_noise($this->_[HDOM_INFO_TEXT]);
|
||||
|
||||
$ret = '<'.$this->tag;
|
||||
$i = -1;
|
||||
|
||||
foreach($this->attr as $key=>$val) {
|
||||
++$i;
|
||||
|
||||
// skip removed attribute
|
||||
if ($val===null || $val===false)
|
||||
continue;
|
||||
|
||||
$ret .= $this->_[HDOM_INFO_SPACE][$i][0];
|
||||
//no value attr: nowrap, checked selected...
|
||||
if ($val===true)
|
||||
$ret .= $key;
|
||||
else {
|
||||
switch($this->_[HDOM_INFO_QUOTE][$i]) {
|
||||
case HDOM_QUOTE_DOUBLE: $quote = '"'; break;
|
||||
case HDOM_QUOTE_SINGLE: $quote = '\''; break;
|
||||
default: $quote = '';
|
||||
}
|
||||
$ret .= $key.$this->_[HDOM_INFO_SPACE][$i][1].'='.$this->_[HDOM_INFO_SPACE][$i][2].$quote.$val.$quote;
|
||||
}
|
||||
}
|
||||
$ret = $this->dom->restore_noise($ret);
|
||||
return $ret . $this->_[HDOM_INFO_ENDSPACE] . '>';
|
||||
}
|
||||
|
||||
// find elements by css selector
|
||||
function find($selector, $idx=null) {
|
||||
$selectors = $this->parse_selector($selector);
|
||||
if (($count=count($selectors))===0) return array();
|
||||
$found_keys = array();
|
||||
|
||||
// find each selector
|
||||
for ($c=0; $c<$count; ++$c) {
|
||||
if (($levle=count($selectors[0]))===0) return array();
|
||||
if (!isset($this->_[HDOM_INFO_BEGIN])) return array();
|
||||
|
||||
$head = array($this->_[HDOM_INFO_BEGIN]=>1);
|
||||
|
||||
// handle descendant selectors, no recursive!
|
||||
for ($l=0; $l<$levle; ++$l) {
|
||||
$ret = array();
|
||||
foreach($head as $k=>$v) {
|
||||
$n = ($k===-1) ? $this->dom->root : $this->dom->nodes[$k];
|
||||
$n->seek($selectors[$c][$l], $ret);
|
||||
}
|
||||
$head = $ret;
|
||||
}
|
||||
|
||||
foreach($head as $k=>$v) {
|
||||
if (!isset($found_keys[$k]))
|
||||
$found_keys[$k] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// sort keys
|
||||
ksort($found_keys);
|
||||
|
||||
$found = array();
|
||||
foreach($found_keys as $k=>$v)
|
||||
$found[] = $this->dom->nodes[$k];
|
||||
|
||||
// return nth-element or array
|
||||
if (is_null($idx)) return $found;
|
||||
else if ($idx<0) $idx = count($found) + $idx;
|
||||
return (isset($found[$idx])) ? $found[$idx] : null;
|
||||
}
|
||||
|
||||
// seek for given conditions
|
||||
protected function seek($selector, &$ret) {
|
||||
list($tag, $key, $val, $exp, $no_key) = $selector;
|
||||
|
||||
// xpath index
|
||||
if ($tag && $key && is_numeric($key)) {
|
||||
$count = 0;
|
||||
foreach ($this->children as $c) {
|
||||
if ($tag==='*' || $tag===$c->tag) {
|
||||
if (++$count==$key) {
|
||||
$ret[$c->_[HDOM_INFO_BEGIN]] = 1;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
$end = (!empty($this->_[HDOM_INFO_END])) ? $this->_[HDOM_INFO_END] : 0;
|
||||
if ($end==0) {
|
||||
$parent = $this->parent;
|
||||
while (!isset($parent->_[HDOM_INFO_END]) && $parent!==null) {
|
||||
$end -= 1;
|
||||
$parent = $parent->parent;
|
||||
}
|
||||
$end += $parent->_[HDOM_INFO_END];
|
||||
}
|
||||
|
||||
for($i=$this->_[HDOM_INFO_BEGIN]+1; $i<$end; ++$i) {
|
||||
$node = $this->dom->nodes[$i];
|
||||
$pass = true;
|
||||
|
||||
if ($tag==='*' && !$key) {
|
||||
if (in_array($node, $this->children, true))
|
||||
$ret[$i] = 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
// compare tag
|
||||
if ($tag && $tag!=$node->tag && $tag!=='*') {$pass=false;}
|
||||
// compare key
|
||||
if ($pass && $key) {
|
||||
if ($no_key) {
|
||||
if (isset($node->attr[$key])) $pass=false;
|
||||
}
|
||||
else if (!isset($node->attr[$key])) $pass=false;
|
||||
}
|
||||
// compare value
|
||||
if ($pass && $key && $val && $val!=='*') {
|
||||
$check = $this->match($exp, $val, $node->attr[$key]);
|
||||
// handle multiple class
|
||||
if (!$check && strcasecmp($key, 'class')===0) {
|
||||
foreach(explode(' ',$node->attr[$key]) as $k) {
|
||||
$check = $this->match($exp, $val, $k);
|
||||
if ($check) break;
|
||||
}
|
||||
}
|
||||
if (!$check) $pass = false;
|
||||
}
|
||||
if ($pass) $ret[$i] = 1;
|
||||
unset($node);
|
||||
}
|
||||
}
|
||||
|
||||
protected function match($exp, $pattern, $value) {
|
||||
switch ($exp) {
|
||||
case '=':
|
||||
return ($value===$pattern);
|
||||
case '!=':
|
||||
return ($value!==$pattern);
|
||||
case '^=':
|
||||
return preg_match("/^".preg_quote($pattern,'/')."/", $value);
|
||||
case '$=':
|
||||
return preg_match("/".preg_quote($pattern,'/')."$/", $value);
|
||||
case '*=':
|
||||
if ($pattern[0]=='/')
|
||||
return preg_match($pattern, $value);
|
||||
return preg_match("/".$pattern."/i", $value);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected function parse_selector($selector_string) {
|
||||
// pattern of CSS selectors, modified from mootools
|
||||
$pattern = "/([\w-:\*]*)(?:\#([\w-]+)|\.([\w-]+))?(?:\[@?(!?[\w-]+)(?:([!*^$]?=)[\"']?(.*?)[\"']?)?\])?([\/, ]+)/is";
|
||||
preg_match_all($pattern, trim($selector_string).' ', $matches, PREG_SET_ORDER);
|
||||
$selectors = array();
|
||||
$result = array();
|
||||
//print_r($matches);
|
||||
|
||||
foreach ($matches as $m) {
|
||||
$m[0] = trim($m[0]);
|
||||
if ($m[0]==='' || $m[0]==='/' || $m[0]==='//') continue;
|
||||
// for borwser grnreated xpath
|
||||
if ($m[1]==='tbody') continue;
|
||||
|
||||
list($tag, $key, $val, $exp, $no_key) = array($m[1], null, null, '=', false);
|
||||
if(!empty($m[2])) {$key='id'; $val=$m[2];}
|
||||
if(!empty($m[3])) {$key='class'; $val=$m[3];}
|
||||
if(!empty($m[4])) {$key=$m[4];}
|
||||
if(!empty($m[5])) {$exp=$m[5];}
|
||||
if(!empty($m[6])) {$val=$m[6];}
|
||||
|
||||
// convert to lowercase
|
||||
if ($this->dom->lowercase) {$tag=strtolower($tag); $key=strtolower($key);}
|
||||
//elements that do NOT have the specified attribute
|
||||
if (isset($key[0]) && $key[0]==='!') {$key=substr($key, 1); $no_key=true;}
|
||||
|
||||
$result[] = array($tag, $key, $val, $exp, $no_key);
|
||||
if (trim($m[7])===',') {
|
||||
$selectors[] = $result;
|
||||
$result = array();
|
||||
}
|
||||
}
|
||||
if (count($result)>0)
|
||||
$selectors[] = $result;
|
||||
return $selectors;
|
||||
}
|
||||
|
||||
function __get($name) {
|
||||
if (isset($this->attr[$name])) return $this->attr[$name];
|
||||
switch($name) {
|
||||
case 'outertext': return $this->outertext();
|
||||
case 'innertext': return $this->innertext();
|
||||
case 'plaintext': return $this->text();
|
||||
case 'xmltext': return $this->xmltext();
|
||||
default: return array_key_exists($name, $this->attr);
|
||||
}
|
||||
}
|
||||
|
||||
function __set($name, $value) {
|
||||
switch($name) {
|
||||
case 'outertext': return $this->_[HDOM_INFO_OUTER] = $value;
|
||||
case 'innertext':
|
||||
if (isset($this->_[HDOM_INFO_TEXT])) return $this->_[HDOM_INFO_TEXT] = $value;
|
||||
return $this->_[HDOM_INFO_INNER] = $value;
|
||||
}
|
||||
if (!isset($this->attr[$name])) {
|
||||
$this->_[HDOM_INFO_SPACE][] = array(' ', '', '');
|
||||
$this->_[HDOM_INFO_QUOTE][] = HDOM_QUOTE_DOUBLE;
|
||||
}
|
||||
$this->attr[$name] = $value;
|
||||
}
|
||||
|
||||
function __isset($name) {
|
||||
switch($name) {
|
||||
case 'outertext': return true;
|
||||
case 'innertext': return true;
|
||||
case 'plaintext': return true;
|
||||
}
|
||||
//no value attr: nowrap, checked selected...
|
||||
return (array_key_exists($name, $this->attr)) ? true : isset($this->attr[$name]);
|
||||
}
|
||||
|
||||
function __unset($name) {
|
||||
if (isset($this->attr[$name]))
|
||||
unset($this->attr[$name]);
|
||||
}
|
||||
|
||||
// camel naming conventions
|
||||
function getAllAttributes() {return $this->attr;}
|
||||
function getAttribute($name) {return $this->__get($name);}
|
||||
function setAttribute($name, $value) {$this->__set($name, $value);}
|
||||
function hasAttribute($name) {return $this->__isset($name);}
|
||||
function removeAttribute($name) {$this->__set($name, null);}
|
||||
function getElementById($id) {return $this->find("#$id", 0);}
|
||||
function getElementsById($id, $idx=null) {return $this->find("#$id", $idx);}
|
||||
function getElementByTagName($name) {return $this->find($name, 0);}
|
||||
function getElementsByTagName($name, $idx=null) {return $this->find($name, $idx);}
|
||||
function parentNode() {return $this->parent();}
|
||||
function childNodes($idx=-1) {return $this->children($idx);}
|
||||
function firstChild() {return $this->first_child();}
|
||||
function lastChild() {return $this->last_child();}
|
||||
function nextSibling() {return $this->next_sibling();}
|
||||
function previousSibling() {return $this->prev_sibling();}
|
||||
}
|
||||
|
||||
// simple html dom parser
|
||||
// -----------------------------------------------------------------------------
|
||||
class simple_html_dom {
|
||||
public $root = null;
|
||||
public $nodes = array();
|
||||
public $callback = null;
|
||||
public $lowercase = false;
|
||||
protected $pos;
|
||||
protected $doc;
|
||||
protected $char;
|
||||
protected $size;
|
||||
protected $cursor;
|
||||
protected $parent;
|
||||
protected $noise = array();
|
||||
protected $token_blank = " \t\r\n";
|
||||
protected $token_equal = ' =/>';
|
||||
protected $token_slash = " />\r\n\t";
|
||||
protected $token_attr = ' >';
|
||||
// use isset instead of in_array, performance boost about 30%...
|
||||
protected $self_closing_tags = array('img'=>1, 'br'=>1, 'input'=>1, 'meta'=>1, 'link'=>1, 'hr'=>1, 'base'=>1, 'embed'=>1, 'spacer'=>1);
|
||||
protected $block_tags = array('root'=>1, 'body'=>1, 'form'=>1, 'div'=>1, 'span'=>1, 'table'=>1);
|
||||
protected $optional_closing_tags = array(
|
||||
'tr'=>array('tr'=>1, 'td'=>1, 'th'=>1),
|
||||
'th'=>array('th'=>1),
|
||||
'td'=>array('td'=>1),
|
||||
'li'=>array('li'=>1),
|
||||
'dt'=>array('dt'=>1, 'dd'=>1),
|
||||
'dd'=>array('dd'=>1, 'dt'=>1),
|
||||
'dl'=>array('dd'=>1, 'dt'=>1),
|
||||
'p'=>array('p'=>1),
|
||||
'nobr'=>array('nobr'=>1),
|
||||
);
|
||||
|
||||
function __construct($str=null) {
|
||||
if ($str) {
|
||||
if (preg_match("/^http:\/\//i",$str) || is_file($str))
|
||||
$this->load_file($str);
|
||||
else
|
||||
$this->load($str);
|
||||
}
|
||||
}
|
||||
|
||||
function __destruct() {
|
||||
$this->clear();
|
||||
}
|
||||
|
||||
// load html from string
|
||||
function load($str, $lowercase=true) {
|
||||
// prepare
|
||||
$this->prepare($str, $lowercase);
|
||||
// strip out comments
|
||||
$this->remove_noise("'<!--(.*?)-->'is");
|
||||
// strip out cdata
|
||||
$this->remove_noise("'<!\[CDATA\[(.*?)\]\]>'is", true);
|
||||
// strip out <style> tags
|
||||
$this->remove_noise("'<\s*style[^>]*[^/]>(.*?)<\s*/\s*style\s*>'is");
|
||||
$this->remove_noise("'<\s*style\s*>(.*?)<\s*/\s*style\s*>'is");
|
||||
// strip out <script> tags
|
||||
$this->remove_noise("'<\s*script[^>]*[^/]>(.*?)<\s*/\s*script\s*>'is");
|
||||
$this->remove_noise("'<\s*script\s*>(.*?)<\s*/\s*script\s*>'is");
|
||||
// strip out preformatted tags
|
||||
$this->remove_noise("'<\s*(?:code)[^>]*>(.*?)<\s*/\s*(?:code)\s*>'is");
|
||||
// strip out server side scripts
|
||||
$this->remove_noise("'(<\?)(.*?)(\?>)'s", true);
|
||||
// strip smarty scripts
|
||||
$this->remove_noise("'(\{\w)(.*?)(\})'s", true);
|
||||
|
||||
// parsing
|
||||
while ($this->parse());
|
||||
// end
|
||||
$this->root->_[HDOM_INFO_END] = $this->cursor;
|
||||
}
|
||||
|
||||
// load html from file
|
||||
function load_file() {
|
||||
$args = func_get_args();
|
||||
$this->load(call_user_func_array('file_get_contents', $args), true);
|
||||
}
|
||||
|
||||
// set callback function
|
||||
function set_callback($function_name) {
|
||||
$this->callback = $function_name;
|
||||
}
|
||||
|
||||
// remove callback function
|
||||
function remove_callback() {
|
||||
$this->callback = null;
|
||||
}
|
||||
|
||||
// save dom as string
|
||||
function save($filepath='') {
|
||||
$ret = $this->root->innertext();
|
||||
if ($filepath!=='') file_put_contents($filepath, $ret);
|
||||
return $ret;
|
||||
}
|
||||
|
||||
// find dom node by css selector
|
||||
function find($selector, $idx=null) {
|
||||
return $this->root->find($selector, $idx);
|
||||
}
|
||||
|
||||
// clean up memory due to php5 circular references memory leak...
|
||||
function clear() {
|
||||
foreach($this->nodes as $n) {$n->clear(); $n = null;}
|
||||
if (isset($this->parent)) {$this->parent->clear(); unset($this->parent);}
|
||||
if (isset($this->root)) {$this->root->clear(); unset($this->root);}
|
||||
unset($this->doc);
|
||||
unset($this->noise);
|
||||
}
|
||||
|
||||
function dump($show_attr=true) {
|
||||
$this->root->dump($show_attr);
|
||||
}
|
||||
|
||||
// prepare HTML data and init everything
|
||||
protected function prepare($str, $lowercase=true) {
|
||||
$this->clear();
|
||||
$this->doc = $str;
|
||||
$this->pos = 0;
|
||||
$this->cursor = 1;
|
||||
$this->noise = array();
|
||||
$this->nodes = array();
|
||||
$this->lowercase = $lowercase;
|
||||
$this->root = new simple_html_dom_node($this);
|
||||
$this->root->tag = 'root';
|
||||
$this->root->_[HDOM_INFO_BEGIN] = -1;
|
||||
$this->root->nodetype = HDOM_TYPE_ROOT;
|
||||
$this->parent = $this->root;
|
||||
// set the length of content
|
||||
$this->size = strlen($str);
|
||||
if ($this->size>0) $this->char = $this->doc[0];
|
||||
}
|
||||
|
||||
// parse html content
|
||||
protected function parse() {
|
||||
if (($s = $this->copy_until_char('<'))==='')
|
||||
return $this->read_tag();
|
||||
|
||||
// text
|
||||
$node = new simple_html_dom_node($this);
|
||||
++$this->cursor;
|
||||
$node->_[HDOM_INFO_TEXT] = $s;
|
||||
$this->link_nodes($node, false);
|
||||
return true;
|
||||
}
|
||||
|
||||
// read tag info
|
||||
protected function read_tag() {
|
||||
if ($this->char!=='<') {
|
||||
$this->root->_[HDOM_INFO_END] = $this->cursor;
|
||||
return false;
|
||||
}
|
||||
$begin_tag_pos = $this->pos;
|
||||
$this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
|
||||
|
||||
// end tag
|
||||
if ($this->char==='/') {
|
||||
$this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
|
||||
$this->skip($this->token_blank_t);
|
||||
$tag = $this->copy_until_char('>');
|
||||
|
||||
// skip attributes in end tag
|
||||
if (($pos = strpos($tag, ' '))!==false)
|
||||
$tag = substr($tag, 0, $pos);
|
||||
|
||||
$parent_lower = strtolower($this->parent->tag);
|
||||
$tag_lower = strtolower($tag);
|
||||
|
||||
if ($parent_lower!==$tag_lower) {
|
||||
if (isset($this->optional_closing_tags[$parent_lower]) && isset($this->block_tags[$tag_lower])) {
|
||||
$this->parent->_[HDOM_INFO_END] = 0;
|
||||
$org_parent = $this->parent;
|
||||
|
||||
while (($this->parent->parent) && strtolower($this->parent->tag)!==$tag_lower)
|
||||
$this->parent = $this->parent->parent;
|
||||
|
||||
if (strtolower($this->parent->tag)!==$tag_lower) {
|
||||
$this->parent = $org_parent; // restore origonal parent
|
||||
if ($this->parent->parent) $this->parent = $this->parent->parent;
|
||||
$this->parent->_[HDOM_INFO_END] = $this->cursor;
|
||||
return $this->as_text_node($tag);
|
||||
}
|
||||
}
|
||||
else if (($this->parent->parent) && isset($this->block_tags[$tag_lower])) {
|
||||
$this->parent->_[HDOM_INFO_END] = 0;
|
||||
$org_parent = $this->parent;
|
||||
|
||||
while (($this->parent->parent) && strtolower($this->parent->tag)!==$tag_lower)
|
||||
$this->parent = $this->parent->parent;
|
||||
|
||||
if (strtolower($this->parent->tag)!==$tag_lower) {
|
||||
$this->parent = $org_parent; // restore origonal parent
|
||||
$this->parent->_[HDOM_INFO_END] = $this->cursor;
|
||||
return $this->as_text_node($tag);
|
||||
}
|
||||
}
|
||||
else if (($this->parent->parent) && strtolower($this->parent->parent->tag)===$tag_lower) {
|
||||
$this->parent->_[HDOM_INFO_END] = 0;
|
||||
$this->parent = $this->parent->parent;
|
||||
}
|
||||
else
|
||||
return $this->as_text_node($tag);
|
||||
}
|
||||
|
||||
$this->parent->_[HDOM_INFO_END] = $this->cursor;
|
||||
if ($this->parent->parent) $this->parent = $this->parent->parent;
|
||||
|
||||
$this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
|
||||
return true;
|
||||
}
|
||||
|
||||
$node = new simple_html_dom_node($this);
|
||||
$node->_[HDOM_INFO_BEGIN] = $this->cursor;
|
||||
++$this->cursor;
|
||||
$tag = $this->copy_until($this->token_slash);
|
||||
|
||||
// doctype, cdata & comments...
|
||||
if (isset($tag[0]) && $tag[0]==='!') {
|
||||
$node->_[HDOM_INFO_TEXT] = '<' . $tag . $this->copy_until_char('>');
|
||||
|
||||
if (isset($tag[2]) && $tag[1]==='-' && $tag[2]==='-') {
|
||||
$node->nodetype = HDOM_TYPE_COMMENT;
|
||||
$node->tag = 'comment';
|
||||
} else {
|
||||
$node->nodetype = HDOM_TYPE_UNKNOWN;
|
||||
$node->tag = 'unknown';
|
||||
}
|
||||
|
||||
if ($this->char==='>') $node->_[HDOM_INFO_TEXT].='>';
|
||||
$this->link_nodes($node, true);
|
||||
$this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
|
||||
return true;
|
||||
}
|
||||
|
||||
// text
|
||||
if ($pos=strpos($tag, '<')!==false) {
|
||||
$tag = '<' . substr($tag, 0, -1);
|
||||
$node->_[HDOM_INFO_TEXT] = $tag;
|
||||
$this->link_nodes($node, false);
|
||||
$this->char = $this->doc[--$this->pos]; // prev
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!preg_match("/^[\w-:]+$/", $tag)) {
|
||||
$node->_[HDOM_INFO_TEXT] = '<' . $tag . $this->copy_until('<>');
|
||||
if ($this->char==='<') {
|
||||
$this->link_nodes($node, false);
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($this->char==='>') $node->_[HDOM_INFO_TEXT].='>';
|
||||
$this->link_nodes($node, false);
|
||||
$this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
|
||||
return true;
|
||||
}
|
||||
|
||||
// begin tag
|
||||
$node->nodetype = HDOM_TYPE_ELEMENT;
|
||||
$tag_lower = strtolower($tag);
|
||||
$node->tag = ($this->lowercase) ? $tag_lower : $tag;
|
||||
|
||||
// handle optional closing tags
|
||||
if (isset($this->optional_closing_tags[$tag_lower]) ) {
|
||||
while (isset($this->optional_closing_tags[$tag_lower][strtolower($this->parent->tag)])) {
|
||||
$this->parent->_[HDOM_INFO_END] = 0;
|
||||
$this->parent = $this->parent->parent;
|
||||
}
|
||||
$node->parent = $this->parent;
|
||||
}
|
||||
|
||||
$guard = 0; // prevent infinity loop
|
||||
$space = array($this->copy_skip($this->token_blank), '', '');
|
||||
|
||||
// attributes
|
||||
do {
|
||||
if ($this->char!==null && $space[0]==='') break;
|
||||
$name = $this->copy_until($this->token_equal);
|
||||
if($guard===$this->pos) {
|
||||
$this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
|
||||
continue;
|
||||
}
|
||||
$guard = $this->pos;
|
||||
|
||||
// handle endless '<'
|
||||
if($this->pos>=$this->size-1 && $this->char!=='>') {
|
||||
$node->nodetype = HDOM_TYPE_TEXT;
|
||||
$node->_[HDOM_INFO_END] = 0;
|
||||
$node->_[HDOM_INFO_TEXT] = '<'.$tag . $space[0] . $name;
|
||||
$node->tag = 'text';
|
||||
$this->link_nodes($node, false);
|
||||
return true;
|
||||
}
|
||||
|
||||
// handle mismatch '<'
|
||||
if($this->doc[$this->pos-1]=='<') {
|
||||
$node->nodetype = HDOM_TYPE_TEXT;
|
||||
$node->tag = 'text';
|
||||
$node->attr = array();
|
||||
$node->_[HDOM_INFO_END] = 0;
|
||||
$node->_[HDOM_INFO_TEXT] = substr($this->doc, $begin_tag_pos, $this->pos-$begin_tag_pos-1);
|
||||
$this->pos -= 2;
|
||||
$this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
|
||||
$this->link_nodes($node, false);
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($name!=='/' && $name!=='') {
|
||||
$space[1] = $this->copy_skip($this->token_blank);
|
||||
$name = $this->restore_noise($name);
|
||||
if ($this->lowercase) $name = strtolower($name);
|
||||
if ($this->char==='=') {
|
||||
$this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
|
||||
$this->parse_attr($node, $name, $space);
|
||||
}
|
||||
else {
|
||||
//no value attr: nowrap, checked selected...
|
||||
$node->_[HDOM_INFO_QUOTE][] = HDOM_QUOTE_NO;
|
||||
$node->attr[$name] = true;
|
||||
if ($this->char!='>') $this->char = $this->doc[--$this->pos]; // prev
|
||||
}
|
||||
$node->_[HDOM_INFO_SPACE][] = $space;
|
||||
$space = array($this->copy_skip($this->token_blank), '', '');
|
||||
}
|
||||
else
|
||||
break;
|
||||
} while($this->char!=='>' && $this->char!=='/');
|
||||
|
||||
$this->link_nodes($node, true);
|
||||
$node->_[HDOM_INFO_ENDSPACE] = $space[0];
|
||||
|
||||
// check self closing
|
||||
if ($this->copy_until_char_escape('>')==='/') {
|
||||
$node->_[HDOM_INFO_ENDSPACE] .= '/';
|
||||
$node->_[HDOM_INFO_END] = 0;
|
||||
}
|
||||
else {
|
||||
// reset parent
|
||||
if (!isset($this->self_closing_tags[strtolower($node->tag)])) $this->parent = $node;
|
||||
}
|
||||
$this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
|
||||
return true;
|
||||
}
|
||||
|
||||
// parse attributes
|
||||
protected function parse_attr($node, $name, &$space) {
|
||||
$space[2] = $this->copy_skip($this->token_blank);
|
||||
switch($this->char) {
|
||||
case '"':
|
||||
$node->_[HDOM_INFO_QUOTE][] = HDOM_QUOTE_DOUBLE;
|
||||
$this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
|
||||
$node->attr[$name] = $this->restore_noise($this->copy_until_char_escape('"'));
|
||||
$this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
|
||||
break;
|
||||
case '\'':
|
||||
$node->_[HDOM_INFO_QUOTE][] = HDOM_QUOTE_SINGLE;
|
||||
$this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
|
||||
$node->attr[$name] = $this->restore_noise($this->copy_until_char_escape('\''));
|
||||
$this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
|
||||
break;
|
||||
default:
|
||||
$node->_[HDOM_INFO_QUOTE][] = HDOM_QUOTE_NO;
|
||||
$node->attr[$name] = $this->restore_noise($this->copy_until($this->token_attr));
|
||||
}
|
||||
}
|
||||
|
||||
// link node's parent
|
||||
protected function link_nodes(&$node, $is_child) {
|
||||
$node->parent = $this->parent;
|
||||
$this->parent->nodes[] = $node;
|
||||
if ($is_child)
|
||||
$this->parent->children[] = $node;
|
||||
}
|
||||
|
||||
// as a text node
|
||||
protected function as_text_node($tag) {
|
||||
$node = new simple_html_dom_node($this);
|
||||
++$this->cursor;
|
||||
$node->_[HDOM_INFO_TEXT] = '</' . $tag . '>';
|
||||
$this->link_nodes($node, false);
|
||||
$this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
|
||||
return true;
|
||||
}
|
||||
|
||||
protected function skip($chars) {
|
||||
$this->pos += strspn($this->doc, $chars, $this->pos);
|
||||
$this->char = ($this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
|
||||
}
|
||||
|
||||
protected function copy_skip($chars) {
|
||||
$pos = $this->pos;
|
||||
$len = strspn($this->doc, $chars, $pos);
|
||||
$this->pos += $len;
|
||||
$this->char = ($this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
|
||||
if ($len===0) return '';
|
||||
return substr($this->doc, $pos, $len);
|
||||
}
|
||||
|
||||
protected function copy_until($chars) {
|
||||
$pos = $this->pos;
|
||||
$len = strcspn($this->doc, $chars, $pos);
|
||||
$this->pos += $len;
|
||||
$this->char = ($this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
|
||||
return substr($this->doc, $pos, $len);
|
||||
}
|
||||
|
||||
protected function copy_until_char($char) {
|
||||
if ($this->char===null) return '';
|
||||
|
||||
if (($pos = strpos($this->doc, $char, $this->pos))===false) {
|
||||
$ret = substr($this->doc, $this->pos, $this->size-$this->pos);
|
||||
$this->char = null;
|
||||
$this->pos = $this->size;
|
||||
return $ret;
|
||||
}
|
||||
|
||||
if ($pos===$this->pos) return '';
|
||||
$pos_old = $this->pos;
|
||||
$this->char = $this->doc[$pos];
|
||||
$this->pos = $pos;
|
||||
return substr($this->doc, $pos_old, $pos-$pos_old);
|
||||
}
|
||||
|
||||
protected function copy_until_char_escape($char) {
|
||||
if ($this->char===null) return '';
|
||||
|
||||
$start = $this->pos;
|
||||
while(1) {
|
||||
if (($pos = strpos($this->doc, $char, $start))===false) {
|
||||
$ret = substr($this->doc, $this->pos, $this->size-$this->pos);
|
||||
$this->char = null;
|
||||
$this->pos = $this->size;
|
||||
return $ret;
|
||||
}
|
||||
|
||||
if ($pos===$this->pos) return '';
|
||||
|
||||
if ($this->doc[$pos-1]==='\\') {
|
||||
$start = $pos+1;
|
||||
continue;
|
||||
}
|
||||
|
||||
$pos_old = $this->pos;
|
||||
$this->char = $this->doc[$pos];
|
||||
$this->pos = $pos;
|
||||
return substr($this->doc, $pos_old, $pos-$pos_old);
|
||||
}
|
||||
}
|
||||
|
||||
// remove noise from html content
|
||||
protected function remove_noise($pattern, $remove_tag=false) {
|
||||
$count = preg_match_all($pattern, $this->doc, $matches, PREG_SET_ORDER|PREG_OFFSET_CAPTURE);
|
||||
|
||||
for ($i=$count-1; $i>-1; --$i) {
|
||||
$key = '___noise___'.sprintf('% 3d', count($this->noise)+100);
|
||||
$idx = ($remove_tag) ? 0 : 1;
|
||||
$this->noise[$key] = $matches[$i][$idx][0];
|
||||
$this->doc = substr_replace($this->doc, $key, $matches[$i][$idx][1], strlen($matches[$i][$idx][0]));
|
||||
}
|
||||
|
||||
// reset the length of content
|
||||
$this->size = strlen($this->doc);
|
||||
if ($this->size>0) $this->char = $this->doc[0];
|
||||
}
|
||||
|
||||
// restore noise to html content
|
||||
function restore_noise($text) {
|
||||
while(($pos=strpos($text, '___noise___'))!==false) {
|
||||
$key = '___noise___'.$text[$pos+11].$text[$pos+12].$text[$pos+13];
|
||||
if (isset($this->noise[$key]))
|
||||
$text = substr($text, 0, $pos).$this->noise[$key].substr($text, $pos+14);
|
||||
}
|
||||
return $text;
|
||||
}
|
||||
|
||||
function __toString() {
|
||||
return $this->root->innertext();
|
||||
}
|
||||
|
||||
function __get($name) {
|
||||
switch($name) {
|
||||
case 'outertext': return $this->root->innertext();
|
||||
case 'innertext': return $this->root->innertext();
|
||||
case 'plaintext': return $this->root->text();
|
||||
}
|
||||
}
|
||||
|
||||
// camel naming conventions
|
||||
function childNodes($idx=-1) {return $this->root->childNodes($idx);}
|
||||
function firstChild() {return $this->root->first_child();}
|
||||
function lastChild() {return $this->root->last_child();}
|
||||
function getElementById($id) {return $this->find("#$id", 0);}
|
||||
function getElementsById($id, $idx=null) {return $this->find("#$id", $idx);}
|
||||
function getElementByTagName($name) {return $this->find($name, 0);}
|
||||
function getElementsByTagName($name, $idx=-1) {return $this->find($name, $idx);}
|
||||
function loadFile() {$args = func_get_args();$this->load(call_user_func_array('file_get_contents', $args), true);}
|
||||
}
|
||||
?>
|
@ -2,4 +2,5 @@
|
||||
border: 0px;
|
||||
width: 16px;
|
||||
height: 18px;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
@ -7,12 +7,14 @@
|
||||
font-family: 'Trebuchet MS', 'Lucida Grande', Verdana, Arial, Sans-Serif;
|
||||
font-size: 13px;
|
||||
color: black;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
a.phplmnormal:hover {
|
||||
font-family: 'Trebuchet MS', 'Lucida Grande', Verdana, Arial, Sans-Serif;
|
||||
font-size: 13px;
|
||||
color: black;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
|
||||
@ -22,6 +24,9 @@ a.phplm:link {
|
||||
font-size: 13px;
|
||||
color: #006699;
|
||||
text-decoration: none;
|
||||
vertical-align: top;
|
||||
border: 0px;
|
||||
margin: 0px;
|
||||
}
|
||||
|
||||
a.phplm:visited {
|
||||
@ -29,6 +34,7 @@ a.phplm:visited {
|
||||
font-size: 13px;
|
||||
text-decoration: none;
|
||||
color: #006699;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
a.phplm:hover {
|
||||
@ -37,6 +43,7 @@ a.phplm:hover {
|
||||
color: #006699;
|
||||
background-color: #eee;
|
||||
text-decoration: none;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
a.phplm:active {
|
||||
@ -44,6 +51,7 @@ a.phplm:active {
|
||||
font-size: 13px;
|
||||
text-decoration: none;
|
||||
color: #006699;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
|
||||
|
@ -186,7 +186,7 @@ function newTreeMenu(
|
||||
$img = $img_space;
|
||||
$alt = $alt_space;
|
||||
}
|
||||
$this->_treeMenu[$menu_name] .= '<img align="top" border="0" class="imgs" src="' . $img . '" alt="' . $alt . '" />';
|
||||
$this->_treeMenu[$menu_name] .= '<img class="imgs" src="' . $img . '" alt="' . $alt . '" />';
|
||||
}
|
||||
|
||||
$not_a_leaf = $cnt<$this->_lastItem[$menu_name] && $this->tree[$cnt+1]['level']>$this->tree[$cnt]['level'];
|
||||
@ -201,9 +201,9 @@ function newTreeMenu(
|
||||
$img = $img_collapse_corner;
|
||||
$alt = $alt_collapse_corner;
|
||||
}
|
||||
$this->_treeMenu[$menu_name] .= '<a onmousedown="' . $toggle_function_name . "('" . $cnt . "')" . '"><img align="top" border="0" class="imgs" id="jt' . $cnt . 'node" src="' . $img . '" alt="' . $alt . '" /></a>';
|
||||
$this->_treeMenu[$menu_name] .= '<a onmousedown="' . $toggle_function_name . "('" . $cnt . "')" . '"><img class="imgs" id="jt' . $cnt . 'node" src="' . $img . '" alt="' . $alt . '" /></a>';
|
||||
} else {
|
||||
$this->_treeMenu[$menu_name] .= '<img align="top" border="0" class="imgs" src="' . $img_corner . '" alt="' . $alt_corner . '" />';
|
||||
$this->_treeMenu[$menu_name] .= '<img class="imgs" src="' . $img_corner . '" alt="' . $alt_corner . '" />';
|
||||
}
|
||||
$levels[$this->tree[$cnt]['level']-1] = 0;
|
||||
} else {
|
||||
@ -215,7 +215,7 @@ function newTreeMenu(
|
||||
$img = $img_collapse;
|
||||
$alt = $alt_collapse;
|
||||
}
|
||||
$this->_treeMenu[$menu_name] .= '<a onmousedown="' . $toggle_function_name . "('" . $cnt . "');" . '"><img align="top" border="0" class="imgs" id="jt' . $cnt . 'node" src="' . $img . '" alt="' . $alt . '" /></a>';
|
||||
$this->_treeMenu[$menu_name] .= '<a onmousedown="' . $toggle_function_name . "('" . $cnt . "');" . '"><img class="imgs" id="jt' . $cnt . 'node" src="' . $img . '" alt="' . $alt . '" /></a>';
|
||||
} else {
|
||||
if ($cnt == $this->_firstItem[$menu_name]) {
|
||||
$img = $img_split_first;
|
||||
@ -224,7 +224,7 @@ function newTreeMenu(
|
||||
$img = $img_split;
|
||||
$alt = $alt_split;
|
||||
}
|
||||
$this->_treeMenu[$menu_name] .= '<img align="top" border="0" class="imgs" id="jt' . $cnt . 'node" src="' . $img . '" alt="' . $alt . '" />';
|
||||
$this->_treeMenu[$menu_name] .= '<img class="imgs" id="jt' . $cnt . 'node" src="' . $img . '" alt="' . $alt . '" />';
|
||||
}
|
||||
$levels[$this->tree[$cnt]['level']-1] = 1;
|
||||
}
|
||||
@ -242,12 +242,12 @@ function newTreeMenu(
|
||||
}
|
||||
|
||||
if ($not_a_leaf) {
|
||||
$this->_treeMenu[$menu_name] .= $a_href_open_img . '<img align="top" border="0" class="imgs" id="jt' . $cnt . 'folder" src="' . $img_folder_open . '" alt="' . $alt_folder_open . '" />' . $a_href_close_img;
|
||||
$this->_treeMenu[$menu_name] .= $a_href_open_img . '<img class="imgs" id="jt' . $cnt . 'folder" src="' . $img_folder_open . '" alt="' . $alt_folder_open . '" />' . $a_href_close_img;
|
||||
} else {
|
||||
if ($this->tree[$cnt]['parsed_icon'] != '') {
|
||||
$this->_treeMenu[$menu_name] .= $a_href_open_img . '<img align="top" border="0" src="' . $this->tree[$cnt]['parsed_icon'] . '" width="' . $this->tree[$cnt]['iconwidth'] . '" height="' . $this->tree[$cnt]['iconheight'] . '" alt="' . $alt_leaf . '" />' . $a_href_close_img;
|
||||
$this->_treeMenu[$menu_name] .= $a_href_open_img . '<img src="' . $this->tree[$cnt]['parsed_icon'] . '" width="' . $this->tree[$cnt]['iconwidth'] . '" height="' . $this->tree[$cnt]['iconheight'] . '" alt="' . $alt_leaf . '" />' . $a_href_close_img;
|
||||
} else {
|
||||
$this->_treeMenu[$menu_name] .= $a_href_open_img . '<img align="top" border="0" class="imgs" src="' . $img_leaf . '" alt="' . $alt_leaf . '" />' . $a_href_close_img;
|
||||
$this->_treeMenu[$menu_name] .= $a_href_open_img . '<img class="imgs" src="' . $img_leaf . '" alt="' . $alt_leaf . '" />' . $a_href_close_img;
|
||||
}
|
||||
}
|
||||
$this->_treeMenu[$menu_name] .= ' ' . $a_href_open . $this->tree[$cnt]['text'] . $a_href_close . "\n";
|
||||
@ -279,7 +279,7 @@ function newTreeMenu(
|
||||
$this->_treeMenu[$menu_name] =
|
||||
'<table cellspacing="0" cellpadding="0" border="0">' . "\n" .
|
||||
'<tr>' . "\n" .
|
||||
'<td class="phplmnormal" nowrap="nowrap">' . "\n" .
|
||||
'<td class="phplmnormal">' . "\n" .
|
||||
$this->_treeMenu[$menu_name] .
|
||||
'</td>' . "\n" .
|
||||
'</tr>' . "\n" .
|
||||
@ -302,14 +302,14 @@ function newTreeMenu(
|
||||
));
|
||||
$toggle_function = $t->parse('out', 'tplfile');
|
||||
$toggle_function =
|
||||
'<script language="JavaScript" type="text/javascript">' . "\n" .
|
||||
'<script type="text/javascript">' . "\n" .
|
||||
'<!--' . "\n" .
|
||||
$toggle_function .
|
||||
'// -->' . "\n" .
|
||||
'</script>' . "\n";
|
||||
|
||||
$toggle =
|
||||
'<script language="JavaScript" type="text/javascript">' . "\n" .
|
||||
'<script type="text/javascript">' . "\n" .
|
||||
'<!--' . "\n" .
|
||||
'if ((DOM && !Opera56 && !Konqueror22) || IE4) {' . "\n" .
|
||||
$toggle .
|
||||
|
11
includes/smarty/plugins/block.translate.php
Normal file
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @block depreated in favour of {t}
|
||||
*/
|
||||
function smarty_block_translate($params,$content,&$smarty,&$repeat) {
|
||||
if (! trim($content))
|
||||
return;
|
||||
|
||||
printf('Translate deprecated in favour of {t}: [%s:%s]',isset($params['module']) ? $params['module'] : 'core',$content);
|
||||
}
|
||||
?>
|
@ -404,7 +404,7 @@ function osb_html_menu_product_host($params,&$smarty) {
|
||||
$id = $params['name'];
|
||||
|
||||
$db = &DB();
|
||||
$result = $db->Execute(sqlSelect($db,'product','id,sku',sprintf('host=1 AND active=1 AND price_type=1 AND id!%s',$params['exclude'])));
|
||||
$result = $db->Execute(sqlSelect($db,'product','id,sku',sprintf('host=1 AND active=1 AND price_type=1 AND id!=%s',$params['exclude'])));
|
||||
if ($result && $result->RecordCount()) {
|
||||
printf('<select id="%s" name="%s[]" size="%s" multiple="multiple">',$id,$params['name'],$params['size']);
|
||||
while(!$result->EOF) {
|
||||
|
@ -29,7 +29,7 @@ function smarty_function_popup_init($params, &$smarty)
|
||||
|
||||
if (!empty($params['src'])) {
|
||||
return '<div id="overDiv" style="position:absolute; visibility:hidden; z-index:'.$zindex.';"></div>' . "\n"
|
||||
. '<script type="text/javascript" language="JavaScript" src="'.$params['src'].'"></script>' . "\n";
|
||||
. '<script type="text/javascript" src="'.$params['src'].'"></script>' . "\n";
|
||||
} else {
|
||||
$smarty->trigger_error("popup_init: missing src parameter");
|
||||
}
|
||||
|