diff --git a/application/config/locale.php b/application/config/locale.php index 87ac931ee0..b692c00aae 100644 --- a/application/config/locale.php +++ b/application/config/locale.php @@ -19,4 +19,11 @@ * Locale timezone. Defaults to use the server timezone. * @see http://php.net/timezones */ -$config['timezone'] = ''; \ No newline at end of file +$config['timezone'] = ''; + +/** + * Force text-direction to be either LTR or RTL + * Possible values: 'rtl' 'ltr' or FALSE + * @see Ush_Locale::is_rtl_language() + */ +$config['force_text_direction'] = FALSE; diff --git a/application/config/requirements.php b/application/config/requirements.php new file mode 100644 index 0000000000..33798c5b07 --- /dev/null +++ b/application/config/requirements.php @@ -0,0 +1,41 @@ + tag instead of the tag. + * This means script downloads won't block other HTTP-requests, + * which can be a performance improvement. + * @see Requirements_Backend::$write_js_to_body for details + **/ +$config['write_js_to_body'] = FALSE; \ No newline at end of file diff --git a/application/controllers/admin.php b/application/controllers/admin.php index 9484a9dd96..e8e7ad8caa 100644 --- a/application/controllers/admin.php +++ b/application/controllers/admin.php @@ -90,6 +90,7 @@ public function __construct() // Themes Helper $this->themes = new Themes(); + $this->themes->admin = TRUE; // Admin is not logged in, or this is a member (not admin) if ( ! $this->auth->logged_in('login')) @@ -118,24 +119,26 @@ public function __construct() // Retrieve Default Settings $this->template->site_name = Kohana::config('settings.site_name'); $this->template->mapstraction = Kohana::config('settings.mapstraction'); - $this->template->api_url = Kohana::config('settings.api_url'); + $this->themes->api_url = Kohana::config('settings.api_url'); // Javascript Header - $this->template->map_enabled = FALSE; - $this->template->datepicker_enabled = FALSE; - $this->template->flot_enabled = FALSE; - $this->template->treeview_enabled = FALSE; - $this->template->protochart_enabled = FALSE; - $this->template->colorpicker_enabled = FALSE; - $this->template->editor_enabled = FALSE; - $this->template->tablerowsort_enabled = FALSE; - $this->template->json2_enabled = FALSE; - $this->template->js = ''; + $this->themes->map_enabled = FALSE; + $this->themes->datepicker_enabled = FALSE; + $this->themes->flot_enabled = FALSE; + $this->themes->treeview_enabled = FALSE; + $this->themes->protochart_enabled = FALSE; + $this->themes->colorpicker_enabled = FALSE; + $this->themes->editor_enabled = FALSE; + $this->themes->tablerowsort_enabled = FALSE; + $this->themes->json2_enabled = FALSE; + $this->themes->hovertip_enabled = TRUE; + $this->themes->slider_enabled = TRUE; + $this->themes->js = ''; $this->template->form_error = FALSE; // Initialize some variables for raphael impact charts - $this->template->raphael_enabled = FALSE; - $this->template->impact_json = ''; + $this->themes->raphael_enabled = FALSE; + $this->themes->impact_json = ''; // Generate main tab navigation list. $this->template->main_tabs = admin::main_tabs(); @@ -152,12 +155,10 @@ public function __construct() $this->template->header_nav->loggedin_role = $this->user->dashboard(); $this->template->header_nav->site_name = Kohana::config('settings.site_name'); - // Header and Footer Blocks - $this->template->header_block = $this->themes->admin_header_block(); - $this->template->footer_block = $this->themes->footer_block(); - // Language switcher $this->template->languages = $this->themes->languages(); + + Event::add('ushahidi_filter.view_pre_render.admin_layout', array($this, '_pre_render')); } public function index() @@ -220,6 +221,18 @@ private function _new_or_not($release_version=NULL, $version_ushahidi=NULL) return TRUE; } + + /** + * Trigger themes->admin_requirements() at the last minute + * + * This is in case features are enabled/disabled + */ + public function _pre_render() + { + $this->themes->requirements(); + $this->template->header_block = $this->themes->header_block(); + $this->template->footer_block = $this->themes->footer_block(); + } } // End Admin diff --git a/application/controllers/admin/addons/plugins.php b/application/controllers/admin/addons/plugins.php index 0080a44817..ee5e5518b4 100644 --- a/application/controllers/admin/addons/plugins.php +++ b/application/controllers/admin/addons/plugins.php @@ -198,7 +198,7 @@ public function index() $this->template->content->status = $status; // Javascript Header - $this->template->js = new View('admin/addons/addons_js'); + $this->themes->js = new View('admin/addons/addons_js'); } } diff --git a/application/controllers/admin/checkins.php b/application/controllers/admin/checkins.php index 0745c5202b..14488fca89 100644 --- a/application/controllers/admin/checkins.php +++ b/application/controllers/admin/checkins.php @@ -111,7 +111,7 @@ function index() $this->template->content->total_items = $pagination->total_items; // Javascript Header - $this->template->js = new View('admin/checkins/checkins_js'); + $this->themes->js = new View('admin/checkins/checkins_js'); } } diff --git a/application/controllers/admin/comments.php b/application/controllers/admin/comments.php index 308e67dd1c..6e760aaf31 100644 --- a/application/controllers/admin/comments.php +++ b/application/controllers/admin/comments.php @@ -186,7 +186,7 @@ function index($page = 1) $this->template->content->status = $status; // Javascript Header - $this->template->js = new View('admin/comments/comments_js'); + $this->themes->js = new View('admin/comments/comments_js'); } } diff --git a/application/controllers/admin/dashboard.php b/application/controllers/admin/dashboard.php index bd8cecbe51..dcda5cc2eb 100644 --- a/application/controllers/admin/dashboard.php +++ b/application/controllers/admin/dashboard.php @@ -96,8 +96,8 @@ public function index() ->find_all(); // Javascript Header - $this->template->protochart_enabled = TRUE; - $this->template->js = new View('admin/stats/stats_js'); + $this->themes->protochart_enabled = TRUE; + $this->themes->js = new View('admin/stats/stats_js'); $this->template->content->failure = ''; diff --git a/application/controllers/admin/manage.php b/application/controllers/admin/manage.php index d8261d0a97..028374389c 100644 --- a/application/controllers/admin/manage.php +++ b/application/controllers/admin/manage.php @@ -351,13 +351,13 @@ public function index() $this->template->content->parents_array = $parents_array; // Javascript Header - $this->template->colorpicker_enabled = TRUE; - $this->template->tablerowsort_enabled = TRUE; - $this->template->js = new View('admin/manage/categories/categories_js'); + $this->themes->colorpicker_enabled = TRUE; + $this->themes->tablerowsort_enabled = TRUE; + $this->themes->js = new View('admin/manage/categories/categories_js'); $this->template->form_error = $form_error; $this->template->content->locale_array = $locales; - $this->template->js->locale_array = $locales; + $this->themes->js->locale_array = $locales; } /** @@ -530,8 +530,8 @@ public function pages() $this->template->content->errors = $errors; // Javascript Header - $this->template->editor_enabled = TRUE; - $this->template->js = new View('admin/manage/pages/pages_js'); + $this->themes->editor_enabled = TRUE; + $this->themes->js = new View('admin/manage/pages/pages_js'); } @@ -634,8 +634,8 @@ public function feeds() $this->template->content->errors = $errors; // Javascript Header - $this->template->colorpicker_enabled = TRUE; - $this->template->js = new View('admin/manage/feeds/feeds_js'); + $this->themes->colorpicker_enabled = TRUE; + $this->themes->js = new View('admin/manage/feeds/feeds_js'); } /** @@ -702,7 +702,7 @@ public function feeds_items() $this->template->content->total_items = $pagination->total_items; // Javascript Header - $this->template->js = new View('admin/manage/feeds/items_js'); + $this->themes->js = new View('admin/manage/feeds/items_js'); } /** @@ -913,8 +913,8 @@ public function layers() $this->template->content->layers = $layers; // Javascript Header - $this->template->colorpicker_enabled = TRUE; - $this->template->js = new View('admin/manage/layers/layers_js'); + $this->themes->colorpicker_enabled = TRUE; + $this->themes->js = new View('admin/manage/layers/layers_js'); } /** diff --git a/application/controllers/admin/manage/actions.php b/application/controllers/admin/manage/actions.php index e47734c2c9..7a755580d5 100644 --- a/application/controllers/admin/manage/actions.php +++ b/application/controllers/admin/manage/actions.php @@ -34,18 +34,18 @@ function index() $this->template->content = new View('admin/manage/actions/main'); $this->template->content->title = Kohana::lang('ui_admin.actions'); - $this->template->map_enabled = TRUE; - $this->template->treeview_enabled = TRUE; + $this->themes->map_enabled = TRUE; + $this->themes->treeview_enabled = TRUE; - $this->template->js = new View('admin/manage/actions/actions_js'); - $this->template->js->default_map = Kohana::config('settings.default_map'); - $this->template->js->default_zoom = Kohana::config('settings.default_zoom'); - $this->template->js->latitude = Kohana::config('settings.default_lat'); - $this->template->js->longitude = Kohana::config('settings.default_lon'); + $this->themes->js = new View('admin/manage/actions/actions_js'); + $this->themes->js->default_map = Kohana::config('settings.default_map'); + $this->themes->js->default_zoom = Kohana::config('settings.default_zoom'); + $this->themes->js->latitude = Kohana::config('settings.default_lat'); + $this->themes->js->longitude = Kohana::config('settings.default_lon'); // TODO: Figure out what to do with this - $this->template->js->incident_zoom = array(); - $this->template->js->geometries = array(); + $this->themes->js->incident_zoom = array(); + $this->themes->js->geometries = array(); $trigger_options = $this->_trigger_options(); $response_options = $this->_response_options(); @@ -265,7 +265,7 @@ function index() $this->template->content->errors = $errors; // Enable date picker - $this->template->datepicker_enabled = TRUE; + $this->themes->datepicker_enabled = TRUE; } function changestate(){ diff --git a/application/controllers/admin/manage/alerts.php b/application/controllers/admin/manage/alerts.php index ce2cb45a8d..ab8dea4221 100644 --- a/application/controllers/admin/manage/alerts.php +++ b/application/controllers/admin/manage/alerts.php @@ -161,6 +161,6 @@ public function index() $this->template->content->keyword = $keyword; // Javascript Header - $this->template->js = new View('admin/manage/alerts/alerts_js'); + $this->themes->js = new View('admin/manage/alerts/alerts_js'); } } \ No newline at end of file diff --git a/application/controllers/admin/manage/badges.php b/application/controllers/admin/manage/badges.php index 23a162b410..79b6ebc040 100644 --- a/application/controllers/admin/manage/badges.php +++ b/application/controllers/admin/manage/badges.php @@ -226,6 +226,6 @@ function index() $this->template->content->users = $users; // Javascript Header - $this->template->js = new View('admin/manage/badges/badges_js'); + $this->themes->js = new View('admin/manage/badges/badges_js'); } } diff --git a/application/controllers/admin/manage/blocks.php b/application/controllers/admin/manage/blocks.php index 73ac5208e2..5724b9892a 100644 --- a/application/controllers/admin/manage/blocks.php +++ b/application/controllers/admin/manage/blocks.php @@ -111,8 +111,8 @@ function index() $this->template->content->sorted_blocks = $sorted_blocks; // Javascript Header - $this->template->tablerowsort_enabled = TRUE; - $this->template->js = new View('admin/manage/blocks/blocks_js'); + $this->themes->tablerowsort_enabled = TRUE; + $this->themes->js = new View('admin/manage/blocks/blocks_js'); } public function sort() diff --git a/application/controllers/admin/manage/forms.php b/application/controllers/admin/manage/forms.php index 3abeda4635..7650a276b0 100755 --- a/application/controllers/admin/manage/forms.php +++ b/application/controllers/admin/manage/forms.php @@ -173,8 +173,8 @@ public function index() $this->template->content->errors = $errors; // Javascript Header - $this->template->js = new View('admin/manage/forms/forms_js'); - $this->template->js->form_id = $form_id; + $this->themes->js = new View('admin/manage/forms/forms_js'); + $this->themes->js->form_id = $form_id; $this->template->form_error = $form_error; } diff --git a/application/controllers/admin/manage/scheduler.php b/application/controllers/admin/manage/scheduler.php index 98db64b0cd..cc437f9802 100644 --- a/application/controllers/admin/manage/scheduler.php +++ b/application/controllers/admin/manage/scheduler.php @@ -197,7 +197,7 @@ function index() $this->template->content->errors = $errors; // Javascript Header - $this->template->js = new View('admin/manage/scheduler/scheduler_js'); + $this->themes->js = new View('admin/manage/scheduler/scheduler_js'); } diff --git a/application/controllers/admin/messages.php b/application/controllers/admin/messages.php index 9c770e97ef..4280331857 100755 --- a/application/controllers/admin/messages.php +++ b/application/controllers/admin/messages.php @@ -245,7 +245,7 @@ public function index($service_id = 1) $this->template->content->level = $level; // Javascript Header - $this->template->js = new View('admin/messages/messages_js'); + $this->themes->js = new View('admin/messages/messages_js'); } /** diff --git a/application/controllers/admin/messages/reporters.php b/application/controllers/admin/messages/reporters.php index 146d1f095c..81a3ef48fc 100644 --- a/application/controllers/admin/messages/reporters.php +++ b/application/controllers/admin/messages/reporters.php @@ -216,12 +216,12 @@ public function index($service_id = 1) $this->template->content->service_array = Service_Model::get_array(); // Javascript Header - $this->template->map_enabled = TRUE; - $this->template->js = new View('admin/reporters/reporters_js'); - $this->template->js->default_map = Kohana::config('settings.default_map'); - $this->template->js->default_zoom = Kohana::config('settings.default_zoom'); - $this->template->js->latitude = Kohana::config('settings.default_lat'); - $this->template->js->longitude = Kohana::config('settings.default_lon'); - $this->template->js->form_error = $form_error; + $this->themes->map_enabled = TRUE; + $this->themes->js = new View('admin/reporters/reporters_js'); + $this->themes->js->default_map = Kohana::config('settings.default_map'); + $this->themes->js->default_zoom = Kohana::config('settings.default_zoom'); + $this->themes->js->latitude = Kohana::config('settings.default_lat'); + $this->themes->js->longitude = Kohana::config('settings.default_lon'); + $this->themes->js->form_error = $form_error; } } diff --git a/application/controllers/admin/reports.php b/application/controllers/admin/reports.php index 30f74883c3..f382db5b3a 100755 --- a/application/controllers/admin/reports.php +++ b/application/controllers/admin/reports.php @@ -300,12 +300,12 @@ public function index($page = 1) $this->template->content->order_field = $order_field; $this->template->content->sort = $sort; - $this->template->map_enabled = TRUE; - $this->template->json2_enabled = TRUE; - $this->template->treeview_enabled = TRUE; + $this->themes->map_enabled = TRUE; + $this->themes->json2_enabled = TRUE; + $this->themes->treeview_enabled = TRUE; // Javascript Header - $this->template->js = new View('admin/reports/reports_js'); + $this->themes->js = new View('admin/reports/reports_js'); } /** @@ -804,29 +804,29 @@ public function edit($id = FALSE, $saved = FALSE) $this->template->content->next_url = $next_url; // Javascript Header - $this->template->map_enabled = TRUE; - $this->template->colorpicker_enabled = TRUE; - $this->template->treeview_enabled = TRUE; - $this->template->json2_enabled = TRUE; + $this->themes->map_enabled = TRUE; + $this->themes->colorpicker_enabled = TRUE; + $this->themes->treeview_enabled = TRUE; + $this->themes->json2_enabled = TRUE; - $this->template->js = new View('reports/submit_edit_js'); - $this->template->js->edit_mode = TRUE; - $this->template->js->default_map = Kohana::config('settings.default_map'); - $this->template->js->default_zoom = Kohana::config('settings.default_zoom'); + $this->themes->js = new View('reports/submit_edit_js'); + $this->themes->js->edit_mode = TRUE; + $this->themes->js->default_map = Kohana::config('settings.default_map'); + $this->themes->js->default_zoom = Kohana::config('settings.default_zoom'); if ( ! $form['latitude'] OR !$form['latitude']) { - $this->template->js->latitude = Kohana::config('settings.default_lat'); - $this->template->js->longitude = Kohana::config('settings.default_lon'); + $this->themes->js->latitude = Kohana::config('settings.default_lat'); + $this->themes->js->longitude = Kohana::config('settings.default_lon'); } else { - $this->template->js->latitude = $form['latitude']; - $this->template->js->longitude = $form['longitude']; + $this->themes->js->latitude = $form['latitude']; + $this->themes->js->longitude = $form['longitude']; } - $this->template->js->incident_zoom = $form['incident_zoom']; - $this->template->js->geometries = $form['geometry']; + $this->themes->js->incident_zoom = $form['incident_zoom']; + $this->themes->js->geometries = $form['geometry']; // Inline Javascript $this->template->content->date_picker_js = $this->_date_picker_js(); @@ -834,8 +834,8 @@ public function edit($id = FALSE, $saved = FALSE) $this->template->content->new_category_toggle_js = $this->_new_category_toggle_js(); // Pack Javascript - $myPacker = new javascriptpacker($this->template->js , 'Normal', FALSE, FALSE); - $this->template->js = $myPacker->pack(); + $myPacker = new javascriptpacker($this->themes->js , 'Normal', FALSE, FALSE); + $this->themes->js = $myPacker->pack(); } @@ -862,7 +862,7 @@ public function download() 'to_date' => '', 'form_auth_token'=> '' ); - + // Default to all selected $form['data_active'] = array(0,1); $form['data_verified'] = array(0,1); @@ -963,31 +963,31 @@ public function download() // Retrieve reports $incidents = ORM::factory('incident')->where($filter)->orderby('incident_dateadd', 'desc')->find_all(); - + // Retrieve categories $categories = Category_Model::get_categories(FALSE, FALSE, FALSE); - + // Retrieve Forms $forms = ORM::Factory('form')->find_all(); - + // Retrieve Custom forms $custom_forms = customforms::get_custom_form_fields(); // If CSV format is selected if($post->format == 'csv') - { + { $report_csv = download::download_csv($post, $incidents, $custom_forms); + + // Output to browser + header("Content-type: text/x-csv"); + header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); + header("Content-Disposition: attachment; filename=" . time() . ".csv"); + header("Content-Length: " . strlen($report_csv)); + echo $report_csv; + exit; - // Output to browser - header("Content-type: text/x-csv"); - header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); - header("Content-Disposition: attachment; filename=" . time() . ".csv"); - header("Content-Length: " . strlen($report_csv)); - echo $report_csv; - exit; - - } - + } + // If XML format is selected if($post->format == 'xml') { @@ -1017,8 +1017,8 @@ public function download() $this->template->content->form_error = $form_error; // Javascript Header - $this->template->js = new View('admin/reports/download_js'); - $this->template->js->calendar_img = url::base() . "media/img/icon-calendar.gif"; + $this->themes->js = new View('admin/reports/download_js'); + $this->themes->js->calendar_img = url::base() . "media/img/icon-calendar.gif"; } public function upload() @@ -1051,14 +1051,14 @@ public function upload() ->add_rules('uploadfile', 'upload::valid', 'upload::required', 'upload::type[xml,csv]', 'upload::size[3M]'); if($post->validate(TRUE)) - { + { // Establish if file to be uploaded is .xml or .csv format $fileinfo = pathinfo($post['uploadfile']['name']); $extension = $fileinfo['extension']; $allowable_extensions = array ('csv', 'xml'); - + if (file_exists($_FILES['uploadfile']['tmp_name'])) - { + { // If file type uploaded is CSV or XML if (in_array($extension, $allowable_extensions)) { @@ -1076,7 +1076,7 @@ public function upload() else { $errors = $importer->errors; - } + } } else @@ -1097,11 +1097,11 @@ public function upload() foreach($post->errors('reports') as $error) { $errors[] = $error; - } - + } + } - if ( count($errors)) + if (count($errors)) { $this->template->content = new View('admin/reports/upload'); $this->template->content->title = Kohana::lang('ui_admin.upload_reports'); diff --git a/application/controllers/admin/settings.php b/application/controllers/admin/settings.php index 4d4aa1b76a..b1fd48fb37 100755 --- a/application/controllers/admin/settings.php +++ b/application/controllers/admin/settings.php @@ -41,7 +41,7 @@ public function site() { $this->template->content = new View('admin/settings/site'); $this->template->content->title = Kohana::lang('ui_admin.settings'); - $this->template->js = new View('admin/settings/site_js'); + $this->themes->js = new View('admin/settings/site_js'); // setup and initialize form field names $form = array( @@ -290,8 +290,8 @@ public function site() $this->template->content->banner_t = NULL; } - - $this->template->colorpicker_enabled = TRUE; + $this->themes->colorpicker_enabled = TRUE; + $this->themes->slider_enabled = TRUE; $this->template->content->form = $form; $this->template->content->errors = $errors; $this->template->content->form_error = $form_error; @@ -341,7 +341,7 @@ public function site() public function index($saved = false) { // Display all maps - $this->template->api_url = Kohana::config('settings.api_url_all'); + $this->themes->api_url = Kohana::config('settings.api_url_all'); // Current Default Country $current_country = Kohana::config('settings.default_country'); @@ -590,14 +590,14 @@ public function index($saved = false) '0'=>utf8::strtoupper(Kohana::lang('ui_main.no'))); // Javascript Header - $this->template->map_enabled = TRUE; - $this->template->colorpicker_enabled = TRUE; - $this->template->js = new View('admin/settings/settings_js'); - $this->template->js->default_map = $form['default_map']; - $this->template->js->default_zoom = $form['default_zoom']; - $this->template->js->default_lat = $form['default_lat']; - $this->template->js->default_lon = $form['default_lon']; - $this->template->js->all_maps_json = $this->_generate_settings_map_js(); + $this->themes->map_enabled = TRUE; + $this->themes->colorpicker_enabled = TRUE; + $this->themes->js = new View('admin/settings/settings_js'); + $this->themes->js->default_map = $form['default_map']; + $this->themes->js->default_zoom = $form['default_zoom']; + $this->themes->js->default_lat = $form['default_lat']; + $this->themes->js->default_lon = $form['default_lon']; + $this->themes->js->all_maps_json = $this->_generate_settings_map_js(); } @@ -787,7 +787,7 @@ public function email() $this->template->content->email_ssl_array = array('1'=>Kohana::lang('ui_admin.yes'),'0'=>Kohana::lang('ui_admin.no')); // Javascript Header - $this->template->js = new View('admin/settings/email_js'); + $this->themes->js = new View('admin/settings/email_js'); } /** @@ -878,7 +878,7 @@ public function cleanurl() { $this->template->content->form_error = $form_error; $this->template->content->form_saved = $form_saved; $this->template->content->yesno_array = array('1'=>utf8::strtoupper(Kohana::lang('ui_main.yes')),'0'=>utf8::strtoupper(Kohana::lang('ui_main.no'))); - $this->template->content->is_clean_url_enabled = $this->_check_for_clean_url(); + $this->themes->content->is_clean_url_enabled = $this->_check_for_clean_url(); } diff --git a/application/controllers/admin/settings/api.php b/application/controllers/admin/settings/api.php index 98a448f13d..e089742139 100644 --- a/application/controllers/admin/settings/api.php +++ b/application/controllers/admin/settings/api.php @@ -149,7 +149,7 @@ public function index() ); // Javascript header - $this->template->js = new View('admin/settings/api/api_js'); + $this->themes->js = new View('admin/settings/api/api_js'); } /** @@ -267,7 +267,7 @@ public function log() $this->template->content->pagination = $pagination; // Javascript header - $this->template->js = new View('admin/settings/api/logs_js'); + $this->themes->js = new View('admin/settings/api/logs_js'); } /** @@ -349,6 +349,6 @@ public function banned() $this->template->content->pagination = $pagination; // Javascript header - $this->template->js = new View('admin/settings/api/banned_js'); + $this->themes->js = new View('admin/settings/api/banned_js'); } } diff --git a/application/controllers/admin/settings/externalapps.php b/application/controllers/admin/settings/externalapps.php index 2e33ea1986..d8fd31560f 100644 --- a/application/controllers/admin/settings/externalapps.php +++ b/application/controllers/admin/settings/externalapps.php @@ -99,7 +99,7 @@ function index() $this->template->content->form_saved = $form_saved; // Javascript Header - $this->template->js = new View('admin/settings/externalapps/externalapps_js'); + $this->themes->js = new View('admin/settings/externalapps/externalapps_js'); } } diff --git a/application/controllers/admin/stats.php b/application/controllers/admin/stats.php index f5606c74fb..8f2938d0e1 100644 --- a/application/controllers/admin/stats.php +++ b/application/controllers/admin/stats.php @@ -55,8 +55,8 @@ public function reports() $this->template->content->title = Kohana::lang('ui_admin.statistics'); // Javascript Header - $this->template->protochart_enabled = TRUE; - $this->template->js = new View('admin/stats/stats_js'); + $this->themes->protochart_enabled = TRUE; + $this->themes->js = new View('admin/stats/stats_js'); $this->template->content->failure = ''; @@ -192,8 +192,8 @@ public function impact() $this->template->content->title = Kohana::lang('ui_admin.statistics'); // Javascript Header - $this->template->raphael_enabled = TRUE; - $this->template->js = new View('admin/stats/stats_js'); + $this->themes->raphael_enabled = TRUE; + $this->themes->js = new View('admin/stats/stats_js'); $this->template->content->failure = ''; @@ -298,8 +298,8 @@ public function hits() $this->template->content->title = Kohana::lang('ui_admin.statistics'); // Javascript Header - $this->template->protochart_enabled = TRUE; - $this->template->js = new View('admin/stats/stats_js'); + $this->themes->protochart_enabled = TRUE; + $this->themes->js = new View('admin/stats/stats_js'); $this->template->content->failure = ''; @@ -372,7 +372,7 @@ function country() $this->template->content->title = Kohana::lang('ui_admin.statistics'); // Javascript Header - $this->template->js = new View('admin/stats/stats_js'); + $this->themes->js = new View('admin/stats/stats_js'); $this->template->content->failure = ''; diff --git a/application/controllers/admin/upgrade.php b/application/controllers/admin/upgrade.php index deffd3ce23..9b6673a9e1 100644 --- a/application/controllers/admin/upgrade.php +++ b/application/controllers/admin/upgrade.php @@ -76,8 +76,8 @@ public function index() { $this->upgrade->logger("STARTED UPGRADE\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); $this->template->content = new View('admin/upgrade/upgrade_status'); - $this->template->js = new View('admin/upgrade/upgrade_status_js'); - $this->template->js->backup = $post->chk_db_backup_box; + $this->themes->js = new View('admin/upgrade/upgrade_status_js'); + $this->themes->js->backup = $post->chk_db_backup_box; $this->template->content->title = Kohana::lang('ui_admin.upgrade_ushahidi_status'); $this->session->set('ftp_server', $post->ftp_server); @@ -88,12 +88,12 @@ public function index() Settings_Model::save_setting('ftp_user_name', $post->ftp_user_name); // Log file location - $this->template->js->log_file = url::site(). "admin/upgrade/logfile?f=".$this->session->get('upgrade_session').".txt"; + $this->themes->js->log_file = url::site(). "admin/upgrade/logfile?f=".$this->session->get('upgrade_session').".txt"; } // No! We have validation errors, we need to show the form again, with the errors else { - $this->template->js = new View('admin/upgrade/upgrade_js'); + $this->themes->js = new View('admin/upgrade/upgrade_js'); // repopulate the form fields $form = arr::overwrite($form, $post->as_array()); @@ -105,7 +105,7 @@ public function index() } else { - $this->template->js = new View('admin/upgrade/upgrade_js'); + $this->themes->js = new View('admin/upgrade/upgrade_js'); } $this->template->content->ftp_server = Settings_Model::get_setting('ftp_server'); diff --git a/application/controllers/admin/users.php b/application/controllers/admin/users.php index d3f2d36cd6..f0d2d0cb27 100755 --- a/application/controllers/admin/users.php +++ b/application/controllers/admin/users.php @@ -35,7 +35,7 @@ public function __construct() public function index() { $this->template->content = new View('admin/users/main'); - $this->template->js = new View('admin/users/users_js'); + $this->themes->js = new View('admin/users/users_js'); // Check, has the form been submitted, if so, setup validation if ($_POST) @@ -337,7 +337,7 @@ public function roles() $this->template->content->form_error = $form_error; $this->template->content->form_saved = $form_saved; $this->template->content->form_action = $form_action; - $this->template->js = new View('admin/users/roles_js'); + $this->themes->js = new View('admin/users/roles_js'); } /** diff --git a/application/controllers/alerts.php b/application/controllers/alerts.php index 37e3621e56..13f544aa8e 100644 --- a/application/controllers/alerts.php +++ b/application/controllers/alerts.php @@ -162,9 +162,6 @@ public function index() $this->themes->js->latitude = $form['alert_lat']; $this->themes->js->longitude = $form['alert_lon']; - // Rebuild Header Block - $this->template->header->header_block = $this->themes->header_block(); - $this->template->footer->footer_block = $this->themes->footer_block(); } @@ -192,10 +189,6 @@ public function confirm() // Hide Mobile $this->template->content->show_mobile = FALSE; } - - // Rebuild Header Block - $this->template->header->header_block = $this->themes->header_block(); - $this->template->footer->footer_block = $this->themes->footer_block(); } @@ -274,9 +267,6 @@ public function verify() $this->template->content->errno = ER_CODE_NOT_FOUND; } - // Rebuild Header Block - $this->template->header->header_block = $this->themes->header_block(); - $this->template->footer->footer_block = $this->themes->footer_block(); } // END function verify @@ -298,9 +288,6 @@ public function unsubscribe($code = NULL) $this->template->content->unsubscribed = TRUE; } - // Rebuild Header Block - $this->template->header->header_block = $this->themes->header_block(); - $this->template->footer->footer_block = $this->themes->footer_block(); } /** diff --git a/application/controllers/contact.php b/application/controllers/contact.php index d14e17c4f5..30fb4f4d17 100644 --- a/application/controllers/contact.php +++ b/application/controllers/contact.php @@ -108,10 +108,6 @@ public function index() $this->template->content->form_error = $form_error; $this->template->content->form_sent = $form_sent; $this->template->content->captcha = $captcha; - - // Rebuild Header Block - $this->template->header->header_block = $this->themes->header_block(); - $this->template->footer->footer_block = $this->themes->footer_block(); } } diff --git a/application/controllers/feeds.php b/application/controllers/feeds.php index 0594eda526..de44c0b1fe 100644 --- a/application/controllers/feeds.php +++ b/application/controllers/feeds.php @@ -77,10 +77,5 @@ public function index() { $this->template->content->pagination_stats = $pagination->total_items.' '.Kohana::lang('ui_admin.feeds'); } - - // Rebuild Header Block - $this->template->header->header_block = $this->themes->header_block(); - $this->template->footer->footer_block = $this->themes->footer_block(); - } } diff --git a/application/controllers/main.php b/application/controllers/main.php index fad69ff0da..3cd27c5eed 100644 --- a/application/controllers/main.php +++ b/application/controllers/main.php @@ -70,12 +70,12 @@ public function __construct() // Themes Helper $this->themes = new Themes(); + $this->themes->requirements(); + $this->themes->frontend = TRUE; $this->themes->api_url = Kohana::config('settings.api_url'); $this->template->header->submit_btn = $this->themes->submit_btn(); $this->template->header->languages = $this->themes->languages(); $this->template->header->search = $this->themes->search(); - $this->template->header->header_block = $this->themes->header_block(); - $this->template->footer->footer_block = $this->themes->footer_block(); // Set Table Prefix $this->table_prefix = Kohana::config('database.default.table_prefix'); @@ -135,6 +135,8 @@ public function __construct() $this->template->header->header_nav->loggedin_user = Auth::instance()->get_user(); } $this->template->header->header_nav->site_name = Kohana::config('settings.site_name'); + + Event::add('ushahidi_filter.view_pre_render.layout', array($this, '_pre_render')); } /** @@ -411,7 +413,12 @@ public function index() // Javascript Header $this->themes->map_enabled = TRUE; - $this->themes->main_page = TRUE; + $this->themes->slider_enabled = TRUE; + + if (Kohana::config('settings.enable_timeline')) + { + $this->themes->timeline_enabled = TRUE; + } // Map Settings $marker_radius = Kohana::config('map.marker_radius'); @@ -442,8 +449,16 @@ public function index() $this->themes->js->active_endDate = $display_endDate; $this->themes->js->blocks_per_row = Kohana::config('settings.blocks_per_row'); - - // Build Header and Footer Blocks + } + + /** + * Trigger themes->requirements() at the last minute + * + * This is in case features are enabled/disabled + */ + public function _pre_render() + { + $this->themes->requirements(); $this->template->header->header_block = $this->themes->header_block(); $this->template->footer->footer_block = $this->themes->footer_block(); } diff --git a/application/controllers/members.php b/application/controllers/members.php index 8c5de566d3..88826e3da9 100644 --- a/application/controllers/members.php +++ b/application/controllers/members.php @@ -58,6 +58,10 @@ public function __construct() url::redirect('/'); } + // Themes Helper + $this->themes = new Themes(); + $this->themes->admin = TRUE; + // Set Table Prefix $this->table_prefix = Kohana::config('database.default.table_prefix'); @@ -65,24 +69,25 @@ public function __construct() // Retrieve Default Settings $this->template->site_name = Kohana::config('settings.site_name'); - $this->template->api_url = Kohana::config('settings.api_url'); + $this->themes->api_url = Kohana::config('settings.api_url'); // Javascript Header - $this->template->map_enabled = FALSE; - $this->template->flot_enabled = FALSE; - $this->template->treeview_enabled = FALSE; - $this->template->protochart_enabled = FALSE; - $this->template->colorpicker_enabled = FALSE; - $this->template->editor_enabled = FALSE; - $this->template->tablerowsort_enabled = FALSE; - $this->template->autocomplete_enabled = FALSE; - $this->template->json2_enabled = FALSE; - $this->template->js = ''; + $this->themes->map_enabled = FALSE; + $this->themes->flot_enabled = FALSE; + $this->themes->treeview_enabled = FALSE; + $this->themes->protochart_enabled = FALSE; + $this->themes->colorpicker_enabled = FALSE; + $this->themes->editor_enabled = FALSE; + $this->themes->tablerowsort_enabled = FALSE; + $this->themes->autocomplete_enabled = FALSE; + $this->themes->json2_enabled = FALSE; + $this->themes->js = ''; + $this->template->form_error = FALSE; // Initialize some variables for raphael impact charts - $this->template->raphael_enabled = FALSE; - $this->template->impact_json = ''; + $this->themes->raphael_enabled = FALSE; + $this->themes->impact_json = ''; // Generate main tab navigation list. $this->template->main_tabs = members::main_tabs(); @@ -100,12 +105,26 @@ public function __construct() $this->template->header_nav->loggedin_user = Auth::instance()->get_user(); } $this->template->header_nav->site_name = Kohana::config('settings.site_name'); - } + + Event::add('ushahidi_filter.view_pre_render.members_layout', array($this, '_pre_render')); + } public function index() { url::redirect('members/dashboard'); } + + /** + * Trigger themes->admin_requirements() at the last minute + * + * This is in case features are enabled/disabled + */ + public function _pre_render() + { + $this->themes->requirements(); + $this->template->header_block = $this->themes->header_block(); + $this->template->footer_block = $this->themes->footer_block(); + } } // End Admin diff --git a/application/controllers/members/alerts.php b/application/controllers/members/alerts.php index b987ad7537..cf61be0ce8 100644 --- a/application/controllers/members/alerts.php +++ b/application/controllers/members/alerts.php @@ -127,6 +127,6 @@ public function index() $this->template->content->total_items = $pagination->total_items; // Javascript Header - $this->template->js = new View('members/alerts_js'); + $this->themes->js = new View('members/alerts_js'); } } diff --git a/application/controllers/members/checkins.php b/application/controllers/members/checkins.php index b2d44e501e..69b3531005 100644 --- a/application/controllers/members/checkins.php +++ b/application/controllers/members/checkins.php @@ -100,7 +100,7 @@ public function index($page = 1) $this->template->content->total_items = $pagination->total_items; // Javascript Header - $this->template->map_enabled = TRUE; - $this->template->js = new View('members/checkins_js'); + $this->themes->map_enabled = TRUE; + $this->themes->js = new View('members/checkins_js'); } } diff --git a/application/controllers/members/dashboard.php b/application/controllers/members/dashboard.php index 853726f895..3b497421c9 100644 --- a/application/controllers/members/dashboard.php +++ b/application/controllers/members/dashboard.php @@ -101,8 +101,8 @@ function index() ); // Javascript Header - $this->template->protochart_enabled = TRUE; - $this->template->js = new View('admin/stats/stats_js'); + $this->themes->protochart_enabled = TRUE; + $this->themes->js = new View('admin/stats/stats_js'); $this->template->content->failure = ''; diff --git a/application/controllers/members/private.php b/application/controllers/members/private.php index 6464c8c65b..431c930209 100644 --- a/application/controllers/members/private.php +++ b/application/controllers/members/private.php @@ -145,7 +145,7 @@ public function index($page = 1) $this->template->content->total_items = $pagination->total_items; // Javascript Header - $this->template->js = new View('members/private_js'); + $this->themes->js = new View('members/private_js'); } /** @@ -258,8 +258,8 @@ public function send() $this->template->content->form_saved = $form_saved; // Javascript Header - $this->template->autocomplete_enabled = TRUE; - $this->template->js = new View('members/private_send_js'); + $this->themes->autocomplete_enabled = TRUE; + $this->themes->js = new View('members/private_send_js'); } /** diff --git a/application/controllers/members/profile.php b/application/controllers/members/profile.php index d46b403fb9..b9f7a2f7b0 100644 --- a/application/controllers/members/profile.php +++ b/application/controllers/members/profile.php @@ -179,7 +179,7 @@ public function index() $this->template->content->yesno_array = array('1'=>utf8::strtoupper(Kohana::lang('ui_main.yes')),'0'=>utf8::strtoupper(Kohana::lang('ui_main.no'))); // Javascript Header - $this->template->colorpicker_enabled = TRUE; + $this->themes->colorpicker_enabled = TRUE; } /** diff --git a/application/controllers/members/reports.php b/application/controllers/members/reports.php index 3ca54745e4..c7bef29d9b 100755 --- a/application/controllers/members/reports.php +++ b/application/controllers/members/reports.php @@ -230,7 +230,7 @@ public function index($page = 1) $this->template->content->status = $status; // Javascript Header - $this->template->js = new View('admin/reports/reports_js'); + $this->themes->js = new View('admin/reports/reports_js'); } @@ -569,37 +569,37 @@ public function edit($id = FALSE, $saved = FALSE) $this->template->content->next_url = $next_url; // Javascript Header - $this->template->map_enabled = TRUE; - $this->template->colorpicker_enabled = TRUE; - $this->template->treeview_enabled = TRUE; - $this->template->json2_enabled = TRUE; + $this->themes->map_enabled = TRUE; + $this->themes->colorpicker_enabled = TRUE; + $this->themes->treeview_enabled = TRUE; + $this->themes->json2_enabled = TRUE; - $this->template->js = new View('reports/submit_edit_js'); - $this->template->js->edit_mode = FALSE; - $this->template->js->default_map = Kohana::config('settings.default_map'); - $this->template->js->default_zoom = Kohana::config('settings.default_zoom'); + $this->themes->js = new View('reports/submit_edit_js'); + $this->themes->js->edit_mode = FALSE; + $this->themes->js->default_map = Kohana::config('settings.default_map'); + $this->themes->js->default_zoom = Kohana::config('settings.default_zoom'); if ( ! $form['latitude'] OR ! $form['latitude']) { - $this->template->js->latitude = Kohana::config('settings.default_lat'); - $this->template->js->longitude = Kohana::config('settings.default_lon'); + $this->themes->js->latitude = Kohana::config('settings.default_lat'); + $this->themes->js->longitude = Kohana::config('settings.default_lon'); } else { - $this->template->js->latitude = $form['latitude']; - $this->template->js->longitude = $form['longitude']; + $this->themes->js->latitude = $form['latitude']; + $this->themes->js->longitude = $form['longitude']; } - $this->template->js->incident_zoom = $form['incident_zoom']; - $this->template->js->geometries = $form['geometry']; + $this->themes->js->incident_zoom = $form['incident_zoom']; + $this->themes->js->geometries = $form['geometry']; // Inline Javascript $this->template->content->date_picker_js = $this->_date_picker_js(); $this->template->content->color_picker_js = $this->_color_picker_js(); // Pack Javascript - $myPacker = new javascriptpacker($this->template->js , 'Normal', FALSE, FALSE); - $this->template->js = $myPacker->pack(); + $myPacker = new javascriptpacker($this->themes->js , 'Normal', FALSE, FALSE); + $this->themes->js = $myPacker->pack(); } diff --git a/application/controllers/page.php b/application/controllers/page.php index 5835cfae5c..86cbb9679c 100644 --- a/application/controllers/page.php +++ b/application/controllers/page.php @@ -51,9 +51,6 @@ public function index($page_id = 1) } $this->template->header->page_title .= $page_title.Kohana::config('settings.title_delimiter'); - - $this->template->header->header_block = $this->themes->header_block(); - $this->template->footer->footer_block = $this->themes->footer_block(); } } diff --git a/application/controllers/profile.php b/application/controllers/profile.php index 91c04428f4..697e31f4f6 100644 --- a/application/controllers/profile.php +++ b/application/controllers/profile.php @@ -34,9 +34,6 @@ public function index() $this->template->content->users = User_Model::get_public_users(); $this->template->header->page_title .= Kohana::lang('ui_main.browse_profiles').Kohana::config('settings.title_delimiter'); - - $this->template->header->header_block = $this->themes->header_block(); - $this->template->footer->footer_block = $this->themes->footer_block(); } /** @@ -104,9 +101,6 @@ public function user() } $this->template->header->page_title .= $user->name.Kohana::config('settings.title_delimiter'); - - $this->template->header->header_block = $this->themes->header_block(); - $this->template->footer->footer_block = $this->themes->footer_block(); } } // End Profile diff --git a/application/controllers/reports.php b/application/controllers/reports.php index 28897a6a45..157d096150 100755 --- a/application/controllers/reports.php +++ b/application/controllers/reports.php @@ -144,9 +144,6 @@ public function index() $this->template->content->report_stats->avg_reports_per_day = $avg_reports_per_day; $this->template->content->report_stats->percent_verified = $percent_verified; $this->template->content->services = Service_Model::get_array(); - - $this->template->header->header_block = $this->themes->header_block(); - $this->template->footer->footer_block = $this->themes->footer_block(); } /** @@ -412,10 +409,6 @@ public function submit($id = FALSE, $saved = FALSE) } $this->themes->js->geometries = $form['geometry']; - - // Rebuild Header Block - $this->template->header->header_block = $this->themes->header_block(); - $this->template->footer->footer_block = $this->themes->footer_block(); } /** @@ -727,10 +720,6 @@ public function view($id = FALSE) // If the Admin is Logged in - Allow for an edit link $this->template->content->logged_in = $this->logged_in; - - // Rebuild Header Block - $this->template->header->header_block = $this->themes->header_block(); - $this->template->footer->footer_block = $this->themes->footer_block(); } /** @@ -740,10 +729,6 @@ public function thanks() { $this->template->header->this_page = 'reports_submit'; $this->template->content = new View('reports/submit_thanks'); - - // Rebuild Header Block - $this->template->header->header_block = $this->themes->header_block(); - $this->template->footer->footer_block = $this->themes->footer_block(); } /** diff --git a/application/controllers/search.php b/application/controllers/search.php index 2288fdab9a..940276e00f 100644 --- a/application/controllers/search.php +++ b/application/controllers/search.php @@ -216,9 +216,5 @@ public function index($page = 1) $this->template->content->search_info = $search_info; $this->template->content->search_results = $html; - - // Rebuild Header Block - $this->template->header->header_block = $this->themes->header_block(); - $this->template->footer->footer_block = $this->themes->footer_block(); } } diff --git a/application/helpers/addon.php b/application/helpers/addon.php index f8c1a98b48..b128813f53 100644 --- a/application/helpers/addon.php +++ b/application/helpers/addon.php @@ -46,7 +46,10 @@ public static function get_addons($type, $include_meta = TRUE) 'Author' => "", 'Author Email' => "", 'Template_Dir' => "", - 'Checkins' => 0 + 'Checkins' => 0, + 'Base Theme' => 'default', + 'CSS' => '', + 'JS' => '', ); } diff --git a/application/helpers/cdn.php b/application/helpers/cdn.php index cc6a82df58..fe61489dfb 100644 --- a/application/helpers/cdn.php +++ b/application/helpers/cdn.php @@ -49,14 +49,14 @@ private static function connection() * @param string $filename Name of the file to be uploaded * @return string */ - public static function upload($filename) + public static function upload($filename, $appendUploadDir = TRUE) { try { self::connection(); // Upload to the CDN and return new filename - return self::$cdn->upload($filename); + return self::$cdn->upload($filename, $appendUploadDir); } catch (Exception $e) { diff --git a/application/helpers/plugin.php b/application/helpers/plugin.php index fe71cda7e0..f94f8a3654 100644 --- a/application/helpers/plugin.php +++ b/application/helpers/plugin.php @@ -10,16 +10,6 @@ */ class plugin_Core { - /** - * @var array - */ - protected static $javascripts = array(); - - /** - * @var array - */ - protected static $stylesheets = array(); - /** * @var array */ @@ -32,12 +22,16 @@ class plugin_Core { */ public static function add_javascript($javascripts = array()) { - if ( ! is_array($javascripts)) - $javascripts = array($javascripts); - - foreach ($javascripts as $key => $javascript) + if (is_array($javascripts)) + { + foreach($javascripts as $javascript) + { + Requirements::js('plugins/'.$javascript.'.js'); + } + } + else { - self::$javascripts[] = $javascript; + Requirements::js('plugins/'.$javascripts.'.js'); } } @@ -49,10 +43,9 @@ public static function add_javascript($javascripts = array()) */ public static function remove_javascript($javascripts = array()) { - foreach (self::$javascripts as $key => $javascript) + foreach ($javascripts as $javascript) { - if (in_array($javascript, $javascripts)) - unset(self::$javascripts[$key]); + Requirements::block('plugins/'.$javascripts.'.js'); } } @@ -64,12 +57,16 @@ public static function remove_javascript($javascripts = array()) */ public static function add_stylesheet($stylesheets = array()) { - if ( ! is_array($stylesheets)) - $stylesheets = array($stylesheets); - - foreach ($stylesheets as $key => $stylesheet) + if (is_array($stylesheets)) { - self::$stylesheets[] = $stylesheet; + foreach($stylesheets as $stylesheet) + { + Requirements::css('plugins/'.$stylesheet.'.css'); + } + } + else + { + Requirements::css('plugins/'.$stylesheets.'.css'); } } @@ -89,43 +86,6 @@ public static function add_sms_provider($sms_providers = array()) } } - /** - * Adds a the stylesheet/javascript to the header of the view file - * - * @param string $type - */ - public static function render($type) - { - $files = $type.'s'; - - $html = ''; - - foreach (self::$$files as $key => $file) - { - switch ($type) - { - case 'stylesheet': - if (substr_compare($file, '.css', -3, 3, FALSE) !== 0) - { - // Add the javascript suffix - $file .= '.css'; - } - $html .= ''; - break; - case 'javascript': - if (substr_compare($file, '.js', -3, 3, FALSE) !== 0) - { - // Add the javascript suffix - $file .= '.js'; - } - $html .= ''; - break; - } - } - - return $html; - } - /** * Rettuns the list of SMS providers * diff --git a/application/helpers/ush_locale.php b/application/helpers/ush_locale.php index 3c3ddd362e..6f55188580 100644 --- a/application/helpers/ush_locale.php +++ b/application/helpers/ush_locale.php @@ -213,6 +213,22 @@ public static function language($iso639) } } + /** + * Is a language written Right-to-left + * @param $locale + */ + public static function is_rtl_language($locale = NULL) + { + // Check for text direction override + if (Kohana::config('locale.force_text_direction') == 'rtl') return TRUE; + if (Kohana::config('locale.force_text_direction') == 'ltr') return FALSE; + + // Check for special translation string 'ui_main.text_direction' + if (Kohana::lang('core.text_direction', $locale) == 'rtl') return TRUE; + + return FALSE; + } + /** * @param string ISO-3166 country code */ @@ -530,9 +546,8 @@ public static function get_i18n($refresh = FALSE) /** * Detect language from GET param, session or settings. - * @param string */ - public static function detect_language($language = FALSE) + public static function detect_language() { // Locale form submitted? if (isset($_GET['l']) && !empty($_GET['l'])) diff --git a/application/hooks/2_settings.php b/application/hooks/2_settings.php index 6516640890..1a680f59e2 100644 --- a/application/hooks/2_settings.php +++ b/application/hooks/2_settings.php @@ -42,10 +42,9 @@ $default_map = isset($settings['default_map']) ? $settings['default_map'] : 'osm_mapnik'; $map_layer = map::base($default_map); -if (isset($map_layer->api_url) AND $map_layer->api_url != '') +if (! empty($map_layer->api_url)) { - Kohana::config_set('settings.api_url', - ""); + Kohana::config_set('settings.api_url', $map_layer->api_url); } // And in case you want to display all maps on one page... @@ -54,9 +53,9 @@ { if (empty($layer->api_url)) continue; // Add to array, use url as key to avoid dupes - $api_url_all[$layer->api_url] = ''; + $api_url_all[$layer->api_url] = $layer->api_url; } -Kohana::config_set('settings.api_url_all', implode("\n",$api_url_all)); +Kohana::config_set('settings.api_url_all', $api_url_all); // Additional Mime Types (KMZ/KML) Kohana::config_set('mimes.kml', array('text/xml')); diff --git a/application/hooks/register_themes.php b/application/hooks/register_themes.php index f71eb79045..f2373ac0bc 100755 --- a/application/hooks/register_themes.php +++ b/application/hooks/register_themes.php @@ -14,6 +14,13 @@ */ class register_themes { + + protected $themes = array(); + protected $loaded_themes = array(); + + protected $theme_js = array(); + protected $theme_css = array(); + /** * Adds the register method to load after system.ready */ @@ -22,68 +29,9 @@ public function __construct() // Hook into routing if (Kohana::config('config.installer_check') == FALSE OR file_exists(DOCROOT."application/config/database.php")) { - Event::add('system.ready', array($this, 'register')); + Event::add('system.ready', array('Themes', 'register_theme')); } } - - /** - * Loads ushahidi themes - */ - public function register() - { - // Array to hold all the CSS files - $theme_css = array(); - // Array to hold all the Javascript files - $theme_js = array(); - - // 1. Load the default theme - Kohana::config_set('core.modules', array_merge(array(THEMEPATH."default"), - Kohana::config("core.modules"))); - $theme_css[] = url::file_loc('css')."themes/default/css/style.css"; - - // 2. Extend the default theme - $theme = THEMEPATH.Kohana::config("settings.site_style"); - if ( Kohana::config("settings.site_style") != "default" ) - { - Kohana::config_set('core.modules', array_merge(array($theme), - Kohana::config("core.modules"))); - - if ( is_dir($theme.'/css') ) - { - $css = dir($theme.'/css'); // Load all the themes css files - while (($css_file = $css->read()) !== FALSE) - if (preg_match('/\.css/i', $css_file)) - { - $theme_css[] = url::file_loc('css')."themes/".Kohana::config("settings.site_style")."/css/".$css_file; - } - } - - if ( is_dir($theme.'/js') ) - { - $js = dir($theme.'/js'); // Load all the themes js files - while (($js_file = $js->read()) !== FALSE) - if (preg_match('/\.js/i', $js_file)) - { - $theme_js[] = url::base()."themes/".Kohana::config("settings.site_style")."/js/".$js_file; - } - } - } - - // 3. Find and add hooks - // We need to manually include the hook file for each theme - if (file_exists($theme.'/hooks')) - { - $d = dir($theme.'/hooks'); // Load all the hooks - while (($entry = $d->read()) !== FALSE) - if ($entry[0] != '.') - { - include $theme.'/hooks/'.$entry; - } - } - - Kohana::config_set('settings.site_style_css',$theme_css); - Kohana::config_set('settings.site_style_js',$theme_js); - } } new register_themes; \ No newline at end of file diff --git a/application/libraries/CSSmin.php b/application/libraries/CSSmin.php new file mode 100644 index 0000000000..6741eeeccf --- /dev/null +++ b/application/libraries/CSSmin.php @@ -0,0 +1,741 @@ +run($css); + } + + /** + * @param bool|int $raise_php_limits + * If true, PHP settings will be raised if needed + */ + public function __construct($raise_php_limits = TRUE) + { + // Set suggested PHP limits + $this->memory_limit = 128 * 1048576; // 128MB in bytes + $this->max_execution_time = 60; // 1 min + $this->pcre_backtrack_limit = 1000 * 1000; + $this->pcre_recursion_limit = 500 * 1000; + + $this->raise_php_limits = (bool) $raise_php_limits; + } + + /** + * Minify a string of CSS + * @param string $css + * @param int|bool $linebreak_pos + * @return string + */ + public function run($css = '', $linebreak_pos = FALSE) + { + if (empty($css)) { + return ''; + } + + if ($this->raise_php_limits) { + $this->do_raise_php_limits(); + } + + $this->comments = array(); + $this->preserved_tokens = array(); + + $start_index = 0; + $length = strlen($css); + + $css = $this->extract_data_urls($css); + + // collect all comment blocks... + while (($start_index = $this->index_of($css, '/*', $start_index)) >= 0) { + $end_index = $this->index_of($css, '*/', $start_index + 2); + if ($end_index < 0) { + $end_index = $length; + } + $comment_found = $this->str_slice($css, $start_index + 2, $end_index); + $this->comments[] = $comment_found; + $comment_preserve_string = self::COMMENT . (count($this->comments) - 1) . '___'; + $css = $this->str_slice($css, 0, $start_index + 2) . $comment_preserve_string . $this->str_slice($css, $end_index); + // Set correct start_index: Fixes issue #2528130 + $start_index = $end_index + 2 + strlen($comment_preserve_string) - strlen($comment_found); + } + + // preserve strings so their content doesn't get accidentally minified + $css = preg_replace_callback('/(?:"(?:[^\\\\"]|\\\\.|\\\\)*")|'."(?:'(?:[^\\\\']|\\\\.|\\\\)*')/S", array($this, 'replace_string'), $css); + + // Let's divide css code in chunks of 25.000 chars aprox. + // Reason: PHP's PCRE functions like preg_replace have a "backtrack limit" + // of 100.000 chars by default (php < 5.3.7) so if we're dealing with really + // long strings and a (sub)pattern matches a number of chars greater than + // the backtrack limit number (i.e. /(.*)/s) PCRE functions may fail silently + // returning NULL and $css would be empty. + $charset = ''; + $charset_regexp = '/@charset [^;]+;/i'; + $css_chunks = array(); + $css_chunk_length = 25000; // aprox size, not exact + $start_index = 0; + $i = $css_chunk_length; // save initial iterations + $l = strlen($css); + + + // if the number of characters is 25000 or less, do not chunk + if ($l <= $css_chunk_length) { + $css_chunks[] = $css; + } else { + // chunk css code securely + while ($i < $l) { + $i += 50; // save iterations. 500 checks for a closing curly brace } + if ($l - $start_index <= $css_chunk_length || $i >= $l) { + $css_chunks[] = $this->str_slice($css, $start_index); + break; + } + if ($css[$i - 1] === '}' && $i - $start_index > $css_chunk_length) { + // If there are two ending curly braces }} separated or not by spaces, + // join them in the same chunk (i.e. @media blocks) + $next_chunk = substr($css, $i); + if (preg_match('/^\s*\}/', $next_chunk)) { + $i = $i + $this->index_of($next_chunk, '}') + 1; + } + + $css_chunks[] = $this->str_slice($css, $start_index, $i); + $start_index = $i; + } + } + } + + // Minify each chunk + for ($i = 0, $n = count($css_chunks); $i < $n; $i++) { + $css_chunks[$i] = $this->minify($css_chunks[$i], $linebreak_pos); + // Keep the first @charset at-rule found + if (empty($charset) && preg_match($charset_regexp, $css_chunks[$i], $matches)) { + $charset = $matches[0]; + } + // Delete all @charset at-rules + $css_chunks[$i] = preg_replace($charset_regexp, '', $css_chunks[$i]); + } + + // Update the first chunk and push the charset to the top of the file. + $css_chunks[0] = $charset . $css_chunks[0]; + + return implode('', $css_chunks); + } + + /** + * Sets the memory limit for this script + * @param int|string $limit + */ + public function set_memory_limit($limit) + { + $this->memory_limit = $this->normalize_int($limit); + } + + /** + * Sets the maximum execution time for this script + * @param int|string $seconds + */ + public function set_max_execution_time($seconds) + { + $this->max_execution_time = (int) $seconds; + } + + /** + * Sets the PCRE backtrack limit for this script + * @param int $limit + */ + public function set_pcre_backtrack_limit($limit) + { + $this->pcre_backtrack_limit = (int) $limit; + } + + /** + * Sets the PCRE recursion limit for this script + * @param int $limit + */ + public function set_pcre_recursion_limit($limit) + { + $this->pcre_recursion_limit = (int) $limit; + } + + /** + * Try to configure PHP to use at least the suggested minimum settings + */ + private function do_raise_php_limits() + { + $php_limits = array( + 'memory_limit' => $this->memory_limit, + 'max_execution_time' => $this->max_execution_time, + 'pcre.backtrack_limit' => $this->pcre_backtrack_limit, + 'pcre.recursion_limit' => $this->pcre_recursion_limit + ); + + // If current settings are higher respect them. + foreach ($php_limits as $name => $suggested) { + $current = $this->normalize_int(ini_get($name)); + // memory_limit exception: allow -1 for "no memory limit". + if ($current > -1 && ($suggested == -1 || $current < $suggested)) { + ini_set($name, $suggested); + } + } + } + + /** + * Does bulk of the minification + * @param string $css + * @param int|bool $linebreak_pos + * @return string + */ + private function minify($css, $linebreak_pos) + { + // strings are safe, now wrestle the comments + for ($i = 0, $max = count($this->comments); $i < $max; $i++) { + + $token = $this->comments[$i]; + $placeholder = '/' . self::COMMENT . $i . '___/'; + + // ! in the first position of the comment means preserve + // so push to the preserved tokens keeping the ! + if (substr($token, 0, 1) === '!') { + $this->preserved_tokens[] = $token; + $token_tring = self::TOKEN . (count($this->preserved_tokens) - 1) . '___'; + $css = preg_replace($placeholder, $token_tring, $css, 1); + // Preserve new lines for /*! important comments + $css = preg_replace('/\s*[\n\r\f]+\s*(\/\*'. $token_tring .')/S', self::NL.'$1', $css); + $css = preg_replace('/('. $token_tring .'\*\/)\s*[\n\r\f]+\s*/S', '$1'.self::NL, $css); + continue; + } + + // \ in the last position looks like hack for Mac/IE5 + // shorten that to /*\*/ and the next one to /**/ + if (substr($token, (strlen($token) - 1), 1) === '\\') { + $this->preserved_tokens[] = '\\'; + $css = preg_replace($placeholder, self::TOKEN . (count($this->preserved_tokens) - 1) . '___', $css, 1); + $i = $i + 1; // attn: advancing the loop + $this->preserved_tokens[] = ''; + $css = preg_replace('/' . self::COMMENT . $i . '___/', self::TOKEN . (count($this->preserved_tokens) - 1) . '___', $css, 1); + continue; + } + + // keep empty comments after child selectors (IE7 hack) + // e.g. html >/**/ body + if (strlen($token) === 0) { + $start_index = $this->index_of($css, $this->str_slice($placeholder, 1, -1)); + if ($start_index > 2) { + if (substr($css, $start_index - 3, 1) === '>') { + $this->preserved_tokens[] = ''; + $css = preg_replace($placeholder, self::TOKEN . (count($this->preserved_tokens) - 1) . '___', $css, 1); + } + } + } + + // in all other cases kill the comment + $css = preg_replace('/\/\*' . $this->str_slice($placeholder, 1, -1) . '\*\//', '', $css, 1); + } + + + // Normalize all whitespace strings to single spaces. Easier to work with that way. + $css = preg_replace('/\s+/', ' ', $css); + + // Shorten & preserve calculations calc(...) since spaces are important + $css = preg_replace_callback('/calc(\((?:[^\(\)]+|(?1))*\))/i', array($this, 'replace_calc'), $css); + + // Replace positive sign from numbers preceded by : or a white-space before the leading space is removed + // +1.2em to 1.2em, +.8px to .8px, +2% to 2% + $css = preg_replace('/((? -9.0 to -9 + $css = preg_replace('/((?\+\(\)\]\~\=,])/', '$1', $css); + $css = preg_replace('/' . self::CLASSCOLON . '/', ':', $css); + + // retain space for special IE6 cases + $css = preg_replace('/\:first\-(line|letter)(\{|,)/i', ':first-$1 $2', $css); + + // no space after the end of a preserved comment + $css = preg_replace('/\*\/ /', '*/', $css); + + // Put the space back in some cases, to support stuff like + // @media screen and (-webkit-min-device-pixel-ratio:0){ + $css = preg_replace('/\band\(/i', 'and (', $css); + + // Remove the spaces after the things that should not have spaces after them. + $css = preg_replace('/([\!\{\}\:;\>\+\(\[\~\=,])\s+/S', '$1', $css); + + // remove unnecessary semicolons + $css = preg_replace('/;+\}/', '}', $css); + + // Fix for issue: #2528146 + // Restore semicolon if the last property is prefixed with a `*` (lte IE7 hack) + // to avoid issues on Symbian S60 3.x browsers. + $css = preg_replace('/(\*[a-z0-9\-]+\s*\:[^;\}]+)(\})/', '$1;$2', $css); + + // Replace 0 length units 0(px,em,%) with 0. + $css = preg_replace('/((?compress_hex_colors($css); + + // border: none to border:0, outline: none to outline:0 + $css = preg_replace('/(border\-?(?:top|right|bottom|left|)|outline)\:none(;|\})/ieS', "strtolower('$1:0$2')", $css); + + // shorter opacity IE filter + $css = preg_replace('/progid\:DXImageTransform\.Microsoft\.Alpha\(Opacity\=/i', 'alpha(opacity=', $css); + + // Remove empty rules. + $css = preg_replace('/[^\};\{\/]+\{\}/S', '', $css); + + // Some source control tools don't like it when files containing lines longer + // than, say 8000 characters, are checked in. The linebreak option is used in + // that case to split long lines after a specific column. + if ($linebreak_pos !== FALSE && (int) $linebreak_pos >= 0) { + $linebreak_pos = (int) $linebreak_pos; + $start_index = $i = 0; + while ($i < strlen($css)) { + $i++; + if ($css[$i - 1] === '}' && $i - $start_index > $linebreak_pos) { + $css = $this->str_slice($css, 0, $i) . "\n" . $this->str_slice($css, $i); + $start_index = $i; + } + } + } + + // Replace multiple semi-colons in a row by a single one + // See SF bug #1980989 + $css = preg_replace('/;;+/', ';', $css); + + // Restore new lines for /*! important comments + $css = preg_replace('/'. self::NL .'/', "\n", $css); + + // restore preserved comments and strings + for ($i = 0, $max = count($this->preserved_tokens); $i < $max; $i++) { + $css = preg_replace('/' . self::TOKEN . $i . '___/', $this->preserved_tokens[$i], $css, 1); + } + + // Trim the final string (for any leading or trailing white spaces) + return trim($css); + } + + /** + * Utility method to replace all data urls with tokens before we start + * compressing, to avoid performance issues running some of the subsequent + * regexes against large strings chunks. + * + * @param string $css + * @return string + */ + private function extract_data_urls($css) + { + // Leave data urls alone to increase parse performance. + $max_index = strlen($css) - 1; + $append_index = $index = $last_index = $offset = 0; + $sb = array(); + $pattern = '/url\(\s*(["\']?)data\:/i'; + + // Since we need to account for non-base64 data urls, we need to handle + // ' and ) being part of the data string. Hence switching to indexOf, + // to determine whether or not we have matching string terminators and + // handling sb appends directly, instead of using matcher.append* methods. + + while (preg_match($pattern, $css, $m, 0, $offset)) { + $index = $this->index_of($css, $m[0], $offset); + $last_index = $index + strlen($m[0]); + $start_index = $index + 4; // "url(".length() + $end_index = $last_index - 1; + $terminator = $m[1]; // ', " or empty (not quoted) + $found_terminator = FALSE; + + if (strlen($terminator) === 0) { + $terminator = ')'; + } + + while ($found_terminator === FALSE && $end_index+1 <= $max_index) { + $end_index = $this->index_of($css, $terminator, $end_index + 1); + + // endIndex == 0 doesn't really apply here + if ($end_index > 0 && substr($css, $end_index - 1, 1) !== '\\') { + $found_terminator = TRUE; + if (')' != $terminator) { + $end_index = $this->index_of($css, ')', $end_index); + } + } + } + + // Enough searching, start moving stuff over to the buffer + $sb[] = $this->substring($css, $append_index, $index); + + if ($found_terminator) { + $token = $this->substring($css, $start_index, $end_index); + $token = preg_replace('/\s+/', '', $token); + $this->preserved_tokens[] = $token; + + $preserver = 'url(' . self::TOKEN . (count($this->preserved_tokens) - 1) . '___)'; + $sb[] = $preserver; + + $append_index = $end_index + 1; + } else { + // No end terminator found, re-add the whole match. Should we throw/warn here? + $sb[] = $this->substring($css, $index, $last_index); + $append_index = $last_index; + } + + $offset = $last_index; + } + + $sb[] = $this->substring($css, $append_index); + + return implode('', $sb); + } + + /** + * Utility method to compress hex color values of the form #AABBCC to #ABC or short color name. + * + * DOES NOT compress CSS ID selectors which match the above pattern (which would break things). + * e.g. #AddressForm { ... } + * + * DOES NOT compress IE filters, which have hex color values (which would break things). + * e.g. filter: chroma(color="#FFFFFF"); + * + * DOES NOT compress invalid hex values. + * e.g. background-color: #aabbccdd + * + * @param string $css + * @return string + */ + private function compress_hex_colors($css) + { + // Look for hex colors inside { ... } (to avoid IDs) and which don't have a =, or a " in front of them (to avoid filters) + $pattern = '/(\=\s*?["\']?)?#([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])(\}|[^0-9a-f{][^{]*?\})/iS'; + $_index = $index = $last_index = $offset = 0; + $sb = array(); + // See: http://ajaxmin.codeplex.com/wikipage?title=CSS%20Colors + $short_safe = array( + '#808080' => 'gray', + '#008000' => 'green', + '#800000' => 'maroon', + '#000080' => 'navy', + '#808000' => 'olive', + '#800080' => 'purple', + '#c0c0c0' => 'silver', + '#008080' => 'teal', + '#f00' => 'red' + ); + + while (preg_match($pattern, $css, $m, 0, $offset)) { + $index = $this->index_of($css, $m[0], $offset); + $last_index = $index + strlen($m[0]); + $is_filter = (bool) $m[1]; + + $sb[] = $this->substring($css, $_index, $index); + + if ($is_filter) { + // Restore, maintain case, otherwise filter will break + $sb[] = $m[1] . '#' . $m[2] . $m[3] . $m[4] . $m[5] . $m[6] . $m[7]; + } else { + if (strtolower($m[2]) == strtolower($m[3]) && + strtolower($m[4]) == strtolower($m[5]) && + strtolower($m[6]) == strtolower($m[7])) { + // Compress. + $hex = '#' . strtolower($m[3] . $m[5] . $m[7]); + } else { + // Non compressible color, restore but lower case. + $hex = '#' . strtolower($m[2] . $m[3] . $m[4] . $m[5] . $m[6] . $m[7]); + } + // replace Hex colors to short safe color names + $sb[] = array_key_exists($hex, $short_safe) ? $short_safe[$hex] : $hex; + } + + $_index = $offset = $last_index - strlen($m[8]); + } + + $sb[] = $this->substring($css, $_index); + + return implode('', $sb); + } + + /* CALLBACKS + * --------------------------------------------------------------------------------------------- + */ + + private function replace_string($matches) + { + $match = $matches[0]; + $quote = substr($match, 0, 1); + // Must use addcslashes in PHP to avoid parsing of backslashes + $match = addcslashes($this->str_slice($match, 1, -1), '\\'); + + // maybe the string contains a comment-like substring? + // one, maybe more? put'em back then + if (($pos = $this->index_of($match, self::COMMENT)) >= 0) { + for ($i = 0, $max = count($this->comments); $i < $max; $i++) { + $match = preg_replace('/' . self::COMMENT . $i . '___/', $this->comments[$i], $match, 1); + } + } + + // minify alpha opacity in filter strings + $match = preg_replace('/progid\:DXImageTransform\.Microsoft\.Alpha\(Opacity\=/i', 'alpha(opacity=', $match); + + $this->preserved_tokens[] = $match; + return $quote . self::TOKEN . (count($this->preserved_tokens) - 1) . '___' . $quote; + } + + private function replace_colon($matches) + { + return preg_replace('/\:/', self::CLASSCOLON, $matches[0]); + } + + private function replace_calc($matches) + { + $this->preserved_tokens[] = preg_replace('/\s?([\*\/\(\),])\s?/', '$1', $matches[0]); + return self::TOKEN . (count($this->preserved_tokens) - 1) . '___'; + } + + private function rgb_to_hex($matches) + { + // Support for percentage values rgb(100%, 0%, 45%); + if ($this->index_of($matches[1], '%') >= 0){ + $rgbcolors = explode(',', str_replace('%', '', $matches[1])); + for ($i = 0; $i < count($rgbcolors); $i++) { + $rgbcolors[$i] = $this->round_number(floatval($rgbcolors[$i]) * 2.55); + } + } else { + $rgbcolors = explode(',', $matches[1]); + } + + // Values outside the sRGB color space should be clipped (0-255) + for ($i = 0; $i < count($rgbcolors); $i++) { + $rgbcolors[$i] = $this->clamp_number(intval($rgbcolors[$i], 10), 0, 255); + $rgbcolors[$i] = sprintf("%02x", $rgbcolors[$i]); + } + + // Fix for issue #2528093 + if (!preg_match('/[\s\,\);\}]/', $matches[2])){ + $matches[2] = ' ' . $matches[2]; + } + + return '#' . implode('', $rgbcolors) . $matches[2]; + } + + private function hsl_to_hex($matches) + { + $values = explode(',', str_replace('%', '', $matches[1])); + $h = floatval($values[0]); + $s = floatval($values[1]); + $l = floatval($values[2]); + + // Wrap and clamp, then fraction! + $h = ((($h % 360) + 360) % 360) / 360; + $s = $this->clamp_number($s, 0, 100) / 100; + $l = $this->clamp_number($l, 0, 100) / 100; + + if ($s == 0) { + $r = $g = $b = $this->round_number(255 * $l); + } else { + $v2 = $l < 0.5 ? $l * (1 + $s) : ($l + $s) - ($s * $l); + $v1 = (2 * $l) - $v2; + $r = $this->round_number(255 * $this->hue_to_rgb($v1, $v2, $h + (1/3))); + $g = $this->round_number(255 * $this->hue_to_rgb($v1, $v2, $h)); + $b = $this->round_number(255 * $this->hue_to_rgb($v1, $v2, $h - (1/3))); + } + + return $this->rgb_to_hex(array('', $r.','.$g.','.$b, $matches[2])); + } + + /* HELPERS + * --------------------------------------------------------------------------------------------- + */ + + private function hue_to_rgb($v1, $v2, $vh) + { + $vh = $vh < 0 ? $vh + 1 : ($vh > 1 ? $vh - 1 : $vh); + if ($vh * 6 < 1) return $v1 + ($v2 - $v1) * 6 * $vh; + if ($vh * 2 < 1) return $v2; + if ($vh * 3 < 2) return $v1 + ($v2 - $v1) * ((2/3) - $vh) * 6; + return $v1; + } + + private function round_number($n) + { + return intval(floor(floatval($n) + 0.5), 10); + } + + private function clamp_number($n, $min, $max) + { + return min(max($n, $min), $max); + } + + /** + * PHP port of Javascript's "indexOf" function for strings only + * Author: Tubal Martin http://blog.margenn.com + * + * @param string $haystack + * @param string $needle + * @param int $offset index (optional) + * @return int + */ + private function index_of($haystack, $needle, $offset = 0) + { + $index = strpos($haystack, $needle, $offset); + + return ($index !== FALSE) ? $index : -1; + } + + /** + * PHP port of Javascript's "substring" function + * Author: Tubal Martin http://blog.margenn.com + * Tests: http://margenn.com/tubal/substring/ + * + * @param string $str + * @param int $from index + * @param int|bool $to index (optional) + * @return string + */ + private function substring($str, $from = 0, $to = FALSE) + { + if ($to !== FALSE) { + if ($from == $to || ($from <= 0 && $to < 0)) { + return ''; + } + + if ($from > $to) { + $from_copy = $from; + $from = $to; + $to = $from_copy; + } + } + + if ($from < 0) { + $from = 0; + } + + $substring = ($to === FALSE) ? substr($str, $from) : substr($str, $from, $to - $from); + return ($substring === FALSE) ? '' : $substring; + } + + /** + * PHP port of Javascript's "slice" function for strings only + * Author: Tubal Martin http://blog.margenn.com + * Tests: http://margenn.com/tubal/str_slice/ + * + * @param string $str + * @param int $start index + * @param int|bool $end index (optional) + * @return string + */ + private function str_slice($str, $start = 0, $end = FALSE) + { + if ($end !== FALSE && ($start < 0 || $end <= 0)) { + $max = strlen($str); + + if ($start < 0) { + if (($start = $max + $start) < 0) { + return ''; + } + } + + if ($end < 0) { + if (($end = $max + $end) < 0) { + return ''; + } + } + + if ($end <= $start) { + return ''; + } + } + + $slice = ($end === FALSE) ? substr($str, $start) : substr($str, $start, $end - $start); + return ($slice === FALSE) ? '' : $slice; + } + + /** + * Convert strings like "64M" or "30" to int values + * @param mixed $size + * @return int + */ + private function normalize_int($size) + { + if (is_string($size)) { + switch (substr($size, -1)) { + case 'M': case 'm': return $size * 1048576; + case 'K': case 'k': return $size * 1024; + case 'G': case 'g': return $size * 1073741824; + } + } + + return (int) $size; + } +} \ No newline at end of file diff --git a/application/libraries/Cloudfiles.php b/application/libraries/Cloudfiles.php index 571440b604..b2f59927c6 100644 --- a/application/libraries/Cloudfiles.php +++ b/application/libraries/Cloudfiles.php @@ -96,14 +96,14 @@ public function authenticate() } // $file must be the absolute path to the file - public function upload($filename) + public function upload($filename, $appendUploadDir = TRUE) { $this->authenticate(); $local_directory = Kohana::config('upload.directory', TRUE); $local_directory = rtrim($local_directory, '/').'/'; - $fullpath = $local_directory.$filename; + $fullpath = $appendUploadDir ? $local_directory.$filename : DOCROOT.$filename; // Put this in a special directory based on subdomain if subdomain is set $dir = $this->_special_dir(); @@ -123,7 +123,7 @@ public function upload($filename) $uri = $container->make_public(); // Return the file path URL - return $file->public_ssl_uri(); + return (Kohana::config('config.external_site_protocol') == 'https') ? $file->public_ssl_uri() : $file->public_uri(); } public function delete($url) diff --git a/application/libraries/JSMin.php b/application/libraries/JSMin.php new file mode 100644 index 0000000000..ee1b442bce --- /dev/null +++ b/application/libraries/JSMin.php @@ -0,0 +1,386 @@ + + * @copyright 2002 Douglas Crockford (jsmin.c) + * @copyright 2008 Ryan Grove (PHP port) + * @copyright 2012 Adam Goforth (Updates) + * @license http://opensource.org/licenses/mit-license.php MIT License + * @version 1.1.2 (2012-05-01) + * @link https://github.com/rgrove/jsmin-php + */ + +class JSMin { + const ORD_LF = 10; + const ORD_SPACE = 32; + const ACTION_KEEP_A = 1; + const ACTION_DELETE_A = 2; + const ACTION_DELETE_A_B = 3; + + protected $a = ''; + protected $b = ''; + protected $input = ''; + protected $inputIndex = 0; + protected $inputLength = 0; + protected $lookAhead = null; + protected $output = ''; + + // -- Public Static Methods -------------------------------------------------- + + /** + * Minify Javascript + * + * @uses __construct() + * @uses min() + * @param string $js Javascript to be minified + * @return string + */ + public static function minify($js) { + $jsmin = new JSMin($js); + return $jsmin->min(); + } + + // -- Public Instance Methods ------------------------------------------------ + + /** + * Constructor + * + * @param string $input Javascript to be minified + */ + public function __construct($input) { + $this->input = str_replace("\r\n", "\n", $input); + $this->inputLength = strlen($this->input); + } + + // -- Protected Instance Methods --------------------------------------------- + + /** + * Action -- do something! What to do is determined by the $command argument. + * + * action treats a string as a single character. Wow! + * action recognizes a regular expression if it is preceded by ( or , or =. + * + * @uses next() + * @uses get() + * @throws JSMinException If parser errors are found: + * - Unterminated string literal + * - Unterminated regular expression set in regex literal + * - Unterminated regular expression literal + * @param int $command One of class constants: + * ACTION_KEEP_A Output A. Copy B to A. Get the next B. + * ACTION_DELETE_A Copy B to A. Get the next B. (Delete A). + * ACTION_DELETE_A_B Get the next B. (Delete B). + */ + protected function action($command) { + switch($command) { + case self::ACTION_KEEP_A: + $this->output .= $this->a; + + case self::ACTION_DELETE_A: + $this->a = $this->b; + + if ($this->a === "'" || $this->a === '"') { + for (;;) { + $this->output .= $this->a; + $this->a = $this->get(); + + if ($this->a === $this->b) { + break; + } + + if (ord($this->a) <= self::ORD_LF) { + throw new JSMinException('Unterminated string literal.'); + } + + if ($this->a === '\\') { + $this->output .= $this->a; + $this->a = $this->get(); + } + } + } + + case self::ACTION_DELETE_A_B: + $this->b = $this->next(); + + if ($this->b === '/' && ( + $this->a === '(' || $this->a === ',' || $this->a === '=' || + $this->a === ':' || $this->a === '[' || $this->a === '!' || + $this->a === '&' || $this->a === '|' || $this->a === '?' || + $this->a === '{' || $this->a === '}' || $this->a === ';' || + $this->a === "\n" )) { + + $this->output .= $this->a . $this->b; + + for (;;) { + $this->a = $this->get(); + + if ($this->a === '[') { + /* + inside a regex [...] set, which MAY contain a '/' itself. Example: mootools Form.Validator near line 460: + return Form.Validator.getValidator('IsEmpty').test(element) || (/^(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]\.?){0,63}[a-z0-9!#$%&'*+/=?^_`{|}~-]@(?:(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)*[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\])$/i).test(element.get('value')); + */ + for (;;) { + $this->output .= $this->a; + $this->a = $this->get(); + + if ($this->a === ']') { + break; + } elseif ($this->a === '\\') { + $this->output .= $this->a; + $this->a = $this->get(); + } elseif (ord($this->a) <= self::ORD_LF) { + throw new JSMinException('Unterminated regular expression set in regex literal.'); + } + } + } elseif ($this->a === '/') { + break; + } elseif ($this->a === '\\') { + $this->output .= $this->a; + $this->a = $this->get(); + } elseif (ord($this->a) <= self::ORD_LF) { + throw new JSMinException('Unterminated regular expression literal.'); + } + + $this->output .= $this->a; + } + + $this->b = $this->next(); + } + } + } + + /** + * Get next char. Convert ctrl char to space. + * + * @return string|null + */ + protected function get() { + $c = $this->lookAhead; + $this->lookAhead = null; + + if ($c === null) { + if ($this->inputIndex < $this->inputLength) { + $c = substr($this->input, $this->inputIndex, 1); + $this->inputIndex += 1; + } else { + $c = null; + } + } + + if ($c === "\r") { + return "\n"; + } + + if ($c === null || $c === "\n" || ord($c) >= self::ORD_SPACE) { + return $c; + } + + return ' '; + } + + /** + * Is $c a letter, digit, underscore, dollar sign, or non-ASCII character. + * + * @return bool + */ + protected function isAlphaNum($c) { + return ord($c) > 126 || $c === '\\' || preg_match('/^[\w\$]$/', $c) === 1; + } + + /** + * Perform minification, return result + * + * @uses action() + * @uses isAlphaNum() + * @uses get() + * @uses peek() + * @return string + */ + protected function min() { + if (0 == strncmp($this->peek(), "\xef", 1)) { + $this->get(); + $this->get(); + $this->get(); + } + + $this->a = "\n"; + $this->action(self::ACTION_DELETE_A_B); + + while ($this->a !== null) { + switch ($this->a) { + case ' ': + if ($this->isAlphaNum($this->b)) { + $this->action(self::ACTION_KEEP_A); + } else { + $this->action(self::ACTION_DELETE_A); + } + break; + + case "\n": + switch ($this->b) { + case '{': + case '[': + case '(': + case '+': + case '-': + case '!': + case '~': + $this->action(self::ACTION_KEEP_A); + break; + + case ' ': + $this->action(self::ACTION_DELETE_A_B); + break; + + default: + if ($this->isAlphaNum($this->b)) { + $this->action(self::ACTION_KEEP_A); + } + else { + $this->action(self::ACTION_DELETE_A); + } + } + break; + + default: + switch ($this->b) { + case ' ': + if ($this->isAlphaNum($this->a)) { + $this->action(self::ACTION_KEEP_A); + break; + } + + $this->action(self::ACTION_DELETE_A_B); + break; + + case "\n": + switch ($this->a) { + case '}': + case ']': + case ')': + case '+': + case '-': + case '"': + case "'": + $this->action(self::ACTION_KEEP_A); + break; + + default: + if ($this->isAlphaNum($this->a)) { + $this->action(self::ACTION_KEEP_A); + } + else { + $this->action(self::ACTION_DELETE_A_B); + } + } + break; + + default: + $this->action(self::ACTION_KEEP_A); + break; + } + } + } + + return $this->output; + } + + /** + * Get the next character, skipping over comments. peek() is used to see + * if a '/' is followed by a '/' or '*'. + * + * @uses get() + * @uses peek() + * @throws JSMinException On unterminated comment. + * @return string + */ + protected function next() { + $c = $this->get(); + + if ($c === '/') { + switch($this->peek()) { + case '/': + for (;;) { + $c = $this->get(); + + if (ord($c) <= self::ORD_LF) { + return $c; + } + } + + case '*': + $this->get(); + + for (;;) { + switch($this->get()) { + case '*': + if ($this->peek() === '/') { + $this->get(); + return ' '; + } + break; + + case null: + throw new JSMinException('Unterminated comment.'); + } + } + + default: + return $c; + } + } + + return $c; + } + + /** + * Get next char. If is ctrl character, translate to a space or newline. + * + * @uses get() + * @return string|null + */ + protected function peek() { + $this->lookAhead = $this->get(); + return $this->lookAhead; + } +} + +// -- Exceptions --------------------------------------------------------------- +class JSMinException extends Exception {} +?> diff --git a/application/libraries/MY_View.php b/application/libraries/MY_View.php index 9d87d23ab0..8465712a49 100644 --- a/application/libraries/MY_View.php +++ b/application/libraries/MY_View.php @@ -41,8 +41,8 @@ public function render($print = FALSE, $renderer = FALSE) { // Run view_pre_render filter to allow plugins/themes to add extra data to a view Event::run('ushahidi_filter.view_pre_render', $this->kohana_local_data); - // View specific hook pre render hook ie. view_pre_render-reports_main - Event::run('ushahidi_filter.view_pre_render-'.str_replace('/','_',$this->name), $this->kohana_local_data); + // View specific hook pre render hook ie. ushahidi_filter.view_pre_render.reports_main + Event::run('ushahidi_filter.view_pre_render.'.str_replace('/','_',$this->name), $this->kohana_local_data); return parent::render($print, $renderer); } diff --git a/application/libraries/Minify_CSS_UriRewriter.php b/application/libraries/Minify_CSS_UriRewriter.php new file mode 100644 index 0000000000..d960e0e519 --- /dev/null +++ b/application/libraries/Minify_CSS_UriRewriter.php @@ -0,0 +1,313 @@ + + */ +class Minify_CSS_UriRewriter { + + /** + * rewrite() and rewriteRelative() append debugging information here + * + * @var string + */ + public static $debugText = ''; + + /** + * In CSS content, rewrite file relative URIs as root relative + * + * @param string $css + * + * @param string $currentDir The directory of the current CSS file. + * + * @param string $docRoot The document root of the web site in which + * the CSS file resides (default = $_SERVER['DOCUMENT_ROOT']). + * + * @param array $symlinks (default = array()) If the CSS file is stored in + * a symlink-ed directory, provide an array of link paths to + * target paths, where the link paths are within the document root. Because + * paths need to be normalized for this to work, use "//" to substitute + * the doc root in the link paths (the array keys). E.g.: + * + * array('//symlink' => '/real/target/path') // unix + * array('//static' => 'D:\\staticStorage') // Windows + * + * + * @return string + */ + public static function rewrite($css, $currentDir, $docRoot = null, $symlinks = array()) + { + self::$_docRoot = self::_realpath( + $docRoot ? $docRoot : $_SERVER['DOCUMENT_ROOT'] + ); + self::$_currentDir = self::_realpath($currentDir); + self::$_symlinks = array(); + + // normalize symlinks + foreach ($symlinks as $link => $target) { + $link = ($link === '//') + ? self::$_docRoot + : str_replace('//', self::$_docRoot . '/', $link); + $link = strtr($link, '/', DIRECTORY_SEPARATOR); + self::$_symlinks[$link] = self::_realpath($target); + } + + self::$debugText .= "docRoot : " . self::$_docRoot . "\n" + . "currentDir : " . self::$_currentDir . "\n"; + if (self::$_symlinks) { + self::$debugText .= "symlinks : " . var_export(self::$_symlinks, 1) . "\n"; + } + self::$debugText .= "\n"; + + $css = self::_trimUrls($css); + + // rewrite + $css = preg_replace_callback('/@import\\s+([\'"])(.*?)[\'"]/' + ,array(self::$className, '_processUriCB'), $css); + $css = preg_replace_callback('/url\\(\\s*([^\\)\\s]+)\\s*\\)/' + ,array(self::$className, '_processUriCB'), $css); + + return $css; + } + + /** + * In CSS content, prepend a path to relative URIs + * + * @param string $css + * + * @param string $path The path to prepend. + * + * @return string + */ + public static function prepend($css, $path) + { + self::$_prependPath = $path; + + $css = self::_trimUrls($css); + + // append + $css = preg_replace_callback('/@import\\s+([\'"])(.*?)[\'"]/' + ,array(self::$className, '_processUriCB'), $css); + $css = preg_replace_callback('/url\\(\\s*([^\\)\\s]+)\\s*\\)/' + ,array(self::$className, '_processUriCB'), $css); + + self::$_prependPath = null; + return $css; + } + + /** + * Get a root relative URI from a file relative URI + * + * + * Minify_CSS_UriRewriter::rewriteRelative( + * '../img/hello.gif' + * , '/home/user/www/css' // path of CSS file + * , '/home/user/www' // doc root + * ); + * // returns '/img/hello.gif' + * + * // example where static files are stored in a symlinked directory + * Minify_CSS_UriRewriter::rewriteRelative( + * 'hello.gif' + * , '/var/staticFiles/theme' + * , '/home/user/www' + * , array('/home/user/www/static' => '/var/staticFiles') + * ); + * // returns '/static/theme/hello.gif' + * + * + * @param string $uri file relative URI + * + * @param string $realCurrentDir realpath of the current file's directory. + * + * @param string $realDocRoot realpath of the site document root. + * + * @param array $symlinks (default = array()) If the file is stored in + * a symlink-ed directory, provide an array of link paths to + * real target paths, where the link paths "appear" to be within the document + * root. E.g.: + * + * array('/home/foo/www/not/real/path' => '/real/target/path') // unix + * array('C:\\htdocs\\not\\real' => 'D:\\real\\target\\path') // Windows + * + * + * @return string + */ + public static function rewriteRelative($uri, $realCurrentDir, $realDocRoot, $symlinks = array()) + { + // prepend path with current dir separator (OS-independent) + $path = strtr($realCurrentDir, '/', DIRECTORY_SEPARATOR) + . DIRECTORY_SEPARATOR . strtr($uri, '/', DIRECTORY_SEPARATOR); + + self::$debugText .= "file-relative URI : {$uri}\n" + . "path prepended : {$path}\n"; + + // "unresolve" a symlink back to doc root + foreach ($symlinks as $link => $target) { + if (0 === strpos($path, $target)) { + // replace $target with $link + $path = $link . substr($path, strlen($target)); + + self::$debugText .= "symlink unresolved : {$path}\n"; + + break; + } + } + // strip doc root + $path = substr($path, strlen($realDocRoot)); + + self::$debugText .= "docroot stripped : {$path}\n"; + + // fix to root-relative URI + $uri = strtr($path, '/\\', '//'); + $uri = self::removeDots($uri); + + self::$debugText .= "traversals removed : {$uri}\n\n"; + + return $uri; + } + + /** + * Remove instances of "./" and "../" where possible from a root-relative URI + * + * @param string $uri + * + * @return string + */ + public static function removeDots($uri) + { + $uri = str_replace('/./', '/', $uri); + // inspired by patch from Oleg Cherniy + do { + $uri = preg_replace('@/[^/]+/\\.\\./@', '/', $uri, 1, $changed); + } while ($changed); + return $uri; + } + + /** + * Defines which class to call as part of callbacks, change this + * if you extend Minify_CSS_UriRewriter + * + * @var string + */ + protected static $className = 'Minify_CSS_UriRewriter'; + + /** + * Get realpath with any trailing slash removed. If realpath() fails, + * just remove the trailing slash. + * + * @param string $path + * + * @return mixed path with no trailing slash + */ + protected static function _realpath($path) + { + $realPath = realpath($path); + if ($realPath !== false) { + $path = $realPath; + } + return rtrim($path, '/\\'); + } + + /** + * Directory of this stylesheet + * + * @var string + */ + private static $_currentDir = ''; + + /** + * DOC_ROOT + * + * @var string + */ + private static $_docRoot = ''; + + /** + * directory replacements to map symlink targets back to their + * source (within the document root) E.g. '/var/www/symlink' => '/var/realpath' + * + * @var array + */ + private static $_symlinks = array(); + + /** + * Path to prepend + * + * @var string + */ + private static $_prependPath = null; + + /** + * @param string $css + * + * @return string + */ + private static function _trimUrls($css) + { + return preg_replace('/ + url\\( # url( + \\s* + ([^\\)]+?) # 1 = URI (assuming does not contain ")") + \\s* + \\) # ) + /x', 'url($1)', $css); + } + + /** + * @param array $m + * + * @return string + */ + private static function _processUriCB($m) + { + // $m matched either '/@import\\s+([\'"])(.*?)[\'"]/' or '/url\\(\\s*([^\\)\\s]+)\\s*\\)/' + $isImport = ($m[0][0] === '@'); + // determine URI and the quote character (if any) + if ($isImport) { + $quoteChar = $m[1]; + $uri = $m[2]; + } else { + // $m[1] is either quoted or not + $quoteChar = ($m[1][0] === "'" || $m[1][0] === '"') + ? $m[1][0] + : ''; + $uri = ($quoteChar === '') + ? $m[1] + : substr($m[1], 1, strlen($m[1]) - 2); + } + // analyze URI + if ('/' !== $uri[0] // root-relative + && false === strpos($uri, '//') // protocol (non-data) + && 0 !== strpos($uri, 'data:') // data protocol + ) { + // URI is file-relative: rewrite depending on options + if (self::$_prependPath === null) { + $uri = self::rewriteRelative($uri, self::$_currentDir, self::$_docRoot, self::$_symlinks); + } else { + $uri = self::$_prependPath . $uri; + if ($uri[0] === '/') { + $root = ''; + $rootRelative = $uri; + $uri = $root . self::removeDots($rootRelative); + } elseif (preg_match('@^((https?\:)?//([^/]+))/@', $uri, $m) && (false !== strpos($m[3], '.'))) { + $root = $m[1]; + $rootRelative = substr($uri, strlen($root)); + $uri = $root . self::removeDots($rootRelative); + } + } + } + return $isImport + ? "@import {$quoteChar}{$uri}{$quoteChar}" + : "url({$quoteChar}{$uri}{$quoteChar})"; + } +} diff --git a/application/libraries/Requirements.php b/application/libraries/Requirements.php new file mode 100644 index 0000000000..82a9bc1ff1 --- /dev/null +++ b/application/libraries/Requirements.php @@ -0,0 +1,1177 @@ +set_combined_files_enabled($enable); + } + + /** + * Checks whether combining of css/javascript files is enabled. + * @return boolean + */ + public static function get_combined_files_enabled() { + return self::backend()->get_combined_files_enabled(); + } + + /** + * Set the relative folder e.g. "assets" for where to store combined files + * @param string $folder Path to folder + */ + public static function set_combined_files_folder($folder) { + self::backend()->setCombinedFilesFolder($folder); + } + + /** + * Set whether we want to suffix requirements with the time / + * location on to the requirements + * + * @param bool + */ + public static function set_suffix_requirements($var) { + self::backend()->set_suffix_requirements($var); + } + + /** + * Return whether we want to suffix requirements + * + * @return bool + */ + public static function get_suffix_requirements() { + return self::backend()->get_suffix_requirements(); + } + + /** + * Instance of requirements for storage + * + * @var Requirements + */ + private static $backend = null; + + public static function backend() { + if(!self::$backend) { + self::$backend = new Requirements_Backend(); + } + return self::$backend; + } + + /** + * Setter method for changing the Requirements backend + * + * @param Requirements $backend + */ + public static function set_backend(Requirements_Backend $backend) { + self::$backend = $backend; + } + + /** + * Register the given javascript file as required. + * + * See {@link Requirements_Backend::javascript()} for more info + * + */ + static function js($file, $uniquenessID = null) { + self::backend()->js($file, $uniquenessID); + } + + /** + * Add the javascript code to the header of the page + * + * See {@link Requirements_Backend::customJS()} for more info + * @param script The script content + * @param uniquenessID Use this to ensure that pieces of code only get added once. + */ + static function customJS($script, $uniquenessID) { + self::backend()->customJS($script, $uniquenessID); + } + + /** + * Include custom CSS styling to the header of the page. + * + * See {@link Requirements_Backend::customCSS()} + * + * @param string $script CSS selectors as a string (without \n"; + } + } + + return $content; + } + + /** + * Finds the path for specified file. + * + * @param string $fileOrUrl + * @param string $type file type ie. css or js + * @return string|boolean + */ + protected function path_for_file($fileOrUrl, $type) { + if(preg_match('/^http[s]?/', $fileOrUrl)) { + return $fileOrUrl; + } else { + // Split query from filename + $suffix = ''; + if(strpos($fileOrUrl, '?') !== false) { + $suffix = substr($fileOrUrl, strpos($fileOrUrl, '?')+1); + $fileOrUrl = substr($fileOrUrl, 0, strpos($fileOrUrl, '?')); + } + + if (file_exists(DOCROOT . $fileOrUrl)) { + // Check for RTL replacements + if ($type == 'css' AND ush_locale::is_rtl_language()) + { + $rtlFile = substr($fileOrUrl, 0, strpos($fileOrUrl, ".$type")) . "-rtl" . substr($fileOrUrl, strpos($fileOrUrl, ".$type")); + if (file_exists(DOCROOT . $rtlFile)) + { + $fileOrUrl = $rtlFile; + } + } + + // Get url prefix, either site base url or CDN url + $prefix = url::file_loc($type); + + $mtimesuffix = "?"; + if($this->suffix_requirements) { + $mtimesuffix .= "m=" . filemtime(DOCROOT . $fileOrUrl); + $suffix = '&'.$suffix; + } + return "{$prefix}{$fileOrUrl}{$mtimesuffix}{$suffix}"; + } + } + Kohana::log('alert', "Requirements: file $fileOrUrl not found"); + return false; + } + + /** + * Concatenate several css or javascript files into a single dynamically generated + * file. This increases performance by fewer HTTP requests. + * + * The combined file is only included if one or more of the individual files was included + * with Requirements::js() or Requirements::css() already. + * + * The combined file is regenerated based on every file modification time. + * Optionally a rebuild can be triggered by appending ?flush=1 to the URL. + * If all files to be combined are javascript, we use the external JSMin library + * to minify the javascript. This can be controlled by {@link $combine_js_with_jsmin}. + * + * CAUTION: You're responsible for ensuring that the load order for combined files + * is retained - otherwise combining javascript files can lead to functional errors + * in the javascript logic, and combining css can lead to wrong styling inheritance. + * Depending on the javascript logic, you also have to ensure that files are not included + * in more than one combine_files() call. + * + * Best practice is to include every javascript file in exactly *one* combine_files() + * directive to avoid the issues mentioned above - this is enforced by this function. + * + * CAUTION: Combining CSS Files discards any "media" information. + * + * Example for combined JavaScript: + * + * Requirements::combine_files( + * 'foobar.js', + * array( + * 'mysite/javascript/foo.js', + * 'mysite/javascript/bar.js', + * 'baz.min' => 'mysite/javascript/baz.min', + * ) + * ); + * + * + * Example for combined CSS: + * + * Requirements::combine_files( + * 'foobar.css', + * array( + * 'mysite/javascript/foo.css', + * 'mysite/javascript/bar.css', + * ) + * ); + * + * + * @see http://code.google.com/p/jsmin-php/ + * + * @todo Should we enforce unique inclusion of files, or leave it to the developer? Can auto-detection cause breaks? + * + * @param string $combinedFileName Filename of the combined file + * @param array $files Array of filenames relative to the webroot + */ + function combine_files($combinedFileName, $files) { + $type = stripos($combinedFileName, '.js') ? 'js' : 'css'; + + // duplicate check + foreach($this->combine_files[$type] as $_combinedFileName => $_files) { + $duplicates = array_intersect($_files, $files); + if($duplicates && $combinedFileName != $_combinedFileName) { + Kohana::log('info', "Requirements_Backend::combine_files(): Already included files " . implode(',', $duplicates) . " in combined file '{$_combinedFileName}'"); + return false; + } + } + + // If the $files array is indexed, generate uniquenessID from last part of filename + if (array_values($files) === $files) + { + $new_files = array(); + foreach($files as $file) + { + $uniquenessID = substr( $file, strrpos( $file, '/' ) +1 ); + $new_files[$uniquenessID] = $file; + } + $files = $new_files; + } + + $this->combine_files[$type][$combinedFileName] = $files; + } + + /** + * Returns all combined files. + * @return array + */ + function get_combine_files() { + return $this->combine_files; + } + + /** + * Deletes all dynamically generated combined files from the filesystem. + * + * @param string $combinedFileName If left blank, all combined files are deleted. + */ + function delete_combined_files($combinedFileName = null) { + $combinedFiles = ($combinedFileName) ? array($combinedFileName => null) : array_merge($this->combine_files['css'], $this->combine_files['js']); + $combinedFolder = DOCROOT . $this->getCombinedFilesFolder(); + foreach($combinedFiles as $combinedFile => $sourceItems) { + $filePath = $combinedFolder . '/' . $combinedFile; + if(file_exists($filePath)) { + unlink($filePath); + } + } + } + + function clear_combined_files() { + $this->combine_files = array('js' => array(), 'css' => array()); + } + + /** + * See {@link combine_files()} + * + */ + function process_combined_files($type = 'all') { + if( !$this->combined_files_enabled) { + return; + } + + switch ($type) + { + case 'js': + $this->_process_combined_files('js'); + break; + case 'css': + $this->_process_combined_files('css'); + break; + case 'all': + default: + $this->_process_combined_files('js'); + $this->_process_combined_files('css'); + break; + } + } + + /** + * See {@link combine_files()} + * + */ + private function _process_combined_files($type) { + // Make a map of files that could be potentially combined + $combinerCheck = array(); + foreach($this->combine_files[$type] as $combinedFile => $sourceItems) { + foreach($sourceItems as $id => $sourceItem) { + if(isset($combinerCheck[$sourceItem]) && $combinerCheck[$sourceItem] != $combinedFile){ + Kohana::log('alert',"Requirements_Backend::process_combined_files - file '$sourceItem' appears in two combined files:" . " '{$combinerCheck[$sourceItem]}' and '$combinedFile'"); + } + $combinerCheck[$sourceItem] = $combinedFile; + $combinerCheck[$id] = $combinedFile; + } + } + + // Work out the relative URL for the combined files from the base folder + $combinedFilesFolder = ($this->getCombinedFilesFolder()) ? ($this->getCombinedFilesFolder() . '/') : ''; + + // Figure out which ones apply to this pageview + $combinedFiles = array(); + $newRequirements = array(); + foreach($this->$type as $id => $params) { + $file = ($type == 'js') ? $params : $params['file']; + if(isset($combinerCheck[$file])) { + $newRequirements[$combinerCheck[$file]] = ($type == 'js') ? $combinedFilesFolder . $combinerCheck[$file] : array('file' => $combinedFilesFolder . $combinerCheck[$file]); + $combinedFiles[$combinerCheck[$file]] = true; + } elseif(isset($combinerCheck[$id])) { + $newRequirements[$combinerCheck[$id]] = ($type == 'js') ? $combinedFilesFolder . $combinerCheck[$id] : array('file' => $combinedFilesFolder . $combinerCheck[$id]); + $combinedFiles[$combinerCheck[$id]] = true; + } else { + $newRequirements[$id] = $params; + } + } + + // Process the combined files + $base = DOCROOT; + foreach(array_diff_key($combinedFiles, $this->blocked) as $combinedFile => $dummy) { + $fileList = $this->combine_files[$type][$combinedFile]; + $combinedFilePath = $base . $combinedFilesFolder . $combinedFile; + + // Check for RTL alternatives + if ($type == 'css' AND ush_locale::is_rtl_language()) + { + $has_rtl_files = FALSE; + foreach($fileList as $index => $file) + { + $rtlFile = substr($file, 0, strpos($file, ".$type")) . "-rtl" . substr($file, strpos($file, ".$type")); + if (file_exists(DOCROOT . $rtlFile)) + { + $fileList[$index] = $rtlFile; + $has_rtl_files = TRUE; + } + } + + // Update combined files details, only if the include RTL alternatives + // We store the RTL version separate from the LTR version, so we don't regenerate every time someone changes language + if ($has_rtl_files) + { + $combinedFile = substr($combinedFile, 0, -4).'-rtl.css'; + $combinedFilePath = $base . $combinedFilesFolder . $combinedFile; + $newRequirements[$combinedFile] = ($type == 'js') ? $combinedFilesFolder . $combinedFile : array('file' => $combinedFilesFolder . $combinedFile); + } + } + + // Make the folder if necessary + if(!file_exists(dirname($combinedFilePath))) { + mkdir(dirname($combinedFilePath)); + } + + // If the file isn't writebale, don't even bother trying to make the combined file + // Complex test because is_writable fails if the file doesn't exist yet. + if((file_exists($combinedFilePath) && !is_writable($combinedFilePath)) || + (!file_exists($combinedFilePath) && !is_writable(dirname($combinedFilePath)))) { + Kohana::log('alert', "Requirements_Backend::process_combined_files(): Couldn't create '$combinedFilePath'"); + continue; + } + + // Determine if we need to build the combined include + if(file_exists($combinedFilePath) && !isset($_GET['flush'])) { + // file exists, check modification date of every contained file + $srcLastMod = 0; + foreach($fileList as $file) { + $srcLastMod = max(filemtime($base . $file), $srcLastMod); + } + $refresh = $srcLastMod > filemtime($combinedFilePath); + } else { + // file doesn't exist, or refresh was explicitly required + $refresh = true; + } + + if(!$refresh) continue; + + $combinedData = ""; + foreach(array_diff($fileList, $this->blocked) as $id => $file) { + $fileContent = file_get_contents($base . $file); + + // if we have a javascript file and jsmin is enabled, minify the content + if($type == 'js' && $this->combine_js_with_jsmin) { + $fileContent = JSMin::minify($fileContent); + } + + if($type == 'css') { + // Rewrite urls in css to be relative to the docroot + $fileContent = Minify_CSS_UriRewriter::rewrite($fileContent, pathinfo($base . $file, PATHINFO_DIRNAME), DOCROOT); + // compress css (if enabled) + if ($this->combine_css_with_cssmin) + { + $fileContent = CSSMin::go($fileContent); + } + } + + // write a header comment for each file for easier identification and debugging + // also the semicolon between each file is required for jQuery to be combinable properly + $combinedData .= "/****** FILE: $file *****/\n" . $fileContent . "\n" . ($type == 'js' ? ';' : '') . "\n"; + } + + $successfulWrite = false; + $fh = fopen($combinedFilePath, 'wb'); + if($fh) { + if(fwrite($fh, $combinedData) == strlen($combinedData)) $successfulWrite = true; + fclose($fh); + unset($fh); + } + + // Should we push this to the CDN too? + if (Kohana::config("cdn.cdn_store_dynamic_content") AND Kohana::config("requirements.cdn_store_combined_files")) + { + $cdn_combined_path = cdn::upload($combinedFilesFolder . $combinedFile, FALSE); + } + + // Unsuccessful write - just include the regular JS files, rather than the combined one + if(!$successfulWrite) { + Kohana::log('alert', "Requirements_Backend::process_combined_files(): Couldn't create '$combinedFilePath'"); + continue; + } + } + + // @todo Alters the original information, which means you can't call this + // method repeatedly - it will behave different on the second call! + $this->$type = $newRequirements; + } + + function get_custom_scripts() { + $requirements = ""; + + if($this->customJS) { + foreach($this->customJS as $script) { + $requirements .= "$script\n"; + } + } + + return $requirements; + } + + /** + * @see Requirements::themedCSS() + */ + public function themedCSS($name, $module = null, $media = null) { + $this->css($this->themedCSSPath($name, $module), $name, $media); + return; + } + + /** + * @see Requirements::ieCSS() + */ + public function ieCSS($version, $name, $media = null) { + $this->customHeadTags("",'iecss-'.$name); + return; + } + + /** + * @see Requirements::ieThemedCSS() + */ + public function ieThemedCSS($version, $name, $module = null, $media = null) { + $this->ieCSS($version, $this->themedCSSPath($name, $module), $media, FALSE); + return; + } + + private function themedCSSPath($name, $module = null) + { + // try to include from a loaded theme + foreach (Themes::loaded_themes() as $theme) + { + $path = THEMEPATH . "$theme/css/$name.css"; + if (file_exists($path)) { + return "themes/$theme/css/$name.css"; + } + } + + // Try to include from fall back module + if ($module AND file_exists(DOCROOT . "$module/css/$name.css")) { + return "$module/css/$name.css"; + } + + // Try to include from global media + if (file_exists(DOCROOT . "media/css/$name.css")) { + return "media/css/$name.css"; + } + } + + function debug() { + Debug::show($this->js); + Debug::show($this->css); + Debug::show($this->customCSS); + Debug::show($this->customJS); + Debug::show($this->customHeadTags); + Debug::show($this->combine_files); + } + +} diff --git a/application/libraries/Themes.php b/application/libraries/Themes.php index 11ca87666c..f2facca2ea 100644 --- a/application/libraries/Themes.php +++ b/application/libraries/Themes.php @@ -16,16 +16,27 @@ class Themes_Core { + public $frontend = false; + public $admin = false; + public $map_enabled = false; public $api_url = null; - public $main_page = false; public $this_page = false; public $treeview_enabled = false; public $validator_enabled = false; public $photoslider_enabled = false; public $colorpicker_enabled = false; + public $datepicker_enabled = false; public $editor_enabled = false; - public $site_style = false; + public $protochart_enabled = false; + public $raphael_enabled = false; + public $tablerowsort_enabled = false; + public $json2_enabled = false; + public $hovertip_enabled = false; + public $slider_enabled = false; + public $timeline_enabled = false; + + // Custom JS to be added public $js = null; public $css_url = null; @@ -38,10 +49,6 @@ public function __construct() // Load Session $this->session = Session::instance(); - - // Grab the proper URL for the css and js files - $this->css_url = url::file_loc('css'); - $this->js_url = url::file_loc('js'); } /** @@ -50,13 +57,27 @@ public function __construct() */ public function header_block() { - $content = Kohana::config("globalcode.head"). - $this->_header_css(). - $this->_header_feeds(). - $this->_header_js(); - + $content = ''; + // For backward compatibility render Requirements here rather than in the view + if (Kohana::config('requirements.write_js_to_body')) + { + $content .= Requirements::render('css'); + $content .= Requirements::render('headtags'); + } + else + { + $content .= Requirements::render(); + } + // Filter::header_block - Modify Header Block + if ($this->admin) + { + Event::run('ushahidi_filter.admin_header_block', $content); + } + elseif ($this->frontend) + { Event::run('ushahidi_filter.header_block', $content); + } return $content; } @@ -67,171 +88,298 @@ public function header_block() */ public function admin_header_block() { - $content = Kohana::config("globalcode.head"); - - // Filter::admin_header_block - Modify Admin Header Block - Event::run('ushahidi_filter.admin_header_block', $content); - - return $content; + $this->header_block(); } /** - * Css Items + * CSS/JS requirements */ - private function _header_css() + public function requirements() { - $core_css = ""; - $core_css .= html::stylesheet($this->css_url."media/css/jquery-ui-themeroller", "", TRUE); + Requirements::customHeadTags(Kohana::config("globalcode.head"),'globalcode-head'); + + Requirements::js("media/js/jquery.js"); + Requirements::js("media/js/jquery.ui.min.js"); + //Requirements::js(Kohana::config('core.site_protocol')."://ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/jquery-ui.min.js"); + Requirements::js("media/js/jquery.pngFix.pack.js"); + Requirements::js("media/js/jquery.timeago.js"); + + Requirements::css("media/css/jquery-ui-themeroller.css"); + + Requirements::js('media/js/global.js'); + Requirements::css('media/css/global.css'); - foreach (Kohana::config("settings.site_style_css") as $theme_css) + if ($this->map_enabled) { - $core_css .= html::stylesheet($theme_css,"",TRUE); + Requirements::js("media/js/OpenLayers.js"); + Requirements::js("media/js/ushahidi.js"); + Requirements::js($this->api_url); + Requirements::customJS("OpenLayers.ImgPath = '".url::file_loc('js')."media/img/openlayers/"."';",'openlayers-imgpath'); + + Requirements::css("media/css/openlayers.css"); + } + + if ($this->hovertip_enabled) + { + Requirements::js('media/js/jquery.hovertip-1.0.js'); + Requirements::css('media/css/jquery.hovertip-1.0.css', ''); + Requirements::customJS( + "$(function() { + if($('.tooltip[title]') != null) + $('.tooltip[title]').hovertip(); + });", + 'tooltip-js' + ); + } + + if ($this->slider_enabled) + { + Requirements::js('media/js/selectToUISlider.jQuery.js'); } - $core_css .= ""; - $core_css .= ""; - $core_css .= ""; - - if ($this->map_enabled) + if ($this->timeline_enabled) { - $core_css .= html::stylesheet($this->css_url."media/css/openlayers","",TRUE); + Requirements::js("media/js/jquery.jqplot.min.js"); + Requirements::css("media/css/jquery.jqplot.min.css"); + Requirements::js("media/js/jqplot.dateAxisRenderer.min.js"); } if ($this->treeview_enabled) { - $core_css .= html::stylesheet($this->css_url."media/css/jquery.treeview","",TRUE); + Requirements::css("media/css/jquery.treeview.css"); + Requirements::js("media/js/jquery.treeview.js"); } - - if ($this->photoslider_enabled) + + // Load ProtoChart + if ($this->protochart_enabled) { - $core_css .= html::stylesheet($this->css_url."media/css/picbox/picbox","",TRUE); + Requirements::customJS("jQuery.noConflict()", 'jquery-noconflict'); + Requirements::js('media/js/protochart/prototype.js'); + Requirements::customHeadTags( + '', + 'ie-excanvas-compressed'); + Requirements::js('media/js/protochart/ProtoChart.js'); } - - if ($this->colorpicker_enabled) + + // Load Raphael + if ($this->raphael_enabled) { - $core_css .= html::stylesheet($this->css_url."media/css/colorpicker","",TRUE); + // The only reason we include prototype is to keep the div element naming convention consistent + //Requirements::js('media/js/protochart/prototype.js'); + Requirements::js('media/js/raphael.js'); + Requirements::customJS('var impact_json = '.$this->impact_json .';','impact_json'); + Requirements::js('media/js/raphael-ushahidi-impact.js'); } - if ($this->site_style AND $this->site_style != "default") + if ($this->validator_enabled) { - $core_css .= html::stylesheet($this->css_url."themes/".$site_style."/style.css"); + Requirements::js("media/js/jquery.validate.min.js"); } - $core_css .= html::stylesheet($this->css_url."media/css/global","",TRUE); - $core_css .= html::stylesheet($this->css_url."media/css/jquery.jqplot.min", "", TRUE); - - // Render CSS - $plugin_css = plugin::render('stylesheet'); - - return $core_css.$plugin_css; + if ($this->photoslider_enabled) + { + Requirements::css("media/css/picbox/picbox.css"); + Requirements::js("media/js/picbox.js"); } - /** - * Javascript Files and Inline JS - */ - private function _header_js() - { - $core_js = ""; - if ($this->map_enabled) + if ($this->colorpicker_enabled) { - $core_js .= html::script($this->js_url."media/js/OpenLayers", TRUE); - $core_js .= ""; - $core_js .= html::script($this->js_url."media/js/ushahidi", TRUE); + Requirements::css("media/css/colorpicker.css"); + Requirements::js("media/js/colorpicker.js"); } - $core_js .= html::script($this->js_url."media/js/jquery", TRUE); - //$core_js .= html::script($this->js_url."media/js/jquery.ui.min", TRUE); - $core_js .= html::script(Kohana::config('core.site_protocol')."://ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/jquery-ui.min.js", TRUE); - $core_js .= html::script($this->js_url."media/js/jquery.pngFix.pack", TRUE); - $core_js .= html::script($this->js_url."media/js/jquery.timeago", TRUE); - - if ($this->map_enabled) + // Load jwysiwyg + if ($this->editor_enabled) { - - $core_js .= $this->api_url; - - if ($this->main_page || $this->this_page == "alerts") + Requirements::css('media/js/jwysiwyg/jwysiwyg/jquery.wysiwyg.css'); + if (Kohana::config("cdn.cdn_ignore_jwysiwyg") == TRUE) { - $core_js .= html::script($this->js_url."media/js/selectToUISlider.jQuery", TRUE); + Requirements::js(url::file_loc('ignore').'media/js/jwysiwyg/jwysiwyg/jquery.wysiwyg.js'); // not sure what the hell to do about this } - - if ($this->main_page) + else { - // Notes: E.Kala - // TODO: Only include the jqplot JS when the timeline is enabled - $core_js .= html::script($this->js_url."media/js/jquery.jqplot.min"); - $core_js .= html::script($this->js_url."media/js/jqplot.dateAxisRenderer.min"); - - $core_js .= ""; + Requirements::js('media/js/jwysiwyg/jwysiwyg/jquery.wysiwyg.js'); } } - - if ($this->treeview_enabled) + + // Table Row Sort + if ($this->tablerowsort_enabled) { - $core_js .= html::script($this->js_url."media/js/jquery.treeview"); + Requirements::js('media/js/jquery.tablednd_0_5.js'); } - - if ($this->validator_enabled) + + // JSON2 for IE+ + if ($this->json2_enabled) { - $core_js .= html::script($this->js_url."media/js/jquery.validate.min"); + Requirements::js('media/js/json2.js'); } - - if ($this->photoslider_enabled) + + if ($this->datepicker_enabled) { - $core_js .= html::script($this->js_url."media/js/picbox", TRUE); + Requirements::customJS(" + Date.dayNames = [ + '". Kohana::lang('datetime.sunday.full') ."', + '". Kohana::lang('datetime.monday.full') ."', + '". Kohana::lang('datetime.tuesday.full') ."', + '". Kohana::lang('datetime.wednesday.full') ."', + '". Kohana::lang('datetime.thursday.full') ."', + '". Kohana::lang('datetime.friday.full') ."', + '". Kohana::lang('datetime.saturday.full') ."' + ]; + Date.abbrDayNames = [ + '". Kohana::lang('datetime.sunday.abbv') ."', + '". Kohana::lang('datetime.monday.abbv') ."', + '". Kohana::lang('datetime.tuesday.abbv') ."', + '". Kohana::lang('datetime.wednesday.abbv') ."', + '". Kohana::lang('datetime.thursday.abbv') ."', + '". Kohana::lang('datetime.friday.abbv') ."', + '". Kohana::lang('datetime.saturday.abbv') ."' + ]; + Date.monthNames = [ + '". Kohana::lang('datetime.january.full') ."', + '". Kohana::lang('datetime.february.full') ."', + '". Kohana::lang('datetime.march.full') ."', + '". Kohana::lang('datetime.april.full') ."', + '". Kohana::lang('datetime.may.full') ."', + '". Kohana::lang('datetime.june.full') ."', + '". Kohana::lang('datetime.july.full') ."', + '". Kohana::lang('datetime.august.full') ."', + '". Kohana::lang('datetime.september.full') ."', + '". Kohana::lang('datetime.october.full') ."', + '". Kohana::lang('datetime.november.full') ."', + '". Kohana::lang('datetime.december.full') ."' + ]; + Date.abbrMonthNames = [ + '". Kohana::lang('datetime.january.abbv') ."', + '". Kohana::lang('datetime.february.abbv') ."', + '". Kohana::lang('datetime.march.abbv') ."', + '". Kohana::lang('datetime.april.abbv') ."', + '". Kohana::lang('datetime.may.abbv') ."', + '". Kohana::lang('datetime.june.abbv') ."', + '". Kohana::lang('datetime.july.abbv') ."', + '". Kohana::lang('datetime.august.abbv') ."', + '". Kohana::lang('datetime.september.abbv') ."', + '". Kohana::lang('datetime.october.abbv') ."', + '". Kohana::lang('datetime.november.abbv') ."', + '". Kohana::lang('datetime.december.abbv') ."' + ]; + Date.firstDayOfWeek = 1; + Date.format = 'mm/dd/yyyy'; + ",'locale-dates'); + + Requirements::js('media/js/jquery.datePicker.js'); + Requirements::customHeadTags( + '','jquery.bgiframe.min'); } - - if ($this->colorpicker_enabled) + + // JS base combines + $base_js = array( + 'media/js/jquery.js', + 'media/js/jquery.ui.min.js', + 'media/js/jquery.pngFix.pack.js', + 'media/js/jquery.timeago.js', + 'media/js/global.js', + //'media/js/OpenLayers.js', + //'media/js/ushahidi.js', + 'media/js/jquery.treeview.js', + 'media/js/selectToUISlider.jQuery.js', + 'media/js/jquery.validate.min.js', + 'media/js/colorpicker.js', + ); + if ($this->timeline_enabled) { - $core_js .= html::script($this->js_url."media/js/colorpicker"); + $base_js[] = 'media/js/jquery.jqplot.min.js'; + $base_js[] = 'media/js/jqplot.dateAxisRenderer.min.js'; } - - $core_js .= html::script($this->js_url."media/js/global"); - - if ($this->editor_enabled) + Requirements::combine_files('0_base.js', $base_js); + + // CSS base combines + $base_css = array( + 'media/css/jquery-ui-themeroller.css', + 'media/css/global.css', + 'media/css/openlayers.css', + 'media/css/jquery.treeview.css', + 'media/css/colorpicker.css', + ); + if ($this->timeline_enabled) { - $core_js .= html::script($this->js_url."media/js/jwysiwyg/jwysiwyg/jquery.wysiwyg.js"); + $base_css[] = 'media/css/jquery.jqplot.min.css'; } + Requirements::combine_files('0_base.css', $base_css); - // Javascript files from plugins - $plugin_js = plugin::render('javascript'); - - // Javascript files from themes - foreach (Kohana::config("settings.site_style_js") as $theme_js) + // JS admin combies + Requirements::combine_files('1_admin.js', array( + 'media/js/jquery.form.js', + 'media/js/jquery.base64.js', + 'media/js/admin.js', + 'media/js/jquery.hovertip-1.0.js', + )); + + // CSS admin combines + Requirements::combine_files('1_admin.css', array( + 'media/css/jquery.hovertip-1.0.css', + 'media/css/admin.css' + )); + + Event::run('ushahidi_action.themes_add_requirements_pre_theme', $this); + + if ($this->admin) { - $core_js .= html::script($theme_js,"",TRUE); + $this->admin_requirements(); } - + + if ($this->frontend) + { + $this->frontend_requirements(); + } + // Inline Javascript - $insert_js = trim($this->js); - $inline_js = <<< INLINEJS - -INLINEJS; - - // Filter::header_js - Modify Header Javascript - Event::run('ushahidi_filter.header_js', $inline_js); - - return $core_js.$plugin_js.$inline_js; + if (!empty($this->js)) + { + //@todo add deprecated warning + Requirements::customJS($this->js,'pagejs'); + } + + Event::run('ushahidi_action.themes_add_requirements', $this); } - /** - * RSS/Atom - */ - private function _header_feeds() + public function admin_requirements() { - $feeds = ""; + Requirements::js('media/js/jquery.form.js'); + Requirements::js('media/js/jquery.validate.min.js'); + Requirements::js('media/js/jquery.base64.js'); + Requirements::js('media/js/admin.js'); + Requirements::css('media/css/admin.css'); + Requirements::ieCSS("lt IE 7", 'media/css/ie6.css'); + } + + public function frontend_requirements() + { + // Add RSS feed if enabled if (Kohana::config("settings.allow_feed")) { - $feeds .= ""; + Requirements::customHeadTags("",'rss-feed'); } - - return $feeds; + + // Theme CSS + foreach(self::$theme_css as $css) + { + Requirements::css($css); + } + + Requirements::combine_files("theme_".Kohana::config("settings.site_style").".css", self::$theme_css); + + // Theme JS + foreach(self::$theme_js as $js) + { + Requirements::js($js); + } + + Requirements::combine_files("theme_".Kohana::config("settings.site_style").".js", self::$theme_js); + + Requirements::ieThemedCSS("lte IE 7", "iehacks.css"); + Requirements::ieThemedCSS("IE 7", "ie7hacks.css"); + Requirements::ieThemedCSS("IE 6", "ie6hacks.css"); } /** @@ -245,6 +393,11 @@ public function footer_block() $this->ushahidi_stats_js()."\n". $this->scheduler_js(); + if (Kohana::config('requirements.write_js_to_body')) + { + $content .= Requirements::render('js'); + } + // Filter::footer_block - Modify Footer Block Event::run('ushahidi_filter.footer_block', $content); @@ -404,4 +557,141 @@ public function ushahidi_stats_js() } return ''; } + + /* Static functions for theme loading */ + + private static $themes = array(); + private static $loaded_themes = array(); + private static $theme_js = array(); + private static $theme_css = array(); + + + /** + * Loads ushahidi themes + */ + public static function register_theme() + { + self::$themes = addon::get_addons('theme', TRUE); + + $theme = Kohana::config("settings.site_style"); + $theme = empty($theme) ? 'default' : $theme; + self::load_theme($theme); +} + + /** + * Load theme + * Loads theme into modules, includes its hooks and recursively loads parent themes + * @param string $theme theme name/directory + **/ + public static function load_theme($theme) + { + // Record loading this theme, so we can avoid dependency loops + self::$loaded_themes[] = $theme; + + // Get meta data to check the base theme + $meta = self::$themes[$theme]; + + // If base theme is set, the base theme exists, and we haven't loaded it yet + // Load the base theme + if (! empty($meta['Base Theme']) + AND isset(self::$themes[$meta['Base Theme']]) + AND ! in_array($meta['Base Theme'], self::$loaded_themes) + ) + { + self::load_theme($meta['Base Theme']); + } + + // Add theme to modules + $theme_base = THEMEPATH . $theme; + Kohana::config_set('core.modules', array_merge(array($theme_base), Kohana::config("core.modules"))); + + // We need to manually include the hook file for each theme + if (file_exists($theme_base.'/hooks')) + { + $d = dir($theme_base.'/hooks'); // Load all the hooks + while (($entry = $d->read()) !== FALSE) + { + if ($entry[0] != '.') + { + include $theme_base.'/hooks/'.$entry; + } + } + } + + self::load_theme_css($theme); + self::load_theme_js($theme); + } + + /* + * Find theme css and store for inclusion later + */ + private static function load_theme_css($theme) + { + $meta = self::$themes[$theme]; + // Add special cases for old themes + if (empty($meta['CSS'])) + { + $meta['CSS'] = array(); + $meta['CSS'][] = 'base'; + $meta['CSS'][] = 'style'; + $meta['CSS'][] = '_default'; + $meta['CSS'][] = $theme; + } + else + { + $meta['CSS'] = explode(',', $meta['CSS']); + $meta['CSS'] = array_map('trim',$meta['CSS']); + } + + // Add specified theme stylesheets + foreach ($meta['CSS'] as $css) + { + if (file_exists(THEMEPATH."$theme/css/$css.css")) + self::$theme_css[$css] = "themes/$theme/css/$css.css"; + } + + // Check for overrides of already added stylesheets + foreach (self::$theme_css as $css => $path) + { + if (file_exists(THEMEPATH."$theme/css/$css.css")) + self::$theme_css[$css] = "themes/$theme/css/$css.css"; + } + } + + /* + * Find theme css and store for inclusion later + */ + private static function load_theme_js($theme) + { + $meta = self::$themes[$theme]; + // Add special cases for old themes + if (empty($meta['JS'])) + { + $meta['JS'] = array(); + } + else + { + $meta['JS'] = explode(',', $meta['JS']); + $meta['JS'] = array_map('trim',$meta['JS']); + } + + // Add specified theme js + foreach ($meta['JS'] as $js) + { + if (file_exists(THEMEPATH."$theme/js/$js.js")) + self::$theme_js[$js] = "themes/$theme/js/$js.js"; + } + + // Check for overrides of already added js + foreach (self::$theme_css as $js => $path) + { + if (file_exists(THEMEPATH."$theme/js/$js.js")) + self::$theme_js[$js] = "themes/$theme/js/$js.js"; + } + } + + public static function loaded_themes() + { + return self::$loaded_themes; + } } diff --git a/application/libraries/cloudfiles/CF_Container.php b/application/libraries/cloudfiles/CF_Container.php index 7673133c0e..dc47c17b3a 100644 --- a/application/libraries/cloudfiles/CF_Container.php +++ b/application/libraries/cloudfiles/CF_Container.php @@ -910,7 +910,7 @@ function delete_object($obj,$container=NULL) */ function create_paths($path_name) { - if ($path_name[0] == '/') { + if (isset($path_name[0]) && $path_name[0] == '/') { $path_name = mb_substr($path_name, 0, 1); } $elements = explode('/', $path_name, -1); diff --git a/application/libraries/cloudfiles/CF_Object.php b/application/libraries/cloudfiles/CF_Object.php index bb7c4765b5..326b50ecd5 100644 --- a/application/libraries/cloudfiles/CF_Object.php +++ b/application/libraries/cloudfiles/CF_Object.php @@ -29,7 +29,7 @@ class CF_Object */ function __construct(&$container, $name, $force_exists=False, $dohead=True) { - if ($name[0] == "/") { + if (isset($name[0]) && $name[0] == "/") { $r = "Object name '".$name; $r .= "' cannot contain begin with a '/' character."; throw new Kohana_Exception($r); diff --git a/application/views/admin/layout.php b/application/views/admin/layout.php index 6daec2cc4e..0e9de98455 100644 --- a/application/views/admin/layout.php +++ b/application/views/admin/layout.php @@ -19,212 +19,10 @@ <?php echo html::specialchars($site_name) ?> ". - html::stylesheet(url::file_loc('css').'media/css/ie6', '', TRUE) - .""; - - // Load OpenLayers - if ($map_enabled) - { - echo html::script(url::file_loc('js').'media/js/OpenLayers', TRUE); - echo html::script(url::file_loc('js').'media/js/ushahidi', TRUE); - echo $api_url . "\n"; - echo ""; - echo html::stylesheet(url::file_loc('css').'media/css/openlayers','',TRUE); - } - - // Load jQuery - echo html::script(url::file_loc('js').'media/js/jquery', TRUE); - echo html::script(url::file_loc('js').'media/js/jquery.form', TRUE); - echo html::script(url::file_loc('js').'media/js/jquery.validate.min', TRUE); - echo html::script(url::file_loc('js').'media/js/jquery.ui.min', TRUE); - echo html::script(url::file_loc('js').'media/js/selectToUISlider.jQuery', TRUE); - echo html::script(url::file_loc('js').'media/js/jquery.hovertip-1.0', TRUE); - echo html::script(url::file_loc('js').'media/js/jquery.base64', TRUE); - ?> - - - - - '. - html::script(url::file_loc('js').'media/js/jquery.bgiframe.min', TRUE) - .''; - ?> - - - - $(function() { - if($('.tooltip[title]') != null) - $('.tooltip[title]').hovertip(); - }); - "; - - // Load Flot - if ($flot_enabled) - { - echo html::script(url::file_loc('js').'media/js/jquery.flot', TRUE); - echo html::script(url::file_loc('js').'media/js/excanvas.min', TRUE); - echo html::script(url::file_loc('js').'media/js/timeline.js', TRUE); - } - - // Load TreeView - if ($treeview_enabled) - { - echo html::script(url::file_loc('js').'media/js/jquery.treeview'); - echo html::stylesheet(url::file_loc('css').'media/css/jquery.treeview'); - } - - // Load ProtoChart - if ($protochart_enabled) - { - echo ""; - echo html::script(url::file_loc('js').'media/js/protochart/prototype', TRUE); - echo ''; - echo html::script(url::file_loc('js').'media/js/protochart/ProtoChart', TRUE); - } - - // Load Raphael - if ($raphael_enabled) - { - // The only reason we include prototype is to keep the div element naming convention consistent - //echo html::script(url::file_loc('js').'media/js/protochart/prototype', TRUE); - echo html::script(url::file_loc('js').'media/js/raphael', TRUE); - echo ''; - echo html::script(url::file_loc('js').'media/js/raphael-ushahidi-impact', TRUE); - } - - // Load ColorPicker - if ($colorpicker_enabled) - { - echo html::stylesheet(url::file_loc('css').'media/css/colorpicker', '', TRUE); - echo html::script(url::file_loc('js').'media/js/colorpicker', TRUE); - } - - // Load jwysiwyg - if ($editor_enabled) - { - if (Kohana::config("cdn.cdn_ignore_jwysiwyg") == TRUE) { - echo html::script(url::file_loc('ignore').'media/js/jwysiwyg/jwysiwyg/jquery.wysiwyg.js', TRUE); - } else { - echo html::script(url::file_loc('js').'media/js/jwysiwyg/jwysiwyg/jquery.wysiwyg.js', TRUE); - } - } - - // Table Row Sort - if ($tablerowsort_enabled) - { - echo html::script(url::file_loc('js').'media/js/jquery.tablednd_0_5', TRUE); - } - - // JSON2 for IE+ - if ($json2_enabled) - { - echo html::script(url::file_loc('js').'media/js/json2', TRUE); - } - - // Turn on picbox - echo html::script(url::file_loc('js').'media/js/picbox', TRUE); - echo html::stylesheet(url::file_loc('css').'media/css/picbox/picbox'); - - //Turn on jwysiwyg - echo html::stylesheet(url::file_loc('css').'media/js/jwysiwyg/jwysiwyg/jquery.wysiwyg.css'); - - // Header Nav - echo html::script(url::file_loc('js').'media/js/global', TRUE); - echo html::stylesheet(url::file_loc('css').'media/css/global','',TRUE); - - // Render CSS and Javascript Files from Plugins - echo plugin::render('stylesheet'); - echo plugin::render('javascript'); - // Action::header_scripts_admin - Additional Inline Scripts Event::run('ushahidi_action.header_scripts_admin'); ?> "; - echo html::script(url::file_loc('js').'media/js/ushahidi', TRUE); - echo html::stylesheet(url::file_loc('css').'media/css/openlayers','',TRUE); - } - - // Load jQuery - echo html::script(url::file_loc('js').'media/js/jquery', TRUE); - echo html::script(url::file_loc('js').'media/js/jquery.form', TRUE); - echo html::script(url::file_loc('js').'media/js/jquery.validate.min', TRUE); - echo html::script(url::file_loc('js').'media/js/jquery.ui.min', TRUE); - echo html::script(url::file_loc('js').'media/js/selectToUISlider.jQuery', TRUE); - echo html::script(url::file_loc('js').'media/js/jquery.hovertip-1.0', TRUE); - echo html::script(url::file_loc('js').'media/js/jquery.base64', TRUE); - echo html::stylesheet(url::file_loc('css').'media/css/jquery.hovertip-1.0', '', TRUE); - - echo ""; - - // Load Flot - if ($flot_enabled) - { - echo html::script(url::file_loc('js').'media/js/jquery.flot', TRUE); - echo html::script(url::file_loc('js').'media/js/excanvas.min', TRUE); - echo html::script(url::file_loc('js').'media/js/timeline.js', TRUE); - } - - // Load TreeView - if ($treeview_enabled) { - echo html::script(url::file_loc('js').'media/js/jquery.treeview'); - echo html::stylesheet(url::file_loc('css').'media/css/jquery.treeview'); - } - - // Load ProtoChart - if ($protochart_enabled) - { - echo ""; - echo html::script(url::file_loc('js').'media/js/protochart/prototype', TRUE); - echo ''; - echo html::script(url::file_loc('js').'media/js/protochart/ProtoChart', TRUE); - } - - // Load Raphael - if($raphael_enabled) - { - // The only reason we include prototype is to keep the div element naming convention consistent - //echo html::script(url::file_loc('js').'media/js/protochart/prototype', TRUE); - echo html::script(url::file_loc('js').'media/js/raphael', TRUE); - echo ''; - echo html::script(url::file_loc('js').'media/js/raphael-ushahidi-impact', TRUE); - } - - // Load ColorPicker - if ($colorpicker_enabled) - { - echo html::stylesheet(url::file_loc('css').'media/css/colorpicker', '', TRUE); - echo html::script(url::file_loc('js').'media/js/colorpicker', TRUE); - } - - // Load TinyMCE - if ($editor_enabled) - { - echo html::script(url::file_loc('js').'media/js/tinymce/tiny_mce', TRUE); - } - - // JSON2 for IE+ - if ($json2_enabled) - { - echo html::script(url::file_loc('js').'media/js/json2', TRUE); - } - - // Load AutoComplete Plugin - if ($autocomplete_enabled) - { - echo html::stylesheet(url::file_loc('css').'media/css/jquery.autocomplete', '', TRUE); - echo html::script(url::file_loc('js').'media/js/jquery.autocomplete.pack', TRUE); - } - - // Turn on picbox - echo html::script(url::file_loc('js').'media/js/picbox', TRUE); - echo html::stylesheet(url::file_loc('css').'media/css/picbox/picbox'); - - // Header Nav - echo html::script(url::file_loc('js').'media/js/global', TRUE); - echo html::stylesheet(url::file_loc('css').'media/css/global','',TRUE); - - // Render CSS and Javascript Files from Plugins - echo plugin::render('stylesheet'); - echo plugin::render('javascript'); - // Action::header_scripts_member - Additional Inline Scripts Event::run('ushahidi_action.header_scripts_member'); ?> + + diff --git a/media/css/admin/all.css b/media/css/admin.css similarity index 88% rename from media/css/admin/all.css rename to media/css/admin.css index b86ac0a18b..e6aab03a6d 100755 --- a/media/css/admin/all.css +++ b/media/css/admin.css @@ -89,7 +89,7 @@ a:hover{ text-decoration:none;} font-size:12px; color:#fff; padding:0 3px 0 10px; - background:url(../../img/admin/top-separator.gif) no-repeat 0 8px; + background:url(../img/admin/top-separator.gif) no-repeat 0 8px; display:inline; list-style:none; } @@ -222,7 +222,7 @@ ul.sub-nav li a:hover{ text-decoration:underline;} /*-- content --*/ #content{ - background:url(../../img/admin/content-bg.gif) repeat-x; + background:url(../img/admin/content-bg.gif) repeat-x; width:940px; padding:10px 10px 0; overflow:hidden; @@ -259,7 +259,7 @@ ul.inf { float:right; } ul.inf li{ - background:url(../../img/admin/separator.gif) no-repeat 0 4px; + background:url(../img/admin/separator.gif) no-repeat 0 4px; padding:0 7px 0 5px; color:#898989; float:left; @@ -304,7 +304,7 @@ ul.inf li a{ } .info-container .i-c-head ul li{ padding:0 10px 0 12px; - background:url(../../img/admin/separator.gif) no-repeat 0 3px; + background:url(../img/admin/separator.gif) no-repeat 0 3px; float:left; list-style:none; } @@ -314,7 +314,7 @@ ul.inf li a{ width:12px; height:12px; text-indent:-3000px; - background:url(../../img/admin/icon-rss.gif) no-repeat; + background:url(../img/admin/icon-rss.gif) no-repeat; overflow:hidden; } .post { @@ -381,12 +381,12 @@ ul.post-info li a{ text-decoration:none; } -ul.post-info li a.ok{ background:url(../../img/admin/icon-ok.gif) no-repeat 100% 3px;} -ul.post-info li a.none{ background:url(../../img/admin/icon-none.gif) no-repeat 100% 3px;} -ul.post-info li a.mail{ background:url(../../img/admin/icon-mail.gif) no-repeat 100% 3px;} -ul.post-info li a.phone{ background:url(../../img/admin/icon-phone.gif) no-repeat 100% 2px;} -ul.post-info li a.sms{ background:url(../../img/admin/icon-phone.gif) no-repeat 100% 2px;} -ul.post-info li a.twitter{ background:url(../../img/admin/icon-twitter.gif) no-repeat 100% 2px;} +ul.post-info li a.ok{ background:url(../img/admin/icon-ok.gif) no-repeat 100% 3px;} +ul.post-info li a.none{ background:url(../img/admin/icon-none.gif) no-repeat 100% 3px;} +ul.post-info li a.mail{ background:url(../img/admin/icon-mail.gif) no-repeat 100% 3px;} +ul.post-info li a.phone{ background:url(../img/admin/icon-phone.gif) no-repeat 100% 2px;} +ul.post-info li a.sms{ background:url(../img/admin/icon-phone.gif) no-repeat 100% 2px;} +ul.post-info li a.twitter{ background:url(../img/admin/icon-twitter.gif) no-repeat 100% 2px;} .post h4{ padding:9px 0 0; font-weight:normal; @@ -422,7 +422,7 @@ ul.nav-list { } ul.nav-list li{ padding:18px 0 19px; - background:url(../../img/admin/dots.gif) repeat-x 0 100%; + background:url(../img/admin/dots.gif) repeat-x 0 100%; float:left; width:395px; list-style:none; @@ -434,16 +434,16 @@ ul.nav-list li a{ line-height:20px; color:#9b0000; } -ul.nav-list li a.reports {background:url(../../img/admin/report-icon.gif) no-repeat 0 0;} -ul.nav-list li a.categories { background:url(../../img/admin/category-icon.gif) no-repeat 0 5px;} -ul.nav-list li a.locations { background:url(../../img/admin/locations-icon.gif) no-repeat 0 2px;} -ul.nav-list li a.media { background:url(../../img/admin/media-icon.gif) no-repeat 0 2px;} -ul.nav-list li a.messages { background:url(../../img/admin/messages-icon.gif) no-repeat 0 2px;} -ul.nav-list li a.alerts { background:url(../../img/admin/alerts-icon.png) no-repeat 0 2px;} -ul.nav-list li a.votes { background:url(../../img/admin/votes-icon.png) no-repeat 0 2px;} -ul.nav-list li a.checkins { background:url(../../img/admin/checkins-icon.png) no-repeat 0 2px;} +ul.nav-list li a.reports {background:url(../img/admin/report-icon.gif) no-repeat 0 0;} +ul.nav-list li a.categories { background:url(../img/admin/category-icon.gif) no-repeat 0 5px;} +ul.nav-list li a.locations { background:url(../img/admin/locations-icon.gif) no-repeat 0 2px;} +ul.nav-list li a.media { background:url(../img/admin/media-icon.gif) no-repeat 0 2px;} +ul.nav-list li a.messages { background:url(../img/admin/messages-icon.gif) no-repeat 0 2px;} +ul.nav-list li a.alerts { background:url(../img/admin/alerts-icon.png) no-repeat 0 2px;} +ul.nav-list li a.votes { background:url(../img/admin/votes-icon.png) no-repeat 0 2px;} +ul.nav-list li a.checkins { background:url(../img/admin/checkins-icon.png) no-repeat 0 2px;} ul.nav-list li span.locations { - background:url(../../img/admin/locations-icon.gif) no-repeat 0 2px; + background:url(../img/admin/locations-icon.gif) no-repeat 0 2px; padding:0 0 5px 40px; float:left; font-size:18px; @@ -487,7 +487,7 @@ ul.nav-list li li strong{ } /*-- footer --*/ #footer{ - background:#202020 url(../../img/admin/footer-bg.jpg) repeat-x; + background:#202020 url(../img/admin/footer-bg.jpg) repeat-x; border-top:4px solid #cb0000; border-bottom:4px solid #cb0000; height:213px; @@ -499,7 +499,7 @@ ul.nav-list li li strong{ #footer a{ margin:34px 0 0 60px; - background:url(../../img/admin/logo.gif) no-repeat; + background:url(../img/admin/logo.gif) no-repeat; width:257px; height:39px; display:block; @@ -657,7 +657,7 @@ a.hide { font-size:11px; color:#b75f5f; padding:0 0 0 43px; - background:url(../../img/admin/separator-1.gif) no-repeat 17px 3px; + background:url(../img/admin/separator-1.gif) no-repeat 17px 3px; } table{ margin:0; @@ -709,7 +709,7 @@ table td{ .table .col-2_sub{ width:519px; padding-left:30px; - background:url(../../img/admin/arrow.gif) no-repeat 13px 22px; + background:url(../img/arrow-play.gif) no-repeat 13px 22px; } .table .col-3{ width:103px; @@ -733,7 +733,7 @@ table td{ background-color:#ffffcc; } .table .col-show-handle{ - background-image: url(../../img/admin/drag.gif); + background-image: url(../img/admin/drag.gif); background-repeat: no-repeat; background-position: center center; cursor: move; @@ -782,7 +782,7 @@ ul.links li{ } ul.info li { padding:0 9px 0 10px; - background:url(../../img/admin/separator-2.gif) no-repeat 0 3px; + background:url(../img/admin/separator-2.gif) no-repeat 0 3px; } ul.info li.none-separator{ padding-left:0;} ul.info li strong { @@ -804,7 +804,7 @@ ul.links li a:hover{ } .table .col-4 ul li{ padding:0 10px 0 12px; - background:url(../../img/admin/separator.gif) no-repeat 0 4px; + background:url(../img/admin/separator.gif) no-repeat 0 4px; float:left; list-style:none; } @@ -814,7 +814,7 @@ ul.links li a:hover{ /*-- tooltips --*/ .tooltip{ cursor: help; - background:url(../../img/tooltip.gif) no-repeat 100% 4px; + background:url(../img/tooltip.gif) no-repeat 100% 4px; padding-right:10px; } a.tooltip{ @@ -985,7 +985,7 @@ a.calendar { float:left; width:22px; height:21px; - background:url(../../img/icon-calendar.gif) no-repeat; + background:url(../img/icon-calendar.gif) no-repeat; } .time { width:188px; @@ -1011,7 +1011,7 @@ a.new-cat, a.show-messages { text-decoration:underline; font-size:10px; padding:1px 0 0 18px; - background:url(../../img/icon-plus.gif) no-repeat 0 4px; + background:url(../img/icon-plus.gif) no-repeat 0 4px; float:right; } a.new-cat:hover, a.show-messages:hover{ text-decoration:none;} @@ -1019,7 +1019,7 @@ a.category_translations { text-decoration:underline; font-size:10px; padding:5px 0 0 18px; - background:url(../../img/icon-plus.gif) no-repeat 0 4px; + background:url(../img/icon-plus.gif) no-repeat 0 4px; float:left; margin: 10px 10px 0 10px; } @@ -1201,9 +1201,9 @@ a.rem{ width:13px; height:13px; float:left; - background:url(../../img/icon-plus.gif) no-repeat; + background:url(../img/icon-plus.gif) no-repeat; } -a.rem { background:url(../../img/icon-minus.gif) no-repeat;} +a.rem { background:url(../img/icon-minus.gif) no-repeat;} input.short { width:50px; } @@ -1660,7 +1660,7 @@ a.new-form_field{ font-size:11px; font-weight:bold; padding:1px 0 0 18px; - background:url(../../img/icon-plus.gif) no-repeat 0 2px; + background:url(../img/icon-plus.gif) no-repeat 0 2px; } .forms_item{ float:left; @@ -1725,7 +1725,7 @@ a.new-form_field{ border:1px solid #fff; } .jColorSelect div{ - background:url(../../img/icon_check.gif) no-repeat; + background:url(../img/icon_check.gif) no-repeat; float:left; width:13px; height:13px; @@ -2204,10 +2204,10 @@ ul.map-toggles li { display:none; float:right; list-style-type: none; } ul.map-toggles li a, ul.map-toggles li a:active { display:inline-block; padding:3px 5px 3px 17px; outline:none; } - a.wider-map { background:transparent url(../../img/admin/icon_sprite.png) -4px -202px no-repeat; } - a.taller-map { background:transparent url(../../img/admin/icon_sprite.png) -4px -221px no-repeat; } - a.shorter-map { background:transparent url(../../img/admin/icon_sprite.png) -4px -241px no-repeat; } - a.smaller-map { background:transparent url(../../img/admin/icon_sprite.png) -4px -182px no-repeat; } + a.wider-map { background:transparent url(../img/admin/icon_sprite.png) -4px -202px no-repeat; } + a.taller-map { background:transparent url(../img/admin/icon_sprite.png) -4px -221px no-repeat; } + a.shorter-map { background:transparent url(../img/admin/icon_sprite.png) -4px -241px no-repeat; } + a.smaller-map { background:transparent url(../img/admin/icon_sprite.png) -4px -182px no-repeat; } /* Map Labeler */ #geometryLabelerHolder{ @@ -2559,10 +2559,10 @@ div.dp-popup td.disabled { margin: 4px 0 0 6px; } .sort-ASC { - background: url(../../img/admin/drag.gif) 0 0 no-repeat; + background: url(../img/admin/drag.gif) 0 0 no-repeat; } .sort-DESC { - background: url(../../img/admin/drag.gif) 0 -8px no-repeat; + background: url(../img/admin/drag.gif) 0 -8px no-repeat; } /* Report search form */ diff --git a/media/css/admin/ie6.css b/media/css/admin/ie6.css deleted file mode 100644 index 164620a57e..0000000000 --- a/media/css/admin/ie6.css +++ /dev/null @@ -1,3 +0,0 @@ -body{ - width:expression(document.documentElement.clientWidth < 960 ? "960px" : "auto"); -} diff --git a/media/css/all.css b/media/css/all.css deleted file mode 100644 index 60aeb9a048..0000000000 --- a/media/css/all.css +++ /dev/null @@ -1,1496 +0,0 @@ -body { - margin:0; - color:#666; - font:12px/15px Arial, Helvetica, sans-serif; - background:#fff url(../img/page-bg.gif) repeat-x; -} -#main { - margin:0 auto; - width:960px; - clear:both; - overflow:hidden; -} -a{ - color:#003399; -} -a:visited{ - color:#0066CC; -} -/*-----header-----*/ - -#header { - clear:both; - width:960px; - height:100px; - overflow:hidden; - position:relative; -} -#header .header-info { - float:left; - width:360px; - padding:26px 0 0 20px -} -#header .header-info strong, -#header .header-info strong a, -#header .header-info strong a:visited{ - color:#fff; - font:28px/33px Arial, Helvetica, sans-serif; - text-decoration:none; -} -#header .header-info p { - color:#fff; - margin:0; - font:12px/18px Arial, Helvetica, sans-serif; -} -#header #menu { - float:right; - margin:70px 0 0; - padding:0; - background:url(../img/nav-bg.gif) no-repeat 100% 0; -} -#header #menu li { - float:left; - padding:0 0 0 1px; - list-style:none; - font:14px/29px Arial, Helvetica, sans-serif; - background:url(../img/nav-separator.gif) no-repeat; -} -#header #menu li a { - float:left; - padding:0 9px; - color:#fff; - text-decoration:none; -} -#header #menu li a.active, -#header #menu li a:hover { - background:url(../img/nav-active.gif) repeat-x; - color:#333; -} -#header #menu li.first a {background:url(../img/nav-first.gif) no-repeat !important;} -#header #menu li.first a:hover, -#header #menu li.first a.active {background-position:0 -29px !important;} -#header #menu li.last a {background:url(../img/nav-last.gif) no-repeat 100% 0 !important;} -#header #menu li.last a:hover, -#header #menu li.last a.active {background-position:100% -29px !important;} -#header .lang_search{ - position:absolute; - top:0; - right:0; - float:right; - margin:10px 0 0 0; -} -#header .lang_box{ - float:left; - margin-right:15px; -} -#header .search_box{ - float:left; -} -#header input.searchbtn -{ - cursor:pointer; - border:outset 1px #ccc; - background:#999; - color:#666; - font-weight:bold; - padding: 2px 2px; - background:url(../img/btn_bkg_g.gif) repeat-x left top; - float:left; - margin-left:5px; -} -#header .text{ - font-size:100%; - color:#00789F; - background-color:#ccc; - padding:2px; - border:1px #ccc solid; - width:120px; - float:left; -} - -#languages { float: left; margin:0; padding:0; } -#languages li { display: inline; } -#languages a { display: block; float: left; margin-right:10px; padding:2px 3px 0 3px; border: none; background: #333; } -#languages a:hover { background-color: #999; } -#languages a.active { background-color: #666; } -#languages img{ - border:none; -} - -/*-----content-----*/ -#content { - clear:both; - width:960px; - overflow:hidden; - background:#cc9 url(../img/content-top.gif) no-repeat; -} -#content .content-bg { - overflow:hidden; - width:930px; - padding:12px 15px 20px; - background:url(../img/content-bottom.gif) no-repeat 0 100%; -} -/*---big-block---*/ -.big-block { - overflow:hidden; - width:930px; - background:url(../img/big-block-bg.gif) repeat-y; -} -.big-block .big-block-top { - overflow:hidden; - width:100%; - background:url(../img/big-block-top.gif) no-repeat; -} -.big-block .big-block-bottom { - overflow:hidden; - width:880px; - padding:16px 25px 20px; - background:url(../img/big-block-bottom.gif) no-repeat 0 100%; -} -.big-block h1 { - margin:0; - padding:8px 0 0; - overflow:hidden; - width:100%; - clear:both; - color:#09c; - font:bold 18px/22px Arial, Helvetica, sans-serif; -} -/*--big-map-block--*/ -.big-map-block { - float:left; - width:574px; -} -.big-map-block .filter { - overflow:hidden; - width:100%; - position:relative; -} -.big-map-block .filter strong { - float:left; - padding:0 10px 0 0; - color:#333; - font:bold 10px/13px Arial, Helvetica, sans-serif; - text-transform:uppercase; - background:url(../img/arrow.gif) no-repeat 100% 50%; -} -.big-map-block .filter ul { - float:left; - margin:0; - padding:0 0 5px 6px; -} -.big-map-block .filter ul li { - float:left; - padding:0 1px; - list-style:none; - font:10px/13px Arial, Helvetica, sans-serif; - text-transform:uppercase; -} -.big-map-block .filter ul li a { - float:left; - color:#996; - text-decoration:none; -} -.big-map-block .filter ul li a span { - float:left; - padding:0 5px; -} -/*.big-map-block .filter ul li a span.active,*/ -.big-map-block .filter ul li a.active, -.big-map-block .filter ul li a:hover { - background:#3399cc url(../img/filter-item-l.gif) no-repeat; - color:#fff; -} -.big-map-block .filter ul li a.active span, -.big-map-block .filter ul li a:hover span {background:url(../img/filter-item-r.gif) no-repeat 100% 0;} -.big-map-block .map-holder { - overflow:hidden; - width:100%; - border:1px solid #ccc; - width:573px; - height:366px; -} -.big-map-block .map-loader { - top:0; - position:absolute; - width:200px; - height:200px; - background-color:red; - display:none; -} -.big-map-block .slider-holder { - margin-top:10px; - width:573px; - height:70px; - font-size: 70%; -} -.slider-holder form, .slider-holder fieldset { - border:0; -} -.slider-holder form, .slider-holder fieldset { - border:0; -} -.slider-holder .play{ - float:right; - border:1px solid #ccc; - background-color:#eee; - padding:3px 6px 3px 15px; - color:#666; - font-weight:bold; - background-image:url(../img/arrow-play.gif); - background-position:5px 50%; - background-repeat:no-repeat; - font-size:1.2em; -} -.slider-holder .pause{ - background-image:url(../img/pause.gif); -} -.slider-holder .play a{ - color:#666; - text-decoration:none; -} -.slider-holder .play:hover{ - background-color:#ffffcc; -} -.slider-holder .play a:hover{ - text-decoration:underline; -} -.olControlLoadingPanel { - background-image:url(../img/loading.gif); - background-position:center; - background-repeat:no-repeat; -} -.olPopupCloseBox { - background: url("../img/openlayers/close.gif") no-repeat; - cursor: pointer; -} -.infowindow{ - padding:10px; - margin-right:-15px; -} -.infowindow h2{ - margin:0 0 5px 0; - padding:0; - font-size:12px; - font-weight:bold; - font-size:14px; -} -.infowindow .infowindow_list{ - padding:10px 0 10px 0; - border:1px solid #ccc; - border-width:1px 0 1px 0; -} -.infowindow ul{ - font-weight:bold; - margin:0 0 0 1em; - padding:0; -} -.infowindow li{ - list-style-type: square; -} -.infowindow a, .infowindow a:visited{ - color:#000; -} -.infowindow a:hover{ - text-decoration:none; -} -.infowindow .infowindow_meta{ - background-color:#eee; - font-size:90%; - padding:1px 5px 3px 5px; -} -/*--category--*/ -.category { - float:right; - width:282px; -} -.category strong.title { - display:block; - padding:0 0 5px 10px; - color:#333; - font:bold 10px/13px Arial, Helvetica, sans-serif; - text-transform:uppercase; - background:url(../img/arrow-down.gif) no-repeat 0 4px; -} -.category .grey-box { - overflow:hidden; - width:100%; - background:#eee url(../img/grey-box-top.gif) no-repeat; -} -.category .grey-box .grey-box-bg { - overflow:hidden; - width:100%; - background:url(../img/grey-box-bottom.gif) no-repeat 0 100%; -} -.category .grey-box ul { - overflow:hidden; - width:264px; - margin:8px 0 0; - padding:0 0 8px 9px; -} -.category .grey-box ul li { - float:left; - width:100%; - list-style:none; -} -.category .grey-box ul li a { - float:left; - padding:0 0 3px 11px; - width:253px; - color:#0091c4; - font:14px/28px Arial, Helvetica, sans-serif; - text-decoration:none; -} -.category .grey-box ul li a:hover, -.category .grey-box ul li a.active { - color:#fff; - background:url(../img/category-item-active.gif) no-repeat; -} -.category .grey-box ul li a span { - float:left; - cursor:pointer; -} -.category .swatch{ - float:left; - margin:6px 8px 0 0; - width:16px; - height:16px; -} -.category .report-btns { - overflow:hidden; - width:100%; - clear:both; - padding:18px 0 0; -} -.category .report-btns a { - float:left; - color:#fff; - font:bold 14px/34px Arial, Helvetica, sans-serif; - text-decoration:none; -} -.category .report-btns a span { - float:left; - padding:0 9px 3px; - cursor:pointer; -} -.category .report-btns a:hover, -.category .report-btns a:hover span {text-decoration:underline;} -.category .report-btns a.btn-red {background:url(../img/red-btn-l.gif) no-repeat;} -.category .report-btns a.btn-red span {background:url(../img/red-btn-r.gif) no-repeat 100% 0;} -.category .report-btns a.btn-grey { - background:url(../img/grey-btn-l.gif) no-repeat; - margin-top:5px; -} -.category .report-btns a.btn-grey span {background:url(../img/grey-btn-r.gif) no-repeat 100% 0;} -.category p { - margin:14px 0 0; - width:100%; - text-align:center; - font:14px/20px Arial, Helvetica, sans-serif; - color:#666; -} -/*---blocks-holder---*/ -.blocks-holder { - overflow:hidden; - width:100%; - padding:18px 0 0; -} -.blocks-holder .incidents, -.blocks-holder .images {float:left;} -.blocks-holder .news, -.blocks-holder .side-block {float:right;} -.blocks-holder .side-block .block-bg {margin:0 0 20px;} -.small-block {width:460px;} -.small-block h3 { - overflow:hidden; - margin:0 0 -1px; - padding:0 0 0 26px; - color:#666; - font:bold 14px/17px Arial, Helvetica, sans-serif; -} -.small-block h3 span {font-size:10px;} -.small-block .block-bg { - overflow:hidden; - width:100%; - background:url(../img/small-block-bg.gif) repeat-y; -} -.small-block .block-top { - overflow:hidden; - width:100%; - background:url(../img/small-block-top.gif) no-repeat; -} -.small-block .block-bottom { - overflow:hidden; - width:410px; - padding:20px 25px 10px; - background:url(../img/small-block-bottom.gif) no-repeat 0 100%; -} -.small-block .block-bg ul { - overflow:hidden; - width:100%; - margin:0; - padding:0 0 10px; -} -.small-block .block-bg ul li { - float:left; - width:100%; - padding:4px 0; - list-style:none; - font:11px/14px Arial, Helvetica, sans-serif; - border-bottom:1px solid #eee; -} -.small-block .block-bg ul li:first-child {border:none;} -.small-block .block-bg ul li.w-01 { - width:238px; - padding:0 10px 0 0; -} -.small-block .block-bg ul li.w-02 { - width:92px; - padding:0 10px 0 0; -} -.small-block .block-bg ul li.w-03 {width:60px;} -.small-block .block-bg ul li a { - color:#09c; - text-decoration:none; -} -.small-block .block-bg ul li a:hover {text-decoration:underline;} -.small-block .block-bg ul li ul {padding:0;} -.small-block .block-bg ul li ul li { - border:none; - padding:0; -} -.small-block .block-bg ul li ul.title li {font:10px/14px Arial, Helvetica, sans-serif;} -.small-block .block-bg a.btn-more { - float:right; - color:#fff; - font:bold 10px/12px Arial, Helvetica, sans-serif; - text-decoration:none; - background:#39c url(../img/filter-item-l.gif) no-repeat; -} -.small-block .block-bg a.btn-more span { - float:left; - padding:0 5px 1px; - cursor:pointer; - background:url(../img/filter-item-r.gif) no-repeat 100% 0; -} -.small-block .block-bg a.btn-more:hover, -.small-block .block-bg a.btn-more:hover span {text-decoration:underline;} -/*---alerts-block---*/ -.step-1 { - float:left; - width:430px; - margin:20px 0 0; - padding:0 0 10px; - border:1px solid #cc9; -} -.step-1 h2 { - margin:0; - padding:0 0 0 10px; - background:#cc9; - font:14px/28px Arial, Helvetica, sans-serif; - color:#666; -} -.step-1 .location { - overflow:hidden; - width:388px; - padding:10px; - margin:10px 0 0 10px; - border:1px solid #eee; -} -.step-1 .location label { - display:block; - color:#666; - padding:0 0 8px; - font:12px/15px Arial, Helvetica, sans-serif; -} -.step-1 .map { - overflow:hidden; - width:388px; - padding:10px; - margin:10px 0 0 10px; - border:1px solid #eee; -} -.step-1 .map p { - margin:0; - padding:0 0 6px; - font:12px/15px Arial, Helvetica, sans-serif; -} -.step-1 .map .map-holder { - overflow:hidden; - border:1px solid #ccc; - width:387px; - height:290px; -} -.step-2-holder { - float:right; - width:432px; -} -.step-2 { - overflow:hidden; - width:430px; - margin:20px 0 0; - padding:0 0 10px; - border:1px solid #cc9; -} -.step-2 h2 { - margin:0; - padding:0 0 0 10px; - background:#cc9; - font:14px/28px Arial, Helvetica, sans-serif; - color:#666; -} -.step-2 .holder { - overflow:hidden; - width:100%; -} -.step-2 .box { - overflow:hidden; - width:388px; - padding:10px; - margin:10px 0 0 10px; - border:1px solid #eee; -} -.step-2 .box input { - overflow:hidden; - margin:0 0 0 22px; - clear:both; -} -.step-2 .box label { - display:block; - width:100%; - overflow:hidden; - color:#666; - padding:0 0 8px; - font:12px/15px Arial, Helvetica, sans-serif; - clear:both; -} -.step-2 .box label input { - float:left; - margin:2px 0 0; - padding:0; - padding:0; - clear:both; - width:auto; -} -* html .step-2 .box label input { - width:15px; - height:15px; -} -* +html .step-2 .box label input { - width:15px; - height:15px; -} -.step-2 .box label span { - float:left; - padding:0 0 0 10px; -} -.step-2-holder #btn-send-alerts { - float:right; - margin:20px 0 0; - padding:0 0 2px; - width:118px; - height:31px; - color:#fff; - font:14px Arial, Helvetica, sans-serif; - background:url(../img/btn-blue.gif) no-repeat; - border:0; - cursor:pointer; -} -/*--incident-name--*/ -.incident-name { - float:left; - width:430px; - margin:0 0 20px; -} -.incident-name ul { - overflow:hidden; - width:100%; - margin:12px 0 0; - padding:0; -} -.incident-name ul li { - float:left; - width:100%; - padding:6px 0; - list-style:none; - border-top:1px solid #eee; -} -.incident-name ul li:first-child {border:none;} -.incident-name ul li strong { - display:block; - width:100%; - font:bold 10px/13px Arial, Helvetica, sans-serif; -} -.incident-name ul li p { - margin:0; - font:12px/15px Arial, Helvetica, sans-serif; -} -.incident-name ul li p strong.green { - display:inline; - color:#339933; - font:bold 12px/15px Arial, Helvetica, sans-serif; -} -.incident-name ul li p strong.red { - display:inline; - color:#CC0000; - font:bold 12px/15px Arial, Helvetica, sans-serif; -} -.incident-name ul li p a { - color:#09c; - text-decoration:none; -} -.incident-name ul li p a:hover {text-decoration:underline;} -/*--incident-map--*/ -.incident-map { - float:right; - width:430px; - margin:0 0 20px; -} -.incident-map ul.legend { - float:right; - margin:0; - padding:0 0 5px; -} -.incident-map ul.legend li { - float:left; - margin:0 0 0 11px; - display:inline; - list-style:none; - color:#996; - font:10px/13px Arial, Helvetica, sans-serif; - text-transform:uppercase; - padding:0 0 0 16px; -} -.incident-map ul.legend li.ico-red {background:url(../img/ico-red.gif) no-repeat;} -.incident-map ul.legend li.ico-orange {background:url(../img/ico-orange.gif) no-repeat;} -.incident-map .map-holder { - overflow:hidden; - clear:both; - border:1px solid #ccc; - width:428px; - height:298px; -} -/*--report-description--*/ -.report-description { - overflow:hidden; - border:1px solid #cc9; - clear:both; - width:878px; - padding:0 0 30px; -} -.report-description .title { - overflow:hidden; - background:#cc9; - width:100%; -} -.report-description .title h2 { - float:left; - margin:0; - padding:0 0 0 10px; - font:bold 14px/28px Arial, Helvetica, sans-serif; -} -.report-description .title a { - float:right; - margin:7px 10px 0 0; - display:inline; - font:10px/13px Arial, Helvetica, sans-serif; - color:#fff; - text-decoration:none; - background:#09c url(../img/lnk-info-l.gif) no-repeat; - text-transform:uppercase; -} -.report-description .title a:hover, -.report-description .title a:hover span {text-decoration:underline;} -.report-description .title a span { - float:left; - padding:0 4px; - cursor:pointer; - background:url(../img/lnk-info-r.gif) no-repeat 100% 0; -} -.report-description .orig-report { - overflow:hidden; - border:1px solid #eee; - width:838px; - margin:20px 0 -10px 19px; -} -.report-description .orig-report .report { - overflow:hidden; - background:#ffc; - padding:10px; - width:818px; -} -.report-description .orig-report .report h4 { - margin:0; - width:100%; - clear:both; - font:bold 12px/17px Arial, Helvetica, sans-serif; - text-transform:uppercase; -} -.report-description .orig-report .report p { - margin:0; - font:12px/17px Arial, Helvetica, sans-serif; -} -.report-description .orig-report .report a.lnk { - float:left; - margin:7px 0 0; - font:10px/13px Arial, Helvetica, sans-serif; - text-decoration:none; - color:#fff; - background:#393 url(../img/green-btn-l.gif) no-repeat; - text-transform:uppercase; -} -.report-description .orig-report .report a.lnk:hover, -.report-description .orig-report .report a.lnk:hover span {text-decoration:underline;} -.report-description .orig-report .report a.lnk span { - float:left; - padding:0 4px; - cursor:pointer; - background:url(../img/green-btn-r.gif) no-repeat 100% 0; -} -.report-description .orig-report .discussion { - overflow:hidden; - padding:16px 20px 20px; - width:798px; -} -.report-description .orig-report .discussion h5 { - margin:0; - width:100%; - clear:both; - font:bold 12px/17px Arial, Helvetica, sans-serif; - text-transform:uppercase; -} -.discussion h5 a, .discussion h5 a:visited{ - text-transform:none; -} -.report-description .orig-report .discussion .discussion-box { - overflow:hidden; - width:778px; - margin:10px 0 0; - padding:10px; - background:#eee; -} -.report-description .orig-report .discussion .discussion-box p { - margin:0; - font:12px/17px Arial, Helvetica, sans-serif; -} -.report-description .orig-report .discussion .discussion-box a.lnk { - float:left; - margin:7px 0 0; - font:10px/13px Arial, Helvetica, sans-serif; - text-decoration:none; - color:#fff; - background:#393 url(../img/green-btn-l.gif) no-repeat; - text-transform:uppercase; -} -.report-description .orig-report .discussion .discussion-box a.lnk:hover, -.report-description .orig-report .discussion .discussion-box a.lnk:hover span {text-decoration:underline;} -.report-description .orig-report .discussion .discussion-box a.lnk span { - float:left; - padding:0 4px; - cursor:pointer; - background:url(../img/green-btn-r.gif) no-repeat 100% 0; -} -/*-search-*/ -.search_block{ - padding:30px; -} -.search_info{ - margin:0 0 15px 0; - border:1px solid #999; - padding:5px; - background-color:#eee; -} -.search_result{ - margin:0 0 15px 0; -} -.search_highlight{ - font-weight:bold; -} -.search_result{ - font-size:13px; -} -.search_result h3{ - margin:0; - padding:0; - font-weight:normal; - font-size:16px; -} -.search_date{ - font-size:12px; - color:#006600; - font-style: italic; - margin-top:3px; -} -/*-gallery-*/ -.gallery { - overflow:hidden; - width:100%; - padding:0 0 10px; -} -.gallery .gal-nav { - overflow:hidden; - width:98%; -} -.gallery .gal-nav a.btn-prev { - float:left; - width:34px; - height:31px; - margin:7px 0 0; - text-indent:-9999px; - overflow:hidden; - background:url(../img/btn-prev.gif) no-repeat; -} -.gallery .gal-nav a.btn-prev:hover {background-position:0 -31px;} -.gallery .gal-nav a.btn-next { - float:right; - width:34px; - height:31px; - margin:7px 0 0; - text-indent:-9999px; - overflow:hidden; - background:url(../img/btn-next.gif) no-repeat; -} -.gallery .gal-nav a.btn-next:hover {background-position:0 -31px;} -.gallery .gal-nav .mask { - float:left; - width:320px; - height:43px; - margin:0 0 0 12px; - display:inline; - overflow:hidden; -} -.gallery .gal-nav .mask ul { - overflow:hidden; - width:9999px; - margin:0; - padding:0; -} -.gallery .gal-nav .mask ul li { - float:left; - padding:0 10px 0 0; - list-style:none; - border:none; - width:auto; -} -.gallery .gal-nav .mask ul li img { - display:block; - margin:0; - border:1px solid #ccc; -} -.gallery .big-img { - overflow:hidden; - width:100%; - padding:10px 0 0; -} -.gallery .big-img img { - display:block; - margin:0; - border:1px solid #ccc; -} -/*-----footer-----*/ -#footer { - background:#A8A8A8 url(../images/footer-bg2.jpg) no-repeat scroll 50% -5px; - clear:both; - width:960px; - padding:20px 0 0; - margin:0 0 30px; - overflow:hidden; -} -#footer .footer-info { - float:left; - width:740px; - padding:0 0 0 20px; -} -#footer .footer-info ul { - overflow:hidden; - width:100%; - margin:0; - padding:0; -} -#footer .footer-info ul li { - float:left; - padding:0 10px 0 11px; - list-style:none; - font:10px/13px Verdana, Arial, Helvetica, sans-serif; - background:url(../img/f-nav-separator.gif) no-repeat 0 60%; -} -#footer .footer-info ul li:first-child { - padding:0 10px 0 0; - background:none; -} -#footer .footer-info ul li a { - color:#996; - text-decoration:none; -} -#footer .footer-info ul li a:hover {text-decoration:underline;} -#footer .footer-info p { - margin:2px 0 0; - color:#ccc; - font:10px/17px Verdana, Arial, Helvetica, sans-serif; -} -#footer .f-logo { - float:right; - margin:0 20px 0 0; - display:inline; -} -#footer .f-logo a { - display:block; - width:164px; - height:32px; - text-indent:-9999px; - overflow:hidden; - background:url(../img/f-logo.gif) no-repeat; -} -/* report */ -.report_left{ - float:left; - width:400px; - margin:20px 0 0; - padding:0 0 10px; -} -.report_right{ - overflow:hidden; - width:455px; - margin:20px 0 0 25px; - padding:0 0 10px; -} -.report_bottom{ - clear:both; -} -.report_row{ - margin:0 0 15px 0; - clear:both; -} -.report_row h4{ - margin:0 0 5px 0; - padding:0; - font-size:120%; - font-weight:bold; -} -.report_row h4 span{ - font-weight: normal; - font-size: 10px; - line-height: 12px; - color: #a1a1a1; -} -.report_row .date-box{ - float:left; - margin-right:10px; -} -.report_row .date-box img{ - padding:0 5px 0 5px; -} -.report_row .time{ - float:left; -} -.report_row .optional-info{ - float:left; - margin-right:10px; -} -.report_category { - clear:both; - overflow:hidden; - font-size:90%; -} -.report_category ul{ - width:50%; - float:left; - margin:0; - padding:0 0 11px; -} -.report_category ul li{ - overflow:hidden; - list-style:none; -} -.report_category ul li label{ - color:#555; -} -.report_optional{ - padding:15px; - background-color:#eee; - width:80%; -} -.report_optional h3 -{ - margin:0 0 15px 0; - padding:0; - font-size:130%; - color:#999; - font-weight:bold; -} -.report_comment{ - border:1px #ccc solid; - margin-top:15px; - padding:20px; - background:#eee; - clear:both; - overflow:hidden; -} -.report_rating{ - margin:15px 0 0 10px; - font-size:90%; -} -.report_rating div{ - float:left; - margin-right:3px; - -} -.rating_value{ - height:14px; - font-weight:bold; - text-align:center; - background-color:#666; - color:#fff; - padding:0 4px 0 4px; -} -.rating_loading{ - margin:0 0 0 10px; -} -span.dots { - width:17px; - text-align:center; - color:#404040; - font-size:18px; - font-weight:bold; -} -a.add, -a.rem{ - margin:3px 0 0 5px; - text-indent:-3000px; - overflow:hidden; - width:13px; - height:13px; - float:left; - background:url(../img/icon-plus.gif) no-repeat; -} -a.rem { background:url(../img/icon-minus.gif) no-repeat;} -.report_map{ - overflow:hidden; - width:100%; - border:2px solid #ccc; - width:450px; - height:300px; -} -.report-find-location { - margin-right:1px; - padding:0 9px 9px 9px; - background-color:#eee; - border:1px solid #ccc; - border-width:0 1px 1px 1px; - font-size:90%; - color:#666; -} -.report-find-location input.findtext { - margin-top:9px; - padding:5px 3px 0 3px; - height:24px; - float:left; - font-size:14px; - font-weight:bold; - color:#666; - width:250px; - border:1px #ccc solid; -} -.report-find-loading{ - float:left; - height:31px; - margin:9px 0 0 3px; -} -a.show-more { - text-decoration:underline; - font-size:10px; - padding:1px 0 0 18px; - background:url(../img/icon-plus.gif) no-repeat 0 2px; - float:right; - margin-right:23px; -} -.hide{ - display:none; -} -a.show-more:hover{ text-decoration:none;} -.texthint{ - font-style:italic; - font-weight:normal; - color:red; - background-color:#FFFF99; -} - - -/* View Reports / Help */ -.report_rowtitle, .org_rowtitle{ - margin: 10px 0 5px 0; - padding-bottom:3px; - border-bottom:2px #000 solid; - overflow:auto; -} -.report_col1, -.report_col2, -.report_col3, -.report_col4, -.report_col5{ - float:left; - padding-right:15px; -} -.report_col1{ - width:85px; -} -.report_col2{ - width:425px; -} -.report_col3{ - width:85px; - text-align:center; -} -.report_col4{ - width:105px; - text-align:center; -} -.report_col5{ - width:105px; - text-align:center; -} -.report_row1, .report_row2, .org_row1, .org_row2{ - clear:both; - overflow:auto; - margin:0 0 10px 0; - padding:5px 0 5px 0; -} -.report_row1, .org_row1{ - background-color:#eee; -} -.report_row1 h3, .report_row2 h3, .org_row1 h3, .org_row2 h3{ - margin:0; - padding:0; - font-size:13px; -} -.org_row1, .org_row2{ - padding:5px; -} -.report_yes, -.report_no{ - font-weight:bold; -} -.report_yes{ - color:#009900; -} -.report_no{ - color:#990000; -} -.org_contact{ - border:1px #ccc solid; - margin-top:15px; - padding:10px; - background:#eee; - clear:both; - overflow:hidden; -} -.org_contact_row{ - margin:0 0 15px 0; - clear:both; -} -.org_contact h3{ - margin:0 0 5px 0; - padding:0 0 3px 0; - border-bottom:1px solid #ccc; -} -.org_contact h4{ - margin:0 0 5px 0; - padding:0; - font-weight:bold; -} - -/* form */ -form { - margin:0; - padding:0; -} -.text, -.textarea, -.select, -.file{ - color:#00789F; - font-size:120%; -} -.text:focus, -.textarea:focus, -.select:focus, -.file:focus{ - background-color:#ffffcc; -} -.text.error, -.textarea.error, -.select.error, -.file.error{ - background-color:#FFE0DD; - border:1px dotted red; -} -label.error { - margin-left: 10px; - color:red; - font-style: italic; - width: auto; - display: block; -} -.text { - padding:3px 7px 3px 7px; - border:1px #ccc solid; -} -.textarea { - padding:7px 7px 3px 7px; - border:1px #ccc solid; -} -.select{ - overflow:hidden; -} -.long{ - width:90%; -} -.long2{ - width:80%; - float:left; - margin-bottom:10px; -} -.short{ - width:100px; -} -.btn_blue, .btn_gray{ - padding:0 0 2px; - width:118px; - height:31px; - color:#fff; - font:14px Arial, Helvetica, sans-serif; - border:0; - cursor:pointer; -} -.btn_blue{ - background:url(../img/btn-blue.gif) no-repeat; -} -.btn_gray{ - background:url(../img/btn-gray.gif) no-repeat; -} -/*-- pager --*/ -ul.pager { - margin:0; - padding:0 0 0 17px; -} -ul.pager li{ - display:inline; - margin:0 6px 0 0; - font-size:10px; - font-weight:bold; - color:#555; - border:1px solid #bbb; - float:left; - list-style:none; -} -ul.pager li.first { - padding:0 5px; -} -ul.pager li a{ - text-decoration:none; - color:#555; - padding:0 5px; - -} -ul.pager li a:hover, -ul.pager li a.active {background:#f2f7fa;} - -/*-----Accessible Slider CSS-----*/ -.ui-slider {clear: both; top: 5px;} -.ui-slider { - text-decoration: none !important; -} -.ui-slider .ui-slider-handle { - overflow: visible !important; -} -.ui-slider .ui-slider-tooltip { - display: none; -} -.ui-slider .screenReaderContext { - position: absolute; - width: 0; - height: 0; - overflow: hidden; - left: -999999999px; -} -.ui-slider .ui-state-active .ui-slider-tooltip, .ui-slider .ui-state-focus .ui-slider-tooltip, .ui-slider .ui-state-hover .ui-slider-tooltip { - display: block; - position: absolute; - bottom: 2.5em; - text-align: center; - padding: .3em .2em .4em; - font-size: .9em; - width: 8em; - margin-left: -3.7em; -} -.ui-slider .ui-slider-tooltip .ui-tooltip-pointer-down, .ui-slider .ui-slider-tooltip .ui-tooltip-pointer-down-inner { - position: absolute; - display: block; - width:0; - height:0; - border-bottom-width: 0; - background: none; -} -.ui-slider .ui-slider-tooltip .ui-tooltip-pointer-down { - border-left: 7px dashed transparent; - border-right: 7px dashed transparent; - border-top-width: 8px; - bottom: -8px; - right: auto; - left: 50%; - margin-left: -7px; -} -.ui-slider .ui-slider-tooltip .ui-tooltip-pointer-down-inner { - border-left: 6px dashed transparent; - border-right: 6px dashed transparent; - border-top: 7px solid #fff; - bottom: auto; - top: -9px; - left: -6px; -} -.ui-slider a { - text-decoration: none; -} -.ui-slider ol, .ui-slider li, .ui-slider dl, .ui-slider dd, .ui-slider dt { - list-style: none; - margin: 0; - padding: 0; -} -.ui-slider ol, .ui-slider dl { - position: relative; - top: 1.3em; - width: 100%; -} -.ui-slider dt { - top: 1.5em; - position: absolute; - padding-top: .2em; - text-align: center; - border-bottom: 1px dotted #ddd; - height: .7em; - color: #999; -} -.ui-slider dt span { - background: #fff; - padding: 0 .5em; -} -.ui-slider li, .ui-slider dd { - position: absolute; - overflow: visible; - color: #666; -} -.ui-slider span.ui-slider-label { - position: absolute; -} -.ui-slider li span.ui-slider-label, .ui-slider dd span.ui-slider-label { - display: none; -} -.ui-slider li span.ui-slider-label-show, .ui-slider dd span.ui-slider-label-show { - display: block; -} -.ui-slider span.ui-slider-tic { - position: absolute; - left: 0; - height: .8em; - top: -1.3em; -} -.ui-slider li span.ui-widget-content, .ui-slider dd span.ui-widget-content { - border-right: 0; - border-left-width: 1px; - border-left-style: solid; - border-top: 0; - border-bottom: 0; -} -.ui-slider .first .ui-slider-tic, .ui-slider .last .ui-slider-tic { - display: none; -} -/* graph */ -.graph-holder { - overflow:hidden; - width:573px; - height:150px; -} -/* error/success */ -.green-box { - margin:10px 0 10px 0; - padding:9px 0 8px; - background:#d8f1d8; - border:2px solid #a7d1a7; - clear:both; - overflow:hidden; -} -.red-box { - margin:10px 0 10px 0; - padding:9px 0 8px; - background:#FFD8D9; - border:2px solid #990000; - clear:both; - overflow:hidden; -} -.green-box h3, .red-box h3{ - margin:0; - padding:0 0 0 15px; - font-size:14px; - color:#555; -} -.alert_response, .thanks_msg { - margin:10px 15px 10px 15px; - border:2px #ccc solid; - background-color:#fff; - padding: 15px; - font:14px/17px Arial, Helvetica, sans-serif; -} -.alert_confirm { - margin:10px 0 0 0; - padding:10px; - border:1px #ccc solid; - background-color:#FFFFCC; -} -.alert_confirm .label{ - margin-bottom:10px; -} - -/*-- feedback --*/ -.feedback_forms{ - display:none; - -} - -.feedback_forms textarea, .feedback_forms textarea input{ - color : #000; - border : 1px solid #996; -} - -.feedback_forms button { - height : 22px; - border : 1px solid #000; - background : #ccc; -} - -.feedback_title a{ - margin : 15px 0 0 0; - color : #996; - font:17px/19px Arial, Helvetica, sans-serif; - text-decoration :none; -} - -.or_txt { - padding : 0 10px 0 10px; - font:14px/17px Arial, Helvetica, sans-serif; -} - -.detailed_feedback { - text-align : center; - padding: 10px 0 0 0; - width : 150px; - height : 50px; - border : 1px solid #000; - background : #ccc; - -} - -.detailed_feedback a { - color : #000; - font:14px/17px Arial, Helvetica, sans-serif; - text-decoration :none; -} diff --git a/media/css/ie6.css b/media/css/ie6.css index 7974ce913f..de49ce64ad 100644 --- a/media/css/ie6.css +++ b/media/css/ie6.css @@ -1,6 +1,10 @@ +body{ + width:expression(document.documentElement.clientWidth < 960 ? "960px" : "auto"); +} + #footer .footer-info ul li { background-image: expression( (this===this.parentNode.childNodes[0]) ? "none" : "auto"); padding-left: expression( (this===this.parentNode.childNodes[0]) ? "0" : "auto"); } .small-block .block-bg ul li, -.incident-name ul li {border: expression( (this===this.parentNode.childNodes[0]) ? "none" : "auto");} \ No newline at end of file +.incident-name ul li {border: expression( (this===this.parentNode.childNodes[0]) ? "none" : "auto");} diff --git a/media/img/admin/arrow.gif b/media/img/admin/arrow.gif deleted file mode 100644 index 70e0f6a343..0000000000 Binary files a/media/img/admin/arrow.gif and /dev/null differ diff --git a/media/img/admin/icon-minus.gif b/media/img/admin/icon-minus.gif deleted file mode 100644 index 2d1476e576..0000000000 Binary files a/media/img/admin/icon-minus.gif and /dev/null differ diff --git a/media/img/admin/icon-plus.gif b/media/img/admin/icon-plus.gif deleted file mode 100644 index 812c345b89..0000000000 Binary files a/media/img/admin/icon-plus.gif and /dev/null differ diff --git a/media/img/cat-filters-bg.jpg b/media/img/cat-filters-bg.jpg deleted file mode 100644 index d88547b602..0000000000 Binary files a/media/img/cat-filters-bg.jpg and /dev/null differ diff --git a/media/img/filters-bg.jpg b/media/img/filters-bg.jpg deleted file mode 100644 index d352fa7dd3..0000000000 Binary files a/media/img/filters-bg.jpg and /dev/null differ diff --git a/media/img/green-btn-l.gif b/media/img/green-btn-l.gif deleted file mode 100644 index 1b2225f9dc..0000000000 Binary files a/media/img/green-btn-l.gif and /dev/null differ diff --git a/media/img/green-btn-r.gif b/media/img/green-btn-r.gif deleted file mode 100644 index 495643e7a0..0000000000 Binary files a/media/img/green-btn-r.gif and /dev/null differ diff --git a/media/img/page-bg.gif b/media/img/page-bg.gif deleted file mode 100644 index c75126c76d..0000000000 Binary files a/media/img/page-bg.gif and /dev/null differ diff --git a/media/img/page-bg.jpg b/media/img/page-bg.jpg deleted file mode 100644 index 19c5a9759e..0000000000 Binary files a/media/img/page-bg.jpg and /dev/null differ diff --git a/media/img/pause.gif b/media/img/pause.gif deleted file mode 100644 index 0614ad28af..0000000000 Binary files a/media/img/pause.gif and /dev/null differ diff --git a/media/img/search-button.jpg b/media/img/search-button.jpg deleted file mode 100644 index 586a602969..0000000000 Binary files a/media/img/search-button.jpg and /dev/null differ diff --git a/media/img/share.jpg b/media/img/share.jpg deleted file mode 100644 index 65c01b43e0..0000000000 Binary files a/media/img/share.jpg and /dev/null differ diff --git a/media/img/tooltip-arrow.png b/media/img/tooltip-arrow.png deleted file mode 100644 index 61987de9b8..0000000000 Binary files a/media/img/tooltip-arrow.png and /dev/null differ diff --git a/media/js/admin.js b/media/js/admin.js new file mode 100644 index 0000000000..41983229ea --- /dev/null +++ b/media/js/admin.js @@ -0,0 +1,21 @@ +function info_search(){ + $("#info-search").submit(); +} +function show_addedit(toggle){ + var addEditForm = $("#addedit"); + if (toggle) { + addEditForm.toggle(400); + } else { + addEditForm.show(400); + } + // Clear fields, but not buttons or the CSRF token. + $(':input','#addedit') + .not(':button, :submit, :reset, #action, :checkbox, [name="form_auth_token"]') + .val('') + .removeAttr('selected'); + + // Reset checkbox separately to avoid wiping its value + $(':checkbox','#addedit').removeAttr('checked'); + + $("a.add").focus(); +} diff --git a/media/js/global.js b/media/js/global.js index 15b8f5e7e6..63fcd7d63a 100644 --- a/media/js/global.js +++ b/media/js/global.js @@ -24,5 +24,8 @@ jQuery(document).ready(function( $ ) { var console = {}; console.log = console.error = console.info = console.debug = console.warn = console.trace = console.dir = console.dirxml = console.group = console.groupEnd = console.time = console.timeEnd = console.assert = console.profile = function() {}; } + + // Trigger pngFix + $(document).pngFix(); }); \ No newline at end of file diff --git a/media/js/jquery.flot.js b/media/js/jquery.flot.js deleted file mode 100644 index 4467fc5d8c..0000000000 --- a/media/js/jquery.flot.js +++ /dev/null @@ -1,6 +0,0 @@ -/* Javascript plotting library for jQuery, v. 0.7. - * - * Released under the MIT license by IOLA, December 2007. - * - */ -(function(b){b.color={};b.color.make=function(d,e,g,f){var c={};c.r=d||0;c.g=e||0;c.b=g||0;c.a=f!=null?f:1;c.add=function(h,j){for(var k=0;k=1){return"rgb("+[c.r,c.g,c.b].join(",")+")"}else{return"rgba("+[c.r,c.g,c.b,c.a].join(",")+")"}};c.normalize=function(){function h(k,j,l){return jl?l:j)}c.r=h(0,parseInt(c.r),255);c.g=h(0,parseInt(c.g),255);c.b=h(0,parseInt(c.b),255);c.a=h(0,c.a,1);return c};c.clone=function(){return b.color.make(c.r,c.b,c.g,c.a)};return c.normalize()};b.color.extract=function(d,e){var c;do{c=d.css(e).toLowerCase();if(c!=""&&c!="transparent"){break}d=d.parent()}while(!b.nodeName(d.get(0),"body"));if(c=="rgba(0, 0, 0, 0)"){c="transparent"}return b.color.parse(c)};b.color.parse=function(c){var d,f=b.color.make;if(d=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(c)){return f(parseInt(d[1],10),parseInt(d[2],10),parseInt(d[3],10))}if(d=/rgba\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(c)){return f(parseInt(d[1],10),parseInt(d[2],10),parseInt(d[3],10),parseFloat(d[4]))}if(d=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(c)){return f(parseFloat(d[1])*2.55,parseFloat(d[2])*2.55,parseFloat(d[3])*2.55)}if(d=/rgba\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(c)){return f(parseFloat(d[1])*2.55,parseFloat(d[2])*2.55,parseFloat(d[3])*2.55,parseFloat(d[4]))}if(d=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(c)){return f(parseInt(d[1],16),parseInt(d[2],16),parseInt(d[3],16))}if(d=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(c)){return f(parseInt(d[1]+d[1],16),parseInt(d[2]+d[2],16),parseInt(d[3]+d[3],16))}var e=b.trim(c).toLowerCase();if(e=="transparent"){return f(255,255,255,0)}else{d=a[e]||[0,0,0];return f(d[0],d[1],d[2])}};var a={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0]}})(jQuery);(function(c){function b(av,ai,J,af){var Q=[],O={colors:["#edc240","#afd8f8","#cb4b4b","#4da74d","#9440ed"],legend:{show:true,noColumns:1,labelFormatter:null,labelBoxBorderColor:"#ccc",container:null,position:"ne",margin:5,backgroundColor:null,backgroundOpacity:0.85},xaxis:{show:null,position:"bottom",mode:null,color:null,tickColor:null,transform:null,inverseTransform:null,min:null,max:null,autoscaleMargin:null,ticks:null,tickFormatter:null,labelWidth:null,labelHeight:null,reserveSpace:null,tickLength:null,alignTicksWithAxis:null,tickDecimals:null,tickSize:null,minTickSize:null,monthNames:null,timeformat:null,twelveHourClock:false},yaxis:{autoscaleMargin:0.02,position:"left"},xaxes:[],yaxes:[],series:{points:{show:false,radius:3,lineWidth:2,fill:true,fillColor:"#ffffff",symbol:"circle"},lines:{lineWidth:2,fill:false,fillColor:null,steps:false},bars:{show:false,lineWidth:2,barWidth:1,fill:true,fillColor:null,align:"left",horizontal:false},shadowSize:3},grid:{show:true,aboveData:false,color:"#545454",backgroundColor:null,borderColor:null,tickColor:null,labelMargin:5,axisMargin:8,borderWidth:2,minBorderMargin:null,markings:null,markingsColor:"#f4f4f4",markingsLineWidth:2,clickable:false,hoverable:false,autoHighlight:true,mouseActiveRadius:10},hooks:{}},az=null,ad=null,y=null,H=null,A=null,p=[],aw=[],q={left:0,right:0,top:0,bottom:0},G=0,I=0,h=0,w=0,ak={processOptions:[],processRawData:[],processDatapoints:[],drawSeries:[],draw:[],bindEvents:[],drawOverlay:[],shutdown:[]},aq=this;aq.setData=aj;aq.setupGrid=t;aq.draw=W;aq.getPlaceholder=function(){return av};aq.getCanvas=function(){return az};aq.getPlotOffset=function(){return q};aq.width=function(){return h};aq.height=function(){return w};aq.offset=function(){var aB=y.offset();aB.left+=q.left;aB.top+=q.top;return aB};aq.getData=function(){return Q};aq.getAxes=function(){var aC={},aB;c.each(p.concat(aw),function(aD,aE){if(aE){aC[aE.direction+(aE.n!=1?aE.n:"")+"axis"]=aE}});return aC};aq.getXAxes=function(){return p};aq.getYAxes=function(){return aw};aq.c2p=C;aq.p2c=ar;aq.getOptions=function(){return O};aq.highlight=x;aq.unhighlight=T;aq.triggerRedrawOverlay=f;aq.pointOffset=function(aB){return{left:parseInt(p[aA(aB,"x")-1].p2c(+aB.x)+q.left),top:parseInt(aw[aA(aB,"y")-1].p2c(+aB.y)+q.top)}};aq.shutdown=ag;aq.resize=function(){B();g(az);g(ad)};aq.hooks=ak;F(aq);Z(J);X();aj(ai);t();W();ah();function an(aD,aB){aB=[aq].concat(aB);for(var aC=0;aC=O.colors.length){aG=0;++aF}}var aH=0,aN;for(aG=0;aGa3.datamax&&a1!=aB){a3.datamax=a1}}c.each(m(),function(a1,a2){a2.datamin=aO;a2.datamax=aI;a2.used=false});for(aU=0;aU0&&aT[aR-aP]!=null&&aT[aR-aP]!=aT[aR]&&aT[aR-aP+1]!=aT[aR+1]){for(aN=0;aNaM){aM=a0}}if(aX.y){if(a0aV){aV=a0}}}}if(aJ.bars.show){var aY=aJ.bars.align=="left"?0:-aJ.bars.barWidth/2;if(aJ.bars.horizontal){aQ+=aY;aV+=aY+aJ.bars.barWidth}else{aK+=aY;aM+=aY+aJ.bars.barWidth}}aF(aJ.xaxis,aK,aM);aF(aJ.yaxis,aQ,aV)}c.each(m(),function(a1,a2){if(a2.datamin==aO){a2.datamin=null}if(a2.datamax==aI){a2.datamax=null}})}function j(aB,aC){var aD=document.createElement("canvas");aD.className=aC;aD.width=G;aD.height=I;if(!aB){c(aD).css({position:"absolute",left:0,top:0})}c(aD).appendTo(av);if(!aD.getContext){aD=window.G_vmlCanvasManager.initElement(aD)}aD.getContext("2d").save();return aD}function B(){G=av.width();I=av.height();if(G<=0||I<=0){throw"Invalid dimensions for plot, width = "+G+", height = "+I}}function g(aC){if(aC.width!=G){aC.width=G}if(aC.height!=I){aC.height=I}var aB=aC.getContext("2d");aB.restore();aB.save()}function X(){var aC,aB=av.children("canvas.base"),aD=av.children("canvas.overlay");if(aB.length==0||aD==0){av.html("");av.css({padding:0});if(av.css("position")=="static"){av.css("position","relative")}B();az=j(true,"base");ad=j(false,"overlay");aC=false}else{az=aB.get(0);ad=aD.get(0);aC=true}H=az.getContext("2d");A=ad.getContext("2d");y=c([ad,az]);if(aC){av.data("plot").shutdown();aq.resize();A.clearRect(0,0,G,I);y.unbind();av.children().not([az,ad]).remove()}av.data("plot",aq)}function ah(){if(O.grid.hoverable){y.mousemove(aa);y.mouseleave(l)}if(O.grid.clickable){y.click(R)}an(ak.bindEvents,[y])}function ag(){if(M){clearTimeout(M)}y.unbind("mousemove",aa);y.unbind("mouseleave",l);y.unbind("click",R);an(ak.shutdown,[y])}function r(aG){function aC(aH){return aH}var aF,aB,aD=aG.options.transform||aC,aE=aG.options.inverseTransform;if(aG.direction=="x"){aF=aG.scale=h/Math.abs(aD(aG.max)-aD(aG.min));aB=Math.min(aD(aG.max),aD(aG.min))}else{aF=aG.scale=w/Math.abs(aD(aG.max)-aD(aG.min));aF=-aF;aB=Math.max(aD(aG.max),aD(aG.min))}if(aD==aC){aG.p2c=function(aH){return(aH-aB)*aF}}else{aG.p2c=function(aH){return(aD(aH)-aB)*aF}}if(!aE){aG.c2p=function(aH){return aB+aH/aF}}else{aG.c2p=function(aH){return aE(aB+aH/aF)}}}function L(aD){var aB=aD.options,aF,aJ=aD.ticks||[],aI=[],aE,aK=aB.labelWidth,aG=aB.labelHeight,aC;function aH(aM,aL){return c('
'+aM.join("")+"
").appendTo(av)}if(aD.direction=="x"){if(aK==null){aK=Math.floor(G/(aJ.length>0?aJ.length:1))}if(aG==null){aI=[];for(aF=0;aF'+aE+"")}}if(aI.length>0){aI.push('
');aC=aH(aI,"width:10000px;");aG=aC.height();aC.remove()}}}else{if(aK==null||aG==null){for(aF=0;aF'+aE+"")}}if(aI.length>0){aC=aH(aI,"");if(aK==null){aK=aC.children().width()}if(aG==null){aG=aC.find("div.tickLabel").height()}aC.remove()}}}if(aK==null){aK=0}if(aG==null){aG=0}aD.labelWidth=aK;aD.labelHeight=aG}function au(aD){var aC=aD.labelWidth,aL=aD.labelHeight,aH=aD.options.position,aF=aD.options.tickLength,aG=O.grid.axisMargin,aJ=O.grid.labelMargin,aK=aD.direction=="x"?p:aw,aE;var aB=c.grep(aK,function(aN){return aN&&aN.options.position==aH&&aN.reserveSpace});if(c.inArray(aD,aB)==aB.length-1){aG=0}if(aF==null){aF="full"}var aI=c.grep(aK,function(aN){return aN&&aN.reserveSpace});var aM=c.inArray(aD,aI)==0;if(!aM&&aF=="full"){aF=5}if(!isNaN(+aF)){aJ+=+aF}if(aD.direction=="x"){aL+=aJ;if(aH=="bottom"){q.bottom+=aL+aG;aD.box={top:I-q.bottom,height:aL}}else{aD.box={top:q.top+aG,height:aL};q.top+=aL+aG}}else{aC+=aJ;if(aH=="left"){aD.box={left:q.left+aG,width:aC};q.left+=aC+aG}else{q.right+=aC+aG;aD.box={left:G-q.right,width:aC}}}aD.position=aH;aD.tickLength=aF;aD.box.padding=aJ;aD.innermost=aM}function U(aB){if(aB.direction=="x"){aB.box.left=q.left;aB.box.width=h}else{aB.box.top=q.top;aB.box.height=w}}function t(){var aC,aE=m();c.each(aE,function(aF,aG){aG.show=aG.options.show;if(aG.show==null){aG.show=aG.used}aG.reserveSpace=aG.show||aG.options.reserveSpace;n(aG)});allocatedAxes=c.grep(aE,function(aF){return aF.reserveSpace});q.left=q.right=q.top=q.bottom=0;if(O.grid.show){c.each(allocatedAxes,function(aF,aG){S(aG);P(aG);ap(aG,aG.ticks);L(aG)});for(aC=allocatedAxes.length-1;aC>=0;--aC){au(allocatedAxes[aC])}var aD=O.grid.minBorderMargin;if(aD==null){aD=0;for(aC=0;aC=0){aD=0}}if(aF.max==null){aB+=aH*aG;if(aB>0&&aE.datamax!=null&&aE.datamax<=0){aB=0}}}}aE.min=aD;aE.max=aB}function S(aG){var aM=aG.options;var aH;if(typeof aM.ticks=="number"&&aM.ticks>0){aH=aM.ticks}else{aH=0.3*Math.sqrt(aG.direction=="x"?G:I)}var aT=(aG.max-aG.min)/aH,aO,aB,aN,aR,aS,aQ,aI;if(aM.mode=="time"){var aJ={second:1000,minute:60*1000,hour:60*60*1000,day:24*60*60*1000,month:30*24*60*60*1000,year:365.2425*24*60*60*1000};var aK=[[1,"second"],[2,"second"],[5,"second"],[10,"second"],[30,"second"],[1,"minute"],[2,"minute"],[5,"minute"],[10,"minute"],[30,"minute"],[1,"hour"],[2,"hour"],[4,"hour"],[8,"hour"],[12,"hour"],[1,"day"],[2,"day"],[3,"day"],[0.25,"month"],[0.5,"month"],[1,"month"],[2,"month"],[3,"month"],[6,"month"],[1,"year"]];var aC=0;if(aM.minTickSize!=null){if(typeof aM.tickSize=="number"){aC=aM.tickSize}else{aC=aM.minTickSize[0]*aJ[aM.minTickSize[1]]}}for(var aS=0;aS=aC){break}}aO=aK[aS][0];aN=aK[aS][1];if(aN=="year"){aQ=Math.pow(10,Math.floor(Math.log(aT/aJ.year)/Math.LN10));aI=(aT/aJ.year)/aQ;if(aI<1.5){aO=1}else{if(aI<3){aO=2}else{if(aI<7.5){aO=5}else{aO=10}}}aO*=aQ}aG.tickSize=aM.tickSize||[aO,aN];aB=function(aX){var a2=[],a0=aX.tickSize[0],a3=aX.tickSize[1],a1=new Date(aX.min);var aW=a0*aJ[a3];if(a3=="second"){a1.setUTCSeconds(a(a1.getUTCSeconds(),a0))}if(a3=="minute"){a1.setUTCMinutes(a(a1.getUTCMinutes(),a0))}if(a3=="hour"){a1.setUTCHours(a(a1.getUTCHours(),a0))}if(a3=="month"){a1.setUTCMonth(a(a1.getUTCMonth(),a0))}if(a3=="year"){a1.setUTCFullYear(a(a1.getUTCFullYear(),a0))}a1.setUTCMilliseconds(0);if(aW>=aJ.minute){a1.setUTCSeconds(0)}if(aW>=aJ.hour){a1.setUTCMinutes(0)}if(aW>=aJ.day){a1.setUTCHours(0)}if(aW>=aJ.day*4){a1.setUTCDate(1)}if(aW>=aJ.year){a1.setUTCMonth(0)}var a5=0,a4=Number.NaN,aY;do{aY=a4;a4=a1.getTime();a2.push(a4);if(a3=="month"){if(a0<1){a1.setUTCDate(1);var aV=a1.getTime();a1.setUTCMonth(a1.getUTCMonth()+1);var aZ=a1.getTime();a1.setTime(a4+a5*aJ.hour+(aZ-aV)*a0);a5=a1.getUTCHours();a1.setUTCHours(0)}else{a1.setUTCMonth(a1.getUTCMonth()+a0)}}else{if(a3=="year"){a1.setUTCFullYear(a1.getUTCFullYear()+a0)}else{a1.setTime(a4+aW)}}}while(a4aU){aP=aU}aQ=Math.pow(10,-aP);aI=aT/aQ;if(aI<1.5){aO=1}else{if(aI<3){aO=2;if(aI>2.25&&(aU==null||aP+1<=aU)){aO=2.5;++aP}}else{if(aI<7.5){aO=5}else{aO=10}}}aO*=aQ;if(aM.minTickSize!=null&&aO0){if(aM.min==null){aG.min=Math.min(aG.min,aL[0])}if(aM.max==null&&aL.length>1){aG.max=Math.max(aG.max,aL[aL.length-1])}}aB=function(aX){var aY=[],aV,aW;for(aW=0;aW1&&/\..*0$/.test((aD[1]-aD[0]).toFixed(aE)))){aG.tickDecimals=aE}}}}aG.tickGenerator=aB;if(c.isFunction(aM.tickFormatter)){aG.tickFormatter=function(aV,aW){return""+aM.tickFormatter(aV,aW)}}else{aG.tickFormatter=aR}}function P(aF){var aH=aF.options.ticks,aG=[];if(aH==null||(typeof aH=="number"&&aH>0)){aG=aF.tickGenerator(aF)}else{if(aH){if(c.isFunction(aH)){aG=aH({min:aF.min,max:aF.max})}else{aG=aH}}}var aE,aB;aF.ticks=[];for(aE=0;aE1){aC=aD[1]}}else{aB=+aD}if(aC==null){aC=aF.tickFormatter(aB,aF)}if(!isNaN(aB)){aF.ticks.push({v:aB,label:aC})}}}function ap(aB,aC){if(aB.options.autoscaleMargin&&aC.length>0){if(aB.options.min==null){aB.min=Math.min(aB.min,aC[0].v)}if(aB.options.max==null&&aC.length>1){aB.max=Math.max(aB.max,aC[aC.length-1].v)}}}function W(){H.clearRect(0,0,G,I);var aC=O.grid;if(aC.show&&aC.backgroundColor){N()}if(aC.show&&!aC.aboveData){ac()}for(var aB=0;aBaG){var aC=aH;aH=aG;aG=aC}return{from:aH,to:aG,axis:aE}}function N(){H.save();H.translate(q.left,q.top);H.fillStyle=am(O.grid.backgroundColor,w,0,"rgba(255, 255, 255, 0)");H.fillRect(0,0,h,w);H.restore()}function ac(){var aF;H.save();H.translate(q.left,q.top);var aH=O.grid.markings;if(aH){if(c.isFunction(aH)){var aK=aq.getAxes();aK.xmin=aK.xaxis.min;aK.xmax=aK.xaxis.max;aK.ymin=aK.yaxis.min;aK.ymax=aK.yaxis.max;aH=aH(aK)}for(aF=0;aFaC.axis.max||aI.toaI.axis.max){continue}aC.from=Math.max(aC.from,aC.axis.min);aC.to=Math.min(aC.to,aC.axis.max);aI.from=Math.max(aI.from,aI.axis.min);aI.to=Math.min(aI.to,aI.axis.max);if(aC.from==aC.to&&aI.from==aI.to){continue}aC.from=aC.axis.p2c(aC.from);aC.to=aC.axis.p2c(aC.to);aI.from=aI.axis.p2c(aI.from);aI.to=aI.axis.p2c(aI.to);if(aC.from==aC.to||aI.from==aI.to){H.beginPath();H.strokeStyle=aD.color||O.grid.markingsColor;H.lineWidth=aD.lineWidth||O.grid.markingsLineWidth;H.moveTo(aC.from,aI.from);H.lineTo(aC.to,aI.to);H.stroke()}else{H.fillStyle=aD.color||O.grid.markingsColor;H.fillRect(aC.from,aI.to,aC.to-aC.from,aI.from-aI.to)}}}var aK=m(),aM=O.grid.borderWidth;for(var aE=0;aEaB.max||(aQ=="full"&&aM>0&&(aO==aB.min||aO==aB.max))){continue}if(aB.direction=="x"){aN=aB.p2c(aO);aJ=aQ=="full"?-w:aQ;if(aB.position=="top"){aJ=-aJ}}else{aL=aB.p2c(aO);aP=aQ=="full"?-h:aQ;if(aB.position=="left"){aP=-aP}}if(H.lineWidth==1){if(aB.direction=="x"){aN=Math.floor(aN)+0.5}else{aL=Math.floor(aL)+0.5}}H.moveTo(aN,aL);H.lineTo(aN+aP,aL+aJ)}H.stroke()}if(aM){H.lineWidth=aM;H.strokeStyle=O.grid.borderColor;H.strokeRect(-aM/2,-aM/2,h+aM,w+aM)}H.restore()}function k(){av.find(".tickLabels").remove();var aG=['
'];var aJ=m();for(var aD=0;aD');for(var aE=0;aEaC.max){continue}var aK={},aI;if(aC.direction=="x"){aI="center";aK.left=Math.round(q.left+aC.p2c(aH.v)-aC.labelWidth/2);if(aC.position=="bottom"){aK.top=aF.top+aF.padding}else{aK.bottom=I-(aF.top+aF.height-aF.padding)}}else{aK.top=Math.round(q.top+aC.p2c(aH.v)-aC.labelHeight/2);if(aC.position=="left"){aK.right=G-(aF.left+aF.width-aF.padding);aI="right"}else{aK.left=aF.left+aF.padding;aI="left"}}aK.width=aC.labelWidth;var aB=["position:absolute","text-align:"+aI];for(var aL in aK){aB.push(aL+":"+aK[aL]+"px")}aG.push('
'+aH.label+"
")}aG.push("
")}aG.push("");av.append(aG.join(""))}function d(aB){if(aB.lines.show){at(aB)}if(aB.bars.show){e(aB)}if(aB.points.show){ao(aB)}}function at(aE){function aD(aP,aQ,aI,aU,aT){var aV=aP.points,aJ=aP.pointsize,aN=null,aM=null;H.beginPath();for(var aO=aJ;aO=aR&&aS>aT.max){if(aR>aT.max){continue}aL=(aT.max-aS)/(aR-aS)*(aK-aL)+aL;aS=aT.max}else{if(aR>=aS&&aR>aT.max){if(aS>aT.max){continue}aK=(aT.max-aS)/(aR-aS)*(aK-aL)+aL;aR=aT.max}}if(aL<=aK&&aL=aK&&aL>aU.max){if(aK>aU.max){continue}aS=(aU.max-aL)/(aK-aL)*(aR-aS)+aS;aL=aU.max}else{if(aK>=aL&&aK>aU.max){if(aL>aU.max){continue}aR=(aU.max-aL)/(aK-aL)*(aR-aS)+aS;aK=aU.max}}if(aL!=aN||aS!=aM){H.moveTo(aU.p2c(aL)+aQ,aT.p2c(aS)+aI)}aN=aK;aM=aR;H.lineTo(aU.p2c(aK)+aQ,aT.p2c(aR)+aI)}H.stroke()}function aF(aI,aQ,aP){var aW=aI.points,aV=aI.pointsize,aN=Math.min(Math.max(0,aP.min),aP.max),aX=0,aU,aT=false,aM=1,aL=0,aR=0;while(true){if(aV>0&&aX>aW.length+aV){break}aX+=aV;var aZ=aW[aX-aV],aK=aW[aX-aV+aM],aY=aW[aX],aJ=aW[aX+aM];if(aT){if(aV>0&&aZ!=null&&aY==null){aR=aX;aV=-aV;aM=2;continue}if(aV<0&&aX==aL+aV){H.fill();aT=false;aV=-aV;aM=1;aX=aL=aR+aV;continue}}if(aZ==null||aY==null){continue}if(aZ<=aY&&aZ=aY&&aZ>aQ.max){if(aY>aQ.max){continue}aK=(aQ.max-aZ)/(aY-aZ)*(aJ-aK)+aK;aZ=aQ.max}else{if(aY>=aZ&&aY>aQ.max){if(aZ>aQ.max){continue}aJ=(aQ.max-aZ)/(aY-aZ)*(aJ-aK)+aK;aY=aQ.max}}if(!aT){H.beginPath();H.moveTo(aQ.p2c(aZ),aP.p2c(aN));aT=true}if(aK>=aP.max&&aJ>=aP.max){H.lineTo(aQ.p2c(aZ),aP.p2c(aP.max));H.lineTo(aQ.p2c(aY),aP.p2c(aP.max));continue}else{if(aK<=aP.min&&aJ<=aP.min){H.lineTo(aQ.p2c(aZ),aP.p2c(aP.min));H.lineTo(aQ.p2c(aY),aP.p2c(aP.min));continue}}var aO=aZ,aS=aY;if(aK<=aJ&&aK=aP.min){aZ=(aP.min-aK)/(aJ-aK)*(aY-aZ)+aZ;aK=aP.min}else{if(aJ<=aK&&aJ=aP.min){aY=(aP.min-aK)/(aJ-aK)*(aY-aZ)+aZ;aJ=aP.min}}if(aK>=aJ&&aK>aP.max&&aJ<=aP.max){aZ=(aP.max-aK)/(aJ-aK)*(aY-aZ)+aZ;aK=aP.max}else{if(aJ>=aK&&aJ>aP.max&&aK<=aP.max){aY=(aP.max-aK)/(aJ-aK)*(aY-aZ)+aZ;aJ=aP.max}}if(aZ!=aO){H.lineTo(aQ.p2c(aO),aP.p2c(aK))}H.lineTo(aQ.p2c(aZ),aP.p2c(aK));H.lineTo(aQ.p2c(aY),aP.p2c(aJ));if(aY!=aS){H.lineTo(aQ.p2c(aY),aP.p2c(aJ));H.lineTo(aQ.p2c(aS),aP.p2c(aJ))}}}H.save();H.translate(q.left,q.top);H.lineJoin="round";var aG=aE.lines.lineWidth,aB=aE.shadowSize;if(aG>0&&aB>0){H.lineWidth=aB;H.strokeStyle="rgba(0,0,0,0.1)";var aH=Math.PI/18;aD(aE.datapoints,Math.sin(aH)*(aG/2+aB/2),Math.cos(aH)*(aG/2+aB/2),aE.xaxis,aE.yaxis);H.lineWidth=aB/2;aD(aE.datapoints,Math.sin(aH)*(aG/2+aB/4),Math.cos(aH)*(aG/2+aB/4),aE.xaxis,aE.yaxis)}H.lineWidth=aG;H.strokeStyle=aE.color;var aC=ae(aE.lines,aE.color,0,w);if(aC){H.fillStyle=aC;aF(aE.datapoints,aE.xaxis,aE.yaxis)}if(aG>0){aD(aE.datapoints,0,0,aE.xaxis,aE.yaxis)}H.restore()}function ao(aE){function aH(aN,aM,aU,aK,aS,aT,aQ,aJ){var aR=aN.points,aI=aN.pointsize;for(var aL=0;aLaT.max||aOaQ.max){continue}H.beginPath();aP=aT.p2c(aP);aO=aQ.p2c(aO)+aK;if(aJ=="circle"){H.arc(aP,aO,aM,0,aS?Math.PI:Math.PI*2,false)}else{aJ(H,aP,aO,aM,aS)}H.closePath();if(aU){H.fillStyle=aU;H.fill()}H.stroke()}}H.save();H.translate(q.left,q.top);var aG=aE.points.lineWidth,aC=aE.shadowSize,aB=aE.points.radius,aF=aE.points.symbol;if(aG>0&&aC>0){var aD=aC/2;H.lineWidth=aD;H.strokeStyle="rgba(0,0,0,0.1)";aH(aE.datapoints,aB,null,aD+aD/2,true,aE.xaxis,aE.yaxis,aF);H.strokeStyle="rgba(0,0,0,0.2)";aH(aE.datapoints,aB,null,aD/2,true,aE.xaxis,aE.yaxis,aF)}H.lineWidth=aG;H.strokeStyle=aE.color;aH(aE.datapoints,aB,ae(aE.points,aE.color),0,false,aE.xaxis,aE.yaxis,aF);H.restore()}function E(aN,aM,aV,aI,aQ,aF,aD,aL,aK,aU,aR,aC){var aE,aT,aJ,aP,aG,aB,aO,aH,aS;if(aR){aH=aB=aO=true;aG=false;aE=aV;aT=aN;aP=aM+aI;aJ=aM+aQ;if(aTaL.max||aPaK.max){return}if(aEaL.max){aT=aL.max;aB=false}if(aJaK.max){aP=aK.max;aO=false}aE=aL.p2c(aE);aJ=aK.p2c(aJ);aT=aL.p2c(aT);aP=aK.p2c(aP);if(aD){aU.beginPath();aU.moveTo(aE,aJ);aU.lineTo(aE,aP);aU.lineTo(aT,aP);aU.lineTo(aT,aJ);aU.fillStyle=aD(aJ,aP);aU.fill()}if(aC>0&&(aG||aB||aO||aH)){aU.beginPath();aU.moveTo(aE,aJ+aF);if(aG){aU.lineTo(aE,aP+aF)}else{aU.moveTo(aE,aP+aF)}if(aO){aU.lineTo(aT,aP+aF)}else{aU.moveTo(aT,aP+aF)}if(aB){aU.lineTo(aT,aJ+aF)}else{aU.moveTo(aT,aJ+aF)}if(aH){aU.lineTo(aE,aJ+aF)}else{aU.moveTo(aE,aJ+aF)}aU.stroke()}}function e(aD){function aC(aJ,aI,aL,aG,aK,aN,aM){var aO=aJ.points,aF=aJ.pointsize;for(var aH=0;aH")}aH.push("");aF=true}if(aN){aJ=aN(aJ,aM)}aH.push('
'+aJ+"")}if(aF){aH.push("")}if(aH.length==0){return}var aL=''+aH.join("")+"
";if(O.legend.container!=null){c(O.legend.container).html(aL)}else{var aI="",aC=O.legend.position,aD=O.legend.margin;if(aD[0]==null){aD=[aD,aD]}if(aC.charAt(0)=="n"){aI+="top:"+(aD[1]+q.top)+"px;"}else{if(aC.charAt(0)=="s"){aI+="bottom:"+(aD[1]+q.bottom)+"px;"}}if(aC.charAt(1)=="e"){aI+="right:"+(aD[0]+q.right)+"px;"}else{if(aC.charAt(1)=="w"){aI+="left:"+(aD[0]+q.left)+"px;"}}var aK=c('
'+aL.replace('style="','style="position:absolute;'+aI+";")+"
").appendTo(av);if(O.legend.backgroundOpacity!=0){var aG=O.legend.backgroundColor;if(aG==null){aG=O.grid.backgroundColor;if(aG&&typeof aG=="string"){aG=c.color.parse(aG)}else{aG=c.color.extract(aK,"background-color")}aG.a=1;aG=aG.toString()}var aB=aK.children();c('
').prependTo(aK).css("opacity",O.legend.backgroundOpacity)}}}var ab=[],M=null;function K(aI,aG,aD){var aO=O.grid.mouseActiveRadius,a0=aO*aO+1,aY=null,aR=false,aW,aU;for(aW=Q.length-1;aW>=0;--aW){if(!aD(Q[aW])){continue}var aP=Q[aW],aH=aP.xaxis,aF=aP.yaxis,aV=aP.datapoints.points,aT=aP.datapoints.pointsize,aQ=aH.c2p(aI),aN=aF.c2p(aG),aC=aO/aH.scale,aB=aO/aF.scale;if(aH.options.inverseTransform){aC=Number.MAX_VALUE}if(aF.options.inverseTransform){aB=Number.MAX_VALUE}if(aP.lines.show||aP.points.show){for(aU=0;aUaC||aK-aQ<-aC||aJ-aN>aB||aJ-aN<-aB){continue}var aM=Math.abs(aH.p2c(aK)-aI),aL=Math.abs(aF.p2c(aJ)-aG),aS=aM*aM+aL*aL;if(aS=Math.min(aZ,aK)&&aN>=aJ+aE&&aN<=aJ+aX):(aQ>=aK+aE&&aQ<=aK+aX&&aN>=Math.min(aZ,aJ)&&aN<=Math.max(aZ,aJ))){aY=[aW,aU/aT]}}}}if(aY){aW=aY[0];aU=aY[1];aT=Q[aW].datapoints.pointsize;return{datapoint:Q[aW].datapoints.points.slice(aU*aT,(aU+1)*aT),dataIndex:aU,series:Q[aW],seriesIndex:aW}}return null}function aa(aB){if(O.grid.hoverable){u("plothover",aB,function(aC){return aC.hoverable!=false})}}function l(aB){if(O.grid.hoverable){u("plothover",aB,function(aC){return false})}}function R(aB){u("plotclick",aB,function(aC){return aC.clickable!=false})}function u(aC,aB,aD){var aE=y.offset(),aH=aB.pageX-aE.left-q.left,aF=aB.pageY-aE.top-q.top,aJ=C({left:aH,top:aF});aJ.pageX=aB.pageX;aJ.pageY=aB.pageY;var aK=K(aH,aF,aD);if(aK){aK.pageX=parseInt(aK.series.xaxis.p2c(aK.datapoint[0])+aE.left+q.left);aK.pageY=parseInt(aK.series.yaxis.p2c(aK.datapoint[1])+aE.top+q.top)}if(O.grid.autoHighlight){for(var aG=0;aGaH.max||aIaG.max){return}var aF=aE.points.radius+aE.points.lineWidth/2;A.lineWidth=aF;A.strokeStyle=c.color.parse(aE.color).scale("a",0.5).toString();var aB=1.5*aF,aC=aH.p2c(aC),aI=aG.p2c(aI);A.beginPath();if(aE.points.symbol=="circle"){A.arc(aC,aI,aB,0,2*Math.PI,false)}else{aE.points.symbol(A,aC,aI,aB,false)}A.closePath();A.stroke()}function v(aE,aB){A.lineWidth=aE.bars.lineWidth;A.strokeStyle=c.color.parse(aE.color).scale("a",0.5).toString();var aD=c.color.parse(aE.color).scale("a",0.5).toString();var aC=aE.bars.align=="left"?0:-aE.bars.barWidth/2;E(aB[0],aB[1],aB[2]||0,aC,aC+aE.bars.barWidth,0,function(){return aD},aE.xaxis,aE.yaxis,A,aE.bars.horizontal,aE.bars.lineWidth)}function am(aJ,aB,aH,aC){if(typeof aJ=="string"){return aJ}else{var aI=H.createLinearGradient(0,aH,0,aB);for(var aE=0,aD=aJ.colors.length;aE12){n=n-12}else{if(n==0){n=12}}}for(var g=0;g0)return true;f[h]=1;j=f[h]>0;f[h]=0;return j},isOverAxis:function(f,h,j){return f>h&&f=0)&&d(f).is(":focusable")}});function g(f,h,j,l){function n(o){o=d[f][h][o]||[];return typeof o== -"string"?o.split(/,?\s+/):o}var q=n("getter");if(l.length==1&&typeof l[0]=="string")q=q.concat(n("getterSetter"));return d.inArray(j,q)!=-1}d.widget=function(f,h){var j=f.split(".")[0];f=f.split(".")[1];d.fn[f]=function(l){var n=typeof l=="string",q=Array.prototype.slice.call(arguments,1);if(n&&l.substring(0,1)=="_")return this;if(n&&g(j,f,l,q)){var o=d.data(this[0],f);return o?o[l].apply(o,q):undefined}return this.each(function(){var p=d.data(this,f);!p&&!n&&d.data(this,f,new d[j][f](this,l))._init(); -p&&n&&d.isFunction(p[l])&&p[l].apply(p,q)})};d[j]=d[j]||{};d[j][f]=function(l,n){var q=this;this.namespace=j;this.widgetName=f;this.widgetEventPrefix=d[j][f].eventPrefix||f;this.widgetBaseClass=j+"-"+f;this.options=d.extend({},d.widget.defaults,d[j][f].defaults,d.metadata&&d.metadata.get(l)[f],n);this.element=d(l).bind("setData."+f,function(o,p,s){if(o.target==l)return q._setData(p,s)}).bind("getData."+f,function(o,p){if(o.target==l)return q._getData(p)}).bind("remove",function(){return q.destroy()})}; -d[j][f].prototype=d.extend({},d.widget.prototype,h);d[j][f].getterSetter="option"};d.widget.prototype={_init:function(){},destroy:function(){this.element.removeData(this.widgetName).removeClass(this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").removeAttr("aria-disabled")},option:function(f,h){var j=f,l=this;if(typeof f=="string"){if(h===undefined)return this._getData(f);j={};j[f]=h}d.each(j,function(n,q){l._setData(n,q)})},_getData:function(f){return this.options[f]},_setData:function(f, -h){this.options[f]=h;if(f=="disabled")this.element[h?"addClass":"removeClass"](this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").attr("aria-disabled",h)},enable:function(){this._setData("disabled",false)},disable:function(){this._setData("disabled",true)},_trigger:function(f,h,j){var l=this.options[f];f=f==this.widgetEventPrefix?f:this.widgetEventPrefix+f;h=d.Event(h);h.type=f;if(h.originalEvent){f=d.event.props.length;for(var n;f;){n=d.event.props[--f];h[n]=h.originalEvent[n]}}this.element.trigger(h, -j);return!(d.isFunction(l)&&l.call(this.element[0],h,j)===false||h.isDefaultPrevented())}};d.widget.defaults={disabled:false};d.ui.mouse={_mouseInit:function(){var f=this;this.element.bind("mousedown."+this.widgetName,function(h){return f._mouseDown(h)}).bind("click."+this.widgetName,function(h){if(f._preventClickEvent){f._preventClickEvent=false;h.stopImmediatePropagation();return false}});if(d.browser.msie){this._mouseUnselectable=this.element.attr("unselectable");this.element.attr("unselectable", -"on")}this.started=false},_mouseDestroy:function(){this.element.unbind("."+this.widgetName);d.browser.msie&&this.element.attr("unselectable",this._mouseUnselectable)},_mouseDown:function(f){f.originalEvent=f.originalEvent||{};if(!f.originalEvent.mouseHandled){this._mouseStarted&&this._mouseUp(f);this._mouseDownEvent=f;var h=this,j=f.which==1,l=typeof this.options.cancel=="string"?d(f.target).parents().add(f.target).filter(this.options.cancel).length:false;if(!j||l||!this._mouseCapture(f))return true; -this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet)this._mouseDelayTimer=setTimeout(function(){h.mouseDelayMet=true},this.options.delay);if(this._mouseDistanceMet(f)&&this._mouseDelayMet(f)){this._mouseStarted=this._mouseStart(f)!==false;if(!this._mouseStarted){f.preventDefault();return true}}this._mouseMoveDelegate=function(n){return h._mouseMove(n)};this._mouseUpDelegate=function(n){return h._mouseUp(n)};d(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+ -this.widgetName,this._mouseUpDelegate);d.browser.safari||f.preventDefault();return f.originalEvent.mouseHandled=true}},_mouseMove:function(f){if(d.browser.msie&&!f.button)return this._mouseUp(f);if(this._mouseStarted){this._mouseDrag(f);return f.preventDefault()}if(this._mouseDistanceMet(f)&&this._mouseDelayMet(f))(this._mouseStarted=this._mouseStart(this._mouseDownEvent,f)!==false)?this._mouseDrag(f):this._mouseUp(f);return!this._mouseStarted},_mouseUp:function(f){d(document).unbind("mousemove."+ -this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;this._preventClickEvent=f.target==this._mouseDownEvent.target;this._mouseStop(f)}return false},_mouseDistanceMet:function(f){return Math.max(Math.abs(this._mouseDownEvent.pageX-f.pageX),Math.abs(this._mouseDownEvent.pageY-f.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){}, -_mouseStop:function(){},_mouseCapture:function(){return true}};d.ui.mouse.defaults={cancel:null,distance:1,delay:0}}(jQuery); -(function(d){d.widget("ui.slider",d.extend({},d.ui.mouse,{_init:function(){var i=this,k=this.options;this._keySliding=false;this._handleIndex=null;this._detectOrientation();this._mouseInit();this.element.addClass("ui-slider ui-slider-"+this.orientation+" ui-widget ui-widget-content ui-corner-all");this.range=d([]);if(k.range){if(k.range===true){this.range=d("
");if(!k.values)k.values=[this._valueMin(),this._valueMin()];if(k.values.length&&k.values.length!=2)k.values=[k.values[0],k.values[0]]}else this.range= -d("
");this.range.appendTo(this.element).addClass("ui-slider-range");if(k.range=="min"||k.range=="max")this.range.addClass("ui-slider-range-"+k.range);this.range.addClass("ui-widget-header")}d(".ui-slider-handle",this.element).length==0&&d('').appendTo(this.element).addClass("ui-slider-handle");if(k.values&&k.values.length)for(;d(".ui-slider-handle",this.element).length').appendTo(this.element).addClass("ui-slider-handle");this.handles= -d(".ui-slider-handle",this.element).addClass("ui-state-default ui-corner-all");this.handle=this.handles.eq(0);this.handles.add(this.range).filter("a").click(function(m){m.preventDefault()}).hover(function(){k.disabled||d(this).addClass("ui-state-hover")},function(){d(this).removeClass("ui-state-hover")}).focus(function(){if(k.disabled)d(this).blur();else{d(".ui-slider .ui-state-focus").removeClass("ui-state-focus");d(this).addClass("ui-state-focus")}}).blur(function(){d(this).removeClass("ui-state-focus")}); -this.handles.each(function(m){d(this).data("index.ui-slider-handle",m)});this.handles.keydown(function(m){var a=true,b=d(this).data("index.ui-slider-handle");if(!i.options.disabled){switch(m.keyCode){case d.ui.keyCode.HOME:case d.ui.keyCode.END:case d.ui.keyCode.UP:case d.ui.keyCode.RIGHT:case d.ui.keyCode.DOWN:case d.ui.keyCode.LEFT:a=false;if(!i._keySliding){i._keySliding=true;d(this).addClass("ui-state-active");i._start(m,b)}break}var c,e,g=i._step();c=i.options.values&&i.options.values.length? -(e=i.values(b)):(e=i.value());switch(m.keyCode){case d.ui.keyCode.HOME:e=i._valueMin();break;case d.ui.keyCode.END:e=i._valueMax();break;case d.ui.keyCode.UP:case d.ui.keyCode.RIGHT:if(c==i._valueMax())return;e=c+g;break;case d.ui.keyCode.DOWN:case d.ui.keyCode.LEFT:if(c==i._valueMin())return;e=c-g;break}i._slide(m,b,e);return a}}).keyup(function(m){var a=d(this).data("index.ui-slider-handle");if(i._keySliding){i._stop(m,a);i._change(m,a);i._keySliding=false;d(this).removeClass("ui-state-active")}}); -this._refreshValue()},destroy:function(){this.handles.remove();this.range.remove();this.element.removeClass("ui-slider ui-slider-horizontal ui-slider-vertical ui-slider-disabled ui-widget ui-widget-content ui-corner-all").removeData("slider").unbind(".slider");this._mouseDestroy()},_mouseCapture:function(i){var k=this.options;if(k.disabled)return false;this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()};this.elementOffset=this.element.offset();var m={x:i.pageX,y:i.pageY}, -a=this._normValueFromMouse(m),b=this._valueMax()-this._valueMin()+1,c,e=this,g;this.handles.each(function(h){var j=Math.abs(a-e.values(h));if(b>j){b=j;c=d(this);g=h}});if(k.range==true&&this.values(1)==k.min)c=d(this.handles[++g]);this._start(i,g);e._handleIndex=g;c.addClass("ui-state-active").focus();k=c.offset();var f=!d(i.target).parents().andSelf().is(".ui-slider-handle");this._clickOffset=f?{left:0,top:0}:{left:i.pageX-k.left-c.width()/2,top:i.pageY-k.top-c.height()/2-(parseInt(c.css("borderTopWidth"), -10)||0)-(parseInt(c.css("borderBottomWidth"),10)||0)+(parseInt(c.css("marginTop"),10)||0)};a=this._normValueFromMouse(m);this._slide(i,g,a);return true},_mouseStart:function(){return true},_mouseDrag:function(i){var k={x:i.pageX,y:i.pageY};k=this._normValueFromMouse(k);this._slide(i,this._handleIndex,k);return false},_mouseStop:function(i){this.handles.removeClass("ui-state-active");this._stop(i,this._handleIndex);this._change(i,this._handleIndex);this._clickOffset=this._handleIndex=null;return false}, -_detectOrientation:function(){this.orientation=this.options.orientation=="vertical"?"vertical":"horizontal"},_normValueFromMouse:function(i){var k;if("horizontal"==this.orientation){k=this.elementSize.width;i=i.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)}else{k=this.elementSize.height;i=i.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)}k=i/k;if(k>1)k=1;if(k<0)k=0;if("vertical"==this.orientation)k=1-k;i=this._valueMax()-this._valueMin();i=k*i;k=i%this.options.step; -i=this._valueMin()+i-k;if(k>this.options.step/2)i+=this.options.step;return parseFloat(i.toFixed(5))},_start:function(i,k){var m={handle:this.handles[k],value:this.value()};if(this.options.values&&this.options.values.length){m.value=this.values(k);m.values=this.values()}this._trigger("start",i,m)},_slide:function(i,k,m){if(this.options.values&&this.options.values.length){var a=this.values(k?0:1);if(this.options.values.length==2&&this.options.range===true&&(k==0&&m>a||k==1&&m1){this.options.values[i]=k;this._refreshValue(m);a||this._change(null,i)}return arguments.length?this.options.values&& -this.options.values.length?this._values(i):this.value():this._values()},_setData:function(i,k,m){d.widget.prototype._setData.apply(this,arguments);switch(i){case "disabled":if(k){this.handles.filter(".ui-state-focus").blur();this.handles.removeClass("ui-state-hover");this.handles.attr("disabled","disabled")}else this.handles.removeAttr("disabled");case "orientation":this._detectOrientation();this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui-slider-"+this.orientation); -this._refreshValue(m);break;case "value":this._refreshValue(m);break}},_step:function(){var i=this.options.step;return i},_value:function(){var i=this.options.value;if(ithis._valueMax())i=this._valueMax();return i},_values:function(i){if(arguments.length){var k=this.options.values[i];if(kthis._valueMax())k=this._valueMax();return k}else return this.options.values},_valueMin:function(){var i=this.options.min;return i}, -_valueMax:function(){var i=this.options.max;return i},_refreshValue:function(i){var k=this.options.range,m=this.options,a=this;if(this.options.values&&this.options.values.length)this.handles.each(function(g){var f=(a.values(g)-a._valueMin())/(a._valueMax()-a._valueMin())*100,h={};h[a.orientation=="horizontal"?"left":"bottom"]=f+"%";d(this).stop(1,1)[i?"animate":"css"](h,m.animate);if(a.options.range===true)if(a.orientation=="horizontal"){g==0&&a.range.stop(1,1)[i?"animate":"css"]({left:f+"%"},m.animate); -g==1&&a.range[i?"animate":"css"]({width:f-lastValPercent+"%"},{queue:false,duration:m.animate})}else{g==0&&a.range.stop(1,1)[i?"animate":"css"]({bottom:f+"%"},m.animate);g==1&&a.range[i?"animate":"css"]({height:f-lastValPercent+"%"},{queue:false,duration:m.animate})}lastValPercent=f});else{var b=this.value(),c=this._valueMin(),e=this._valueMax();b=e!=c?(b-c)/(e-c)*100:0;c={};c[a.orientation=="horizontal"?"left":"bottom"]=b+"%";this.handle.stop(1,1)[i?"animate":"css"](c,m.animate);k=="min"&&this.orientation== -"horizontal"&&this.range.stop(1,1)[i?"animate":"css"]({width:b+"%"},m.animate);k=="max"&&this.orientation=="horizontal"&&this.range[i?"animate":"css"]({width:100-b+"%"},{queue:false,duration:m.animate});k=="min"&&this.orientation=="vertical"&&this.range.stop(1,1)[i?"animate":"css"]({height:b+"%"},m.animate);k=="max"&&this.orientation=="vertical"&&this.range[i?"animate":"css"]({height:100-b+"%"},{queue:false,duration:m.animate})}}}));d.extend(d.ui.slider,{getter:"value values",version:"1.7.2",eventPrefix:"slide", -defaults:{animate:false,delay:0,distance:0,max:100,min:0,orientation:"horizontal",range:false,step:1,value:0,values:null}})})(jQuery); -(function(d){d.extend(d.ui,{datepicker:{version:"1.7.2"}});var i="datepicker";function k(){this.debug=false;this._curInst=null;this._keyEvent=false;this._disabledInputs=[];this._inDialog=this._datepickerShowing=false;this._mainDivId="ui-datepicker-div";this._inlineClass="ui-datepicker-inline";this._appendClass="ui-datepicker-append";this._triggerClass="ui-datepicker-trigger";this._dialogClass="ui-datepicker-dialog";this._disableClass="ui-datepicker-disabled";this._unselectableClass="ui-datepicker-unselectable"; -this._currentClass="ui-datepicker-current-day";this._dayOverClass="ui-datepicker-days-cell-over";this.regional=[];this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun", -"Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],dateFormat:"mm/dd/yy",firstDay:0,isRTL:false};this._defaults={showOn:"focus",showAnim:"show",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:false,hideIfNoPrevNext:false,navigationAsDateFormat:false,gotoCurrent:false,changeMonth:false,changeYear:false,showMonthAfterYear:false,yearRange:"-10:+10",showOtherMonths:false,calculateWeek:this.iso8601Week,shortYearCutoff:"+10", -minDate:null,maxDate:null,duration:"normal",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:true,showButtonPanel:false};d.extend(this._defaults,this.regional[""]);this.dpDiv=d('
')}d.extend(k.prototype,{markerClassName:"hasDatepicker", -log:function(){this.debug&&console.log.apply("",arguments)},setDefaults:function(a){m(this._defaults,a||{});return this},_attachDatepicker:function(a,b){var c=null;for(var e in this._defaults){var g=a.getAttribute("date:"+e);if(g){c=c||{};try{c[e]=eval(g)}catch(f){c[e]=g}}}e=a.nodeName.toLowerCase();g=e=="div"||e=="span";if(!a.id)a.id="dp"+ ++this.uuid;var h=this._newInst(d(a),g);h.settings=d.extend({},b||{},c||{});if(e=="input")this._connectDatepicker(a,h);else g&&this._inlineDatepicker(a,h)},_newInst:function(a, -b){var c=a[0].id.replace(/([:\[\]\.])/g,"\\\\$1");return{id:c,input:a,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:b,dpDiv:!b?this.dpDiv:d('
')}},_connectDatepicker:function(a,b){var c=d(a);b.append=d([]);b.trigger=d([]);if(!c.hasClass(this.markerClassName)){var e=this._get(b,"appendText"),g=this._get(b,"isRTL");if(e){b.append=d(''+e+"");c[g?"before":"after"](b.append)}e=this._get(b,"showOn");if(e=="focus"||e=="both")c.focus(this._showDatepicker);if(e=="button"||e=="both"){e=this._get(b,"buttonText");var f=this._get(b,"buttonImage");b.trigger=d(this._get(b,"buttonImageOnly")?d("").addClass(this._triggerClass).attr({src:f,alt:e,title:e}):d('').addClass(this._triggerClass).html(f==""?e:d("").attr({src:f,alt:e,title:e})));c[g?"before":"after"](b.trigger);b.trigger.click(function(){d.datepicker._datepickerShowing&& -d.datepicker._lastInput==a?d.datepicker._hideDatepicker():d.datepicker._showDatepicker(a);return false})}c.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).bind("setData.datepicker",function(h,j,l){b.settings[j]=l}).bind("getData.datepicker",function(h,j){return this._get(b,j)});d.data(a,i,b)}},_inlineDatepicker:function(a,b){var c=d(a);if(!c.hasClass(this.markerClassName)){c.addClass(this.markerClassName).append(b.dpDiv).bind("setData.datepicker",function(e,g,f){b.settings[g]= -f}).bind("getData.datepicker",function(e,g){return this._get(b,g)});d.data(a,i,b);this._setDate(b,this._getDefaultDate(b));this._updateDatepicker(b);this._updateAlternate(b)}},_dialogDatepicker:function(a,b,c,e,g){a=this._dialogInst;if(!a){a="dp"+ ++this.uuid;this._dialogInput=d('');this._dialogInput.keydown(this._doKeyDown);d("body").append(this._dialogInput);a=this._dialogInst=this._newInst(this._dialogInput,false); -a.settings={};d.data(this._dialogInput[0],i,a)}m(a.settings,e||{});this._dialogInput.val(b);this._pos=g?g.length?g:[g.pageX,g.pageY]:null;if(!this._pos){b=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth;e=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight;g=document.documentElement.scrollLeft||document.body.scrollLeft;var f=document.documentElement.scrollTop||document.body.scrollTop;this._pos=[b/2-100+g,e/2-150+f]}this._dialogInput.css("left", -this._pos[0]+"px").css("top",this._pos[1]+"px");a.settings.onSelect=c;this._inDialog=true;this.dpDiv.addClass(this._dialogClass);this._showDatepicker(this._dialogInput[0]);d.blockUI&&d.blockUI(this.dpDiv);d.data(this._dialogInput[0],i,a);return this},_destroyDatepicker:function(a){var b=d(a),c=d.data(a,i);if(b.hasClass(this.markerClassName)){var e=a.nodeName.toLowerCase();d.removeData(a,i);if(e=="input"){c.append.remove();c.trigger.remove();b.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown", -this._doKeyDown).unbind("keypress",this._doKeyPress)}else if(e=="div"||e=="span")b.removeClass(this.markerClassName).empty()}},_enableDatepicker:function(a){var b=d(a),c=d.data(a,i);if(b.hasClass(this.markerClassName)){var e=a.nodeName.toLowerCase();if(e=="input"){a.disabled=false;c.trigger.filter("button").each(function(){this.disabled=false}).end().filter("img").css({opacity:"1.0",cursor:""})}else if(e=="div"||e=="span"){b=b.children("."+this._inlineClass);b.children().removeClass("ui-state-disabled")}this._disabledInputs= -d.map(this._disabledInputs,function(g){return g==a?null:g})}},_disableDatepicker:function(a){var b=d(a),c=d.data(a,i);if(b.hasClass(this.markerClassName)){var e=a.nodeName.toLowerCase();if(e=="input"){a.disabled=true;c.trigger.filter("button").each(function(){this.disabled=true}).end().filter("img").css({opacity:"0.5",cursor:"default"})}else if(e=="div"||e=="span"){b=b.children("."+this._inlineClass);b.children().addClass("ui-state-disabled")}this._disabledInputs=d.map(this._disabledInputs,function(g){return g== -a?null:g});this._disabledInputs[this._disabledInputs.length]=a}},_isDisabledDatepicker:function(a){if(!a)return false;for(var b=0;b-1}},_showDatepicker:function(a){a=a.target||a;if(a.nodeName.toLowerCase()!="input")a=d("input",a.parentNode)[0];if(!(d.datepicker._isDisabledDatepicker(a)||d.datepicker._lastInput==a)){var b=d.datepicker._getInst(a),c=d.datepicker._get(b,"beforeShow"); -m(b.settings,c?c.apply(a,[a,b]):{});d.datepicker._hideDatepicker(null,"");d.datepicker._lastInput=a;d.datepicker._setDateFromField(b);if(d.datepicker._inDialog)a.value="";if(!d.datepicker._pos){d.datepicker._pos=d.datepicker._findPos(a);d.datepicker._pos[1]+=a.offsetHeight}var e=false;d(a).parents().each(function(){e|=d(this).css("position")=="fixed";return!e});if(e&&d.browser.opera){d.datepicker._pos[0]-=document.documentElement.scrollLeft;d.datepicker._pos[1]-=document.documentElement.scrollTop}a= -{left:d.datepicker._pos[0],top:d.datepicker._pos[1]};d.datepicker._pos=null;b.rangeStart=null;b.dpDiv.css({position:"absolute",display:"block",top:"-1000px"});d.datepicker._updateDatepicker(b);a=d.datepicker._checkOffset(b,a,e);b.dpDiv.css({position:d.datepicker._inDialog&&d.blockUI?"static":e?"fixed":"absolute",display:"none",left:a.left+"px",top:a.top+"px"});if(!b.inline){a=d.datepicker._get(b,"showAnim")||"show";c=d.datepicker._get(b,"duration");var g=function(){d.datepicker._datepickerShowing= -true;d.browser.msie&&parseInt(d.browser.version,10)<7&&d("iframe.ui-datepicker-cover").css({width:b.dpDiv.width()+4,height:b.dpDiv.height()+4})};d.effects&&d.effects[a]?b.dpDiv.show(a,d.datepicker._get(b,"showOptions"),c,g):b.dpDiv[a](c,g);c==""&&g();b.input[0].type!="hidden"&&b.input[0].focus();d.datepicker._curInst=b}}},_updateDatepicker:function(a){var b={width:a.dpDiv.width()+4,height:a.dpDiv.height()+4},c=this;a.dpDiv.empty().append(this._generateHTML(a)).find("iframe.ui-datepicker-cover").css({width:b.width, -height:b.height}).end().find("button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a").bind("mouseout",function(){d(this).removeClass("ui-state-hover");this.className.indexOf("ui-datepicker-prev")!=-1&&d(this).removeClass("ui-datepicker-prev-hover");this.className.indexOf("ui-datepicker-next")!=-1&&d(this).removeClass("ui-datepicker-next-hover")}).bind("mouseover",function(){if(!c._isDisabledDatepicker(a.inline?a.dpDiv.parent()[0]:a.input[0])){d(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"); -d(this).addClass("ui-state-hover");this.className.indexOf("ui-datepicker-prev")!=-1&&d(this).addClass("ui-datepicker-prev-hover");this.className.indexOf("ui-datepicker-next")!=-1&&d(this).addClass("ui-datepicker-next-hover")}}).end().find("."+this._dayOverClass+" a").trigger("mouseover").end();b=this._getNumberOfMonths(a);var e=b[1],g=17;e>1?a.dpDiv.addClass("ui-datepicker-multi-"+e).css("width",g*e+"em"):a.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width(""); -a.dpDiv[(b[0]!=1||b[1]!=1?"add":"remove")+"Class"]("ui-datepicker-multi");a.dpDiv[(this._get(a,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl");a.input&&a.input[0].type!="hidden"&&a==d.datepicker._curInst&&d(a.input[0]).focus()},_checkOffset:function(a,b,c){var e=a.dpDiv.outerWidth(),g=a.dpDiv.outerHeight(),f=a.input?a.input.outerWidth():0,h=a.input?a.input.outerHeight():0,j=(window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth)+d(document).scrollLeft(),l=(window.innerHeight|| -document.documentElement.clientHeight||document.body.clientHeight)+d(document).scrollTop();b.left-=this._get(a,"isRTL")?e-f:0;b.left-=c&&b.left==a.input.offset().left?d(document).scrollLeft():0;b.top-=c&&b.top==a.input.offset().top+h?d(document).scrollTop():0;b.left-=b.left+e>j&&j>e?Math.abs(b.left+e-j):0;b.top-=b.top+g>l&&l>g?Math.abs(b.top+g+h*2-l):0;return b},_findPos:function(a){for(;a&&(a.type=="hidden"||a.nodeType!=1);)a=a.nextSibling;a=d(a).offset();return[a.left,a.top]},_hideDatepicker:function(a, -b){var c=this._curInst;if(!(!c||a&&c!=d.data(a,i))){c.stayOpen&&this._selectDate("#"+c.id,this._formatDate(c,c.currentDay,c.currentMonth,c.currentYear));c.stayOpen=false;if(this._datepickerShowing){b=b!=null?b:this._get(c,"duration");a=this._get(c,"showAnim");var e=function(){d.datepicker._tidyDialog(c)};b!=""&&d.effects&&d.effects[a]?c.dpDiv.hide(a,d.datepicker._get(c,"showOptions"),b,e):c.dpDiv[b==""?"hide":a=="slideDown"?"slideUp":a=="fadeIn"?"fadeOut":"hide"](b,e);b==""&&this._tidyDialog(c);if(b= -this._get(c,"onClose"))b.apply(c.input?c.input[0]:null,[c.input?c.input.val():"",c]);this._datepickerShowing=false;this._lastInput=null;if(this._inDialog){this._dialogInput.css({position:"absolute",left:"0",top:"-100px"});if(d.blockUI){d.unblockUI();d("body").append(this.dpDiv)}}this._inDialog=false}this._curInst=null}},_tidyDialog:function(a){a.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")},_checkExternalClick:function(a){if(d.datepicker._curInst){a=d(a.target);a.parents("#"+ -d.datepicker._mainDivId).length==0&&!a.hasClass(d.datepicker.markerClassName)&&!a.hasClass(d.datepicker._triggerClass)&&d.datepicker._datepickerShowing&&!(d.datepicker._inDialog&&d.blockUI)&&d.datepicker._hideDatepicker(null,"")}},_adjustDate:function(a,b,c){a=d(a);var e=this._getInst(a[0]);if(!this._isDisabledDatepicker(a[0])){this._adjustInstDate(e,b+(c=="M"?this._get(e,"showCurrentAtPos"):0),c);this._updateDatepicker(e)}},_gotoToday:function(a){a=d(a);var b=this._getInst(a[0]);if(this._get(b,"gotoCurrent")&& -b.currentDay){b.selectedDay=b.currentDay;b.drawMonth=b.selectedMonth=b.currentMonth;b.drawYear=b.selectedYear=b.currentYear}else{var c=new Date;b.selectedDay=c.getDate();b.drawMonth=b.selectedMonth=c.getMonth();b.drawYear=b.selectedYear=c.getFullYear()}this._notifyChange(b);this._adjustDate(a)},_selectMonthYear:function(a,b,c){a=d(a);var e=this._getInst(a[0]);e._selectingMonthYear=false;e["selected"+(c=="M"?"Month":"Year")]=e["draw"+(c=="M"?"Month":"Year")]=parseInt(b.options[b.selectedIndex].value, -10);this._notifyChange(e);this._adjustDate(a)},_clickMonthYear:function(a){a=d(a);a=this._getInst(a[0]);a.input&&a._selectingMonthYear&&!d.browser.msie&&a.input[0].focus();a._selectingMonthYear=!a._selectingMonthYear},_selectDay:function(a,b,c,e){var g=d(a);if(!(d(e).hasClass(this._unselectableClass)||this._isDisabledDatepicker(g[0]))){g=this._getInst(g[0]);g.selectedDay=g.currentDay=d("a",e).html();g.selectedMonth=g.currentMonth=b;g.selectedYear=g.currentYear=c;if(g.stayOpen)g.endDay=g.endMonth= -g.endYear=null;this._selectDate(a,this._formatDate(g,g.currentDay,g.currentMonth,g.currentYear));if(g.stayOpen){g.rangeStart=this._daylightSavingAdjust(new Date(g.currentYear,g.currentMonth,g.currentDay));this._updateDatepicker(g)}}},_clearDate:function(a){a=d(a);var b=this._getInst(a[0]);b.stayOpen=false;b.endDay=b.endMonth=b.endYear=b.rangeStart=null;this._selectDate(a,"")},_selectDate:function(a,b){a=d(a);a=this._getInst(a[0]);b=b!=null?b:this._formatDate(a);a.input&&a.input.val(b);this._updateAlternate(a); -var c=this._get(a,"onSelect");if(c)c.apply(a.input?a.input[0]:null,[b,a]);else a.input&&a.input.trigger("change");if(a.inline)this._updateDatepicker(a);else if(!a.stayOpen){this._hideDatepicker(null,this._get(a,"duration"));this._lastInput=a.input[0];typeof a.input[0]!="object"&&a.input[0].focus();this._lastInput=null}},_updateAlternate:function(a){var b=this._get(a,"altField");if(b){var c=this._get(a,"altFormat")||this._get(a,"dateFormat"),e=this._getDate(a);dateStr=this.formatDate(c,e,this._getFormatConfig(a)); -d(b).each(function(){d(this).val(dateStr)})}},noWeekends:function(a){a=a.getDay();return[a>0&&a<6,""]},iso8601Week:function(a){a=new Date(a.getFullYear(),a.getMonth(),a.getDate());var b=new Date(a.getFullYear(),0,4),c=b.getDay()||7;b.setDate(b.getDate()+1-c);if(c<4&&anew Date(a.getFullYear(),11,28)){c=(new Date(a.getFullYear()+1,0,4)).getDay()||7;if(c>4&&(a.getDay()||7)0&&x="0"&&b.charAt(x)<="9";){y=y*10+parseInt(b.charAt(x++),10);z--}if(z==v)throw"Missing number at position "+x;return y}function r(v,z,y){v=p(v)?y:z;for(y=z=0;y0&&x-1){l=1;n=q;do{e=this._getDaysInMonth(c,l-1);if(n<=e)break;l++;n-=e}while(1)}B=this._daylightSavingAdjust(new Date(c,l-1,n));if(B.getFullYear()!=c||B.getMonth()+1!=l||B.getDate()!=n)throw"Invalid date";return B},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TIMESTAMP:"@",W3C:"yy-mm-dd",formatDate:function(a,b,c){if(!b)return"";var e=(c?c.dayNamesShort:null)||this._defaults.dayNamesShort, -g=(c?c.dayNames:null)||this._defaults.dayNames,f=(c?c.monthNamesShort:null)||this._defaults.monthNamesShort;c=(c?c.monthNames:null)||this._defaults.monthNames;function h(r){(r=o+1=0;s--)p+=this._getDaysInMonth(b.getFullYear(),s);n+=j("o",p,3);break;case "m":n+=j("m",b.getMonth()+1,2);break;case "M":n+=l("M",b.getMonth(),f,c);break;case "y":n+=h("y")?b.getFullYear():(b.getYear()%100<10?"0":"")+b.getYear()%100;break;case "@":n+=b.getTime();break;case "'":if(h("'"))n+="'";else q=true;break;default:n+=a.charAt(o)}return n},_possibleChars:function(a){for(var b="",c=false,e=0;ea?a:b},_determineDate:function(a,b){function c(g){var f=new Date;f.setDate(f.getDate()+g);return f}function e(g,f){var h=new Date,j=h.getFullYear(),l=h.getMonth();h=h.getDate();for(var n=/([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,q=n.exec(g);q;){switch(q[2]||"d"){case "d":case "D":h+=parseInt(q[1],10);break;case "w":case "W":h+=parseInt(q[1],10)*7;break;case "m":case "M":l+=parseInt(q[1],10);h=Math.min(h,f(j,l));break;case "y":case "Y":j+=parseInt(q[1],10);h=Math.min(h,f(j,l));break}q=n.exec(g)}return new Date(j, -l,h)}if(a=(a=a==null?b:typeof a=="string"?e(a,this._getDaysInMonth):typeof a=="number"?isNaN(a)?b:c(a):a)&&a.toString()=="Invalid Date"?b:a){a.setHours(0);a.setMinutes(0);a.setSeconds(0);a.setMilliseconds(0)}return this._daylightSavingAdjust(a)},_daylightSavingAdjust:function(a){if(!a)return null;a.setHours(a.getHours()>12?a.getHours()+2:0);return a},_setDate:function(a,b){var c=!b,e=a.selectedMonth,g=a.selectedYear;b=this._determineDate(b,new Date);a.selectedDay=a.currentDay=b.getDate();a.drawMonth= -a.selectedMonth=a.currentMonth=b.getMonth();a.drawYear=a.selectedYear=a.currentYear=b.getFullYear();if(e!=a.selectedMonth||g!=a.selectedYear)this._notifyChange(a);this._adjustInstDate(a);if(a.input)a.input.val(c?"":this._formatDate(a))},_getDate:function(a){return a=!a.currentYear||a.input&&a.input.val()==""?null:this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay))},_generateHTML:function(a){var b=new Date;b=this._daylightSavingAdjust(new Date(b.getFullYear(),b.getMonth(), -b.getDate()));var c=this._get(a,"isRTL"),e=this._get(a,"showButtonPanel"),g=this._get(a,"hideIfNoPrevNext"),f=this._get(a,"navigationAsDateFormat"),h=this._getNumberOfMonths(a),j=this._get(a,"showCurrentAtPos"),l=this._get(a,"stepMonths");this._get(a,"stepBigMonths");var n=h[0]!=1||h[1]!=1,q=this._daylightSavingAdjust(!a.currentDay?new Date(9999,9,9):new Date(a.currentYear,a.currentMonth,a.currentDay)),o=this._getMinMaxDate(a,"min",true),p=this._getMinMaxDate(a,"max");j=a.drawMonth-j;var s=a.drawYear; -if(j<0){j+=12;s--}if(p){var r=this._daylightSavingAdjust(new Date(p.getFullYear(),p.getMonth()-h[1]+1,p.getDate()));for(r=o&&rr;){j--;if(j<0){j=11;s--}}}a.drawMonth=j;a.drawYear=s;r=this._get(a,"prevText");r=!f?r:this.formatDate(r,this._daylightSavingAdjust(new Date(s,j-l,1)),this._getFormatConfig(a));r=this._canAdjustMonth(a,-1,s,j)?''+r+"":g?"":''+r+"";var t=this._get(a,"nextText");t=!f?t:this.formatDate(t,this._daylightSavingAdjust(new Date(s,j+l,1)),this._getFormatConfig(a));g=this._canAdjustMonth(a,+1,s,j)?''+t+"":g?"":''+t+"";l=this._get(a,"currentText");t=this._get(a,"gotoCurrent")&&a.currentDay?q:b;l=!f?l:this.formatDate(l,t,this._getFormatConfig(a));f=!a.inline?'":"";e=e?'
'+(c?f:"")+(this._isInRange(a,t)?'":"")+(c?"":f)+"
":"";f=parseInt(this._get(a,"firstDay"),10);f=isNaN(f)?0:f;l=this._get(a,"dayNames");this._get(a,"dayNamesShort");t=this._get(a,"dayNamesMin");var x=this._get(a,"monthNames"), -A=this._get(a,"monthNamesShort"),B=this._get(a,"beforeShowDay"),v=this._get(a,"showOtherMonths");this._get(a,"calculateWeek");for(var z=a.endDay?this._daylightSavingAdjust(new Date(a.endYear,a.endMonth,a.endDay)):q,y=this._getDefaultDate(a),F="",D=0;D'+(/all|left/.test(w)&&D==0?c?g:r:"")+(/all|right/.test(w)&&D==0?c?r:g:"")+this._generateMonthYearHeader(a,j,s,o,p,J,D>0||G>0,x,A)+'';var E="";for(w=0;w<7;w++){var u=(w+f)%7;E+="=5?' class="ui-datepicker-week-end"':"")+'>'+ -t[u]+""}C+=E+"";E=this._getDaysInMonth(s,j);if(s==a.selectedYear&&j==a.selectedMonth)a.selectedDay=Math.min(a.selectedDay,E);w=(this._getFirstDayOfMonth(s,j)-f+7)%7;E=n?6:Math.ceil((w+E)/7);u=this._daylightSavingAdjust(new Date(s,j,1-w));for(var M=0;M";var N="";for(w=0;w<7;w++){var I=B?B.apply(a.input?a.input[0]:null,[u]):[true,""],H=u.getMonth()!=j,K=H||!I[0]||o&&up;N+='";u.setDate(u.getDate()+1);u=this._daylightSavingAdjust(u)}C+=N+""}j++;if(j>11){j=0;s++}C+="
=q.getTime()&&u.getTime()<=z.getTime()?" "+this._currentClass:"")+(u.getTime()==b.getTime()?" ui-datepicker-today":""))+'"'+((!H||v)&&I[2]?' title="'+I[2]+'"':"")+(K?"":" onclick=\"DP_jQuery.datepicker._selectDay('#"+a.id+"',"+j+","+s+', this);return false;"')+">"+(H?v?u.getDate(): -" ":K?''+u.getDate()+"":'=q.getTime()&&u.getTime()<=z.getTime()?" ui-state-active":"")+'" href="#">'+u.getDate()+"")+"
"+(n?""+(h[0]>0&&G==h[1]-1?'
':""):"");L+=C}F+=L}F+=e+(d.browser.msie&&parseInt(d.browser.version, -10)<7&&!a.inline?'':"");a._keyEvent=false;return F},_generateMonthYearHeader:function(a,b,c,e,g,f,h,j,l){e=a.rangeStart&&e&&f',p="";if(h||!f)p+=''+j[b]+" ";else{j=e&&e.getFullYear()==c;var s=g&&g.getFullYear()==c;p+='"}q||(o+=p+((h||f||n)&&!(f&&n)?" ":""));if(h||!n)o+=''+c+"";else{b=this._get(a,"yearRange").split(":");j=l=0;if(b.length!=2){l=c-10;j=c+10}else if(b[0].charAt(0)=="+"||b[0].charAt(0)=="-"){l=c+parseInt(b[0], -10);j=c+parseInt(b[1],10)}else{l=parseInt(b[0],10);j=parseInt(b[1],10)}l=e?Math.max(l,e.getFullYear()):l;j=g?Math.min(j,g.getFullYear()):j;for(o+='"}if(q)o+=(h||f||n?" ":"")+p;o+="";return o},_adjustInstDate:function(a, -b,c){var e=a.drawYear+(c=="Y"?b:0),g=a.drawMonth+(c=="M"?b:0);b=Math.min(a.selectedDay,this._getDaysInMonth(e,g))+(c=="D"?b:0);e=this._daylightSavingAdjust(new Date(e,g,b));g=this._getMinMaxDate(a,"min",true);b=this._getMinMaxDate(a,"max");e=g&&eb?b:e;a.selectedDay=e.getDate();a.drawMonth=a.selectedMonth=e.getMonth();a.drawYear=a.selectedYear=e.getFullYear();if(c=="M"||c=="Y")this._notifyChange(a)},_notifyChange:function(a){var b=this._get(a,"onChangeMonthYear");if(b)b.apply(a.input? -a.input[0]:null,[a.selectedYear,a.selectedMonth+1,a])},_getNumberOfMonths:function(a){a=this._get(a,"numberOfMonths");return a==null?[1,1]:typeof a=="number"?[1,a]:a},_getMinMaxDate:function(a,b,c){b=this._determineDate(this._get(a,b+"Date"),null);return!c||!a.rangeStart?b:!b||a.rangeStart>b?a.rangeStart:b},_getDaysInMonth:function(a,b){return 32-(new Date(a,b,32)).getDate()},_getFirstDayOfMonth:function(a,b){return(new Date(a,b,1)).getDay()},_canAdjustMonth:function(a,b,c,e){var g=this._getNumberOfMonths(a); -c=this._daylightSavingAdjust(new Date(c,e+(b<0?b:g[1]),1));b<0&&c.setDate(this._getDaysInMonth(c.getFullYear(),c.getMonth()));return this._isInRange(a,c)},_isInRange:function(a,b){var c=!a.rangeStart?null:this._daylightSavingAdjust(new Date(a.selectedYear,a.selectedMonth,a.selectedDay));c=(c=c&&a.rangeStart=c)&&(!a||b<=a)},_getFormatConfig:function(a){var b=this._get(a,"shortYearCutoff");b=typeof b!="string"? -b:(new Date).getFullYear()%100+parseInt(b,10);return{shortYearCutoff:b,dayNamesShort:this._get(a,"dayNamesShort"),dayNames:this._get(a,"dayNames"),monthNamesShort:this._get(a,"monthNamesShort"),monthNames:this._get(a,"monthNames")}},_formatDate:function(a,b,c,e){if(!b){a.currentDay=a.selectedDay;a.currentMonth=a.selectedMonth;a.currentYear=a.selectedYear}b=b?typeof b=="object"?b:this._daylightSavingAdjust(new Date(e,c,b)):this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay)); -return this.formatDate(this._get(a,"dateFormat"),b,this._getFormatConfig(a))}});function m(a,b){d.extend(a,b);for(var c in b)if(b[c]==null||b[c]==undefined)a[c]=b[c];return a}d.fn.datepicker=function(a){if(!d.datepicker.initialized){d(document).mousedown(d.datepicker._checkExternalClick).find("body").append(d.datepicker.dpDiv);d.datepicker.initialized=true}var b=Array.prototype.slice.call(arguments,1);if(typeof a=="string"&&(a=="isDisabled"||a=="getDate"))return d.datepicker["_"+a+"Datepicker"].apply(d.datepicker, -[this[0]].concat(b));if(a=="option"&&arguments.length==2&&typeof arguments[1]=="string")return d.datepicker["_"+a+"Datepicker"].apply(d.datepicker,[this[0]].concat(b));return this.each(function(){typeof a=="string"?d.datepicker["_"+a+"Datepicker"].apply(d.datepicker,[this].concat(b)):d.datepicker._attachDatepicker(this,a)})};d.datepicker=new k;d.datepicker.initialized=false;d.datepicker.uuid=(new Date).getTime();d.datepicker.version="1.7.2";window.DP_jQuery=d})(jQuery); -(function(d){d.widget("ui.progressbar",{_init:function(){this.element.addClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").attr({role:"progressbar","aria-valuemin":this._valueMin(),"aria-valuemax":this._valueMax(),"aria-valuenow":this._value()});this.valueDiv=d('
').appendTo(this.element);this._refreshValue()},destroy:function(){this.element.removeClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow").removeData("progressbar").unbind(".progressbar"); -this.valueDiv.remove();d.widget.prototype.destroy.apply(this,arguments)},value:function(i){if(i===undefined)return this._value();this._setData("value",i);return this},_setData:function(i,k){switch(i){case "value":this.options.value=k;this._refreshValue();this._trigger("change",null,{});break}d.widget.prototype._setData.apply(this,arguments)},_value:function(){var i=this.options.value;if(ithis._valueMax())i=this._valueMax();return i},_valueMin:function(){var i= -0;return i},_valueMax:function(){var i=100;return i},_refreshValue:function(){var i=this.value();this.valueDiv[i==this._valueMax()?"addClass":"removeClass"]("ui-corner-right");this.valueDiv.width(i+"%");this.element.attr("aria-valuenow",i)}});d.extend(d.ui.progressbar,{version:"1.7.2",defaults:{value:0}})})(jQuery); -jQuery.effects||function(d){d.effects={version:"1.7.2",save:function(b,c){for(var e=0;e');var e=b.parent();if(b.css("position")=="static"){e.css({position:"relative"});b.css({position:"relative"})}else{var g= -b.css("top");if(isNaN(parseInt(g,10)))g="auto";var f=b.css("left");if(isNaN(parseInt(f,10)))f="auto";e.css({position:b.css("position"),top:g,left:f,zIndex:b.css("z-index")}).show();b.css({position:"relative",top:0,left:0})}e.css(c);return e},removeWrapper:function(b){if(b.parent().is(".ui-effects-wrapper"))return b.parent().replaceWith(b);return b},setTransition:function(b,c,e,g){g=g||{};d.each(c,function(f,h){unit=b.cssUnit(h);if(unit[0]>0)g[h]=unit[0]*e+unit[1]});return g},animateClass:function(b, -c,e,g){var f=typeof e=="function"?e:g?g:null,h=typeof e=="string"?e:null;return this.each(function(){var j={},l=d(this),n=l.attr("style")||"";if(typeof n=="object")n=n.cssText;if(b.toggle)l.hasClass(b.toggle)?(b.remove=b.toggle):(b.add=b.toggle);var q=d.extend({},document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle);b.add&&l.addClass(b.add);b.remove&&l.removeClass(b.remove);var o=d.extend({},document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle); -b.add&&l.removeClass(b.add);b.remove&&l.addClass(b.remove);for(var p in o)if(typeof o[p]!="function"&&o[p]&&p.indexOf("Moz")==-1&&p.indexOf("length")==-1&&o[p]!=q[p]&&(p.match(/color/i)||!p.match(/color/i)&&!isNaN(parseInt(o[p],10)))&&(q.position!="static"||q.position=="static"&&!p.match(/left|top|bottom|right/)))j[p]=o[p];l.animate(j,c,h,function(){if(typeof d(this).attr("style")=="object"){d(this).attr("style").cssText="";d(this).attr("style").cssText=n}else d(this).attr("style",n);b.add&&d(this).addClass(b.add); -b.remove&&d(this).removeClass(b.remove);f&&f.apply(this,arguments)})})}};function i(b,c){var e=b[1]&&b[1].constructor==Object?b[1]:{};if(c)e.mode=c;c=b[1]&&b[1].constructor!=Object?b[1]:e.duration?e.duration:b[2];c=d.fx.off?0:typeof c==="number"?c:d.fx.speeds[c]||d.fx.speeds._default;var g=e.callback||d.isFunction(b[1])&&b[1]||d.isFunction(b[2])&&b[2]||d.isFunction(b[3])&&b[3];return[b[0],e,c,g]}d.fn.extend({_show:d.fn.show,_hide:d.fn.hide,__toggle:d.fn.toggle,_addClass:d.fn.addClass,_removeClass:d.fn.removeClass, -_toggleClass:d.fn.toggleClass,effect:function(b,c,e,g){return d.effects[b]?d.effects[b].call(this,{method:b,options:c||{},duration:e,callback:g}):null},show:function(){return!arguments[0]||arguments[0].constructor==Number||/(slow|normal|fast)/.test(arguments[0])?this._show.apply(this,arguments):this.effect.apply(this,i(arguments,"show"))},hide:function(){return!arguments[0]||arguments[0].constructor==Number||/(slow|normal|fast)/.test(arguments[0])?this._hide.apply(this,arguments):this.effect.apply(this, -i(arguments,"hide"))},toggle:function(){return!arguments[0]||arguments[0].constructor==Number||/(slow|normal|fast)/.test(arguments[0])||d.isFunction(arguments[0])||typeof arguments[0]=="boolean"?this.__toggle.apply(this,arguments):this.effect.apply(this,i(arguments,"toggle"))},addClass:function(b,c,e,g){return c?d.effects.animateClass.apply(this,[{add:b},c,e,g]):this._addClass(b)},removeClass:function(b,c,e,g){return c?d.effects.animateClass.apply(this,[{remove:b},c,e,g]):this._removeClass(b)},toggleClass:function(b, -c,e,g){return typeof c!=="boolean"&&c?d.effects.animateClass.apply(this,[{toggle:b},c,e,g]):this._toggleClass(b,c)},morph:function(b,c,e,g,f){return d.effects.animateClass.apply(this,[{add:c,remove:b},e,g,f])},switchClass:function(){return this.morph.apply(this,arguments)},cssUnit:function(b){var c=this.css(b),e=[];d.each(["em","px","%","pt"],function(g,f){if(c.indexOf(f)>0)e=[parseFloat(c),f]});return e}});d.each(["backgroundColor","borderBottomColor","borderLeftColor","borderRightColor","borderTopColor", -"color","outlineColor"],function(b,c){d.fx.step[c]=function(e){if(e.state==0){e.start=m(e.elem,c);e.end=k(e.end)}e.elem.style[c]="rgb("+[Math.max(Math.min(parseInt(e.pos*(e.end[0]-e.start[0])+e.start[0],10),255),0),Math.max(Math.min(parseInt(e.pos*(e.end[1]-e.start[1])+e.start[1],10),255),0),Math.max(Math.min(parseInt(e.pos*(e.end[2]-e.start[2])+e.start[2],10),255),0)].join(",")+")"}});function k(b){var c;if(b&&b.constructor==Array&&b.length==3)return b;if(c=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(b))return[parseInt(c[1], -10),parseInt(c[2],10),parseInt(c[3],10)];if(c=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(b))return[parseFloat(c[1])*2.55,parseFloat(c[2])*2.55,parseFloat(c[3])*2.55];if(c=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(b))return[parseInt(c[1],16),parseInt(c[2],16),parseInt(c[3],16)];if(c=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(b))return[parseInt(c[1]+c[1],16),parseInt(c[2]+c[2],16),parseInt(c[3]+c[3],16)];if(/rgba\(0, 0, 0, 0\)/.exec(b))return a.transparent; -return a[d.trim(b).toLowerCase()]}function m(b,c){var e;do{e=d.curCSS(b,c);if(e!=""&&e!="transparent"||d.nodeName(b,"body"))break;c="backgroundColor"}while(b=b.parentNode);return k(e)}var a={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153, -50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192, -192],white:[255,255,255],yellow:[255,255,0],transparent:[255,255,255]};d.easing.jswing=d.easing.swing;d.extend(d.easing,{def:"easeOutQuad",swing:function(b,c,e,g,f){return d.easing[d.easing.def](b,c,e,g,f)},easeInQuad:function(b,c,e,g,f){return g*(c/=f)*c+e},easeOutQuad:function(b,c,e,g,f){return-g*(c/=f)*(c-2)+e},easeInOutQuad:function(b,c,e,g,f){if((c/=f/2)<1)return g/2*c*c+e;return-g/2*(--c*(c-2)-1)+e},easeInCubic:function(b,c,e,g,f){return g*(c/=f)*c*c+e},easeOutCubic:function(b,c,e,g,f){return g* -((c=c/f-1)*c*c+1)+e},easeInOutCubic:function(b,c,e,g,f){if((c/=f/2)<1)return g/2*c*c*c+e;return g/2*((c-=2)*c*c+2)+e},easeInQuart:function(b,c,e,g,f){return g*(c/=f)*c*c*c+e},easeOutQuart:function(b,c,e,g,f){return-g*((c=c/f-1)*c*c*c-1)+e},easeInOutQuart:function(b,c,e,g,f){if((c/=f/2)<1)return g/2*c*c*c*c+e;return-g/2*((c-=2)*c*c*c-2)+e},easeInQuint:function(b,c,e,g,f){return g*(c/=f)*c*c*c*c+e},easeOutQuint:function(b,c,e,g,f){return g*((c=c/f-1)*c*c*c*c+1)+e},easeInOutQuint:function(b,c,e,g,f){if((c/= -f/2)<1)return g/2*c*c*c*c*c+e;return g/2*((c-=2)*c*c*c*c+2)+e},easeInSine:function(b,c,e,g,f){return-g*Math.cos(c/f*(Math.PI/2))+g+e},easeOutSine:function(b,c,e,g,f){return g*Math.sin(c/f*(Math.PI/2))+e},easeInOutSine:function(b,c,e,g,f){return-g/2*(Math.cos(Math.PI*c/f)-1)+e},easeInExpo:function(b,c,e,g,f){return c==0?e:g*Math.pow(2,10*(c/f-1))+e},easeOutExpo:function(b,c,e,g,f){return c==f?e+g:g*(-Math.pow(2,-10*c/f)+1)+e},easeInOutExpo:function(b,c,e,g,f){if(c==0)return e;if(c==f)return e+g;if((c/= -f/2)<1)return g/2*Math.pow(2,10*(c-1))+e;return g/2*(-Math.pow(2,-10*--c)+2)+e},easeInCirc:function(b,c,e,g,f){return-g*(Math.sqrt(1-(c/=f)*c)-1)+e},easeOutCirc:function(b,c,e,g,f){return g*Math.sqrt(1-(c=c/f-1)*c)+e},easeInOutCirc:function(b,c,e,g,f){if((c/=f/2)<1)return-g/2*(Math.sqrt(1-c*c)-1)+e;return g/2*(Math.sqrt(1-(c-=2)*c)+1)+e},easeInElastic:function(b,c,e,g,f){b=1.70158;var h=0,j=g;if(c==0)return e;if((c/=f)==1)return e+g;h||(h=f*0.3);if(j=0)&&c(b,!e)}}),a(function(){var b=document.body,c=b.appendChild(c=document.createElement("div"));c.offsetHeight,a.extend(c.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0}),a.support.minHeight=c.offsetHeight===100,a.support.selectstart="onselectstart"in c,b.removeChild(c).style.display="none"}),a.extend(a.ui,{plugin:{add:function(b,c,d){var e=a.ui[b].prototype;for(var f in d)e.plugins[f]=e.plugins[f]||[],e.plugins[f].push([c,d[f]])},call:function(a,b,c){var d=a.plugins[b];if(!d||!a.element[0].parentNode)return;for(var e=0;e0?!0:(b[d]=1,e=b[d]>0,b[d]=0,e)},isOverAxis:function(a,b,c){return a>b&&a=9||!!b.button?this._mouseStarted?(this._mouseDrag(b),b.preventDefault()):(this._mouseDistanceMet(b)&&this._mouseDelayMet(b)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,b)!==!1,this._mouseStarted?this._mouseDrag(b):this._mouseUp(b)),!this._mouseStarted):this._mouseUp(b)},_mouseUp:function(b){return a(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,b.target==this._mouseDownEvent.target&&a.data(b.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(b)),!1},_mouseDistanceMet:function(a){return Math.max(Math.abs(this._mouseDownEvent.pageX-a.pageX),Math.abs(this._mouseDownEvent.pageY-a.pageY))>=this.options.distance},_mouseDelayMet:function(a){return this.mouseDelayMet},_mouseStart:function(a){},_mouseDrag:function(a){},_mouseStop:function(a){},_mouseCapture:function(a){return!0}})})(jQuery);;/*! jQuery UI - v1.8.21 - 2012-06-05 +* https://github.com/jquery/jquery-ui +* Includes: jquery.ui.accordion.js +* Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */ +(function(a,b){a.widget("ui.accordion",{options:{active:0,animated:"slide",autoHeight:!0,clearStyle:!1,collapsible:!1,event:"click",fillSpace:!1,header:"> li > :first-child,> :not(li):even",icons:{header:"ui-icon-triangle-1-e",headerSelected:"ui-icon-triangle-1-s"},navigation:!1,navigationFilter:function(){return this.href.toLowerCase()===location.href.toLowerCase()}},_create:function(){var b=this,c=b.options;b.running=0,b.element.addClass("ui-accordion ui-widget ui-helper-reset").children("li").addClass("ui-accordion-li-fix"),b.headers=b.element.find(c.header).addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all").bind("mouseenter.accordion",function(){if(c.disabled)return;a(this).addClass("ui-state-hover")}).bind("mouseleave.accordion",function(){if(c.disabled)return;a(this).removeClass("ui-state-hover")}).bind("focus.accordion",function(){if(c.disabled)return;a(this).addClass("ui-state-focus")}).bind("blur.accordion",function(){if(c.disabled)return;a(this).removeClass("ui-state-focus")}),b.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom");if(c.navigation){var d=b.element.find("a").filter(c.navigationFilter).eq(0);if(d.length){var e=d.closest(".ui-accordion-header");e.length?b.active=e:b.active=d.closest(".ui-accordion-content").prev()}}b.active=b._findActive(b.active||c.active).addClass("ui-state-default ui-state-active").toggleClass("ui-corner-all").toggleClass("ui-corner-top"),b.active.next().addClass("ui-accordion-content-active"),b._createIcons(),b.resize(),b.element.attr("role","tablist"),b.headers.attr("role","tab").bind("keydown.accordion",function(a){return b._keydown(a)}).next().attr("role","tabpanel"),b.headers.not(b.active||"").attr({"aria-expanded":"false","aria-selected":"false",tabIndex:-1}).next().hide(),b.active.length?b.active.attr({"aria-expanded":"true","aria-selected":"true",tabIndex:0}):b.headers.eq(0).attr("tabIndex",0),a.browser.safari||b.headers.find("a").attr("tabIndex",-1),c.event&&b.headers.bind(c.event.split(" ").join(".accordion ")+".accordion",function(a){b._clickHandler.call(b,a,this),a.preventDefault()})},_createIcons:function(){var b=this.options;b.icons&&(a("").addClass("ui-icon "+b.icons.header).prependTo(this.headers),this.active.children(".ui-icon").toggleClass(b.icons.header).toggleClass(b.icons.headerSelected),this.element.addClass("ui-accordion-icons"))},_destroyIcons:function(){this.headers.children(".ui-icon").remove(),this.element.removeClass("ui-accordion-icons")},destroy:function(){var b=this.options;this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role"),this.headers.unbind(".accordion").removeClass("ui-accordion-header ui-accordion-disabled ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top").removeAttr("role").removeAttr("aria-expanded").removeAttr("aria-selected").removeAttr("tabIndex"),this.headers.find("a").removeAttr("tabIndex"),this._destroyIcons();var c=this.headers.next().css("display","").removeAttr("role").removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-accordion-disabled ui-state-disabled");return(b.autoHeight||b.fillHeight)&&c.css("height",""),a.Widget.prototype.destroy.call(this)},_setOption:function(b,c){a.Widget.prototype._setOption.apply(this,arguments),b=="active"&&this.activate(c),b=="icons"&&(this._destroyIcons(),c&&this._createIcons()),b=="disabled"&&this.headers.add(this.headers.next())[c?"addClass":"removeClass"]("ui-accordion-disabled ui-state-disabled")},_keydown:function(b){if(this.options.disabled||b.altKey||b.ctrlKey)return;var c=a.ui.keyCode,d=this.headers.length,e=this.headers.index(b.target),f=!1;switch(b.keyCode){case c.RIGHT:case c.DOWN:f=this.headers[(e+1)%d];break;case c.LEFT:case c.UP:f=this.headers[(e-1+d)%d];break;case c.SPACE:case c.ENTER:this._clickHandler({target:b.target},b.target),b.preventDefault()}return f?(a(b.target).attr("tabIndex",-1),a(f).attr("tabIndex",0),f.focus(),!1):!0},resize:function(){var b=this.options,c;if(b.fillSpace){if(a.browser.msie){var d=this.element.parent().css("overflow");this.element.parent().css("overflow","hidden")}c=this.element.parent().height(),a.browser.msie&&this.element.parent().css("overflow",d),this.headers.each(function(){c-=a(this).outerHeight(!0)}),this.headers.next().each(function(){a(this).height(Math.max(0,c-a(this).innerHeight()+a(this).height()))}).css("overflow","auto")}else b.autoHeight&&(c=0,this.headers.next().each(function(){c=Math.max(c,a(this).height("").height())}).height(c));return this},activate:function(a){this.options.active=a;var b=this._findActive(a)[0];return this._clickHandler({target:b},b),this},_findActive:function(b){return b?typeof b=="number"?this.headers.filter(":eq("+b+")"):this.headers.not(this.headers.not(b)):b===!1?a([]):this.headers.filter(":eq(0)")},_clickHandler:function(b,c){var d=this.options;if(d.disabled)return;if(!b.target){if(!d.collapsible)return;this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").children(".ui-icon").removeClass(d.icons.headerSelected).addClass(d.icons.header),this.active.next().addClass("ui-accordion-content-active");var e=this.active.next(),f={options:d,newHeader:a([]),oldHeader:d.active,newContent:a([]),oldContent:e},g=this.active=a([]);this._toggle(g,e,f);return}var h=a(b.currentTarget||c),i=h[0]===this.active[0];d.active=d.collapsible&&i?!1:this.headers.index(h);if(this.running||!d.collapsible&&i)return;var j=this.active,g=h.next(),e=this.active.next(),f={options:d,newHeader:i&&d.collapsible?a([]):h,oldHeader:this.active,newContent:i&&d.collapsible?a([]):g,oldContent:e},k=this.headers.index(this.active[0])>this.headers.index(h[0]);this.active=i?a([]):h,this._toggle(g,e,f,i,k),j.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").children(".ui-icon").removeClass(d.icons.headerSelected).addClass(d.icons.header),i||(h.removeClass("ui-state-default ui-corner-all").addClass("ui-state-active ui-corner-top").children(".ui-icon").removeClass(d.icons.header).addClass(d.icons.headerSelected),h.next().addClass("ui-accordion-content-active"));return},_toggle:function(b,c,d,e,f){var g=this,h=g.options;g.toShow=b,g.toHide=c,g.data=d;var i=function(){if(!g)return;return g._completed.apply(g,arguments)};g._trigger("changestart",null,g.data),g.running=c.size()===0?b.size():c.size();if(h.animated){var j={};h.collapsible&&e?j={toShow:a([]),toHide:c,complete:i,down:f,autoHeight:h.autoHeight||h.fillSpace}:j={toShow:b,toHide:c,complete:i,down:f,autoHeight:h.autoHeight||h.fillSpace},h.proxied||(h.proxied=h.animated),h.proxiedDuration||(h.proxiedDuration=h.duration),h.animated=a.isFunction(h.proxied)?h.proxied(j):h.proxied,h.duration=a.isFunction(h.proxiedDuration)?h.proxiedDuration(j):h.proxiedDuration;var k=a.ui.accordion.animations,l=h.duration,m=h.animated;m&&!k[m]&&!a.easing[m]&&(m="slide"),k[m]||(k[m]=function(a){this.slide(a,{easing:m,duration:l||700})}),k[m](j)}else h.collapsible&&e?b.toggle():(c.hide(),b.show()),i(!0);c.prev().attr({"aria-expanded":"false","aria-selected":"false",tabIndex:-1}).blur(),b.prev().attr({"aria-expanded":"true","aria-selected":"true",tabIndex:0}).focus()},_completed:function(a){this.running=a?0:--this.running;if(this.running)return;this.options.clearStyle&&this.toShow.add(this.toHide).css({height:"",overflow:""}),this.toHide.removeClass("ui-accordion-content-active"),this.toHide.length&&(this.toHide.parent()[0].className=this.toHide.parent()[0].className),this._trigger("change",null,this.data)}}),a.extend(a.ui.accordion,{version:"1.8.21",animations:{slide:function(b,c){b=a.extend({easing:"swing",duration:300},b,c);if(!b.toHide.size()){b.toShow.animate({height:"show",paddingTop:"show",paddingBottom:"show"},b);return}if(!b.toShow.size()){b.toHide.animate({height:"hide",paddingTop:"hide",paddingBottom:"hide"},b);return}var d=b.toShow.css("overflow"),e=0,f={},g={},h=["height","paddingTop","paddingBottom"],i,j=b.toShow;i=j[0].style.width,j.width(j.parent().width()-parseFloat(j.css("paddingLeft"))-parseFloat(j.css("paddingRight"))-(parseFloat(j.css("borderLeftWidth"))||0)-(parseFloat(j.css("borderRightWidth"))||0)),a.each(h,function(c,d){g[d]="hide";var e=(""+a.css(b.toShow[0],d)).match(/^([\d+-.]+)(.*)$/);f[d]={value:e[1],unit:e[2]||"px"}}),b.toShow.css({height:0,overflow:"hidden"}).show(),b.toHide.filter(":hidden").each(b.complete).end().filter(":visible").animate(g,{step:function(a,c){c.prop=="height"&&(e=c.end-c.start===0?0:(c.now-c.start)/(c.end-c.start)),b.toShow[0].style[c.prop]=e*f[c.prop].value+f[c.prop].unit},duration:b.duration,easing:b.easing,complete:function(){b.autoHeight||b.toShow.css("height",""),b.toShow.css({width:i,overflow:d}),b.complete()}})},bounceslide:function(a){this.slide(a,{easing:a.down?"easeOutBounce":"swing",duration:a.down?1e3:200})}}})})(jQuery);;/*! jQuery UI - v1.8.21 - 2012-06-05 +* https://github.com/jquery/jquery-ui +* Includes: jquery.ui.slider.js +* Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */ +(function(a,b){var c=5;a.widget("ui.slider",a.ui.mouse,{widgetEventPrefix:"slide",options:{animate:!1,distance:0,max:100,min:0,orientation:"horizontal",range:!1,step:1,value:0,values:null},_create:function(){var b=this,d=this.options,e=this.element.find(".ui-slider-handle").addClass("ui-state-default ui-corner-all"),f="",g=d.values&&d.values.length||1,h=[];this._keySliding=!1,this._mouseSliding=!1,this._animateOff=!0,this._handleIndex=null,this._detectOrientation(),this._mouseInit(),this.element.addClass("ui-slider ui-slider-"+this.orientation+" ui-widget"+" ui-widget-content"+" ui-corner-all"+(d.disabled?" ui-slider-disabled ui-disabled":"")),this.range=a([]),d.range&&(d.range===!0&&(d.values||(d.values=[this._valueMin(),this._valueMin()]),d.values.length&&d.values.length!==2&&(d.values=[d.values[0],d.values[0]])),this.range=a("
").appendTo(this.element).addClass("ui-slider-range ui-widget-header"+(d.range==="min"||d.range==="max"?" ui-slider-range-"+d.range:"")));for(var i=e.length;ic&&(f=c,g=a(this),i=b)}),c.range===!0&&this.values(1)===c.min&&(i+=1,g=a(this.handles[i])),j=this._start(b,i),j===!1?!1:(this._mouseSliding=!0,h._handleIndex=i,g.addClass("ui-state-active").focus(),k=g.offset(),l=!a(b.target).parents().andSelf().is(".ui-slider-handle"),this._clickOffset=l?{left:0,top:0}:{left:b.pageX-k.left-g.width()/2,top:b.pageY-k.top-g.height()/2-(parseInt(g.css("borderTopWidth"),10)||0)-(parseInt(g.css("borderBottomWidth"),10)||0)+(parseInt(g.css("marginTop"),10)||0)},this.handles.hasClass("ui-state-hover")||this._slide(b,i,e),this._animateOff=!0,!0))},_mouseStart:function(a){return!0},_mouseDrag:function(a){var b={x:a.pageX,y:a.pageY},c=this._normValueFromMouse(b);return this._slide(a,this._handleIndex,c),!1},_mouseStop:function(a){return this.handles.removeClass("ui-state-active"),this._mouseSliding=!1,this._stop(a,this._handleIndex),this._change(a,this._handleIndex),this._handleIndex=null,this._clickOffset=null,this._animateOff=!1,!1},_detectOrientation:function(){this.orientation=this.options.orientation==="vertical"?"vertical":"horizontal"},_normValueFromMouse:function(a){var b,c,d,e,f;return this.orientation==="horizontal"?(b=this.elementSize.width,c=a.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)):(b=this.elementSize.height,c=a.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)),d=c/b,d>1&&(d=1),d<0&&(d=0),this.orientation==="vertical"&&(d=1-d),e=this._valueMax()-this._valueMin(),f=this._valueMin()+d*e,this._trimAlignValue(f)},_start:function(a,b){var c={handle:this.handles[b],value:this.value()};return this.options.values&&this.options.values.length&&(c.value=this.values(b),c.values=this.values()),this._trigger("start",a,c)},_slide:function(a,b,c){var d,e,f;this.options.values&&this.options.values.length?(d=this.values(b?0:1),this.options.values.length===2&&this.options.range===!0&&(b===0&&c>d||b===1&&c1){this.options.values[b]=this._trimAlignValue(c),this._refreshValue(),this._change(null,b);return}if(!arguments.length)return this._values();if(!a.isArray(arguments[0]))return this.options.values&&this.options.values.length?this._values(b):this.value();d=this.options.values,e=arguments[0];for(f=0;f=this._valueMax())return this._valueMax();var b=this.options.step>0?this.options.step:1,c=(a-this._valueMin())%b,d=a-c;return Math.abs(c)*2>=b&&(d+=c>0?b:-b),parseFloat(d.toFixed(5))},_valueMin:function(){return this.options.min},_valueMax:function(){return this.options.max},_refreshValue:function(){var b=this.options.range,c=this.options,d=this,e=this._animateOff?!1:c.animate,f,g={},h,i,j,k;this.options.values&&this.options.values.length?this.handles.each(function(b,i){f=(d.values(b)-d._valueMin())/(d._valueMax()-d._valueMin())*100,g[d.orientation==="horizontal"?"left":"bottom"]=f+"%",a(this).stop(1,1)[e?"animate":"css"](g,c.animate),d.options.range===!0&&(d.orientation==="horizontal"?(b===0&&d.range.stop(1,1)[e?"animate":"css"]({left:f+"%"},c.animate),b===1&&d.range[e?"animate":"css"]({width:f-h+"%"},{queue:!1,duration:c.animate})):(b===0&&d.range.stop(1,1)[e?"animate":"css"]({bottom:f+"%"},c.animate),b===1&&d.range[e?"animate":"css"]({height:f-h+"%"},{queue:!1,duration:c.animate}))),h=f}):(i=this.value(),j=this._valueMin(),k=this._valueMax(),f=k!==j?(i-j)/(k-j)*100:0,g[d.orientation==="horizontal"?"left":"bottom"]=f+"%",this.handle.stop(1,1)[e?"animate":"css"](g,c.animate),b==="min"&&this.orientation==="horizontal"&&this.range.stop(1,1)[e?"animate":"css"]({width:f+"%"},c.animate),b==="max"&&this.orientation==="horizontal"&&this.range[e?"animate":"css"]({width:100-f+"%"},{queue:!1,duration:c.animate}),b==="min"&&this.orientation==="vertical"&&this.range.stop(1,1)[e?"animate":"css"]({height:f+"%"},c.animate),b==="max"&&this.orientation==="vertical"&&this.range[e?"animate":"css"]({height:100-f+"%"},{queue:!1,duration:c.animate}))}}),a.extend(a.ui.slider,{version:"1.8.21"})})(jQuery);;/*! jQuery UI - v1.8.21 - 2012-06-05 +* https://github.com/jquery/jquery-ui +* Includes: jquery.ui.datepicker.js +* Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */ +(function($,undefined){function Datepicker(){this.debug=!1,this._curInst=null,this._keyEvent=!1,this._disabledInputs=[],this._datepickerShowing=!1,this._inDialog=!1,this._mainDivId="ui-datepicker-div",this._inlineClass="ui-datepicker-inline",this._appendClass="ui-datepicker-append",this._triggerClass="ui-datepicker-trigger",this._dialogClass="ui-datepicker-dialog",this._disableClass="ui-datepicker-disabled",this._unselectableClass="ui-datepicker-unselectable",this._currentClass="ui-datepicker-current-day",this._dayOverClass="ui-datepicker-days-cell-over",this.regional=[],this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],weekHeader:"Wk",dateFormat:"mm/dd/yy",firstDay:0,isRTL:!1,showMonthAfterYear:!1,yearSuffix:""},this._defaults={showOn:"focus",showAnim:"fadeIn",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:!1,hideIfNoPrevNext:!1,navigationAsDateFormat:!1,gotoCurrent:!1,changeMonth:!1,changeYear:!1,yearRange:"c-10:c+10",showOtherMonths:!1,selectOtherMonths:!1,showWeek:!1,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",minDate:null,maxDate:null,duration:"fast",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:!0,showButtonPanel:!1,autoSize:!1,disabled:!1},$.extend(this._defaults,this.regional[""]),this.dpDiv=bindHover($('
'))}function bindHover(a){var b="button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";return a.bind("mouseout",function(a){var c=$(a.target).closest(b);if(!c.length)return;c.removeClass("ui-state-hover ui-datepicker-prev-hover ui-datepicker-next-hover")}).bind("mouseover",function(c){var d=$(c.target).closest(b);if($.datepicker._isDisabledDatepicker(instActive.inline?a.parent()[0]:instActive.input[0])||!d.length)return;d.parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"),d.addClass("ui-state-hover"),d.hasClass("ui-datepicker-prev")&&d.addClass("ui-datepicker-prev-hover"),d.hasClass("ui-datepicker-next")&&d.addClass("ui-datepicker-next-hover")})}function extendRemove(a,b){$.extend(a,b);for(var c in b)if(b[c]==null||b[c]==undefined)a[c]=b[c];return a}function isArray(a){return a&&($.browser.safari&&typeof a=="object"&&a.length||a.constructor&&a.constructor.toString().match(/\Array\(\)/))}$.extend($.ui,{datepicker:{version:"1.8.21"}});var PROP_NAME="datepicker",dpuuid=(new Date).getTime(),instActive;$.extend(Datepicker.prototype,{markerClassName:"hasDatepicker",maxRows:4,log:function(){this.debug&&console.log.apply("",arguments)},_widgetDatepicker:function(){return this.dpDiv},setDefaults:function(a){return extendRemove(this._defaults,a||{}),this},_attachDatepicker:function(target,settings){var inlineSettings=null;for(var attrName in this._defaults){var attrValue=target.getAttribute("date:"+attrName);if(attrValue){inlineSettings=inlineSettings||{};try{inlineSettings[attrName]=eval(attrValue)}catch(err){inlineSettings[attrName]=attrValue}}}var nodeName=target.nodeName.toLowerCase(),inline=nodeName=="div"||nodeName=="span";target.id||(this.uuid+=1,target.id="dp"+this.uuid);var inst=this._newInst($(target),inline);inst.settings=$.extend({},settings||{},inlineSettings||{}),nodeName=="input"?this._connectDatepicker(target,inst):inline&&this._inlineDatepicker(target,inst)},_newInst:function(a,b){var c=a[0].id.replace(/([^A-Za-z0-9_-])/g,"\\\\$1");return{id:c,input:a,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:b,dpDiv:b?bindHover($('
')):this.dpDiv}},_connectDatepicker:function(a,b){var c=$(a);b.append=$([]),b.trigger=$([]);if(c.hasClass(this.markerClassName))return;this._attachments(c,b),c.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp).bind("setData.datepicker",function(a,c,d){b.settings[c]=d}).bind("getData.datepicker",function(a,c){return this._get(b,c)}),this._autoSize(b),$.data(a,PROP_NAME,b),b.settings.disabled&&this._disableDatepicker(a)},_attachments:function(a,b){var c=this._get(b,"appendText"),d=this._get(b,"isRTL");b.append&&b.append.remove(),c&&(b.append=$(''+c+""),a[d?"before":"after"](b.append)),a.unbind("focus",this._showDatepicker),b.trigger&&b.trigger.remove();var e=this._get(b,"showOn");(e=="focus"||e=="both")&&a.focus(this._showDatepicker);if(e=="button"||e=="both"){var f=this._get(b,"buttonText"),g=this._get(b,"buttonImage");b.trigger=$(this._get(b,"buttonImageOnly")?$("").addClass(this._triggerClass).attr({src:g,alt:f,title:f}):$('').addClass(this._triggerClass).html(g==""?f:$("").attr({src:g,alt:f,title:f}))),a[d?"before":"after"](b.trigger),b.trigger.click(function(){return $.datepicker._datepickerShowing&&$.datepicker._lastInput==a[0]?$.datepicker._hideDatepicker():$.datepicker._datepickerShowing&&$.datepicker._lastInput!=a[0]?($.datepicker._hideDatepicker(),$.datepicker._showDatepicker(a[0])):$.datepicker._showDatepicker(a[0]),!1})}},_autoSize:function(a){if(this._get(a,"autoSize")&&!a.inline){var b=new Date(2009,11,20),c=this._get(a,"dateFormat");if(c.match(/[DM]/)){var d=function(a){var b=0,c=0;for(var d=0;db&&(b=a[d].length,c=d);return c};b.setMonth(d(this._get(a,c.match(/MM/)?"monthNames":"monthNamesShort"))),b.setDate(d(this._get(a,c.match(/DD/)?"dayNames":"dayNamesShort"))+20-b.getDay())}a.input.attr("size",this._formatDate(a,b).length)}},_inlineDatepicker:function(a,b){var c=$(a);if(c.hasClass(this.markerClassName))return;c.addClass(this.markerClassName).append(b.dpDiv).bind("setData.datepicker",function(a,c,d){b.settings[c]=d}).bind("getData.datepicker",function(a,c){return this._get(b,c)}),$.data(a,PROP_NAME,b),this._setDate(b,this._getDefaultDate(b),!0),this._updateDatepicker(b),this._updateAlternate(b),b.settings.disabled&&this._disableDatepicker(a),b.dpDiv.css("display","block")},_dialogDatepicker:function(a,b,c,d,e){var f=this._dialogInst;if(!f){this.uuid+=1;var g="dp"+this.uuid;this._dialogInput=$(''),this._dialogInput.keydown(this._doKeyDown),$("body").append(this._dialogInput),f=this._dialogInst=this._newInst(this._dialogInput,!1),f.settings={},$.data(this._dialogInput[0],PROP_NAME,f)}extendRemove(f.settings,d||{}),b=b&&b.constructor==Date?this._formatDate(f,b):b,this._dialogInput.val(b),this._pos=e?e.length?e:[e.pageX,e.pageY]:null;if(!this._pos){var h=document.documentElement.clientWidth,i=document.documentElement.clientHeight,j=document.documentElement.scrollLeft||document.body.scrollLeft,k=document.documentElement.scrollTop||document.body.scrollTop;this._pos=[h/2-100+j,i/2-150+k]}return this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px"),f.settings.onSelect=c,this._inDialog=!0,this.dpDiv.addClass(this._dialogClass),this._showDatepicker(this._dialogInput[0]),$.blockUI&&$.blockUI(this.dpDiv),$.data(this._dialogInput[0],PROP_NAME,f),this},_destroyDatepicker:function(a){var b=$(a),c=$.data(a,PROP_NAME);if(!b.hasClass(this.markerClassName))return;var d=a.nodeName.toLowerCase();$.removeData(a,PROP_NAME),d=="input"?(c.append.remove(),c.trigger.remove(),b.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress).unbind("keyup",this._doKeyUp)):(d=="div"||d=="span")&&b.removeClass(this.markerClassName).empty()},_enableDatepicker:function(a){var b=$(a),c=$.data(a,PROP_NAME);if(!b.hasClass(this.markerClassName))return;var d=a.nodeName.toLowerCase();if(d=="input")a.disabled=!1,c.trigger.filter("button").each(function(){this.disabled=!1}).end().filter("img").css({opacity:"1.0",cursor:""});else if(d=="div"||d=="span"){var e=b.children("."+this._inlineClass);e.children().removeClass("ui-state-disabled"),e.find("select.ui-datepicker-month, select.ui-datepicker-year").removeAttr("disabled")}this._disabledInputs=$.map(this._disabledInputs,function(b){return b==a?null:b})},_disableDatepicker:function(a){var b=$(a),c=$.data(a,PROP_NAME);if(!b.hasClass(this.markerClassName))return;var d=a.nodeName.toLowerCase();if(d=="input")a.disabled=!0,c.trigger.filter("button").each(function(){this.disabled=!0}).end().filter("img").css({opacity:"0.5",cursor:"default"});else if(d=="div"||d=="span"){var e=b.children("."+this._inlineClass);e.children().addClass("ui-state-disabled"),e.find("select.ui-datepicker-month, select.ui-datepicker-year").attr("disabled","disabled")}this._disabledInputs=$.map(this._disabledInputs,function(b){return b==a?null:b}),this._disabledInputs[this._disabledInputs.length]=a},_isDisabledDatepicker:function(a){if(!a)return!1;for(var b=0;b-1}},_doKeyUp:function(a){var b=$.datepicker._getInst(a.target);if(b.input.val()!=b.lastVal)try{var c=$.datepicker.parseDate($.datepicker._get(b,"dateFormat"),b.input?b.input.val():null,$.datepicker._getFormatConfig(b));c&&($.datepicker._setDateFromField(b),$.datepicker._updateAlternate(b),$.datepicker._updateDatepicker(b))}catch(d){$.datepicker.log(d)}return!0},_showDatepicker:function(a){a=a.target||a,a.nodeName.toLowerCase()!="input"&&(a=$("input",a.parentNode)[0]);if($.datepicker._isDisabledDatepicker(a)||$.datepicker._lastInput==a)return;var b=$.datepicker._getInst(a);$.datepicker._curInst&&$.datepicker._curInst!=b&&($.datepicker._curInst.dpDiv.stop(!0,!0),b&&$.datepicker._datepickerShowing&&$.datepicker._hideDatepicker($.datepicker._curInst.input[0]));var c=$.datepicker._get(b,"beforeShow"),d=c?c.apply(a,[a,b]):{};if(d===!1)return;extendRemove(b.settings,d),b.lastVal=null,$.datepicker._lastInput=a,$.datepicker._setDateFromField(b),$.datepicker._inDialog&&(a.value=""),$.datepicker._pos||($.datepicker._pos=$.datepicker._findPos(a),$.datepicker._pos[1]+=a.offsetHeight);var e=!1;$(a).parents().each(function(){return e|=$(this).css("position")=="fixed",!e}),e&&$.browser.opera&&($.datepicker._pos[0]-=document.documentElement.scrollLeft,$.datepicker._pos[1]-=document.documentElement.scrollTop);var f={left:$.datepicker._pos[0],top:$.datepicker._pos[1]};$.datepicker._pos=null,b.dpDiv.empty(),b.dpDiv.css({position:"absolute",display:"block",top:"-1000px"}),$.datepicker._updateDatepicker(b),f=$.datepicker._checkOffset(b,f,e),b.dpDiv.css({position:$.datepicker._inDialog&&$.blockUI?"static":e?"fixed":"absolute",display:"none",left:f.left+"px",top:f.top+"px"});if(!b.inline){var g=$.datepicker._get(b,"showAnim"),h=$.datepicker._get(b,"duration"),i=function(){var a=b.dpDiv.find("iframe.ui-datepicker-cover");if(!!a.length){var c=$.datepicker._getBorders(b.dpDiv);a.css({left:-c[0],top:-c[1],width:b.dpDiv.outerWidth(),height:b.dpDiv.outerHeight()})}};b.dpDiv.zIndex($(a).zIndex()+1),$.datepicker._datepickerShowing=!0,$.effects&&$.effects[g]?b.dpDiv.show(g,$.datepicker._get(b,"showOptions"),h,i):b.dpDiv[g||"show"](g?h:null,i),(!g||!h)&&i(),b.input.is(":visible")&&!b.input.is(":disabled")&&b.input.focus(),$.datepicker._curInst=b}},_updateDatepicker:function(a){var b=this;b.maxRows=4;var c=$.datepicker._getBorders(a.dpDiv);instActive=a,a.dpDiv.empty().append(this._generateHTML(a));var d=a.dpDiv.find("iframe.ui-datepicker-cover");!d.length||d.css({left:-c[0],top:-c[1],width:a.dpDiv.outerWidth(),height:a.dpDiv.outerHeight()}),a.dpDiv.find("."+this._dayOverClass+" a").mouseover();var e=this._getNumberOfMonths(a),f=e[1],g=17;a.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width(""),f>1&&a.dpDiv.addClass("ui-datepicker-multi-"+f).css("width",g*f+"em"),a.dpDiv[(e[0]!=1||e[1]!=1?"add":"remove")+"Class"]("ui-datepicker-multi"),a.dpDiv[(this._get(a,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl"),a==$.datepicker._curInst&&$.datepicker._datepickerShowing&&a.input&&a.input.is(":visible")&&!a.input.is(":disabled")&&a.input[0]!=document.activeElement&&a.input.focus();if(a.yearshtml){var h=a.yearshtml;setTimeout(function(){h===a.yearshtml&&a.yearshtml&&a.dpDiv.find("select.ui-datepicker-year:first").replaceWith(a.yearshtml),h=a.yearshtml=null},0)}},_getBorders:function(a){var b=function(a){return{thin:1,medium:2,thick:3}[a]||a};return[parseFloat(b(a.css("border-left-width"))),parseFloat(b(a.css("border-top-width")))]},_checkOffset:function(a,b,c){var d=a.dpDiv.outerWidth(),e=a.dpDiv.outerHeight(),f=a.input?a.input.outerWidth():0,g=a.input?a.input.outerHeight():0,h=document.documentElement.clientWidth+$(document).scrollLeft(),i=document.documentElement.clientHeight+$(document).scrollTop();return b.left-=this._get(a,"isRTL")?d-f:0,b.left-=c&&b.left==a.input.offset().left?$(document).scrollLeft():0,b.top-=c&&b.top==a.input.offset().top+g?$(document).scrollTop():0,b.left-=Math.min(b.left,b.left+d>h&&h>d?Math.abs(b.left+d-h):0),b.top-=Math.min(b.top,b.top+e>i&&i>e?Math.abs(e+g):0),b},_findPos:function(a){var b=this._getInst(a),c=this._get(b,"isRTL");while(a&&(a.type=="hidden"||a.nodeType!=1||$.expr.filters.hidden(a)))a=a[c?"previousSibling":"nextSibling"];var d=$(a).offset();return[d.left,d.top]},_hideDatepicker:function(a){var b=this._curInst;if(!b||a&&b!=$.data(a,PROP_NAME))return;if(this._datepickerShowing){var c=this._get(b,"showAnim"),d=this._get(b,"duration"),e=function(){$.datepicker._tidyDialog(b)};$.effects&&$.effects[c]?b.dpDiv.hide(c,$.datepicker._get(b,"showOptions"),d,e):b.dpDiv[c=="slideDown"?"slideUp":c=="fadeIn"?"fadeOut":"hide"](c?d:null,e),c||e(),this._datepickerShowing=!1;var f=this._get(b,"onClose");f&&f.apply(b.input?b.input[0]:null,[b.input?b.input.val():"",b]),this._lastInput=null,this._inDialog&&(this._dialogInput.css({position:"absolute",left:"0",top:"-100px"}),$.blockUI&&($.unblockUI(),$("body").append(this.dpDiv))),this._inDialog=!1}},_tidyDialog:function(a){a.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")},_checkExternalClick:function(a){if(!$.datepicker._curInst)return;var b=$(a.target),c=$.datepicker._getInst(b[0]);(b[0].id!=$.datepicker._mainDivId&&b.parents("#"+$.datepicker._mainDivId).length==0&&!b.hasClass($.datepicker.markerClassName)&&!b.closest("."+$.datepicker._triggerClass).length&&$.datepicker._datepickerShowing&&(!$.datepicker._inDialog||!$.blockUI)||b.hasClass($.datepicker.markerClassName)&&$.datepicker._curInst!=c)&&$.datepicker._hideDatepicker()},_adjustDate:function(a,b,c){var d=$(a),e=this._getInst(d[0]);if(this._isDisabledDatepicker(d[0]))return;this._adjustInstDate(e,b+(c=="M"?this._get(e,"showCurrentAtPos"):0),c),this._updateDatepicker(e)},_gotoToday:function(a){var b=$(a),c=this._getInst(b[0]);if(this._get(c,"gotoCurrent")&&c.currentDay)c.selectedDay=c.currentDay,c.drawMonth=c.selectedMonth=c.currentMonth,c.drawYear=c.selectedYear=c.currentYear;else{var d=new Date;c.selectedDay=d.getDate(),c.drawMonth=c.selectedMonth=d.getMonth(),c.drawYear=c.selectedYear=d.getFullYear()}this._notifyChange(c),this._adjustDate(b)},_selectMonthYear:function(a,b,c){var d=$(a),e=this._getInst(d[0]);e["selected"+(c=="M"?"Month":"Year")]=e["draw"+(c=="M"?"Month":"Year")]=parseInt(b.options[b.selectedIndex].value,10),this._notifyChange(e),this._adjustDate(d)},_selectDay:function(a,b,c,d){var e=$(a);if($(d).hasClass(this._unselectableClass)||this._isDisabledDatepicker(e[0]))return;var f=this._getInst(e[0]);f.selectedDay=f.currentDay=$("a",d).html(),f.selectedMonth=f.currentMonth=b,f.selectedYear=f.currentYear=c,this._selectDate(a,this._formatDate(f,f.currentDay,f.currentMonth,f.currentYear))},_clearDate:function(a){var b=$(a),c=this._getInst(b[0]);this._selectDate(b,"")},_selectDate:function(a,b){var c=$(a),d=this._getInst(c[0]);b=b!=null?b:this._formatDate(d),d.input&&d.input.val(b),this._updateAlternate(d);var e=this._get(d,"onSelect");e?e.apply(d.input?d.input[0]:null,[b,d]):d.input&&d.input.trigger("change"),d.inline?this._updateDatepicker(d):(this._hideDatepicker(),this._lastInput=d.input[0],typeof d.input[0]!="object"&&d.input.focus(),this._lastInput=null)},_updateAlternate:function(a){var b=this._get(a,"altField");if(b){var c=this._get(a,"altFormat")||this._get(a,"dateFormat"),d=this._getDate(a),e=this.formatDate(c,d,this._getFormatConfig(a));$(b).each(function(){$(this).val(e)})}},noWeekends:function(a){var b=a.getDay();return[b>0&&b<6,""]},iso8601Week:function(a){var b=new Date(a.getTime());b.setDate(b.getDate()+4-(b.getDay()||7));var c=b.getTime();return b.setMonth(0),b.setDate(1),Math.floor(Math.round((c-b)/864e5)/7)+1},parseDate:function(a,b,c){if(a==null||b==null)throw"Invalid arguments";b=typeof b=="object"?b.toString():b+"";if(b=="")return null;var d=(c?c.shortYearCutoff:null)||this._defaults.shortYearCutoff;d=typeof d!="string"?d:(new Date).getFullYear()%100+parseInt(d,10);var e=(c?c.dayNamesShort:null)||this._defaults.dayNamesShort,f=(c?c.dayNames:null)||this._defaults.dayNames,g=(c?c.monthNamesShort:null)||this._defaults.monthNamesShort,h=(c?c.monthNames:null)||this._defaults.monthNames,i=-1,j=-1,k=-1,l=-1,m=!1,n=function(b){var c=s+1-1){j=1,k=l;do{var u=this._getDaysInMonth(i,j-1);if(k<=u)break;j++,k-=u}while(!0)}var t=this._daylightSavingAdjust(new Date(i,j-1,k));if(t.getFullYear()!=i||t.getMonth()+1!=j||t.getDate()!=k)throw"Invalid date";return t},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:(718685+Math.floor(492.5)-Math.floor(19.7)+Math.floor(4.925))*24*60*60*1e7,formatDate:function(a,b,c){if(!b)return"";var d=(c?c.dayNamesShort:null)||this._defaults.dayNamesShort,e=(c?c.dayNames:null)||this._defaults.dayNames,f=(c?c.monthNamesShort:null)||this._defaults.monthNamesShort,g=(c?c.monthNames:null)||this._defaults.monthNames,h=function(b){var c=m+112?a.getHours()+2:0),a):null},_setDate:function(a,b,c){var d=!b,e=a.selectedMonth,f=a.selectedYear,g=this._restrictMinMax(a,this._determineDate(a,b,new Date));a.selectedDay=a.currentDay=g.getDate(),a.drawMonth=a.selectedMonth=a.currentMonth=g.getMonth(),a.drawYear=a.selectedYear=a.currentYear=g.getFullYear(),(e!=a.selectedMonth||f!=a.selectedYear)&&!c&&this._notifyChange(a),this._adjustInstDate(a),a.input&&a.input.val(d?"":this._formatDate(a))},_getDate:function(a){var b=!a.currentYear||a.input&&a.input.val()==""?null:this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay));return b},_generateHTML:function(a){var b=new Date;b=this._daylightSavingAdjust(new Date(b.getFullYear(),b.getMonth(),b.getDate()));var c=this._get(a,"isRTL"),d=this._get(a,"showButtonPanel"),e=this._get(a,"hideIfNoPrevNext"),f=this._get(a,"navigationAsDateFormat"),g=this._getNumberOfMonths(a),h=this._get(a,"showCurrentAtPos"),i=this._get(a,"stepMonths"),j=g[0]!=1||g[1]!=1,k=this._daylightSavingAdjust(a.currentDay?new Date(a.currentYear,a.currentMonth,a.currentDay):new Date(9999,9,9)),l=this._getMinMaxDate(a,"min"),m=this._getMinMaxDate(a,"max"),n=a.drawMonth-h,o=a.drawYear;n<0&&(n+=12,o--);if(m){var p=this._daylightSavingAdjust(new Date(m.getFullYear(),m.getMonth()-g[0]*g[1]+1,m.getDate()));p=l&&pp)n--,n<0&&(n=11,o--)}a.drawMonth=n,a.drawYear=o;var q=this._get(a,"prevText");q=f?this.formatDate(q,this._daylightSavingAdjust(new Date(o,n-i,1)),this._getFormatConfig(a)):q;var r=this._canAdjustMonth(a,-1,o,n)?''+q+"":e?"":''+q+"",s=this._get(a,"nextText");s=f?this.formatDate(s,this._daylightSavingAdjust(new Date(o,n+i,1)),this._getFormatConfig(a)):s;var t=this._canAdjustMonth(a,1,o,n)?''+s+"":e?"":''+s+"",u=this._get(a,"currentText"),v=this._get(a,"gotoCurrent")&&a.currentDay?k:b;u=f?this.formatDate(u,v,this._getFormatConfig(a)):u;var w=a.inline?"":'",x=d?'
'+(c?w:"")+(this._isInRange(a,v)?'":"")+(c?"":w)+"
":"",y=parseInt(this._get(a,"firstDay"),10);y=isNaN(y)?0:y;var z=this._get(a,"showWeek"),A=this._get(a,"dayNames"),B=this._get(a,"dayNamesShort"),C=this._get(a,"dayNamesMin"),D=this._get(a,"monthNames"),E=this._get(a,"monthNamesShort"),F=this._get(a,"beforeShowDay"),G=this._get(a,"showOtherMonths"),H=this._get(a,"selectOtherMonths"),I=this._get(a,"calculateWeek")||this.iso8601Week,J=this._getDefaultDate(a),K="";for(var L=0;L1)switch(N){case 0:Q+=" ui-datepicker-group-first",P=" ui-corner-"+(c?"right":"left");break;case g[1]-1:Q+=" ui-datepicker-group-last",P=" ui-corner-"+(c?"left":"right");break;default:Q+=" ui-datepicker-group-middle",P=""}Q+='">'}Q+='
'+(/all|left/.test(P)&&L==0?c?t:r:"")+(/all|right/.test(P)&&L==0?c?r:t:"")+this._generateMonthYearHeader(a,n,o,l,m,L>0||N>0,D,E)+'
'+"";var R=z?'":"";for(var S=0;S<7;S++){var T=(S+y)%7;R+="=5?' class="ui-datepicker-week-end"':"")+">"+''+C[T]+""}Q+=R+"";var U=this._getDaysInMonth(o,n);o==a.selectedYear&&n==a.selectedMonth&&(a.selectedDay=Math.min(a.selectedDay,U));var V=(this._getFirstDayOfMonth(o,n)-y+7)%7,W=Math.ceil((V+U)/7),X=j?this.maxRows>W?this.maxRows:W:W;this.maxRows=X;var Y=this._daylightSavingAdjust(new Date(o,n,1-V));for(var Z=0;Z";var _=z?'":"";for(var S=0;S<7;S++){var ba=F?F.apply(a.input?a.input[0]:null,[Y]):[!0,""],bb=Y.getMonth()!=n,bc=bb&&!H||!ba[0]||l&&Ym;_+='",Y.setDate(Y.getDate()+1),Y=this._daylightSavingAdjust(Y)}Q+=_+""}n++,n>11&&(n=0,o++),Q+="
'+this._get(a,"weekHeader")+"
'+this._get(a,"calculateWeek")(Y)+""+(bb&&!G?" ":bc?''+Y.getDate()+"":''+Y.getDate()+"")+"
"+(j?""+(g[0]>0&&N==g[1]-1?'
':""):""),M+=Q}K+=M}return K+=x+($.browser.msie&&parseInt($.browser.version,10)<7&&!a.inline?'':""),a._keyEvent=!1,K},_generateMonthYearHeader:function(a,b,c,d,e,f,g,h){var i=this._get(a,"changeMonth"),j=this._get(a,"changeYear"),k=this._get(a,"showMonthAfterYear"),l='
',m="";if(f||!i)m+=''+g[b]+"";else{var n=d&&d.getFullYear()==c,o=e&&e.getFullYear()==c;m+='"}k||(l+=m+(f||!i||!j?" ":""));if(!a.yearshtml){a.yearshtml="";if(f||!j)l+=''+c+"";else{var q=this._get(a,"yearRange").split(":"),r=(new Date).getFullYear(),s=function(a){var b=a.match(/c[+-].*/)?c+parseInt(a.substring(1),10):a.match(/[+-].*/)?r+parseInt(a,10):parseInt(a,10);return isNaN(b)?r:b},t=s(q[0]),u=Math.max(t,s(q[1]||""));t=d?Math.max(t,d.getFullYear()):t,u=e?Math.min(u,e.getFullYear()):u,a.yearshtml+='",l+=a.yearshtml,a.yearshtml=null}}return l+=this._get(a,"yearSuffix"),k&&(l+=(f||!i||!j?" ":"")+m),l+="
",l},_adjustInstDate:function(a,b,c){var d=a.drawYear+(c=="Y"?b:0),e=a.drawMonth+(c=="M"?b:0),f=Math.min(a.selectedDay,this._getDaysInMonth(d,e))+(c=="D"?b:0),g=this._restrictMinMax(a,this._daylightSavingAdjust(new Date(d,e,f)));a.selectedDay=g.getDate(),a.drawMonth=a.selectedMonth=g.getMonth(),a.drawYear=a.selectedYear=g.getFullYear(),(c=="M"||c=="Y")&&this._notifyChange(a)},_restrictMinMax:function(a,b){var c=this._getMinMaxDate(a,"min"),d=this._getMinMaxDate(a,"max"),e=c&&bd?d:e,e},_notifyChange:function(a){var b=this._get(a,"onChangeMonthYear");b&&b.apply(a.input?a.input[0]:null,[a.selectedYear,a.selectedMonth+1,a])},_getNumberOfMonths:function(a){var b=this._get(a,"numberOfMonths");return b==null?[1,1]:typeof b=="number"?[1,b]:b},_getMinMaxDate:function(a,b){return this._determineDate(a,this._get(a,b+"Date"),null)},_getDaysInMonth:function(a,b){return 32-this._daylightSavingAdjust(new Date(a,b,32)).getDate()},_getFirstDayOfMonth:function(a,b){return(new Date(a,b,1)).getDay()},_canAdjustMonth:function(a,b,c,d){var e=this._getNumberOfMonths(a),f=this._daylightSavingAdjust(new Date(c,d+(b<0?b:e[0]*e[1]),1));return b<0&&f.setDate(this._getDaysInMonth(f.getFullYear(),f.getMonth())),this._isInRange(a,f)},_isInRange:function(a,b){var c=this._getMinMaxDate(a,"min"),d=this._getMinMaxDate(a,"max");return(!c||b.getTime()>=c.getTime())&&(!d||b.getTime()<=d.getTime())},_getFormatConfig:function(a){var b=this._get(a,"shortYearCutoff");return b=typeof b!="string"?b:(new Date).getFullYear()%100+parseInt(b,10),{shortYearCutoff:b,dayNamesShort:this._get(a,"dayNamesShort"),dayNames:this._get(a,"dayNames"),monthNamesShort:this._get(a,"monthNamesShort"),monthNames:this._get(a,"monthNames")}},_formatDate:function(a,b,c,d){b||(a.currentDay=a.selectedDay,a.currentMonth=a.selectedMonth,a.currentYear=a.selectedYear);var e=b?typeof b=="object"?b:this._daylightSavingAdjust(new Date(d,c,b)):this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay));return this.formatDate(this._get(a,"dateFormat"),e,this._getFormatConfig(a))}}),$.fn.datepicker=function(a){if(!this.length)return this;$.datepicker.initialized||($(document).mousedown($.datepicker._checkExternalClick).find("body").append($.datepicker.dpDiv),$.datepicker.initialized=!0);var b=Array.prototype.slice.call(arguments,1);return typeof a!="string"||a!="isDisabled"&&a!="getDate"&&a!="widget"?a=="option"&&arguments.length==2&&typeof arguments[1]=="string"?$.datepicker["_"+a+"Datepicker"].apply($.datepicker,[this[0]].concat(b)):this.each(function(){typeof a=="string"?$.datepicker["_"+a+"Datepicker"].apply($.datepicker,[this].concat(b)):$.datepicker._attachDatepicker(this,a)}):$.datepicker["_"+a+"Datepicker"].apply($.datepicker,[this[0]].concat(b))},$.datepicker=new Datepicker,$.datepicker.initialized=!1,$.datepicker.uuid=(new Date).getTime(),$.datepicker.version="1.8.21",window["DP_jQuery_"+dpuuid]=$})(jQuery);;/*! jQuery UI - v1.8.21 - 2012-06-05 +* https://github.com/jquery/jquery-ui +* Includes: jquery.ui.progressbar.js +* Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */ +(function(a,b){a.widget("ui.progressbar",{options:{value:0,max:100},min:0,_create:function(){this.element.addClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").attr({role:"progressbar","aria-valuemin":this.min,"aria-valuemax":this.options.max,"aria-valuenow":this._value()}),this.valueDiv=a("
").appendTo(this.element),this.oldValue=this._value(),this._refreshValue()},destroy:function(){this.element.removeClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow"),this.valueDiv.remove(),a.Widget.prototype.destroy.apply(this,arguments)},value:function(a){return a===b?this._value():(this._setOption("value",a),this)},_setOption:function(b,c){b==="value"&&(this.options.value=c,this._refreshValue(),this._value()===this.options.max&&this._trigger("complete")),a.Widget.prototype._setOption.apply(this,arguments)},_value:function(){var a=this.options.value;return typeof a!="number"&&(a=0),Math.min(this.options.max,Math.max(this.min,a))},_percentage:function(){return 100*this._value()/this.options.max},_refreshValue:function(){var a=this.value(),b=this._percentage();this.oldValue!==a&&(this.oldValue=a,this._trigger("change")),this.valueDiv.toggle(a>this.min).toggleClass("ui-corner-right",a===this.options.max).width(b.toFixed(0)+"%"),this.element.attr("aria-valuenow",a)}}),a.extend(a.ui.progressbar,{version:"1.8.21"})})(jQuery);;/*! jQuery UI - v1.8.21 - 2012-06-05 +* https://github.com/jquery/jquery-ui +* Includes: jquery.effects.core.js +* Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */ +jQuery.effects||function(a,b){function c(b){var c;return b&&b.constructor==Array&&b.length==3?b:(c=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(b))?[parseInt(c[1],10),parseInt(c[2],10),parseInt(c[3],10)]:(c=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(b))?[parseFloat(c[1])*2.55,parseFloat(c[2])*2.55,parseFloat(c[3])*2.55]:(c=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(b))?[parseInt(c[1],16),parseInt(c[2],16),parseInt(c[3],16)]:(c=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(b))?[parseInt(c[1]+c[1],16),parseInt(c[2]+c[2],16),parseInt(c[3]+c[3],16)]:(c=/rgba\(0, 0, 0, 0\)/.exec(b))?e.transparent:e[a.trim(b).toLowerCase()]}function d(b,d){var e;do{e=a.curCSS(b,d);if(e!=""&&e!="transparent"||a.nodeName(b,"body"))break;d="backgroundColor"}while(b=b.parentNode);return c(e)}function h(){var a=document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle,b={},c,d;if(a&&a.length&&a[0]&&a[a[0]]){var e=a.length;while(e--)c=a[e],typeof a[c]=="string"&&(d=c.replace(/\-(\w)/g,function(a,b){return b.toUpperCase()}),b[d]=a[c])}else for(c in a)typeof a[c]=="string"&&(b[c]=a[c]);return b}function i(b){var c,d;for(c in b)d=b[c],(d==null||a.isFunction(d)||c in g||/scrollbar/.test(c)||!/color/i.test(c)&&isNaN(parseFloat(d)))&&delete b[c];return b}function j(a,b){var c={_:0},d;for(d in b)a[d]!=b[d]&&(c[d]=b[d]);return c}function k(b,c,d,e){typeof b=="object"&&(e=c,d=null,c=b,b=c.effect),a.isFunction(c)&&(e=c,d=null,c={});if(typeof c=="number"||a.fx.speeds[c])e=d,d=c,c={};return a.isFunction(d)&&(e=d,d=null),c=c||{},d=d||c.duration,d=a.fx.off?0:typeof d=="number"?d:d in a.fx.speeds?a.fx.speeds[d]:a.fx.speeds._default,e=e||c.complete,[b,c,d,e]}function l(b){return!b||typeof b=="number"||a.fx.speeds[b]?!0:typeof b=="string"&&!a.effects[b]?!0:!1}a.effects={},a.each(["backgroundColor","borderBottomColor","borderLeftColor","borderRightColor","borderTopColor","borderColor","color","outlineColor"],function(b,e){a.fx.step[e]=function(a){a.colorInit||(a.start=d(a.elem,e),a.end=c(a.end),a.colorInit=!0),a.elem.style[e]="rgb("+Math.max(Math.min(parseInt(a.pos*(a.end[0]-a.start[0])+a.start[0],10),255),0)+","+Math.max(Math.min(parseInt(a.pos*(a.end[1]-a.start[1])+a.start[1],10),255),0)+","+Math.max(Math.min(parseInt(a.pos*(a.end[2]-a.start[2])+a.start[2],10),255),0)+")"}});var e={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0],transparent:[255,255,255]},f=["add","remove","toggle"],g={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};a.effects.animateClass=function(b,c,d,e){return a.isFunction(d)&&(e=d,d=null),this.queue(function(){var g=a(this),k=g.attr("style")||" ",l=i(h.call(this)),m,n=g.attr("class")||"";a.each(f,function(a,c){b[c]&&g[c+"Class"](b[c])}),m=i(h.call(this)),g.attr("class",n),g.animate(j(l,m),{queue:!1,duration:c,easing:d,complete:function(){a.each(f,function(a,c){b[c]&&g[c+"Class"](b[c])}),typeof g.attr("style")=="object"?(g.attr("style").cssText="",g.attr("style").cssText=k):g.attr("style",k),e&&e.apply(this,arguments),a.dequeue(this)}})})},a.fn.extend({_addClass:a.fn.addClass,addClass:function(b,c,d,e){return c?a.effects.animateClass.apply(this,[{add:b},c,d,e]):this._addClass(b)},_removeClass:a.fn.removeClass,removeClass:function(b,c,d,e){return c?a.effects.animateClass.apply(this,[{remove:b},c,d,e]):this._removeClass(b)},_toggleClass:a.fn.toggleClass,toggleClass:function(c,d,e,f,g){return typeof d=="boolean"||d===b?e?a.effects.animateClass.apply(this,[d?{add:c}:{remove:c},e,f,g]):this._toggleClass(c,d):a.effects.animateClass.apply(this,[{toggle:c},d,e,f])},switchClass:function(b,c,d,e,f){return a.effects.animateClass.apply(this,[{add:c,remove:b},d,e,f])}}),a.extend(a.effects,{version:"1.8.21",save:function(a,b){for(var c=0;c").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),e=document.activeElement;try{e.id}catch(f){e=document.body}return b.wrap(d),(b[0]===e||a.contains(b[0],e))&&a(e).focus(),d=b.parent(),b.css("position")=="static"?(d.css({position:"relative"}),b.css({position:"relative"})):(a.extend(c,{position:b.css("position"),zIndex:b.css("z-index")}),a.each(["top","left","bottom","right"],function(a,d){c[d]=b.css(d),isNaN(parseInt(c[d],10))&&(c[d]="auto")}),b.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})),d.css(c).show()},removeWrapper:function(b){var c,d=document.activeElement;return b.parent().is(".ui-effects-wrapper")?(c=b.parent().replaceWith(b),(b[0]===d||a.contains(b[0],d))&&a(d).focus(),c):b},setTransition:function(b,c,d,e){return e=e||{},a.each(c,function(a,c){var f=b.cssUnit(c);f[0]>0&&(e[c]=f[0]*d+f[1])}),e}}),a.fn.extend({effect:function(b,c,d,e){var f=k.apply(this,arguments),g={options:f[1],duration:f[2],callback:f[3]},h=g.options.mode,i=a.effects[b];return a.fx.off||!i?h?this[h](g.duration,g.callback):this.each(function(){g.callback&&g.callback.call(this)}):i.call(this,g)},_show:a.fn.show,show:function(a){if(l(a))return this._show.apply(this,arguments);var b=k.apply(this,arguments);return b[1].mode="show",this.effect.apply(this,b)},_hide:a.fn.hide,hide:function(a){if(l(a))return this._hide.apply(this,arguments);var b=k.apply(this,arguments);return b[1].mode="hide",this.effect.apply(this,b)},__toggle:a.fn.toggle,toggle:function(b){if(l(b)||typeof b=="boolean"||a.isFunction(b))return this.__toggle.apply(this,arguments);var c=k.apply(this,arguments);return c[1].mode="toggle",this.effect.apply(this,c)},cssUnit:function(b){var c=this.css(b),d=[];return a.each(["em","px","%","pt"],function(a,b){c.indexOf(b)>0&&(d=[parseFloat(c),b])}),d}}),a.easing.jswing=a.easing.swing,a.extend(a.easing,{def:"easeOutQuad",swing:function(b,c,d,e,f){return a.easing[a.easing.def](b,c,d,e,f)},easeInQuad:function(a,b,c,d,e){return d*(b/=e)*b+c},easeOutQuad:function(a,b,c,d,e){return-d*(b/=e)*(b-2)+c},easeInOutQuad:function(a,b,c,d,e){return(b/=e/2)<1?d/2*b*b+c:-d/2*(--b*(b-2)-1)+c},easeInCubic:function(a,b,c,d,e){return d*(b/=e)*b*b+c},easeOutCubic:function(a,b,c,d,e){return d*((b=b/e-1)*b*b+1)+c},easeInOutCubic:function(a,b,c,d,e){return(b/=e/2)<1?d/2*b*b*b+c:d/2*((b-=2)*b*b+2)+c},easeInQuart:function(a,b,c,d,e){return d*(b/=e)*b*b*b+c},easeOutQuart:function(a,b,c,d,e){return-d*((b=b/e-1)*b*b*b-1)+c},easeInOutQuart:function(a,b,c,d,e){return(b/=e/2)<1?d/2*b*b*b*b+c:-d/2*((b-=2)*b*b*b-2)+c},easeInQuint:function(a,b,c,d,e){return d*(b/=e)*b*b*b*b+c},easeOutQuint:function(a,b,c,d,e){return d*((b=b/e-1)*b*b*b*b+1)+c},easeInOutQuint:function(a,b,c,d,e){return(b/=e/2)<1?d/2*b*b*b*b*b+c:d/2*((b-=2)*b*b*b*b+2)+c},easeInSine:function(a,b,c,d,e){return-d*Math.cos(b/e*(Math.PI/2))+d+c},easeOutSine:function(a,b,c,d,e){return d*Math.sin(b/e*(Math.PI/2))+c},easeInOutSine:function(a,b,c,d,e){return-d/2*(Math.cos(Math.PI*b/e)-1)+c},easeInExpo:function(a,b,c,d,e){return b==0?c:d*Math.pow(2,10*(b/e-1))+c},easeOutExpo:function(a,b,c,d,e){return b==e?c+d:d*(-Math.pow(2,-10*b/e)+1)+c},easeInOutExpo:function(a,b,c,d,e){return b==0?c:b==e?c+d:(b/=e/2)<1?d/2*Math.pow(2,10*(b-1))+c:d/2*(-Math.pow(2,-10*--b)+2)+c},easeInCirc:function(a,b,c,d,e){return-d*(Math.sqrt(1-(b/=e)*b)-1)+c},easeOutCirc:function(a,b,c,d,e){return d*Math.sqrt(1-(b=b/e-1)*b)+c},easeInOutCirc:function(a,b,c,d,e){return(b/=e/2)<1?-d/2*(Math.sqrt(1-b*b)-1)+c:d/2*(Math.sqrt(1-(b-=2)*b)+1)+c},easeInElastic:function(a,b,c,d,e){var f=1.70158,g=0,h=d;if(b==0)return c;if((b/=e)==1)return c+d;g||(g=e*.3);if(h + * @license For license information, see License.txt + */ +class Requirements_Test extends PHPUnit_Framework_TestCase { + + public function setUp() + { + + } + + public function tearDown() + { + + } + + function testExternalUrls() { + $backend = Requirements::backend(); + $backend->set_combined_files_enabled(true); + + $backend->js('http://www.mydomain.com/test.js'); + $backend->js('https://www.mysecuredomain.com/test2.js'); + $backend->css('http://www.mydomain.com/test.css'); + $backend->css('https://www.mysecuredomain.com/test2.css'); + + $html = $backend->render(); + + $this->assertContains( + 'http://www.mydomain.com/test.js', + $html, + 'Load external javascript URL' + ); + $this->assertContains( + 'https://www.mysecuredomain.com/test2.js', + $html, + 'Load external secure javascript URL' + ); + $this->assertContains( + 'http://www.mydomain.com/test.css', + $html, + 'Load external CSS URL' + ); + $this->assertContains( + 'https://www.mysecuredomain.com/test2.css', + $html, + 'Load external secure CSS URL' + ); + + // This should replace test.css above + // @todo move to seperate test + $backend->css('https://www.anything.com/test.css'); + $html = $backend->render(); + $this->assertContains( + 'https://www.anything.com/test.css', + $html, + 'Load external CSS URL' + ); + $this->assertNotContains( + 'https://www.mydomain.com/test.css', + $html, + 'Load external CSS URL' + ); + } + + protected function setupCombinedRequirements($backend) { + $backend->clear(); + //$backend->setCombinedFilesFolder('assets'); + + // clearing all previously generated requirements (just in case) + $backend->clear_combined_files(); + $backend->delete_combined_files('RequirementsTest_bc.js'); + + // require files normally (e.g. called from a FormField instance) + $backend->js('tests/phpunit/data/RequirementsTest_a.js'); + $backend->js('tests/phpunit/data/RequirementsTest_b.js'); + $backend->js('tests/phpunit/data/RequirementsTest_c.js'); + + // require two of those files as combined includes + $backend->combine_files( + 'RequirementsTest_bc.js', + array( + 'tests/phpunit/data/RequirementsTest_b.js', + 'tests/phpunit/data/RequirementsTest_c.js' + ) + ); + } + + protected function setupCombinedNonrequiredRequirements($backend) { + $backend->clear(); + //$backend->setCombinedFilesFolder('assets'); + + // clearing all previously generated requirements (just in case) + $backend->clear_combined_files(); + $backend->delete_combined_files('RequirementsTest_bc.js'); + + // require files as combined includes + $backend->combine_files( + 'RequirementsTest_bc.js', + array( + 'data/forms/RequirementsTest_b.js', + 'data/forms/RequirementsTest_c.js' + ) + ); + } + + function testCombinedJavascript() { + $backend = new Requirements_Backend; + $backend->set_combined_files_enabled(TRUE); + //$backend->setCombinedFilesFolder('/media/uploads'); + + $this->setupCombinedRequirements($backend); + + $combinedFilePath = DOCROOT . 'media/uploads/' . 'RequirementsTest_bc.js'; + + $html = $backend->render(); + + /* COMBINED JAVASCRIPT FILE IS INCLUDED IN HTML HEADER */ + $this->assertContains('media/uploads/RequirementsTest_bc.js', $html, 'combined javascript file is included in html header'); + + /* COMBINED JAVASCRIPT FILE EXISTS */ + $this->assertFileExists($combinedFilePath, 'combined javascript file exists'); + + /* COMBINED JAVASCRIPT HAS CORRECT CONTENT */ + $combinedFileContents = @file_get_contents($combinedFilePath); + $this->assertContains("alert('b')", $combinedFileContents, 'combined javascript has correct content'); + $this->assertContains("alert('c')", $combinedFileContents, 'combined javascript has correct content'); + + /* COMBINED FILES ARE NOT INCLUDED TWICE */ + $this->assertNotContains('RequirementsTest_b.js', $html, 'combined files are not included twice'); + $this->assertNotContains('RequirementsTest_c.js', $html, 'combined files are not included twice'); + + /* NORMAL REQUIREMENTS ARE STILL INCLUDED */ + $this->assertContains('RequirementsTest_a.js', $html, 'normal requirements are still included'); + + $backend->delete_combined_files('RequirementsTest_bc.js'); + + // Then do it again, this time not requiring the files beforehand + $backend = new Requirements_Backend; + $backend->set_combined_files_enabled(true); + $backend->setCombinedFilesFolder('assets'); + + $this->setupCombinedNonrequiredRequirements($backend); + + $combinedFilePath = DOCROOT . 'media/uploads/' . 'RequirementsTest_bc.js'; + + $html = $backend->render(); + + /* COMBINED JAVASCRIPT FILE IS NOT INCLUDED IN HTML HEADER */ + $this->assertNotContains('media/uploads/RequirementsTest_bc.js', $html, 'combined javascript file is included in html header'); + + /* COMBINED JAVASCRIPT FILE EXISTS */ + clearstatcache(); // needed to get accurate file_exists() results + $this->assertFileNotExists($combinedFilePath, 'combined javascript file exists'); + + /* COMBINED FILES ARE NOT INCLUDED TWICE */ + $this->assertNotContains('RequirementsTest_b.js', $html, 'combined files are not included twice'); + $this->assertNotContains('RequirementsTest_c.js', $html, 'combined files are not included twice'); + + $backend->delete_combined_files('RequirementsTest_bc.js'); + } + + function testBlockedCombinedJavascript() { + $backend = new Requirements_Backend; + $backend->set_combined_files_enabled(true); + $backend->setCombinedFilesFolder('assets'); + $combinedFilePath = DOCROOT . '/media/uploads/' . 'RequirementsTest_bc.js'; + + /* BLOCKED COMBINED FILES ARE NOT INCLUDED */ + $this->setupCombinedRequirements($backend); + $backend->block('RequirementsTest_bc.js'); + $backend->delete_combined_files('RequirementsTest_bc.js'); + + clearstatcache(); // needed to get accurate file_exists() results + $html = $backend->render(); + + $this->assertNotContains('RequirementsTest_bc.js', $html, 'blocked combined files are not included '); + $backend->unblock('RequirementsTest_bc.js'); + + /* BLOCKED UNCOMBINED FILES ARE NOT INCLUDED */ + $this->setupCombinedRequirements($backend); + $backend->block('tests/phpunit/data/RequirementsTest_b.js'); + $backend->delete_combined_files('RequirementsTest_bc.js'); + clearstatcache(); // needed to get accurate file_exists() results + $html = $backend->render(); + $combinedFileContents = @file_get_contents($combinedFilePath); + $this->assertNotContains("alert('b')", (string)$combinedFileContents, 'blocked uncombined files are not included'); + $backend->unblock('RequirementsTest_b.js'); + + /* A SINGLE FILE CAN'T BE INCLUDED IN TWO COMBINED FILES */ + $this->setupCombinedRequirements($backend); + clearstatcache(); // needed to get accurate file_exists() results + + // This throws a notice-level error, so we prefix with @ + @$backend->combine_files( + 'RequirementsTest_ac.js', + array( + 'tests/phpunit/data/RequirementsTest_a.js', + 'tests/phpunit/data/RequirementsTest_c.js' + ) + ); + + $combinedFiles = $backend->get_combine_files(); + + $this->assertEquals( + array_keys($combinedFiles['js']), + array('RequirementsTest_bc.js'), + "A single file can't be included in two combined files" + ); + + $backend->delete_combined_files('RequirementsTest_bc.js'); + } + + function testArgsInUrls() { + $backend = new Requirements_Backend; + $backend->set_combined_files_enabled(TRUE); + $backend->set_suffix_requirements(TRUE); + + $backend->js('tests/phpunit/data/RequirementsTest_a.js?test=1&test=2&test=3'); + $backend->css('tests/phpunit/data/RequirementsTest_a.css?test=1&test=2&test=3'); + $backend->delete_combined_files('RequirementsTest_bc.js'); + + $html = $backend->render(); + + /* Javascript has correct path */ + $this->assertRegexp('#src=".*\/RequirementsTest_a\.js\?m=\d\d+&test=1&test=2&test=3#', $html, 'javascript has correct path and mtime suffix'); + + /* CSS has correct path */ + $this->assertRegexp('#href=".*\/RequirementsTest_a\.css\?m=\d\d+&test=1&test=2&test=3#', $html, 'css has correct path and mtime suffix'); + + // Testing again without mtime suffix + $backend->set_suffix_requirements(FALSE); + + $html = $backend->render(); + + /* Javascript has correct path */ + $this->assertRegexp('#src=".*\/RequirementsTest_a\.js\?test=1&test=2&test=3#', $html, 'javascript has correct path'); + + /* CSS has correct path */ + $this->assertRegexp('#href=".*\/RequirementsTest_a\.css\?test=1&test=2&test=3#', $html, 'css has correct path'); + } + + function testRequirementsBackend() { + $backend = new Requirements_Backend(); + $backend->js('tests/phpunit/data/a.js'); + + $this->assertCount(1, $backend->get_js(), "There should be only 1 file included in required javascript."); + $this->assertContains('tests/phpunit/data/a.js', $backend->get_js(), "/tests/phpunit/data/a.js should be included in required javascript."); + + $backend->js('tests/phpunit/data/b.js'); + $this->assertCount(2, $backend->get_js(), "There should be 2 files included in required javascript."); + + $backend->block('tests/phpunit/data/a.js'); + $this->assertCount(1, $backend->get_js(), "There should be only 1 file included in required javascript."); + $this->assertNotContains('tests/phpunit/data/a.js', $backend->get_js(), "/tests/phpunit/data/a.js should not be included in required javascript after it has been blocked."); + $this->assertContains('tests/phpunit/data/b.js', $backend->get_js(), "/tests/phpunit/data/b.js should be included in required javascript."); + + $backend->css('tests/phpunit/data/a.css'); + $this->assertCount(1, $backend->get_css(), "There should be only 1 file included in required css."); + $this->assertArrayHasKey('a.css', $backend->get_css(), "/tests/phpunit/data/a.css should be in required css."); + $this->assertContains(array('file' => 'tests/phpunit/data/a.css', 'media' => null), $backend->get_css(), "/tests/phpunit/data/a.css should be in required css."); + + $backend->block('tests/phpunit/data/a.css'); + $this->assertCount(0, $backend->get_css(), "There should be nothing in required css after file has been blocked."); + + // Test unblock_all() + $backend->unblock_all(); + $this->assertCount(2, $backend->get_js(), "There should be only 2 files included in required css."); + $this->assertCount(1, $backend->get_css(), "There should be only 1 file included in required javascript."); + + // Testing clear() + $backend->js('tests/phpunit/data/c.css'); + $backend->clear(); + $this->assertCount(0, $backend->get_css(), "There should be nothing in required css after requirements cleared."); + $this->assertCount(0, $backend->get_js(), "There should be nothing in required js after requirements cleared."); + + // Testing js block by id + $backend->js('tests/phpunit/data/a.js'); + $backend->block('a.js'); + $this->assertCount(0, $backend->get_js(), "There should be nothing in required js after file has be blocked."); + + // Testing css block by id + $backend->css('tests/phpunit/data/a.css'); + $backend->block('a.css'); + $this->assertCount(0, $backend->get_css(), "There should be nothing in required css after file has been blocked."); + + // Testing unblock + $backend->unblock('a.js'); + $this->assertCount(1, $backend->get_js(), "There should be only 1 file included in required javascript."); + } + + function testBlockedInRender() { + $backend = new Requirements_Backend(); + $backend->js('tests/phpunit/data/RequirementsTest_a.js'); + $backend->js('tests/phpunit/data/RequirementsTest_a.css'); + $backend->js('tests/phpunit/data/RequirementsTest_b.js'); + $backend->js('tests/phpunit/data/RequirementsTest_b.css'); + $backend->js('tests/phpunit/data/RequirementsTest_c.js'); + $backend->js('tests/phpunit/data/RequirementsTest_c.css'); + + $backend->block('tests/phpunit/data/RequirementsTest_a.js'); + $backend->block('tests/phpunit/data/RequirementsTest_a.css'); + $backend->block('RequirementsTest_b.js'); + $backend->block('RequirementsTest_b.css'); + + $html = $backend->render(); + $this->assertNotContains('tests/phpunit/data/RequirementsTest_a.js', $html, 'RequirementsTest_a.js was blocked and should not appear in rendered HTML'); + $this->assertNotContains('tests/phpunit/data/RequirementsTest_a.css', $html, 'RequirementsTest_a.css was blocked and should not appear in rendered HTML'); + $this->assertNotContains('tests/phpunit/data/RequirementsTest_b.js', $html, 'RequirementsTest_b.js was blocked and should not appear in rendered HTML'); + $this->assertNotContains('tests/phpunit/data/RequirementsTest_b.css', $html, 'RequirementsTest_b.css was blocked and should not appear in rendered HTML'); + $this->assertContains('tests/phpunit/data/RequirementsTest_c.js', $html, 'RequirementsTest_c.js should appear in rendered HTML'); + $this->assertContains('tests/phpunit/data/RequirementsTest_c.css', $html, 'RequirementsTest_c.css should appear in rendered HTML'); + } +} + diff --git a/tests/phpunit/classes/libraries/Themes_Test.php b/tests/phpunit/classes/libraries/Themes_Test.php new file mode 100644 index 0000000000..904954b476 --- /dev/null +++ b/tests/phpunit/classes/libraries/Themes_Test.php @@ -0,0 +1,28 @@ + + * @license For license information, see License.txt + */ +class Themes_Test extends PHPUnit_Framework_TestCase { + + public function setUp() + { + + } + + public function tearDown() + { + + } + + public function testSomething() + { + } + +} + \ No newline at end of file diff --git a/tests/phpunit/data/RequirementsTest_a.css b/tests/phpunit/data/RequirementsTest_a.css new file mode 100644 index 0000000000..730bd9eb35 --- /dev/null +++ b/tests/phpunit/data/RequirementsTest_a.css @@ -0,0 +1 @@ +.a {color: #f00;} \ No newline at end of file diff --git a/tests/phpunit/data/RequirementsTest_a.js b/tests/phpunit/data/RequirementsTest_a.js new file mode 100644 index 0000000000..829a652433 --- /dev/null +++ b/tests/phpunit/data/RequirementsTest_a.js @@ -0,0 +1 @@ +alert('a'); \ No newline at end of file diff --git a/tests/phpunit/data/RequirementsTest_b.css b/tests/phpunit/data/RequirementsTest_b.css new file mode 100644 index 0000000000..e11f7eebfc --- /dev/null +++ b/tests/phpunit/data/RequirementsTest_b.css @@ -0,0 +1 @@ +.b {color: #0ff;} \ No newline at end of file diff --git a/tests/phpunit/data/RequirementsTest_b.js b/tests/phpunit/data/RequirementsTest_b.js new file mode 100644 index 0000000000..3d8670ca8c --- /dev/null +++ b/tests/phpunit/data/RequirementsTest_b.js @@ -0,0 +1 @@ +alert('b'); \ No newline at end of file diff --git a/tests/phpunit/data/RequirementsTest_c.css b/tests/phpunit/data/RequirementsTest_c.css new file mode 100644 index 0000000000..ae49dd2024 --- /dev/null +++ b/tests/phpunit/data/RequirementsTest_c.css @@ -0,0 +1 @@ +.c {color: #0ff;} \ No newline at end of file diff --git a/tests/phpunit/data/RequirementsTest_c.js b/tests/phpunit/data/RequirementsTest_c.js new file mode 100644 index 0000000000..1e0f7b3ceb --- /dev/null +++ b/tests/phpunit/data/RequirementsTest_c.js @@ -0,0 +1 @@ +alert('c'); \ No newline at end of file diff --git a/themes/bueno/views/footer.php b/themes/bueno/views/footer.php index 87420b89f5..93dd9f7fd8 100644 --- a/themes/bueno/views/footer.php +++ b/themes/bueno/views/footer.php @@ -11,7 +11,7 @@
-
+