Changeset 9127
- Timestamp:
- 03/11/10 05:39:36 (2 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
freepbx/trunk/amp_conf/htdocs/admin/components.class.php
r8599 r9127 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, '', ''); … … 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; … … 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) { … … 705 712 } 706 713 714 class gui_drawselects extends guiinput { 715 function gui_drawselects($elemname, $index, $prompttext = '', $helptext = '', $canbeempty = true, $failvalidationmsg='') { 716 $parent_class = get_parent_class($this); 717 if(!$canbeempty){ 718 $jsvalidation ='()'; 719 $jsvalidationtest ='!$("input[name=goto'.$index.']:submit").val()'; 720 $failvalidationmsg = _('Please select a valid destination.'); 721 } 722 parent::$parent_class($elemname, '', $prompttext, $helptext, $jsvalidation, $failvalidationmsg, '', $jsvalidationtest); 723 724 $this->html_input=drawselects($currentvalue, $index, false, false); 725 } 726 } 727 707 728 /* 708 729 ************************************************************ freepbx/trunk/amp_conf/htdocs/admin/functions.inc.php
r9069 r9127 1955 1955 } 1956 1956 1957 // $goto is the current goto destination setting 1958 // $i is the destination set number (used when drawing multiple destination sets in a single form ie: digital receptionist) 1959 // esnure that any form that includes this calls the setDestinations() javascript function on submit. 1960 // ie: if the form name is "edit", and drawselects has been called with $i=2 then use onsubmit="setDestinations(edit,2)" 1961 function drawselects($goto,$i,$show_custom=false) { 1957 /* 1958 * $goto is the current goto destination setting 1959 * $i is the destination set number (used when drawing multiple destination sets in a single form ie: digital receptionist) 1960 * esnure that any form that includes this calls the setDestinations() javascript function on submit. 1961 * ie: if the form name is "edit", and drawselects has been called with $i=2 then use onsubmit="setDestinations(edit,2)" 1962 * $table specifies if the destinations will be drawn in a new <tr> and <td> 1963 * 1964 */ 1965 function drawselects($goto,$i,$show_custom=false, $table=true) { 1962 1966 global $tabindex; 1963 1967 … … 1967 1971 $all_destinations = array(); 1968 1972 $module_hash = array(); 1969 1970 $selectHtml = '<tr><td colspan=2>'; 1973 $selectHtml=''; 1974 if($table){ 1975 $selectHtml.='<tr><td colspan=2>'; 1976 } 1977 1971 1978 1972 1979 //check for module-specific destination functions … … 2067 2074 //close off our row 2068 2075 } 2069 $selectHtml .= '</td></tr>'; 2076 if($table){ 2077 $selectHtml.='</td></tr>'; 2078 } 2070 2079 2071 2080 return $selectHtml;
