Ticket #4123: patch.diff
| File patch.diff, 4.1 kB (added by mbrevda, 2 years ago) |
|---|
-
amp_conf/htdocs/admin/components.class.php
old new 516 516 517 517 var $html_input; 518 518 519 function guiinput($elemname, $currentvalue = '', $prompttext = '', $helptext = '', $jsvalidation = '', $failvalidationmsg = '', $canbeempty = true ) {519 function guiinput($elemname, $currentvalue = '', $prompttext = '', $helptext = '', $jsvalidation = '', $failvalidationmsg = '', $canbeempty = true, $jsvalidationtest='') { 520 520 // call parent class contructor 521 521 guielement::guielement($elemname, '', ''); 522 522 … … 528 528 $this->helptext = $helptext; 529 529 // JavaScript validation field on the element 530 530 $this->jsvalidation = $jsvalidation; 531 // JavaScript validation test 532 $this->jsvalidationtest = $jsvalidationtest; 531 533 // Msg to use if above validation fails (forced to use gettext language stuff) 532 534 $this->failvalidationmsg = $failvalidationmsg; 533 535 // Can this field be empty ? … … 541 543 function generatevalidation() { 542 544 $output = ''; 543 545 544 if ($this->jsvalidation != '') { 545 $thefld = "theForm." . $this->_elemname; 546 $thefldvalue = $thefld . ".value"; 546 if ($this->jsvalidation != '' ) { 547 if(!$this->jsvalidationtest){ 548 $thefld = "theForm." . $this->_elemname; 549 $thefldvalue = $thefld . ".value"; 550 }else{ 551 $thefld="theForm." . $this->_elemname; 552 $thefldvalue =$this->jsvalidationtest; 553 } 547 554 548 555 if ($this->canbeempty) { 549 556 $output .= "\tdefaultEmptyOK = true;\n"; … … 719 726 } 720 727 } 721 728 729 class gui_drawselects extends guiinput { 730 function gui_drawselects($elemname, $index, $prompttext = '', $helptext = '', $canbeempty = true, $failvalidationmsg='') { 731 $parent_class = get_parent_class($this); 732 if(!$canbeempty){ 733 $jsvalidation ='()'; 734 $jsvalidationtest ='!$("input[name=goto'.$index.']:submit").val()'; 735 $failvalidationmsg = _('Please select a valid destination.'); 736 } 737 parent::$parent_class($elemname, '', $prompttext, $helptext, $jsvalidation, $failvalidationmsg, '', $jsvalidationtest); 738 739 $this->html_input=drawselects($currentvalue, $index, false, false); 740 } 741 } 742 722 743 /* 723 744 ************************************************************ 724 745 ** guitext is the base class of all text fields (e.g. h1) ** -
amp_conf/htdocs/admin/functions.inc.php
old new 1961 1961 } 1962 1962 } 1963 1963 1964 // $goto is the current goto destination setting 1965 // $i is the destination set number (used when drawing multiple destination sets in a single form ie: digital receptionist) 1966 // esnure that any form that includes this calls the setDestinations() javascript function on submit. 1967 // ie: if the form name is "edit", and drawselects has been called with $i=2 then use onsubmit="setDestinations(edit,2)" 1968 function drawselects($goto,$i,$show_custom=false) { 1964 /* 1965 * $goto is the current goto destination setting 1966 * $i is the destination set number (used when drawing multiple destination sets in a single form ie: digital receptionist) 1967 * esnure that any form that includes this calls the setDestinations() javascript function on submit. 1968 * ie: if the form name is "edit", and drawselects has been called with $i=2 then use onsubmit="setDestinations(edit,2)" 1969 * $table specifies if the destinations will be drawn in a new <tr> and <td> 1970 * 1971 */ 1972 function drawselects($goto,$i,$show_custom=false, $table=true) { 1969 1973 global $tabindex; 1970 1974 1971 1975 /* --- MODULES BEGIN --- */ … … 1973 1977 1974 1978 $all_destinations = array(); 1975 1979 $module_hash = array(); 1980 $selectHtml=''; 1981 if($table){ 1982 $selectHtml.='<tr><td colspan=2>'; 1983 } 1976 1984 1977 $selectHtml = '<tr><td colspan=2>';1978 1985 1979 1986 //check for module-specific destination functions 1980 1987 foreach ($active_modules as $rawmod => $module) { … … 2073 2080 2074 2081 //close off our row 2075 2082 } 2076 $selectHtml .= '</td></tr>'; 2083 if($table){ 2084 $selectHtml.='</td></tr>'; 2085 } 2077 2086 2078 2087 return $selectHtml; 2079 2088 }
