';
echo '';
$table->data = array();
$plugin_id = get_parameter ("view", 0);
$locked = true;
// If we have plugin id (update mode) and this plugin used by any module or component
// The command configuration will be locked
if ($plugin_id > 0) {
$modules_using_plugin = db_get_value_filter('count(*)','tagente_modulo', array('delete_pending' => 0, 'id_plugin' => $plugin_id));
$components_using_plugin = db_get_value_filter('count(*)','tnetwork_component', array('id_plugin' => $plugin_id));
if(($components_using_plugin + $modules_using_plugin) == 0) {
$locked = false;
}
}
else {
$locked = false;
}
$disabled = '';
if ($locked) {
$disabled = 'readonly="readonly"';
}
$data = array();
$data[0] = __('Plugin command');
$data[1] = '';
if ($locked) {
$data[1] .= html_print_image('images/lock.png', true, array('class' => 'command_advanced_conf'));
}
$table->data['plugin_command'] = $data;
$data = array();
$data[0] = __('Plug-in parameters').ui_print_help_icon ('plugin_parameters', true);
$data[1] = '';
if ($locked) {
$data[1] .= html_print_image('images/lock.png', true, array('class' => 'command_advanced_conf'));
}
$table->data['plugin_parameters'] = $data;
$data = array();
$data[0] = __('Command preview');
$data[1] = '';
$table->data['plugin_preview'] = $data;
echo '';
$data = array();
$table->data = array ();
$macros = json_decode($macros,true);
// The next row number is plugin_9
$next_name_number = 9;
$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'];
}
$datam = array ();
$datam[0] = __('Description')." ($macro_name)";
$datam[0] .= html_print_input_hidden($macro_name_name, $macro_name, true);
$datam[1] = html_print_input_text_extended ($macro_desc_name, $macro_desc_value, 'text-'.$macro_desc_name, '', 30, 255, $locked, '', "class='command_advanced_conf'", true);
if($locked) {
$datam[1] .= html_print_image('images/lock.png', true, array('class' => 'command_advanced_conf'));
}
$datam[2] = __('Default value')." ($macro_name)";
$datam[3] = html_print_input_text_extended ($macro_value_name, $macro_value_value, 'text-'.$macro_value_name, '', 30, 255, $locked, '', "class='command_component command_advanced_conf'", true);
if($locked) {
$datam[3] .= html_print_image('images/lock.png', true, array('class' => 'command_advanced_conf'));
}
$table->data['plugin_'.$next_name_number] = $datam;
$next_name_number++;
$table->colspan['plugin_'.$next_name_number][1] = 3;
$datam = array ();
$datam[0] = __('Help')." ($macro_name)
";
$datam[1] = html_print_input_text_extended ($macro_help_name, $macro_help_value, 'text-'.$macro_help_name, '', 100, 255, $locked, '', "class='command_advanced_conf'", true);
if($locked) {
$datam[1] .= html_print_image('images/lock.png', true, array('class' => 'command_advanced_conf'));
}
$datam[1] .= "
";
$table->data['plugin_'.$next_name_number] = $datam;
$next_name_number++;
$i++;
}
if (!$locked) {
$datam = array ();
$datam[0] = ''.__('Add macro').' '.html_print_image('images/add.png',true).'';
$datam[0] .= ''.$i.' ';
$datam[0] .= ''.$next_name_number.' ';
$delete_macro_style = '';
if($i <= 2) {
$delete_macro_style = 'display:none;';
}
$datam[2] = '';
$table->colspan['plugin_action'][0] = 2;
$table->rowstyle['plugin_action'] = 'text-align:center';
$table->colspan['plugin_action'][2] = 2;
$table->data['plugin_action'] = $datam;
}
echo '';
echo '';
echo ' |