Changeset 1320

Show
Ignore:
Timestamp:
01/09/08 16:49:58 (9 months ago)
Author:
benoitg
Message:
  • Add gettext calls, fixes #413
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wifidog-auth/CHANGELOG

    r1316 r1320  
    11# $Id$ 
     22008-01-09 Benoit GrĂ©goire  <bock@step.polymtl.ca> 
     3        * Add gettext calls, fixes #413 
     4         
    252008-01-06 Benoit GrĂ©goire  <bock@step.polymtl.ca> 
    36        * Some more work on the permission system.  At long last, close #358 
  • trunk/wifidog-auth/wifidog/classes/Content/BannerAdGroup/BannerAdGroup.php

    r1249 r1320  
    135135        /*max_width*/ 
    136136        $html .= "<li class='admin_element_item_container'>\n"; 
    137         $html .= "<div class='admin_element_label'>" . ("Width") . ": </div>\n"; 
     137        $html .= "<div class='admin_element_label'>" . _("Width") . ": </div>\n"; 
    138138        $html .= "<div class='admin_element_data'>\n"; 
    139139        $name = "banner_add_group_{this->getId()}_max_width"; 
     
    144144        /*max_height*/ 
    145145        $html .= "<li class='admin_element_item_container'>\n"; 
    146         $html .= "<div class='admin_element_label'>" . ("Height") . ": </div>\n"; 
     146        $html .= "<div class='admin_element_label'>" . _("Height") . ": </div>\n"; 
    147147        $html .= "<div class='admin_element_data'>\n"; 
    148148        $name = "banner_add_group_{this->getId()}_max_height"; 
  • trunk/wifidog-auth/wifidog/classes/Content/ContentGroup/ContentGroup.php

    r1249 r1320  
    5959 */ 
    6060class ContentGroup extends Content { 
    61  
    62     private $CONTENT_ORDERING_MODES = array ( 
    63         'RANDOM' => "Pick content elements randomly", 
    64         'PSEUDO_RANDOM' => "Pick content elements randomly, but not twice until all elements have been seen", 
    65         'SEQUENTIAL' => "Pick content elements in sequential order" 
    66     ); 
    67     private $CONTENT_CHANGES_ON_MODES = array ( 
    68         'ALWAYS' => "Content always rotates", 
    69         'NEXT_DAY' => "Content rotates once per day", 
    70         'NEXT_LOGIN' => "Content rotates once per session", 
    71         'NEXT_NODE' => "Content rotates each time you change node", 
    72         'NEVER' => "Content never rotates.  Usefull when showing all elements simultaneously in a specific order." 
    73     ); 
    74     private $ALLOW_REPEAT_MODES = array ( 
    75         'YES' => "Content can be shown more than once", 
    76         'NO' => "Content can only be shown once", 
    77         'ONCE_PER_NODE' => "Content can be shown more than once, but not at the same node" 
    78     ); 
     61    /** See contructor for value */ 
     62    private $CONTENT_ORDERING_MODES; 
     63    /** See contructor for value */ 
     64    private $CONTENT_CHANGES_ON_MODES; 
     65    /** See contructor for value */ 
     66    private $ALLOW_REPEAT_MODES; 
    7967 
    8068    // is_expandable is ONLY for internal use, it use normally only set by the constructor 
     
    9583        // Init values 
    9684        $row = null; 
    97  
    9885        parent :: __construct($content_id); 
     86        $this->CONTENT_ORDERING_MODES = array ( 
     87        'RANDOM' => _("Pick content elements randomly"), 
     88        'PSEUDO_RANDOM' => _("Pick content elements randomly, but not twice until all elements have been seen"), 
     89       'SEQUENTIAL' => _("Pick content elements in sequential order") 
     90        ); 
     91        $this->CONTENT_CHANGES_ON_MODES = array ( 
     92        'ALWAYS' => _("Content always rotates"), 
     93        'NEXT_DAY' => _("Content rotates once per day"), 
     94        'NEXT_LOGIN' => _("Content rotates once per session"), 
     95        'NEXT_NODE' => _("Content rotates each time you change node"), 
     96        'NEVER' => _("Content never rotates.  Usefull when showing all elements simultaneously in a specific order.") 
     97        ); 
     98        $this->ALLOW_REPEAT_MODES = array ( 
     99        'YES' => _("Content can be shown more than once"), 
     100        'NO' => _("Content can only be shown once"), 
     101        'ONCE_PER_NODE' => _("Content can be shown more than once, but not at the same node") 
     102        ); 
    99103 
    100104        $content_id = $db->escapeString($content_id); 
     
    121125 
    122126    /** Set the allowed content types for the group, 
    123     * @param $allowed_content_types ContentTypeFilter*/ 
     127    * @param $allowed_content_types ContentTypeFilter*/ 
    124128    public function setAllowedContentTypes(ContentTypeFilter $allowed_content_types) { 
    125129        $this->allowed_content_types = $allowed_content_types; 
     
    128132 
    129133    /** In what order is the content displayed to the user 
    130     * @return string, a key of CONTENT_SELECTION_MODES */ 
     134    * @return string, a key of CONTENT_SELECTION_MODES */ 
    131135    public function getContentOrderingMode() { 
    132136        return $this->content_group_row['content_ordering_mode']; 
     
    157161 
    158162    /** When does the content rotate? 
    159     * @return string, a key of CONTENT_SELECTION_MODES */ 
     163    * @return string, a key of CONTENT_SELECTION_MODES */ 
    160164    public function getContentChangesOnMode() { 
    161165        return $this->content_group_row['content_changes_on_mode']; 
     
    215219 
    216220    /** How many element should be picked for display at once? 
    217     * @return integer */ 
     221    * @return integer */ 
    218222    public function getDisplayNumElements() { 
    219223        if ($this->temporary_display_num_elements == null) 
    220             return $this->content_group_row['display_num_elements']; 
     224        return $this->content_group_row['display_num_elements']; 
    221225        else 
    222             return $this->temporary_display_num_elements; 
     226        return $this->temporary_display_num_elements; 
    223227    } 
    224228 
    225229    /** How many element should be picked for display at once? 
    226     * @param $display_num_elements integer, must be greater than zero. 
    227     * @return true if successfull 
    228     * */ 
     230    * @param $display_num_elements integer, must be greater than zero. 
     231    * @return true if successfull 
     232    * */ 
    229233    protected function setDisplayNumElements($display_num_elements, & $errormsg = null) { 
    230234        $retval = false; 
     
    289293        /*display_num_elements*/ 
    290294        $html .= "<li class='admin_element_item_container'>\n"; 
    291         $html .= "<div class='admin_element_label'>" . ("Pick how many elements for each display?") . ": </div>\n"; 
     295        $html .= "<div class='admin_element_label'>" . _("Pick how many elements for each display?") . ": </div>\n"; 
    292296        $html .= "<div class='admin_element_data'>\n"; 
    293297        $name = "content_group_" . $this->id . "_display_num_elements"; 
     
    324328        $name = "content_group_" . $this->id . "_expired_elements_shown"; 
    325329        $html .= "<input type='hidden' name='$name' id='$name' value='$showExpired'>\n"; 
    326          
     330 
    327331        $html .= "<ul class='admin_element_list'>\n"; 
    328332        foreach ($this->getElements($additionalWhere) as $element) { 
     
    371375 
    372376            /* content_group_element */ 
    373          $name = "content_group_" . $this->id . "_expired_elements_shown"; 
    374         if (empty ($_REQUEST[$name])) { 
    375             $additionalWhere = "AND (valid_until_timestamp IS NULL OR valid_until_timestamp >= CURRENT_TIMESTAMP) \n"; 
    376         } else { 
    377             $additionalWhere = null; 
    378        
     377            $name = "content_group_" . $this->id . "_expired_elements_shown"; 
     378            if (empty ($_REQUEST[$name])) { 
     379                $additionalWhere = "AND (valid_until_timestamp IS NULL OR valid_until_timestamp >= CURRENT_TIMESTAMP) \n"; 
     380            } else { 
     381                $additionalWhere = null; 
     382            
    379383            foreach ($this->getElements($additionalWhere) as $element) { 
    380384                $name = "content_group_" . $this->id . "_element_" . $element->GetId() . "_erase"; 
     
    415419 
    416420    /**Get the next element or elements to be displayed, depending on the display mode 
    417     * @return an array of ContentGroupElement or an empty arrray */ 
     421    * @return an array of ContentGroupElement or an empty arrray */ 
    418422    function getDisplayElements() { 
    419423        //This function is very expensive, cache the results 
     
    477481                        $object = self :: getObject($redisplay_row['content_group_element_id']); 
    478482                        if ($object->isDisplayableAt(Node :: GetCurrentNode()) == true) /** Only content available at this hotspot are considered */ 
    479                            
     483                       
    480484                            $redisplay_objects[] = $object; 
    481485                        } 
     
    550554                    $object = self :: getObject($element_row['content_group_element_id']); 
    551555                    if ($object->isDisplayableAt(Node :: GetCurrentNode()) == true) /** Only content available at this hotspot are considered */ 
    552                        
     556                   
    553557                        $new_objects[] = $object; 
    554558                    } 
     
    571575                $new_objects = array_slice($new_objects, 0, $num_to_pick); 
    572576            } 
    573              
     577 
    574578            /*echo "<pre>Redisplay: "; 
    575             print_r($redisplay_objects); 
    576             echo "New objects: "; 
    577             print_r($new_objects); 
    578             echo "</pre>";*/ 
    579              
     579            print_r($redisplay_objects); 
     580            echo "New objects: "; 
     581            print_r($new_objects); 
     582            echo "</pre>";*/ 
     583 
    580584            $retval = array_merge($new_objects, $redisplay_objects); 
    581585            //echo count($retval).' returned <br>'; 
     
    592596    protected function setIsExpandable($status) { 
    593597        if (is_bool($status)) 
    594             $this->is_expandable = $status; 
     598        $this->is_expandable = $status; 
    595599    } 
    596600 
     
    610614            //TODO: Try to find a better solution to this problem... 
    611615            if ($status == true) 
    612                 $this->setTemporaryDisplayNumElements(3000); 
     616            $this->setTemporaryDisplayNumElements(3000); 
    613617            else 
    614                 $this->setTemporaryDisplayNumElements(null); 
     618            $this->setTemporaryDisplayNumElements(null); 
    615619            $this->expand_status = $status; 
    616620        } 
     
    625629    public function getExpandStatus() { 
    626630        if ($this->expand_status == null) 
    627             return false; 
     631        return false; 
    628632        return $this->expand_status; 
    629633    } 
     
    655659                    // If the content group logging is disabled, all the children will inherit this property temporarly 
    656660                    if ($this->getLoggingStatus() == false) 
    657                         $display_element->setLoggingStatus(false); 
     661                    $display_element->setLoggingStatus(false); 
    658662                    $html .= $display_element->getUserUI(); 
    659663                } 
     
    662666            } 
    663667        } 
    664                $this->setUserUIMainDisplayContent($html); 
     668        $this->setUserUIMainDisplayContent($html); 
    665669        return parent :: getUserUI(); 
    666670    } 
     
    697701 
    698702    /** Reloads the object from the database.  Should normally be called after a set operation. 
    699     * This function is private because calling it from a subclass will call the 
    700     * constructor from the wrong scope */ 
     703    * This function is private because calling it from a subclass will call the 
     704    * constructor from the wrong scope */ 
    701705    private function refresh() { 
    702706        $this->__construct($this->id);