Changeset 256

Show
Ignore:
Timestamp:
04/10/08 00:29:05 (9 months ago)
Author:
shupp
Message:

Moved Domains to smarty gettext plugin. CS fixes

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/Framework/Module/Domains.php

    r246 r256  
    55 * Framework_Module_Domains  
    66 *  
    7  * This module is for viewing and editing vpopmail domains 
    8  *  
    9  * @uses      ToasterAdmin_Auth_System 
    10  * @package   ToasterAdmin 
    11  * @author    Bill Shupp <hostmaster@shupp.org>  
    12  * @copyright 2007 Bill Shupp 
    13  * @license   GPL 2.0  {@link http://www.gnu.org/licenses/gpl.txt} 
    14  * @link      http://trac.merchbox.com/trac/toasteradmin 
     7 * PHP Version 5.1.0+ 
     8 *  
     9 * @uses       ToasterAdmin_Auth_System 
     10 * @category   Mail 
     11 * @package    ToasterAdmin 
     12 * @subpackage Module 
     13 * @author     Bill Shupp <hostmaster@shupp.org>  
     14 * @copyright  2007-2008 Bill Shupp 
     15 * @license    GPL 2.0  {@link http://www.gnu.org/licenses/gpl.txt} 
     16 * @link       http://trac.merchbox.com/trac/toasteradmin 
    1517 */ 
    1618 
     
    2123 * This module is for viewing and editing vpopmail domains 
    2224 *  
    23  * @uses      ToasterAdmin_Auth_System 
    24  * @package   ToasterAdmin 
    25  * @author    Bill Shupp <hostmaster@shupp.org>  
    26  * @copyright 2007 Bill Shupp 
    27  * @license   GPL 2.0  {@link http://www.gnu.org/licenses/gpl.txt} 
    28  * @link      http://trac.merchbox.com/trac/toasteradmin 
     25 * @uses       ToasterAdmin_Auth_System 
     26 * @category   Mail 
     27 * @package    ToasterAdmin 
     28 * @subpackage Module 
     29 * @author     Bill Shupp <hostmaster@shupp.org>  
     30 * @copyright  2007-2008 Bill Shupp 
     31 * @license    GPL 2.0  {@link http://www.gnu.org/licenses/gpl.txt} 
     32 * @link       http://trac.merchbox.com/trac/toasteradmin 
    2933 */ 
    3034class Framework_Module_Domains extends ToasterAdmin_Auth_System 
     
    3640     * Run listDomains() 
    3741     * 
    38      * @access      public 
    39      * @return      mixed 
     42     * @access public 
     43     * @return mixed 
    4044     */ 
    4145    public function __default() 
     
    5963 
    6064        // Build domain list 
    61         $domainArray = $this->user->listDomains($this->data['currentPage'],$this->data['limit']); 
    62         $domains = array(); 
    63         $count = 0; 
    64         while (list($key,$val) = each($domainArray)) { 
    65             $domains[$count]['name'] = $key; 
    66             $domains[$count]['limits_url'] = htmlspecialchars('./?module=Main&class=Limits&domain=' . $key); 
    67             $domains[$count]['menu_url'] = htmlspecialchars('./?module=Domains&class=Menu&domain=' . $key); 
    68             $domains[$count]['delete_url'] = htmlspecialchars('./?module=Domains&event=delDomain&domain=' . $key); 
    69             $count++; 
    70         } 
    71         $this->setData('domains', $domains); 
    72         $this->setData('add_domain_url', htmlspecialchars("./?module=Domains&event=addDomain")); 
    73  
    74         // Language 
    75         $this->setData('LANG_Add_Domain', _('Add Domain')); 
    76         $this->setData('LANG_Domains_Page', _('Domains: Page')); 
    77         $this->setData('LANG_of', _('of')); 
    78         $this->setData('LANG_edit_domain', _('edit domain')); 
    79         $this->setData('LANG_delete_domain', _('delete domain')); 
    80  
     65        $list = $this->user->listDomains($this->data['currentPage'], 
     66            $this->data['limit']); 
     67        $a    = array(); 
     68        $c    = 0; 
     69        foreach ($list as $key => $val) { 
     70            $lus = './?module=Main&class=Limits&domain=' . $key; 
     71            $mus = './?module=Domains&class=Menu&domain=' . $key; 
     72            $dus = './?module=Domains&event=delDomain&domain=' . $key; 
     73 
     74            $a[$c]['name']       = $key; 
     75            $a[$c]['limits_url'] = htmlspecialchars($lus); 
     76            $a[$c]['menu_url']   = htmlspecialchars($mus); 
     77            $a[$c]['delete_url'] = htmlspecialchars($dus); 
     78            $c++; 
     79        } 
     80        $this->setData('domains', $a); 
     81        $this->setData('add_domain_url', 
     82            htmlspecialchars("./?module=Domains&event=addDomain")); 
    8183        $this->tplFile = 'listDomains.tpl'; 
    8284        return; 
     
    116118        // Add domain 
    117119        try { 
    118             $result = $this->user->addDomain($form->getElementValue('domain'), $form->getElementValue('password')); 
     120            $result = $this->user->addDomain($form->getElementValue('domain'), 
     121                $form->getElementValue('password')); 
    119122        } catch (Net_Vpopmaild_Exception $e) { 
    120123            $this->setData('message', _("Error: ") . $e->getMessage()); 
    121124            return $this->addDomain(); 
    122125        } 
    123         header('Location: ./?module=Domains&class=Menu&success&domain=' . $form->getElementValue('domain')); 
     126        header('Location: ./?module=Domains&class=Menu&success&domain=' 
     127            . $form->getElementValue('domain')); 
    124128        return; 
    125129    } 
     
    128132     * addDomainForm  
    129133     *  
    130      * create add domain form 
    131      *  
    132      * @access private 
    133      * @return void 
    134      */ 
    135     private function addDomainForm() 
    136     { 
    137         $form = new HTML_QuickForm('formLogin', 'post', './?module=Domains&event=addDomainNow'); 
     134     * Create add domain form. 
     135     *  
     136     * @access protected 
     137     * @return object HTML_QuickForm object 
     138     */ 
     139    protected function addDomainForm() 
     140    { 
     141        $form = new HTML_QuickForm('formLogin', 'post', 
     142            './?module=Domains&event=addDomainNow'); 
    138143 
    139144        $form->addElement('text', 'domain', _('Domain')); 
     
    141146        $form->addElement('submit', 'submit', _('Add Domain')); 
    142147 
    143         $form->addRule('domain', _('Please a domain name'), 'required', null, 'client'); 
    144         $form->addRule('password', _('Please enter a postmaster password'), 'required', null, 'client'); 
     148        $form->addRule('domain', _('Please a domain name'), 
     149            'required', null, 'client'); 
     150        $form->addRule('password', _('Please enter a postmaster password'), 
     151            'required', null, 'client'); 
    145152        $form->applyFilter('__ALL__', 'trim'); 
    146153 
     
    163170        } 
    164171 
    165         $this->setData('LANG_Are_you_sure_you_want_to_delete_this_domain', _("Are you sure you want to delete this domain?")); 
    166         $this->setData('LANG_cancel', _("cancel")); 
    167         $this->setData('LANG_delete', _("delete")); 
    168  
    169         $this->setData('delete_url', htmlspecialchars("./?module=Domains&event=delDomainNow&domain=" . $this->domain)); 
    170         $this->setData('cancel_url', htmlspecialchars("./?module=Domains&event=cancelDelDomain")); 
     172        $dus = "./?module=Domains&event=delDomainNow&domain=" . $this->domain; 
     173        $cus = "./?module=Domains&event=cancelDelDomain"; 
     174        $this->setData('delete_url', htmlspecialchars($dus)); 
     175        $this->setData('cancel_url', htmlspecialchars($cus)); 
    171176        $this->tplFile = 'domainConfirmDelete.tpl'; 
    172177 
     
    207212     * @return void 
    208213     */ 
    209     public function cancelDelDomain() { 
     214    public function cancelDelDomain() 
     215    { 
    210216        $this->setData('message', _("Domain deletion canceled")); 
    211217        return $this->listDomains(); 
    212218    } 
    213219 
     220    /** 
     221     * _renderForm  
     222     *  
     223     * Render Add Domain form 
     224     *  
     225     * @param object $form HTML_QuickForm object 
     226     *  
     227     * @access private 
     228     * @return void 
     229     */ 
    214230    private function _renderForm($form) 
    215231    { 
    216232        $this->tplFile = 'addDomain.tpl'; 
    217233        $this->setData('addDomainForm', $form->toHtml()); 
    218         $this->setData('LANG_Main_Menu', _('Main Menu')); 
    219         $this->setData('LANG_List_Domains', _('List Domains')); 
    220234    } 
    221235 
  • trunk/Framework/Module/Domains/Templates/Default/addDomain.tpl

    r228 r256  
    88{$addDomainForm} 
    99<br /> 
    10 <a href="./?module=Domains">{$LANG_List_Domains}</a> | <a href="./?module=Main">{$LANG_Main_Menu}</a> 
     10<a href="./?module=Domains">{t}List Domains{/t}</a> | <a href="./?module=Main">{t}Main Menu{/t}</a> 
    1111</div> 
    1212<div class="boxbottom"></div> 
  • trunk/Framework/Module/Domains/Templates/Default/domainConfirmDelete.tpl

    r74 r256  
    11<div class="boxtop"></div> 
    22<div class="box"> 
    3 {$LANG_Are_you_sure_you_want_to_delete_this_domain
     3{t}Are you sure you want to delete this domain?{/t
    44<br /><br /> 
    55{$domain} 
    66<br /><br /> 
    7 <a href="{$cancel_url}">{$LANG_cancel}</a> &nbsp | &nbsp <a href="{$delete_url}">{$LANG_delete}</a> 
     7<a href="{$cancel_url}">{t}cancel{/t}</a> &nbsp | &nbsp <a href="{$delete_url}">{t}delete{/t}</a> 
    88</div> 
    99<div class="boxbottom"></div> 
  • trunk/Framework/Module/Domains/Templates/Default/domainMenu.tpl

    r227 r256  
    1111<tr><td class="border"> 
    1212<ul> 
    13     <li><a href="{$list_accounts_url}">{$LANG_Email_Accounts}</a></li> 
    14     <li><a href="{$list_forwards_url}">{$LANG_Forwards}</a></li> 
    15     <li><a href="{$list_responders_url}">{$LANG_Auto_Responders}</a></li> 
    16     <!-- <li><a href="{$list_lists_url}">{$LANG_Mailing_Lists}</a></li> --> 
     13    <li><a href="{$list_accounts_url}">{t}Email Accounts{/t}</a></li> 
     14    <li><a href="{$list_forwards_url}">{t}Forwards{/t}</a></li> 
     15    <li><a href="{$list_responders_url}">{t}Auto Responders{/t}</a></li> 
     16    <!-- <li><a href="{$list_lists_url}">{t}Mailing Lists{/t}</a></li> --> 
    1717</ul> 
    1818</td> 
    1919</tr> 
    2020</table> 
    21 {if $isSysAdmin}<a href="./?module=Domains">{$LANG_Domain_List}</a>{/if} 
     21{if $isSysAdmin}<a href="./?module=Domains">{t}Domain List{/t}</a>{/if} 
    2222</div> 
    2323<div class="boxbottom"></div> 
  • trunk/Framework/Module/Domains/Templates/Default/listDomains.tpl

    r246 r256  
    22<div class="boxtop"></div> 
    33<div class="box"> 
    4 <strong><a href="{$add_domain_url}">{$LANG_Add_Domain}</a></strong> 
     4<strong><a href="{$add_domain_url}">{t}Add Domain{/t}</a></strong> 
    55</div> 
    66<div class="boxbottom"></div> 
     
    99<div class="boxtopDomains"> 
    1010    <div class="boxtopDomainscontent"> 
    11         <h1>{$LANG_Domains_Page} {$currentPage} {$LANG_of} {$totalPages}</h1> 
     11        <h1>{t}Domains: Page{/t} {$currentPage} {t}of{/t} {$totalPages}</h1> 
    1212    {framework_pager start=$start limit=$limit total=$total}  
    1313    </div>