From 5855f5895d71120728b7281d5bbc50853a374315 Mon Sep 17 00:00:00 2001
From: mdtrooper <tres.14159@gmail.com>
Date: Wed, 13 Feb 2013 17:47:43 +0000
Subject: [PATCH] 2013-02-13 Miguel de Dios <miguel.dedios@artica.es>

	* extensions/module_groups.php,
	godmode/massive/massive_add_alerts.php,
	godmode/massive/massive_edit_modules.php, godmode/tag/tag.php:
	cleaned source code style.

	* images/network.disabled.png: added image.
	* images/chart_curve.disabled.png: fixed mistake image.

	* godmode/agentes/module_manager.php: improved the style of table.

	Fixes: #3604465




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7647 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
---
 pandora_console/ChangeLog                     |  14 ++++
 pandora_console/extensions/module_groups.php  |   6 +-
 .../godmode/agentes/module_manager.php        |  62 ++++++++++++------
 .../godmode/massive/massive_add_alerts.php    |  38 +++++------
 .../godmode/massive/massive_edit_modules.php  |   2 +-
 pandora_console/godmode/tag/tag.php           |   6 +-
 .../images/chart_curve.disabled.png           | Bin 398 -> 399 bytes
 pandora_console/images/network.disabled.png   | Bin 0 -> 377 bytes
 8 files changed, 82 insertions(+), 46 deletions(-)
 create mode 100644 pandora_console/images/network.disabled.png

diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog
index d405f1d4d6..d9a451bfaa 100644
--- a/pandora_console/ChangeLog
+++ b/pandora_console/ChangeLog
@@ -1,3 +1,17 @@
+2013-02-13 Miguel de Dios <miguel.dedios@artica.es>
+	
+	* extensions/module_groups.php,
+	godmode/massive/massive_add_alerts.php,
+	godmode/massive/massive_edit_modules.php, godmode/tag/tag.php:
+	cleaned source code style.
+	
+	* images/network.disabled.png: added image.
+	* images/chart_curve.disabled.png: fixed mistake image.
+	
+	* godmode/agentes/module_manager.php: improved the style of table.
+	
+	Fixes: #3604465
+
 2013-02-13 Miguel de Dios <miguel.dedios@artica.es>
 	
 	* include/config_process.php: fixed the lost initial value for
diff --git a/pandora_console/extensions/module_groups.php b/pandora_console/extensions/module_groups.php
index 93996eba23..ad31e7947f 100644
--- a/pandora_console/extensions/module_groups.php
+++ b/pandora_console/extensions/module_groups.php
@@ -62,7 +62,7 @@ if (is_ajax ()) {
 								ON t3.id = t1.id_alert_template_module
 								AND t1.id_alert_action = t2.id
 							WHERE (t3.id_alert_template = ' . $template['id'] . ' AND
-								  t3.id_agent_module = ' . $module['id_agente_modulo'] . ');';
+								t3.id_agent_module = ' . $module['id_agente_modulo'] . ');';
 						
 						$actions = db_get_all_rows_sql($sql);
 						
@@ -74,9 +74,9 @@ if (is_ajax ()) {
 							
 							$default_action = true;
 							
-							$actions = db_get_all_rows_sql($sql);							
+							$actions = db_get_all_rows_sql($sql);
 						}
-
+						
 						if ($actions === false) {
 							$actions = array();
 						}
diff --git a/pandora_console/godmode/agentes/module_manager.php b/pandora_console/godmode/agentes/module_manager.php
index 22bb6f8588..959e7f673e 100644
--- a/pandora_console/godmode/agentes/module_manager.php
+++ b/pandora_console/godmode/agentes/module_manager.php
@@ -45,10 +45,18 @@ echo '</form>';
 // Check if there is at least one server of each type available to assign that
 // kind of modules. If not, do not show server type in combo
 
-$network_available = db_get_sql ("SELECT count(*) from tserver where server_type = 1"); //POSTGRESQL AND ORACLE COMPATIBLE
-$wmi_available = db_get_sql ("SELECT count(*) from tserver where server_type = 6"); //POSTGRESQL AND ORACLE COMPATIBLE
-$plugin_available = db_get_sql ("SELECT count(*) from tserver where server_type = 4"); //POSTGRESQL AND ORACLE COMPATIBLE
-$prediction_available = db_get_sql ("SELECT count(*) from tserver where server_type = 5"); //POSTGRESQL AND ORACLE COMPATIBLE
+$network_available = db_get_sql ("SELECT count(*)
+	FROM tserver
+	WHERE server_type = 1"); //POSTGRESQL AND ORACLE COMPATIBLE
+$wmi_available = db_get_sql ("SELECT count(*)
+	FROM tserver
+	WHERE server_type = 6"); //POSTGRESQL AND ORACLE COMPATIBLE
+$plugin_available = db_get_sql ("SELECT count(*)
+	FROM tserver
+	WHERE server_type = 4"); //POSTGRESQL AND ORACLE COMPATIBLE
+$prediction_available = db_get_sql ("SELECT count(*)
+	FROM tserver
+	WHERE server_type = 5"); //POSTGRESQL AND ORACLE COMPATIBLE
 
 // Development mode to use all servers
 if ($develop_bypass) {
@@ -307,7 +315,7 @@ switch ($sortField) {
 					case "postgresql":
 						$order[] = array('field' => 'tagente_modulo.nombre', 'order' => 'DESC');
 						break;
-					case "oracle":	
+					case "oracle":
 						$order[] = array('field' => 'dbms_lob.substr(tagente_modulo.nombre,4000,1)', 'order' => 'DESC');
 						break;
 				}
@@ -419,7 +427,7 @@ switch ($config["dbtype"]) {
 		
 		$modules = db_get_all_rows_sql($sql);
 		break;
-	case "oracle":	
+	case "oracle":
 		$set = array();
 		$set['limit'] = $limit;
 		$set['offset'] = $offset;
@@ -473,6 +481,7 @@ $table->head[7] = __('Warn');
 
 
 $table->head[8] = __('Action');
+$table->head[9] = '<span title="' . __('Delete') . '">' . __('D.') . '</span>';
 
 $table->rowstyle = array();
 $table->style = array ();
@@ -480,8 +489,9 @@ $table->style[0] = 'font-weight: bold';
 $table->size = array ();
 $table->size[2] = '55px';
 $table->align = array ();
-$table->align[2] = 'center';
-$table->align[8] = 'center';
+$table->align[2] = 'left';
+$table->align[8] = 'left';
+$table->align[9] = 'left';
 $table->data = array ();
 
 $agent_interval = agents_get_interval ($id_agente);
@@ -518,9 +528,9 @@ foreach ($modules as $module) {
 		$table->rowstyle[$i - 1] = 'text-align: center';
 		$table->rowclass[$i - 1] = 'datos3';
 		if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK)
-				$table->colspan[$i - 1][0] = 9;
+				$table->colspan[$i - 1][0] = 10;
 		else
-			$table->colspan[$i - 1][0] = 7;
+			$table->colspan[$i - 1][0] = 8;
 		
 		$data = array ();
 	}
@@ -631,14 +641,7 @@ foreach ($modules as $module) {
 			html_print_image('images/lightbulb.png', true, array('alt' => __('Disable module'), 'title' => __('Disable module'))) ."</a>";
 	}
 	
-	if(check_acl ($config['id_user'], $agent['id_grupo'], "AW")) {
-		// Delete module
-		$data[8] .= html_print_checkbox('id_delete[]', $module['id_agente_modulo'], false, true);
-		$data[8] .= '&nbsp;<a href="index.php?sec=gagente&tab=module&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&delete_module='.$module['id_agente_modulo'].'"
-			onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
-		$data[8] .= html_print_image ('images/cross.png', true,
-			array ('title' => __('Delete')));
-		$data[8] .= '</a> ';
+	if (check_acl ($config['id_user'], $agent['id_grupo'], "AW")) {
 		$data[8] .= '&nbsp;<a href="index.php?sec=gagente&tab=module&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&duplicate_module='.$module['id_agente_modulo'].'"
 			onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
 		$data[8] .= html_print_image ('images/copy.png', true,
@@ -646,7 +649,6 @@ foreach ($modules as $module) {
 		$data[8] .= '</a> ';
 		
 		// Make a data normalization
-		
 		if (isset($numericModules[$type])) {
 			if ($numericModules[$type] === true) {
 				$data[8] .= '&nbsp;<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&tab=module&fix_module='.$module['id_agente_modulo'].'" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
@@ -655,14 +657,34 @@ foreach ($modules as $module) {
 				$data[8] .= '</a>';
 			}
 		}
+		else {
+			$data[8] .= "&nbsp;" . html_print_image ('images/chart_curve.disabled.png', true,
+				array ('title' => __('Normalize (Disabled)')));
+		}
+		
 		//create network component action
-		if (is_user_admin($config['id_user'])) {
+		if ((is_user_admin($config['id_user'])) && 
+			($module['id_modulo'] == MODULE_NETWORK)) {
 			$data[8] .= '&nbsp;<a href="index.php?sec=gmodules&sec2=godmode/modules/manage_network_components&create_network_from_module=1&id_agente='.$id_agente.'&create_module_from='.$module['id_agente_modulo'].'"
 				onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
 			$data[8] .= html_print_image ('images/network.png', true,
 				array ('title' => __('Create network component')));
 			$data[8] .= '</a> ';
 		}
+		else {
+			$data[8] .= '&nbsp;' . html_print_image ('images/network.disabled.png', true,
+				array ('title' => __('Create network component (Disabled)')));
+		}
+	}
+	
+	if (check_acl ($config['id_user'], $agent['id_grupo'], "AW")) {
+		// Delete module
+		$data[9] = html_print_checkbox('id_delete[]', $module['id_agente_modulo'], false, true);
+		$data[9] .= '&nbsp;<a href="index.php?sec=gagente&tab=module&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&delete_module='.$module['id_agente_modulo'].'"
+			onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
+		$data[9] .= html_print_image ('images/cross.png', true,
+			array ('title' => __('Delete')));
+		$data[9] .= '</a> ';
 	}
 	
 	array_push ($table->data, $data);
diff --git a/pandora_console/godmode/massive/massive_add_alerts.php b/pandora_console/godmode/massive/massive_add_alerts.php
index 69c001942d..1a64c6b2d3 100644
--- a/pandora_console/godmode/massive/massive_add_alerts.php
+++ b/pandora_console/godmode/massive/massive_add_alerts.php
@@ -55,13 +55,13 @@ function process_manage_add ($id_alert_template, $id_agents, $module_names) {
 		return false;
 	}
 	
-	foreach($module_names as $module){
+	foreach($module_names as $module) {
 		foreach($id_agents as $id_agent) {
 			 $module_id = modules_get_agentmodule_id($module, $id_agent);
 			 $modules_id[] = $module_id['id_agente_modulo'];
 		}
 	}
-		
+	
 	if(count($module_names) == 1 && $module_names[0] == '0'){
 		$modules_id = agents_common_modules ($id_agents, false, true);
 	}
@@ -69,9 +69,9 @@ function process_manage_add ($id_alert_template, $id_agents, $module_names) {
 	
 	$conttotal = 0;
 	$contsuccess = 0;
-	foreach($modules_id as $module){
+	foreach($modules_id as $module) {
 		$success = alerts_create_alert_agent_module ($module, $id_alert_template);
-
+		
 		if($success)
 			$contsuccess ++;
 		$conttotal ++;
@@ -85,9 +85,9 @@ function process_manage_add ($id_alert_template, $id_agents, $module_names) {
 	}
 	
 	ui_print_result_message ($contsuccess > 0,
-	__('Successfully added')."(".$contsuccess."/".$conttotal.")",
-	__('Could not be added'));
-
+		__('Successfully added')."(".$contsuccess."/".$conttotal.")",
+		__('Could not be added'));
+	
 }
 
 $id_group = (int) get_parameter ('id_group', -1);
@@ -167,12 +167,12 @@ ui_require_jquery_file ('pandora.controls');
 <script type="text/javascript">
 /* <![CDATA[ */
 $(document).ready (function () {
-	$("#checkbox-recursion").click(function (){
+	$("#checkbox-recursion").click(function () {
 		$("#id_group").trigger("change");
 	});
-
+	
 	$("#id_agents").change(agent_changed_by_multiple_agents);
-
+	
 	$("#id_group").change (function () {
 		var $select = $("#id_agents").enable ();
 		$("#agent_loading").show ();
@@ -203,32 +203,32 @@ $(document).ready (function () {
 	function () {
 		$(this).css ("width", "auto"); 
 	});
-			
+	
 	$("#id_group").blur (function () {
 		$(this).css ("width", "180px"); 
-	});	
-
+	});
+	
 	$("#id_agents").click (
 	function () {
-		$(this).css ("width", "auto"); 
+		$(this).css ("width", "auto");
 	});
-			
+	
 	$("#id_agents").blur (function () {
 		$(this).css ("width", "180px"); 
-	});	
+	});
 	
 	$("#module").click (
 	function () {
 		$(this).css ("width", "auto"); 
 	});
-			
+	
 	$("#module").blur (function () {
 		$(this).css ("width", "180px"); 
-	});		
+	});
 	
 	$("#modules_selection_mode").change (function() {
 		$("#id_agents").trigger('change');
-	});	
+	});
 	
 });
 /* ]]> */
diff --git a/pandora_console/godmode/massive/massive_edit_modules.php b/pandora_console/godmode/massive/massive_edit_modules.php
index 6c668994e9..a1e586e766 100644
--- a/pandora_console/godmode/massive/massive_edit_modules.php
+++ b/pandora_console/godmode/massive/massive_edit_modules.php
@@ -131,7 +131,7 @@ if ($update) {
 			"(" . $success . "/" . $count . ")",
 		__('Could not be updated'));
 	
-	$info = 'Modules: ' . json_encode($modules_) . ' Agents: ' . json_encode($agents_);	
+	$info = 'Modules: ' . json_encode($modules_) . ' Agents: ' . json_encode($agents_);
 	if ($success > 0) {
 		db_pandora_audit("Masive management", "Edit module", false, false, $info);
 	}
diff --git a/pandora_console/godmode/tag/tag.php b/pandora_console/godmode/tag/tag.php
index 9748e00367..80e2ca379b 100644
--- a/pandora_console/godmode/tag/tag.php
+++ b/pandora_console/godmode/tag/tag.php
@@ -72,7 +72,7 @@ $buttons[$tab]['active'] = true;
 if (defined('METACONSOLE')) {
 	
 	// Print header
-	ui_meta_print_header(__('Tags'), "", $buttons);	
+	ui_meta_print_header(__('Tags'), "", $buttons);
 	
 }
 else {
@@ -153,8 +153,8 @@ if (!empty($result)) {
 	$table->style = array ();
 	$table->style[0] = 'font-weight: bold; text-align:center';
 	$table->style[1] = 'text-align:center';
-	$table->style[2] = 'text-align:center';	
-	$table->style[3] = 'text-align:center'; 
+	$table->style[2] = 'text-align:center';
+	$table->style[3] = 'text-align:center';
 	$table->style[5] = 'text-align:center';
 	$table->head[0] = __('Tag name');
 	$table->head[1] = __('Description');
diff --git a/pandora_console/images/chart_curve.disabled.png b/pandora_console/images/chart_curve.disabled.png
index dc2b5b710d2815191a6eb8f069050d433993dbd0..f46ecf9da11d7bf173e9ca57f46fa735685cb8ae 100644
GIT binary patch
delta 334
zcmV-U0kQs$1CIlcB#|*Gf87EN5fBy7B@qz-00AILL_t(2&vnsDD{XNc#_`Ykw>DcQ
z7@(BMh&sknCq-dK$J~ev<VBcz0ZQHjCNAkr3`8dbd%#RC1D!3ly^|tmt!1#cOGlo;
zGy48+&oA29PX{xZuL?qWtT|2x$C3I91-nfISX6PUr1Z&erBcKhe_C8>kV8(rATKYe
z){3Fqp)t3Dih{Brm6)#r8Gc%Jr_X^41G?O6m((_iq0xvVXBrIabgrN%vG4{&R^;T}
z_$9XOTE8FiqBkHjC%Ey)nr_c#6tzlfX9psgRBA%2E7yLz^r-Hm1AhfMn<}Q<J8@yx
zqoog^(~}LEX=S~7L>0BY=NiMR7d=KrO5h*00mKnz-}CSI<W(qs+1nbbw)_8Ck?=q?
g*`vvKO4g5G0p{FY<|P_EYybcN07*qoM6N<$g46eyO8@`>

delta 331
zcmV-R0kr;)1C9fbBnkm@Qb$4nuFf3kks&O9+6Nj40S9}T3s?XE0TM|>K~yNub<w>_
zoKX<Q@!vV`S<wU(mVovqY?CI~XknAmn-VX<yYK>*G(w7Gi5Su>_|e!{SnU!MAuQQl
z&!pIQV+u1cFwFCxfrlr3Ijo10=PUA&L7m0_Y8Hc9q~hl@$1@!pq`X{w^6?*eYUB}r
z<fn^YzPIz-r8UhH5JF?ySNGtXm%6Q77Qk;4JzeK^-O75cv1S1<(v@v_=d;FvEF^US
zgfOxRwyf)DB*gMV2xC2vyq6?QtO{ACdQiM@>Vs%qoEe%5NhXZFa&7E~D|7eyrgp3d
zNuj#)V9kMS=mdM-2vvv$Fwyf`lI-g?Te01WRY-&SHg$x=-)^HccM~NaU9@o*MI+0t
d$*M*<{sRO2c)!_iZw3GW002ovPDHLkV1jpHnb-gT

diff --git a/pandora_console/images/network.disabled.png b/pandora_console/images/network.disabled.png
new file mode 100644
index 0000000000000000000000000000000000000000..cba8a75b7ed14b26d656545ed22de442619d49d9
GIT binary patch
literal 377
zcmV-<0fzpGP)<h;3K|Lk000e1NJLTq000mG000mO1ONa4wfZ;e00002VoOIv0RM-N
z%)bBt010qNS#tmY3ljhU3ljkVnw%H_000McNliru-2x2}C@yxfM9u&J0SZY(K~yNu
zb<w*nL}3&K;O|^qVi3U~@dg@+M56EnDi5F`IuA01TICtUr6QsbN<<W*P*J!{B5@6q
zIp<e6#)z?so$TzDwf5ROVrxEI37uLXdQX<H@tlX&$in(dN?wZO0s>7n(k67JUt&3e
zL|k<B2C*P~4L|Iti_K`4tNkX#Hf7FKmG$Z|St!IBzL`B$RIMrfSS+7kM3o}esKjF<
z<o6E!i^{IG8%9O9X@|{(+Q5|qgQjqYS<H%?6q0e>>S9;=Fjg4Ue`4;s^@2f{hCDYN
z3et|~-ndhV8%GwtbAy`bEn3Yc;$u&0N=8E4pJ$~L@yYA!=Hc8%&=Tp<!`t@$zhgcD
X1q5@LN2|5%00000NkvXXu0mjfl|-B~

literal 0
HcmV?d00001