def find_merged_avatars(main_root):
    print cformat('%{white!}checking for merged avatars')
    avatar_id_map = {}
    for avatar in verbose_iterator(main_root['avatars'].itervalues(), len(main_root['avatars']), attrgetter('id'),
                                   lambda av: '{}, {}'.format(safe_upper(av.surName), av.name)):
        for merged_avatar in getattr(avatar, '_mergeFrom', []):
            avatar_id_map[merged_avatar.getId()] = avatar.getId()
    return avatar_id_map
Example #2
0
 def find_merged_avatars(self):
     print cformat('%{white!}checking for merged avatars')
     for avatar in verbose_iterator(
             self.zodb_root['avatars'].itervalues(),
             len(self.zodb_root['avatars']), attrgetter('id'),
             lambda av: '{}, {}'.format(safe_upper(av.surName), av.name)):
         for merged_avatar in getattr(avatar, '_mergeFrom', []):
             self.merged_avatars[merged_avatar.getId()] = avatar.getId()
Example #3
0
 def find_merged_avatars(self):
     print cformat("%{white!}checking for merged avatars")
     for avatar in verbose_iterator(
         self.zodb_root["avatars"].itervalues(),
         len(self.zodb_root["avatars"]),
         attrgetter("id"),
         lambda av: "{}, {}".format(safe_upper(av.surName), av.name),
     ):
         for merged_avatar in getattr(avatar, "_mergeFrom", []):
             self.merged_avatars[merged_avatar.getId()] = avatar.getId()
Example #4
0
 def getDisplayName(self):
     result = []
     if self._title:
         result.append(self._title)
         result.append(' ')
     result.append(safe_upper(self._familyName))
     result.append(', ')
     result.append(self._firstName)
     if self._affiliation:
         result.append(' (')
         result.append(self._affiliation)
         result.append(')')
     return ("".join(result))
Example #5
0
 def getDisplayName(self):
     result = []
     if self._title:
         result.append(self._title)
         result.append(' ')
     result.append(safe_upper(self._familyName))
     result.append(', ')
     result.append(self._firstName)
     if self._affiliation:
         result.append(' (')
         result.append(self._affiliation)
         result.append(')')
     return ("".join(result))
Example #6
0
 def getDisplayName(self, truncate=True):
     result = []
     if self._title:
         result.append(self._title)
         result.append(' ')
     result.append(safe_upper(self._familyName))
     result.append(', ')
     result.append(self._firstName)
     if self._affiliation:
         result.append(' (')
         result.append(self._affiliation)
         result.append(')')
     result = "".join(result)
     if truncate:
         return result[:31] #31 is the max length accepted by the MCU
     else:
         return result
Example #7
0
 def getDisplayName(self, truncate=True):
     result = []
     if self._title:
         result.append(self._title)
         result.append(' ')
     result.append(safe_upper(self._familyName))
     result.append(', ')
     result.append(self._firstName)
     if self._affiliation:
         result.append(' (')
         result.append(self._affiliation)
         result.append(')')
     result = "".join(result)
     if truncate:
         return result[:31]  #31 is the max length accepted by the MCU
     else:
         return result
Example #8
0
    def __init__(self, booking, user = None):
        WebcastRequestAdminNotificationBase.__init__(self, booking)

        self.setSubject("""[WebcastReq] Webcast request accepted: %s (event id: %s)"""
                        % (self._conference.getTitle(), str(self._conference.getId())))

        userInfo = ""
        if user:
            userInfo = " by %s %s" % (user.getFirstName(), safe_upper(user.getFamilyName()))
        self.setBody("""Dear Webcast Manager,<br />
<br />
A webcast request for the event: "%s" has been accepted in <a href="%s">%s</a>""" %(self._conference.getTitle(),
                                                                                    MailTools.getServerName(),
                                                                                    MailTools.getServerName())
+ userInfo + """.<br />
Click <a href="%s">here</a> to view the request.<br />

""" % (self._modifLink))
Example #9
0
    def __init__(self, booking, user=None):
        WebcastRequestAdminNotificationBase.__init__(self, booking)

        self.setSubject(
            """[WebcastReq] Webcast request accepted: %s (event id: %s)""" %
            (self._conference.getTitle(), str(self._conference.getId())))

        userInfo = ""
        if user:
            userInfo = " by %s %s" % (user.getFirstName(),
                                      safe_upper(user.getFamilyName()))
        self.setBody("""Dear Webcast Manager,<br />
<br />
A webcast request for the event: "%s" has been accepted in <a href="%s">%s</a>"""
                     % (self._conference.getTitle(), MailTools.getServerName(),
                        MailTools.getServerName()) + userInfo + """.<br />
Click <a href="%s">here</a> to view the request.<br />

""" % (self._modifLink))
Example #10
0
    def getVars( self ):
        vars = wcomponents.WTemplated.getVars( self )
        vars["title"]=self.__contrib.getTitle()
        sl = []
        if self.__contrib.getSpeakerText() != "":
            sl.append( self.__contrib.getSpeakerText() )
        for speaker in self.__contrib.getSpeakerList():
            sl.append("%s (%s)"%(speaker.getFullName(), speaker.getAffiliation()))
        vars["speakerList"] = ";<br>".join(sl)
        vars["description"] = self.__contrib.getDescription()
        owner = self.__contrib.getOwner()
        vars["place"] = ""
        location = self.__contrib.getOwnLocation()
        if location:
            vars["place"] = safe_upper(location.getName())
            if location.getAddress().strip() != "":
                vars["place"] += "(%s)"%location.getAddress()

        room = self.__contrib.getOwnRoom()
        if room:
            location = self.__contrib.getLocation()
            roomLink = linking.RoomLinker().getHTMLLink( room , location )
            if vars["place"].strip() != "":
                vars["place"] += ", "
            vars["place"] += "room: %s"%roomLink
        if vars["place"].strip() != "":
            vars["place"] = "<br>&nbsp;&nbsp;at %s"%vars["place"]
        vars["startDate"] = self.__contrib.getStartDate().strftime("%d-%b-%Y %H:%M")
        if self.__contrib.getParent().getStartDate().strftime("%Y%B%d") ==\
           self.__contrib.getParent().getEndDate().strftime("%Y%B%d"):
            if self.__contrib.getParent().getStartDate().strftime("%Y%B%d") ==\
               self.__contrib.getStartDate().strftime("%Y%B%d"):
                vars["startDate"] = self.__contrib.getStartDate().strftime("%H:%M")
        vars["endDate"] = format_date(self.__contrib.getEndDate(), format='full')
        vars["endTime"] = self.__contrib.getEndDate().strftime("%H:%M")
        vars["duration"] = (datetime(1900,1,1)+self.__contrib.getDuration()).strftime("%M'")
        if self.__contrib.getDuration()>timedelta(seconds=3600):
            vars["duration"] = (datetime(1900,1,1)+self.__contrib.getDuration()).strftime("%Hh%M'")
        vars["modifyURL"] = self.__modifyURLGen( self.__contrib )
        ml = []
        for mat in self.__contrib.getAllMaterialList():
            s = wcomponents.WMaterialDisplayItem().getHTML(self.__aw, mat, self.__materialsURLGen(mat))
            if not s:
                continue
            ml.append(s)
        if len(ml) == 0:
            vars["materials"] = ""
        else:
            vars["materials"] = "(%s)"%", ".join( ml )

        vars["materialURLGen"] = self.__materialsURLGen
        scl = []
        for sc in self.__contrib.getSubContributionList():
            s = WSubContributionMeetingDisplay(self.__aw, sc).getHTML({"modifyURL":self.__subContribModifyURLGen(sc), "materialURLGen":self.__materialsURLGen} )
            if not s:
                continue
            scl.append(s)
        if len(scl) == 0:
            vars["subConts"] = ""
        else:
            vars["subConts"] = "%s"%" ".join( scl )
        vars["modifyItem"] = ""
        if self.__contrib.canModify( self.__aw ):
            vars["modifyItem"] = """<a href="%s"><img src="%s" border="0" alt="Jump to the modification interface"></a> """%(self.__modifyURLGen( self.__contrib ), Configuration.Config.getInstance().getSystemIconURL("modify") )
        return vars
Example #11
0
 def find_merged_avatars(self):
     print cformat('%{white!}checking for merged avatars')
     for avatar in verbose_iterator(self.zodb_root['avatars'].itervalues(), len(self.zodb_root['avatars']),
                                    attrgetter('id'), lambda av: '{}, {}'.format(safe_upper(av.surName), av.name)):
         for merged_avatar in getattr(avatar, '_mergeFrom', []):
             self.merged_avatars[merged_avatar.getId()] = avatar.getId()
Example #12
0
    def getVars(self):
        vars = wcomponents.WTemplated.getVars(self)
        vars["title"] = self.__contrib.getTitle()
        sl = []
        if self.__contrib.getSpeakerText() != "":
            sl.append(self.__contrib.getSpeakerText())
        for speaker in self.__contrib.getSpeakerList():
            sl.append("%s (%s)" %
                      (speaker.getFullName(), speaker.getAffiliation()))
        vars["speakerList"] = ";<br>".join(sl)
        vars["description"] = self.__contrib.getDescription()
        owner = self.__contrib.getOwner()
        vars["place"] = ""
        location = self.__contrib.getOwnLocation()
        if location:
            vars["place"] = safe_upper(location.getName())
            if location.getAddress().strip() != "":
                vars["place"] += "(%s)" % location.getAddress()

        room = self.__contrib.getOwnRoom()
        if room:
            location = self.__contrib.getLocation()
            roomLink = linking.RoomLinker().getHTMLLink(room, location)
            if vars["place"].strip() != "":
                vars["place"] += ", "
            vars["place"] += "room: %s" % roomLink
        if vars["place"].strip() != "":
            vars["place"] = "<br>&nbsp;&nbsp;at %s" % vars["place"]
        vars["startDate"] = self.__contrib.getStartDate().strftime(
            "%d-%b-%Y %H:%M")
        if self.__contrib.getParent().getStartDate().strftime("%Y%B%d") ==\
           self.__contrib.getParent().getEndDate().strftime("%Y%B%d"):
            if self.__contrib.getParent().getStartDate().strftime("%Y%B%d") ==\
               self.__contrib.getStartDate().strftime("%Y%B%d"):
                vars["startDate"] = self.__contrib.getStartDate().strftime(
                    "%H:%M")
        vars["endDate"] = format_date(self.__contrib.getEndDate(),
                                      format='full')
        vars["endTime"] = self.__contrib.getEndDate().strftime("%H:%M")
        vars["duration"] = (datetime(1900, 1, 1) +
                            self.__contrib.getDuration()).strftime("%M'")
        if self.__contrib.getDuration() > timedelta(seconds=3600):
            vars["duration"] = (
                datetime(1900, 1, 1) +
                self.__contrib.getDuration()).strftime("%Hh%M'")
        vars["modifyURL"] = self.__modifyURLGen(self.__contrib)
        ml = []
        for mat in self.__contrib.getAllMaterialList():
            s = wcomponents.WMaterialDisplayItem().getHTML(
                self.__aw, mat, self.__materialsURLGen(mat))
            if not s:
                continue
            ml.append(s)
        if len(ml) == 0:
            vars["materials"] = ""
        else:
            vars["materials"] = "(%s)" % ", ".join(ml)

        vars["materialURLGen"] = self.__materialsURLGen
        scl = []
        for sc in self.__contrib.getSubContributionList():
            s = WSubContributionMeetingDisplay(self.__aw, sc).getHTML({
                "modifyURL":
                self.__subContribModifyURLGen(sc),
                "materialURLGen":
                self.__materialsURLGen
            })
            if not s:
                continue
            scl.append(s)
        if len(scl) == 0:
            vars["subConts"] = ""
        else:
            vars["subConts"] = "%s" % " ".join(scl)
        vars["modifyItem"] = ""
        if self.__contrib.canModify(self.__aw):
            vars[
                "modifyItem"] = """<a href="%s"><img src="%s" border="0" alt="Jump to the modification interface"></a> """ % (
                    self.__modifyURLGen(self.__contrib),
                    Configuration.Config.getInstance().getSystemIconURL(
                        "modify"))
        return vars
Example #13
0
 def getValue(cls, reg):
     res = "%s %s" % (reg.getFirstName(), safe_upper(reg.getFamilyName()))
     res = res.strip()
     return res
Example #14
0
 def getValue(cls, reg):
     res = "%s %s" % (reg.getFirstName(), safe_upper(reg.getFamilyName()))
     res = res.strip()
     return res