From 4425825908813ba362e2d3b4cf47e571d2bc5201 Mon Sep 17 00:00:00 2001 From: "alejandro.campos@artica.es" Date: Thu, 10 Nov 2022 14:19:01 +0100 Subject: [PATCH] change update constraints for server plugins --- pandora_console/godmode/servers/plugin.php | 87 +++++----------------- 1 file changed, 18 insertions(+), 69 deletions(-) diff --git a/pandora_console/godmode/servers/plugin.php b/pandora_console/godmode/servers/plugin.php index 89ecfb5705..5a0d8a063a 100644 --- a/pandora_console/godmode/servers/plugin.php +++ b/pandora_console/godmode/servers/plugin.php @@ -399,10 +399,7 @@ if (($create != '') || ($view != '')) { $data = []; $data[0] = __('Plugin command').ui_print_help_tip(__('Specify interpreter and plugin path. The server needs permissions to run it.'), true); - $data[1] = ''; - if ($locked) { - $data[1] .= html_print_image('images/lock_mc.png', true, ['class' => 'command_advanced_conf lock', 'class' => 'invert_filter']); - } + $data[1] = ''; $data[1] .= ' '; $data[1] .= html_print_image('images/file.png', true, ['class' => 'invert_filter'], false, true); @@ -411,11 +408,7 @@ if (($create != '') || ($view != '')) { $data = []; $data[0] = __('Plug-in parameters'); - $data[1] = ''; - if ($locked) { - $data[1] .= html_print_image('images/lock_mc.png', true, ['class' => 'command_advanced_conf lock', 'class' => 'invert_filter']); - } - + $data[1] = ''; $table->data['plugin_parameters'] = $data; $data = []; @@ -484,16 +477,10 @@ if (($create != '') || ($view != '')) { $datam = []; $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_macro text_input'", true); - if ($locked) { - $datam[1] .= html_print_image('images/lock_mc.png', true, ['class' => 'command_macro lock', 'class' => 'invert_filter']); - } + $datam[1] = html_print_input_text_extended($macro_desc_name, $macro_desc_value, 'text-'.$macro_desc_name, '', 30, 255, false, '', "class='command_macro text_input'", true); $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_macro text_input'", true); - if ($locked) { - $datam[3] .= html_print_image('images/lock_mc.png', true, ['class' => 'command_macro lock', 'class' => 'invert_filter']); - } + $datam[3] = html_print_input_text_extended($macro_value_name, $macro_value_value, 'text-'.$macro_value_name, '', 30, 255, false, '', "class='command_component command_macro text_input'", true); $table->data['plugin_'.$next_name_number] = $datam; @@ -524,24 +511,15 @@ if (($create != '') || ($view != '')) { $datam = []; $datam[0] = __('Help')." ($macro_name)


"; - $tadisabled = $locked === true ? ' disabled' : ''; $datam[1] = html_print_textarea( $macro_help_name, 6, 100, $macro_help_value, - 'class="command_macro" class="w97p"'.$tadisabled, + 'class="command_macro" class="w97p"', true ); - if ($locked) { - $datam[1] .= html_print_image( - 'images/lock_mc.png', - true, - ['class' => 'command_macro lock invert_filter'] - ); - } - $datam[1] .= '


'; $table->data['plugin_'.$next_name_number] = $datam; @@ -551,15 +529,16 @@ if (($create != '') || ($view != '')) { // Add/Delete buttons $datam = []; - $datam[0] = '
'.''.__('Add macro').''.' '.html_print_image( - 'images/add.png', - true, - ['class' => 'invert_filter'] - ).''; - $datam[0] .= ''; - $datam[0] .= ''; if (!$locked) { + $datam[0] = ''.''.__('Add macro').''.' '.html_print_image( + 'images/add.png', + true, + ['class' => 'invert_filter'] + ).''; + $datam[0] .= ''; + $datam[0] .= ''; + $delete_macro_style = ''; if ($i <= 2) { $delete_macro_style = 'display:none;'; @@ -1002,8 +981,11 @@ ui_require_javascript_file('pandora_modules'); }); update_preview(); } - $('a#add_macro_btn').click(add_macro_click_event); - + + if (locked === 0) { + $('a#add_macro_btn').click(add_macro_click_event); + } + // Delete macro var delete_macro_click_event = function (event) { delete_macro_form('table-form-plugin_'); @@ -1031,45 +1013,12 @@ ui_require_javascript_file('pandora_modules'); } } - var command_click_locked_event = function (event) { - var $element = $(this); - - if (!$element.is('input') || ($element.is('input') && ($element.prop('readonly') || $element.prop('disabled')))) { - if ($element.prop('id') === 'form_parameters') { - var message = '' - + '.\n' + ''; - - if (confirm(message)) { - if ($element.is('input')) { - $element - .prop('readonly', false) - .prop('disabled', false) - .siblings('img.command_advanced_conf.lock') - .remove(); - } - else { - $element - .siblings('input.command_advanced_conf') - .prop('readonly', false) - .prop('disabled', false) - $element.remove(); - } - } - } - else { - alert(""); - } - } - } - var macros_click_locked_event = function (event) { alert(""); } if (locked) { $('a#add_macro_btn').click(add_macro_click_locked_event); - $('.command_advanced_conf').click(command_click_locked_event); - $('.command_macro').click(macros_click_locked_event); }