HomeHelpTrac

Changeset 15855 for trunk


Ignore:
Timestamp:
01/09/12 00:44:13 (5 months ago)
Author:
Alexander Trofimov
Message:

Form - one line view for checkbox and switcher elements

Location:
trunk/templates/base
Files:
2 edited

Legend:

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

    r15850 r15855  
    364364} 
    365365 
     366.bx-form-value-oneline, 
     367.bx-form-caption-oneline { 
     368    float:left; 
     369} 
     370 
     371.bx-form-caption-oneline-switcher { 
     372    line-height:26px; 
     373} 
     374 
    366375/* extra features */ 
    367376 
  • trunk/templates/base/scripts/BxBaseFormView.php

    r15798 r15855  
    210210                $sRow = $this->genRowCustom($aInput, 'genInputFiles'); 
    211211            break; 
     212     
     213            case 'switcher': 
     214            case 'checkbox': 
     215                $sRow = $this->genRowStandard($aInput, true); 
     216            break; 
    212217 
    213218            default: 
     
    224229     * @return string 
    225230     */ 
    226     function genRowStandard(&$aInput) { 
     231    function genRowStandard(&$aInput, $isOneLine = false) { 
    227232 
    228233        $sCaption = isset($aInput['caption']) ? bx_process_output($aInput['caption']) : ''; 
     
    250255        } 
    251256 
     257        $sClassOneLineCaption = ''; 
     258        $sClassOneLineValue = ''; 
     259        if ($isOneLine) { 
     260            $sClassOneLineCaption = ' bx-form-caption-oneline bx-form-caption-oneline-' . $aInput['type'] . ' bx-def-margin-sec-left'; 
     261            $sClassOneLineValue = ' bx-form-value-oneline bx-form-value-oneline-' . $aInput['type']; 
     262            $aInput['attrs']['id'] = $this->getInputId($aInput); 
     263            if ($sCaption) 
     264                $sCaption = '<label for="' . $aInput['attrs']['id'] . '">' . $sCaption . '</label>'; 
     265        } 
     266 
    252267        $sInput = $this->genInput($aInput); 
    253268 
    254269        $sCaptionCode = ''; 
    255270        if ($sCaption) 
    256             $sCaptionCode = '<div class="bx-form-caption">' . $sCaption . $sRequired . '</div>'; 
     271            $sCaptionCode = '<div class="bx-form-caption' . $sClassOneLineCaption . '">' . $sCaption . $sRequired . '</div>'; 
    257272        else 
    258             $sInput .= $sRequired; // TODO: maybe some other way to show required item 
     273            $sInput .= $sRequired;  
    259274 
    260275        $sInputCode = $this->genWrapperInput($aInput, $sInput); 
     
    267282        if (empty($sErrorIcon)) $sErrorIcon = ''; 
    268283 
    269         $sCode = <<<BLAH 
    270                 <div $sTrAttrs> 
    271                     $sCaptionCode 
    272                     <div class="bx-form-value$sClassAdd"> 
     284        $sValueCode = <<<BLAH 
     285                    <div class="bx-form-value{$sClassAdd}{$sClassOneLineValue}"> 
    273286                        <div class="bx-clear"></div> 
    274287                        $sInputCode 
     
    279292                        <div class="bx-clear"></div> 
    280293                    </div> 
    281                 </div> 
    282294BLAH; 
    283  
    284  
    285         return $sCode; 
     295     
     296        if ($isOneLine) 
     297            $sCode = $sValueCode . $sCaptionCode . '<div class="bx-clear"></div>'; 
     298        else  
     299            $sCode = $sCaptionCode . $sValueCode; 
     300 
     301        return "<div $sTrAttrs>" . $sCode . "</div>"; 
    286302    } 
    287303 
     
    565581        $aInput['type'] = 'checkbox'; 
    566582        $sCheckbox = $this->genInputStandard(&$aInput); 
     583        $aInput['type'] = 'switcher'; 
    567584 
    568585        $sClass = 'off'; 
Note: See TracChangeset for help on using the changeset viewer.