From 3b633261c66c5e5c5e5c7a83b99b841a28ec3847 Mon Sep 17 00:00:00 2001
From: zarzuelo <noreply@pandorafms.org>
Date: Fri, 16 Mar 2012 09:23:09 +0000
Subject: [PATCH] 2012-03-16  Sergio Martin <sergio.martin@artica.es>

	* include/functions_html.php
	include/javascript/pandora.js
	images/pencil.png
	images/default_list.png: Improved the usability
	of the periods advanced control toggling between
	manual and default mode



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5784 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
---
 pandora_console/ChangeLog                     |   9 +++++++
 pandora_console/images/default_list.png       | Bin 0 -> 451 bytes
 pandora_console/images/pencil.png             | Bin 0 -> 474 bytes
 pandora_console/include/functions_html.php    |  23 ++++++++++++------
 pandora_console/include/javascript/pandora.js |   9 +++++++
 5 files changed, 34 insertions(+), 7 deletions(-)
 create mode 100644 pandora_console/images/default_list.png
 create mode 100644 pandora_console/images/pencil.png

diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog
index 18b7740062..931a4f0131 100644
--- a/pandora_console/ChangeLog
+++ b/pandora_console/ChangeLog
@@ -1,3 +1,12 @@
+2012-03-16  Sergio Martin <sergio.martin@artica.es>
+
+	* include/functions_html.php
+	include/javascript/pandora.js
+	images/pencil.png
+	images/default_list.png: Improved the usability
+	of the periods advanced control toggling between
+	manual and default mode
+
 2012-03-15  Sancho Lerena <slerena@artica.es>
 
 	* images/console/background: Replaced old imagemaps
diff --git a/pandora_console/images/default_list.png b/pandora_console/images/default_list.png
new file mode 100644
index 0000000000000000000000000000000000000000..3a953aed17a906cc75c042e4b7e620bf743926a0
GIT binary patch
literal 451
zcmV;!0X+VRP)<h;3K|Lk000e1NJLTq000mG000mO1^@s6AM^iV0000PbVXQnQ*UN;
zcVTj606}DLVr3vnZDD6+Qe|Oed2z{QJOBUzWl2OqRCwBqldVs~Kp4i~yL*Q&e*qAJ
z0)+xa1!l=Y8q6F79D)RaAeezbA@N{Qu#g1{GdLWM5a2IhVoe~u58mtOtsmpIH@RNh
zd-~k(Y5Ou`4A{EsbiSlgfzcWUcSaYpgL6P3dK-<#G-eA@%3w2!VA8s2w*xyngN)?;
z<CEMua5mV@t<%tSkV?bc?2OZ6USMkq5iTEJ0SU8gASvE%xKPkz8BL&o{rVCJQ8iGs
z`*$J>`k_IFL<Sf4FD^z_8U9{<v8b;QZ~=$WG7&IfIRmR#%6JHJ5zcR)p@s~~uQ8DZ
z4#?bZKm^Cll{7-xz()8<l-~f6!`bx{)P$%+NR)!3=BnR-3xw8oXwOFcJ{pp-1oZt|
zR}X1~GJ%b7vK9Vg@TX>ke!8>n`H4+I?>IT<xpsju?KIRog1F!BQiH5%%W6FRNIP>H
taU6Hk%d9CFWAiixFnRUp*|%Q-1^{uQhX!HZ@EQOB002ovPDHLkV1gVoz|sH!

literal 0
HcmV?d00001

diff --git a/pandora_console/images/pencil.png b/pandora_console/images/pencil.png
new file mode 100644
index 0000000000000000000000000000000000000000..d5ba3d5962359f1d6e4c7965e89850570307fe0e
GIT binary patch
literal 474
zcmV<00VV#4P)<h;3K|Lk000e1NJLTq000mG000mO1^@s6AM^iV0000PbVXQnQ*UN;
zcVTj606}DLVr3vnZDD6+Qe|Oed2z{QJOBUzd`Uz>RCwBy(#=Z(K^O+`$FQyiC3%oK
zWOa$6@}mDhhloB7-Re|ARQC|1AW$jjuq6bB5Z;3bx=2b%Mui{grMgHUMQfs^;@8?V
zyJTS6G7ap)%<k{mecu`2ALC)mN20bfQk@e*(8P+@tya=H)C<z3Ms(Zr6T%c=vh0$T
zrDg1goyhZ9#IqFy%}0bO;MzPwOmltU>`si2O~Czmj&i09A<0Y66>`{b))W1-3P{8e
zYgvHnmSAu|3-6T|+@?)Odk|2_;u$r-zX2(FWnK|!Tg72WfgQ_+j=mBQo2Zb-Ns3cI
z_MNU4;0kLnzZaD7pSw_xKWL!>4kG<ExZy4|#$`C}v{>YPb+{(rQU)8ji-uSnO7Z4f
z(-Fgz>bqfSW-J9HjweaSupW4H14$Z?%hCT5n6Oj=DOPAqCraJ3KvAGyE;3^&;N-p?
zr=BM$OL;(JfFsnyjHMD{d<ielH_)b=Q79;3wELNH^(c@2T4ToILHZJ40B=moz`lmU
QX#fBK07*qoM6N<$f@Ukw&;S4c

literal 0
HcmV?d00001

diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php
index 3a99537659..2b36812501 100644
--- a/pandora_console/include/functions_html.php
+++ b/pandora_console/include/functions_html.php
@@ -436,16 +436,25 @@ function html_print_extended_select_for_time ($name, $selected = '', $script = '
 	
 	ob_start();
 	
-	html_print_select ($fields, $name . '_select', $selected,"" . $script,
-		$nothing, $nothing_value, false, false, false, '', false, 'font-size: xx-small;'.$select_style);
-	html_print_input_text ($name . '_text', $selected, '', $size);
-	html_print_input_hidden ($name, $selected);
-	html_print_select ($units, $name . '_units', 1, "" . $script,
-		$nothing, $nothing_value, false, false, false, '', false, 'font-size: xx-small;'.$select_style);
+	echo '<div id="'.$name.'_default" style="width:100%">';
+		html_print_select ($fields, $name . '_select', $selected,"" . $script,
+			$nothing, $nothing_value, false, false, false, '', false, 'font-size: xx-small;'.$select_style);
+		echo ' <a href="javascript:">'.html_print_image('images/pencil.png',true,array('class' => $name . '_toggler', 'alt' => __('Manual'), 'title' => __('Manual'))).'</a>';
+	echo '</div>';
+	
+	echo '<div id="'.$name.'_manual" style="width:100%">';
+		html_print_input_text ($name . '_text', $selected, '', $size);
+		html_print_input_hidden ($name, $selected);
+		html_print_select ($units, $name . '_units', 1, "" . $script,
+			$nothing, $nothing_value, false, false, false, '', false, 'font-size: xx-small;'.$select_style);
+		echo ' <a href="javascript:">'.html_print_image('images/default_list.png',true,array('class' => $name . '_toggler', 'alt' => __('List'), 'title' => __('List'))).'</a>';
+	echo '</div>';
 	
 	echo "
 	<script type='text/javascript'>
-		period_select_events('$name');
+		$(document).ready (function () {
+			period_select_events('$name');
+		});
 	</script>
 	";
 		
diff --git a/pandora_console/include/javascript/pandora.js b/pandora_console/include/javascript/pandora.js
index 04d65a9c8a..1c4b168721 100644
--- a/pandora_console/include/javascript/pandora.js
+++ b/pandora_console/include/javascript/pandora.js
@@ -610,12 +610,21 @@ function agent_autocomplete (id_agent_name, id_server_name, id_agent_id ) {
  * @param name string with the name of the select for time
  */
 function period_select_events(name) {
+	// Manual mode is hidden by default
+	$('#'+name+'_manual').hide();
+	
 	// If the text input is empty, we put on it 5 minutes by default
 	if($('#text-'+name+'_text').val() == '') {
 		$('#text-'+name+'_text').val(300);
 		$('#'+name+'_select option:eq(1)').attr('selected', true);
 	}
 	
+	$('.'+name+'_toggler').click(function() {
+		$('#'+name+'_default').toggle();
+		$('#'+name+'_manual').toggle();
+		$('#text-'+name+'_text').focus();
+	});
+	
 	function adjustTextUnits() {
 		var restPrev;
 		var unitsSelected = false;