HomeHelpTrac

Changeset 15546 for trunk/templates


Ignore:
Timestamp:
10/06/11 02:16:37 (8 months ago)
Author:
Alexander Trofimov
Message:

Forms design and fixes

Location:
trunk/templates/base
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/templates/base/css/forms.css

    r15484 r15546  
    11 
     2.bx-form-advanced-wrapper > .bx-form-section-header:first-child { 
     3    margin-top:0; 
     4} 
     5 
     6.bx-form-advanced-wrapper > .bx-form-section:first-child { 
     7    border-top:none; 
     8    padding-top:0; 
     9} 
    210 
    311.bx-form-section-header { 
    4     font-size:16px; 
    5     font-weight:bold; 
     12    position:relative; 
    613    text-transform:uppercase; 
     14} 
     15 
     16.bx-form-section { 
     17    border-width:2px; 
    718} 
    819 
     
    1223 
    1324.bx-form-caption { 
    14     font-size:16px; 
    1525    font-weight:bold; 
    1626    margin-bottom:5px; 
     
    2737 
    2838.bx-form-info { 
    29     font-style:italic; 
     39 
    3040} 
    3141 
    3242/* form inputs */ 
    3343 
     44.bx-form-input-wrapper-doublerange, 
     45.bx-form-input-select_multiple, 
     46.bx-form-input-select, 
     47.bx-form-input-radio_set, 
     48.bx-form-input-checkbox_set, 
    3449.bx-form-input-email, 
    3550.bx-form-input-number, 
     
    86101} 
    87102 
     103.bx-form-input-select_multiple, 
     104.bx-form-input-radio_set, 
     105.bx-form-input-checkbox_set { 
     106    height:auto; 
     107} 
     108 
    88109.bx-form-input-textarea { 
    89110    padding:8px; 
     
    94115 
    95116.bx-form-input-datepicker { 
    96     width:80px; 
     117    width:110px; 
    97118} 
    98119 
     
    117138} 
    118139 
     140/* section toggler */ 
     141 
     142.bx-form-section-toggle { 
     143    position:absolute; 
     144    top:10px; 
     145    right:0; 
     146} 
     147 
     148.bx-form-section-toggle .bx-btn u { 
     149    background-image:url(../images/icons/toggle_down.png); 
     150 
     151    -moz-transform: rotate(-180deg); 
     152    -webkit-transform: rotate(-180deg); 
     153    -ms-transform: rotate(-180deg); 
     154    -o-transform: rotate(-180deg); 
     155 
     156    -webkit-transition: all 0.5s ease; 
     157    -moz-transition: all 0.5s ease; 
     158    -ms-transition: all 0.5s ease; 
     159    -o-transition: all 0.5s ease; 
     160} 
     161 
     162.bx-form-section-toggle .bx-btn u.collapsed { 
     163 
     164    -moz-transform: rotate(0deg); 
     165    -webkit-transform: rotate(0deg); 
     166    -ms-transform: rotate(0deg); 
     167    -o-transform: rotate(0deg); 
     168} 
  • trunk/templates/base/scripts/BxBaseFormView.php

    r15533 r15546  
    1111class BxBaseFormView extends BxDolForm { 
    1212 
     13    protected static $_isToggleJsAdded = false; 
     14 
     15    protected static $_isCssJsAdded = false; 
     16 
    1317    var $bEnableErrorIcon = true; 
    1418 
     
    4246     */ 
    4347    var $_bHtmlEditorAdded = false; 
     48 
     49    /** 
     50     * Default divider for several inputs 
     51     * @var string 
     52     */ 
     53    var $_sDivider = '<span class="bx-def-margin-left"></span>'; 
     54 
     55    /** 
     56     * Alternative divider for several inputs 
     57     * @var string 
     58     */ 
     59    var $_sDividerAlt = '<br />'; 
    4460 
    4561    /** 
     
    130146                ) 
    131147            ); 
     148        }         
     149 
     150        // check if we need to generate open section clause 
     151        $sOpenSection = ''; 
     152        foreach ($this->aInputs as $aInput) { 
     153            if (isset($aInput['type']) && 'hidden' == $aInput['type']) 
     154                continue; 
     155            if (isset($aInput['type']) && 'block_header' != $aInput['type']) 
     156                $sOpenSection = $this->getOpenSection(); 
     157            break; 
    132158        } 
    133159 
     
    136162        foreach ($this->aInputs as $aInput) 
    137163            $sCont .= $this->genRow($aInput); 
    138  
    139         $sOpenSection  = $this->getOpenSection(); 
     164         
    140165        $sCloseSection = $this->getCloseSection(); 
    141166 
     
    150175     */ 
    151176    function genRow(&$aInput) { 
     177 
     178        if (!isset($aInput['type'])) 
     179            $aInput['type'] = false; 
    152180 
    153181        switch ($aInput['type']) { 
     
    215243        } 
    216244 
    217         $sInput     = $this->genInput($aInput); 
     245        $sInput = $this->genInput($aInput); 
     246 
     247        $sCaptionCode = ''; 
     248        if ($sCaption) 
     249            $sCaptionCode = '<div class="bx-form-caption">' . $sCaption . $sRequired . '</div>'; 
     250        else 
     251            $sInput .= $sRequired; // TODO: maybe some other way to show required item 
     252 
    218253        $sInputCode = $this->genWrapperInput($aInput, $sInput); 
    219254 
     
    227262        $sCode = <<<BLAH 
    228263                <div $sTrAttrs> 
    229                     <div class="bx-form-caption"> 
    230                         $sCaption 
    231                         $sRequired 
    232                     </div> 
    233  
     264                    $sCaptionCode 
    234265                    <div class="bx-form-value$sClassAdd"> 
    235266                        <div class="bx-clear"></div> 
     
    284315        $sTrAttrs = $this->convertArray2Attrs(empty($aInput['tr_attrs']) ? array() : $aInput['tr_attrs']); 
    285316 
     317        $sCaptionCode = ''; 
     318        if ($sCaption) 
     319            $sCaptionCode = '<div class="bx-form-caption">' . $sCaption . $sRequired . '</div>'; 
     320 
    286321        $sCode = <<<BLAH 
    287322                <div $sTrAttrs> 
    288                     <div class="bx-form-caption"> 
    289                         $sCaption 
    290                         $sRequired 
    291                     </div> 
    292  
     323                    $sCaptionCode 
    293324                    <div class="bx-form-value$sClassAdd"> 
    294325                        <div class="bx-clear"></div> 
     
    312343        $aAttrs = empty($aInput['attrs']) ? '' : $aInput['attrs']; 
    313344        $aNextTbodyAdd = false; // need to have some default 
     345 
     346        if (!$aInput['caption']) { 
     347            $sCode = $this->getCloseSection(); 
     348            $aAttrs['class'] = "bx-form-section-divider bx-def-margin-top " . (isset($aAttrs['class']) ? ' ' . $aAttrs['class'] : ''); 
     349            $sAttrs = $this->convertArray2Attrs($aAttrs); 
     350            $sCode .=  "<div $sAttrs></div>"; 
     351            $sCode .= $this->getOpenSection(false); 
     352            return $sCode; 
     353        } 
    314354 
    315355        if (isset($aInput['collapsable']) and $aInput['collapsable']) { 
     
    327367        } 
    328368 
    329         $aAttrs['class'] = "bx-form-section-header bx-def-margin-sec" . 
     369        $aAttrs['class'] = "bx-form-section-header bx-def-margin-top bx-def-padding-sec-top bx-def-padding-sec-bottom bx-def-font-grayed bx-def-font-h3" . 
    330370            (isset($aAttrs['class']) ? ' ' . $aAttrs['class'] : '') . 
    331371            (isset($sClassAdd) ? ' ' . $sClassAdd  : ''); 
     
    336376 
    337377        $sCode .= $this->getCloseSection(); 
    338  
    339         $sCode .=  "<div $sAttrs>" . bx_process_output($aInput['caption']) . " <a href=\"javascript:void(0)\" onclick=\"javascript:$(this).parent().next().toggle()\">Toggle</a></div>\n"; 
     378         
     379        $sCode .=  "<div $sAttrs>" . bx_process_output($aInput['caption']); 
     380        if (isset($aInput['collapsable']) and $aInput['collapsable']) 
     381            $sCode .=  $this->genToggleElement($aInput); 
     382        $sCode .=  "</div>\n"; 
    340383 
    341384        $sCode .= $this->getOpenSection($aNextTbodyAdd); 
     
    358401     * @return string Output HTML Code 
    359402     */ 
    360     function genInput(&$aInput) { 
    361  
    362         $sDivider = isset($aInput['dv']) ? $aInput['dv'] : ' '; 
     403    function genInput(&$aInput) {         
    363404 
    364405        switch ($aInput['type']) { 
     
    411452            case 'input_set': // numeric array of inputs 
    412453                $sInput = ''; 
    413  
     454                $sDivider = isset($aInput['dv']) ? $aInput['dv'] : ' '; 
    414455                foreach ($aInput as $iKey => $aSubInput) { 
    415456                    if (!is_int($iKey) or !$aSubInput) 
     
    529570        $aAttrs['type'] = $aInput['type']; 
    530571        if (isset($aInput['name'])) $aAttrs['name'] = $aInput['name']; 
    531         if (isset($aInput['value'])) $aAttrs['value'] = $aInput['value']; 
    532572 
    533573        $sAttrs = $this->convertArray2Attrs($aAttrs); 
     
    605645 
    606646    /** 
     647     * Generate Select Box Element 
     648     * 
     649     * @param array $aInput 
     650     * @return string 
     651     */ 
     652    function genInputSelectBox(&$aInput, $sInfo = '', $sError = '') { 
     653 
     654        $aNewInput = $aInput; 
     655 
     656        $aNewInput['type'] = 'select'; 
     657        $aNewInput['name'] .= '[]'; 
     658 
     659        $sInput = $this->genInput($aNewInput); 
     660        return <<<BLAH 
     661                <div class="bx-form-input-wrapper input-wrapper-{$aInput['type']}"> 
     662                   $sInput 
     663                </div> 
     664                $sInfo 
     665                $sError 
     666BLAH; 
     667 
     668    } 
     669 
     670    /** 
     671     * Generate Select Box Element 
     672     * 
     673     * @param array $aInput 
     674     * @return string 
     675     */ 
     676    function genInputFiles(&$aInput, $sInfo = '', $sError = '') { 
     677 
     678        $sUniqId = genRndPwd (8, false); 
     679        $sUploaders = ''; 
     680        $oUploader = null; 
     681        foreach ($aInput['uploaders'] as $sUploaderObject) { 
     682            bx_import('BxDolUploader'); 
     683            $oUploader = BxDolUploader::getObjectInstance($sUploaderObject, $aInput['storage_object'], $sUniqId); 
     684            if (!$oUploader) 
     685                continue; 
     686 
     687            $sGhostTemplate = false; 
     688            if (isset($aInput['ghost_template']) && is_object($aInput['ghost_template'])) { // form is not submitted and ghost template is BxDolFormNested object 
     689 
     690                $oFormNested = $aInput['ghost_template']; 
     691                if ($oFormNested instanceof BxDolFormNested) 
     692                    $sGhostTemplate = $oFormNested->getCode(); 
     693 
     694            } elseif (isset($aInput['ghost_template']) && is_array($aInput['ghost_template']) && isset($aInput['ghost_template']['inputs'])) { // form is not submitted and ghost template is form array 
     695 
     696                bx_import('BxDolFormNested'); 
     697                $oFormNested = new BxDolFormNested($aInput['name'], $aInput['ghost_template'], $this->aParams['db']['submit_name'], $this->oTemplate); 
     698                $sGhostTemplate = $oFormNested->getCode(); 
     699 
     700            } elseif (isset($aInput['ghost_template']) && is_array($aInput['ghost_template']) && $aInput['ghost_template']) { // form is submitted and ghost template is array of BxDolFormNested objects 
     701 
     702                bx_import('BxDolFormNested'); 
     703                $sGhostTemplate = array (); 
     704                foreach ($aInput['ghost_template'] as $iFileId => $oFormNested) 
     705                    if (is_object($oFormNested) && $oFormNested instanceof BxDolFormNested) 
     706                        $sGhostTemplate[$iFileId] = $oFormNested->getCode(); 
     707 
     708            } elseif (isset($aInput['ghost_template']) && is_string($aInput['ghost_template'])) { // ghost template is just string template, without nested form 
     709 
     710                $sGhostTemplate = $aInput['ghost_template']; 
     711 
     712            } 
     713            $aParams = array(); 
     714            if (isset($aInput['images_transcoder']) && $aInput['images_transcoder']) 
     715                $aParams = array('images_transcoder' => bx_js_string($aInput['images_transcoder'])); 
     716            $sUploaders .= $oUploader->getUploaderButton($sGhostTemplate, isset($aInput['multiple']) ? $aInput['multiple'] : true, $aParams); 
     717        }                 
     718 
     719        return $this->oTemplate->parseHtmlByName('form_field_uploader.html', array( 
     720            'uploaders_buttons' => $sUploaders, 
     721            'info' => $sInfo, 
     722            'id_container_errors' => $oUploader->getIdContainerErrors(), 
     723            'id_container_result' => $oUploader->getIdContainerResult(), 
     724            'uploader_instance_name' => $oUploader->getNameJsInstanceUploader(), 
     725            'is_init_ghosts' => isset($aInput['init_ghosts']) && !$aInput['init_ghosts'] ? 0 : 1, 
     726        )); 
     727    } 
     728 
     729    /** 
    607730     * Generate Select Element 
    608731     * 
     
    611734     */ 
    612735    function genInputSelect(&$aInput) { 
     736        $sCurValue = isset($aInput['value']) ? $aInput['value'] : ''; 
     737        return $this->_genInputSelect(&$aInput, false, $sCurValue, '_isSelected'); 
     738    } 
     739 
     740    /** 
     741     * Generate Multiple Select Element 
     742     * 
     743     * @param array $aInput 
     744     * @return string 
     745     */ 
     746    function genInputSelectMultiple(&$aInput) { 
     747        $aCurValues = array(); 
     748        if (isset($aInput['value']) && $aInput['value']) 
     749            $aCurValues = is_array($aInput['value']) ? $aInput['value'] : array($aInput['value']); 
     750        return $this->_genInputSelect(&$aInput, true, $aCurValues, '_isSelectedMultiple'); 
     751    } 
     752 
     753    /** 
     754     * Generate Checkbox Set Element 
     755     * 
     756     * @param array $aInput 
     757     * @return string 
     758     */ 
     759    function genInputCheckboxSet(&$aInput) { 
     760        $aCurValues = array(); 
     761        if (isset($aInput['value']) && $aInput['value']) 
     762            $aCurValues = is_array($aInput['value']) ? $aInput['value'] : array($aInput['value']); 
     763        return $this->_genInputsSet($aInput, 'checkbox', $aCurValues, '_isSelectedMultiple', '[]'); 
     764    } 
     765    /** 
     766     * Generate Radiobuttons Set Element 
     767     * 
     768     * @param array $aInput 
     769     * @return string 
     770     */ 
     771    function genInputRadioSet(&$aInput) { 
     772        $sCurValue = isset($aInput['value']) ? $aInput['value'] : ''; 
     773        return $this->_genInputsSet($aInput, 'radio', $sCurValue, '_isSelected'); 
     774    } 
     775 
     776    function _isSelected ($sValue, $sCurValue) { 
     777        return ((string)$sValue === (string)$sCurValue); 
     778    } 
     779 
     780    function _isSelectedMultiple ($sValue, $aCurValues) { 
     781        return in_array($sValue, $aCurValues); 
     782    } 
     783 
     784    function _genInputSelect(&$aInput, $isMultiple, $mixedCurrentVal, $sIsSelectedFunc) { 
    613785 
    614786        $aAttrs = empty($aInput['attrs']) ? array() : $aInput['attrs']; 
     
    618790 
    619791        $aAttrs['name'] = $aInput['name']; 
     792        if ($isMultiple) { 
     793            $aAttrs['name'] .= '[]'; 
     794            $aAttrs['multiple'] = 'multiple'; 
     795        } 
    620796 
    621797        // for inputs with labels generate id 
     
    626802 
    627803        // generate options 
    628         $sCurValue = $aInput['value']; 
    629804        $sOptions = ''; 
    630  
    631  
    632805        if (isset($aInput['values']) and is_array($aInput['values'])) { 
    633806            foreach ($aInput['values'] as $sValue => $sTitle) { 
     
    639812                $sTitleC = bx_process_output($sTitle); 
    640813 
    641                 $sSelected = ((string)$sValue === (string)$sCurValue) ? 'selected="selected"' : ''; 
     814                $sSelected = $this->$sIsSelectedFunc($sValue, $mixedCurrentVal) ? 'selected="selected"' : ''; 
    642815 
    643816                $sOptions .= <<<BLAH 
     
    658831    } 
    659832 
    660     /** 
    661      * Generate Select Box Element 
    662      * 
    663      * @param array $aInput 
    664      * @return string 
    665      */ 
    666     function genInputSelectBox(&$aInput, $sInfo = '', $sError = '') { 
    667  
    668         $aNewInput = $aInput; 
    669  
    670         $aNewInput['type'] = 'select'; 
    671         $aNewInput['name'] .= '[]'; 
    672  
    673         $sInput = $this->genInput($aNewInput); 
    674         return <<<BLAH 
    675                 <div class="bx-form-input-wrapper input-wrapper-{$aInput['type']}"> 
    676                    $sInput 
    677                 </div> 
    678                 $sInfo 
    679                 $sError 
    680 BLAH; 
    681  
    682     } 
    683  
    684     /** 
    685      * Generate Select Box Element 
    686      * 
    687      * @param array $aInput 
    688      * @return string 
    689      */ 
    690     function genInputFiles(&$aInput, $sInfo = '', $sError = '') { 
    691  
    692         $sUniqId = genRndPwd (8, false); 
    693         $sUploaders = ''; 
    694         $oUploader = null; 
    695         foreach ($aInput['uploaders'] as $sUploaderObject) { 
    696             bx_import('BxDolUploader'); 
    697             $oUploader = BxDolUploader::getObjectInstance($sUploaderObject, $aInput['storage_object'], $sUniqId); 
    698             if (!$oUploader) 
    699                 continue; 
    700  
    701             $sGhostTemplate = false; 
    702             if (isset($aInput['ghost_template']) && is_object($aInput['ghost_template'])) { // form is not submitted and ghost template is BxDolFormNested object 
    703  
    704                 $oFormNested = $aInput['ghost_template']; 
    705                 if ($oFormNested instanceof BxDolFormNested) 
    706                     $sGhostTemplate = $oFormNested->getCode(); 
    707  
    708             } elseif (isset($aInput['ghost_template']) && is_array($aInput['ghost_template']) && isset($aInput['ghost_template']['inputs'])) { // form is not submitted and ghost template is form array 
    709  
    710                 bx_import('BxDolFormNested'); 
    711                 $oFormNested = new BxDolFormNested($aInput['name'], $aInput['ghost_template'], $this->aParams['db']['submit_name'], $this->oTemplate); 
    712                 $sGhostTemplate = $oFormNested->getCode(); 
    713  
    714             } elseif (isset($aInput['ghost_template']) && is_array($aInput['ghost_template']) && $aInput['ghost_template']) { // form is submitted and ghost template is array of BxDolFormNested objects 
    715  
    716                 bx_import('BxDolFormNested'); 
    717                 $sGhostTemplate = array (); 
    718                 foreach ($aInput['ghost_template'] as $iFileId => $oFormNested) 
    719                     if (is_object($oFormNested) && $oFormNested instanceof BxDolFormNested) 
    720                         $sGhostTemplate[$iFileId] = $oFormNested->getCode(); 
    721  
    722             } elseif (isset($aInput['ghost_template']) && is_string($aInput['ghost_template'])) { // ghost template is just string template, without nested form 
    723  
    724                 $sGhostTemplate = $aInput['ghost_template']; 
    725  
    726             } 
    727             $aParams = array(); 
    728             if (isset($aInput['images_transcoder']) && $aInput['images_transcoder']) 
    729                 $aParams = array('images_transcoder' => bx_js_string($aInput['images_transcoder'])); 
    730             $sUploaders .= $oUploader->getUploaderButton($sGhostTemplate, isset($aInput['multiple']) ? $aInput['multiple'] : true, $aParams); 
    731         }                 
    732  
    733         return $this->oTemplate->parseHtmlByName('form_field_uploader.html', array( 
    734             'uploaders_buttons' => $sUploaders, 
    735             'info' => $sInfo, 
    736             'id_container_errors' => $oUploader->getIdContainerErrors(), 
    737             'id_container_result' => $oUploader->getIdContainerResult(), 
    738             'uploader_instance_name' => $oUploader->getNameJsInstanceUploader(), 
    739             'is_init_ghosts' => isset($aInput['init_ghosts']) && !$aInput['init_ghosts'] ? 0 : 1, 
    740         )); 
    741     } 
    742  
    743     /** 
    744      * Generate Multiple Select Element 
    745      * 
    746      * @param array $aInput 
    747      * @return string 
    748      */ 
    749     function genInputSelectMultiple(&$aInput) { 
    750         $aAttrs = $aInput['attrs']; 
     833    function _genInputsSet(&$aInput, $sType, $mixedCurrentVal, $sIsCheckedFunc, $sNameAppend = '') { 
     834        $aAttrs = empty($aInput['attrs']) ? array() : $aInput['attrs']; 
    751835 
    752836        // add default className to attributes 
    753837        $aAttrs['class'] = "bx-form-input-{$aInput['type']}" . (isset($aAttrs['class']) ? (' ' . $aAttrs['class']) : ''); 
    754838 
    755         $aAttrs['name']     = $aInput['name'] . '[]'; 
    756         $aAttrs['multiple'] = 'multiple'; 
     839        $aAttrs['name']  = $aInput['name']; 
    757840 
    758841        // for inputs with labels generate id 
     
    763846 
    764847        // generate options 
    765         $aCurValues = $aInput['value'] ? (is_array($aInput['value']) ? $aInput['value'] : array($aInput['value'])) : array(); 
     848        $sDivider = isset($aInput['dv']) ? $aInput['dv'] : $this->_sDivider; 
     849 
    766850        $sOptions = ''; 
    767851 
    768852        if (isset($aInput['values']) and is_array($aInput['values'])) { 
    769             foreach ($aInput['values'] as $sValue => $sTitle) { 
    770                 $sValueC = bx_html_attribute($sValue); 
    771                 $sTitleC = bx_process_output($sTitle); 
    772  
    773                 $sSelected = in_array($sValue, $aCurValues) ? 'selected="selected"' : ''; 
    774  
    775                 $sOptions .= <<<BLAH 
    776                    <option value="$sValueC" $sSelected>$sTitleC</option> 
    777 BLAH; 
    778  
    779             } 
    780         } 
    781  
    782         // generate element 
    783         $sCode = <<<BLAH 
    784             <select $sAttrs> 
    785                 $sOptions 
    786             </select> 
    787 BLAH; 
    788  
    789         return $sCode; 
    790     } 
    791  
    792     /** 
    793      * Generate Checkbox Set Element 
    794      * 
    795      * @param array $aInput 
    796      * @return string 
    797      */ 
    798     function genInputCheckboxSet(&$aInput) { 
    799         $aAttrs = empty($aInput['attrs']) ? array() : $aInput['attrs']; 
    800  
    801         // add default className to attributes 
    802         $aAttrs['class'] = "bx-form-input-{$aInput['type']}" . (isset($aAttrs['class']) ? (' ' . $aAttrs['class']) : ''); 
    803  
    804         $aAttrs['name']  = $aInput['name']; 
    805  
    806         // for inputs with labels generate id 
    807         if (isset($aInput['label'])) 
    808             $aAttrs['id'] = $this->getInputId($aInput); 
    809  
    810         $sAttrs = $this->convertArray2Attrs($aAttrs); 
    811  
    812         // generate options 
    813         $sDivider = isset($aInput['dv']) ? $aInput['dv'] : ' '; 
    814         $aCurValues = $aInput['value'] ? (is_array($aInput['value']) ? $aInput['value'] : array($aInput['value'])) : array(); 
    815  
    816         $sOptions = ''; 
    817  
    818         if (isset($aInput['values']) and is_array($aInput['values'])) { 
    819             if (count($aInput['values']) > 3 && $sDivider == ' ') 
    820                 $sDivider = '<br />'; 
     853            if (count($aInput['values']) > 3 && $sDivider == $this->_sDivider) 
     854                $sDivider = $this->_sDividerAlt; 
    821855            // generate complex input using simple standard inputs 
    822856            foreach ($aInput['values'] as $sValue => $sLabel) { 
    823857                // create new simple input 
    824858                $aNewInput = array( 
    825                     'type' => 'checkbox', 
    826                     'name' => $aInput['name'] . '[]', 
    827                     'value' => $sValue, 
    828                     'checked' => in_array($sValue, $aCurValues), 
    829                     'label' => $sLabel, 
     859                    'type'    => $sType, 
     860                    'name'    => $aInput['name'] . $sNameAppend, 
     861                    'value'   => $sValue, 
     862                    'checked' => $this->$sIsCheckedFunc($sValue, $mixedCurrentVal), 
     863                    'label'   => $sLabel, 
    830864                ); 
    831865 
     
    846880        return $sCode; 
    847881    } 
    848     /** 
    849      * Generate Radiobuttons Set Element 
    850      * 
    851      * @param array $aInput 
    852      * @return string 
    853      */ 
    854     function genInputRadioSet(&$aInput) { 
     882 
     883    function genInputCaptcha(&$aInput) { 
     884 
    855885        $aAttrs = empty($aInput['attrs']) ? array() : $aInput['attrs']; 
    856886 
     
    858888        $aAttrs['class'] = "bx-form-input-{$aInput['type']}" . (isset($aAttrs['class']) ? (' ' . $aAttrs['class']) : ''); 
    859889 
    860         $aAttrs['name']  = $aInput['name']; 
     890        //$aAttrs['name']  = $aInput['name']; 
    861891 
    862892        // for inputs with labels generate id 
     
    866896        $sAttrs = $this->convertArray2Attrs($aAttrs); 
    867897 
    868         // generate options 
    869         $sDivider = isset($aInput['dv']) ? $aInput['dv'] : ' '; 
    870         $sCurValue = $aInput['value']; 
    871  
    872         $sOptions = ''; 
    873  
    874         if (isset($aInput['values']) and is_array($aInput['values'])) { 
    875             if (count($aInput['values']) > 3 && $sDivider == ' ') 
    876                 $sDivider = '<br />'; 
    877             // generate complex input using simple standard inputs 
    878             foreach ($aInput['values'] as $sValue => $sLabel) { 
    879                 // create new simple input 
    880                 $aNewInput = array( 
    881                     'type'    => 'radio', 
    882                     'name'    => $aInput['name'], 
    883                     'value'   => $sValue, 
    884                     'checked' => ((string)$sValue === (string)$sCurValue), 
    885                     'label'   => $sLabel, 
    886                 ); 
    887  
    888                 $sNewInput  = $this->genInput($aNewInput); 
    889  
    890                 // attach new input to complex 
    891                 $sOptions .= ($sNewInput . $sDivider); 
    892             } 
    893         } 
    894  
    895         // generate element 
    896         $sCode = <<<BLAH 
    897             <div $sAttrs> 
    898                 $sOptions 
    899             </div> 
    900 BLAH; 
    901  
    902         return $sCode; 
    903     } 
    904  
    905     function genInputCaptcha(&$aInput) { 
    906  
    907         $aAttrs = empty($aInput['attrs']) ? array() : $aInput['attrs']; 
    908  
    909         // add default className to attributes 
    910         $aAttrs['class'] = "bx-form-input-{$aInput['type']}" . (isset($aAttrs['class']) ? (' ' . $aAttrs['class']) : ''); 
    911  
    912         //$aAttrs['name']  = $aInput['name']; 
    913  
    914         // for inputs with labels generate id 
    915         if (isset($aInput['label'])) 
    916             $aAttrs['id'] = $this->getInputId($aInput); 
    917  
    918         $sAttrs = $this->convertArray2Attrs($aAttrs); 
    919  
    920898        $sSimgUrl = BX_DOL_URL_ROOT . 'simg/simg.php'; 
    921         $sDivider = isset($aInput['dv']) ? $aInput['dv'] : '<br />'; 
     899        $sDivider = isset($aInput['dv']) ? $aInput['dv'] : $this->_sDividerAlt; 
    922900 
    923901        $aTextInput = array( 
     
    961939     * Convert array to attributes string 
    962940     * 
    963      * <code> 
     941     * @code 
    964942     * $a = array('name' => 'test', 'value' => 5); 
    965943     * $s = $this->convertArray2Attrs($a); 
    966944     * echo $s; 
    967      * </code> 
     945     * @endcode 
    968946     * 
    969947     * Output: 
     
    991969    } 
    992970 
     971    function genToggleElement($aInput) { 
     972 
     973        $sJs = ''; 
     974        if (!self::$_isToggleJsAdded) { 
     975            $sJs = "\n<script> 
     976                function bx_form_section_toggle(e) { 
     977                    var eSection = $(e).parent().parent().next();                 
     978                    if ('none' == eSection.css('display')) { 
     979                        $(e).find('u').removeClass('collapsed'); 
     980                        eSection.slideDown(); 
     981                    } else { 
     982                        $(e).find('u').addClass('collapsed'); 
     983                        eSection.slideUp(); 
     984                    } 
     985                } 
     986            </script>\n"; 
     987            self::$_isToggleJsAdded = true; 
     988        } 
     989 
     990        $sClass = ''; 
     991        if (isset($aInput['collapsed']) and $aInput['collapsed']) 
     992            $sClass = 'collapsed'; 
     993 
     994        return $sJs . '<div class="bx-form-section-toggle"><a class="bx-btn bx-btn-small bx-btn-symbol-small" href="javascript:void(0)" onclick="bx_form_section_toggle(this)"><u class="' . $sClass . '"></u></a></div>'; 
     995    } 
     996 
    993997    function genInfoIcon($sInfo) { 
    994         return '<div class="bx-form-info">' . bx_process_output($sInfo) . '</div>'; 
     998        return '<div class="bx-form-info bx-def-font-grayed bx-def-font-small">' . bx_process_output($sInfo) . '</div>'; 
    995999    } 
    9961000 
     
    10091013 
    10101014            if ($aAttrs and is_array($aAttrs)) { 
    1011                 $aAttrs['class'] = "bx-form-section bx-def-padding bx-def-color-bg-sec" . (isset($aAttrs['class']) ? (' ' . $aAttrs['class']) : ''); 
     1015                $aAttrs['class'] = "bx-form-section bx-def-padding-top bx-def-border-top" . (isset($aAttrs['class']) ? (' ' . $aAttrs['class']) : ''); 
    10121016                $sAttrs = $this->convertArray2Attrs($aAttrs); 
    10131017            } else { 
    1014                 $sAttrs = ' class="bx-form-section bx-def-padding bx-def-color-bg-sec" '; 
     1018                $sAttrs = ' class="bx-form-section bx-def-padding-top bx-def-border-top" '; 
    10151019            } 
    10161020 
     
    10401044    function addCssJs () { 
    10411045 
    1042         if (isset($GLOBALS['glBxFormIsCssJsAdded']) && $GLOBALS['glBxFormIsCssJsAdded']) 
     1046        if (self::$_isCssJsAdded) 
    10431047            return; 
    10441048 
     
    10741078        $this->oTemplate->addCss($aCss); 
    10751079 
    1076         $GLOBALS['glBxFormIsCssJsAdded'] = true; 
     1080        self::$_isCssJsAdded = true; 
    10771081    } 
    10781082} 
  • trunk/templates/base/uploader_button_html5.html

    r15516 r15546  
    1     <a href="javascript:void(0);" onclick="__uploader_instance_name__.showUploaderForm();" class="bx-btn bx-def-margin-sec-left"><bx_text:_sys_uploader_html5_button_name /></a> 
     1    <a href="javascript:void(0);" onclick="__uploader_instance_name__.showUploaderForm();" class="bx-btn bx-btn-small bx-def-margin-sec-left"><bx_text:_sys_uploader_html5_button_name /></a> 
    22    <script> 
    33        $(document).ready(function(){ 
  • trunk/templates/base/uploader_button_simple.html

    r15516 r15546  
    1     <a href="javascript:void(0);" onclick="__uploader_instance_name__.showUploaderForm();" class="bx-btn bx-def-margin-sec-left"><bx_text:_sys_uploader_simple_button_name /></a> 
     1    <a href="javascript:void(0);" onclick="__uploader_instance_name__.showUploaderForm();" class="bx-btn bx-btn-small bx-def-margin-sec-left"><bx_text:_sys_uploader_simple_button_name /></a> 
    22    <script> 
    33        $(document).ready(function(){ 
  • trunk/templates/base/uploader_nested_form_wrapper.html

    r15500 r15546  
    1 <div id="bx-uploader-file-{file_id}" class="bx-uploader-ghost bx-def-border-bottom bx-def-padding-bottom"> 
     1<div id="bx-uploader-file-{file_id}" class="bx-uploader-ghost"> 
    22    <div class="bx-uploader-ghost-preview bx-def-padding-right bx-def-padding-top"> 
    33        <img src="{file_icon}" class="bx-def-border" /> 
    44    </div> 
    5     <div class="bx-uploader-ghost-form"> 
    6         <div class="bx-uploader-ghost-form-filename bx-def-padding-left bx-def-padding-top bx-def-font-grayed">{file_name}</div> 
     5    <div class="bx-uploader-ghost-form "> 
     6        <div class="bx-uploader-ghost-form-filename bx-def-padding-top bx-def-padding-bottom bx-def-font-grayed">{file_name}</div> 
    77        __nested_form__ 
    8         <div class="bx-uploader-ghost-form-actions bx-def-padding-left"><a href="javascript:void(0);" onclick="{js_instance_name}.deleteGhost('{file_id}')"><bx_text:_Delete /></a></div> 
     8        <div class="bx-uploader-ghost-form-actions bx-def-margin-top"><a class="bx-btn bx-btn-small" href="javascript:void(0);" onclick="{js_instance_name}.deleteGhost('{file_id}')"><bx_text:_Delete /></a></div> 
    99    </div> 
    1010    <div class="bx-clear"></div> 
Note: See TracChangeset for help on using the changeset viewer.