From e2834cd49da5df098cc34d3919c2a67c449ee695 Mon Sep 17 00:00:00 2001 From: Rouslan Placella Date: Tue, 14 Jun 2011 11:54:05 +0100 Subject: [PATCH] Generate the type dropdown for Routine editor in PHP, not JavaScript. --- js/db_routines.js | 25 ------------------------- libraries/db_routines.inc.php | 32 +++++++++++++++++++++----------- 2 files changed, 21 insertions(+), 36 deletions(-) diff --git a/js/db_routines.js b/js/db_routines.js index cf62df74ef..b2b3b0c5a1 100644 --- a/js/db_routines.js +++ b/js/db_routines.js @@ -285,31 +285,6 @@ $(document).ready(function() { // Cache the template for a parameter table row param_template = data.param_template; // Make adjustments in the dialog to make it AJAX compatible - /** - * @var is_procedure Used to make the PROCEDURE dropdown option selected - * if a procedure is being edited or created. - */ - var is_procedure = ''; - /** - * @var is_function Used to make the FUNCTION dropdown option selected - * if a function is being edited or created. - */ - var is_function = ''; - if (data.type == 'PROCEDURE') { - is_procedure = ' selected="selected"'; - } else if (data.type == 'FUNCTION') { - is_function = ' selected="selected"'; - } - /** - * @var new_type_cell Contains HTML code that replaces the non-JS functionality - * used to switch the routine editor from procedure to function - * editing modes and back with a JS-aware dropdown. - */ - var new_type_cell = ''; - $('.routine_changetype_cell').html(new_type_cell); $('.routine_param_remove').show(); $('input[name=routine_removeparameter]').remove(); $('input[name=routine_addparameter]').css('width', '100%'); diff --git a/libraries/db_routines.inc.php b/libraries/db_routines.inc.php index ef566ff099..3ca70bb0b6 100644 --- a/libraries/db_routines.inc.php +++ b/libraries/db_routines.inc.php @@ -623,12 +623,16 @@ function displayRoutineEditor($mode, $operation, $routine, $errors, $is_ajax) { . "\n"; } - $isfunction_class = ''; - $isprocedure_class = ''; + $isfunction_class = ''; + $isprocedure_class = ''; + $isfunction_select = ''; + $isprocedure_select = ''; if ($routine['type'] == 'PROCEDURE') { - $isfunction_class = ' hide'; + $isfunction_class = ' hide'; + $isprocedure_select = " selected='selected'"; } else { $isprocedure_class = ' hide'; + $isfunction_select = " selected='selected'"; } // Create the output @@ -647,14 +651,20 @@ function displayRoutineEditor($mode, $operation, $routine, $errors, $is_ajax) { $retval .= "\n"; $retval .= "\n"; $retval .= " " . __('Type') . "\n"; - // TODO: generate ajax dropdown here, not by js - $retval .= " \n"; - $retval .= " \n"; - $retval .= "
\n"; - $retval .= " {$routine['type']}\n"; - $retval .= "
\n"; - $retval .= " \n"; + $retval .= " \n"; + if ($is_ajax) { + $retval .= " \n"; + } else { + $retval .= " \n"; + $retval .= "
\n"; + $retval .= " {$routine['type']}\n"; + $retval .= "
\n"; + $retval .= " \n"; + } $retval .= " \n"; $retval .= "\n"; $retval .= "\n";