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:
parent
45c15b7202
commit
3355abadfb
|
@ -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>
|
||||
|
||||
* extras/pandoradb_migrate_5.0.x_to_5.1.mysql.sql: Added the SNMP L2
|
||||
|
|
|
@ -282,6 +282,8 @@ if (($create != "") OR ($view != "")) {
|
|||
$macro_value_value = '';
|
||||
$macro_name_name = 'field'.$i.'_macro';
|
||||
$macro_name = '_field'.$i.'_';
|
||||
$macro_hide_value_name = 'field'.$i.'_hide';
|
||||
$macro_hide_value_value = 1;
|
||||
|
||||
if(isset($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;
|
||||
|
||||
$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[0] = __('Help')."<span style='font-weight: normal'> ($macro_name)</span><br><br><br>";
|
||||
$tadisabled = $locked === true ? ' disabled' : '';
|
||||
|
@ -456,11 +465,13 @@ else {
|
|||
$desc = (string)get_parameter ('field'.$i.'_desc');
|
||||
$help = (string)get_parameter ('field'.$i.'_help');
|
||||
$value = (string)get_parameter ('field'.$i.'_value');
|
||||
$hide = get_parameter ('field'.$i.'_hide');
|
||||
|
||||
$macros[$i]['macro'] = $macro;
|
||||
$macros[$i]['desc'] = $desc;
|
||||
$macros[$i]['help'] = $help;
|
||||
$macros[$i]['value'] = $value;
|
||||
$macros[$i]['hide'] = $hide;
|
||||
$i++;
|
||||
}
|
||||
|
||||
|
|
|
@ -1554,7 +1554,7 @@ function html_print_radio_button ($name, $value, $label = '', $checkedvalue = ''
|
|||
*
|
||||
* @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 ();
|
||||
|
||||
//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;
|
||||
}
|
||||
|
||||
$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 .= ' id="checkbox-'.$id.'"';
|
||||
if ($id == '') {
|
||||
$output .= ' id="checkbox-'.$id_aux.'"';
|
||||
} else {
|
||||
$output .= ' '.$id.'"';
|
||||
}
|
||||
|
||||
if ($script != '') {
|
||||
$output .= ' onclick="'. $script . '"';
|
||||
|
|
|
@ -474,13 +474,15 @@ function new_macro(prefix) {
|
|||
$('#delete_macro_button').show();
|
||||
|
||||
var next_row = parseInt($('#next_row').html());
|
||||
|
||||
$('#next_row').html(next_row + 2);
|
||||
var nrow1 = next_row - 2;
|
||||
var nrow2 = next_row - 1;
|
||||
var nrow3 = next_row;
|
||||
var nrow4 = next_row + 1;
|
||||
|
||||
|
||||
$('#next_row').html(next_row + 3);
|
||||
var nrow1 = next_row - 3;
|
||||
var nrow2 = next_row - 2;
|
||||
var nrow3 = next_row - 1;
|
||||
var nrow4 = next_row;
|
||||
var nrow5 = next_row + 1;
|
||||
var nrow6 = next_row + 2;
|
||||
|
||||
var next_number = parseInt($('#next_macro').html());
|
||||
$('#next_macro').html(next_number + 1);
|
||||
var current_number = next_number - 1;
|
||||
|
@ -488,67 +490,90 @@ function new_macro(prefix) {
|
|||
// Clone two last rows
|
||||
var $row1 = $('#' + prefix + nrow1).clone(true);
|
||||
var $row2 = $('#' + prefix + nrow2).clone(true);
|
||||
var $row3 = $('#' + prefix + nrow3).clone(true);
|
||||
|
||||
// Change the tr ID
|
||||
$row1.attr('id',prefix + (nrow3));
|
||||
$row2.attr('id',prefix + (nrow4));
|
||||
$row1.attr('id',prefix + (nrow4));
|
||||
$row2.attr('id',prefix + (nrow5));
|
||||
$row3.attr('id',prefix + (nrow6));
|
||||
// Change the td ID
|
||||
$row1.find('td').attr('id', changeTdId);
|
||||
$row2.find('td').attr('id', changeTdId);
|
||||
$row3.find('td').attr('id', changeTdId);
|
||||
|
||||
// Insert after last field
|
||||
$row2.insertAfter('#' + prefix + nrow2);
|
||||
$row1.insertAfter('#' + prefix + nrow2);
|
||||
$row3.insertAfter('#' + prefix + nrow3);
|
||||
$row2.insertAfter('#' + prefix + nrow3);
|
||||
$row1.insertAfter('#' + prefix + nrow3);
|
||||
|
||||
// Change labels
|
||||
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');
|
||||
label1 = label1.replace(exp_reg,'field' + next_number);
|
||||
$("#" + prefix + nrow3 + "-" + i).html(label1);
|
||||
$("#" + prefix + nrow4 + "-" + i).html(label1);
|
||||
}
|
||||
|
||||
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');
|
||||
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
|
||||
$('#text-field' + next_number + '_desc').val('');
|
||||
$('#text-field' + next_number + '_help').val('');
|
||||
$('#text-field' + next_number + '_value').val('');
|
||||
$('#radio-field' + next_number + '_hide').val(0);
|
||||
|
||||
function changeTdId() {
|
||||
switch(this.id) {
|
||||
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';
|
||||
break;
|
||||
case prefix + (nrow2) + '-1':
|
||||
case prefix + (nrow1) + '-1':
|
||||
return prefix + (nrow4) + '-1';
|
||||
break;
|
||||
case prefix + (nrow2) + '-2':
|
||||
case prefix + (nrow1) + '-2':
|
||||
return prefix + (nrow4) + '-2';
|
||||
break;
|
||||
case prefix + (nrow2) + '-3':
|
||||
case prefix + (nrow1) + '-3':
|
||||
return prefix + (nrow4) + '-3';
|
||||
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) {
|
||||
|
@ -556,7 +581,10 @@ function add_macro_field(macro, row_model_id) {
|
|||
// Change the carriage returns by html returns <br> in help
|
||||
var macro_help = macro['help'].replace(/
/g,"<br>");
|
||||
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;
|
||||
|
||||
|
@ -601,6 +629,9 @@ function add_macro_field(macro, row_model_id) {
|
|||
// 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('name',macro_macro);
|
||||
if (macro['hide']) {
|
||||
$('#'+row_id).children().eq(1).children().attr('type','password');
|
||||
}
|
||||
$('#'+row_id).children().eq(1).children().val(macro_value);
|
||||
|
||||
|
||||
|
|
|
@ -1165,7 +1165,7 @@ tr.disabled_row_user * {
|
|||
width: 100%;
|
||||
}
|
||||
.orange {
|
||||
color: #ffa300;
|
||||
color: #fd7304;
|
||||
}
|
||||
.green {
|
||||
color: #5a8629;
|
||||
|
|
Loading…
Reference in New Issue