|
|
 |
« on: September 09, 2010, 04:00:02 PM » |
|
Revision: 3235 http://pandora.svn.sourceforge.net/pandora/?rev=3235&view=revAuthor: mdtrooper Date: 2010-09-09 14:07:21 +0000 (Thu, 09 Sep 2010) Log Message: ----------- 2010-09-09 Miguel de Dios
* godmode/setup/os.list.php, godmode/setup/os.builder.php, godmode/setup/os.php: changed the source code and added "os.builder.php" and "os.list.php" for to change the management page for to be a "tab page".
Modified Paths: -------------- trunk/pandora_console/ChangeLog trunk/pandora_console/godmode/setup/os.php
Added Paths: ----------- trunk/pandora_console/godmode/setup/os.builder.php trunk/pandora_console/godmode/setup/os.list.php
Modified: trunk/pandora_console/ChangeLog =================================================================== --- trunk/pandora_console/ChangeLog 2010-09-09 12:19:11 UTC (rev 3234) +++ trunk/pandora_console/ChangeLog 2010-09-09 14:07:21 UTC (rev 3235) @@ -1,5 +1,11 @@ 2010-09-09 Miguel de Dios
+ * godmode/setup/os.list.php, godmode/setup/os.builder.php, + godmode/setup/os.php: changed the source code and added "os.builder.php" and + "os.list.php" for to change the management page for to be a "tab page". + +2010-09-09 Miguel de Dios + * include/functions_networkmap.php: cleaned source code.
* include/functions_ui.php: in function "print_os_icon" change the
Added: trunk/pandora_console/godmode/setup/os.builder.php =================================================================== --- trunk/pandora_console/godmode/setup/os.builder.php (rev 0) +++ trunk/pandora_console/godmode/setup/os.builder.php 2010-09-09 14:07:21 UTC (rev 3235) @@ -0,0 +1,79 @@ ++ +// Pandora FMS - http://pandorafms.com +// ================================================== +// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas +// Please see http://pandorafms.org for full contribution list + +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation for version 2. +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Load global vars +global $config; + +check_login (); + +if (! give_acl ($config['id_user'], 0, "PM") && ! is_user_admin ($config['id_user'])) { + audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", "Trying to access Setup Management"); + require ("general/noaccess.php"); + return; +} + +echo ''; + +function get_list_os_icons_dir() { + global $config; + + $return = array(); + + $items = scandir($config['homedir'] . '/images/os_icons'); + + foreach ($items as $item) { + if (strstr($item, '_small.png') || strstr($item, '_small.gif') + || strstr($item, '_small.jpg')) { + continue; + } + if (strstr($item, '.png') || strstr($item, '.gif') + || strstr($item, '.jpg')) { + $return[$item] = $item; + } + } + + return $return; +} +?> + \ No newline at end of file
Added: trunk/pandora_console/godmode/setup/os.list.php =================================================================== --- trunk/pandora_console/godmode/setup/os.list.php (rev 0) +++ trunk/pandora_console/godmode/setup/os.list.php 2010-09-09 14:07:21 UTC (rev 3235) @@ -0,0 +1,59 @@ ++ +// Pandora FMS - http://pandorafms.com +// ================================================== +// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas +// Please see http://pandorafms.org for full contribution list + +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation for version 2. +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Load global vars +global $config; + +check_login (); + +if (! give_acl ($config['id_user'], 0, "PM") && ! is_user_admin ($config['id_user'])) { + audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", "Trying to access Setup Management"); + require ("general/noaccess.php"); + return; +} + +$table = null; + +$table->width = '80%'; +$table->head[0] = ''; +$table->head[1] = __('Name'); +$table->head[2] = __('Description'); +$table->head[3] = ''; +$table->align[0] = 'center'; +$table->align[3] = 'center'; +$table->size[0] = '20px'; +$table->size[3] = '20px'; + +$osList = get_db_all_rows_in_table('tconfig_os'); + +$table->data = array(); +foreach ($osList as $os) { + $data = array(); + $data[] = print_os_icon($os['id_os'], false, true); + $data[] = '' . safe_output($os['name']) . ''; + $data[] = printTruncateText(safe_output($os['description']), 25, true, true); + if ($os['id_os'] > 13) { + $data[] = ' '; + } + else { + //The original icons of pandora don't delete. + $data[] = ''; + } + + $table->data[] = $data; +} + +print_table($table); +?> \ No newline at end of file
Modified: trunk/pandora_console/godmode/setup/os.php =================================================================== --- trunk/pandora_console/godmode/setup/os.php 2010-09-09 12:19:11 UTC (rev 3234) +++ trunk/pandora_console/godmode/setup/os.php 2010-09-09 14:07:21 UTC (rev 3235) @@ -26,6 +26,7 @@
$action = get_parameter('action', 'new'); $idOS = get_parameter('id_os', 0); +$tab = get_parameter('tab', 'builder');
if ($idOS) { $os = get_db_row_filter('tconfig_os', array('id_os' => $idOS)); @@ -39,8 +40,7 @@ $icon = get_parameter('icon',0); }
-// Header -print_page_header(__('Edit OS'), "", false, "", true); +$message = '';
switch ($action) { default: @@ -65,17 +65,15 @@ $resultOrId = process_sql_insert('tconfig_os', $values);
if ($resultOrId === false) { - print_error_message(__('Fail to create OS')); + $message = print_error_message(__('Fail to create OS'), '', true); + $tab = 'builder'; $actionHidden = 'save'; $textButton = __('Create'); $classButton = 'class="sub next"'; } else { - $idOs = $resultOrId; - print_success_message(__('Success to create OS')); - $actionHidden = 'update'; - $textButton = __('Update'); - $classButton = 'class="sub upd"'; + $message = print_success_message(__('Success to create OS'), '', true); + $tab = 'list'; } break; case 'update': @@ -92,7 +90,10 @@ } $result = process_sql_update('tconfig_os', $values, array('id_os' => $idOS));
- print_result_message($result, __('Success to update OS'), __('Error to update OS')); + $message = print_result_message($result, __('Success to update OS'), __('Error to update OS'), '', true); + if ($result !== false) { + $tab = 'list'; + }
$actionHidden = 'update'; $textButton = __('Update'); @@ -104,125 +105,42 @@ $count = $count[0]['count'];
if ($count > 0) { - print_error_message(__('There are agents with this OS.')); + $message = print_error_message(__('There are agents with this OS.'), '', true); } else { $result = (bool)process_sql_delete('tconfig_os', array('id_os' => $idOS));
- print_result_message($result, __('Success to delete'), __('Error to delete')); + $message = print_result_message($result, __('Success to delete'), __('Error to delete'), '', true); } - - $idOS = 0; - $name = get_parameter('name', ''); - $description = get_parameter('description', ''); - $icon = get_parameter('icon',0); - - $actionHidden = 'save'; - $textButton = __('Create'); - $classButton = 'class="sub next"'; break; }
-$table = null; +$buttons = array( + 'list' => array( + 'active' => false, + 'text' => '' . + print_image ("images/god6.png", true, array ("title" => __('List OS'))) .''), + 'builder' => array( + 'active' => false, + 'text' => '' . + print_image ("images/config.png", true, array ("title" => __('Builder OS'))) .''));
-$table->width = '80%'; -$table->head[0] = ''; -$table->head[1] = __('Name'); -$table->head[2] = __('Description'); -$table->head[3] = ''; -$table->align[0] = 'center'; -$table->align[3] = 'center'; -$table->size[0] = '20px'; -$table->size[3] = '20px'; + +$buttons[$tab]['active'] = true;
-$osList = get_db_all_rows_in_table('tconfig_os'); +// Header +print_page_header(__('Edit OS'), "", false, "", true, $buttons);
-$table->data = array(); -foreach ($osList as $os) { - $data = array(); - $data[] = print_os_icon($os['id_os'], false, true); - $data[] = '' . safe_output($os['name']) . ''; - $data[] = printTruncateText(safe_output($os['description']), 25, true, true); - if ($os['id_os'] > 13) { - $data[] = ' '; - } - else { - //The original icons of pandora don't delete. - $data[] = ''; - } - - $table->data[] = $data; -} +echo $message;
-$htmlListOS = print_table($table, true); - -toggle($htmlListOS,__('List of OS'), __('Toggle')); - -echo ''; - -function get_list_os_icons_dir() { - global $config; - - $return = array(); - - $items = scandir($config['homedir'] . '/images/os_icons'); - - foreach ($items as $item) { - if (strstr($item, '_small.png') || strstr($item, '_small.gif') - || strstr($item, '_small.jpg')) { - continue; - } - if (strstr($item, '.png') || strstr($item, '.gif') - || strstr($item, '.jpg')) { - $return[$item] = $item; - } - } - - return $return; +switch ($tab) { + case 'list': + require_once('godmode/setup/os.list.php'); + return; + break; + case 'builder': + require_once('godmode/setup/os.builder.php'); + return; + break; } -?> - \ No newline at end of file +?> \ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
------------------------------------------------------------------------------ This SF.net Dev2Dev email is sponsored by:
Show off your parallel programming skills. Enter the Intel(R) Threading Challenge 2010. http://p.sf.net/sfu/intel-thread-sfd _______________________________________________ Pandora-commits mailing list Pandora-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pandora-commits
|