2009-03-12 Esteban Sanchez <estebans@artica.es>

* godmode/db/db_purge.php: Style correction.

	* godmode/modules/manage_nc_groups.php: Complete rewritten.

	* godmode/modules/manage_nc_groups_form.php: Use pandora functions.
	Needs more love.

	* godmode/reporting/map_builder.php: Some fixes to make it work in
	IE7. 

	* include/javascript/jquery.pandora.controls.js: Execute automatically
	instead of on ready. Typo fixed that was not allowing to work on IE.

	* include/styles/ie.css: Bit of style corrections.

	* include/functions_ui.php: Added the ie.css code at the bottom, so it
	has preferences over other styles.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1534 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
Esteban Sanchez 2009-03-13 11:22:07 +00:00
parent 170da6184f
commit b09ab2f083
8 changed files with 130 additions and 94 deletions

View File

@ -1,3 +1,23 @@
2009-03-13 Esteban Sanchez <estebans@artica.es>
* godmode/db/db_purge.php: Style correction.
* godmode/modules/manage_nc_groups.php: Complete rewritten.
* godmode/modules/manage_nc_groups_form.php: Use pandora functions.
Needs more love.
* godmode/reporting/map_builder.php: Some fixes to make it work in
IE7.
* include/javascript/jquery.pandora.controls.js: Execute automatically
instead of on ready. Typo fixed that was not allowing to work on IE.
* include/styles/ie.css: Bit of style corrections.
* include/functions_ui.php: Added the ie.css code at the bottom, so it
has preferences over other styles.
2009-03-12 Evi Vanoost <vanooste@rcbi.rochester.edu>
* include/functions.php: Added safe_output_xml which makes variables

View File

@ -36,8 +36,6 @@ if (isset ($_POST["agent"])){
$id_agent = -1;
}
echo '<h2>'.__('Database Maintenance').' &gt; '.__('Database purge').'</h2>
<img src="reporting/fgraph.php?tipo=db_agente_purge&id='.$id_agent.'" />
<br /><br />
@ -84,7 +82,7 @@ if (isset($_POST["purgedb"])) {
echo "<h3>".__('Please be patient. This operation can take a long time depending on the amount of modules.')."</h3>";
$sql = sprintf ("SELECT id_agente_modulo FROM tagente_modulo WHERE id_agente = %d", $id_agent);
$result=get_db_all_rows_sql ($sql);
$result = get_db_all_rows_sql ($sql);
if (empty ($result)) {
$result = array ();
}
@ -103,10 +101,10 @@ if (isset($_POST["purgedb"])) {
$errors++;
$sql = sprintf ("DELETE FROM `tagente_datos_inc` WHERE `id_agente_modulo` = %d AND `utimestamp` < %d",$row["id_agente_modulo"],$from_date);
if (process_sql ($sql) === false)
$errors++;
$errors++;
$sql = sprintf ("DELETE FROM `tagente_datos_string` WHERE `id_agente_modulo` = %d AND `utimestamp` < %d",$row["id_agente_modulo"],$from_date);
if (process_sql ($sql) === false)
$errors++;
$errors++;
}
if ($errors > 0) {

View File

@ -27,86 +27,84 @@ if (! give_acl ($config['id_user'], 0, "PM")) {
require ("general/noaccess.php");
exit;
}
if (isset($_GET["create"])){ // Create module
$name = entrada_limpia ($_POST["name"]);
$parent = entrada_limpia ($_POST["parent"]);
$sql_insert="INSERT INTO tnetwork_component_group (name,parent)
VALUES ('$name', '$parent')";
$result=mysql_query($sql_insert);
if (! $result)
echo "<h3 class='error'>".__('Not created. Error inserting data')."</h3>";
else {
echo "<h3 class='suc'>".__('Created successfully')."</h3>";
$id_sg = mysql_insert_id();
}
}
if (isset($_GET["update"])){ // if modified any parameter
$id_sg = entrada_limpia ($_GET["id_sg"]);
$name = entrada_limpia ($_POST["name"]);
$parent = entrada_limpia ($_POST["parent"]);
$sql_update ="UPDATE tnetwork_component_group
SET name = '$name', parent = '$parent'
WHERE id_sg = '$id_sg'";
$result=mysql_query($sql_update);
if (! $result)
echo "<h3 class='error'>".__('Not updated. Error updating data')."</h3>";
else
echo "<h3 class='suc'>".__('Updated successfully')."</h3>";
}
$create = (bool) get_parameter ('create');
$update = (bool) get_parameter ('update');
$delete = (bool) get_parameter ('delete');
if (isset($_GET["delete"])){ // if delete
$id_sg = entrada_limpia ($_GET["id_sg"]);
$sql_delete= "DELETE FROM tnetwork_component_group WHERE id_sg = ".$id_sg;
$result=mysql_query($sql_delete);
if (! $result)
echo "<h3 class='error'>".__('Not deleted. Error deleting data')."</h3>";
else
echo "<h3 class='suc'>".__('Deleted successfully')."</h3>";
echo '<h2>'.__('Module management').' &gt; '. __('Component group management').'</h2>';
if ($create) {
$name = (string) get_parameter ('name');
$parent = (int) get_parameter ('parent');
$result=mysql_query($sql_delete);
$result = process_sql_insert ('tnetwork_component_group',
array ('name' => $name,
'parent' => $parent));
print_error_message ($result,
__('Created successfully'),
__('Not created. Error inserting data'));
}
echo "<h2>".__('Module management')." &gt; ";
echo __('Component group management')."</h2>";
echo "<table cellpadding='4' cellspacing='4' width='550' class='databox'>";
echo "<th>".__('Name')."</th>";
echo "<th>".__('Parent')."</th>";
echo "<th>".__('Delete')."</th>";
$sql1='SELECT * FROM tnetwork_component_group ORDER BY parent';
$result=mysql_query($sql1);
$color=0;
while ($row=mysql_fetch_array($result)){
if ($color == 1){
$tdcolor = "datos";
$color = 0;
}
else {
$tdcolor = "datos2";
$color = 1;
}
echo "<tr>
<td class='$tdcolor'>
<b><a href='index.php?sec=gmodules&sec2=godmode/modules/manage_nc_groups_form&edit=1&id_sg=".$row["id_sg"]."'>".$row["name"]."</a></b>
</td>
<td class='$tdcolor'>
".give_network_component_group_name ($row["parent"])."
</td>
<td class='$tdcolor' align='center'>
<a href='index.php?sec=gmodules&sec2=godmode/modules/manage_nc_groups&delete=1&id_sg=".$row["id_sg"]."'
onClick='if (!confirm(\' ".__('Are you sure?')."\'))
return false;'>
<img border='0' src='images/cross.png'></a>
</td>
</tr>";
if ($update) {
$id = (int) get_parameter ('id_sg');
$name = (string) get_parameter ('name');
$parent = (int) get_parameter ('parent');
$result = process_sql_update ('tnetwork_component_group',
array ('name' => $name,
'parent' => $parent),
array ('id_sg' => $id));
print_error_message ($result,
__('Updated successfully'),
__('Not updated. Error updating data'));
}
echo "</table>";
echo '<table width="550">';
echo '<tr><td align="right">';
echo "<form method=post action='index.php?sec=gmodules&sec2=godmode/modules/manage_nc_groups_form&create=1'>";
echo "<input type='submit' class='sub next' name='crt' value='".__('Create')."'>";
echo "</form></td></tr></table>";
if ($delete) { // if delete
$id = (int) get_parameter ('id_sg');
$result = process_sql_delete ('tnetwork_component_group',
array ('id_sg' => $id));
print_error_message ($result,
__('Deleted successfully'),
__('Not deleted. Error deleting data'));
}
$table->width = '90%';
$table->head = array ();
$table->head[0] = __('Name');
$table->head[1] = __('Parent');
$table->head[2] = __('Delete');
$table->style = array ();
$table->style[0] = 'font-weight: bold';
$table->align = array ();
$table->align[2] = 'center';
$table->data = array ();
$groups = get_db_all_rows_filter ('tnetwork_component_group',
array ('order' => 'parent'));
if ($groups === false)
$groups = array ();
foreach ($groups as $group) {
$data = array ();
$data[0] = '<a href="index.php?sec=gmodules&sec2=godmode/modules/manage_nc_groups_form&edit=1&id_sg='.$group["id_sg"].'">'.$group["name"].'</a>';
$data[1] = give_network_component_group_name ($group["parent"]);
$data[2] = '<a href="index.php?sec=gmodules&sec2=godmode/modules/manage_nc_groups&delete=1&id_sg='.$group["id_sg"].'"
onClick="if (!confirm(\''.__('Are you sure?').'\')) return false;">
<img src="images/cross.png"></a>';
array_push ($table->data, $data);
}
print_table ($table);
echo '<form method="post" action="index.php?sec=gmodules&sec2=godmode/modules/manage_nc_groups_form">';
echo '<div class="action-buttons" style="width: '.$table->width.'">';
print_input_hidden ('create', 1);
print_submit_button (__('Create'), 'crt', false, 'class="sub next"');
echo '</div>';
echo '</form>';
?>

View File

@ -27,22 +27,25 @@ if (! give_acl ($config['id_user'], 0, "PM")) {
require ("general/noaccess.php");
exit;
}
if (isset($_GET["edit"])){ // Edit mode
$create = (bool) get_parameter ('create');
$edit = (bool) get_parameter ('edit');
if ($edit) { // Edit mode
$id_sg = entrada_limpia ($_GET["id_sg"]);
$sql1 = "SELECT * FROM tnetwork_component_group where id_sg = $id_sg";
$result=mysql_query($sql1);
$row=mysql_fetch_array($result);
$name = $row["name"];
$parent = $row["parent"];
} elseif (isset($_GET["create"])){
} elseif ($create) {
$id_sg = -1;
$name = "";
$parent = "";
}
echo "<h2>".__('Component group management')."</h2>";
echo '<table width="500" cellspacing="4" cellpadding="4" class="databox_color">';
echo '<table width="50%" cellspacing="4" cellpadding="4" class="databox">';
// Different Form url if it's a create or if it's a update form
if ($id_sg != -1)

View File

@ -528,7 +528,13 @@ $(document).ready (function () {
$("#form_layout_data_editor #map_linked").attr ('value', data['id_layout_linked']);
$("#form_layout_data_editor #hidden-update_layout_data").attr ('value', 1);
$("#form_layout_data_editor #hidden-create_layout_data").attr ('value', 0);
$("#form_layout_data_editor #hidden-id_layout_data").attr ('value', id);
if (jQuery.browser.msie) {
$("#form_layout_data_editor #hidden-id_layout_data").remove ();
input = $('<input type="hidden" name="id_layout_data"></input>').attr ('value', id);
$("#form_layout_data_editor").append (input);
} else {
$("#form_layout_data_editor #hidden-id_layout_data").attr ('value', id);
}
$("#form_layout_data_editor #submit-create_layout_data_button").attr ('value', "<?php echo __('Update'); ?>").removeClass ('wand').addClass ('upd');
$("#form_layout_data_editor #text-label_color").attr ('value', data['label_color']);
$(".ColorPickerDivSample").css ('background-color', data['label_color']);
@ -542,9 +548,10 @@ $(document).ready (function () {
accept: ".layout-data",
drop: function (ev, ui) {
image = $('#'+ ui.draggable[0].id + " img").eq (0);
elements = $("#" + this.id + " img").length;
total = $("img", this).length;
id = ui.draggable[0].id.split ("-").pop ();
$(ui.draggable[0]).clone ().css ('margin-left', 60 * elements).
$(ui.draggable[0]).clone ().css ('margin-left', 60 * total).
css ('margin-top', 0). attr ('id', 'delete-layout-data-' + id).
appendTo ("#"+this.id + " #elements");
$(ui.draggable[0]).remove ();

View File

@ -567,9 +567,6 @@ function process_page_head ($string, $bitfield) {
<meta name="robots" content="index, follow" />
<link rel="icon" href="images/pandora.ico" type="image/ico" />
<link rel="stylesheet" href="include/styles/common.css" type="text/css"/>
<!--[if gte IE 6]>
<link rel="stylesheet" href="include/styles/ie.css" type="text/css"/>
<![endif]-->
<link rel="alternate" href="operation/events/events_rss.php" title="Pandora RSS Feed" type="application/rss+xml" />';
if ($config["language"] != "en") {
@ -661,7 +658,12 @@ function process_page_head ($string, $bitfield) {
$output .= '<script type="text/javascript" src="'.$filename.'"></script>'."\n\t";
}
}
$output .= '<!--[if gte IE 6]>
<link rel="stylesheet" href="include/styles/ie.css" type="text/css"/>
<![endif]-->';
$output .= $string;
return $output;

View File

@ -1,4 +1,4 @@
$(document).ready (function () {
(function($) {
var dummyFunc = function () {
return;
};
@ -109,6 +109,6 @@ $(document).ready (function () {
});
$.fn.extend({
pandoraSelectGroup: $.pandoraSelectGroup.construct,
pandoraSelectAgent: $.pandoraSelectAgent.construct,
pandoraSelectAgent: $.pandoraSelectAgent.construct
});
});
}) (jQuery);

View File

@ -34,3 +34,11 @@
* html .timeEntry_control { /* IE only */
margin-top: -4px;
}
table#simple input#text-snmp_oid {
width: 70%;
}
div.configuration {
margin-top: -20px;
}