2014-04-09 Vanessa Gil <vanessa.gil@artica.es>

* godmode/servers/plugin.php
	  include/functions_html.php
	  include/javascript/pandora_module.js: Possibility to 
	hide the value of a macro.
	  
	* include/styles/pandora.css: Changed color alerts.


git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@9747 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
vgilc 2014-04-09 14:24:20 +00:00
parent 45c15b7202
commit 3355abadfb
5 changed files with 92 additions and 37 deletions

View File

@ -1,3 +1,12 @@
2014-04-09 Vanessa Gil <vanessa.gil@artica.es>
* godmode/servers/plugin.php
include/functions_html.php
include/javascript/pandora_module.js: Possibility to
hide the value of a macro.
* include/styles/pandora.css: Changed color alerts.
2014-04-09 Ramon Novoa <rnovoa@artica.es> 2014-04-09 Ramon Novoa <rnovoa@artica.es>
* extras/pandoradb_migrate_5.0.x_to_5.1.mysql.sql: Added the SNMP L2 * extras/pandoradb_migrate_5.0.x_to_5.1.mysql.sql: Added the SNMP L2

View File

@ -282,6 +282,8 @@ if (($create != "") OR ($view != "")) {
$macro_value_value = ''; $macro_value_value = '';
$macro_name_name = 'field'.$i.'_macro'; $macro_name_name = 'field'.$i.'_macro';
$macro_name = '_field'.$i.'_'; $macro_name = '_field'.$i.'_';
$macro_hide_value_name = 'field'.$i.'_hide';
$macro_hide_value_value = 1;
if(isset($macros[$i]['desc'])) { if(isset($macros[$i]['desc'])) {
$macro_desc_value = $macros[$i]['desc']; $macro_desc_value = $macros[$i]['desc'];
@ -315,6 +317,13 @@ if (($create != "") OR ($view != "")) {
$table->colspan['plugin_'.$next_name_number][1] = 3; $table->colspan['plugin_'.$next_name_number][1] = 3;
$datam = array ();
$datam[0] = __('Hide value');
$datam[1] = html_print_checkbox_extended ($macro_hide_value_name, $macro_hide_value_value, 0, 0, '', array('class' => 'command_advanced_conf'), true, 'checkbox-'.$macro_hide_value_name);
$table->data['plugin_'.$next_name_number] = $datam;
$next_name_number++;
$datam = array (); $datam = array ();
$datam[0] = __('Help')."<span style='font-weight: normal'> ($macro_name)</span><br><br><br>"; $datam[0] = __('Help')."<span style='font-weight: normal'> ($macro_name)</span><br><br><br>";
$tadisabled = $locked === true ? ' disabled' : ''; $tadisabled = $locked === true ? ' disabled' : '';
@ -456,11 +465,13 @@ else {
$desc = (string)get_parameter ('field'.$i.'_desc'); $desc = (string)get_parameter ('field'.$i.'_desc');
$help = (string)get_parameter ('field'.$i.'_help'); $help = (string)get_parameter ('field'.$i.'_help');
$value = (string)get_parameter ('field'.$i.'_value'); $value = (string)get_parameter ('field'.$i.'_value');
$hide = get_parameter ('field'.$i.'_hide');
$macros[$i]['macro'] = $macro; $macros[$i]['macro'] = $macro;
$macros[$i]['desc'] = $desc; $macros[$i]['desc'] = $desc;
$macros[$i]['help'] = $help; $macros[$i]['help'] = $help;
$macros[$i]['value'] = $value; $macros[$i]['value'] = $value;
$macros[$i]['hide'] = $hide;
$i++; $i++;
} }

View File

@ -1554,7 +1554,7 @@ function html_print_radio_button ($name, $value, $label = '', $checkedvalue = ''
* *
* @return string HTML code if return parameter is true. * @return string HTML code if return parameter is true.
*/ */
function html_print_checkbox_extended ($name, $value, $checked, $disabled, $script, $attributes, $return = false) { function html_print_checkbox_extended ($name, $value, $checked, $disabled, $script, $attributes, $return = false, $id='') {
static $idcounter = array (); static $idcounter = array ();
//If duplicate names exist, it will start numbering. Otherwise it won't //If duplicate names exist, it will start numbering. Otherwise it won't
@ -1565,10 +1565,14 @@ function html_print_checkbox_extended ($name, $value, $checked, $disabled, $scri
$idcounter[$name] = 0; $idcounter[$name] = 0;
} }
$id = preg_replace('/[^a-z0-9\:\;\-\_]/i', '', $name.($idcounter[$name] ? $idcounter[$name] : '')); $id_aux = preg_replace('/[^a-z0-9\:\;\-\_]/i', '', $name.($idcounter[$name] ? $idcounter[$name] : ''));
$output = '<input name="'.$name.'" type="checkbox" value="'.$value.'" '. ($checked ? 'checked="checked"': ''); $output = '<input name="'.$name.'" type="checkbox" value="'.$value.'" '. ($checked ? 'checked="checked"': '');
$output .= ' id="checkbox-'.$id.'"'; if ($id == '') {
$output .= ' id="checkbox-'.$id_aux.'"';
} else {
$output .= ' '.$id.'"';
}
if ($script != '') { if ($script != '') {
$output .= ' onclick="'. $script . '"'; $output .= ' onclick="'. $script . '"';

View File

@ -475,11 +475,13 @@ function new_macro(prefix) {
var next_row = parseInt($('#next_row').html()); var next_row = parseInt($('#next_row').html());
$('#next_row').html(next_row + 2); $('#next_row').html(next_row + 3);
var nrow1 = next_row - 2; var nrow1 = next_row - 3;
var nrow2 = next_row - 1; var nrow2 = next_row - 2;
var nrow3 = next_row; var nrow3 = next_row - 1;
var nrow4 = next_row + 1; var nrow4 = next_row;
var nrow5 = next_row + 1;
var nrow6 = next_row + 2;
var next_number = parseInt($('#next_macro').html()); var next_number = parseInt($('#next_macro').html());
$('#next_macro').html(next_number + 1); $('#next_macro').html(next_number + 1);
@ -488,67 +490,90 @@ function new_macro(prefix) {
// Clone two last rows // Clone two last rows
var $row1 = $('#' + prefix + nrow1).clone(true); var $row1 = $('#' + prefix + nrow1).clone(true);
var $row2 = $('#' + prefix + nrow2).clone(true); var $row2 = $('#' + prefix + nrow2).clone(true);
var $row3 = $('#' + prefix + nrow3).clone(true);
// Change the tr ID // Change the tr ID
$row1.attr('id',prefix + (nrow3)); $row1.attr('id',prefix + (nrow4));
$row2.attr('id',prefix + (nrow4)); $row2.attr('id',prefix + (nrow5));
$row3.attr('id',prefix + (nrow6));
// Change the td ID // Change the td ID
$row1.find('td').attr('id', changeTdId); $row1.find('td').attr('id', changeTdId);
$row2.find('td').attr('id', changeTdId); $row2.find('td').attr('id', changeTdId);
$row3.find('td').attr('id', changeTdId);
// Insert after last field // Insert after last field
$row2.insertAfter('#' + prefix + nrow2); $row3.insertAfter('#' + prefix + nrow3);
$row1.insertAfter('#' + prefix + nrow2); $row2.insertAfter('#' + prefix + nrow3);
$row1.insertAfter('#' + prefix + nrow3);
// Change labels // Change labels
for(i = 0; i <= 3; i++) { for(i = 0; i <= 3; i++) {
var label1 = $("#" + prefix + nrow3 + "-" + i).html(); var label1 = $("#" + prefix + nrow4 + "-" + i).html();
var exp_reg = new RegExp('field' + current_number, 'g'); var exp_reg = new RegExp('field' + current_number, 'g');
label1 = label1.replace(exp_reg,'field' + next_number); label1 = label1.replace(exp_reg,'field' + next_number);
$("#" + prefix + nrow3 + "-" + i).html(label1); $("#" + prefix + nrow4 + "-" + i).html(label1);
} }
for(i = 0; i <= 1; i++) { for(i = 0; i <= 1; i++) {
var label2 = $("#" + prefix + nrow4 + "-" + i).html(); var label2 = $("#" + prefix + nrow5 + "-" + i).html();
var exp_reg = new RegExp('field' + current_number, 'g'); var exp_reg = new RegExp('field' + current_number, 'g');
label2 = label2.replace(exp_reg,'field' + next_number); label2 = label2.replace(exp_reg,'field' + next_number);
$("#" + prefix + nrow4 + "-" + i).html(label2); $("#" + prefix + nrow5 + "-" + i).html(label2);
}
for(i = 0; i <= 1; i++) {
var label3 = $("#" + prefix + nrow6 + "-" + i).html();
var exp_reg = new RegExp('field' + current_number, 'g');
label3 = label3.replace(exp_reg,'field' + next_number);
$("#" + prefix + nrow6 + "-" + i).html(label3);
} }
// Empty the text inputs // Empty the text inputs
$('#text-field' + next_number + '_desc').val(''); $('#text-field' + next_number + '_desc').val('');
$('#text-field' + next_number + '_help').val(''); $('#text-field' + next_number + '_help').val('');
$('#text-field' + next_number + '_value').val(''); $('#text-field' + next_number + '_value').val('');
$('#radio-field' + next_number + '_hide').val(0);
function changeTdId() { function changeTdId() {
switch(this.id) { switch(this.id) {
case prefix + (nrow1) + '-0': case prefix + (nrow1) + '-0':
return prefix + (nrow3) + '-0';
break;
case prefix + (nrow1) + '-1':
return prefix + (nrow3) + '-1';
break;
case prefix + (nrow1) + '-2':
return prefix + (nrow3) + '-2';
break;
case prefix + (nrow1) + '-3':
return prefix + (nrow3) + '-3';
break;
case prefix + (nrow2) + '-0':
return prefix + (nrow4) + '-0'; return prefix + (nrow4) + '-0';
break; break;
case prefix + (nrow2) + '-1': case prefix + (nrow1) + '-1':
return prefix + (nrow4) + '-1'; return prefix + (nrow4) + '-1';
break; break;
case prefix + (nrow2) + '-2': case prefix + (nrow1) + '-2':
return prefix + (nrow4) + '-2'; return prefix + (nrow4) + '-2';
break; break;
case prefix + (nrow2) + '-3': case prefix + (nrow1) + '-3':
return prefix + (nrow4) + '-3'; return prefix + (nrow4) + '-3';
break; break;
case prefix + (nrow2) + '-0':
return prefix + (nrow5) + '-0';
break;
case prefix + (nrow2) + '-1':
return prefix + (nrow5) + '-1';
break;
case prefix + (nrow2) + '-2':
return prefix + (nrow5) + '-2';
break;
case prefix + (nrow2) + '-3':
return prefix + (nrow5) + '-3';
break;
case prefix + (nrow3) + '-0':
return prefix + (nrow6) + '-0';
break;
case prefix + (nrow3) + '-1':
return prefix + (nrow6) + '-1';
break;
case prefix + (nrow3) + '-2':
return prefix + (nrow6) + '-2';
break;
case prefix + (nrow3) + '-3':
return prefix + (nrow6) + '-3';
break;
} }
} }
} }
function add_macro_field(macro, row_model_id) { function add_macro_field(macro, row_model_id) {
@ -556,7 +581,10 @@ function add_macro_field(macro, row_model_id) {
// Change the carriage returns by html returns <br> in help // Change the carriage returns by html returns <br> in help
var macro_help = macro['help'].replace(/&#x0d;/g,"<br>"); var macro_help = macro['help'].replace(/&#x0d;/g,"<br>");
var macro_macro = macro['macro']; var macro_macro = macro['macro'];
var macro_value = $('<div />').html(macro['value']).text();; var macro_value = $('<div />').html(macro['value']).text();
var macro_hide = macro['hide'];
macro_value.type = 'password';
var row_id = row_model_id + macro_macro; var row_id = row_model_id + macro_macro;
@ -601,6 +629,9 @@ function add_macro_field(macro, row_model_id) {
// Change the text box id and value // Change the text box id and value
$('#'+row_id).children().eq(1).children().attr('id','text-'+macro_macro); $('#'+row_id).children().eq(1).children().attr('id','text-'+macro_macro);
$('#'+row_id).children().eq(1).children().attr('name',macro_macro); $('#'+row_id).children().eq(1).children().attr('name',macro_macro);
if (macro['hide']) {
$('#'+row_id).children().eq(1).children().attr('type','password');
}
$('#'+row_id).children().eq(1).children().val(macro_value); $('#'+row_id).children().eq(1).children().val(macro_value);

View File

@ -1165,7 +1165,7 @@ tr.disabled_row_user * {
width: 100%; width: 100%;
} }
.orange { .orange {
color: #ffa300; color: #fd7304;
} }
.green { .green {
color: #5a8629; color: #5a8629;