From f7c0726660dbcd59af878f700f0318de10f8dbc7 Mon Sep 17 00:00:00 2001 From: zarzuelo Date: Thu, 1 Mar 2012 16:41:02 +0000 Subject: [PATCH] 2012-03-01 Sergio Martin * include/functions_graph.php include/graphs/functions_flot.php include/graphs/flot include/graphs/flot/jquery.flot.resize.min.js include/graphs/flot/jquery.flot.min.js include/graphs/flot/pandora.flot.js include/graphs/flot/jquery.flot.symbol.min.js include/graphs/flot/jquery.flot.selection.min.js include/graphs/flot/jquery.flot.stack.min.js include/graphs/flot/jquery.flot.threshold.js include/graphs/flot/jquery.flot.pie.min.js include/graphs/flot/jquery.flot.crosshair.min.js include/graphs/fgraph.php include/graphs/functions_utils.php include/javascript/pandora.js include/javascript/jquery.mousewheel.js include/javascript/jquery-1.6.1.min.js include/ajax/events.php include/include_graph_dependencies.php operation/agentes/estado_generalagente.php operation/agentes/stat_win.php images/zoom_cross.png images/zoom_cross.disabled.png images/chart_curve_overview.png godmode/setup/setup_visuals.php godmode/users/configure_user.php: Added a new graphs engine (Flot) and replace the old flash charts by it. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5685 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 30 + .../godmode/setup/setup_visuals.php | 2 +- .../godmode/users/configure_user.php | 4 +- .../images/chart_curve_overview.png | Bin 0 -> 831 bytes .../images/zoom_cross.disabled.png | Bin 0 -> 499 bytes pandora_console/images/zoom_cross.png | Bin 0 -> 907 bytes pandora_console/include/ajax/events.php | 60 + pandora_console/include/functions_graph.php | 221 ++-- pandora_console/include/graphs/fgraph.php | 86 +- .../graphs/flot/jquery.flot.crosshair.min.js | 1 + .../include/graphs/flot/jquery.flot.min.js | 6 + .../graphs/flot/jquery.flot.pie.min.js | 1 + .../graphs/flot/jquery.flot.resize.min.js | 1 + .../graphs/flot/jquery.flot.selection.min.js | 1 + .../graphs/flot/jquery.flot.stack.min.js | 1 + .../graphs/flot/jquery.flot.symbol.min.js | 1 + .../graphs/flot/jquery.flot.threshold.js | 132 ++ .../include/graphs/flot/pandora.flot.js | 912 ++++++++++++++ .../include/graphs/functions_flot.php | 1080 +++++++++++++++++ .../include/graphs/functions_utils.php | 21 + .../include/include_graph_dependencies.php | 6 +- .../include/javascript/jquery-1.6.1.min.js | 18 + .../include/javascript/jquery.mousewheel.js | 78 ++ pandora_console/include/javascript/pandora.js | 4 +- .../agentes/estado_generalagente.php | 9 +- .../operation/agentes/stat_win.php | 18 +- 26 files changed, 2546 insertions(+), 147 deletions(-) create mode 100644 pandora_console/images/chart_curve_overview.png create mode 100644 pandora_console/images/zoom_cross.disabled.png create mode 100644 pandora_console/images/zoom_cross.png create mode 100644 pandora_console/include/ajax/events.php create mode 100644 pandora_console/include/graphs/flot/jquery.flot.crosshair.min.js create mode 100644 pandora_console/include/graphs/flot/jquery.flot.min.js create mode 100644 pandora_console/include/graphs/flot/jquery.flot.pie.min.js create mode 100644 pandora_console/include/graphs/flot/jquery.flot.resize.min.js create mode 100644 pandora_console/include/graphs/flot/jquery.flot.selection.min.js create mode 100644 pandora_console/include/graphs/flot/jquery.flot.stack.min.js create mode 100644 pandora_console/include/graphs/flot/jquery.flot.symbol.min.js create mode 100644 pandora_console/include/graphs/flot/jquery.flot.threshold.js create mode 100644 pandora_console/include/graphs/flot/pandora.flot.js create mode 100644 pandora_console/include/graphs/functions_flot.php create mode 100755 pandora_console/include/javascript/jquery-1.6.1.min.js create mode 100755 pandora_console/include/javascript/jquery.mousewheel.js diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index ffd3c8a89b..98e9622a08 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,33 @@ +2012-03-01 Sergio Martin + + * include/functions_graph.php + include/graphs/functions_flot.php + include/graphs/flot + include/graphs/flot/jquery.flot.resize.min.js + include/graphs/flot/jquery.flot.min.js + include/graphs/flot/pandora.flot.js + include/graphs/flot/jquery.flot.symbol.min.js + include/graphs/flot/jquery.flot.selection.min.js + include/graphs/flot/jquery.flot.stack.min.js + include/graphs/flot/jquery.flot.threshold.js + include/graphs/flot/jquery.flot.pie.min.js + include/graphs/flot/jquery.flot.crosshair.min.js + include/graphs/fgraph.php + include/graphs/functions_utils.php + include/javascript/pandora.js + include/javascript/jquery.mousewheel.js + include/javascript/jquery-1.6.1.min.js + include/ajax/events.php + include/include_graph_dependencies.php + operation/agentes/estado_generalagente.php + operation/agentes/stat_win.php + images/zoom_cross.png + images/zoom_cross.disabled.png + images/chart_curve_overview.png + godmode/setup/setup_visuals.php + godmode/users/configure_user.php: Added a new graphs engine (Flot) and + replace the old flash charts by it. + 2012-03-01 Vanessa Gil * godmode/agentes/planned_downtime.php: Fixed bug #3474901: Planned diff --git a/pandora_console/godmode/setup/setup_visuals.php b/pandora_console/godmode/setup/setup_visuals.php index ccd3445cec..51c54452fe 100644 --- a/pandora_console/godmode/setup/setup_visuals.php +++ b/pandora_console/godmode/setup/setup_visuals.php @@ -91,7 +91,7 @@ $table->data[11][1] = html_print_select($fonts, 'fontpath', $config["fontpath"], $table->data[12][0] = __('Font size'); $table->data[12][1] = html_print_select(range(1, 15), 'font_size', $config["font_size"], '', '', 0, true); -$table->data[13][0] = __('Flash charts') . ui_print_help_tip(__('Whether to use Flash charts or static PNG graphs'), true); +$table->data[13][0] = __('Interactive charts') . ui_print_help_tip(__('Whether to use Javascript or static PNG graphs'), true); $table->data[13][1] = __('Yes').' '.html_print_radio_button ('flash_charts', 1, '', $config["global_flash_charts"], true).'  '; $table->data[13][1] .= __('No').' '.html_print_radio_button ('flash_charts', 0, '', $config["global_flash_charts"], true); diff --git a/pandora_console/godmode/users/configure_user.php b/pandora_console/godmode/users/configure_user.php index 4fe6bb7e79..9006dbef5e 100644 --- a/pandora_console/godmode/users/configure_user.php +++ b/pandora_console/godmode/users/configure_user.php @@ -158,7 +158,7 @@ if ($create_user) { ' Phone: ' . $values['phone'] . ' Comments: ' . $values['comments'] . ' Is_admin: ' . $values['is_admin'] . ' Language: ' . $values['language'] . - ' Block size: ' . $values['block_size'] . ' Flash Chats: ' . $values['flash_chart']; + ' Block size: ' . $values['block_size'] . ' Interactive Charts: ' . $values['flash_chart']; if ($isFunctionSkins !== ENTERPRISE_NOT_HOOK) { $info .= ' Skin: ' . $values['id_skin']; @@ -401,7 +401,7 @@ if (count($usr_groups) > 1){ } } -$table->data[11][0] = __('Flash charts'); +$table->data[11][0] = __('Interactive charts'); $values = array(-1 => __('Use global conf'), 1 => __('Yes'), 0 => __('No')); $table->data[11][1] = html_print_select($values, 'flash_charts', $user_info["flash_chart"], '', '', -1, true, false, false); $table->data[12][0] = __('Block size for pagination'); diff --git a/pandora_console/images/chart_curve_overview.png b/pandora_console/images/chart_curve_overview.png new file mode 100644 index 0000000000000000000000000000000000000000..ab7dc61ab99c9060ee3271ee988fe10d8325a2ce GIT binary patch literal 831 zcmV-F1Hk-=P)Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2iyV} z3NaFXHmS$}00O^BL_t(I%cYV{ZyQwV#563sD70L4gX2C=sm` zHn8b0$Y0>6WC4F65<)@{A<;#;U;_(^3Pn^6AI-!`>?HPlWa63e+{+>@?WQYU9UZ-^ zqw{`^hGy2Bv+o0iw16wfh^aztX|JI`>o za~>g11t|eYWignwIlSnzv;7tMeoTFKo(tV;(0Gfzi9>!eCe;#KRLFGwKSz`?P!uV~ z(m3y5;oNYZ#_s{cEuT9l9S+C8^5&e!6~DsS-VAQNO2ex@ApwJHdo0afCCjJWQzL$v z9`f7$fUeB>q;|lo@gDKm;6!b#riWg9`|$^W4D%_s_agS9lz)yAJm2Tjm3MiulG3X$ zk%uA0Zl6Z2Le+NAr}_neD$DYCxIbV#$|?rJD9_B1*6U1! zD08&b{K5gZb+_r7g>-F^d`g$n-ca>e&y}rD>{8BtA7#&a8+!}H> zf?m_+gBdta%5;C1(N2JCN~#SP=kkYqyLqdfB#Bf2yGg+}f5!B~6h|s;*EXy8*!Pc`2LZ~-Px#0%A)?L;(MXkIcUS000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2iyW32?jFY z$7f#v00DPNL_t(2&sEONOOpWr2Jqke?wxbFw)9l2ls@Q#kWjS4U_pdXhwee=F8L1# zb(W4HEP`&{LT^a~(Iqc|E4%bTQK?~;Q0By(ZF}Dijoeqy`Pyikq$(o^Po8n#G3Ok$U)^g% z)-vVr;YSD?ol^J9Z)sU?4QP~i7Q#3xSk`O9mWCF(Y|4wH9T3HuIwZC(^{Ps1%9_)e zX@jv!Bx}KftVq9ZonETBs4@;I8|&GthgPJN)Rk;{X31Ga2lQWVa{H6 zb!|tPBfbiq5F@-a8Yj7A)v8<)Cx<{s4Z%fHvPx#24YJ`L;(K){{a7>y{D4^000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2iyV} z3OWTI5%t6X00Rq2L_t(I%WaWeNSkLEhOhVgiSdg`O%|<~*pa!q+ReGnh_&04YU#G( zD(z7{aWEN$m9h?27#sWPJQ=LR!nT9agC4HJ7*w!q3>vh7Hr2+pqTOJ|Sd31iL6f#7 z=F9i)pg3ab1JA*8A6(q`{RoQY_KyeqWx@OyS+M^v3Nw6Y z+tfxrZ=T%-kd{@VcwF3C+QBP6J4+8uQaOus0Wt_4DFRoS%HNwiQQa;q%PJ`bXr?8= z+(5S}SV&U20+|9lLXcGz91h4A1g5Hixq)ekZJ$uAq$UM`)NEgQNFHAG7}jmJ^3d`n8!U6r7Qgpj=!P^U87#V z&&Ki+o2JNYi;xVD;Hlk1?x$}!x~~m@?8GRgwR=d0M_BDSfHdI{A?`$?IP8jZn}fRV zE(TME7tL^DOpReojiDP(QihjH-Ct1UhThGK#K&)tPUq?DswaHmpxgqez~ZwDv+mdX zKG<*FkD+Kfj>E@TwWc}Ix{5y)VIn-ia(sq2o83^;%`X2#-hQF%D}PJxIqmm-f#BZu z_7C%+VQd~R0Qt}`POpz&28J=q?HM%PdBQ&p^KnoWXy~ONCm%=HfApO(Z#E+}SGkO@ ztPx*XLvxi&Z#E+jdz*;kczNzs2Jb${_^rj`m;RW4cdG~g^*0(M;4doo hX&OLN(K@7*{0GCMJ4qNn=lK8t002ovPDHLkV1lAQrw0H4 literal 0 HcmV?d00001 diff --git a/pandora_console/include/ajax/events.php b/pandora_console/include/ajax/events.php new file mode 100644 index 0000000000..0ac7236a4c --- /dev/null +++ b/pandora_console/include/ajax/events.php @@ -0,0 +1,60 @@ + $event_ids, + 'order' => 'utimestamp ASC'), + array ('evento', 'utimestamp', 'estado', 'criticity')); + + $out = ''; + $out .= ''; + foreach($events as $event) { + switch($event["estado"]) { + case 0: + $img = "../../images/star.png"; + $title = __('New event'); + break; + case 1: + $img = "../../images/tick.png"; + $title = __('Event validated'); + break; + case 2: + $img = "../../images/hourglass.png"; + $title = __('Event in process'); + break; + } + + $out .= ''; + } + $out .= '
'; + $out .= ''.$title.''; + $out .= ''; + $out .= io_safe_output($event['evento']); + $out .= '
'; + $out .= '
'; + $out .= '
'; + + echo $out; +} + +?> diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index 6149c5661f..3d391175fd 100755 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -60,7 +60,7 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events, "utimestamp > $datelimit", "utimestamp < $date", 'order' => 'utimestamp ASC'), - array ('evento', 'utimestamp', 'event_type')); + array ('id_evento', 'evento', 'utimestamp', 'event_type')); if ($events === false) { $events = array (); } @@ -152,6 +152,8 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events, $unit = modules_get_unit($agent_module_id); } + $chart_extra_data = array(); + // Calculate chart data for ($i = 0; $i < $resolution; $i++) { $timestamp = $datelimit + ($interval * $i); @@ -188,12 +190,16 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events, // Read events and alerts that fall in the current interval $event_value = 0; $alert_value = 0; + $event_ids = array(); + $alert_ids = array(); while (isset ($events[$k]) && $events[$k]['utimestamp'] >= $timestamp && $events[$k]['utimestamp'] <= ($timestamp + $interval)) { if ($show_events == 1) { $event_value++; + $event_ids[] = $events[$k]['id_evento']; } if ($show_alerts == 1 && substr ($events[$k]['event_type'], 0, 5) == 'alert') { $alert_value++; + $alert_ids[] = $events[$k]['id_evento']; } $k++; } @@ -284,11 +290,15 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events, //$chart[$timestamp]['timestamp_bottom'] = $timestamp; //$chart[$timestamp]['timestamp_top'] = $timestamp + $interval; ///////// + $series_type = array(); + if($show_events) { $chart[$timestamp]['event'] = $event_value; + $series_type['event'] = 'points'; } if($show_alerts) { $chart[$timestamp]['alert'] = $alert_value; + $series_type['alert'] = 'points'; } if ($baseline) { $chart[$timestamp]['baseline'] = array_shift ($baseline_data); @@ -296,6 +306,13 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events, $chart[$timestamp]['baseline'] = 0; } } + + if(!empty($event_ids)) { + $chart_extra_data[count($chart)-1]['events'] = implode(',',$event_ids); + } + if(!empty($alert_ids)) { + $chart_extra_data[count($chart)-1]['alerts'] = implode(',',$alert_ids); + } } // Return chart data and don't draw @@ -309,10 +326,10 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events, $avg_value = round(reporting_get_agentmodule_data_average ($agent_module_id, $period, $date), 2); // Fix event and alert scale - $event_max = $max_value * 1.25; + $event_max = $max_value * 1.15; foreach ($chart as $timestamp => $chart_data) { if ($show_events && $chart_data['event'] > 0) { - $chart[$timestamp]['event'] = $event_max; + $chart[$timestamp]['event'] = $event_max * 1.15; } if ($show_alerts && $chart_data['alert'] > 0) { $chart[$timestamp]['alert'] = $event_max; @@ -328,26 +345,28 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events, /////// // Color commented not to restrict serie colors - /*$color = array(); + $color = array(); $color['sum'] = array('border' => '#000000', 'color' => $config['graph_color2'], 'alpha' => 50); if($show_events) { - $color['event'] = array('border' => '#ff7f00', 'color' => '#ff7f00', 'alpha' => 50); + $color['event'] = array('border' => '#ff0000', 'color' => '#ff0000', 'alpha' => 50); } if($show_alerts) { - $color['alert'] = array('border' => '#ff0000', 'color' => '#ff0000', 'alpha' => 50); + $color['alert'] = array('border' => '#ff7f00', 'color' => '#ff7f00', 'alpha' => 50); } $color['max'] = array('border' => '#000000', 'color' => $config['graph_color3'], 'alpha' => 50); $color['min'] = array('border' => '#000000', 'color' => $config['graph_color1'], 'alpha' => 50); $color['baseline'] = array('border' => null, 'color' => '#0097BD', 'alpha' => 10); - $color['unit'] = array('border' => null, 'color' => '#0097BC', 'alpha' => 10); */ + $color['unit'] = array('border' => null, 'color' => '#0097BC', 'alpha' => 10); $legend = array(); $legend['sum'] = __('Avg') . ' (' . $avg_value . ')'; if($show_events) { $legend['event'] = __('Events'); + $chart_extra_data['legend_events'] = $legend['event']; } if($show_alerts) { $legend['alert'] = __('Alerts'); + $chart_extra_data['legend_alerts'] = $legend['alert']; } $legend['max'] = __('Max') . ' (' .format_for_graph($max_value) . ')'; $legend['min'] = __('Min') . ' (' . format_for_graph($min_value) . ')'; @@ -361,11 +380,14 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events, include_flash_chart_script($homeurl); } + $water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png", + 'url' => $config['homeurl'] . "/images/logo_vertical_water.png"); + // Color commented not to restrict serie colors - return area_graph($flash_chart, $chart, $width, $height, '' /*$color*/ ,$legend, - $long_index, "images/image_problem.opaque.png", "", $unit, $homeurl, - $config['homedir'] . "/images/logo_vertical_water.png", - $config['fontpath'], $config['font_size'], $unit, $ttl); + return area_graph($flash_chart, $chart, $width, $height, $color, $legend, + $long_index, "images/image_problem.opaque.png", "", "", $homeurl, + $water_mark, + $config['fontpath'], $config['font_size'], $unit, $ttl, $series_type, $chart_extra_data); } function graph_get_formatted_date($timestamp, $format1, $format2) { @@ -750,17 +772,19 @@ function graphic_combined_module ($module_list, $weight_list, $period, $width, $ $flash_charts = false; } - if ($flash_charts){ include_flash_chart_script(); } + $water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png", + 'url' => $config['homeurl'] . "/images/logo_vertical_water.png"); + switch ($stacked) { case GRAPH_AREA: $color = null; return area_graph($flash_charts, $graph_values, $width, $height, $color, $module_name_list, $long_index, $homeurl."images/image_problem.opaque.png", - "", "", $homeurl, $config['homedir'] . "/images/logo_vertical_water.png", + "", "", $homeurl, $water_mark, $config['fontpath'], $config['font_size'], "", $ttl); break; default: @@ -768,21 +792,21 @@ function graphic_combined_module ($module_list, $weight_list, $period, $width, $ $color = null; return stacked_area_graph($flash_charts, $graph_values, $width, $height, $color, $module_name_list, $long_index, $homeurl."images/image_problem.opaque.png", - "", "", $config['homedir'] . "/images/logo_vertical_water.png", + "", "", $water_mark, $config['fontpath'], $config['font_size'], "", $ttl, $homeurl); break; case GRAPH_LINE: $color = null; return line_graph($flash_charts, $graph_values, $width, $height, $color, $module_name_list, $long_index, $homeurl."images/image_problem.opaque.png", - "", "", $config['homedir'] . "/images/logo_vertical_water.png", + "", "", $water_mark, $config['fontpath'], $config['font_size'], "", $ttl, $homeurl); break; case GRAPH_STACKED_LINE: $color = null; return stacked_line_graph($flash_charts, $graph_values, $width, $height, $color, $module_name_list, $long_index, $homeurl."images/image_problem.opaque.png", - "", "", $config['homedir'] . "/images/logo_vertical_water.png", + "", "", $water_mark, $config['fontpath'], $config['font_size'], "", $ttl, $homeurl); break; } @@ -846,12 +870,15 @@ function graphic_agentaccess ($id_agent, $width, $height, $period = 0) { } } + $water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png", + 'url' => $config['homeurl'] . "/images/logo_vertical_water.png"); + if ($empty_data) echo fs_error_image(); else { echo area_graph($config['flash_charts'], $data, $width, $height, null, null, null, "images/image_problem.opaque.png", "", "", "", - $config['homedir'] . "/images/logo_vertical_water.png", + $water_mark, $config['fontpath'], $config['font_size'], ""); } } @@ -909,8 +936,11 @@ function graph_event_module ($width = 300, $height = 200, $id_agent) { } asort ($data); + $water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png", + 'url' => $config['homeurl'] . "/images/logo_vertical_water.png"); + return pie3d_graph($config['flash_charts'], $data, $width, $height, __("other"), - '', $config['homedir'] . "/images/logo_vertical_water.png", + '', $water_mark, $config['fontpath'], $config['font_size']); } @@ -923,7 +953,7 @@ function progress_bar($progress, $width, $height, $title = '', $mode = 1) { require_once("include_graph_dependencies.php"); include_graphs_dependencies($config['homedir'].'/'); - return "" . $title . ""; } @@ -948,7 +978,6 @@ function grafico_db_agentes_purge ($id_agent, $width = 380, $height = 300) { global $config; global $graphic_type; - include_flash_chart_script(); if ($id_agent < 1) { $id_agent = -1; @@ -997,9 +1026,12 @@ function grafico_db_agentes_purge ($id_agent, $width = 380, $height = 300) { $data["1 ".__("Month")] == 0 && $data["3 ".__("Months")] == 0 && $data[__("Older")] == 0) { return html_print_image('images/image_problem.png', true); } - + + $water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png", + 'url' => $config['homeurl'] . "/images/logo_vertical_water.png"); + return pie3d_graph($config['flash_charts'], $data, $width, $height, - __('Other'), '', $config['homedir'] . "/images/logo_vertical_water.png", + __('Other'), '', $water_mark, $config['fontpath'], $config['font_size']); } @@ -1080,9 +1112,12 @@ function graph_db_agentes_modulos2($width, $height) { } } + $water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png", + 'url' => $config['homeurl'] . "/images/logo_vertical_water.png"); + return hbar_graph($config['flash_charts'], $data, $width, $height, array(), array(), "", "", true, "", - $config['homedir'] . "/images/logo_vertical_water.png", + $water_mark, $config['fontpath'], $config['font_size'], false); } @@ -1639,6 +1674,7 @@ function graph_graphic_agentevents_static($id_agent, $width, $height, $period = $time = array (); $data = array (); $legend = array(); + $full_legend = array(); $cont = 0; for ($i = 0; $i < $interval; $i++) { @@ -1653,6 +1689,8 @@ function graph_graphic_agentevents_static($id_agent, $width, $height, $period = if ($cont == 0 or $cont % 2) $legend[$name] = $name; + $full_legend[$name] = $name;; + $top = $datelimit + ($periodtime * ($i + 1)); $event = db_get_row_filter ('tevento', array ('id_agente' => $id_agent, @@ -1680,14 +1718,20 @@ function graph_graphic_agentevents_static($id_agent, $width, $height, $period = $colors = array(1 => '#38B800', 2 => '#FFFF00', 3 => '#FF0000', 4 => '#C3C3C3'); // Draw slicebar graph - echo slicesbar_graph($data, $period, $width, $height, $colors, $config['fontpath'], $config['round_corner'], $homeurl); - // Draw legend - echo "
"; - echo " "; - foreach ($legend as $hour){ - echo "" . $hour . ""; + if($config['flash_charts']) { + echo flot_slicesbar_graph($data, $period, $width, $height, $full_legend, $colors, $config['fontpath'], $config['round_corner'], $homeurl); + } + else { + echo slicesbar_graph($data, $period, $width, $height, $colors, $config['fontpath'], $config['round_corner'], $homeurl); + + // Draw legend + echo "
"; echo " "; + foreach ($legend as $hour){ + echo "" . $hour . ""; + echo " "; + } } } @@ -2450,9 +2494,12 @@ function grafico_modulo_string ($agent_module_id, $period, $show_events, $legend = null; + $water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png", + 'url' => $config['homeurl'] . "/images/logo_vertical_water.png"); + return vbar_graph($flash_chart, $chart, $width, $height, $color, $legend, "", $unit, $homeurl, - $config['homedir'] . "/images/logo_vertical_water.png", + $water_mark, $config['fontpath'], $config['font_size'], true, true, 1, true); } @@ -2836,10 +2883,6 @@ function graphic_module_events ($id_module, $width, $height, $period = 0, $homeu global $config; global $graphic_type; - if ($config['flash_charts']) { - include_flash_chart_script($homeurl); - } - $data = array (); $resolution = $config['graph_res'] * ($period * 2 / $width); // Number of "slices" we want in graph @@ -2880,46 +2923,32 @@ function graphic_module_events ($id_module, $width, $height, $period = 0, $homeu $top = $datelimit + ($periodtime * ($i + 1)); - if ($config['flash_charts']){ - $criticity = (int) db_get_value_filter ('criticity', - 'tevento', - array ('id_agentmodule' => $id_module, - 'utimestamp > '.$bottom, - 'utimestamp < '.$top)); - - switch ($criticity) { - case 3: $data[$name] = 'E5DF63'; + + $event = db_get_row_filter ('tevento', + array ('id_agentmodule' => $id_module, + 'utimestamp > '.$bottom, + 'utimestamp < '.$top), 'criticity, utimestamp'); + + if (!empty($event['utimestamp'])){ + $data[$cont]['utimestamp'] = $periodtime; + switch ($event['criticity']) { + case 3: $data[$cont]['data'] = 2; break; - case 4: $data[$name] = 'FF3C4B'; + case 4: $data[$cont]['data'] = 3; + break; + default:$data[$cont]['data'] = 1; break; - default: $data[$name] = '9ABD18'; } - }else{ - $event = db_get_row_filter ('tevento', - array ('id_agentmodule' => $id_module, - 'utimestamp > '.$bottom, - 'utimestamp < '.$top), 'criticity, utimestamp'); - - if (!empty($event['utimestamp'])){ - $data[$cont]['utimestamp'] = $periodtime; - switch ($event['criticity']) { - case 3: $data[$cont]['data'] = 2; - break; - case 4: $data[$cont]['data'] = 3; - break; - default:$data[$cont]['data'] = 1; - break; - } - $current_timestamp = $event['utimestamp']; - } - else{ - $data[$cont]['utimestamp'] = $periodtime; - $data[$cont]['data'] = 1; - $current_timestamp = $bottom; - } - $legend[] = date($time_format, $current_timestamp); - $cont++; + $current_timestamp = $event['utimestamp']; } + else{ + $data[$cont]['utimestamp'] = $periodtime; + $data[$cont]['data'] = 1; + $current_timestamp = $bottom; + } + $legend[] = date($time_format, $current_timestamp); + $cont++; + } $pixels_between_xdata = 25; @@ -2934,37 +2963,43 @@ function graphic_module_events ($id_module, $width, $height, $period = 0, $homeu $step = round($ndata/$xdata_display); - if ($config['flash_charts']) { - return fs_module_event_chart ($data, $width, $height, /*$resolution / 750*/ $step, $homeurl, 1); - } else { - $colors = array(1 => '#38B800', 2 => '#FFFF00', 3 => '#FF0000', 4 => '#C3C3C3'); + $colors = array(1 => '#38B800', 2 => '#FFFF00', 3 => '#FF0000', 4 => '#C3C3C3'); - // Draw slicebar graph + // Draw slicebar graph + if($config['flash_charts']) { + echo flot_slicesbar_graph($data, $period, $width, 15, $legend, $colors, $config['fontpath'], $config['round_corner'], $homeurl); + } + else { echo slicesbar_graph($data, $period, $width, 15, $colors, $config['fontpath'], $config['round_corner'], $homeurl); // Draw legend echo "
"; - //echo "
$value) { - $file_name = string2image(ui_print_truncate_text($value, 15, false, true, false, '...'), 115, 13, 2, 270, '#FFFFFF', '#696969', 4, 0); - - if (($step >= 1) && ($count++ % $step == 0)) { - if ($zoom == 1) - echo "     "; - elseif ($zoom == 2) - echo "  "; - elseif ($zoom == 3) - echo "  "; - elseif ($zoom == 4) - echo "     "; - - echo html_print_image($file_name, true, array('title' => $value)); + if(!$config['flash_charts']) { + // Draw legend + echo "
"; + + //echo "
$value) { + $file_name = string2image(ui_print_truncate_text($value, 15, false, true, false, '...'), 115, 13, 2, 270, '#FFFFFF', '#696969', 4, 0); + + if (($step >= 1) && ($count++ % $step == 0)) { + if ($zoom == 1) + echo "     "; + elseif ($zoom == 2) + echo "  "; + elseif ($zoom == 3) + echo "  "; + elseif ($zoom == 4) + echo "     "; + + echo html_print_image($file_name, true, array('title' => $value)); + } } } - //echo "
"; - } + } + //echo "
"; } ?> diff --git a/pandora_console/include/graphs/fgraph.php b/pandora_console/include/graphs/fgraph.php index 30a536b442..a90c7bb822 100755 --- a/pandora_console/include/graphs/fgraph.php +++ b/pandora_console/include/graphs/fgraph.php @@ -116,7 +116,7 @@ function histogram($chart_data, $width, $height, $font, $max, $title, $mode, $tt $id_graph = serialize_in_temp($graph, null, $ttl); - return ""; + return ""; } function progressbar($progress, $width, $height, $title, $font, $mode = 1, @@ -134,7 +134,7 @@ function progressbar($progress, $width, $height, $title, $font, $mode = 1, $id_graph = serialize_in_temp($graph, null, $ttl); - return ""; + return ""; } @@ -151,15 +151,17 @@ function slicesbar_graph($chart_data, $period, $width, $height, $colors, $font, $id_graph = serialize_in_temp($graph, null, $ttl); - return ""; + return ""; } function vbar_graph($flash_chart, $chart_data, $width, $height, $color = array(), $legend = array(), $xaxisname = "", $yaxisname = "", $homedir="", $water_mark = '', $font = '', $font_size = '', $force_steps = true, $ttl = 1, $reduce_data_columns = false) { - + + setup_watermark($water_mark, $water_mark_file, $water_mark_url); + if($flash_chart) { - echo fs_2d_column_chart ($chart_data, $width, $height, $homedir, $reduce_data_columns, $yaxisname); + echo flot_vcolumn_chart ($chart_data, $width, $height, $water_mark_url, $homedir, $reduce_data_columns); } else { $graph = array(); @@ -170,14 +172,14 @@ function vbar_graph($flash_chart, $chart_data, $width, $height, $color = array() $graph['legend'] = $legend; $graph['xaxisname'] = $xaxisname; $graph['yaxisname'] = $yaxisname; - $graph['water_mark'] = $water_mark; + $graph['water_mark'] = $water_mark_file; $graph['font'] = $font; $graph['font_size'] = $font_size; $graph['force_steps'] = $force_steps; $id_graph = serialize_in_temp($graph, null, $ttl); - return ""; + return ""; } } @@ -186,14 +188,17 @@ function threshold_graph($flash_chart, $chart_data, $width, $height, $ttl = 1) { echo fs_area_chart ($chart_data, $width, $height); } else { - echo ""; + echo ""; } } function area_graph($flash_chart, $chart_data, $width, $height, $color, $legend, $long_index, $no_data_image, $xaxisname = "", $yaxisname = "", $homeurl="", - $water_mark = "", $font = '', $font_size = '', $unit = '', $ttl = 1) { + $water_mark = "", $font = '', $font_size = '', $unit = '', $ttl = 1, $series_type = array(), + $chart_extra_data = array()) { + setup_watermark($water_mark, $water_mark_file, $water_mark_url); + // ATTENTION: The min height is 101 if($height <= 100) { $height = 101; @@ -204,7 +209,7 @@ function area_graph($flash_chart, $chart_data, $width, $height, $color, $legend, } if($flash_chart) { - return fs_area_graph($chart_data, $width, $height, $color, $legend, $long_index, $homeurl, $unit); + return flot_area_simple_graph($chart_data, $width, $height, $color, $legend, $long_index, $homeurl, $unit, $water_mark_url, $series_type, $chart_extra_data); } else { $graph = array(); @@ -215,13 +220,13 @@ function area_graph($flash_chart, $chart_data, $width, $height, $color, $legend, $graph['legend'] = $legend; $graph['xaxisname'] = $xaxisname; $graph['yaxisname'] = $yaxisname; - $graph['water_mark'] = $water_mark; + $graph['water_mark'] = $water_mark_file; $graph['font'] = $font; $graph['font_size'] = $font_size; $id_graph = serialize_in_temp($graph, null, $ttl); - return ""; + return ""; } } @@ -229,12 +234,14 @@ function stacked_area_graph($flash_chart, $chart_data, $width, $height, $color, $legend, $long_index, $no_data_image, $xaxisname = "", $yaxisname = "", $water_mark = "", $font = '', $font_size = '', $unit = '', $ttl = 1, $homeurl = '') { + setup_watermark($water_mark, $water_mark_file, $water_mark_url); + if (empty($chart_data)) { return ''; } if($flash_chart) { - return fs_stacked_graph($chart_data, $width, $height, $color, $legend, $long_index); + return flot_area_stacked_graph($chart_data, $width, $height, $color, $legend, $long_index, $homeurl, $unit, $water_mark_url); } else { //Stack the data @@ -248,13 +255,13 @@ function stacked_area_graph($flash_chart, $chart_data, $width, $height, $color, $graph['legend'] = $legend; $graph['xaxisname'] = $xaxisname; $graph['yaxisname'] = $yaxisname; - $graph['water_mark'] = $water_mark; + $graph['water_mark'] = $water_mark_file; $graph['font'] = $font; $graph['font_size'] = $font_size; $id_graph = serialize_in_temp($graph, null, $ttl); - return ""; + return ""; } } @@ -262,17 +269,19 @@ function stacked_line_graph($flash_chart, $chart_data, $width, $height, $color, $legend, $long_index, $no_data_image, $xaxisname = "", $yaxisname = "", $water_mark = "", $font = '', $font_size = '', $unit = '', $ttl = 1, $homeurl = '') { + setup_watermark($water_mark, $water_mark_file, $water_mark_url); + if (empty($chart_data)) { return ''; } - - //Stack the data - stack_data($chart_data, $legend, $color); - + if($flash_chart) { - return fs_line_graph($chart_data, $width, $height, $color, $legend, $long_index); + return flot_line_stacked_graph($chart_data, $width, $height, $color, $legend, $long_index, $homeurl, $unit, $water_mark_url); } else { + //Stack the data + stack_data($chart_data, $legend, $color); + $graph = array(); $graph['data'] = $chart_data; $graph['width'] = $width; @@ -281,13 +290,13 @@ function stacked_line_graph($flash_chart, $chart_data, $width, $height, $color, $graph['legend'] = $legend; $graph['xaxisname'] = $xaxisname; $graph['yaxisname'] = $yaxisname; - $graph['water_mark'] = $water_mark; + $graph['water_mark'] = $water_mark_file; $graph['font'] = $font; $graph['font_size'] = $font_size; $id_graph = serialize_in_temp($graph, null, $ttl); - return ""; + return ""; } } @@ -295,12 +304,14 @@ function line_graph($flash_chart, $chart_data, $width, $height, $color, $legend, $long_index, $no_data_image, $xaxisname = "", $yaxisname = "", $water_mark = "", $font = '', $font_size = '', $unit = '', $ttl = 1, $homeurl = '') { + setup_watermark($water_mark, $water_mark_file, $water_mark_url); + if (empty($chart_data)) { return ''; } if($flash_chart) { - return fs_line_graph($chart_data, $width, $height, $color, $legend, $long_index); + return flot_line_simple_graph($chart_data, $width, $height, $color, $legend, $long_index, $homeurl, $unit, $water_mark_url); } else { $graph = array(); @@ -311,13 +322,13 @@ function line_graph($flash_chart, $chart_data, $width, $height, $color, $legend, $graph['legend'] = $legend; $graph['xaxisname'] = $xaxisname; $graph['yaxisname'] = $yaxisname; - $graph['water_mark'] = $water_mark; + $graph['water_mark'] = $water_mark_file; $graph['font'] = $font; $graph['font_size'] = $font_size; $id_graph = serialize_in_temp($graph, null, $ttl); - return ""; + return ""; } } @@ -333,7 +344,7 @@ function kiviat_graph($graph_type, $flash_chart, $chart_data, $width, $height, $ $id_graph = serialize_in_temp($graph, null, $ttl); - return ""; + return ""; } function radar_graph($flash_chart, $chart_data, $width, $height, $no_data_image, $ttl = 1, $homedir="") { @@ -347,13 +358,15 @@ function polar_graph($flash_chart, $chart_data, $width, $height, $no_data_image, function hbar_graph($flash_chart, $chart_data, $width, $height, $color = array(), $legend = array(), $xaxisname = "", $yaxisname = "", $force_height = true, $homedir="", $water_mark = '', $font = '', $font_size = '', $force_steps = true, $ttl = 1, $return = false) { + + setup_watermark($water_mark, $water_mark_file, $water_mark_url); + if($flash_chart) { - include_flash_chart_script(); if ($return){ - return fs_2d_hcolumn_chart ($chart_data, $width, $height); + return flot_hcolumn_chart ($chart_data, $width, $height, $water_mark_url); } else{ - echo fs_2d_hcolumn_chart ($chart_data, $width, $height); + echo flot_hcolumn_chart ($chart_data, $width, $height, $water_mark_url); } } else { @@ -366,14 +379,14 @@ function hbar_graph($flash_chart, $chart_data, $width, $height, $color = array() $graph['xaxisname'] = $xaxisname; $graph['yaxisname'] = $yaxisname; $graph['force_height'] = $force_height; - $graph['water_mark'] = $water_mark; + $graph['water_mark'] = $water_mark_file; $graph['font'] = $font; $graph['font_size'] = $font_size; $graph['force_steps'] = $force_steps; $id_graph = serialize_in_temp($graph, null, $ttl); - return ""; + return ""; } } @@ -391,6 +404,9 @@ function pie2d_graph($flash_chart, $chart_data, $width, $height, function pie_graph($graph_type, $flash_chart, $chart_data, $width, $height, $others_str = "other", $homedir="", $water_mark = "", $font = '', $font_size = '', $ttl = 1) { + + setup_watermark($water_mark, $water_mark_file, $water_mark_url); + // This library allows only 8 colors $max_values = 8; @@ -418,7 +434,7 @@ function pie_graph($graph_type, $flash_chart, $chart_data, $width, $height, return fs_2d_pie_chart (array_values($chart_data), array_keys($chart_data), $width, $height); break; case "3d": - return fs_3d_pie_chart(array_values($chart_data), array_keys($chart_data), $width, $height); + return flot_pie_chart(array_values($chart_data), array_keys($chart_data), $width, $height, $water_mark_url, $font, $font_size); break; } } @@ -427,7 +443,7 @@ function pie_graph($graph_type, $flash_chart, $chart_data, $width, $height, $graph['data'] = $chart_data; $graph['width'] = $width; $graph['height'] = $height; - $graph['water_mark'] = $water_mark; + $graph['water_mark'] = $water_mark_file; $graph['font'] = $font; $graph['font_size'] = $font_size; @@ -435,10 +451,10 @@ function pie_graph($graph_type, $flash_chart, $chart_data, $width, $height, switch($graph_type) { case "2d": - return ""; + return ""; break; case "3d": - return ""; + return ""; break; } } diff --git a/pandora_console/include/graphs/flot/jquery.flot.crosshair.min.js b/pandora_console/include/graphs/flot/jquery.flot.crosshair.min.js new file mode 100644 index 0000000000..ccaf240366 --- /dev/null +++ b/pandora_console/include/graphs/flot/jquery.flot.crosshair.min.js @@ -0,0 +1 @@ +(function(b){var a={crosshair:{mode:null,color:"rgba(170, 0, 0, 0.80)",lineWidth:1}};function c(h){var j={x:-1,y:-1,locked:false};h.setCrosshair=function e(l){if(!l){j.x=-1}else{var k=h.p2c(l);j.x=Math.max(0,Math.min(k.left,h.width()));j.y=Math.max(0,Math.min(k.top,h.height()))}h.triggerRedrawOverlay()};h.clearCrosshair=h.setCrosshair;h.lockCrosshair=function f(k){if(k){h.setCrosshair(k)}j.locked=true};h.unlockCrosshair=function g(){j.locked=false};function d(k){if(j.locked){return}if(j.x!=-1){j.x=-1;h.triggerRedrawOverlay()}}function i(k){if(j.locked){return}if(h.getSelection&&h.getSelection()){j.x=-1;return}var l=h.offset();j.x=Math.max(0,Math.min(k.pageX-l.left,h.width()));j.y=Math.max(0,Math.min(k.pageY-l.top,h.height()));h.triggerRedrawOverlay()}h.hooks.bindEvents.push(function(l,k){if(!l.getOptions().crosshair.mode){return}k.mouseout(d);k.mousemove(i)});h.hooks.drawOverlay.push(function(m,k){var n=m.getOptions().crosshair;if(!n.mode){return}var l=m.getPlotOffset();k.save();k.translate(l.left,l.top);if(j.x!=-1){k.strokeStyle=n.color;k.lineWidth=n.lineWidth;k.lineJoin="round";k.beginPath();if(n.mode.indexOf("x")!=-1){k.moveTo(j.x,0);k.lineTo(j.x,m.height())}if(n.mode.indexOf("y")!=-1){k.moveTo(0,j.y);k.lineTo(m.width(),j.y)}k.stroke()}k.restore()});h.hooks.shutdown.push(function(l,k){k.unbind("mouseout",d);k.unbind("mousemove",i)})}b.plot.plugins.push({init:c,options:a,name:"crosshair",version:"1.0"})})(jQuery); \ No newline at end of file diff --git a/pandora_console/include/graphs/flot/jquery.flot.min.js b/pandora_console/include/graphs/flot/jquery.flot.min.js new file mode 100644 index 0000000000..4467fc5d8c --- /dev/null +++ b/pandora_console/include/graphs/flot/jquery.flot.min.js @@ -0,0 +1,6 @@ +/* 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;g1){N.series.pie.tilt=1}if(N.series.pie.tilt<0){N.series.pie.tilt=0}O.hooks.processDatapoints.push(E);O.hooks.drawOverlay.push(H);O.hooks.draw.push(r)}}function e(P,N){var O=P.getOptions();if(O.series.pie.show&&O.grid.hoverable){N.unbind("mousemove").mousemove(t)}if(O.series.pie.show&&O.grid.clickable){N.unbind("click").click(l)}}function G(O){var P="";function N(S,T){if(!T){T=0}for(var R=0;Rh.width-n){B=h.width-n}}}function v(O){for(var N=0;N0){R.push({data:[[1,P]],color:N,label:a.series.pie.combine.label,angle:(P*(Math.PI*2))/M,percent:(P/M*100)})}return R}function r(S,Q){if(!L){return}ctx=Q;I();var T=S.getData();var P=0;while(F&&P0){n*=w}P+=1;N();if(a.series.pie.tilt<=0.8){O()}R()}if(P>=o){N();L.prepend('
Could not draw pie with labels contained inside canvas
')}if(S.setSeries&&S.insertLegend){S.setSeries(T);S.insertLegend()}function N(){ctx.clearRect(0,0,h.width,h.height);L.children().filter(".pieLabel, .pieLabelBackground").remove()}function O(){var Z=5;var Y=15;var W=10;var X=0.02;if(a.series.pie.radius>1){var U=a.series.pie.radius}else{var U=n*a.series.pie.radius}if(U>=(h.width/2)-Z||U*a.series.pie.tilt>=(h.height/2)-Y||U<=W){return}ctx.save();ctx.translate(Z,Y);ctx.globalAlpha=X;ctx.fillStyle="#000";ctx.translate(B,p);ctx.scale(1,a.series.pie.tilt);for(var V=1;V<=W;V++){ctx.beginPath();ctx.arc(0,0,U,0,Math.PI*2,false);ctx.fill();U-=V}ctx.restore()}function R(){startAngle=Math.PI*a.series.pie.startAngle;if(a.series.pie.radius>1){var U=a.series.pie.radius}else{var U=n*a.series.pie.radius}ctx.save();ctx.translate(B,p);ctx.scale(1,a.series.pie.tilt);ctx.save();var Y=startAngle;for(var W=0;W1e-9){ctx.moveTo(0,0)}else{if(b.browser.msie){ab-=0.0001}}ctx.arc(0,0,U,Y,Y+ab,false);ctx.closePath();Y+=ab;if(aa){ctx.fill()}else{ctx.stroke()}}function V(){var ac=startAngle;if(a.series.pie.label.radius>1){var Z=a.series.pie.label.radius}else{var Z=n*a.series.pie.label.radius}for(var ab=0;ab=a.series.pie.label.threshold*100){aa(T[ab],ac,ab)}ac+=T[ab].angle}function aa(ap,ai,ag){if(ap.data[0][1]==0){return}var ar=a.legend.labelFormatter,aq,ae=a.series.pie.label.formatter;if(ar){aq=ar(ap.label,ap)}else{aq=ap.label}if(ae){aq=ae(aq,ap)}var aj=((ai+ap.angle)+ai)/2;var ao=B+Math.round(Math.cos(aj)*Z);var am=p+Math.round(Math.sin(aj)*Z)*a.series.pie.tilt;var af=''+aq+"";L.append(af);var an=L.children("#pieLabel"+ag);var ad=(am-an.height()/2);var ah=(ao-an.width()/2);an.css("top",ad);an.css("left",ah);if(0-ad>0||0-ah>0||h.height-(ad+an.height())<0||h.width-(ah+an.width())<0){F=true}if(a.series.pie.label.background.opacity!=0){var ak=a.series.pie.label.background.color;if(ak==null){ak=ap.color}var al="top:"+ad+"px;left:"+ah+"px;";b('
').insertBefore(an).css("opacity",a.series.pie.label.background.opacity)}}}}}function J(N){if(a.series.pie.innerRadius>0){N.save();innerRadius=a.series.pie.innerRadius>1?a.series.pie.innerRadius:n*a.series.pie.innerRadius;N.globalCompositeOperation="destination-out";N.beginPath();N.fillStyle=a.series.pie.stroke.color;N.arc(0,0,innerRadius,0,Math.PI*2,false);N.fill();N.closePath();N.restore();N.save();N.beginPath();N.strokeStyle=a.series.pie.stroke.color;N.arc(0,0,innerRadius,0,Math.PI*2,false);N.stroke();N.closePath();N.restore()}}function s(Q,R){for(var S=false,P=-1,N=Q.length,O=N-1;++P1?O.series.pie.radius:n*O.series.pie.radius;for(var Q=0;Q1?P.series.pie.radius:n*P.series.pie.radius;R.save();R.translate(B,p);R.scale(1,P.series.pie.tilt);for(i=0;i1e-9){R.moveTo(0,0)}R.arc(0,0,N,S.startAngle,S.startAngle+S.angle,false);R.closePath();R.fill()}}}var a={series:{pie:{show:false,radius:"auto",innerRadius:0,startAngle:3/2,tilt:1,offset:{top:0,left:"auto"},stroke:{color:"#FFF",width:1},label:{show:"auto",formatter:function(d,e){return'
'+d+"
"+Math.round(e.percent)+"%
"},radius:1,background:{color:null,opacity:0},threshold:0},combine:{threshold:-1,color:null,label:"Other"},highlight:{opacity:0.5}}}};b.plot.plugins.push({init:c,options:a,name:"pie",version:"1.0"})})(jQuery); \ No newline at end of file diff --git a/pandora_console/include/graphs/flot/jquery.flot.resize.min.js b/pandora_console/include/graphs/flot/jquery.flot.resize.min.js new file mode 100644 index 0000000000..1fa0771f57 --- /dev/null +++ b/pandora_console/include/graphs/flot/jquery.flot.resize.min.js @@ -0,0 +1 @@ +(function(n,p,u){var w=n([]),s=n.resize=n.extend(n.resize,{}),o,l="setTimeout",m="resize",t=m+"-special-event",v="delay",r="throttleWindow";s[v]=250;s[r]=true;n.event.special[m]={setup:function(){if(!s[r]&&this[l]){return false}var a=n(this);w=w.add(a);n.data(this,t,{w:a.width(),h:a.height()});if(w.length===1){q()}},teardown:function(){if(!s[r]&&this[l]){return false}var a=n(this);w=w.not(a);a.removeData(t);if(!w.length){clearTimeout(o)}},add:function(b){if(!s[r]&&this[l]){return false}var c;function a(d,h,g){var f=n(this),e=n.data(this,t);e.w=h!==u?h:f.width();e.h=g!==u?g:f.height();c.apply(this,arguments)}if(n.isFunction(b)){c=b;return a}else{c=b.handler;b.handler=a}}};function q(){o=p[l](function(){w.each(function(){var d=n(this),a=d.width(),b=d.height(),c=n.data(this,t);if(a!==c.w||b!==c.h){d.trigger(m,[c.w=a,c.h=b])}});q()},s[v])}})(jQuery,this);(function(b){var a={};function c(f){function e(){var h=f.getPlaceholder();if(h.width()==0||h.height()==0){return}f.resize();f.setupGrid();f.draw()}function g(i,h){i.getPlaceholder().resize(e)}function d(i,h){i.getPlaceholder().unbind("resize",e)}f.hooks.bindEvents.push(g);f.hooks.shutdown.push(d)}b.plot.plugins.push({init:c,options:a,name:"resize",version:"1.0"})})(jQuery); \ No newline at end of file diff --git a/pandora_console/include/graphs/flot/jquery.flot.selection.min.js b/pandora_console/include/graphs/flot/jquery.flot.selection.min.js new file mode 100644 index 0000000000..badc0052db --- /dev/null +++ b/pandora_console/include/graphs/flot/jquery.flot.selection.min.js @@ -0,0 +1 @@ +(function(a){function b(k){var p={first:{x:-1,y:-1},second:{x:-1,y:-1},show:false,active:false};var m={};var r=null;function e(s){if(p.active){l(s);k.getPlaceholder().trigger("plotselecting",[g()])}}function n(s){if(s.which!=1){return}document.body.focus();if(document.onselectstart!==undefined&&m.onselectstart==null){m.onselectstart=document.onselectstart;document.onselectstart=function(){return false}}if(document.ondrag!==undefined&&m.ondrag==null){m.ondrag=document.ondrag;document.ondrag=function(){return false}}d(p.first,s);p.active=true;r=function(t){j(t)};a(document).one("mouseup",r)}function j(s){r=null;if(document.onselectstart!==undefined){document.onselectstart=m.onselectstart}if(document.ondrag!==undefined){document.ondrag=m.ondrag}p.active=false;l(s);if(f()){i()}else{k.getPlaceholder().trigger("plotunselected",[]);k.getPlaceholder().trigger("plotselecting",[null])}return false}function g(){if(!f()){return null}var u={},t=p.first,s=p.second;a.each(k.getAxes(),function(v,w){if(w.used){var y=w.c2p(t[w.direction]),x=w.c2p(s[w.direction]);u[v]={from:Math.min(y,x),to:Math.max(y,x)}}});return u}function i(){var s=g();k.getPlaceholder().trigger("plotselected",[s]);if(s.xaxis&&s.yaxis){k.getPlaceholder().trigger("selected",[{x1:s.xaxis.from,y1:s.yaxis.from,x2:s.xaxis.to,y2:s.yaxis.to}])}}function h(t,u,s){return us?s:u)}function d(w,t){var v=k.getOptions();var u=k.getPlaceholder().offset();var s=k.getPlotOffset();w.x=h(0,t.pageX-u.left-s.left,k.width());w.y=h(0,t.pageY-u.top-s.top,k.height());if(v.selection.mode=="y"){w.x=w==p.first?0:k.width()}if(v.selection.mode=="x"){w.y=w==p.first?0:k.height()}}function l(s){if(s.pageX==null){return}d(p.second,s);if(f()){p.show=true;k.triggerRedrawOverlay()}else{q(true)}}function q(s){if(p.show){p.show=false;k.triggerRedrawOverlay();if(!s){k.getPlaceholder().trigger("plotunselected",[])}}}function c(s,w){var t,y,z,A,x=k.getAxes();for(var u in x){t=x[u];if(t.direction==w){A=w+t.n+"axis";if(!s[A]&&t.n==1){A=w+"axis"}if(s[A]){y=s[A].from;z=s[A].to;break}}}if(!s[A]){t=w=="x"?k.getXAxes()[0]:k.getYAxes()[0];y=s[w+"1"];z=s[w+"2"]}if(y!=null&&z!=null&&y>z){var v=y;y=z;z=v}return{from:y,to:z,axis:t}}function o(t,s){var v,u,w=k.getOptions();if(w.selection.mode=="y"){p.first.x=0;p.second.x=k.width()}else{u=c(t,"x");p.first.x=u.axis.p2c(u.from);p.second.x=u.axis.p2c(u.to)}if(w.selection.mode=="x"){p.first.y=0;p.second.y=k.height()}else{u=c(t,"y");p.first.y=u.axis.p2c(u.from);p.second.y=u.axis.p2c(u.to)}p.show=true;k.triggerRedrawOverlay();if(!s&&f()){i()}}function f(){var s=5;return Math.abs(p.second.x-p.first.x)>=s&&Math.abs(p.second.y-p.first.y)>=s}k.clearSelection=q;k.setSelection=o;k.getSelection=g;k.hooks.bindEvents.push(function(t,s){var u=t.getOptions();if(u.selection.mode!=null){s.mousemove(e);s.mousedown(n)}});k.hooks.drawOverlay.push(function(v,D){if(p.show&&f()){var t=v.getPlotOffset();var s=v.getOptions();D.save();D.translate(t.left,t.top);var z=a.color.parse(s.selection.color);D.strokeStyle=z.scale("a",0.8).toString();D.lineWidth=1;D.lineJoin="round";D.fillStyle=z.scale("a",0.4).toString();var B=Math.min(p.first.x,p.second.x),A=Math.min(p.first.y,p.second.y),C=Math.abs(p.second.x-p.first.x),u=Math.abs(p.second.y-p.first.y);D.fillRect(B,A,C,u);D.strokeRect(B,A,C,u);D.restore()}});k.hooks.shutdown.push(function(t,s){s.unbind("mousemove",e);s.unbind("mousedown",n);if(r){a(document).unbind("mouseup",r)}})}a.plot.plugins.push({init:b,options:{selection:{mode:null,color:"#e8cfac"}},name:"selection",version:"1.1"})})(jQuery); \ No newline at end of file diff --git a/pandora_console/include/graphs/flot/jquery.flot.stack.min.js b/pandora_console/include/graphs/flot/jquery.flot.stack.min.js new file mode 100644 index 0000000000..bba2a0e5ff --- /dev/null +++ b/pandora_console/include/graphs/flot/jquery.flot.stack.min.js @@ -0,0 +1 @@ +(function(b){var a={series:{stack:null}};function c(f){function d(k,j){var h=null;for(var g=0;g2&&(G?g.format[2].x:g.format[2].y),n=u&&v.lines.steps,E=true,q=G?1:0,H=G?0:1,D=0,B=0,A;while(true){if(D>=F.length){break}A=t.length;if(F[D]==null){for(m=0;m=y.length){if(!u){for(m=0;mJ){if(u&&D>0&&F[D-z]!=null){k=w+(F[D-z+H]-w)*(J-x)/(F[D-z+q]-x);t.push(J);t.push(k+I);for(m=2;m0&&y[B-h]!=null){r=I+(y[B-h+H]-I)*(x-J)/(y[B-h+q]-J)}t[A+H]+=r;D+=z}}E=false;if(A!=t.length&&o){t[A+2]+=r}}}}if(n&&A!=t.length&&A>0&&t[A]!=null&&t[A]!=t[A-z]&&t[A+1]!=t[A-z+1]){for(m=0;m 0 && origpoints[i - ps] != null) { + var interx = (x - origpoints[i - ps]) / (y - origpoints[i - ps + 1]) * (below - y) + x; + prevp.push(interx); + prevp.push(below); + for (m = 2; m < ps; ++m) + prevp.push(origpoints[i + m]); + + p.push(null); // start new segment + p.push(null); + for (m = 2; m < ps; ++m) + p.push(origpoints[i + m]); + p.push(interx); + p.push(below); + for (m = 2; m < ps; ++m) + p.push(origpoints[i + m]); + } + + p.push(x); + p.push(y); + if (thresholded.lines.fill) { + p.push(0) + } + } + + datapoints.points = newpoints; + thresholded.datapoints.points = threspoints; + + if (thresholded.datapoints.points.length > 0) + plot.getData().push(thresholded); + + // FIXME: there are probably some edge cases left in bars + } + + function iterateThresholds(plot, s, datapoints) { + if(!s.threshold) + return; + + if(s.threshold instanceof Array) { + s.threshold.sort(function(a, b) { + return a.below - b.below; + }); + + $(s.threshold).each(function(i, th) { + thresholdData(plot, s, datapoints, th.below, th.color); + }); + } else { + thresholdData(plot, s, datapoints, s.threshold.below, s.threshold.color); + } + } + + plot.hooks.processDatapoints.push(iterateThresholds); + } + + $.plot.plugins.push({ + init: init, + options: options, + name: 'threshold', + version: '1.0' + }); +})(jQuery); diff --git a/pandora_console/include/graphs/flot/pandora.flot.js b/pandora_console/include/graphs/flot/pandora.flot.js new file mode 100644 index 0000000000..ba28777a08 --- /dev/null +++ b/pandora_console/include/graphs/flot/pandora.flot.js @@ -0,0 +1,912 @@ +/* + + +*/ + +function pandoraFlotPie(graph_id, values, labels, nseries, width, font_size, water_mark, separator) { + var labels = labels.split(separator); + var data = values.split(separator); + + for( var i = 0; i'+label+'
'+Math.round(series.percent)+'%'; + }, + background: { + opacity: 0.5, + color: '#000' + } + }; + } + + var plot = $jq161.plot($('#'+graph_id), data, + { + series: { + pie: { + show: true, + radius: 3/4, + label: label_conf + //$label_str + } + }, + legend: { + show: true + }, + grid: { + hoverable: true, + clickable: true + } + }); + + var legends = $('#'+graph_id+' .legendLabel'); + legends.each(function () { + // fix the widths so they don't jump around + $(this).css('width', $(this).width()+5); + }); + + // Events + $jq161('#'+graph_id).bind('plothover', pieHover); + $jq161('#'+graph_id).bind('plotclick', pieClick); + $jq161('#'+graph_id).bind('mouseout',resetInteractivity); + + function pieHover(event, pos, obj) + { + if (!obj) + return; + + index = obj.seriesIndex; + legends.css('font-weight', ''); + legends.eq(index).css('font-weight', 'bold'); + } + + // Reset styles + function resetInteractivity() { + legends.each(function () { + // fix the widths so they don't jump around + $(this).css('font-weight', ''); + }); + } + + if(water_mark) { + // Set the watermark position + $('#watermark_image_'+graph_id)[0].onload = function() { + var canvaslimit_right = parseInt(plot.offset().left + plot.width()); + var canvaslimit_bottom = parseInt(plot.offset().top + plot.height()); + $('#watermark_'+graph_id).css('left',canvaslimit_right-parseInt(this.width)); + $('#watermark_'+graph_id).css('top',canvaslimit_bottom-parseInt(this.height)); + $('#watermark_'+graph_id).show(); + } + } +} + +function pandoraFlotHBars(graph_id, values, labels, water_mark, maxvalue, water_mark, separator, separator2) { + + values = values.split(separator2); + var datas = new Array(); + + for(i=0;i'+v+''; + } + + // Events + $jq161('#'+graph_id).bind('plothover', function (event, pos, item) { + $('.values_'+graph_id).css('font-weight', ''); + if(item != null) { + index = item.dataIndex; + $('#value_'+index+'_'+graph_id).css('font-weight', 'bold'); + } + }); + + if(water_mark) { + // Adjust the menu image on top of the plot + $('#watermark_image_'+graph_id)[0].onload = function() { + var canvaslimit_right = parseInt(plot.offset().left + plot.width()); + var canvaslimit_bottom = parseInt(plot.offset().top + plot.height()); + $('#watermark_'+graph_id).css('left',canvaslimit_right); + $('#watermark_'+graph_id).css('top',canvaslimit_bottom-parseInt(this.height)); + $('#watermark_'+graph_id).show(); + } + } +} + +function pandoraFlotVBars(graph_id, values, labels, water_mark, maxvalue, water_mark, separator, separator2) { + + values = values.split(separator2); + var datas = new Array(); + + for(i=0;i'+v+''; + } + + // Events + //~ $jq161('#'+graph_id).bind('plothover', function (event, pos, item) { + //~ $('.values_'+graph_id).css('font-weight', ''); + //~ if(item != null) { + //~ index = item.dataIndex; + //~ $('#value_'+index+'_'+graph_id).css('font-weight', 'bold'); + //~ } + //~ }); + + if(water_mark) { + // Adjust the menu image on top of the plot + $('#watermark_image_'+graph_id)[0].onload = function() { + var canvaslimit_right = parseInt(plot.offset().left + plot.width()); + var canvaslimit_bottom = parseInt(plot.offset().top + plot.height()); + $('#watermark_'+graph_id).css('left',canvaslimit_right); + $('#watermark_'+graph_id).css('top',canvaslimit_bottom-parseInt(this.height)); + $('#watermark_'+graph_id).show(); + } + } +} + +function pandoraFlotSlicebar(graph_id, values, datacolor, labels, legend, acumulate_data, intervaltick, water_mark, maxvalue, separator, separator2) { + + values = values.split(separator2); + labels = labels.split(separator); + legend = legend.split(separator); + acumulate_data = acumulate_data.split(separator); + datacolor = datacolor.split(separator); + + var datas = new Array(); + + for(i=0;i' + legend[i] + ''; + } + } + return ''; + } +} + +function pandoraFlotArea(graph_id, values, labels, labels_long, legend, colors, type, serie_types, water_mark, width, max_x, homeurl, unit, font_size, menu, events, event_ids, legend_events, alerts, alert_ids, legend_alerts, separator, separator2) { + + var threshold = false; + + values = values.split(separator2); + serie_types = serie_types.split(separator); + labels_long = labels_long.split(separator); + labels = labels.split(separator); + legend = legend.split(separator); + events = events.split(separator); + event_ids = event_ids.split(separator); + alerts = alerts.split(separator); + alert_ids = alert_ids.split(separator); + colors = colors.split(separator); + + var eventsz = new Array(); + $.each(events,function(i,v) { + eventsz[event_ids[i]] = v; + }); + + var alertsz = new Array(); + $.each(alerts,function(i,v) { + alertsz[alert_ids[i]] = v; + }); + + switch(type) { + case 'line_simple': + stacked = null; + filled = false; + break; + case 'line_stacked': + stacked = 'stack'; + filled = false; + break; + case 'area_simple': + stacked = null; + filled = true; + break; + case 'area_stacked': + stacked = 'stack'; + filled = true; + break; + } + + var datas = new Array(); + + vwarning_min = 60; + vwarning_max = 70; + vcritical_min = 70; + vcritical_max = -1; + + for(i=0;i axes.xaxis.max || + pos.y < axes.yaxis.min || pos.y > axes.yaxis.max) { + return; + } + + var j, dataset = currentPlot.getData(); + + var i = 0; + for (k = 0; k < dataset.length; ++k) { + + // k is the real series counter + // i is the series counter without thresholds + var series = dataset[k]; + + if(series.label == null) { + continue; + } + + // find the nearest points, x-wise + for (j = 0; j < series.data.length; ++j) + if (series.data[j][0] > pos.x) { + break; + } + + var y = series.data[j][1]; + + if(currentRanges == null || (currentRanges.xaxis.from < j && j < currentRanges.xaxis.to)) { + $jq161('#timestamp_'+graph_id).show(); + if(width < 400) { + $('#timestamp_'+graph_id).text(labels[j] + ' (' + parseFloat(y).toFixed(2) + ')'); + } + else { + $('#timestamp_'+graph_id).text(labels_long[j]); + } + + $('#timestamp_'+graph_id).css('top', plot.offset().top); + + var timesize = $('#timestamp_'+graph_id).width(); + + if(currentRanges != null) { + dataset = plot.getData(); + } + + var timenewpos = dataset[0].xaxis.p2c(pos.x)+plot.offset().left; + + var canvaslimit = plot.offset().left + plot.width(); + + if(timesize+timenewpos > canvaslimit) { + $('#timestamp_'+graph_id).css('left', timenewpos - timesize); + } + else { + $('#timestamp_'+graph_id).css('left', timenewpos); + } + } + else { + $jq161('#timestamp_'+graph_id).hide(); + } + + var label_aux = series.label + ' = '; + + if(serie_types[i] != 'points') { + legends.eq(i).text(label_aux.replace(/=.*/, '= ' + parseFloat(y).toFixed(2) +' '+unit)); + } + + legends.eq(i).css('font-size',font_size+'pt'); + legends.eq(i).css('color','#000'); + + i++; + } + } + + // Events + $jq161('#'+graph_id).bind('plothover', function (event, pos, item) { + overview.setCrosshair({ x: pos.x, y: 0 }); + currentPlot = plot; + latestPosition = pos; + if (!updateLegendTimeout) { + updateLegendTimeout = setTimeout(updateLegend, 50); + } + + }); + + $jq161('#'+graph_id).bind("plotclick", function (event, pos, item) { + plot.unhighlight(); + if (item) { + plot.unhighlight(); + var canvaslimit = parseInt(plot.offset().left + plot.width()); + var dataset = plot.getData(); + var timenewpos = parseInt(dataset[0].xaxis.p2c(pos.x)+plot.offset().left); + var extrasize = parseInt($('#extra_'+graph_id).css('width').split('px')[0]); + + var left_pos; + if(extrasize+timenewpos > canvaslimit) { + left_pos = timenewpos - extrasize - 20; + } + else { + left_pos = timenewpos + 20; + } + + var extra_info = 'No info to show'; + var extra_show = false; + + $('#extra_'+graph_id).css('left',left_pos); + $('#extra_'+graph_id).css('top',plot.offset().top + 25); + switch(item.series.label) { + case legend_alerts: + extra_info = ''+legend_alerts+' - '+labels_long[item.dataIndex]+''+get_event_details(alertsz[item.dataIndex]); + extra_show = true; + break; + case legend_events: + extra_info = ''+legend_events+' - '+labels_long[item.dataIndex]+''+get_event_details(eventsz[item.dataIndex]); + extra_show = true; + break; + } + + if(extra_show) { + $('#extra_'+graph_id).html(extra_info); + $('#extra_'+graph_id).css('display',''); + } + plot.highlight(item.series, item.datapoint); + } + else { + $('#extra_'+graph_id).css('display','none'); + } + }); + + $jq161('#overview_'+graph_id).bind('plothover', function (event, pos, item) { + plot.setCrosshair({ x: pos.x, y: 0 }); + currentPlot = overview; + latestPosition = pos; + if (!updateLegendTimeout) { + updateLegendTimeout = setTimeout(updateLegend, 50); + } + }); + + $jq161('#'+graph_id).bind('mouseout',resetInteractivity); + $jq161('#overview_'+graph_id).bind('mouseout',resetInteractivity); + + // Reset interactivity styles + function resetInteractivity() { + $('#timestamp_'+graph_id).hide(); + dataset = plot.getData(); + for (i = 0; i < dataset.length; ++i) { + legends.eq(i).text(legends.eq(i).text().replace(/=.*/, '')); + } + plot.clearCrosshair(); + overview.clearCrosshair(); + } + + // Format functions + function xFormatter(v, axis) { + if(labels[v] == undefined) { + return ''; + } + return '
'+labels[v]+'
'; + } + + function yFormatter(v, axis) { + return '
'+v+' '+unit+'
'; + } + + function lFormatter(v, axis) { + return '
'+v+'
'; + } + + if(menu) { + $('#menu_overview_'+graph_id).click(function() { + $('#overview_'+graph_id).toggle(); + }); + + $('#menu_cancelzoom_'+graph_id).click(function() { + // cancel the zooming + plot = $jq161.plot($('#'+graph_id), datas, + $jq161.extend(true, {}, options, { + xaxis: { min: 0, max: max_x }, + legend: { show: false } + })); + + $('#menu_cancelzoom_'+graph_id).attr('src',homeurl+'/images/zoom_cross.disabled.png'); + overview.clearSelection(); + }); + + // Adjust the menu image on top of the plot + $('#menu_overview_'+graph_id)[0].onload = function() { + var canvaslimit_right = parseInt(plot.offset().left + plot.width() - 20); + var canvaslimit_top = parseInt(plot.offset().top - 8); + var n_options = parseInt($('#menu_'+graph_id).children().length); + $('#menu_'+graph_id).css('left',canvaslimit_right-parseInt(this.width)*n_options); + $('#menu_'+graph_id).css('top',canvaslimit_top-parseInt(this.height)); + $('#menu_'+graph_id).show(); + } + } + + if(water_mark) { + // Adjust the menu image on top of the plot + $('#watermark_image_'+graph_id)[0].onload = function() { + var canvaslimit_right = parseInt(plot.offset().left + plot.width()); + var canvaslimit_bottom = parseInt(plot.offset().top + plot.height()); + $('#watermark_'+graph_id).css('left',canvaslimit_right); + $('#watermark_'+graph_id).css('top',canvaslimit_bottom-parseInt(this.height)); + $('#watermark_'+graph_id).show(); + } + } +} + +function get_event_details (event_ids) { + var inputs = []; + var table; + inputs.push ("get_events_details=1"); + inputs.push ("event_ids="+event_ids); + inputs.push ("page=include/ajax/events"); + jQuery.ajax ({ + data: inputs.join ("&"), + type: 'GET', + url: action="../../ajax.php", + timeout: 10000, + dataType: 'html', + async: false, + success: function (data) { + table = data; + } + }); + + return table; +} diff --git a/pandora_console/include/graphs/functions_flot.php b/pandora_console/include/graphs/functions_flot.php new file mode 100644 index 0000000000..ceffe171de --- /dev/null +++ b/pandora_console/include/graphs/functions_flot.php @@ -0,0 +1,1080 @@ + + + + + + + + + + + + +'; + +/////////////////////////////// +////////// AREA GRAPHS //////// +/////////////////////////////// +function flot_area_stacked_graph($chart_data, $width, $height, $color, $legend, $long_index, $homeurl = '', $unit = '', $water_mark = '', $serie_types = array(), $chart_extra_data = array()) { + global $config; + + return flot_area_graph($chart_data, $width, $height, $color, $legend, $long_index, $homeurl, $unit, 'area_stacked', $water_mark, $serie_types, $chart_extra_data); +} + +function flot_area_simple_graph($chart_data, $width, $height, $color, $legend, $long_index, $homeurl = '', $unit = '', $water_mark = '', $serie_types = array(), $chart_extra_data = array()) { + global $config; + + return flot_area_graph($chart_data, $width, $height, $color, $legend, $long_index, $homeurl, $unit, 'area_simple', $water_mark, $serie_types, $chart_extra_data); +} + +function flot_line_stacked_graph($chart_data, $width, $height, $color, $legend, $long_index, $homeurl = '', $unit = '', $water_mark = '', $serie_types = array(), $chart_extra_data = array()) { + global $config; + + return flot_area_graph($chart_data, $width, $height, $color, $legend, $long_index, $homeurl, $unit, 'line_stacked', $water_mark, $serie_types, $chart_extra_data); +} + +function flot_line_simple_graph($chart_data, $width, $height, $color, $legend, $long_index, $homeurl = '', $unit = '', $water_mark = '', $serie_types = array(), $chart_extra_data = array()) { + global $config; + + return flot_area_graph($chart_data, $width, $height, $color, $legend, $long_index, $homeurl, $unit, 'line_simple', $water_mark, $serie_types, $chart_extra_data); +} + +function flot_area_graph($chart_data, $width, $height, $color, $legend, $long_index, $homeurl, $unit, $type, $water_mark, $serie_types, $chart_extra_data) { + global $config; + + $menu = true; + $font_size = '7'; + + // Get a unique identifier to graph + $graph_id = uniqid('graph_'); + + // Set some containers to legend, graph, timestamp tooltip, etc. + $return = "

"; + $return .= "
"; + $return .= ""; + $return .= ""; + + if($water_mark != '') { + $return .= ""; + $watermark = 'true'; + } + else { + $watermark = 'false'; + } + + // Set a weird separator to serialize and unserialize passing data from php to javascript + $separator = ';;::;;'; + $separator2 = ':,:,,,:,:'; + + // Transform data from our format to library format + $labels = array(); + $a = array(); + $vars = array(); + $serie_types2 = array(); + + $colors = array(); + foreach($legend as $serie_key => $serie) { + if(isset($color[$serie_key])) { + $colors[] = $color[$serie_key]['color']; + } + else { + $colors[] = ''; + } + } + + foreach($chart_data as $label => $values) { + $labels[] = io_safe_output($label); + + foreach($values as $key => $value) { + $jsvar = "data_".$graph_id."_".$key; + + if(!isset($serie_types[$key])) { + $serie_types2[$jsvar] = 'line'; + } + else { + $serie_types2[$jsvar] = $serie_types[$key]; + } + + if($serie_types2[$jsvar] == 'points' && $value == 0) { + $data[$jsvar][] = 'null'; + } + else { + $data[$jsvar][] = $value; + } + } + } + + // Store data series in javascript format + $jsvars = ''; + $jsseries = array(); + $values2 = array(); + $i = 0; + $max_x = 0; + foreach($data as $jsvar => $values) { + $n_values = count($values); + if($n_values > $max_x) { + $max_x = $n_values; + } + + $values2[] = implode($separator,$values); + $i ++; + } + + $values = implode($separator2, $values2); + + // Max is "n-1" because start with 0 + $max_x--; + + if($menu) { + $return .= ""; + } + $extra_height = $height - 50; + $extra_width = (int)($width / 3); + + $return .= ""; + + // Process extra data + $events = array(); + $event_ids = array(); + $alerts = array(); + $alert_ids = array(); + $legend_events = ''; + $legend_alerts = ''; + + foreach($chart_extra_data as $i => $data) { + switch($i) { + case 'legend_alerts': + $legend_alerts = $data; + break; + case 'legend_events': + $legend_events = $data; + break; + default: + if(isset($data['events'])) { + $event_ids[] = $i; + $events[$i] = $data['events']; + } + if(isset($data['alerts'])) { + $alert_ids[] = $i; + $alerts[$i] = $data['alerts']; + } + break; + } + } + + // Store serialized data to use it from javascript + $events = implode($separator,$events); + $event_ids = implode($separator,$event_ids); + $alerts = implode($separator,$alerts); + $alert_ids = implode($separator,$alert_ids); + $labels = implode($separator,$labels); + $labels_long = implode($separator,$long_index); + $legend = io_safe_output(implode($separator,$legend)); + $serie_types = implode($separator, $serie_types2); + $colors = implode($separator, $colors); + + // Javascript code + $return .= ""; + + return $return; +} + +/////////////////////////////// +///// END OF AREA GRAPHS ////// +/////////////////////////////// + +function fs_line_graph2($chart_data, $width, $height, $color, $legend, $long_index) { + global $config; + + $graph_type = "MSLine"; + + $chart = new FusionCharts($graph_type, $width, $height); + + + $pixels_between_xdata = 25; + $max_xdata_display = round($width / $pixels_between_xdata); + $ndata = count($chart_data); + if($max_xdata_display > $ndata) { + $xdata_display = $ndata; + } + else { + $xdata_display = $max_xdata_display; + } + + $step = round($ndata/$xdata_display); + + + if(is_array(reset($chart_data))) { + $data2 = array(); + $count = 0; + foreach($chart_data as $i =>$values) { + $count++; + $show_name = '0'; + if (($count % $step) == 0) { + $show_name = '1'; + } + + if (isset($long_index[$i])) { + $chart->addCategory($i, //''); + 'hoverText=' . $long_index[$i] . + ';showName=' . $show_name); + } + else { + $chart->addCategory($i, 'showName=' . $show_name); + } + + $c = 0; + foreach($values as $i2 => $value) { + $data2[$i2][$i] = $value; + $c++; + } + } + $data = $data2; + } + else { + $data = array($chart_data); + } + + $a = 0; + + $empty = 1; + foreach ($data as $i => $value) { + + $legend_text = ''; + if (isset($legend[$i])) { + $legend_text = $legend[$i]; + } + + $alpha = ''; + $areaBorderColor = ''; + $color = ''; + $showAreaBorder = 1; //0 old default + if (isset($color[$i])) { + if (!isset($color[$i]['border'])) { + $showAreaBorder = 1; + } + + if (isset($color[$i]['alpha'])) { + $alpha = 'alpha=' . $color[$i]['alpha'] . ';'; + } + + if (isset($color[$i]['border'])) { + $areaBorderColor = 'areaBorderColor=' . $color[$i]['border'] . ';'; + } + + if (isset($color[$i]['color'])) { + $color = 'color=#' . $color[$i]['color']; + } + } + + $chart->addDataSet($legend_text, $alpha . + 'showAreaBorder=' . $showAreaBorder . ';' . + $areaBorderColor . + $color); + + $count = 0; + $step = 10; + $num_vlines = 0; + + foreach ($value as $i2 => $v) { + if ($count++ % $step == 0) { + $show_name = '1'; + $num_vlines++; + } + else { + $show_name = '0'; + } + + $empty = 0; + + if ($a < 3) { + $a++; +// $chart->addCategory(date('G:i', $i2), //''); +// 'hoverText=' . date (html_entity_decode ($config['date_format'], ENT_QUOTES, "UTF-8"), $i2) . +// ';showName=' . $show_name); + } + + //Add data + $chart->addChartData($v); + } + } + + $chart->setChartParams('animation=0;numVDivLines=' . $num_vlines . + ';showShadow=0;showAlternateVGridColor=1;showNames=1;rotateNames=1;' . + 'lineThickness=3;anchorRadius=0.5;showValues=0;baseFontSize=9;showLimits=0;' . + 'showAreaBorder=1;areaBorderThickness=0.1;areaBorderColor=000000' . ($empty == 1 ? ';yAxisMinValue=0;yAxisMaxValue=1' : '')); + + $random_number = uniqid(); + + $div_id = 'chart_div_' . $random_number; + $chart_id = 'chart_' . $random_number; + + + $output = '
'; + //$output .= ''; + $output .= ''; + + return $output; +} + +/////////////////////////////// +/////////////////////////////// +/////////////////////////////// + + +// Returns the number of seconds since the Epoch for a date in the format dd/mm/yyyy +function date_to_epoch2 ($date) { + $date_array = explode ('/', $date); + return mktime (0, 0, 0, $date_array [1], $date_array [0], $date_array [2]); +} + +// Returns the code needed to display the chart +function get_chart_code2 ($chart, $width, $height, $swf) { + $random_number = rand (); + $div_id = 'chart_div_' . $random_number; + $chart_id = 'chart_' . $random_number; + $output = '
'; + $output .= ''; + return $output; +} + +// Prints a FLOT pie chart +function flot_pie_chart ($values, $labels, $width, $height, $water_mark, $font = '', $font_size = 8) { + $series = sizeof($values); + if (($series != sizeof ($labels)) || ($series == 0) ){ + return; + } + + $graph_id = uniqid('graph_'); + + $return = "
"; + + if($water_mark != '') { + $return .= ""; + $water_mark = 'true'; + } + else { + $water_mark = 'false'; + } + + $separator = ';;::;;'; + + $labels = implode($separator,$labels); + $values = implode($separator,$values); + + $return .= ""; + + return $return; +} + +// Prints a 2D pie chart +function fs_2d_pie_chart2 ($data, $names, $width, $height, $background = "FFFFFF") { + if ((sizeof ($data) != sizeof ($names)) OR (sizeof($data) == 0) ){ + return; + } + + // Generate the XML + $chart = new FusionCharts("Pie3D", $width, $height); + $chart->setSWFPath("include/graphs/FusionCharts/"); + $params="showNames=1;showValues=0;showPercentageValues=0;baseFontSize=9;bgColor=$background;bgAlpha=100;canvasBgAlpha=100;"; + $chart->setChartParams($params); + + for ($i = 0; $i < sizeof ($data); $i++) { + $chart->addChartData($data[$i], 'name=' . clean_flash_string($names[$i])); + } + + // Return the code + return get_chart_code ($chart, $width, $height, 'include/graphs/FusionCharts/FCF_Pie2D.swf'); +} + +// Returns a 2D column chart +function fs_2d_column_chart2 ($data, $width, $height, $homeurl = '', $reduce_data_columns = false) { + if (sizeof ($data) == 0) { + return; + } + + // Generate the XML + $chart = new FusionCharts('Column2D', $width, $height); + + $pixels_between_xdata = 25; + $max_xdata_display = round($width / $pixels_between_xdata); + $ndata = count($data); + if($max_xdata_display > $ndata) { + $xdata_display = $ndata; + } + else { + $xdata_display = $max_xdata_display; + } + + $step = round($ndata/$xdata_display); + + if(is_array(reset($data))) { + $data2 = array(); + $count = 0; + foreach($data as $i =>$values) { + $count++; + $show_name = '0'; + if (($count % $step) == 0) { + $show_name = '1'; + } + + $chart->addCategory($i, //''); + 'hoverText=' . $i . + ';showName=' . $show_name); + + $c = 0; + $previous = false; + foreach($values as $i2 => $value) { + if ($reduce_data_columns) { + if ($previous !== false) { + if ($previous == $value) continue; + } + } + $data2[$i2][$i] = $value; + $c++; + + $previous = $value; + } + } + $data = $data2; + } + else { + $data = array($data); + } + + $empty = 0; + $num_vlines = 0; + $count = 0; + + foreach ($data as $legend_value => $values) { + + foreach($values as $name => $value) { + if (($count++ % $step) == 0) { + $show_name = '1'; + $num_vlines++; + } else { + $show_name = '0'; + } + if ($value != 0) { + $empty = 0; + } + $chart->addChartData($value, 'name=' . clean_flash_string($name) . ';showName=' . $show_name . ';color=95BB04'); + } + } + + $chart->setChartParams('decimalPrecision=0;showAlternateVGridColor=1; numVDivLines='.$num_vlines.';showNames=1;rotateNames=1;showValues=0;showPercentageValues=0;showLimits=0;baseFontSize=9;' +. ($empty == 1 ? ';yAxisMinValue=0;yAxisMaxValue=1' : '')); + + // Return the code + return get_chart_code ($chart, $width, $height, $homeurl . 'include/graphs/FusionCharts/FCF_Column2D.swf'); +} + +// Returns a BAR Horizontalchart +function fs_2d_hcolumn_chart2 ($data, $width, $height) { + if (sizeof ($data) == 0) { + return; + } + + // Generate the XML + $chart = new FusionCharts('Bar2D', $width, $height); + + $pixels_between_xdata = 25; + $max_xdata_display = round($width / $pixels_between_xdata); + $ndata = count($data); + if($max_xdata_display > $ndata) { + $xdata_display = $ndata; + } + else { + $xdata_display = $max_xdata_display; + } + + $step = round($ndata/$xdata_display); + + + if(is_array(reset($data))) { + $data2 = array(); + $count = 0; + foreach($data as $i =>$values) { + $count++; + $show_name = '0'; + if (($count % $step) == 0) { + $show_name = '1'; + } + + $chart->addCategory($i, //''); + 'hoverText=' . $i . + ';showName=' . $show_name); + + $c = 0; + foreach($values as $i2 => $value) { + $data2[$i2][$i] = $value; + $c++; + } + } + $data = $data2; + } + else { + $data = array($data); + } + + $empty = 0; + $num_vlines = 0; + $count = 0; + + foreach ($data as $legend_value => $values) { + + foreach($values as $name => $value) { + if (($count++ % $step) == 0) { + $show_name = '1'; + $num_vlines++; + } else { + $show_name = '0'; + } + if ($value != 0) { + $empty = 0; + } + $chart->addChartData($value, 'name=' . clean_flash_string($name) . ';showName=' . $show_name/* . ';color=95BB04'*/); + } + } + + $params='showNames=1;showValues=0;showPercentageValues=0;baseFontSize=9;rotateNames=1;chartLeftMargin=0;chartRightMargin=0;chartBottomMargin=0;chartTopMargin=0;showBarShadow=1;showLimits=1'; + + $chart->setChartParams($params.';numVDivLines='.$num_vlines.($empty == 1 ? ';yAxisMinValue=0;yAxisMaxValue=1' : '')); + + // Return the code + return get_chart_code ($chart, $width, $height, 'include/graphs/FusionCharts/FCF_Bar2D.swf'); +} + +// Returns a 3D column chart +function flot_hcolumn_chart ($graph_data, $width, $height, $water_mark) { + global $config; + + $stacked_str = ''; + $multicolor = true; + + // Get a unique identifier to graph + $graph_id = uniqid('graph_'); + $graph_id2 = uniqid('graph_'); + + // Set some containers to legend, graph, timestamp tooltip, etc. + $return .= "
"; + $return .= ""; + + if($water_mark != '') { + $return .= ""; + $watermark = 'true'; + } + else { + $watermark = 'false'; + } + + // Set a weird separator to serialize and unserialize passing data from php to javascript + $separator = ';;::;;'; + $separator2 = ':,:,,,:,:'; + + // Transform data from our format to library format + $labels = array(); + $a = array(); + $vars = array(); + + $max = 0; + $i = count($graph_data); + foreach($graph_data as $label => $values) { + $labels[] = io_safe_output($label); + $i--; + + foreach($values as $key => $value) { + $jsvar = "data_".$graph_id."_".$key; + + if($multicolor) { + for($j = count($graph_data) - 1; $j>=0; $j--) { + if($j == $i) { + $data[$jsvar.$i][$j] = $value; + } + else { + $data[$jsvar.$i][$j] = 0; + } + } + } + else { + $data[$jsvar][] = $value; + } + + $return .= "
$value
"; + if($value > $max) { + $max = $value; + } + } + } + + // Store serialized data to use it from javascript + $labels = implode($separator,$labels); + + // Store data series in javascript format + $jsvars = ''; + $jsseries = array(); + + $i = 0; + + $values2 = array(); + + foreach($data as $jsvar => $values) { + $values2[] = implode($separator,$values); + } + + $values = implode($separator2, $values2); + + $jsseries = implode(',', $jsseries); + + + // Javascript code + $return .= ""; + + return $return; +} + +// Returns a 3D column chart +function flot_vcolumn_chart ($graph_data, $width, $height, $water_mark, $homedir, $reduce_data_columns) { + global $config; + + $stacked_str = ''; + $multicolor = false; + + // Get a unique identifier to graph + $graph_id = uniqid('graph_'); + $graph_id2 = uniqid('graph_'); + + // Set some containers to legend, graph, timestamp tooltip, etc. + $return .= "
"; + $return .= ""; + + if($water_mark != '') { + $return .= ""; + $watermark = 'true'; + } + else { + $watermark = 'false'; + } + + // Set a weird separator to serialize and unserialize passing data from php to javascript + $separator = ';;::;;'; + $separator2 = ':,:,,,:,:'; + + // Transform data from our format to library format + $labels = array(); + $a = array(); + $vars = array(); + + $max = 0; + $i = count($graph_data); + foreach($graph_data as $label => $values) { + $labels[] = io_safe_output($label); + $i--; + + foreach($values as $key => $value) { + $jsvar = "data_".$graph_id."_".$key; + + if($multicolor) { + for($j = count($graph_data) - 1; $j>=0; $j--) { + if($j == $i) { + $data[$jsvar.$i][$j] = $value; + } + else { + $data[$jsvar.$i][$j] = 0; + } + } + } + else { + $data[$jsvar][] = $value; + } + + //$return .= "
$value
"; + if($value > $max) { + $max = $value; + } + } + } + + // Store serialized data to use it from javascript + $labels = implode($separator,$labels); + + // Store data series in javascript format + $jsvars = ''; + $jsseries = array(); + + $i = 0; + + $values2 = array(); + + foreach($data as $jsvar => $values) { + $values2[] = implode($separator,$values); + } + + $values = implode($separator2, $values2); + + $jsseries = implode(',', $jsseries); + + // Javascript code + $return .= ""; + + return $return; +} + +function flot_slicesbar_graph ($graph_data, $period, $width, $height, $legend, $colors, $fontpath, $round_corner, $homeurl, $watermark = '') { + global $config; + + $height+= 20; + + $stacked_str = 'stack: stack,'; + + // Get a unique identifier to graph + $graph_id = uniqid('graph_'); + + // Set some containers to legend, graph, timestamp tooltip, etc. + $return .= "
"; + $return .= ""; + + // Set a weird separator to serialize and unserialize passing data from php to javascript + $separator = ';;::;;'; + $separator2 = ':,:,,,:,:'; + + // Transform data from our format to library format + $labels = array(); + $a = array(); + $vars = array(); + + $datacolor = array(); + + $max = 0; + + $i = count($graph_data); + + $intervaltick = $period / $i; + + $leg_max_length = 0; + foreach($legend as $l) { + if(strlen($l) > $leg_max_length) { + $leg_max_length = strlen($l); + } + } + + $fontsize = 7; + + $maxticks = (int) ($width / ($fontsize * $leg_max_length)); + + $i_aux = $i; + while(1) { + if($i_aux <= $maxticks ) { + break; + } + + $intervaltick*= 2; + + $i_aux /= 2; + } + + $intervaltick = (int) $intervaltick; + $acumulate = 0; + $c = 0; + $acumulate_data = array(); + foreach($graph_data as $label => $values) { + $labels[] = io_safe_output($label); + $i--; + + foreach($values as $key => $value) { + $jsvar = "d_".$graph_id."_".$i; + if($key == 'data') { + $datacolor[$jsvar] = $colors[$value]; + continue; + } + $data[$jsvar][] = $value; + + $acumulate_data[$c] = $acumulate; + $acumulate += $value; + $c++; + + //$return .= "
$value
"; + if($value > $max) { + $max = $value; + } + } + } + + // Store serialized data to use it from javascript + $labels = implode($separator,$labels); + $datacolor = implode($separator,$datacolor); + $legend = io_safe_output(implode($separator,$legend)); + $acumulate_data = io_safe_output(implode($separator,$acumulate_data)); + + // Store data series in javascript format + $jsvars = ''; + $jsseries = array(); + + $date = get_system_time (); + $datelimit = ($date - $period) * 1000; + + $i = 0; + + $values2 = array(); + + foreach($data as $jsvar => $values) { + $values2[] = implode($separator,$values); + $i ++; + } + + $values = implode($separator2, $values2); + + // Javascript code + $return .= ""; + + return $return; +} + +// Prints a Gantt chart +function fs_gantt_chart2 ($title, $from, $to, $tasks, $milestones, $width, $height) { + + // Generate the XML + $chart = new FusionCharts("Gantt", $width, $height, "1", "0"); + $chart->setSWFPath("include/graphs/FusionCharts/"); + $chart->setChartParams('dateFormat=dd/mm/yyyy;hoverCapBorderColor=2222ff;hoverCapBgColor=e1f5ff;ganttLineAlpha=80;canvasBorderColor=024455;canvasBorderThickness=0;gridBorderColor=2179b1;gridBorderAlpha=20;ganttWidthPercent=80'); + $chart->setGanttProcessesParams('headerText=' . __('Task') . ';fontColor=ffffff;fontSize=9;isBold=1;isAnimated=1;bgColor=2179b1;headerbgColor=2179b1;headerFontColor=ffffff;headerFontSize=12;align=left'); + $chart->setGanttTasksParams(''); + + $start_date = explode ('/', $from); + $start_day = $start_date[0]; + $start_month = $start_date[1]; + $start_year = $start_date[2]; + $end_date = explode ('/', $to); + $end_day = $end_date[0]; + $end_month = $end_date[1]; + $end_year = $end_date[2]; + $time_span = date_to_epoch ($to) - date_to_epoch ($from); + + // Years + $chart->addGanttCategorySet ('bgColor=2179b1;fontColor=ff0000'); + for ($i = $start_year; $i <= $end_year; $i++) { + if ($i == $start_year) { + $start = sprintf ('%02d/%02d/%04d', $start_day, $start_month, $start_year); + } else { + $start = sprintf ('%02d/%02d/%04d', 1, 1, $i); + } + if ($i == $end_year) { + $end = sprintf ('%02d/%02d/%04d', $end_day, $end_month, $end_year); + } else { + $end = sprintf ('%02d/%02d/%04d', cal_days_in_month (CAL_GREGORIAN, 12, $i), 12, $i); + } + $chart->addGanttCategory ($i, ';start=' . $start . ';end=' . $end . ';align=center;fontColor=ffffff;isBold=1;fontSize=16'); + } + + // Months + $chart->addGanttCategorySet ('bgColor=ffffff;fontColor=1288dd;fontSize=10'); + for ($i = $start_year ; $i <= $end_year; $i++) { + for ($j = 1 ; $j <= 12; $j++) { + if ($i == $start_year && $j < $start_month) { + continue; + } else if ($i == $end_year && $j > $end_month) { + break; + } + if ($i == $start_year && $j == $start_month) { + $start = sprintf ('%02d/%02d/%04d', $start_day, $start_month, $start_year); + } else { + $start = sprintf ('%02d/%02d/%04d', 1, $j, $i); + } + if ($i == $end_year && $j == $end_month) { + $end = sprintf ('%02d/%02d/%04d', $end_day, $end_month, $end_year); + } else { + $end = sprintf ('%02d/%02d/%04d', cal_days_in_month (CAL_GREGORIAN, $j, $i), $j, $i); + } + $chart->addGanttCategory (date('F', mktime(0,0,0,$j,1)), ';start=' . $start . ';end=' . $end . ';align=center;isBold=1'); + } + } + + // Days + if ($time_span < 2592000) { + $chart->addGanttCategorySet (); + for ($i = $start_year ; $i <= $end_year; $i++) { + for ($j = 1 ; $j <= 12; $j++) { + if ($i == $start_year && $j < $start_month) { + continue; + } else if ($i == $end_year && $j > $end_month) { + break; + } + $num_days = cal_days_in_month (CAL_GREGORIAN, $j, $i); + for ($k = 1 ; $k <= $num_days; $k++) { + if ($i == $start_year && $j == $start_month && $k < $start_day) { + continue; + } else if ($i == $end_year && $j == $end_month && $k > $end_day) { + break; + } + $start = sprintf ('%02d/%02d/%04d', $k, $j, $i); + $end = sprintf ('%02d/%02d/%04d', $k, $j, $i); + $chart->addGanttCategory ($k, ';start=' . $start . ';end=' . $end . ';fontSize=8;isBold=0'); + } + } + } + } + // Weeks + else if ($time_span < 10368000) { + $chart->addGanttCategorySet (); + for ($i = $start_year ; $i <= $end_year; $i++) { + for ($j = 1 ; $j <= 12; $j++) { + if ($i == $start_year && $j < $start_month) { + continue; + } else if ($i == $end_year && $j > $end_month) { + break; + } + $num_days = cal_days_in_month (CAL_GREGORIAN, $j, $i); + for ($k = 1, $l = 1; $k <= $num_days; $k += 8, $l++) { + if ($i == $start_year && $j == $start_month && $k + 7 < $start_day) { + continue; + } + if ($i == $end_year && $j == $end_month && $k > $end_day) { + break; + } + + if ($i == $start_year && $j == $start_month && $k < $start_day) { + $start = sprintf ('%02d/%02d/%04d', $start_day, $j, $i); + } else { + $start = sprintf ('%02d/%02d/%04d', $k, $j, $i); + } + if ($i == $end_year && $j == $end_month && $k + 7 > $end_day) { + $end = sprintf ('%02d/%02d/%04d', $end_day, $j, $i); + } else if ($k + 7 > $num_days) { + $end = sprintf ('%02d/%02d/%04d', $num_days, $j, $i); + } else { + $end = sprintf ('%02d/%02d/%04d', $k + 7, $j, $i); + } + + $chart->addGanttCategory (__('Week') . " $l", ';start=' . $start . ';end=' . $end . ';fontSize=8;isBold=0'); + } + } + } + } + + // Tasks + foreach ($tasks as $task) { + $chart->addGanttProcess (clean_flash_string($task['name']), 'id=' . $task['id'] . ';link=' . urlencode($task['link'])); + + $chart->addGanttTask (__('Planned'), 'start=' . $task['start'] . ';end=' . $task['end'] . ';id=' . $task['id'] . ';processId=' . $task['id'] . ';color=4b3cff;height=5;topPadding=10;animation=0'); + + if ($task['real_start'] !== false && $task['real_end']) { + $chart->addGanttTask (__('Actual'), 'start=' . $task['real_start'] . ';end=' . $task['real_end'] . ';processId=' . $task['id'] . ';color=ff3c4b;alpha=100;topPadding=15;height=5'); + } + if ($task['completion'] != 0) { + $task_span = date_to_epoch ($task['end']) - date_to_epoch ($task['start']); + $end = date ('d/m/Y', date_to_epoch ($task['start']) + $task_span * $task['completion'] / 100.0); + $chart->addGanttTask (__('Completion')." (".$task['completion'].")", 'start=' . $task['start'] . ';end=' . $end . ';processId=' . $task['id'] . ';color=32cd32;alpha=100;topPadding=20;height=5'); + } + if ($task['parent'] != 0) { + $chart->addGanttConnector ($task['parent'], $task['id'], 'color=2179b1;thickness=2;fromTaskConnectStart=1'); + } + } + + // Milestones + if ($milestones !== '') { + $chart->addGanttProcess (__('Milestones'), 'id=0'); + foreach ($milestones as $milestone) { + $chart->addGanttTask (clean_flash_string($milestone['name']), 'start=' . $milestone['date'] . ';end=' . $milestone['date'] . ';id=ms-' . $milestone['id'] . ';processId=0;color=ffffff;alpha=0;height=60;topPadding=0;animation=0'); + $chart->addGanttMilestone ('ms-' . $milestone['id'], 'date=' . $milestone['date'] . ';radius=8;color=efbb07;shape=star;numSides=3;borderThickness=1'); + } + } + + // Today + $chart->addTrendLine ('start=' . date ('d/m/Y') . ';displayValue='. __('Today') . ';color=666666;isTrendZone=1;alpha=20'); + + // Return the code + return get_chart_code ($chart, $width, $height, 'include/graphs/FusionCharts/FCF_Gantt.swf'); +} + +?> + + diff --git a/pandora_console/include/graphs/functions_utils.php b/pandora_console/include/graphs/functions_utils.php index 083dbe2e63..00a77bcd16 100644 --- a/pandora_console/include/graphs/functions_utils.php +++ b/pandora_console/include/graphs/functions_utils.php @@ -131,4 +131,25 @@ function graph_get_max_index($legend_values) { return $max_chars; } + +function setup_watermark($water_mark, &$water_mark_file, &$water_mark_url) { + if(!is_array($water_mark)) { + $water_mark['file'] = $water_mark; + } + + if(isset($water_mark['file'])) { + $water_mark_file = $water_mark['file']; + } + else { + $water_mark_file = ''; + } + + if(isset($water_mark['url'])) { + $water_mark_url = $water_mark['url']; + } + else { + $water_mark_url = ''; + } +} + ?> diff --git a/pandora_console/include/include_graph_dependencies.php b/pandora_console/include/include_graph_dependencies.php index 8ed67cafe2..37a58acd4a 100644 --- a/pandora_console/include/include_graph_dependencies.php +++ b/pandora_console/include/include_graph_dependencies.php @@ -16,6 +16,7 @@ /* Function that includes all graph dependencies */ function include_graphs_dependencies($home_url = '', $serialize_ttl = 1) { + global $config; global $ttl; global $homeurl; @@ -24,7 +25,10 @@ include_once($homeurl . 'include/functions_io.php'); include_once($homeurl . 'include/functions.php'); include_once($homeurl . 'include/functions_html.php'); - + + if($config['flash_charts'] && !defined('AJAX') && !get_parameter('static_graph',0)) { + include_once($homeurl . 'include/graphs/functions_flot.php'); + } include_once($homeurl . 'include/graphs/functions_fsgraph.php'); include_once($homeurl . 'include/graphs/functions_gd.php'); include_once($homeurl . 'include/graphs/functions_utils.php'); diff --git a/pandora_console/include/javascript/jquery-1.6.1.min.js b/pandora_console/include/javascript/jquery-1.6.1.min.js new file mode 100755 index 0000000000..b2ac1747f3 --- /dev/null +++ b/pandora_console/include/javascript/jquery-1.6.1.min.js @@ -0,0 +1,18 @@ +/*! + * jQuery JavaScript Library v1.6.1 + * http://jquery.com/ + * + * Copyright 2011, John Resig + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * Includes Sizzle.js + * http://sizzlejs.com/ + * Copyright 2011, The Dojo Foundation + * Released under the MIT, BSD, and GPL Licenses. + * + * Date: Thu May 12 15:04:36 2011 -0400 + */ +(function(a,b){function cy(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cv(a){if(!cj[a]){var b=f("<"+a+">").appendTo("body"),d=b.css("display");b.remove();if(d==="none"||d===""){ck||(ck=c.createElement("iframe"),ck.frameBorder=ck.width=ck.height=0),c.body.appendChild(ck);if(!cl||!ck.createElement)cl=(ck.contentWindow||ck.contentDocument).document,cl.write("");b=cl.createElement(a),cl.body.appendChild(b),d=f.css(b,"display"),c.body.removeChild(ck)}cj[a]=d}return cj[a]}function cu(a,b){var c={};f.each(cp.concat.apply([],cp.slice(0,b)),function(){c[this]=a});return c}function ct(){cq=b}function cs(){setTimeout(ct,0);return cq=f.now()}function ci(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ch(){try{return new a.XMLHttpRequest}catch(b){}}function cb(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g=0===c})}function W(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function O(a,b){return(a&&a!=="*"?a+".":"")+b.replace(A,"`").replace(B,"&")}function N(a){var b,c,d,e,g,h,i,j,k,l,m,n,o,p=[],q=[],r=f._data(this,"events");if(!(a.liveFired===this||!r||!r.live||a.target.disabled||a.button&&a.type==="click")){a.namespace&&(n=new RegExp("(^|\\.)"+a.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)")),a.liveFired=this;var s=r.live.slice(0);for(i=0;ic)break;a.currentTarget=e.elem,a.data=e.handleObj.data,a.handleObj=e.handleObj,o=e.handleObj.origHandler.apply(e.elem,arguments);if(o===!1||a.isPropagationStopped()){c=e.level,o===!1&&(b=!1);if(a.isImmediatePropagationStopped())break}}return b}}function L(a,c,d){var e=f.extend({},d[0]);e.type=a,e.originalEvent={},e.liveFired=b,f.event.handle.call(c,e),e.isDefaultPrevented()&&d[0].preventDefault()}function F(){return!0}function E(){return!1}function m(a,c,d){var e=c+"defer",g=c+"queue",h=c+"mark",i=f.data(a,e,b,!0);i&&(d==="queue"||!f.data(a,g,b,!0))&&(d==="mark"||!f.data(a,h,b,!0))&&setTimeout(function(){!f.data(a,g,b,!0)&&!f.data(a,h,b,!0)&&(f.removeData(a,e,!0),i.resolve())},0)}function l(a){for(var b in a)if(b!=="toJSON")return!1;return!0}function k(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(j,"$1-$2").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNaN(d)?i.test(d)?f.parseJSON(d):d:parseFloat(d)}catch(g){}f.data(a,c,d)}else d=b}return d}var c=a.document,d=a.navigator,e=a.location,f=function(){function H(){if(!e.isReady){try{c.documentElement.doScroll("left")}catch(a){setTimeout(H,1);return}e.ready()}}var e=function(a,b){return new e.fn.init(a,b,h)},f=a.jQuery,g=a.$,h,i=/^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/\d/,n=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,o=/^[\],:{}\s]*$/,p=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,q=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,r=/(?:^|:|,)(?:\s*\[)+/g,s=/(webkit)[ \/]([\w.]+)/,t=/(opera)(?:.*version)?[ \/]([\w.]+)/,u=/(msie) ([\w.]+)/,v=/(mozilla)(?:.*? rv:([\w.]+))?/,w=d.userAgent,x,y,z,A=Object.prototype.toString,B=Object.prototype.hasOwnProperty,C=Array.prototype.push,D=Array.prototype.slice,E=String.prototype.trim,F=Array.prototype.indexOf,G={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=n.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.6.1",length:0,size:function(){return this.length},toArray:function(){return D.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?C.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),y.done(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(D.apply(this,arguments),"slice",D.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:C,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j0)return;y.resolveWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").unbind("ready")}},bindReady:function(){if(!y){y=e._Deferred();if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",z,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",z),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&H()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a&&typeof a=="object"&&"setInterval"in a},isNaN:function(a){return a==null||!m.test(a)||isNaN(a)},type:function(a){return a==null?String(a):G[A.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;if(a.constructor&&!B.call(a,"constructor")&&!B.call(a.constructor.prototype,"isPrototypeOf"))return!1;var c;for(c in a);return c===b||B.call(a,c)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw a},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(o.test(b.replace(p,"@").replace(q,"]").replace(r,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(b,c,d){a.DOMParser?(d=new DOMParser,c=d.parseFromString(b,"text/xml")):(c=new ActiveXObject("Microsoft.XMLDOM"),c.async="false",c.loadXML(b)),d=c.documentElement,(!d||!d.nodeName||d.nodeName==="parsererror")&&e.error("Invalid XML: "+b);return c},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i1?h.call(arguments,0):c,--e||g.resolveWith(g,h.call(b,0))}}var b=arguments,c=0,d=b.length,e=d,g=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred();if(d>1){for(;c
a",d=a.getElementsByTagName("*"),e=a.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};f=c.createElement("select"),g=f.appendChild(c.createElement("option")),h=a.getElementsByTagName("input")[0],j={leadingWhitespace:a.firstChild.nodeType===3,tbody:!a.getElementsByTagName("tbody").length,htmlSerialize:!!a.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55$/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:h.value==="on",optSelected:g.selected,getSetAttribute:a.className!=="t",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},h.checked=!0,j.noCloneChecked=h.cloneNode(!0).checked,f.disabled=!0,j.optDisabled=!g.disabled;try{delete a.test}catch(s){j.deleteExpando=!1}!a.addEventListener&&a.attachEvent&&a.fireEvent&&(a.attachEvent("onclick",function b(){j.noCloneEvent=!1,a.detachEvent("onclick",b)}),a.cloneNode(!0).fireEvent("onclick")),h=c.createElement("input"),h.value="t",h.setAttribute("type","radio"),j.radioValue=h.value==="t",h.setAttribute("checked","checked"),a.appendChild(h),k=c.createDocumentFragment(),k.appendChild(a.firstChild),j.checkClone=k.cloneNode(!0).cloneNode(!0).lastChild.checked,a.innerHTML="",a.style.width=a.style.paddingLeft="1px",l=c.createElement("body"),m={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"};for(q in m)l.style[q]=m[q];l.appendChild(a),b.insertBefore(l,b.firstChild),j.appendChecked=h.checked,j.boxModel=a.offsetWidth===2,"zoom"in a.style&&(a.style.display="inline",a.style.zoom=1,j.inlineBlockNeedsLayout=a.offsetWidth===2,a.style.display="",a.innerHTML="
",j.shrinkWrapBlocks=a.offsetWidth!==2),a.innerHTML="
t
",n=a.getElementsByTagName("td"),r=n[0].offsetHeight===0,n[0].style.display="",n[1].style.display="none",j.reliableHiddenOffsets=r&&n[0].offsetHeight===0,a.innerHTML="",c.defaultView&&c.defaultView.getComputedStyle&&(i=c.createElement("div"),i.style.width="0",i.style.marginRight="0",a.appendChild(i),j.reliableMarginRight=(parseInt((c.defaultView.getComputedStyle(i,null)||{marginRight:0}).marginRight,10)||0)===0),l.innerHTML="",b.removeChild(l);if(a.attachEvent)for(q in{submit:1,change:1,focusin:1})p="on"+q,r=p in a,r||(a.setAttribute(p,"return;"),r=typeof a[p]=="function"),j[q+"Bubbles"]=r;return j}(),f.boxModel=f.support.boxModel;var i=/^(?:\{.*\}|\[.*\])$/,j=/([a-z])([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!l(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g=f.expando,h=typeof c=="string",i,j=a.nodeType,k=j?f.cache:a,l=j?a[f.expando]:a[f.expando]&&f.expando;if((!l||e&&l&&!k[l][g])&&h&&d===b)return;l||(j?a[f.expando]=l=++f.uuid:l=f.expando),k[l]||(k[l]={},j||(k[l].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?k[l][g]=f.extend(k[l][g],c):k[l]=f.extend(k[l],c);i=k[l],e&&(i[g]||(i[g]={}),i=i[g]),d!==b&&(i[f.camelCase(c)]=d);if(c==="events"&&!i[c])return i[g]&&i[g].events;return h?i[f.camelCase(c)]:i}},removeData:function(b,c,d){if(!!f.acceptData(b)){var e=f.expando,g=b.nodeType,h=g?f.cache:b,i=g?b[f.expando]:f.expando;if(!h[i])return;if(c){var j=d?h[i][e]:h[i];if(j){delete j[c];if(!l(j))return}}if(d){delete h[i][e];if(!l(h[i]))return}var k=h[i][e];f.support.deleteExpando||h!=a?delete h[i]:h[i]=null,k?(h[i]={},g||(h[i].toJSON=f.noop),h[i][e]=k):g&&(f.support.deleteExpando?delete b[f.expando]:b.removeAttribute?b.removeAttribute(f.expando):b[f.expando]=null)}},_data:function(a,b,c){return f.data(a,b,c,!0)},acceptData:function(a){if(a.nodeName){var b=f.noData[a.nodeName.toLowerCase()];if(b)return b!==!0&&a.getAttribute("classid")===b}return!0}}),f.fn.extend({data:function(a,c){var d=null;if(typeof a=="undefined"){if(this.length){d=f.data(this[0]);if(this[0].nodeType===1){var e=this[0].attributes,g;for(var h=0,i=e.length;h-1)return!0;return!1},val:function(a){var c,d,e=this[0];if(!arguments.length){if(e){c=f.valHooks[e.nodeName.toLowerCase()]||f.valHooks[e.type];if(c&&"get"in c&&(d=c.get(e,"value"))!==b)return d;return(e.value||"").replace(p,"")}return b}var g=f.isFunction(a);return this.each(function(d){var e=f(this),h;if(this.nodeType===1){g?h=a.call(this,d,e.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.nodeName.toLowerCase()]||f.valHooks[this.type];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c=a.selectedIndex,d=[],e=a.options,g=a.type==="select-one";if(c<0)return null;for(var h=g?c:0,i=g?c+1:e.length;h=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attrFix:{tabindex:"tabIndex"},attr:function(a,c,d,e){var g=a.nodeType;if(!a||g===3||g===8||g===2)return b;if(e&&c in f.attrFn)return f(a)[c](d);if(!("getAttribute"in a))return f.prop(a,c,d);var h,i,j=g!==1||!f.isXMLDoc(a);c=j&&f.attrFix[c]||c,i=f.attrHooks[c],i||(!t.test(c)||typeof d!="boolean"&&d!==b&&d.toLowerCase()!==c.toLowerCase()?v&&(f.nodeName(a,"form")||u.test(c))&&(i=v):i=w);if(d!==b){if(d===null){f.removeAttr(a,c);return b}if(i&&"set"in i&&j&&(h=i.set(a,d,c))!==b)return h;a.setAttribute(c,""+d);return d}if(i&&"get"in i&&j)return i.get(a,c);h=a.getAttribute(c);return h===null?b:h},removeAttr:function(a,b){var c;a.nodeType===1&&(b=f.attrFix[b]||b,f.support.getSetAttribute?a.removeAttribute(b):(f.attr(a,b,""),a.removeAttributeNode(a.getAttributeNode(b))),t.test(b)&&(c=f.propFix[b]||b)in a&&(a[c]=!1))},attrHooks:{type:{set:function(a,b){if(q.test(a.nodeName)&&a.parentNode)f.error("type property can't be changed");else if(!f.support.radioValue&&b==="radio"&&f.nodeName(a,"input")){var c=a.value;a.setAttribute("type",b),c&&(a.value=c);return b}}},tabIndex:{get:function(a){var c=a.getAttributeNode("tabIndex");return c&&c.specified?parseInt(c.value,10):r.test(a.nodeName)||s.test(a.nodeName)&&a.href?0:b}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(a,c,d){var e=a.nodeType;if(!a||e===3||e===8||e===2)return b;var g,h,i=e!==1||!f.isXMLDoc(a);c=i&&f.propFix[c]||c,h=f.propHooks[c];return d!==b?h&&"set"in h&&(g=h.set(a,d,c))!==b?g:a[c]=d:h&&"get"in h&&(g=h.get(a,c))!==b?g:a[c]},propHooks:{}}),w={get:function(a,c){return a[f.propFix[c]||c]?c.toLowerCase():b},set:function(a,b,c){var d;b===!1?f.removeAttr(a,c):(d=f.propFix[c]||c,d in a&&(a[d]=b),a.setAttribute(c,c.toLowerCase()));return c}},f.attrHooks.value={get:function(a,b){if(v&&f.nodeName(a,"button"))return v.get(a,b);return a.value},set:function(a,b,c){if(v&&f.nodeName(a,"button"))return v.set(a,b,c);a.value=b}},f.support.getSetAttribute||(f.attrFix=f.propFix,v=f.attrHooks.name=f.valHooks.button={get:function(a,c){var d;d=a.getAttributeNode(c);return d&&d.nodeValue!==""?d.nodeValue:b},set:function(a,b,c){var d=a.getAttributeNode(c);if(d){d.nodeValue=b;return b}}},f.each(["width","height"],function(a,b){f.attrHooks[b]=f.extend(f.attrHooks[b],{set:function(a,c){if(c===""){a.setAttribute(b,"auto");return c}}})})),f.support.hrefNormalized||f.each(["href","src","width","height"],function(a,c){f.attrHooks[c]=f.extend(f.attrHooks[c],{get:function(a){var d=a.getAttribute(c,2);return d===null?b:d}})}),f.support.style||(f.attrHooks.style={get:function(a){return a.style.cssText.toLowerCase()||b},set:function(a,b){return a.style.cssText=""+b}}),f.support.optSelected||(f.propHooks.selected=f.extend(f.propHooks.selected,{get:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex)}})),f.support.checkOn||f.each(["radio","checkbox"],function(){f.valHooks[this]={get:function(a){return a.getAttribute("value")===null?"on":a.value}}}),f.each(["radio","checkbox"],function(){f.valHooks[this]=f.extend(f.valHooks[this],{set:function(a,b){if(f.isArray(b))return a.checked=f.inArray(f(a).val(),b)>=0}})});var x=Object.prototype.hasOwnProperty,y=/\.(.*)$/,z=/^(?:textarea|input|select)$/i,A=/\./g,B=/ /g,C=/[^\w\s.|`]/g,D=function(a){return a.replace(C,"\\$&")};f.event={add:function(a,c,d,e){if(a.nodeType!==3&&a.nodeType!==8){if(d===!1)d=E;else if(!d)return;var g,h;d.handler&&(g=d,d=g.handler),d.guid||(d.guid=f.guid++);var i=f._data(a);if(!i)return;var j=i.events,k=i.handle;j||(i.events=j={}),k||(i.handle=k=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.handle.apply(k.elem,arguments):b}),k.elem=a,c=c.split(" ");var l,m=0,n;while(l=c[m++]){h=g?f.extend({},g):{handler:d,data:e},l.indexOf(".")>-1?(n=l.split("."),l=n.shift(),h.namespace=n.slice(0).sort().join(".")):(n=[],h.namespace=""),h.type=l,h.guid||(h.guid=d.guid);var o=j[l],p=f.event.special[l]||{};if(!o){o=j[l]=[];if(!p.setup||p.setup.call(a,e,n,k)===!1)a.addEventListener?a.addEventListener(l,k,!1):a.attachEvent&&a.attachEvent("on"+l,k)}p.add&&(p.add.call(a,h),h.handler.guid||(h.handler.guid=d.guid)),o.push(h),f.event.global[l]=!0}a=null}},global:{},remove:function(a,c,d,e){if(a.nodeType!==3&&a.nodeType!==8){d===!1&&(d=E);var g,h,i,j,k=0,l,m,n,o,p,q,r,s=f.hasData(a)&&f._data(a),t=s&&s.events;if(!s||!t)return;c&&c.type&&(d=c.handler,c=c.type);if(!c||typeof c=="string"&&c.charAt(0)==="."){c=c||"";for(h in t)f.event.remove(a,h+c);return}c=c.split(" ");while(h=c[k++]){r=h,q=null,l=h.indexOf(".")<0,m=[],l||(m=h.split("."),h=m.shift(),n=new RegExp("(^|\\.)"+f.map(m.slice(0).sort(),D).join("\\.(?:.*\\.)?")+"(\\.|$)")),p=t[h];if(!p)continue;if(!d){for(j=0;j=0&&(h=h.slice(0,-1),j=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if(!!e&&!f.event.customEvent[h]||!!f.event.global[h]){c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.exclusive=j,c.namespace=i.join("."),c.namespace_re=new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)");if(g||!e)c.preventDefault(),c.stopPropagation();if(!e){f.each(f.cache,function(){var a=f.expando,b=this[a];b&&b.events&&b.events[h]&&f.event.trigger(c,d,b.handle.elem +)});return}if(e.nodeType===3||e.nodeType===8)return;c.result=b,c.target=e,d=d?f.makeArray(d):[],d.unshift(c);var k=e,l=h.indexOf(":")<0?"on"+h:"";do{var m=f._data(k,"handle");c.currentTarget=k,m&&m.apply(k,d),l&&f.acceptData(k)&&k[l]&&k[l].apply(k,d)===!1&&(c.result=!1,c.preventDefault()),k=k.parentNode||k.ownerDocument||k===c.target.ownerDocument&&a}while(k&&!c.isPropagationStopped());if(!c.isDefaultPrevented()){var n,o=f.event.special[h]||{};if((!o._default||o._default.call(e.ownerDocument,c)===!1)&&(h!=="click"||!f.nodeName(e,"a"))&&f.acceptData(e)){try{l&&e[h]&&(n=e[l],n&&(e[l]=null),f.event.triggered=h,e[h]())}catch(p){}n&&(e[l]=n),f.event.triggered=b}}return c.result}},handle:function(c){c=f.event.fix(c||a.event);var d=((f._data(this,"events")||{})[c.type]||[]).slice(0),e=!c.exclusive&&!c.namespace,g=Array.prototype.slice.call(arguments,0);g[0]=c,c.currentTarget=this;for(var h=0,i=d.length;h-1?f.map(a.options,function(a){return a.selected}).join("-"):"":f.nodeName(a,"select")&&(c=a.selectedIndex);return c},K=function(c){var d=c.target,e,g;if(!!z.test(d.nodeName)&&!d.readOnly){e=f._data(d,"_change_data"),g=J(d),(c.type!=="focusout"||d.type!=="radio")&&f._data(d,"_change_data",g);if(e===b||g===e)return;if(e!=null||g)c.type="change",c.liveFired=b,f.event.trigger(c,arguments[1],d)}};f.event.special.change={filters:{focusout:K,beforedeactivate:K,click:function(a){var b=a.target,c=f.nodeName(b,"input")?b.type:"";(c==="radio"||c==="checkbox"||f.nodeName(b,"select"))&&K.call(this,a)},keydown:function(a){var b=a.target,c=f.nodeName(b,"input")?b.type:"";(a.keyCode===13&&!f.nodeName(b,"textarea")||a.keyCode===32&&(c==="checkbox"||c==="radio")||c==="select-multiple")&&K.call(this,a)},beforeactivate:function(a){var b=a.target;f._data(b,"_change_data",J(b))}},setup:function(a,b){if(this.type==="file")return!1;for(var c in I)f.event.add(this,c+".specialChange",I[c]);return z.test(this.nodeName)},teardown:function(a){f.event.remove(this,".specialChange");return z.test(this.nodeName)}},I=f.event.special.change.filters,I.focus=I.beforeactivate}f.support.focusinBubbles||f.each({focus:"focusin",blur:"focusout"},function(a,b){function e(a){var c=f.event.fix(a);c.type=b,c.originalEvent={},f.event.trigger(c,null,c.target),c.isDefaultPrevented()&&a.preventDefault()}var d=0;f.event.special[b]={setup:function(){d++===0&&c.addEventListener(a,e,!0)},teardown:function(){--d===0&&c.removeEventListener(a,e,!0)}}}),f.each(["bind","one"],function(a,c){f.fn[c]=function(a,d,e){var g;if(typeof a=="object"){for(var h in a)this[c](h,d,a[h],e);return this}if(arguments.length===2||d===!1)e=d,d=b;c==="one"?(g=function(a){f(this).unbind(a,g);return e.apply(this,arguments)},g.guid=e.guid||f.guid++):g=e;if(a==="unload"&&c!=="one")this.one(a,d,e);else for(var i=0,j=this.length;i0?this.bind(b,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0)}),function(){function u(a,b,c,d,e,f){for(var g=0,h=d.length;g0){j=i;break}}i=i[a]}d[g]=j}}}function t(a,b,c,d,e,f){for(var g=0,h=d.length;g+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d=0,e=Object.prototype.toString,g=!1,h=!0,i=/\\/g,j=/\W/;[0,0].sort(function(){h=!1;return 0});var k=function(b,d,f,g){f=f||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return f;var i,j,n,o,q,r,s,t,u=!0,w=k.isXML(d),x=[],y=b;do{a.exec(""),i=a.exec(y);if(i){y=i[3],x.push(i[1]);if(i[2]){o=i[3];break}}}while(i);if(x.length>1&&m.exec(b))if(x.length===2&&l.relative[x[0]])j=v(x[0]+x[1],d);else{j=l.relative[x[0]]?[d]:k(x.shift(),d);while(x.length)b=x.shift(),l.relative[b]&&(b+=x.shift()),j=v(b,j)}else{!g&&x.length>1&&d.nodeType===9&&!w&&l.match.ID.test(x[0])&&!l.match.ID.test(x[x.length-1])&&(q=k.find(x.shift(),d,w),d=q.expr?k.filter(q.expr,q.set)[0]:q.set[0]);if(d){q=g?{expr:x.pop(),set:p(g)}:k.find(x.pop(),x.length===1&&(x[0]==="~"||x[0]==="+")&&d.parentNode?d.parentNode:d,w),j=q.expr?k.filter(q.expr,q.set):q.set,x.length>0?n=p(j):u=!1;while(x.length)r=x.pop(),s=r,l.relative[r]?s=x.pop():r="",s==null&&(s=d),l.relative[r](n,s,w)}else n=x=[]}n||(n=j),n||k.error(r||b);if(e.call(n)==="[object Array]")if(!u)f.push.apply(f,n);else if(d&&d.nodeType===1)for(t=0;n[t]!=null;t++)n[t]&&(n[t]===!0||n[t].nodeType===1&&k.contains(d,n[t]))&&f.push(j[t]);else for(t=0;n[t]!=null;t++)n[t]&&n[t].nodeType===1&&f.push(j[t]);else p(n,f);o&&(k(o,h,f,g),k.uniqueSort(f));return f};k.uniqueSort=function(a){if(r){g=h,a.sort(r);if(g)for(var b=1;b0},k.find=function(a,b,c){var d;if(!a)return[];for(var e=0,f=l.order.length;e":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!j.test(b)){b=b.toLowerCase();for(;e=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(i,"")},TAG:function(a,b){return a[1].replace(i,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||k.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&k.error(a[0]);a[0]=d++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(i,"");!f&&l.attrMap[g]&&(a[1]=l.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(i,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=k(b[3],null,null,c);else{var g=k.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(l.match.POS.test(b[0])||l.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!k(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return bc[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=l.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||k.getText([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=l.attrHandle[c]?l.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=l.setFilters[e];if(f)return f(a,c,b,d)}}},m=l.match.POS,n=function(a,b){return"\\"+(b-0+1)};for(var o in l.match)l.match[o]=new RegExp(l.match[o].source+/(?![^\[]*\])(?![^\(]*\))/.source),l.leftMatch[o]=new RegExp(/(^(?:.|\r|\n)*?)/.source+l.match[o].source.replace(/\\(\d+)/g,n));var p=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(q){p=function(a,b){var c=0,d=b||[];if(e.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var f=a.length;c",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(l.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},l.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(l.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(l.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=k,b=c.createElement("div"),d="__sizzle__";b.innerHTML="

";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){k=function(b,e,f,g){e=e||c;if(!g&&!k.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return p(e.getElementsByTagName(b),f);if(h[2]&&l.find.CLASS&&e.getElementsByClassName)return p(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return p([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return p([],f);if(i.id===h[3])return p([i],f)}try{return p(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var m=e,n=e.getAttribute("id"),o=n||d,q=e.parentNode,r=/^\s*[+~]/.test(b);n?o=o.replace(/'/g,"\\$&"):e.setAttribute("id",o),r&&q&&(e=e.parentNode);try{if(!r||q)return p(e.querySelectorAll("[id='"+o+"'] "+b),f)}catch(s){}finally{n||m.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)k[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}k.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!k.isXML(a))try{if(e||!l.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return k(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="
";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;l.order.splice(1,0,"CLASS"),l.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?k.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?k.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:k.contains=function(){return!1},k.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var v=function(a,b){var c,d=[],e="",f=b.nodeType?[b]:b;while(c=l.match.PSEUDO.exec(a))e+=c[0],a=a.replace(l.match.PSEUDO,"");a=l.relative[a]?a+"*":a;for(var g=0,h=f.length;g0)for(h=g;h0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h,i,j={},k=1;if(g&&a.length){for(d=0,e=a.length;d-1:f(g).is(h))&&c.push({selector:i,elem:g,level:k});g=g.parentNode,k++}}return c}var l=U.test(a)||typeof a!="string"?f(a,b||this.context):0;for(d=0,e=this.length;d-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a||typeof a=="string")return f.inArray(this[0],a?f(a):this.parent().children());return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(W(c[0])||W(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling(a.parentNode.firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c),g=T.call(arguments);P.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!V[a]?f.unique(e):e,(this.length>1||R.test(d))&&Q.test(a)&&(e=e.reverse());return this.pushStack(e,a,g.join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var Y=/ jQuery\d+="(?:\d+|null)"/g,Z=/^\s+/,$=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,_=/<([\w:]+)/,ba=/",""],legend:[1,"
","
"],thead:[1,"","
"],tr:[2,"","
"],td:[3,"","
"],col:[2,"","
"],area:[1,"",""],_default:[0,"",""]};bg.optgroup=bg.option,bg.tbody=bg.tfoot=bg.colgroup=bg.caption=bg.thead,bg.th=bg.td,f.support.htmlSerialize||(bg._default=[1,"div
","
"]),f.fn.extend({text:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.text(a.call(this,b,c.text()))});if(typeof a!="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return f.text(this)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){f(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f(arguments[0]).toArray());return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(Y,""):null;if(typeof a=="string"&&!bc.test(a)&&(f.support.leadingWhitespace||!Z.test(a))&&!bg[(_.exec(a)||["",""])[1].toLowerCase()]){a=a.replace($,"<$1>");try{for(var c=0,d=this.length;c1&&l0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d=a.cloneNode(!0),e,g,h;if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bj(a,d),e=bk(a),g=bk(d);for(h=0;e[h];++h)bj(e[h],g[h])}if(b){bi(a,d);if(c){e=bk(a),g=bk(d);for(h=0;e[h];++h)bi(e[h],g[h])}}return d},clean:function(a,b,d,e){var g;b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument|| +b[0]&&b[0].ownerDocument||c);var h=[],i;for(var j=0,k;(k=a[j])!=null;j++){typeof k=="number"&&(k+="");if(!k)continue;if(typeof k=="string")if(!bb.test(k))k=b.createTextNode(k);else{k=k.replace($,"<$1>");var l=(_.exec(k)||["",""])[1].toLowerCase(),m=bg[l]||bg._default,n=m[0],o=b.createElement("div");o.innerHTML=m[1]+k+m[2];while(n--)o=o.lastChild;if(!f.support.tbody){var p=ba.test(k),q=l==="table"&&!p?o.firstChild&&o.firstChild.childNodes:m[1]===""&&!p?o.childNodes:[];for(i=q.length-1;i>=0;--i)f.nodeName(q[i],"tbody")&&!q[i].childNodes.length&&q[i].parentNode.removeChild(q[i])}!f.support.leadingWhitespace&&Z.test(k)&&o.insertBefore(b.createTextNode(Z.exec(k)[0]),o.firstChild),k=o.childNodes}var r;if(!f.support.appendChecked)if(k[0]&&typeof (r=k.length)=="number")for(i=0;i=0)return b+"px"}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return bp.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle;c.zoom=1;var e=f.isNaN(b)?"":"alpha(opacity="+b*100+")",g=d&&d.filter||c.filter||"";c.filter=bo.test(g)?g.replace(bo,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){var c;f.swap(a,{display:"inline-block"},function(){b?c=bz(a,"margin-right","marginRight"):c=a.style.marginRight});return c}})}),c.defaultView&&c.defaultView.getComputedStyle&&(bA=function(a,c){var d,e,g;c=c.replace(br,"-$1").toLowerCase();if(!(e=a.ownerDocument.defaultView))return b;if(g=e.getComputedStyle(a,null))d=g.getPropertyValue(c),d===""&&!f.contains(a.ownerDocument.documentElement,a)&&(d=f.style(a,c));return d}),c.documentElement.currentStyle&&(bB=function(a,b){var c,d=a.currentStyle&&a.currentStyle[b],e=a.runtimeStyle&&a.runtimeStyle[b],f=a.style;!bs.test(d)&&bt.test(d)&&(c=f.left,e&&(a.runtimeStyle.left=a.currentStyle.left),f.left=b==="fontSize"?"1em":d||0,d=f.pixelLeft+"px",f.left=c,e&&(a.runtimeStyle.left=e));return d===""?"auto":d}),bz=bA||bB,f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)});var bE=/%20/g,bF=/\[\]$/,bG=/\r?\n/g,bH=/#.*$/,bI=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bJ=/^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bK=/^(?:about|app|app\-storage|.+\-extension|file|widget):$/,bL=/^(?:GET|HEAD)$/,bM=/^\/\//,bN=/\?/,bO=/)<[^<]*)*<\/script>/gi,bP=/^(?:select|textarea)/i,bQ=/\s+/,bR=/([?&])_=[^&]*/,bS=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bT=f.fn.load,bU={},bV={},bW,bX;try{bW=e.href}catch(bY){bW=c.createElement("a"),bW.href="",bW=bW.href}bX=bS.exec(bW.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bT)return bT.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("
").append(c.replace(bO,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bP.test(this.nodeName)||bJ.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bG,"\r\n")}}):{name:b.name,value:c.replace(bG,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.bind(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?f.extend(!0,a,f.ajaxSettings,b):(b=a,a=f.extend(!0,f.ajaxSettings,b));for(var c in{context:1,url:1})c in b?a[c]=b[c]:c in f.ajaxSettings&&(a[c]=f.ajaxSettings[c]);return a},ajaxSettings:{url:bW,isLocal:bK.test(bX[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":"*/*"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML}},ajaxPrefilter:bZ(bU),ajaxTransport:bZ(bV),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a?4:0;var o,r,u,w=l?ca(d,v,l):b,x,y;if(a>=200&&a<300||a===304){if(d.ifModified){if(x=v.getResponseHeader("Last-Modified"))f.lastModified[k]=x;if(y=v.getResponseHeader("Etag"))f.etag[k]=y}if(a===304)c="notmodified",o=!0;else try{r=cb(d,w),c="success",o=!0}catch(z){c="parsererror",u=z}}else{u=c;if(!c||a)c="error",a<0&&(a=0)}v.status=a,v.statusText=c,o?h.resolveWith(e,[r,c,v]):h.rejectWith(e,[v,c,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.resolveWith(e,[v,c]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f._Deferred(),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bI.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.done,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bH,"").replace(bM,bX[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bQ),d.crossDomain==null&&(r=bS.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bX[1]&&r[2]==bX[2]&&(r[3]||(r[1]==="http:"?80:443))==(bX[3]||(bX[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),b$(bU,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bL.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bN.test(d.url)?"&":"?")+d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bR,"$1_="+x);d.url=y+(y===d.url?(bN.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", */*; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=b$(bV,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){status<2?w(-1,z):f.error(z)}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)b_(g,a[g],c,e);return d.join("&").replace(bE,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var cc=f.now(),cd=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+cc++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=b.contentType==="application/x-www-form-urlencoded"&&typeof b.data=="string";if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(cd.test(b.url)||e&&cd.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(cd,l),b.url===j&&(e&&(k=k.replace(cd,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var ce=a.ActiveXObject?function(){for(var a in cg)cg[a](0,1)}:!1,cf=0,cg;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ch()||ci()}:ch,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,ce&&delete cg[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n),m.text=h.responseText;try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++cf,ce&&(cg||(cg={},f(a).unload(ce)),cg[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var cj={},ck,cl,cm=/^(?:toggle|show|hide)$/,cn=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,co,cp=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],cq,cr=a.webkitRequestAnimationFrame||a.mozRequestAnimationFrame||a.oRequestAnimationFrame;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(cu("show",3),a,b,c);for(var g=0,h=this.length;g=e.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),e.animatedProperties[this.prop]=!0;for(g in e.animatedProperties)e.animatedProperties[g]!==!0&&(c=!1);if(c){e.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){d.style["overflow"+b]=e.overflow[a]}),e.hide&&f(d).hide();if(e.hide||e.show)for(var i in e.animatedProperties)f.style(d,i,e.orig[i]);e.complete.call(d)}return!1}e.duration==Infinity?this.now=b:(h=b-this.startTime,this.state=h/e.duration,this.pos=f.easing[e.animatedProperties[this.prop]](this.state,h,0,1,e.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){for(var a=f.timers,b=0;b
";f.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"}),b.innerHTML=j,a.insertBefore(b,a.firstChild),d=b.firstChild,e=d.firstChild,h=d.nextSibling.firstChild.firstChild,this.doesNotAddBorder=e.offsetTop!==5,this.doesAddBorderForTableAndCells=h.offsetTop===5,e.style.position="fixed",e.style.top="20px",this.supportsFixedPosition=e.offsetTop===20||e.offsetTop===15,e.style.position=e.style.top="",d.style.overflow="hidden",d.style.position="relative",this.subtractsBorderForOverflowNotVisible=e.offsetTop===-5,this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==i,a.removeChild(b),f.offset.initialize=f.noop},bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;f.offset.initialize(),f.offset.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(f.css(a,"marginTop"))||0,c+=parseFloat(f.css(a,"marginLeft"))||0);return{top:b,left:c}},setOffset:function(a,b,c){var d=f.css(a,"position");d==="static"&&(a.style.position="relative");var e=f(a),g=e.offset(),h=f.css(a,"top"),i=f.css(a,"left"),j=(d==="absolute"||d==="fixed")&&f.inArray("auto",[h,i])>-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=cx.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!cx.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each(["Left","Top"],function(a,c){var d="scroll"+c;f.fn[d]=function(c){var e,g;if(c===b){e=this[0];if(!e)return null;g=cy(e);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:f.support.boxModel&&g.document.documentElement[d]||g.document.body[d]:e[d]}return this.each(function(){g=cy(this),g?g.scrollTo(a?f(g).scrollLeft():c,a?c:f(g).scrollTop()):this[d]=c})}}),f.each(["Height","Width"],function(a,c){var d=c.toLowerCase();f.fn["inner"+c]=function(){return this[0]?parseFloat(f.css(this[0],d,"padding")):null},f.fn["outer"+c]=function(a){return this[0]?parseFloat(f.css(this[0],d,a?"margin":"border")):null},f.fn[d]=function(a){var e=this[0];if(!e)return a==null?null:this;if(f.isFunction(a))return this.each(function(b){var c=f(this);c[d](a.call(this,b,c[d]()))});if(f.isWindow(e)){var g=e.document.documentElement["client"+c];return e.document.compatMode==="CSS1Compat"&&g||e.document.body["client"+c]||g}if(e.nodeType===9)return Math.max(e.documentElement["client"+c],e.body["scroll"+c],e.documentElement["scroll"+c],e.body["offset"+c],e.documentElement["offset"+c]);if(a===b){var h=f.css(e,d),i=parseFloat(h);return f.isNaN(i)?h:i}return this.css(d,typeof a=="string"?a:a+"px")}}),a.jQuery=a.$=f})(window); \ No newline at end of file diff --git a/pandora_console/include/javascript/jquery.mousewheel.js b/pandora_console/include/javascript/jquery.mousewheel.js new file mode 100755 index 0000000000..b7932415ce --- /dev/null +++ b/pandora_console/include/javascript/jquery.mousewheel.js @@ -0,0 +1,78 @@ +/*! Copyright (c) 2010 Brandon Aaron (http://brandonaaron.net) + * Licensed under the MIT License (LICENSE.txt). + * + * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers. + * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix. + * Thanks to: Seamus Leahy for adding deltaX and deltaY + * + * Version: 3.0.4 + * + * Requires: 1.2.2+ + */ + +(function($) { + +var types = ['DOMMouseScroll', 'mousewheel']; + +$.event.special.mousewheel = { + setup: function() { + if ( this.addEventListener ) { + for ( var i=types.length; i; ) { + this.addEventListener( types[--i], handler, false ); + } + } else { + this.onmousewheel = handler; + } + }, + + teardown: function() { + if ( this.removeEventListener ) { + for ( var i=types.length; i; ) { + this.removeEventListener( types[--i], handler, false ); + } + } else { + this.onmousewheel = null; + } + } +}; + +$.fn.extend({ + mousewheel: function(fn) { + return fn ? this.bind("mousewheel", fn) : this.trigger("mousewheel"); + }, + + unmousewheel: function(fn) { + return this.unbind("mousewheel", fn); + } +}); + + +function handler(event) { + var orgEvent = event || window.event, args = [].slice.call( arguments, 1 ), delta = 0, returnValue = true, deltaX = 0, deltaY = 0; + event = $.event.fix(orgEvent); + event.type = "mousewheel"; + + // Old school scrollwheel delta + if ( event.wheelDelta ) { delta = event.wheelDelta/120; } + if ( event.detail ) { delta = -event.detail/3; } + + // New school multidimensional scroll (touchpads) deltas + deltaY = delta; + + // Gecko + if ( orgEvent.axis !== undefined && orgEvent.axis === orgEvent.HORIZONTAL_AXIS ) { + deltaY = 0; + deltaX = -1*delta; + } + + // Webkit + if ( orgEvent.wheelDeltaY !== undefined ) { deltaY = orgEvent.wheelDeltaY/120; } + if ( orgEvent.wheelDeltaX !== undefined ) { deltaX = -1*orgEvent.wheelDeltaX/120; } + + // Add event and delta to the front of the arguments + args.unshift(event, delta, deltaX, deltaY); + + return $.event.handle.apply(this, args); +} + +})(jQuery); \ No newline at end of file diff --git a/pandora_console/include/javascript/pandora.js b/pandora_console/include/javascript/pandora.js index c2d0c2f159..01228890c6 100644 --- a/pandora_console/include/javascript/pandora.js +++ b/pandora_console/include/javascript/pandora.js @@ -10,8 +10,8 @@ function toggleDiv (divid){ } function winopeng (url, wid) { - open (url, wid,"width=590,height=410,status=no,toolbar=no,menubar=no,scrollbar=no"); - // WARNING !! Internet Explorer DOESNT SUPPORT "-" CARACTERS IN WINDOW HANDLE VARIABLE + open (url, wid,"width=650,height=410,status=no,toolbar=no,menubar=no,scrollbar=no"); + // WARNING !! Internet Explorer DOESNT SUPPORT "-" CHARACTERS IN WINDOW HANDLE VARIABLE status =wid; } diff --git a/pandora_console/operation/agentes/estado_generalagente.php b/pandora_console/operation/agentes/estado_generalagente.php index 2fe374c2ae..46b63b7b5a 100644 --- a/pandora_console/operation/agentes/estado_generalagente.php +++ b/pandora_console/operation/agentes/estado_generalagente.php @@ -66,12 +66,9 @@ if ($config["agentaccess"]){ echo '
 
'; echo ''.__('Events generated -by module-').'
'; echo graph_event_module (290, 120, $id_agente); -if ($config['flash_charts']) { - echo graphic_agentevents ($id_agente, 290, 60, 86400); -} -else{ - graph_graphic_agentevents_static ($id_agente, 290, 15, 86400, ''); -} +echo '
'; +graph_graphic_agentevents_static ($id_agente, 290, 15, 86400, ''); + echo ''; echo '
'; diff --git a/pandora_console/operation/agentes/stat_win.php b/pandora_console/operation/agentes/stat_win.php index 4bcb5fd4d1..1a75599075 100644 --- a/pandora_console/operation/agentes/stat_win.php +++ b/pandora_console/operation/agentes/stat_win.php @@ -14,16 +14,14 @@ // GNU General Public License for more details. - -// Global & session management -require_once ('../../include/config.php'); -require_once ('../../include/auth/mysql.php'); - if (! isset($_SESSION['id_usuario'])) { session_start(); session_write_close(); } +// Global & session management +require_once ('../../include/config.php'); +require_once ('../../include/auth/mysql.php'); require_once ($config['homedir'] . '/include/functions.php'); require_once ($config['homedir'] . '/include/functions_db.php'); require_once ($config['homedir'] . '/include/functions_reporting.php'); @@ -32,6 +30,8 @@ require_once ($config['homedir'] . '/include/functions_modules.php'); check_login (); +echo ''; + $id = get_parameter('id'); $label = base64_decode(get_parameter('label', '')); ?> @@ -108,7 +108,7 @@ function show_others() { //--> - + "; + +echo "
"; + switch ($graph_type) { case 'boolean': echo grafico_modulo_boolean ($id, $period, $draw_events, $width, $height, @@ -195,6 +198,7 @@ switch ($graph_type) { echo fs_error_image ('../images'); break; } +echo "
"; //z-index is 1 because 2 made the calendar show under the divmenu. echo ''; ?>