Pages: [1]   Go Down
Author Topic: [Pandora-commits] SF.net SVN: pandora:[3234] trunk/pandora_console  (Read 110 times)
0 Members and 1 Guest are viewing this topic.
sf_gateway
Sr. Member
****

Karma: 0
Offline Offline

Posts: 3854


View Profile
« on: September 09, 2010, 02:00:02 PM »


Revision: 3234
http://pandora.svn.sourceforge.net/pandora/?rev=3234&view=rev
Author:   mdtrooper
Date:     2010-09-09 12:19:11 +0000 (Thu, 09 Sep 2010)

Log Message:
-----------
2010-09-09  Miguel de Dios  

* include/functions_networkmap.php: cleaned source code.

* include/functions_ui.php: in function "print_os_icon" change the
directory to search os icon because it change for new feature.

* images/os_icons, images/os_icons/*: copied the icons image files into this
dir for to use in new feature.

* godmode/menu.php: added new item in submenu "Setup" for the management
the OS.

* godmode/setup/os.php: added the page to management the list OS of agents.

Pending task: #3057663

Modified Paths:
--------------
trunk/pandora_console/ChangeLog
trunk/pandora_console/godmode/menu.php
trunk/pandora_console/include/functions_networkmap.php
trunk/pandora_console/include/functions_ui.php

Added Paths:
-----------
trunk/pandora_console/godmode/setup/os.php
trunk/pandora_console/images/os_icons/
trunk/pandora_console/images/os_icons/network.png
trunk/pandora_console/images/os_icons/network_small.png
trunk/pandora_console/images/os_icons/so_aix.png
trunk/pandora_console/images/os_icons/so_aix_small.png
trunk/pandora_console/images/os_icons/so_bsd.png
trunk/pandora_console/images/os_icons/so_bsd_small.png
trunk/pandora_console/images/os_icons/so_cisco.png
trunk/pandora_console/images/os_icons/so_cisco_small.png
trunk/pandora_console/images/os_icons/so_hpux.png
trunk/pandora_console/images/os_icons/so_hpux_small.png
trunk/pandora_console/images/os_icons/so_linux.png
trunk/pandora_console/images/os_icons/so_linux_small.png
trunk/pandora_console/images/os_icons/so_mac.png
trunk/pandora_console/images/os_icons/so_mac_small.png
trunk/pandora_console/images/os_icons/so_other.png
trunk/pandora_console/images/os_icons/so_other_small.png
trunk/pandora_console/images/os_icons/so_solaris.png
trunk/pandora_console/images/os_icons/so_solaris_small.png
trunk/pandora_console/images/os_icons/so_win.png
trunk/pandora_console/images/os_icons/so_win_small.png

Modified: trunk/pandora_console/ChangeLog
===================================================================
--- trunk/pandora_console/ChangeLog   2010-09-09 05:16:36 UTC (rev 3233)
+++ trunk/pandora_console/ChangeLog   2010-09-09 12:19:11 UTC (rev 3234)
@@ -1,3 +1,20 @@
+2010-09-09  Miguel de Dios  
+
+   * include/functions_networkmap.php: cleaned source code.
+
+   * include/functions_ui.php: in function "print_os_icon" change the
+   directory to search os icon because it change for new feature.
+
+   * images/os_icons, images/os_icons/*: copied the icons image files into this
+   dir for to use in new feature.
+
+   * godmode/menu.php: added new item in submenu "Setup" for the management
+   the OS.
+
+   * godmode/setup/os.php: added the page to management the list OS of agents.
+
+   Pending task: #3057663
+
2010-09-09  Sancho Lerena  

* fgraph.php: Graph "Modules per agent" was not working properly

Modified: trunk/pandora_console/godmode/menu.php
===================================================================
--- trunk/pandora_console/godmode/menu.php   2010-09-09 05:16:36 UTC (rev 3233)
+++ trunk/pandora_console/godmode/menu.php   2010-09-09 12:19:11 UTC (rev 3234)
@@ -207,6 +207,7 @@
$sub["godmode/setup/gis"]["text"] = __('Map conections GIS');
$sub["godmode/setup/links"]["text"] = __('Links');
$sub["godmode/setup/news"]["text"] = __('Site news');
+   $sub["godmode/setup/os"]["text"] = __('Edit OS');
enterprise_hook ('historydb_submenu');
enterprise_hook ('enterprise_acl_submenu');


Added: trunk/pandora_console/godmode/setup/os.php
===================================================================
--- trunk/pandora_console/godmode/setup/os.php                           (rev 0)
+++ trunk/pandora_console/godmode/setup/os.php   2010-09-09 12:19:11 UTC (rev 3234)
@@ -0,0 +1,228 @@
++
+// 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;
+}
+
+$action = get_parameter('action', 'new');
+$idOS = get_parameter('id_os', 0);
+
+if ($idOS) {
+   $os = get_db_row_filter('tconfig_os', array('id_os' => $idOS));
+   $name = $os['name'];
+   $description = $os['description'];
+   $icon = $os['icon_name'];
+}
+else {
+   $name = get_parameter('name', '');
+   $description = get_parameter('description', '');
+   $icon = get_parameter('icon',0);
+}
+
+// Header
+print_page_header(__('Edit OS'), "", false, "", true);
+
+switch ($action) {
+   default:
+   case 'new':
+      $actionHidden = 'save';
+      $textButton = __('Create');
+      $classButton = 'class="sub next"';
+      break;
+   case 'edit':
+      $actionHidden = 'update';
+      $textButton = __('Update');
+      $classButton = 'class="sub upd"';
+      break;
+   case 'save':
+      $values = array();
+      $values['name'] = $name;
+      $values['description'] = $description;
+
+      if (($icon !== 0) && ($icon != '')) {
+         $values['icon_name'] = $icon;
+      }
+      $resultOrId = process_sql_insert('tconfig_os', $values);
+
+      if ($resultOrId === false) {
+         print_error_message(__('Fail to create OS'));
+         $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"';
+      }
+      break;
+   case 'update':
+      $name = get_parameter('name', '');
+      $description = get_parameter('description', '');
+      $icon = get_parameter('icon',0);
+
+      $values = array();
+      $values['name'] = $name;
+      $values['description'] = $description;
+
+      if (($icon !== 0) && ($icon != '')) {
+         $values['icon_name'] = $icon;
+      }
+      $result = process_sql_update('tconfig_os', $values, array('id_os' => $idOS));
+
+      print_result_message($result, __('Success to update OS'), __('Error to update OS'));
+
+      $actionHidden = 'update';
+      $textButton = __('Update');
+      $classButton = 'class="sub upd"';
+      break;
+   case 'delete':
+      $sql = 'SELECT COUNT(id_os) AS count FROM tagente WHERE id_os = ' . $idOS;
+      $count = get_db_all_rows_sql($sql);
+      $count = $count[0]['count'];
+
+      if ($count > 0) {
+         print_error_message(__('There are agents with this OS.'));
+      }
+      else {
+         $result = (bool)process_sql_delete('tconfig_os', array('id_os' => $idOS));
+
+         print_result_message($result, __('Success to delete'), __('Error to delete'));
+      }
+
+      $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;
+
+$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;
+}
+
+$htmlListOS = print_table($table, true);
+
+toggle($htmlListOS,__('List of OS'), __('Toggle'));
+
+echo '';
+unset($table->head);
+unset($table->align);
+unset($table->size);
+unset($table->data);
+
+$table->width = '50%';
+
+$table->style[0] = 'font-weight: bolder; vertical-align: top;';
+
+$table->data[0][0] = __('Name:');
+$table->data[0][1] = print_input_text('name', $name, __('Name'), 20, 30, true);
+$table->data[1][0] = __('Description');
+$table->data[1][1] = print_textarea('description', 5, 10, $description, '', true);
+$icons = get_list_os_icons_dir();
+$table->data[2][0] = __('Icon');
+$table->data[2][1] = print_select($icons, 'icon',  $icon, 'show_icon_OS();', __('None'), 0, true);
+$table->data[2][1] .= ' ' . print_os_icon($idOS, false, true) . '';
+
+
+echo '
';
+print_button(__('New OS'), 'new_button', false, 'new_os();', 'class="sub add"');
+echo '
';
+echo '';
+print_table($table);
+
+print_input_hidden('id_os', $idOS);
+print_input_hidden ('action', $actionHidden);
+
+echo '
';
+print_submit_button ($textButton, 'update_button', false, $classButton);
+echo '
';
+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/images/os_icons/network.png
===================================================================
(Binary files differ)


Property changes on: trunk/pandora_console/images/os_icons/network.png
______________________________________________________ _____________
Added: svn:executable
+ *
Added: svn:mime-type
+ application/octet-stream

Added: trunk/pandora_console/images/os_icons/network_small.png
===================================================================
(Binary files differ)


Property changes on: trunk/pandora_console/images/os_icons/network_small.png
______________________________________________________ _____________
Added: svn:executable
+ *
Added: svn:mime-type
+ application/octet-stream

Added: trunk/pandora_console/images/os_icons/so_aix.png
===================================================================
(Binary files differ)


Property changes on: trunk/pandora_console/images/os_icons/so_aix.png
______________________________________________________ _____________
Added: svn:executable
+ *
Added: svn:mime-type
+ application/octet-stream

Added: trunk/pandora_console/images/os_icons/so_aix_small.png
===================================================================
(Binary files differ)


Property changes on: trunk/pandora_console/images/os_icons/so_aix_small.png
______________________________________________________ _____________
Added: svn:executable
+ *
Added: svn:mime-type
+ application/octet-stream

Added: trunk/pandora_console/images/os_icons/so_bsd.png
===================================================================
(Binary files differ)


Property changes on: trunk/pandora_console/images/os_icons/so_bsd.png
______________________________________________________ _____________
Added: svn:executable
+ *
Added: svn:mime-type
+ application/octet-stream

Added: trunk/pandora_console/images/os_icons/so_bsd_small.png
===================================================================
(Binary files differ)


Property changes on: trunk/pandora_console/images/os_icons/so_bsd_small.png
______________________________________________________ _____________
Added: svn:executable
+ *
Added: svn:mime-type
+ application/octet-stream

Added: trunk/pandora_console/images/os_icons/so_cisco.png
===================================================================
(Binary files differ)


Property changes on: trunk/pandora_console/images/os_icons/so_cisco.png
______________________________________________________ _____________
Added: svn:executable
+ *
Added: svn:mime-type
+ application/octet-stream

Added: trunk/pandora_console/images/os_icons/so_cisco_small.png
===================================================================
(Binary files differ)


Property changes on: trunk/pandora_console/images/os_icons/so_cisco_small.png
______________________________________________________ _____________
Added: svn:executable
+ *
Added: svn:mime-type
+ application/octet-stream

Added: trunk/pandora_console/images/os_icons/so_hpux.png
===================================================================
(Binary files differ)


Property changes on: trunk/pandora_console/images/os_icons/so_hpux.png
______________________________________________________ _____________
Added: svn:executable
+ *
Added: svn:mime-type
+ application/octet-stream

Added: trunk/pandora_console/images/os_icons/so_hpux_small.png
===================================================================
(Binary files differ)


Property changes on: trunk/pandora_console/images/os_icons/so_hpux_small.png
______________________________________________________ _____________
Added: svn:executable
+ *
Added: svn:mime-type
+ application/octet-stream

Added: trunk/pandora_console/images/os_icons/so_linux.png
===================================================================
(Binary files differ)


Property changes on: trunk/pandora_console/images/os_icons/so_linux.png
______________________________________________________ _____________
Added: svn:executable
+ *
Added: svn:mime-type
+ application/octet-stream

Added: trunk/pandora_console/images/os_icons/so_linux_small.png
===================================================================
(Binary files differ)


Property changes on: trunk/pandora_console/images/os_icons/so_linux_small.png
______________________________________________________ _____________
Added: svn:executable
+ *
Added: svn:mime-type
+ application/octet-stream

Added: trunk/pandora_console/images/os_icons/so_mac.png
===================================================================
(Binary files differ)


Property changes on: trunk/pandora_console/images/os_icons/so_mac.png
______________________________________________________ _____________
Added: svn:executable
+ *
Added: svn:mime-type
+ application/octet-stream

Added: trunk/pandora_console/images/os_icons/so_mac_small.png
===================================================================
(Binary files differ)


Property changes on: trunk/pandora_console/images/os_icons/so_mac_small.png
______________________________________________________ _____________
Added: svn:executable
+ *
Added: svn:mime-type
+ application/octet-stream

Added: trunk/pandora_console/images/os_icons/so_other.png
===================================================================
(Binary files differ)


Property changes on: trunk/pandora_console/images/os_icons/so_other.png
______________________________________________________ _____________
Added: svn:executable
+ *
Added: svn:mime-type
+ application/octet-stream

Added: trunk/pandora_console/images/os_icons/so_other_small.png
===================================================================
(Binary files differ)


Property changes on: trunk/pandora_console/images/os_icons/so_other_small.png
______________________________________________________ _____________
Added: svn:executable
+ *
Added: svn:mime-type
+ application/octet-stream

Added: trunk/pandora_console/images/os_icons/so_solaris.png
===================================================================
(Binary files differ)


Property changes on: trunk/pandora_console/images/os_icons/so_solaris.png
______________________________________________________ _____________
Added: svn:executable
+ *
Added: svn:mime-type
+ application/octet-stream

Added: trunk/pandora_console/images/os_icons/so_solaris_small.png
===================================================================
(Binary files differ)


Property changes on: trunk/pandora_console/images/os_icons/so_solaris_small.png
______________________________________________________ _____________
Added: svn:executable
+ *
Added: svn:mime-type
+ application/octet-stream

Added: trunk/pandora_console/images/os_icons/so_win.png
===================================================================
(Binary files differ)


Property changes on: trunk/pandora_console/images/os_icons/so_win.png
______________________________________________________ _____________
Added: svn:executable
+ *
Added: svn:mime-type
+ application/octet-stream

Added: trunk/pandora_console/images/os_icons/so_win_small.png
===================================================================
(Binary files differ)


Property changes on: trunk/pandora_console/images/os_icons/so_win_small.png
______________________________________________________ _____________
Added: svn:executable
+ *
Added: svn:mime-type
+ application/octet-stream

Modified: trunk/pandora_console/include/functions_networkmap.php
===================================================================
--- trunk/pandora_console/include/functions_networkmap.php   2010-09-09 05:16:36 UTC (rev 3233)
+++ trunk/pandora_console/include/functions_networkmap.php   2010-09-09 12:19:11 UTC (rev 3234)
@@ -319,7 +319,7 @@
if ($simple == 0){
// Set node icon
if (file_exists ('images/groups_small/'.$icon.'.png')) {
-         $img_node = '';
+         $img_node = '';
} else {
$img_node = '-';
}

Modified: trunk/pandora_console/include/functions_ui.php
===================================================================
--- trunk/pandora_console/include/functions_ui.php   2010-09-09 05:16:36 UTC (rev 3233)
+++ trunk/pandora_console/include/functions_ui.php   2010-09-09 12:19:11 UTC (rev 3234)
@@ -276,7 +276,7 @@
return "-";
}

-   $output = ''.$os_name.'';
+   $output = ''.$os_name.'';

if ($name === true) {
$output .= ' - '.$os_name;


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
Logged

Pages: [1]   Go Up
Print
 
Jump to:  


SourceForge.net Logo  This site is monitored by Pandora FMS   ArticaST