2012-07-27 Miguel de Dios <miguel.dedios@artica.es>

* godmode/gis_maps/index.php, godmode/groups/group_list.php,
	godmode/db/db_main.php, godmode/agentes/agent_manager.php,
	godmode/agentes/module_manager_editor_common.php: cleaned source
	code style.




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6821 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2012-07-27 09:01:12 +00:00
parent 765cb7860b
commit e2c6686186
6 changed files with 79 additions and 59 deletions

View File

@ -1,3 +1,10 @@
2012-07-27 Miguel de Dios <miguel.dedios@artica.es>
* godmode/gis_maps/index.php, godmode/groups/group_list.php,
godmode/db/db_main.php, godmode/agentes/agent_manager.php,
godmode/agentes/module_manager_editor_common.php: cleaned source
code style.
2012-07-27 Miguel de Dios <miguel.dedios@artica.es>
* include/Image/Graph/*, include/Image/Graph.php,

View File

@ -296,7 +296,7 @@ if (!$new_agent) {
}
else
$table->data[3][1] = '<em>'.__('Not available').'</em>';
$listIcons = gis_get_array_list_icons();
$arraySelectIcon = array();
@ -322,18 +322,23 @@ else {
$path_warning = $path . $icon_path . ".warning.png";
}
$table->data[4][1] = html_print_select($arraySelectIcon, "icon_path", $icon_path, "changeIcons();", __('None'), '', true) .
'&nbsp;' . html_print_image($path_ok, true, array("id" => "icon_ok", "style" => "display:".$display_icons.";")) .
'&nbsp;' . html_print_image($path_bad, true, array("id" => "icon_bad", "style" => "display:".$display_icons.";")) .
'&nbsp;' . html_print_image($path_warning, true, array("id" => "icon_warning", "style" => "display:".$display_icons.";"));
$table->data[4][1] = html_print_select($arraySelectIcon, "icon_path",
$icon_path, "changeIcons();", __('None'), '', true) .
'&nbsp;' . html_print_image($path_ok, true,
array("id" => "icon_ok", "style" => "display:".$display_icons.";")) .
'&nbsp;' . html_print_image($path_bad, true,
array("id" => "icon_bad", "style" => "display:".$display_icons.";")) .
'&nbsp;' . html_print_image($path_warning, true,
array("id" => "icon_warning", "style" => "display:".$display_icons.";"));
if ($config['activate_gis']) {
$table->data[5][0] = __('Ignore new GIS data:');
$table->data[5][1] = __('Disabled').' '.html_print_radio_button_extended ("update_gis_data", 1, '', $update_gis_data, false, '', 'style="margin-right: 40px;"', true);
$table->data[5][1] .= __('Enabled').' '.html_print_radio_button_extended ("update_gis_data", 0, '', $update_gis_data, false, '', 'style="margin-right: 40px;"', true);
$table->data[5][1] = __('Disabled') . ' ' .
html_print_radio_button_extended ("update_gis_data", 1, '',
$update_gis_data, false, '', 'style="margin-right: 40px;"', true);
$table->data[5][1] .= __('Enabled') . ' ' .
html_print_radio_button_extended ("update_gis_data", 0, '',
$update_gis_data, false, '', 'style="margin-right: 40px;"', true);
}
$table->data[6][0] = __('Url address:');
@ -378,7 +383,8 @@ if ($id_agente) {
html_print_submit_button (__('Update'), 'updbutton', false, 'class="sub upd"');
html_print_input_hidden ('update_agent', 1);
html_print_input_hidden ('id_agente', $id_agente);
} else {
}
else {
html_print_submit_button (__('Create'), 'crtbutton', false, 'class="sub wand"');
html_print_input_hidden ('create_agent', 1);
}
@ -390,11 +396,11 @@ ui_require_jquery_file ('bgiframe');
?>
<script type="text/javascript">
/* <![CDATA[ */
//Use this function for change 3 icons when change the selectbox
function changeIcons() {
icon = $("#icon_path :selected").val();
$("#icon_without_status").attr("src", "images/spinner.png");
$("#icon_default").attr("src", "images/spinner.png");
$("#icon_ok").attr("src", "images/spinner.png");
@ -487,4 +493,4 @@ $(document).ready (function () {
$(".ui-autocomplete").css("text-align", "left");
});
/* ]]> */
</script>
</script>

View File

@ -286,32 +286,34 @@ if ($__code_from == 'modules') {
$__id_where = 'b.id_agente_modulo';
$__id = (int)$id_agent_module;
// Code comes from policy module editor
}else {
}
else {
global $__id_pol_mod;
$__table_modules= 'ttag_policy_module';
$__id_where = 'b.id_policy_module';
$__id = $__id_pol_mod;
}
$table_advanced->data[6][1] = html_print_select_from_sql ("SELECT id_tag, name
FROM ttag
WHERE id_tag NOT IN (
SELECT a.id_tag
FROM ttag a, $__table_modules b
WHERE a.id_tag = b.id_tag AND $__id_where = $__id )
ORDER BY name",
'id_tag_available[]', $id_tag, '','','', true, true, false, false, 'width: 200px', '5');
$table_advanced->data[6][1] = html_print_select_from_sql (
"SELECT id_tag, name
FROM ttag
WHERE id_tag NOT IN (
SELECT a.id_tag
FROM ttag a, $__table_modules b
WHERE a.id_tag = b.id_tag AND $__id_where = $__id )
ORDER BY name", 'id_tag_available[]', $id_tag, '','','',
true, true, false, false, 'width: 200px', '5');
$table_advanced->data[6][2] = html_print_image('images/darrowright.png', true, array('id' => 'right', 'title' => __('Add tags to module'))); //html_print_input_image ('add', 'images/darrowright.png', 1, '', true, array ('title' => __('Add tags to module')));
$table_advanced->data[6][2] .= '<br><br><br><br>' . html_print_image('images/darrowleft.png', true, array('id' => 'left', 'title' => __('Delete tags to module'))); //html_print_input_image ('add', 'images/darrowleft.png', 1, '', true, array ('title' => __('Delete tags to module')));
$table_advanced->data[6][3] = '<b>' . __('Tags selected') . '</b>';
$table_advanced->data[6][4] = html_print_select_from_sql ("SELECT a.id_tag, name
FROM ttag a, $__table_modules b
WHERE a.id_tag = b.id_tag AND $__id_where = $__id
ORDER BY name",
'id_tag_selected[]', $id_tag, '','','', true, true, false, false, 'width: 200px', '5');
//$table_advanced->data[6][4] .= html_print_input_hidden('id_tag_serialize', '');
$table_advanced->data[6][3] = '<b>' . __('Tags selected') . '</b>';
$table_advanced->data[6][4] = html_print_select_from_sql (
"SELECT a.id_tag, name
FROM ttag a, $__table_modules b
WHERE a.id_tag = b.id_tag AND $__id_where = $__id
ORDER BY name",
'id_tag_selected[]', $id_tag, '','','', true, true, false,
false, 'width: 200px', '5');
?>
<script type="text/javascript">
@ -325,7 +327,7 @@ $(document).ready (function () {
$("select[name='id_tag_selected[]']").append($("<option></option>").val(id_tag).html('<i>' + tag_name + '</i>'));
$("#id_tag_available").find("option[value='" + id_tag + "']").remove();
}
});
});
});
$("#left").click (function () {
jQuery.each($("select[name='id_tag_selected[]'] option:selected"), function (key, value) {
@ -335,7 +337,7 @@ $(document).ready (function () {
$("select[name='id_tag_available[]']").append($("<option>").val(id_tag).html('<i>' + tag_name + '</i>'));
$("#id_tag_selected").find("option[value='" + id_tag + "']").remove();
}
});
});
});
$("#submit-updbutton").click(function () {
$('#id_tag_selected option').map(function(){
@ -344,4 +346,4 @@ $(document).ready (function () {
});
});
/* ]]> */
</script>
</script>

View File

@ -179,15 +179,16 @@ echo '<tr class="rowPair"><td>';
echo __('Last time on DB maintance');
echo '<td>';
if (!isset($config['db_maintance'])){
if (!isset($config['db_maintance'])) {
echo "<b><font size=12px>".__("Never")."</font></b>";
} else {
}
else {
$seconds = time()-$config['db_maintance'];
if ($seconds > 90000) //(1,1 days)
echo "<b><font color='#ff0000' size=12px>";
else
echo "<font><b>";
echo human_time_description_raw($seconds);
echo " *";
}
@ -199,4 +200,4 @@ echo '<div align="justify"><br><hr width=100%>';
echo '(*) '.__('Please check your Pandora Server setup and be sure that database maintenance daemon is running. It\'s very important to keep up-to-date database to get the best performance and results in Pandora');
echo '</div>';
echo '</td></tr></table>';
?>
?>

View File

@ -112,10 +112,11 @@ if ($maps){
$table->data[] = $table_info;
}
}
if (!empty ($table->data)) {
html_print_table($table);
} else {
}
else {
echo '<div class="nf">'.('No maps defined').'</div>';
}
@ -162,4 +163,4 @@ function setDefault(id_tgis_map) {
});
}
}
</script>
</script>

View File

@ -165,17 +165,19 @@ $check = db_get_value('nombre', 'tgrupo', 'nombre', $name);
$result = db_process_sql_insert('tgrupo', $values);
if ($result) {
echo "<h3 class='suc'>".__('Group successfully created')."</h3>";
} else {
}
else {
echo "<h3 class='error'>".__('There was a problem creating group')."</h3>";
}
} else {
}
else {
echo "<h3 class='error'>".__('Each group must have a different name')."</h3>";
}
} else {
}
else {
//$result = false;
echo "<h3 class='error'>".__('Group must have a name')."</h3>";
}
}
/* Update group */
@ -188,32 +190,34 @@ if ($update_group) {
$custom_id = (string) get_parameter ('custom_id');
$propagate = (bool) get_parameter('propagate');
$skin = (string) get_parameter ('skin');
/*Check if name field is empty*/
if( $name != "") {
switch ($config["dbtype"]) {
case "mysql":
$sql = sprintf ('UPDATE tgrupo SET nombre = "%s",
icon = "%s", disabled = %d, parent = %d, custom_id = "%s", propagate = %d, id_skin = %d
WHERE id_grupo = %d',
$name, substr ($icon, 0, -4), !$alerts_enabled, $id_parent, $custom_id, $propagate, $skin, $id_group);
icon = "%s", disabled = %d, parent = %d, custom_id = "%s", propagate = %d, id_skin = %d
WHERE id_grupo = %d',
$name, substr ($icon, 0, -4), !$alerts_enabled, $id_parent, $custom_id, $propagate, $skin, $id_group);
break;
case "postgresql":
case "oracle":
$sql = sprintf ('UPDATE tgrupo SET nombre = \'%s\',
icon = \'%s\', disabled = %d, parent = %d, custom_id = \'%s\', propagate = %d, id_skin = %d
WHERE id_grupo = %d',
$name, substr ($icon, 0, -4), !$alerts_enabled, $id_parent, $custom_id, $propagate, $skin, $id_group);
icon = \'%s\', disabled = %d, parent = %d, custom_id = \'%s\', propagate = %d, id_skin = %d
WHERE id_grupo = %d',
$name, substr ($icon, 0, -4), !$alerts_enabled, $id_parent, $custom_id, $propagate, $skin, $id_group);
break;
}
}
$result = db_process_sql ($sql);
} else {
}
else {
$result = false;
}
if ($result !== false) {
echo "<h3 class='suc'>".__('Group successfully updated')."</h3>";
} else {
}
else {
echo "<h3 class='error'>".__('There was a problem modifying group')."</h3>";
}
}
@ -221,7 +225,7 @@ if ($update_group) {
/* Delete group */
if ($delete_group) {
$id_group = (int) get_parameter ('id_group');
$usedGroup = groups_check_used($id_group);
if (!$usedGroup['return']) {
@ -245,13 +249,12 @@ if ($delete_group) {
else {
echo "<h3 class='error'>".__('There was a problem deleting group')."</h3>";
}
}
db_clean_cache();
$groups = users_get_groups_tree ($config['id_user'], "AR", true);
$table->width = '98%';
if(!empty($groups)) {
if (!empty($groups)) {
$table->head = array ();
$table->head[0] = __('Name');
$table->head[1] = __('ID');
@ -262,7 +265,7 @@ if(!empty($groups)) {
$table->align[2] = 'center';
$table->align[4] = 'center';
$table->data = array ();
$iterator = 0;
foreach ($groups as $id_group => $group) {