From 838b82448e59ca7f712eb7f7fa2c8205e43de284 Mon Sep 17 00:00:00 2001 From: guruevi Date: Fri, 6 Mar 2009 20:29:41 +0000 Subject: [PATCH] 2009-03-05 Evi Vanoost * godmode/reporting/map_builder_wizard.php: Fixed small error when no valid id was passed. * godmode/reporting/map_builder.php: Modified code so that width and height can be specified for all types of graphics. Fixed code where width and height wouldn't be passed in the database git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1520 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 9 ++++++ .../godmode/reporting/map_builder.php | 32 ++++++++----------- .../godmode/reporting/map_builder_wizard.php | 5 +++ 3 files changed, 27 insertions(+), 19 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index e709a092db..e294903ab9 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,12 @@ +2009-03-05 Evi Vanoost + + * godmode/reporting/map_builder_wizard.php: Fixed small error when no + valid id was passed. + + * godmode/reporting/map_builder.php: Modified code so that width and + height can be specified for all types of graphics. Fixed code where + width and height wouldn't be passed in the database + 2009-03-05 Evi Vanoost * include/auth/dev.php: Updated examples diff --git a/pandora_console/godmode/reporting/map_builder.php b/pandora_console/godmode/reporting/map_builder.php index 2ba68e3df0..cb6864787f 100644 --- a/pandora_console/godmode/reporting/map_builder.php +++ b/pandora_console/godmode/reporting/map_builder.php @@ -236,8 +236,8 @@ if ($update_layout_data) { $values['parent_item'] = $layout_data_parent_item; $values['period'] = $layout_data_period; $values['id_layout_linked'] = $layout_data_map_linked; - $values['height'] = $height; - $values['width'] = $width; + $values['height'] = $layout_data_height; + $values['width'] = $layout_data_width; $result = process_sql_update ('tlayout_data', $values, array ('id' => $id_layout_data)); if ($result !== false) { @@ -280,23 +280,21 @@ if (! $edit_layout && ! $id_layout) { foreach ($maps as $map) { $data = array (); - $data[0] = ''.$map['name'].''; + $data[0] = ''.$map['name'].''; - $data[1] = ' '; + $data[1] = print_image ("images/".get_group_icon ($map['id_group']).'.png', true).' '; $data[1] .= get_group_name ($map['id_group']); $data[2] = get_db_sql ("SELECT COUNT(id) FROM tlayout_data WHERE id_layout = ".$map['id']); - $data[3] = ' - '; + $data[3] = ''.print_image ("images/pill.png", true).''; - $data[4] = ' - '; + $data[4] = ''.print_image ("images/cross.png", true).''; array_push ($table->data, $data); } print_table ($table); } echo '
'; - echo '
'; + echo ''; print_input_hidden ('edit_layout', 1); print_submit_button (__('Create'), '', false, 'class="sub wand"'); echo '
'; @@ -312,9 +310,9 @@ if (! $edit_layout && ! $id_layout) { $table->data[0][1] = print_input_text ('name', $name, '', 15, 50, true); if ($id_layout){ - $table->data[0][1] .= '  '; + $table->data[0][1] .= '  '.print_image ("images/pill.png", true).''; - $table->data[0][1] .= '  '; + $table->data[0][1] .= '  '.print_image ("images/eye.png", true).''; } $table->data[1][0] = __('Group'); @@ -328,7 +326,7 @@ if (! $edit_layout && ! $id_layout) { $table->data[4][0] = __('Height'); $table->data[4][1] = print_input_text ('height', $height, '', 3, 5, true); } - echo '
'; + echo ''; print_table ($table); echo '
'; @@ -401,8 +399,6 @@ if (! $edit_layout && ! $id_layout) { $table->data = array (); $table->id = 'table_layout_data'; $table->rowstyle = array (); - $table->rowstyle[3] = 'display: none'; - $table->rowstyle[4] = 'display: none'; $table->data[0][0] = __('Label'); $table->data[0][1] = print_input_text ('label', '', '', 20, 200, true); @@ -430,7 +426,7 @@ if (! $edit_layout && ! $id_layout) { $table->data[10][1] = print_select_from_sql ('SELECT id, name FROM tlayout WHERE id != '.$id_layout, 'map_linked', '', '', 'None', '', true); - echo ''; + echo ''; print_table ($table); print_input_hidden ('create_layout_data', 1); print_input_hidden ('update_layout_data', 0); @@ -554,8 +550,8 @@ $(document).ready (function () { $("#form_layout_data_editor #type").attr ('value', data['type']); $("#form_layout_data_editor #type").change (); $("#form_layout_data_editor #image").attr ('value', data['image']); - $("#form_layout_data_editor #width").attr ('value', data['width']); - $("#form_layout_data_editor #height").attr ('value', data['height']); + $("#form_layout_data_editor #text-width").attr ('value', data['width']); + $("#form_layout_data_editor #text-height").attr ('value', data['height']); $("#form_layout_data_editor #image").change (); $("#form_layout_data_editor #id_layout_data").attr ('value', data['id']); $("#form_layout_data_editor #period").attr ('value', data['period'] / 3600); @@ -602,10 +598,8 @@ $(document).ready (function () { $("#form_layout_data_editor #agent").change (agent_changed); $("#form_layout_data_editor #type").change (function () { if (this.value == 0) { - $("#table_layout_data #table_layout_data-3, #table_layout_data #table_layout_data-4").fadeOut (); $("#table_layout_data #table_layout_data-8").fadeIn (); } else { - $("#table_layout_data #table_layout_data-3, #table_layout_data #table_layout_data-4").fadeIn (); $("#table_layout_data #table_layout_data-8").fadeOut (); } diff --git a/pandora_console/godmode/reporting/map_builder_wizard.php b/pandora_console/godmode/reporting/map_builder_wizard.php index 593d45ffbf..3afbb024fe 100644 --- a/pandora_console/godmode/reporting/map_builder_wizard.php +++ b/pandora_console/godmode/reporting/map_builder_wizard.php @@ -29,6 +29,11 @@ if (! give_acl ($config['id_user'], 0, "AW")) { $layout_id = (int) get_parameter ('id_layout'); $layout = get_db_row ('tlayout', 'id', $layout_id); +if (empty ($layout)) { + print_error_message (false, '', __('No layout with this id found')); + return; +} + $layout_group = $layout["id_group"]; if (! give_acl ($config['id_user'], $layout_group, "AW")) {