diff --git a/application/bootstrap.php b/application/bootstrap.php index c10916f..0f4adad 100644 --- a/application/bootstrap.php +++ b/application/bootstrap.php @@ -36,14 +36,6 @@ ini_set('unserialize_callback_func', 'spl_autoload_call'); //-- Configuration and initialization ----------------------------------------- -/** - * Set Kohana::$environment if a 'KOHANA_ENV' environment variable has been supplied. - */ -if (getenv('KOHANA_ENV') !== FALSE) -{ - Kohana::$environment = getenv('KOHANA_ENV'); -} - /** * Initialize Kohana, setting the default options. * diff --git a/application/classes/controller/lnapp/login.php b/application/classes/controller/lnapp/login.php new file mode 100644 index 0000000..4a82b52 --- /dev/null +++ b/application/classes/controller/lnapp/login.php @@ -0,0 +1,213 @@ +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) { + // Store our details in a session key + Session::instance()->set('username',$_POST['username']); + Session::instance()->set('password',$_POST['password']); + + // 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.') + )); + } +} +?> diff --git a/application/classes/controller/lnapp/templatedefault.php b/application/classes/controller/lnapp/templatedefault.php index 343804f..22ef6f1 100644 --- a/application/classes/controller/lnapp/templatedefault.php +++ b/application/classes/controller/lnapp/templatedefault.php @@ -61,9 +61,9 @@ abstract class Controller_lnApp_TemplateDefault extends Controller_Template { if (! Kohana::Config('config.method_security')) return FALSE; - return (($this->auth_required !== FALSE && Auth::instance()->logged_in() === 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]) === FALSE)); + Auth::instance()->logged_in($this->secure_actions[$this->request->action],get_class($this).'|'.__METHOD__) === FALSE)); } /** diff --git a/application/classes/controller/login.php b/application/classes/controller/login.php index bd9288e..59a728d 100644 --- a/application/classes/controller/login.php +++ b/application/classes/controller/login.php @@ -1,138 +1,4 @@ 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) { - // Store our details in a session key - Session::instance()->set('admin_name',$_POST['admin_name']); - Session::instance()->set('password',$_POST['password']); - - // 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').'...'; - } - - 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.') - )); - } -} +class Controller_Login extends Controller_lnApp_Login {} ?> diff --git a/application/classes/database/tsm.php b/application/classes/database/tsm.php index 303015a..717f163 100644 --- a/application/classes/database/tsm.php +++ b/application/classes/database/tsm.php @@ -55,7 +55,7 @@ class Database_TSM extends Database { // Get user login details from user session - these are set by login if (! $username) - $username = Session::instance()->get_once('admin_name'); + $username = Session::instance()->get_once('username'); if (! $password) $password = Session::instance()->get_once('password'); diff --git a/application/classes/lnapp/config.php b/application/classes/lnapp/config.php index d8ce71e..8389266 100644 --- a/application/classes/lnapp/config.php +++ b/application/classes/lnapp/config.php @@ -12,39 +12,6 @@ * @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 */ @@ -90,7 +57,13 @@ abstract class lnApp_Config extends Kohana { return Kohana::config('config.site_name'); } + public static function logo_file() { + // @todo Move the logo filename to a config file + return Kohana::find_file(sprintf('media/%s',Config::siteid()),'img/logo-small','png'); + } + public static function logo() { + // @todo Move the logo filename to a config file $mediapath = Route::get('default/media'); $logo = $mediapath->uri(array('file'=>'img/logo-small.png'),array('alt'=>static::sitename())); diff --git a/application/classes/model/auth/userdefault.php b/application/classes/model/auth/userdefault.php index 723aa74..5759a92 100644 --- a/application/classes/model/auth/userdefault.php +++ b/application/classes/model/auth/userdefault.php @@ -51,13 +51,13 @@ class Model_Auth_UserDefault extends Model_Auth_User { * @return boolean */ public function login(array & $array, $redirect = FALSE) { - $fieldname = 'admin_name'; + $fieldname = 'admin_name'; // @todo This should be defined in a config or database driver file $array = Validate::factory($array) - ->label('admin_name', $this->_labels[$fieldname]) + ->label('username', $this->_labels[$fieldname]) ->label('password', $this->_labels['password']) ->filter(TRUE, 'trim') - ->filter('admin_name','strtoupper') - ->rules('admin_name', $this->_rules[$fieldname]) + ->filter('username','strtoupper') + ->rules('username', $this->_rules[$fieldname]) ->rules('password', $this->_rules['password']); // Get the remember login option @@ -69,7 +69,7 @@ class Model_Auth_UserDefault extends Model_Auth_User { if ($array->check()) { // Attempt to load the user - $this->where($fieldname, '=', $array['admin_name'])->find(); + $this->where($fieldname, '=', $array['username'])->find(); if ($this->loaded() AND Auth::instance()->login($this, $array['password'], $remember)) { diff --git a/application/classes/tsm.php b/application/classes/tsm.php index 217b46b..fe1d2b8 100644 --- a/application/classes/tsm.php +++ b/application/classes/tsm.php @@ -13,7 +13,7 @@ class TSM { public function set($username,$password,Database_TSM_Result $server) { // @todo Consider encrypting this - Session::instance()->set('admin_name',$username); + Session::instance()->set('username',$username); Session::instance()->set('password',$password); Session::instance()->set('SERVER',$server); diff --git a/application/config/auth.php b/application/config/auth.php index 9be58f5..a0561fc 100644 --- a/application/config/auth.php +++ b/application/config/auth.php @@ -12,18 +12,11 @@ */ return array( - - 'driver' => 'ORM', - 'hash_method' => 'sha1', - 'salt_pattern' => '1, 3, 5, 9, 14, 15, 20, 21, 28, 30', - 'lifetime' => 1209600, - 'session_key' => 'admin_name', - 'forced_key' => 'auth_forced', - - // Username/password combinations for the Auth File driver - 'users' => array( - // 'admin' => 'b3154acf3a344170077d11bdb5fff31532f679a1919e716a02', - ), - + 'driver' => 'ORM', + 'hash_method' => 'sha1', + 'salt_pattern' => '1, 3, 5, 9, 14, 15, 20, 21, 28, 30', + 'lifetime' => 1209600, + 'session_key' => 'username', + 'forced_key' => 'auth_forced', ); ?> diff --git a/application/i18n/.htaccess b/application/i18n/.htaccess new file mode 100644 index 0000000..281d5c3 --- /dev/null +++ b/application/i18n/.htaccess @@ -0,0 +1,2 @@ +order allow,deny +deny from all diff --git a/application/media/css/default.css b/application/media/css/default.css index 1592830..1f76b7c 100644 --- a/application/media/css/default.css +++ b/application/media/css/default.css @@ -1,10 +1,13 @@ /* Default Template CSS */ -table.box-full { border: 1px solid #AAAACC; margin-right: auto; width: 100%; } 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; margin-right: auto; 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; } diff --git a/application/media/css/jquery.gritter.css b/application/media/css/jquery.gritter.css new file mode 100644 index 0000000..0d6cba5 --- /dev/null +++ b/application/media/css/jquery.gritter.css @@ -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; +} diff --git a/application/media/img/address-book-new-big.png b/application/media/img/address-book-new-big.png new file mode 100644 index 0000000..aa7c4e0 Binary files /dev/null and b/application/media/img/address-book-new-big.png differ diff --git a/application/media/img/address-book-new.png b/application/media/img/address-book-new.png new file mode 100644 index 0000000..e37385c Binary files /dev/null and b/application/media/img/address-book-new.png differ diff --git a/application/media/img/ajax-progress.gif b/application/media/img/ajax-progress.gif new file mode 100644 index 0000000..994bfab Binary files /dev/null and b/application/media/img/ajax-progress.gif differ diff --git a/application/media/img/bug-big.png b/application/media/img/bug-big.png new file mode 100644 index 0000000..0758a85 Binary files /dev/null and b/application/media/img/bug-big.png differ diff --git a/application/media/img/dialog-error-big.png b/application/media/img/dialog-error-big.png new file mode 100644 index 0000000..49ed530 Binary files /dev/null and b/application/media/img/dialog-error-big.png differ diff --git a/application/media/img/dialog-information-big.png b/application/media/img/dialog-information-big.png new file mode 100644 index 0000000..cca5804 Binary files /dev/null and b/application/media/img/dialog-information-big.png differ diff --git a/application/media/img/dialog-password-big.png b/application/media/img/dialog-password-big.png new file mode 100644 index 0000000..e40a48d Binary files /dev/null and b/application/media/img/dialog-password-big.png differ diff --git a/application/media/img/dialog-question-big.png b/application/media/img/dialog-question-big.png new file mode 100644 index 0000000..2361f74 Binary files /dev/null and b/application/media/img/dialog-question-big.png differ diff --git a/application/media/img/dialog-question.png b/application/media/img/dialog-question.png new file mode 100644 index 0000000..ec07761 Binary files /dev/null and b/application/media/img/dialog-question.png differ diff --git a/application/media/img/dialog-warning-big.png b/application/media/img/dialog-warning-big.png new file mode 100644 index 0000000..a9ff09b Binary files /dev/null and b/application/media/img/dialog-warning-big.png differ diff --git a/application/media/img/gritter-close-ie6.gif b/application/media/img/gritter-close-ie6.gif new file mode 100644 index 0000000..aea6e42 Binary files /dev/null and b/application/media/img/gritter-close-ie6.gif differ diff --git a/application/media/img/gritter.png b/application/media/img/gritter.png new file mode 100755 index 0000000..0ca3bc0 Binary files /dev/null and b/application/media/img/gritter.png differ diff --git a/application/media/img/help-about-big.png b/application/media/img/help-about-big.png new file mode 100644 index 0000000..45b5d62 Binary files /dev/null and b/application/media/img/help-about-big.png differ diff --git a/application/media/img/help-about.png b/application/media/img/help-about.png new file mode 100644 index 0000000..435ea0e Binary files /dev/null and b/application/media/img/help-about.png differ diff --git a/application/media/img/help-big.png b/application/media/img/help-big.png new file mode 100644 index 0000000..bbda895 Binary files /dev/null and b/application/media/img/help-big.png differ diff --git a/application/media/img/help-faq-big.png b/application/media/img/help-faq-big.png new file mode 100644 index 0000000..1d57544 Binary files /dev/null and b/application/media/img/help-faq-big.png differ diff --git a/application/media/img/help-faq.png b/application/media/img/help-faq.png new file mode 100644 index 0000000..69e0ce1 Binary files /dev/null and b/application/media/img/help-faq.png differ diff --git a/application/media/img/help.png b/application/media/img/help.png new file mode 100644 index 0000000..674a8e9 Binary files /dev/null and b/application/media/img/help.png differ diff --git a/application/media/img/jquery.gritter.close-ie6.gif b/application/media/img/jquery.gritter.close-ie6.gif new file mode 100644 index 0000000..aea6e42 Binary files /dev/null and b/application/media/img/jquery.gritter.close-ie6.gif differ diff --git a/application/media/img/jquery.gritter.png b/application/media/img/jquery.gritter.png new file mode 100644 index 0000000..0ca3bc0 Binary files /dev/null and b/application/media/img/jquery.gritter.png differ diff --git a/application/media/img/request-feature-big.png b/application/media/img/request-feature-big.png new file mode 100644 index 0000000..b7b1241 Binary files /dev/null and b/application/media/img/request-feature-big.png differ diff --git a/application/media/img/smile-big.png b/application/media/img/smile-big.png new file mode 100644 index 0000000..22fba5f Binary files /dev/null and b/application/media/img/smile-big.png differ diff --git a/application/media/img/toggle-closed.png b/application/media/img/toggle-closed.png new file mode 100644 index 0000000..f66b1a8 Binary files /dev/null and b/application/media/img/toggle-closed.png differ diff --git a/application/media/img/toggle-open.png b/application/media/img/toggle-open.png new file mode 100644 index 0000000..6ff9066 Binary files /dev/null and b/application/media/img/toggle-open.png differ diff --git a/application/media/js/jquery.gritter-1.5.js b/application/media/js/jquery.gritter-1.5.js new file mode 100644 index 0000000..bf3bd47 --- /dev/null +++ b/application/media/js/jquery.gritter-1.5.js @@ -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:'
',_tpl_item:'',_tpl_wrap:'
',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!='')?'':'',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 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 ); + } + }); +}; diff --git a/application/media/js/themes/default/d.png b/application/media/js/themes/default/d.png new file mode 100644 index 0000000..8540175 Binary files /dev/null and b/application/media/js/themes/default/d.png differ diff --git a/application/media/js/themes/default/dot_for_ie.gif b/application/media/js/themes/default/dot_for_ie.gif new file mode 100644 index 0000000..c0cc5fd Binary files /dev/null and b/application/media/js/themes/default/dot_for_ie.gif differ diff --git a/application/media/js/themes/default/style.css b/application/media/js/themes/default/style.css new file mode 100644 index 0000000..2ca17ea --- /dev/null +++ b/application/media/js/themes/default/style.css @@ -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("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("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("d.png") -2px -53px no-repeat !important; } +#vakata-dragged.jstree-default .jstree-invalid { background:url("d.png") -18px -53px no-repeat !important; } +#jstree-marker.jstree-default { background:url("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 */ diff --git a/application/media/js/themes/default/throbber.gif b/application/media/js/themes/default/throbber.gif new file mode 100644 index 0000000..5b33f7e Binary files /dev/null and b/application/media/js/themes/default/throbber.gif differ diff --git a/application/messages/.htaccess b/application/messages/.htaccess new file mode 100644 index 0000000..281d5c3 --- /dev/null +++ b/application/messages/.htaccess @@ -0,0 +1,2 @@ +order allow,deny +deny from all diff --git a/application/views/.htaccess b/application/views/.htaccess new file mode 100644 index 0000000..281d5c3 --- /dev/null +++ b/application/views/.htaccess @@ -0,0 +1,2 @@ +order allow,deny +deny from all diff --git a/application/views/login.php b/application/views/login.php index a9a595d..56ec060 100644 --- a/application/views/login.php +++ b/application/views/login.php @@ -2,11 +2,13 @@ - + + +
User Name:
'login-uid','size'=>40));?>
'login-uid','size'=>40));?>
 
Password:
'login-pwd','size'=>40));?>
 
diff --git a/application/views/template.php b/application/views/template.php new file mode 100644 index 0000000..6f72764 --- /dev/null +++ b/application/views/template.php @@ -0,0 +1 @@ +