Changeset b7f4eee3751ed0742999d737e4cd81005f58a40b in indico


Ignore:
Timestamp:
01/20/12 15:34:52 (4 months ago)
Author:
Alberto Resco Perez <alberto.resco.perez@…>
Children:
791f15a31168da6bb2bac441f2cb1a6f370d15da
Parents:
96c522bb4f6d67ab582d9bda459e76015d874d8b
git-author:
Alberto Resco Perez <alberto.resco.perez@…> (01/20/12 15:34:52)
git-committer:
Pedro Ferreira <jose.pedro.ferreira@…> (01/24/12 11:13:41)
Message:

[FIX] Fix small bugs in the Participants interface

Location:
indico
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • indico/MaKaC/services/implementation/conference.py

    r96c522 rb7f4ee  
    750750            data["toList"] = [participant.getEmail()] 
    751751            urlInvitation = urlHandlers.UHConfParticipantsInvitation.getURL( self._conf ) 
    752             urlInvitation.addParam("participantId","%s"%id) 
     752            urlInvitation.addParam("participantId","%s"%participant.getId()) 
    753753            urlRefusal = urlHandlers.UHConfParticipantsRefusal.getURL( self._conf ) 
    754             urlRefusal.addParam("participantId","%s"%id) 
     754            urlRefusal.addParam("participantId","%s"%participant.getId()) 
    755755            data["body"] = data["body"].format(name=participant.getEmail(), confTitle=self._conf.getTitle(), url=urlHandlers.UHConferenceDisplay.getURL( self._conf ), urlRefusal=urlRefusal, urlInvitation=urlInvitation) 
    756756            GenericMailer.sendAndLog(GenericNotification(data),self._conf,"participants", self._getUser()) 
     
    776776        pm = ParameterManager(self._params) 
    777777        self._userList = pm.extract("userIds", pType=list, allowEmpty=False) 
     778 
     779    def _getWarningAlreadyAdded(self, list, typeList=""): 
     780        if len(list) == 1: 
     781            return _("""The participant identified by email %s 
     782                        is already in the %s participants' list.""")%(typeList, list[0]) 
     783        else: 
     784 
     785            return _("""The participants identified by email %s 
     786                        are already in the %s participants' list.""")%(typeList ,", ".join(list)) 
    778787 
    779788class ConferenceParticipantsDisplay(ConferenceModifBase): 
     
    916925class ConferenceAddParticipants(ConferenceParticipantBase, ConferenceParticipantListBase): 
    917926 
     927    def _addParticipant(self, participant, participation): 
     928        if not participation.addParticipant(participant, self._getUser()) : 
     929            if participation.alreadyParticipating(participant) != 0 : 
     930                self._usersParticipant.append(participant.getEmail()) 
     931            elif participation.alreadyPending(participant)!=0: 
     932                self._usersPending.append(participant.getEmail()) 
     933        else: 
     934            self._added.append(conferences.WConferenceParticipant(self._conf,participant).getHTML()) 
     935 
    918936    def _getAnswer(self): 
    919937        if self._userList == []: 
    920938            raise NoReportError(_("No users were selected to be added as participants.")) 
    921         eventManager = self._getUser() 
     939        self._usersPending = [] 
     940        self._usersParticipant = [] 
     941        self._added =[] 
    922942        participation = self._conf.getParticipation() 
    923943        result = {} 
    924944        infoWarning = [] 
    925         usersPending = [] 
    926         usersParticipant = [] 
    927         added =[] 
     945 
    928946        for user in self._userList: 
    929947            ph = PrincipalHolder() 
    930948            selected = ph.getById(int(user['id'])) 
    931949            if isinstance(selected, Avatar) : 
    932                 participant =self._generateParticipant(selected) 
    933                 if not participation.addParticipant(participant,eventManager) : 
    934                     if participation.alreadyParticipating(participant) != 0 : 
    935                         usersParticipant.append(participant.getEmail()) 
    936                     elif participation.alreadyPending(participant)!=0: 
    937                         usersPending.append(participant.getEmail()) 
    938                 else: 
    939                     added.append(conferences.WConferenceParticipant(self._conf,participant).getHTML()) 
     950                self._addParticipant(self._generateParticipant(selected), participation) 
    940951            elif isinstance(selected, Group) : 
    941952                for member in selected.getMemberList() : 
    942                     participant =self._generateParticipant(member) 
    943                     if not participation.addParticipant(participant,eventManager) : 
    944                         if participation.alreadyParticipating(participant) != 0 : 
    945                             usersParticipant.append(participant.getEmail()) 
    946                         elif participation.alreadyPending(participant)!=0: 
    947                             usersPending.append(participant.getEmail()) 
    948                     else: 
    949                         added.append(conferences.WConferenceParticipant(self._conf,participant).getHTML()) 
     953                    self._addParticipant(self._generateParticipant(member), participation) 
    950954 
    951955            else : 
    952                 participant = self._generateParticipant() 
    953                 if not participation.addParticipant(participant,eventManager) : 
    954                     if participation.alreadyParticipating(participant) != 0 : 
    955                         usersParticipant.append(participant.getEmail()) 
    956                     elif participation.alreadyPending(participant)!=0: 
    957                         usersPending.append(participant.getEmail()) 
    958                 else: 
    959                     added.append(conferences.WConferenceParticipant(self._conf,participant).getHTML()) 
    960  
    961         result["added"] = ("".join(added)).replace("\n","") 
    962         if usersPending: 
    963             if len(usersPending) == 1: 
    964                 infoWarning.append(_("""The participant identified by email %s 
    965                             is already in the pending participants' list.""")%usersPending[0]) 
    966             else: 
    967  
    968                 infoWarning.append(_("""The participants identified by email %s 
    969                             are already in the pending participants' list.""")%(", ".join(usersPending))) 
    970         if usersParticipant: 
    971             if len(usersParticipant) == 1: 
    972                 infoWarning.append(_("""The participant identified by email %s 
    973                             is already in the participants' list.""")%usersParticipant[0]) 
    974             else: 
    975  
    976                 infoWarning.append(_("""The participants identified by email %s 
    977                             are already in the participants' list.""")%(", ".join(usersParticipant))) 
     956                self._addParticipant(self._generateParticipant(), participation) 
     957 
     958        result["added"] = ("".join(self._added)).replace("\n","") 
     959        if self._usersPending: 
     960            infoWarning.append(self._getWarningAlreadyAdded(self._usersPending, "pending")) 
     961        if self._usersParticipant: 
     962            infoWarning.append(self._getWarningAlreadyAdded(self._usersParticipant)) 
    978963        if infoWarning: 
    979964            result["infoWarning"] = infoWarning 
     
    982967class ConferenceInviteParticipants(ConferenceParticipantBase, ConferenceParticipantListBase): 
    983968 
     969    def _checkParams(self): 
     970        ConferenceParticipantListBase._checkParams(self) 
     971        pm = ParameterManager(self._params) 
     972        self._emailSubject = pm.extract("subject", pType=str, allowEmpty=False) 
     973        self._emailBody = pm.extract("body", pType=str, allowEmpty=False) 
     974 
     975    def _inviteParticipant(self, participant, participation): 
     976        if not participation.inviteParticipant(participant, self._getUser()) : 
     977            if participation.alreadyParticipating(participant) != 0 : 
     978                self._usersParticipant.append(participant.getEmail()) 
     979            elif participation.alreadyPending(participant)!=0: 
     980                self._usersPending.append(participant.getEmail()) 
     981            return False 
     982        else: 
     983            self._added.append(conferences.WConferenceParticipant(self._conf,participant).getHTML()) 
     984            return True 
     985 
    984986    def _getAnswer(self): 
    985987        if self._userList == []: 
    986988            raise NoReportError(_("No users were selected to be invited as participants.")) 
    987         pm = ParameterManager(self._params) 
    988         emailSubject = pm.extract("subject", pType=str, allowEmpty=False) 
    989         emailBody = pm.extract("body", pType=str, allowEmpty=False) 
     989        self._usersPending = [] 
     990        self._usersParticipant = [] 
     991        self._added =[] 
    990992        currentUser = self._getUser() 
    991993        participation = self._conf.getParticipation() 
    992994        infoWarning = [] 
    993         usersPending = [] 
    994         usersParticipant = [] 
    995         added =[] 
     995 
    996996        result = {} 
    997997        data = {} 
    998998        if currentUser: 
    999999            data["fromAddr"] = currentUser.getEmail() 
    1000         data["subject"] = emailSubject 
    1001         data["body"] = emailBody 
     1000        data["subject"] = self._emailSubject 
     1001        data["body"] = self._emailBody 
    10021002        for user in self._userList: 
    10031003            ph = PrincipalHolder() 
     
    10051005            if isinstance(selected, Avatar) : 
    10061006                participant =self._generateParticipant(selected) 
    1007                 if not participation.inviteParticipant(participant,currentUser) : 
    1008                     if participation.alreadyParticipating(participant) != 0 : 
    1009                         usersParticipant.append(participant.getEmail()) 
    1010                     elif participation.alreadyPending(participant)!=0: 
    1011                         usersPending.append(participant.getEmail()) 
    1012                 else: 
    1013                     added.append(conferences.WConferenceParticipant(self._conf,participant).getHTML()) 
     1007                if self._inviteParticipant(participant, participation): 
    10141008                    self._sendEmailWithFormat(participant, data) 
    10151009            elif isinstance(selected, Group) : 
    10161010                for member in selected.getMemberList() : 
    10171011                    participant =self._generateParticipant(member) 
    1018                     if not participation.inviteParticipant(participant,currentUser) : 
    1019                         if participation.alreadyParticipating(participant) != 0 : 
    1020                             usersParticipant.append(participant.getEmail()) 
    1021                         elif participation.alreadyPending(participant)!=0: 
    1022                             usersPending.append(participant.getEmail()) 
    1023                     else: 
    1024                         added.append(conferences.WConferenceParticipant(self._conf,participant).getHTML()) 
     1012                    if self._inviteParticipant(participant, participation): 
    10251013                        self._sendEmailWithFormat(participant, data) 
    10261014            else : 
    10271015                participant = self._generateParticipant() 
    1028                 if not participation.inviteParticipant(participant,currentUser) : 
    1029                     if participation.alreadyParticipating(participant) != 0 : 
    1030                         usersParticipant.append(participant.getEmail()) 
    1031                     elif participation.alreadyPending(participant)!=0: 
    1032                         usersPending.append(participant.getEmail()) 
    1033                 else: 
    1034                     added.append(conferences.WConferenceParticipant(self._conf,participant).getHTML()) 
     1016                if self._inviteParticipant(participant, participation): 
    10351017                    self._sendEmailWithFormat(participant, data) 
    1036         result["added"] = ("".join(added)).replace("\n","") 
    1037         if usersPending: 
    1038             if len(usersPending) == 1: 
    1039                 infoWarning.append(_("""The participant identified by email %s 
    1040                             is already in the pending participants' list.""")%usersPending[0]) 
    1041             else: 
    1042  
    1043                 infoWarning.append(_("""The participants identified by email %s 
    1044                             are already in the pending participants' list.""")%(", ".join(usersPending))) 
    1045         if usersParticipant: 
    1046             if len(usersParticipant) == 1: 
    1047                 infoWarning.append(_("""The participant identified by email %s 
    1048                             is already in the participants' list.""")%usersParticipant[0]) 
    1049             else: 
    1050  
    1051                 infoWarning.append(_("""The participants identified by email %s 
    1052                             are already in the participants' list.""")%(", ".join(usersParticipant))) 
     1018        result["added"] = ("".join(self._added)).replace("\n","") 
     1019        if self._usersPending: 
     1020            infoWarning.append(self._getWarningAlreadyAdded(self._usersPending, "pending")) 
     1021        if self._usersParticipant: 
     1022            infoWarning.append(self._getWarningAlreadyAdded(self._usersParticipant)) 
    10531023        if infoWarning: 
    10541024            result["infoWarning"] = infoWarning 
     
    11331103        return True 
    11341104 
    1135 class ConferenceRejectPendingParticipants(ConferenceParticipantBase, ConferenceParticipantListBase): 
     1105class ConferenceRejectPendingParticipants(ConferenceParticipantListBase): 
     1106 
     1107    def _getAnswer(self): 
     1108        if self._userList == []: 
     1109            raise NoReportError(_("No pending participants were selected to be rejected.")) 
     1110        for id in self._userList: 
     1111            pending = self._conf.getParticipation().getPendingParticipantByKey(id) 
     1112            pending.setStatusDeclined() 
     1113            self._conf.getParticipation().declineParticipant(pending) 
     1114        return True 
     1115 
     1116class ConferenceRejectWithEmailPendingParticipants(ConferenceParticipantBase, ConferenceParticipantListBase): 
    11361117 
    11371118    def _getAnswer(self): 
     
    15901571    "participation.acceptPending": ConferenceAcceptPendingParticipants, 
    15911572    "participation.rejectPending": ConferenceRejectPendingParticipants, 
     1573    "participation.rejectPendingWithEmail": ConferenceRejectWithEmailPendingParticipants, 
    15921574    "protection.getAllowedUsersList": ConferenceProtectionUserList, 
    15931575    "protection.addAllowedUsers": ConferenceProtectionAddUsers, 
  • indico/MaKaC/webinterface/pages/conferences.py

    r1a8f22 rb7f4ee  
    33183318        self._tabCtrl = wcomponents.TabControl() 
    33193319 
    3320         self._tabParticipantsSetup = self._tabCtrl.newTab( "participantsetup", _("Setup"), urlHandlers.UHConfModifParticipants.getURL( self._conf ) ) 
    3321         self._tabParticipantsList = self._tabCtrl.newTab( "participantsList", _("Participants"), urlHandlers.UHConfModifParticipantsList.getURL( self._conf ) ) 
     3320        self._tabParticipantsSetup = self._tabCtrl.newTab( "participantsetup", _("Setup"), urlHandlers.UHConfModifParticipantsSetup.getURL( self._conf ) ) 
     3321        self._tabParticipantsList = self._tabCtrl.newTab( "participantsList", _("Participants"), urlHandlers.UHConfModifParticipants.getURL( self._conf ) ) 
    33223322        self._tabStatistics = self._tabCtrl.newTab("statistics", _("Statistics"), urlHandlers.UHConfModifParticipantsStatistics.getURL(self._conf)) 
    33233323        if self._conf.getParticipation().getPendingParticipantList() and nowutc() < self._conf.getStartDate(): 
  • indico/MaKaC/webinterface/rh/conferenceModif.py

    r1a8f22 rb7f4ee  
    17081708            return conferences.WPConferenceModificationClosed( self, self._target ).display() 
    17091709        else: 
    1710             return conferences.WPConfModifParticipantsSetup( self, self._target ).display() 
    1711  
    1712 class RHConfModifParticipantsList(RHConferenceModifBase): 
    1713     _uh = urlHandlers.UHConfModifParticipantsList 
     1710            return conferences.WPConfModifParticipants( self, self._target ).display() 
     1711 
     1712class RHConfModifParticipantsSetup(RHConferenceModifBase): 
     1713    _uh = urlHandlers.UHConfModifParticipantsSetup 
    17141714 
    17151715    def _process( self ): 
     
    17171717            return conferences.WPConferenceModificationClosed( self, self._target ).display() 
    17181718        else: 
    1719             return conferences.WPConfModifParticipants( self, self._target ).display() 
     1719            return conferences.WPConfModifParticipantsSetup( self, self._target ).display() 
    17201720 
    17211721class RHConfModifParticipantsPending(RHConferenceModifBase): 
  • indico/MaKaC/webinterface/tpls/ConferenceParticipants.tpl

    r9dd174 rb7f4ee  
    2222                                <li><a href="#" id="add_existing_user">${_("Existing user")}</a></li> 
    2323                                <li><a href="#" id="add_new_user">${_("New user")}</a></li> 
     24                                % if nowutc() < self_._conf.getStartDate() : 
     25                                    <li><a href="#" id="invite_users">${_("Invite")}</a></li> 
     26                                % endif 
    2427                              </ul> 
    2528                          </li> 
    26                           % if nowutc() < self_._conf.getStartDate() : 
    27                           <li class="middle"> 
    28                               <a href="#" id="invite_users">${_("Invite")}</a> 
    29                           </li> 
    30                           % endif 
    3129                          <li class="middle"> 
    3230                            <a href="#" id="remove_users">${_("Remove")}</a> 
     
    209207    }; 
    210208 
    211     var actionUsers = function(method){ 
    212         var arrayChecked=[]; 
    213         if (atLeastOneParticipantSelected()){ 
    214             $("input:checkbox:checked").each(function() { 
    215                    arrayChecked.push($(this).val()); 
    216             }); 
    217         var killProgress = IndicoUI.Dialogs.Util.progress("Processing..."); 
    218         var success = false; 
    219         jsonRpc(Indico.Urls.JsonRpcService, method, 
    220                 { confId: "${self_._conf.getId()}", 
    221                   userIds: arrayChecked }, 
    222                 function(result, error){ 
    223                     killProgress(); 
    224                     if (exists(error)) { 
    225                         IndicoUtil.errorReport(error); 
    226                     } else if(result.infoWarning){ 
    227                         (new WarningPopup($T("Warning"),result.infoWarning)).open(); 
    228                     } else if(result.emailed){ 
    229                         success = true; 
    230                         (new WarningPopup($T("Done"),result.emailed)).open(); 
    231                     } 
    232                     success = true; 
    233                 }); 
    234         return success; 
    235     }}; 
    236  
    237  
    238209    var searchUsers = function(title, handler) { 
    239210        var chooseUsersPopup = new ChooseUsersPopup(title, true, ${self_._conf.getId()}, true, 
     
    258229                            IndicoUtil.errorReport(error); 
    259230                        } else { 
    260                             $("input:checkbox:checked").parents("tr[id^=participant]").hide("highlight", {color:"#881122"}, 1500, function(){$(this).remove();checkNumberParticipants();}); 
     231                            $("input:checkbox:checked").parents("tr[id^=participant]").remove(); 
     232                            checkNumberParticipants(); 
    261233                        } 
    262234                    }); 
     
    271243                participantsChecked[$(this).val()] = $(this).parent().siblings("[id^=nameParticipant]").children("[id^=participantEdit]").text(); 
    272244            }); 
    273             var popup = new ParticipantsEmailPopup($T("Send mail to the participants"),"${conf.getTitle()}", ${conf.getId()},  
     245            var popup = new ParticipantsEmailPopup($T("Send mail to the participants"),"${conf.getTitle()}", ${conf.getId()}, 
    274246                                                   method, participantsChecked, "${currentUser.getStraightFullName()}", 
    275247                                                   null, null, legends, function() { 
    276                                                        alert($T('E-mail sent!')); 
     248                                                       (new AlertPopup($T("E-mail sent"), $T('An e-mail has been sent to ') +_.values(participantsChecked).join(", ") + ".")).open(); 
    277249                                                       deselectAll(); 
    278250                                                   }); 
     
    283255 
    284256    var manageAttendance = function(method, target, type){ 
    285         if(actionUsers(method) == true) { 
    286             $('input:checkbox:checked[id^=checkParticipant]').parent().siblings("td[id^="+target+"]").text(type); 
    287             $('input:checkbox:checked[id^=checkParticipant]').parents('tr[id^=participant]').effect("highlight", {}, 1500, deselectAll()); 
     257        var arrayChecked=[]; 
     258        if (atLeastOneParticipantSelected()){ 
     259            $("input:checkbox:checked").each(function() { 
     260                   arrayChecked.push($(this).val()); 
     261            }); 
     262        var killProgress = IndicoUI.Dialogs.Util.progress("Processing..."); 
     263        jsonRpc(Indico.Urls.JsonRpcService, method, 
     264                { confId: "${self_._conf.getId()}", 
     265                  userIds: arrayChecked }, 
     266                function(result, error){ 
     267                    killProgress(); 
     268                    if (exists(error)) { 
     269                        IndicoUtil.errorReport(error); 
     270                    } else { 
     271                        $('input:checkbox:checked[id^=checkParticipant]').parent().siblings("td[id^="+target+"]").text(type); 
     272                        $('input:checkbox:checked[id^=checkParticipant]').parents('tr[id^=participant]').effect("highlight", {}, 1500, deselectAll()); 
     273                    } 
     274                }); 
    288275        } 
    289276        return false; 
     
    301288    $('#add_new_user').bind('menu_select', function() { 
    302289        var onSuccess = function(result){ 
    303             $(result).insertAfter($("#headParticipants")).effect("highlight", {}, 3000); 
     290            $(result).insertAfter($("#headParticipants")).filter("tr[id^=participant]").effect("highlight",{},3000) 
    304291            actionParticipantRows(); 
    305292            checkNumberParticipants(); 
  • indico/MaKaC/webinterface/tpls/ConferenceParticipantsPending.tpl

    r96c522 rb7f4ee  
    130130 
    131131    var pendingHandler = function(){ 
    132         $('input:checkbox:checked[id^=checkPending]').parents('tr[id^=pending]').hide("highlight", {color:"#881122"}, 1500, function(){ 
    133             $(this).remove(); 
    134             checkNumberPending(); 
    135             }); 
     132        $('input:checkbox:checked[id^=checkPending]').parents('tr[id^=pending]').remove(); 
     133        checkNumberPending(); 
    136134    }; 
    137135 
     
    142140                   arrayChecked.push($(this).val()); 
    143141            }); 
     142 
    144143        var killProgress = IndicoUI.Dialogs.Util.progress("Processing..."); 
    145144        jsonRpc(Indico.Urls.JsonRpcService, method, 
     
    168167            var legends = {'confTitle':$T('field containing the conference title. (This field is mandatory)'), 
    169168                           'name':$T('field containing the full name of the participant.(This field is mandatory)')}; 
    170             var popup = new ParticipantsEmailPopup($T("Send mail to the participants"),"${conf.getTitle()}", ${conf.getId()}, 'event.participation.rejectPending', participantsChecked, '${currentUser.getStraightFullName()}' ,subject, body, legends, pendingHandler); 
     169            var popup = new ParticipantsEmailPopup($T("Send mail to the participants"),"${conf.getTitle()}", ${conf.getId()}, 'event.participation.rejectPendingWithEmail', participantsChecked, '${currentUser.getStraightFullName()}' ,subject, body, legends, pendingHandler); 
    171170            popup.open(); 
    172171        } 
  • indico/MaKaC/webinterface/urlHandlers.py

    r1a8f22 rb7f4ee  
    15981598    _relativeURL = "confModifDisplay.py/savePic" 
    15991599 
    1600 class UHConfModifParticipantsList( URLHandler ): 
    1601     _relativeURL = "confModifParticipants.py/list" 
     1600class UHConfModifParticipantsSetup( URLHandler ): 
     1601    _relativeURL = "confModifParticipants.py/setup" 
    16021602 
    16031603class UHConfModifParticipantsPending( URLHandler ): 
  • indico/htdocs/confModifParticipants.py

    r1a8f22 rb7f4ee  
    2626    return conferenceModif.RHConfModifParticipants( req ).process( params ) 
    2727 
    28 def list ( req, **params ): 
    29     return conferenceModif.RHConfModifParticipantsList( req ).process( params ) 
     28def setup ( req, **params ): 
     29    return conferenceModif.RHConfModifParticipantsSetup( req ).process( params ) 
    3030 
    3131def pendingParticipants( req, **params ): 
  • indico/htdocs/js/indico/Display/Dialogs.js

    r9f657d rb7f4ee  
    3131                 [$T('First Name'), $B(self.parameterManager.add(Html.edit({style: {width: '200px'}}), 'text', false), self.userData.accessor('name'))], 
    3232                 [$T('Affiliation'), $B(Html.edit({style: {width: '200px'}}), self.userData.accessor('affiliation'))], 
    33                  [$T('Email'),  $B(self.parameterManager.add(Html.edit({style: {width: '200px'}}), 'email', true), self.userData.accessor('email'))], 
     33                 [$T('Email'),  $B(self.parameterManager.add(Html.edit({style: {width: '200px'}}), 'email', false), self.userData.accessor('email'))], 
    3434                 [$T('Address'), $B(Html.textarea({style: {width: '200px'}}), self.userData.accessor('address'))], 
    3535                 [$T('Telephone'), $B(Html.edit({style: {width: '150px'}}), self.userData.accessor('phone'))], 
Note: See TracChangeset for help on using the changeset viewer.