Changeset a749c25d5fae9ffc0b991d488d9abc5c0aabb7de in indico


Ignore:
Timestamp:
01/27/12 15:35:32 (4 months ago)
Author:
Alberto Resco Perez <alberto.resco.perez@…>
Children:
4ea669e54b4fc0f87e4bd65500eca6c19a61939e
Parents:
a7be1a17914010579dd11191ba7dca4c5ba2ba21
git-author:
Alberto Resco Perez <alberto.resco.perez@…> (01/27/12 15:35:32)
git-committer:
Jose Benito <jose.benito.gonzalez@…> (02/02/12 17:45:57)
Message:

[IMP] Restrict num participants meetings/lectures

  • Add an Input in the Setup tab of participants.
  • When a user goes to event display does not show the apply link.
  • Closes #912.
Location:
indico/MaKaC
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • indico/MaKaC/participant.py

    r9dd174 ra749c2  
    5050        self._dateNegotiation = None 
    5151        self._displayParticipantList = True 
     52        self._numMaxParticipants = 0 
    5253 
    5354    def clone(self, conference, options, eventManager=None): 
     
    136137        self.notifyModification() 
    137138 
     139    def getNumMaxParticipants(self): 
     140        try: 
     141            return self._numMaxParticipants 
     142        except AttributeError : 
     143            self._numMaxParticipants = 0 
     144            return False 
     145 
     146    def setNumMaxParticipants(self, value, responsibleUser = None): 
     147        self._numMaxParticipants = value 
     148        logData = { 
     149            "subject": "Num max of participants.", 
     150            "value": str(value) 
     151        } 
     152        self._conference.getLogHandler().logAction(logData, "participants", responsibleUser) 
     153        self.notifyModification() 
     154 
     155    def isFull(self): 
     156        if self.getNumMaxParticipants() != 0: 
     157            return len(self.getParticipantList()) >= self.getNumMaxParticipants() 
     158        return False 
    138159 
    139160    def alreadyParticipating(self, participant): 
  • indico/MaKaC/services/implementation/conference.py

    rb7f4ee ra749c2  
    822822        return True 
    823823 
     824class ConferenceParticipantsSetNumMaxParticipants( ConferenceTextModificationBase ): 
     825    """ 
     826    Conference num max participants modification 
     827    """ 
     828    def _handleSet(self): 
     829        numMaxPart = self._value 
     830        if (self._value ==""): 
     831            raise ServiceError("ERR-E2", _("The value of the maximum numbers of participants cannot be empty.")) 
     832        try: 
     833            numMaxPart = int(self._value) 
     834        except ValueError: 
     835            raise ServiceError("ERR-E3", _("The value of the maximum numbers of participants has to be a positive number.")) 
     836 
     837        self._target.getParticipation().setNumMaxParticipants(int(numMaxPart)) 
     838 
     839 
     840    def _handleGet(self): 
     841        return self._target.getParticipation().getNumMaxParticipants() 
     842 
    824843class ConferenceApplyParticipant(ConferenceDisplayBase, ConferenceAddEditParticipantBase): 
    825844 
     
    832851            raise NoReportError(_("""This event began on %s, you cannot apply for 
    833852                                         participation after the event began."""%self._conf.getStartDate()), title=_("Event started")) 
    834  
    835         if not self._conf.getParticipation().isAllowedForApplying() : 
     853        participation = self._conf.getParticipation() 
     854 
     855        if not participation.isAllowedForApplying() : 
    836856            raise NoReportError( _("""Participation in this event is restricted to persons invited. 
    837857                                           If you insist on taking part in this event, please contact the event manager."""), title=_("Application restricted")) 
     858        if participation.getNumMaxParticipants() > 0 and len(participation.getParticipantList()) >= participation.getNumMaxParticipants(): 
     859            raise NoReportError( _("""You cannot apply for participation in this event because the maximum numbers of participants has been reached. 
     860                                           If you insist on taking part in this event, please contact the event manager."""), title=_("Maximum number of participants reached")) 
     861 
    838862        result = {} 
    839863        user = self._getUser() 
    840864        pending = self._generateParticipant(user) 
    841         participation = self._conf.getParticipation() 
    842865        if participation.alreadyParticipating(pending) != 0: 
    843866            raise NoReportError(_("The participant can not be added to the meeting because there is already a participant with the email address '%s'." 
     
    15581581    "participation.allowForApply": ConferenceParticipantsAllowForApplying, 
    15591582    "participation.autopAccept": ConferenceParticipantsAutoAccept, 
     1583    "participation.setNumMaxParticipants": ConferenceParticipantsSetNumMaxParticipants, 
    15601584    "participation.applyParticipant": ConferenceApplyParticipant, 
    15611585    "participation.addParticipant": ConferenceAddParticipant, 
  • indico/MaKaC/webinterface/pages/conferences.py

    rb7f4ee ra749c2  
    10761076        if (conf.getType() in ("meeting", "simple_event") 
    10771077                and conf.getParticipation().isAllowedForApplying() 
    1078                 and conf.getStartDate() > nowutc()): 
     1078                and conf.getStartDate() > nowutc() 
     1079                and not conf.getParticipation().isFull()): 
    10791080            vars['registrationOpen'] = True 
    10801081        evaluation = conf.getEvaluation() 
     
    33863387        vars["allowForApply"] = self._conf.getParticipation().isAllowedForApplying() 
    33873388        vars["autopAccept"] = self._conf.getParticipation().autoAccept() 
     3389        vars["numMaxParticipants"] = self._conf.getParticipation().getNumMaxParticipants() 
    33883390        return vars 
    33893391 
  • indico/MaKaC/webinterface/tpls/ConferenceParticipantsSetup.tpl

    r1a8f22 ra749c2  
    3131    </td> 
    3232</tr> 
     33<tr> 
     34    <td style="padding-right:15px">${ _("Max No. of participants.")}</td> 
     35    <td class="blacktext"> 
     36        <div id="inPlaceEditNumMaxParticipants"></div> 
     37    </td> 
     38</tr> 
    3339</table> 
    3440 
     
    4349    $("#inPlaceEditAutoAccept").append($(new RemoteSwitchButton(${"false" if autoAccept else "true"}, 
    4450            Html.img({src:imageSrc("enabledSection.png")}), Html.img({src:imageSrc("disabledSection.png")}), "event.participation.autopAccept", "event.participation.autopAccept",{confId:${confId}}).draw().dom)); 
     51    $("#inPlaceEditNumMaxParticipants").append(new InputEditWidget('event.participation.setNumMaxParticipants', 
     52            {confId:${confId}}, ${ jsonEncode(numMaxParticipants) }, 0, false, null, function(value){return IndicoUtil.isInteger(value);}, '${_("The value set is not a positive number")}', '${_("Please insert a positive number or 0 for unlimited")}', 
     53            null).draw().dom); 
     54 
    4555   }); 
    4656</script> 
  • indico/MaKaC/webinterface/tpls/events/include/EventDetails.tpl

    refc9355 ra749c2  
    66% if conf.getDescription(): 
    77<tr id="eventDescription"> 
    8     <td class="leftCol">Description</td> 
     8    <td class="leftCol">${_("Description")}</td> 
    99    <td>${common.renderDescription(conf.getDescription())}</td> 
    1010</tr> 
     
    1313% if participants: 
    1414<tr id="eventParticipants"> 
    15     <td class="leftCol">Participants</td> 
     15    <td class="leftCol">${_("Participants")}</td> 
    1616    <td id="eventListParticipants">${participants}</td> 
    1717</tr> 
     
    2222    <td class="leftCol"> 
    2323    % if webcastOnAirURL: 
    24         Live Webcast 
     24        ${_("Live Webcast")} 
    2525    % elif forthcomingWebcast: 
    26         Webcast 
     26        ${_("Webcast")} 
    2727    % endif 
    2828    </td> 
    2929    <td> 
    3030    % if webcastOnAirURL: 
    31          <a href="${webcastOnAirURL}" target="_blank"><strong>View the live webcast</strong></a> 
     31         <a href="${webcastOnAirURL}" target="_blank"><strong>${_("View the live webcast")}</strong></a> 
    3232    % elif forthcomingWebcast: 
    33          Please note that this event will be available <em>live</em> via the 
    34          <a href="${forthcomingWebcastURL}" target="_blank"><strong>Webcast Service</strong>.</a> 
     33         ${_("Please note that this event will be available <em>live</em> via the")} 
     34         <a href="${forthcomingWebcastURL}" target="_blank"><strong>${_("Webcast Service")}</strong>.</a> 
    3535    % endif 
    3636    </td> 
     
    4040% if len(materials) > 0: 
    4141<tr id="materialList"> 
    42     <td class="leftCol">Material</td> 
     42    <td class="leftCol">${_("Material")}</td> 
    4343    <td> 
    4444        <div class="materialList clearfix"> 
     
    6464% if len(lectures) > 0: 
    6565<tr id="lectureLinks"> 
    66     <td class="leftCol">Other occasions</td> 
     66    <td class="leftCol">${_("Other occasions")}</td> 
    6767    <td> 
    6868    % for lecture in lectures: 
     
    7676% if registrationOpen: 
    7777<tr> 
    78     <td class="leftCol">Registration</td> 
     78    <td class="leftCol">${_("Registration")}</td> 
    7979    <td> 
    80         Want to participate? 
    81         <span class="fakeLink" id="applyLink">Apply here</span> 
     80        ${_("Want to participate?")} 
     81        <span class="fakeLink" id="applyLink">${_("Apply here")}</span> 
    8282    </td> 
    8383</tr> 
     
    8686% if evaluationLink: 
    8787<tr> 
    88     <td class="leftCol">Evaluation</td> 
    89     <td><a href="${evaluationLink}">Evaluate this event</a></td> 
     88    <td class="leftCol">${_("Evaluation")}</td> 
     89    <td><a href="${evaluationLink}">${_("Evaluate this event")}</a></td> 
    9090</tr> 
    9191% endif 
     
    9393% if conf.getOrgText(): 
    9494<tr> 
    95     <td class="leftCol">Organised by</td> 
     95    <td class="leftCol">${_("Organised by")}</td> 
    9696    <td>${conf.getOrgText()}</td> 
    9797</tr> 
Note: See TracChangeset for help on using the changeset viewer.