2012-07-24 Sergio Martin <sergio.martin@artica.es>
* extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql: Added missed field to migrate scripts * godmode/agentes/module_manager_editor.php godmode/modules/manage_network_components_form.php godmode/modules/manage_network_components_form_plugin.php: Improve code of dinamic macros and encapsulate it on enterprise side git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6802 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
4071876f27
commit
6176401c55
|
@ -1,3 +1,16 @@
|
|||
2012-07-24 Sergio Martin <sergio.martin@artica.es>
|
||||
|
||||
* extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql
|
||||
extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql
|
||||
extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql: Added
|
||||
missed field to migrate scripts
|
||||
|
||||
* godmode/agentes/module_manager_editor.php
|
||||
godmode/modules/manage_network_components_form.php
|
||||
godmode/modules/manage_network_components_form_plugin.php:
|
||||
Improve code of dinamic macros and encapsulate it on enterprise
|
||||
side
|
||||
|
||||
2012-07-24 Dario Rodriguez <dario.rodriguez@artica.es>
|
||||
|
||||
* operation/tree.php: Added comment to insert tag based
|
||||
|
|
|
@ -281,6 +281,7 @@ ALTER TABLE tnetwork_component ADD `macros` text;
|
|||
-- -----------------------------------------------------
|
||||
|
||||
ALTER TABLE tagente_modulo ADD `wizard_level` enum('basic','advanced','custom','nowizard') default 'nowizard';
|
||||
ALTER TABLE tagente_modulo ADD `macros` text;
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `tusuario`
|
||||
|
|
|
@ -286,6 +286,7 @@ ALTER TABLE tnetwork_component ADD (macros CLOB default '');
|
|||
|
||||
ALTER TABLE tagente_modulo ADD (wizard_level VARCHAR2(100) default 'nowizard' NOT NULL);
|
||||
ALTER TABLE tagente_modulo ADD CONSTRAINT t_agente_modulo_wizard_level_cons CHECK (wizard_level IN ('basic','advanced','custom','nowizard'));
|
||||
ALTER TABLE tagente_modulo ADD (macros CLOB default '');
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `tusuario`
|
||||
|
|
|
@ -274,6 +274,7 @@ ALTER TABLE "tnetwork_component" ADD COLUMN "macros" TEXT default '';
|
|||
|
||||
CREATE TYPE type_tagente_modulo_wizard_level AS ENUM ('basic','advanced','custom','nowizard');
|
||||
ALTER TABLE "tagente_modulo" ADD COLUMN "wizard_level" type_tagente_modulo_wizard_level default 'nowizard';
|
||||
ALTER TABLE "tagente_modulo" ADD COLUMN "macros" TEXT default '';
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `tusuario`
|
||||
|
|
|
@ -40,6 +40,7 @@ if (is_ajax ()) {
|
|||
|
||||
$components = network_components_get_network_components ($id_module_component,
|
||||
array ('id_group' => $id_module_group,
|
||||
'only_metaconsole' => 0,
|
||||
'order' => 'name ASC'),
|
||||
array ('id_nc', 'name'));
|
||||
|
||||
|
@ -51,7 +52,10 @@ if (is_ajax ()) {
|
|||
require_once ($config['homedir'].'/'.ENTERPRISE_DIR.'/include/functions_local_components.php');
|
||||
|
||||
$id_module_group = (int) get_parameter ('id_module_component_group');
|
||||
$localComponents = local_components_get_local_components(array('id_network_component_group' => $id_module_group), array('id', 'name'));
|
||||
$localComponents = local_components_get_local_components(
|
||||
array('id_network_component_group' => $id_module_group,
|
||||
'only_metaconsole' => 0),
|
||||
array('id', 'name'));
|
||||
|
||||
echo json_encode($localComponents);
|
||||
return;
|
||||
|
|
|
@ -168,6 +168,8 @@ else {
|
|||
}
|
||||
echo '</div>';
|
||||
echo '</form>';
|
||||
|
||||
ui_require_javascript_file_enterprise('pandora_local_components');
|
||||
?>
|
||||
<script language="JavaScript" type="text/javascript">
|
||||
<!--
|
||||
|
@ -478,103 +480,4 @@ $(document).ready (function () {
|
|||
type_change ();
|
||||
<?php endif; ?>
|
||||
//-->
|
||||
|
||||
// Functions to add and remove dynamic fields for macros
|
||||
function delete_macro() {
|
||||
var next_number = parseInt($('#next_macro').html());
|
||||
// Is not possible delete first macro
|
||||
if(next_number == 3) {
|
||||
$('#delete_macro_button').hide();
|
||||
}
|
||||
var next_row = parseInt($('#next_row').html());
|
||||
$('#next_macro').html(next_number-1);
|
||||
$('#next_row').html(next_row-2);
|
||||
|
||||
var nrow1 = next_row - 2;
|
||||
var nrow2 = next_row - 1;
|
||||
|
||||
var $row1 = $('#network_component-plugin_'+nrow1).remove();
|
||||
var $row2 = $('#network_component-plugin_'+nrow2).remove();
|
||||
}
|
||||
|
||||
function new_macro() {
|
||||
$('#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;
|
||||
|
||||
var next_number = parseInt($('#next_macro').html());
|
||||
$('#next_macro').html(next_number+1);
|
||||
var current_number = next_number - 1;
|
||||
|
||||
// Clone two last rows
|
||||
var $row1 = $('#network_component-plugin_'+nrow1).clone(true);
|
||||
var $row2 = $('#network_component-plugin_'+nrow2).clone(true);
|
||||
|
||||
// Change the tr ID
|
||||
$row1.attr('id','network_component-plugin_'+(nrow3));
|
||||
$row2.attr('id','network_component-plugin_'+(nrow4));
|
||||
// Change the td ID
|
||||
$row1.find('td').attr('id', changeTdId);
|
||||
$row2.find('td').attr('id', changeTdId);
|
||||
|
||||
// Insert after last field
|
||||
$row2.insertAfter('#network_component-plugin_'+nrow2);
|
||||
$row1.insertAfter('#network_component-plugin_'+nrow2);
|
||||
|
||||
// Change labels
|
||||
for(i=0;i<=3;i++) {
|
||||
var label1 = $("#network_component-plugin_"+nrow3+"-"+i).html();
|
||||
var exp_reg = new RegExp('field'+current_number, 'g');
|
||||
label1 = label1.replace(exp_reg,'field'+next_number);
|
||||
$("#network_component-plugin_"+nrow3+"-"+i).html(label1);
|
||||
}
|
||||
|
||||
for(i=0;i<=1;i++) {
|
||||
var label2 = $("#network_component-plugin_"+nrow4+"-"+i).html();
|
||||
var exp_reg = new RegExp('field'+current_number, 'g');
|
||||
label2 = label2.replace(exp_reg,'field'+next_number);
|
||||
$("#network_component-plugin_"+nrow4+"-"+i).html(label2);
|
||||
}
|
||||
|
||||
// Empty the text inputs
|
||||
$('#text-field'+next_number+'_desc').val('');
|
||||
$('#text-field'+next_number+'_help').val('');
|
||||
$('#text-field'+next_number+'_value').val('');
|
||||
|
||||
function changeTdId() {
|
||||
switch(this.id) {
|
||||
case 'network_component-plugin_'+(nrow1)+'-0':
|
||||
return 'network_component-plugin_'+(nrow3)+'-0';
|
||||
break;
|
||||
case 'network_component-plugin_'+(nrow1)+'-1':
|
||||
return 'network_component-plugin_'+(nrow3)+'-1';
|
||||
break;
|
||||
case 'network_component-plugin_'+(nrow1)+'-2':
|
||||
return 'network_component-plugin_'+(nrow3)+'-2';
|
||||
break;
|
||||
case 'network_component-plugin_'+(nrow1)+'-3':
|
||||
return 'network_component-plugin_'+(nrow3)+'-3';
|
||||
break;
|
||||
case 'network_component-plugin_'+(nrow2)+'-0':
|
||||
return 'network_component-plugin_'+(nrow4)+'-0';
|
||||
break;
|
||||
case 'network_component-plugin_'+(nrow2)+'-1':
|
||||
return 'network_component-plugin_'+(nrow4)+'-1';
|
||||
break;
|
||||
case 'network_component-plugin_'+(nrow2)+'-2':
|
||||
return 'network_component-plugin_'+(nrow4)+'-2';
|
||||
break;
|
||||
case 'network_component-plugin_'+(nrow2)+'-3':
|
||||
return 'network_component-plugin_'+(nrow4)+'-3';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -52,77 +52,77 @@ $data[3] = html_print_input_text ('post_process', $post_process, '', 12, 25, tru
|
|||
|
||||
push_table_row ($data, 'plugin_3');
|
||||
|
||||
|
||||
$data = array ();
|
||||
$data[0] = __('Plugin macros');
|
||||
$data[0] .= ui_print_help_icon ('plugin_macros', true);
|
||||
$data[1] = $data[2] = $data[3] = '';
|
||||
|
||||
push_table_row ($data, 'plugin_4');
|
||||
|
||||
$macros = json_decode($macros,true);
|
||||
// The next row number is plugin_5
|
||||
$next_name_number = 5;
|
||||
$i = 1;
|
||||
while(1) {
|
||||
// Always print at least one macro
|
||||
if((!isset($macros[$i]) || $macros[$i]['desc'] == '') && $i > 1) {
|
||||
break;
|
||||
}
|
||||
$macro_desc_name = 'field'.$i.'_desc';
|
||||
$macro_desc_value = '';
|
||||
$macro_help_name = 'field'.$i.'_help';
|
||||
$macro_help_value = '';
|
||||
$macro_value_name = 'field'.$i.'_value';
|
||||
$macro_value_value = '';
|
||||
$macro_name_name = 'field'.$i.'_macro';
|
||||
$macro_name = '_field'.$i.'_';
|
||||
|
||||
if(isset($macros[$i]['desc'])) {
|
||||
$macro_desc_value = $macros[$i]['desc'];
|
||||
}
|
||||
|
||||
if(isset($macros[$i]['help'])) {
|
||||
$macro_help_value = $macros[$i]['help'];
|
||||
}
|
||||
|
||||
if(isset($macros[$i]['value'])) {
|
||||
$macro_value_value = $macros[$i]['value'];
|
||||
}
|
||||
|
||||
// Dynamic macros for enterprise version
|
||||
if(enterprise_installed()) {
|
||||
$data = array ();
|
||||
$data[0] = sprintf(__('Macro %s description'),$macro_name);
|
||||
$data[0] .= ui_print_help_tip (sprintf(__('Field that will replace the macro %s in Plug-in parameters'),$macro_name), true);
|
||||
$data[0] .= html_print_input_hidden($macro_name_name, $macro_name, true);
|
||||
$data[1] = html_print_input_text ($macro_desc_name, $macro_desc_value, '', 30, 255, true);
|
||||
$data[2] = sprintf(__('Macro %s default value'),$macro_name);
|
||||
$data[2] .= ui_print_help_tip (sprintf(__('Default value for the macro %s'),$macro_name), true);
|
||||
$data[3] = html_print_input_text ($macro_value_name, $macro_value_value, '', 30, 255, true);
|
||||
$data[0] = __('Plugin macros');
|
||||
$data[0] .= ui_print_help_icon ('plugin', true);
|
||||
$data[1] = $data[2] = $data[3] = '';
|
||||
|
||||
push_table_row ($data, 'plugin_'.$next_name_number);
|
||||
$next_name_number++;
|
||||
|
||||
$table->colspan['plugin_'.$next_name_number][1] = 2;
|
||||
push_table_row ($data, 'plugin_4');
|
||||
|
||||
$data = array ();
|
||||
$data[0] = sprintf(__('Macro %s help'),$macro_name);
|
||||
$data[0] .= ui_print_help_tip (sprintf(__('Help that will appear near %s'),$macro_name), true);
|
||||
$data[1] = html_print_input_text ($macro_help_name, $macro_help_value, '', 100, 255, true);
|
||||
$macros = json_decode($macros,true);
|
||||
// The next row number is plugin_5
|
||||
$next_name_number = 5;
|
||||
$i = 1;
|
||||
while(1) {
|
||||
// Always print at least one macro
|
||||
if((!isset($macros[$i]) || $macros[$i]['desc'] == '') && $i > 1) {
|
||||
break;
|
||||
}
|
||||
$macro_desc_name = 'field'.$i.'_desc';
|
||||
$macro_desc_value = '';
|
||||
$macro_help_name = 'field'.$i.'_help';
|
||||
$macro_help_value = '';
|
||||
$macro_value_name = 'field'.$i.'_value';
|
||||
$macro_value_value = '';
|
||||
$macro_name_name = 'field'.$i.'_macro';
|
||||
$macro_name = '_field'.$i.'_';
|
||||
|
||||
if(isset($macros[$i]['desc'])) {
|
||||
$macro_desc_value = $macros[$i]['desc'];
|
||||
}
|
||||
|
||||
if(isset($macros[$i]['help'])) {
|
||||
$macro_help_value = $macros[$i]['help'];
|
||||
}
|
||||
|
||||
if(isset($macros[$i]['value'])) {
|
||||
$macro_value_value = $macros[$i]['value'];
|
||||
}
|
||||
|
||||
$data = array ();
|
||||
$data[0] = sprintf(__('Macro %s description'),$macro_name);
|
||||
$data[0] .= html_print_input_hidden($macro_name_name, $macro_name, true);
|
||||
$data[1] = html_print_input_text ($macro_desc_name, $macro_desc_value, '', 30, 255, true);
|
||||
$data[2] = sprintf(__('Macro %s default value'),$macro_name);
|
||||
$data[3] = html_print_input_text ($macro_value_name, $macro_value_value, '', 30, 255, true);
|
||||
|
||||
push_table_row ($data, 'plugin_'.$next_name_number);
|
||||
$next_name_number++;
|
||||
$i++;
|
||||
}
|
||||
push_table_row ($data, 'plugin_'.$next_name_number);
|
||||
$next_name_number++;
|
||||
|
||||
$table->colspan['plugin_'.$next_name_number][1] = 2;
|
||||
|
||||
$data = array ();
|
||||
$data[0] = sprintf(__('Macro %s help'),$macro_name);
|
||||
$data[1] = html_print_input_text ($macro_help_name, $macro_help_value, '', 100, 255, true);
|
||||
|
||||
push_table_row ($data, 'plugin_'.$next_name_number);
|
||||
$next_name_number++;
|
||||
$i++;
|
||||
}
|
||||
|
||||
$table->colspan['plugin_n'][2] = 2;
|
||||
|
||||
$data = array ();
|
||||
$data[0] = '';
|
||||
$data[1] = __('Add macro').' <a href="javascript:new_macro()">'.html_print_image('images/add.png',true).'</a>';
|
||||
$data[1] = __('Add macro').' <a href="javascript:new_macro(\'network_component-plugin_\')">'.html_print_image('images/add.png',true).'</a>';
|
||||
$data[1] .= '<div id="next_macro" style="display:none">'.$i.'</div>';
|
||||
$data[1] .= '<div id="next_row" style="display:none">'.$next_name_number.'</div>';
|
||||
$data[2] = '<div id="delete_macro_button" style="display:none;">'.__('Delete macro').' <a href="javascript:delete_macro()">'.html_print_image('images/cancel.png',true).'</a></div>';
|
||||
$data[2] = '<div id="delete_macro_button" style="display:none;">'.__('Delete macro').' <a href="javascript:delete_macro(\'network_component-plugin_\')">'.html_print_image('images/cancel.png',true).'</a></div>';
|
||||
|
||||
push_table_row ($data, 'plugin_n');
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
|
Loading…
Reference in New Issue