Changeset 6050
- Timestamp:
- 07/18/08 22:35:33 (1 month ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
freepbx/trunk/amp_conf/htdocs/admin/components.class.php
r6015 r6050 565 565 // Textbox 566 566 class gui_textbox extends guiinput { 567 function gui_textbox($elemname, $currentvalue = '', $prompttext = '', $helptext = '', $jsvalidation = '', $failvalidationmsg = '', $canbeempty = true, $maxchars = 0 ) {567 function gui_textbox($elemname, $currentvalue = '', $prompttext = '', $helptext = '', $jsvalidation = '', $failvalidationmsg = '', $canbeempty = true, $maxchars = 0, $disable=false) { 568 568 // call parent class contructor 569 569 $parent_class = get_parent_class($this); … … 572 572 $maxlength = ($maxchars > 0) ? " maxlength=\"$maxchars\"" : ''; 573 573 $tabindex = guielement::gettabindex(); 574 $this->html_input = "<input type=\"text\" name=\"$this->_elemname\" id=\"$this->_elemname\"$maxlength tabindex=$tabindex value=\"" . htmlentities($this->currentvalue) . "\">"; 574 $disable_state = $disable ? 'disabled="true"':''; 575 $this->html_input = "<input type=\"text\" name=\"$this->_elemname\" id=\"$this->_elemname\" $disable_state $maxlength tabindex=$tabindex value=\"" . htmlentities($this->currentvalue) . "\">"; 575 576 } 576 577 } … … 578 579 // Password 579 580 class gui_password extends guiinput { 580 function gui_password($elemname, $currentvalue = '', $prompttext = '', $helptext = '', $jsvalidation = '', $failvalidationmsg = '', $canbeempty = true, $maxchars = 0 ) {581 function gui_password($elemname, $currentvalue = '', $prompttext = '', $helptext = '', $jsvalidation = '', $failvalidationmsg = '', $canbeempty = true, $maxchars = 0, $disable=false) { 581 582 // call parent class contructor 582 583 $parent_class = get_parent_class($this); … … 585 586 $maxlength = ($maxchars > 0) ? " maxlength=\"$maxchars\"" : ''; 586 587 $tabindex = guielement::gettabindex(); 587 $this->html_input = "<input type=\"password\" name=\"$this->_elemname\" id=\"$this->_elemname\"$maxlength tabindex=$tabindex value=\"" . htmlentities($this->currentvalue) . "\">"; 588 $disable_state = $disable ? 'disabled="true"':''; 589 $this->html_input = "<input type=\"password\" name=\"$this->_elemname\" id=\"$this->_elemname\" $disable_state $maxlength tabindex=$tabindex value=\"" . htmlentities($this->currentvalue) . "\">"; 588 590 } 589 591 } … … 591 593 // Select box 592 594 class gui_selectbox extends guiinput { 593 function gui_selectbox($elemname, $valarray, $currentvalue = '', $prompttext = '', $helptext = '', $canbeempty = true, $onchange = '' ) {595 function gui_selectbox($elemname, $valarray, $currentvalue = '', $prompttext = '', $helptext = '', $canbeempty = true, $onchange = '', $disable=false) { 594 596 if (!is_array($valarray)) { 595 597 trigger_error('$valarray must be a valid array in gui_selectbox'); … … 602 604 parent::$parent_class($elemname, $currentvalue, $prompttext, $helptext); 603 605 604 $this->html_input = $this->buildselectbox($valarray, $currentvalue, $canbeempty, $onchange );606 $this->html_input = $this->buildselectbox($valarray, $currentvalue, $canbeempty, $onchange, $disable); 605 607 } 606 608 607 609 // Build select box 608 function buildselectbox($valarray, $currentvalue, $canbeempty, $onchange ) {610 function buildselectbox($valarray, $currentvalue, $canbeempty, $onchange, $disable) { 609 611 $output = ''; 610 612 $onchange = ($onchange != '') ? " onchange=\"$onchange\"" : ''; 611 613 612 614 $tabindex = guielement::gettabindex(); 613 $output .= "\n\t\t\t<select name=\"$this->_elemname\" id=\"$this->_elemname\" tabindex=$tabindex $onchange >\n"; 615 $disable_state = $disable ? 'disabled="true"':''; 616 $output .= "\n\t\t\t<select name=\"$this->_elemname\" id=\"$this->_elemname\" tabindex=$tabindex $disable_state $onchange >\n"; 614 617 // include blank option if required 615 618 if ($canbeempty) … … 631 634 632 635 class gui_radio extends guiinput { 633 function gui_radio($elemname, $valarray, $currentvalue = '', $prompttext = '', $helptext = '' ) {636 function gui_radio($elemname, $valarray, $currentvalue = '', $prompttext = '', $helptext = '', $disable=false) { 634 637 if (!is_array($valarray)) { 635 638 trigger_error('$valarray must be a valid array in gui_radio'); … … 640 643 parent::$parent_class($elemname, $currentvalue, $prompttext, $helptext); 641 644 642 $this->html_input = $this->buildradiobuttons($valarray, $currentvalue );643 } 644 645 function buildradiobuttons($valarray, $currentvalue ) {645 $this->html_input = $this->buildradiobuttons($valarray, $currentvalue, $disable); 646 } 647 648 function buildradiobuttons($valarray, $currentvalue, $disable=false) { 646 649 $output = ''; 647 650 … … 653 656 654 657 $tabindex = guielement::gettabindex(); 655 $output .= "<input type=\"radio\" name=\"$this->_elemname\" id=\"$this->_elemname$count\" tabindex=$tabindex value=\"$this->_elemname=$itemvalue\"$itemchecked/>$itemtext \n"; 658 $disable_state = $disable ? 'disabled="true"':''; 659 $output .= "<input type=\"radio\" name=\"$this->_elemname\" id=\"$this->_elemname$count\" $disable_state tabindex=$tabindex value=\"$this->_elemname=$itemvalue\"$itemchecked/>$itemtext \n"; 656 660 $count++; 657 661 }
