HomeHelpTrac

Changeset 15674 for trunk/templates


Ignore:
Timestamp:
11/14/11 20:25:08 (6 months ago)
Author:
Alexander Trofimov
Message:

Grid

Location:
trunk/templates
Files:
4 added
2 edited

Legend:

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

    r15545 r15674  
    101101 
    102102.bx-def-color-bg-sec { 
    103     background:#f2f2f2; 
     103    background-color:#f2f2f2; 
    104104} 
    105105 
  • trunk/templates/base/scripts/BxBaseFormView.php

    r15633 r15674  
    109109BLAH; 
    110110        } else { 
    111             // add default className to attributes 
    112             $this->aFormAttrs['class'] = 'bx-form-advanced' . (isset($this->aFormAttrs['class']) ? (' ' . $this->aFormAttrs['class']) : ''); 
    113  
    114             $sFormAttrs = $this->convertArray2Attrs($this->aFormAttrs); 
     111            $sFormAttrs = bx_convert_array2attrs($this->aFormAttrs, 'bx-form-advanced'); 
    115112 
    116113            $sForm = <<<BLAH 
     
    227224        $sErrorIcon = $this->genErrorIcon(empty($aInput['error']) ? '' : $aInput['error']); 
    228225 
    229         $aInput['tr_attrs']['class'] = "bx-form-element-wrapper bx-def-margin-top" . (isset($aInput['tr_attrs']['class']) ? ' ' . $aInput['tr_attrs']['class'] : ''); 
    230226        if (isset($aInput['name'])) 
    231227            $aInput['tr_attrs']['id'] = "bx-form-element-" . $aInput['name']; 
    232         $sTrAttrs = $this->convertArray2Attrs($aInput['tr_attrs']); 
     228        $sTrAttrs = bx_convert_array2attrs(isset($aInput['tr_attrs']) && is_array($aInput['tr_attrs']) ? $aInput['tr_attrs'] : array(), "bx-form-element-wrapper bx-def-margin-top"); 
    233229 
    234230        if ($aInput['type'] == 'captcha') { 
     
    281277 
    282278    function genWrapperInput($aInput, $sContent) { 
    283         $sAttr = isset($aInput['attrs_wrapper']) && is_array($aInput['attrs_wrapper']) ? $this->convertArray2Attrs($aInput['attrs_wrapper']) : ''; 
     279        $sAttr = isset($aInput['attrs_wrapper']) && is_array($aInput['attrs_wrapper']) ? bx_convert_array2attrs($aInput['attrs_wrapper']) : ''; 
    284280 
    285281        $sCode = <<<BLAH 
     
    310306        $sInput = $this->$sCustomMethod($aInput, $sInfoIcon, $sErrorIcon); 
    311307 
    312         $aInput['tr_attrs']['class'] = "bx-form-element-wrapper bx-def-margin-top" . (isset($aInput['tr_attrs']['class']) ? ' ' . $aInput['tr_attrs']['class'] : ''); 
    313308        if (isset($aInput['name'])) 
    314309            $aInput['tr_attrs']['id'] = "bx-form-element-" . $aInput['name']; 
    315         $sTrAttrs = $this->convertArray2Attrs(empty($aInput['tr_attrs']) ? array() : $aInput['tr_attrs']); 
     310        $sTrAttrs = bx_convert_array2attrs(empty($aInput['tr_attrs']) ? array() : $aInput['tr_attrs'], "bx-form-element-wrapper bx-def-margin-top"); 
    316311 
    317312        $sCaptionCode = ''; 
     
    346341        if (empty($aInput['caption'])) { 
    347342            $sCode = $this->getCloseSection(); 
    348             $aAttrs['class'] = "bx-form-section-divider bx-def-margin-top " . (isset($aAttrs['class']) ? ' ' . $aAttrs['class'] : ''); 
    349             $sAttrs = $this->convertArray2Attrs($aAttrs); 
     343            $sAttrs = bx_convert_array2attrs($aAttrs, "bx-form-section-divider bx-def-margin-top"); 
    350344            $sCode .=  "<div $sAttrs></div>"; 
    351345            $sCode .= $this->getOpenSection(false); 
     
    365359            $sClassAdd = ''; 
    366360            $aNextTbodyAdd = false; 
    367         } 
    368  
    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" . 
    370             (isset($aAttrs['class']) ? ' ' . $aAttrs['class'] : '') . 
    371             (isset($sClassAdd) ? ' ' . $sClassAdd  : ''); 
    372  
    373         $sAttrs = $this->convertArray2Attrs($aAttrs); 
     361        }         
     362 
     363        $sAttrs = bx_convert_array2attrs($aAttrs, "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" . (empty($sClassAdd) ? '' : ' ' . $sClassAdd)); 
    374364 
    375365        $sCode = ''; 
     
    537527 
    538528        // add default className to attributes 
    539         $aAttrs['class'] = "bx-def-font-inputs bx-form-input-{$aInput['type']}" . (isset($aAttrs['class']) ? ' ' . $aAttrs['class'] : ''); 
    540529        $aAttrs['type'] = $aInput['type']; 
    541530        if (isset($aInput['name'])) $aAttrs['name'] = $aInput['name']; 
     
    550539            $aAttrs['checked'] = 'checked'; 
    551540 
    552         $sAttrs = $this->convertArray2Attrs($aAttrs); 
     541        $sAttrs = bx_convert_array2attrs($aAttrs, "bx-def-font-inputs bx-form-input-{$aInput['type']}"); 
    553542 
    554543        return  "<input $sAttrs />\n"; 
     
    567556 
    568557        // add default className to attributes 
    569         $aAttrs['class'] = "bx-def-font-inputs bx-form-input-{$aInput['type']} bx-btn" . ('submit' == $aInput['type'] ? ' bx-btn-primary' : '') . (isset($aAttrs['class']) ? ' ' . $aAttrs['class'] : ''); 
    570558        $aAttrs['type'] = $aInput['type']; 
    571559        if (isset($aInput['value'])) 
     
    574562        if (isset($aInput['name'])) $aAttrs['name'] = $aInput['name']; 
    575563 
    576         $sAttrs = $this->convertArray2Attrs($aAttrs); 
     564        $sAttrs = bx_convert_array2attrs($aAttrs, "bx-def-font-inputs bx-form-input-{$aInput['type']} bx-btn" . ('submit' == $aInput['type'] ? ' bx-btn-primary' : '')); 
    577565 
    578566        return  "<button $sAttrs>" . $aInput['value'] . "</button>\n"; 
     
    589577        // clone attributes for system use ;) 
    590578        $aAttrs = empty($aInput['attrs']) ? array() : $aInput['attrs']; 
    591  
    592         // add default className to attributes 
    593         $aAttrs['class'] = 
    594             "bx-form-input-{$aInput['type']}" . 
    595             (isset($aAttrs['class']) ? (' ' . $aAttrs['class']) : '') . 
    596             ((isset($aInput['html']) and $aInput['html'] and $this->addHtmlEditor($aInput['html'], $aInput)) ? ' bx-form-input-html' : ''); 
    597579 
    598580        $aAttrs['name'] = $aInput['name']; 
     
    602584            $aAttrs['id'] = $this->getInputId($aInput); 
    603585 
    604         $sAttrs = $this->convertArray2Attrs($aAttrs); 
     586        $sAttrs = bx_convert_array2attrs($aAttrs, "bx-form-input-{$aInput['type']}" . ((isset($aInput['html']) and $aInput['html'] and $this->addHtmlEditor($aInput['html'], $aInput)) ? ' bx-form-input-html' : '')); 
    605587 
    606588        $sValue = isset($aInput['value']) ? bx_process_output($aInput['value']) : ''; 
     
    789771        $aAttrs = empty($aInput['attrs']) ? array() : $aInput['attrs']; 
    790772 
    791         // add default className to attributes 
    792         $aAttrs['class'] = "bx-form-input-{$aInput['type']}" . (isset($aAttrs['class']) ? (' ' . $aAttrs['class']) : ''); 
    793  
    794773        $aAttrs['name'] = $aInput['name']; 
    795774        if ($isMultiple) { 
     
    802781            $aAttrs['id'] = $this->getInputId($aInput); 
    803782 
    804         $sAttrs = $this->convertArray2Attrs($aAttrs); 
     783        $sAttrs = bx_convert_array2attrs($aAttrs, "bx-form-input-{$aInput['type']}"); 
    805784 
    806785        // generate options 
     
    837816        $aAttrs = empty($aInput['attrs']) ? array() : $aInput['attrs']; 
    838817 
    839         // add default className to attributes 
    840         $aAttrs['class'] = "bx-form-input-{$aInput['type']}" . (isset($aAttrs['class']) ? (' ' . $aAttrs['class']) : ''); 
    841  
    842818        $aAttrs['name']  = $aInput['name']; 
    843819 
     
    846822            $aAttrs['id'] = $this->getInputId($aInput); 
    847823 
    848         $sAttrs = $this->convertArray2Attrs($aAttrs); 
     824        $sAttrs = bx_convert_array2attrs($aAttrs, "bx-form-input-{$aInput['type']}"); 
    849825 
    850826        // generate options 
     
    888864        $aAttrs = empty($aInput['attrs']) ? array() : $aInput['attrs']; 
    889865 
    890         // add default className to attributes 
    891         $aAttrs['class'] = "bx-form-input-{$aInput['type']}" . (isset($aAttrs['class']) ? (' ' . $aAttrs['class']) : ''); 
    892  
    893         //$aAttrs['name']  = $aInput['name']; 
    894  
    895866        // for inputs with labels generate id 
    896867        if (isset($aInput['label'])) 
    897868            $aAttrs['id'] = $this->getInputId($aInput); 
    898869 
    899         $sAttrs = $this->convertArray2Attrs($aAttrs); 
     870        $sAttrs = bx_convert_array2attrs($aAttrs, "bx-form-input-{$aInput['type']}"); 
    900871 
    901872        $sSimgUrl = BX_DOL_URL_ROOT . 'simg/simg.php'; 
     
    939910    } 
    940911 
    941     /** 
    942      * Convert array to attributes string 
    943      * 
    944      * @code 
    945      * $a = array('name' => 'test', 'value' => 5); 
    946      * $s = $this->convertArray2Attrs($a); 
    947      * echo $s; 
    948      * @endcode 
    949      * 
    950      * Output: 
    951      * name="test" value="5" 
    952      * 
    953      * @param array $a 
    954      * @return string 
    955      */ 
    956     function convertArray2Attrs($a) { 
    957         $sRet = ''; 
    958  
    959         if (is_array($a)) { 
    960             foreach ($a as $sKey => $sValue) { 
    961  
    962                 if (!isset($sValue) || is_null($sValue)) // pass NULL values 
    963                     continue; 
    964  
    965                 $sValueC = bx_html_attribute($sValue); 
    966  
    967                 $sRet .= " $sKey=\"$sValueC\""; 
    968             } 
    969         } 
    970  
    971         return $sRet; 
    972     } 
    973912 
    974913    function genToggleElement($aInput) { 
     
    1011950    } 
    1012951 
    1013     function getOpenSection($aAttrs = false) { 
     952    function getOpenSection($aAttrs = array()) { 
    1014953 
    1015954        if (!$this->_isSectionOpened) { 
    1016955 
    1017             if ($aAttrs and is_array($aAttrs)) { 
    1018                 $aAttrs['class'] = "bx-form-section bx-def-padding-top bx-def-border-top" . (isset($aAttrs['class']) ? (' ' . $aAttrs['class']) : ''); 
    1019                 $sAttrs = $this->convertArray2Attrs($aAttrs); 
    1020             } else { 
    1021                 $sAttrs = ' class="bx-form-section bx-def-padding-top bx-def-border-top" '; 
    1022             } 
     956            if (!$aAttrs || !is_array($aAttrs)) 
     957                $aAttrs = array(); 
     958            $sAttrs = bx_convert_array2attrs($aAttrs, "bx-form-section bx-def-padding-top bx-def-border-top"); 
    1023959 
    1024960            $this->_isSectionOpened = true; 
Note: See TracChangeset for help on using the changeset viewer.