Changeset 292

Show
Ignore:
Timestamp:
03/08/08 16:07:56 (5 years ago)
Author:
d0nut
Message:

... but allow both to be configured for every group

Location:
application.register
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • application.register/files/lib/action/UserGroupOptionsAction.class.php

    r276 r292  
    1111 */ 
    1212class UserGroupOptionsAction extends AbstractAction { 
    13         public $enabled = array(); 
     13        public $displayNotification=0, $emailNotification=0; 
    1414        public $groupID = 0; 
    1515        public $group; 
     
    2727                        throw new IllegalLinkException(); 
    2828                } 
     29                $this->displayNotification = isset($_POST['groupApplyMail_display']) ? intval($_POST['groupApplyMail_display']) : 0; 
     30                $this->emailNotification = isset($_POST['groupApplyMail_email']) ? intval($_POST['groupApplyMail_email']) : 0; 
    2931                 
    30                 $this->enabled = isset($_POST['groupApplyMail_enabled']) ? intval($_POST['groupApplyMail_enabled']) : 0; 
    3132        } 
    3233         
     
    4344                } 
    4445                 
    45                 if($this->enabled) { 
    46                         $sql = "INSERT IGNORE  
     46                if($this->displayNotification || $this->emailNotification) { 
     47                        $sql = "INSERT 
    4748                                INTO            wcf".WCF_N."_groupapplymail 
    48                                                 (userID, groupID) 
     49                                                (userID, groupID, displayNotification, emailNotification) 
    4950                                VALUES 
    50                                                 (".WCF::getUser()->userID.", ".intval($this->groupID).")"; 
     51                                                (".WCF::getUser()->userID.", ".intval($this->groupID).", ".$this->displayNotification.", ".$this->emailNotification.") 
     52                                ON DUPLICATE KEY 
     53                                UPDATE          displayNotification=".$this->displayNotification.", 
     54                                                emailNotification=".$this->emailNotification; 
    5155                         
    5256                } else { 
  • application.register/files/lib/system/event/listener/UserGroupAdministrateMailListener.class.php

    r286 r292  
    1515         
    1616        //data 
    17         protected $enabled; 
     17        protected $displayNotification=0, $emailNotification=0; 
    1818 
    1919        /** 
     
    3838         */ 
    3939        protected function readData() { 
    40                 $sql = "SELECT          COUNT(*) AS c 
    41                         FROM            wcf".WCF_N."_groupapplymail 
    42                         WHERE           groupID = '".intval($this->eventObj->groupID)."' 
    43                         AND             userID = '".WCF::getUser()->userID."'"; 
     40                $sql = "SELECT          displayNotification, 
     41                                        emailNotification 
     42                        FROM            wcf".WCF_N."_group_application_mail 
     43                        WHERE           groupID = ".intval($this->eventObj->groupID)." 
     44                        AND             userID = ".WCF::getUser()->userID; 
    4445                $row = WCF::getDB()->getFirstRow($sql); 
    45                 $this->enabled = intval($row['c']); 
     46                if($row) { 
     47                        $this->displayNotification = intval($row['displayNotification']); 
     48                        $this->emailNotification = intval($row['emailNotification']); 
     49                } 
    4650        } 
    4751 
     
    5256                WCF::getTPL()->assign(array( 
    5357                        'groupID' => $this->eventObj->groupID, 
    54                         'enabled' => $this->enabled, 
     58                        'displayl' => $this->displayNotification, 
     59                        'email' => $this->emailNotification, 
    5560                        'groupType' => $this->eventObj->group->groupType 
    5661                )); 
  • application.register/files/lib/system/event/listener/UserGroupApplyMailListener.class.php

    r286 r292  
    2626                        FROM            wcf".WCF_N."_groupapplymail 
    2727                        NATURAL JOIN    wcf".WCF_N."_user user 
    28                         WHERE           groupID = '".intval($eventObj->group->groupID)."'"; 
     28                        WHERE           groupID = ".intval($eventObj->group->groupID)." 
     29                        AND             emailNotification = 1"; 
    2930                $result = WCF::getDB()->sendQuery($sql); 
    3031                while ($row = WCF::getDB()->fetchArray($result)) { 
  • application.register/templates/userGroupApplyMail.tpl

    r276 r292  
    33                <legend>{lang}wcf.groupapplymail.options{/lang}</legend> 
    44 
    5                 <div class="formCheckBox formElement" id="enableGroupApplyMailDiv"> 
     5                <div class="formCheckBox formElement"> 
     6                        <div class="formField"> 
     7                                <label for="enableGroupApplyMailDisplay"><input id="enableGroupApplyMailDisplay" type="checkbox" name="groupApplyMail_display" value="1" 
     8                                {if $display}checked="checked"{/if}/> {lang}wcf.groupapplymail.enableDisplayNotification.{$groupType}{/lang}</label> 
     9                        </div> 
    610 
     11                        <div class="formFieldDesc"> 
     12                                <p>{lang}wcf.groupapplymail.enableDisplayNotification.{$groupType}.description{/lang}</p> 
     13                        </div> 
     14                </div> 
     15                 
     16                <div class="formCheckBox formElement"> 
    717                        <div class="formField"> 
    8                                 <label for="enableGroupApplyMail"><input id="enableGroupApplyMail" type="checkbox" name="groupApplyMail_enabled" value="1" 
    9                                 {if $enabled}checked="checked"{/if}/> {lang}wcf.groupapplymail.enableEmailNotification.{$groupType}{/lang}</label> 
     18                                <label for="enableGroupApplyMailEmail"><input id="enableGroupApplyMailEmail" type="checkbox" name="groupApplyMail_email" value="1" 
     19                                {if $email}checked="checked"{/if}/> {lang}wcf.groupapplymail.enableEmailNotification.{$groupType}{/lang}</label> 
    1020                        </div> 
    1121