예제 #1
0
 def _newParticipant(self, a):
     part = conference.ContributionParticipation()
     part.setTitle(a.getTitle())
     part.setFirstName(a.getName())
     part.setFamilyName(a.getSurName())
     part.setAffiliation(a.getOrganisation())
     part.setEmail(a.getEmail())
     part.setAddress(a.getAddress())
     part.setPhone(a.getTelephone())
     part.setFax(a.getFax())
     if self._kindOfList == "prAuthor":
         self._contribution.addPrimaryAuthor(part)
     elif self._kindOfList == "coAuthor":
         self._contribution.addCoAuthor(part)
     elif self._kindOfList == "speaker":
         self._contribution.newSpeaker(part)
예제 #2
0
 def _newParticipant(self):
     part = conference.ContributionParticipation()
     part.setTitle(self._userData.get("title", ""))
     part.setFirstName(self._userData.get("firstName", ""))
     part.setFamilyName(self._userData.get("familyName", ""))
     part.setAffiliation(self._userData.get("affiliation", ""))
     part.setEmail(self._userData.get("email", ""))
     part.setAddress(self._userData.get("address", ""))
     part.setPhone(self._userData.get("phone", ""))
     part.setFax(self._userData.get("fax", ""))
     if self._kindOfList == "prAuthor":
         self._contribution.addPrimaryAuthor(part)
     elif self._kindOfList == "coAuthor":
         self._contribution.addCoAuthor(part)
     elif self._kindOfList == "speaker":
         self._contribution.newSpeaker(part)
     #If the participant needs to be given submission rights
     if self._userData.get("submission", False):
         if self._userData.get("email", "") == "":
             raise ServiceAccessError(_("It is necessary to enter the email of the %s if you want to add him as submitter.") % self._kindOfList)
         self._contribution.grantSubmission(part)
예제 #3
0
def addTalksToSession(s, ses, slot):
    ct = agenda.cursor(
    )  #creates a cursor and gets all the Talks associated with this session
    ct.execute("select * from TALK where ids = \'" + s[1] + "\' and ida = \'" +
               s[0] + "\'")
    t = ct.fetchone()  #selects the first talk from the list
    #t[0]-ida, t[1]-ids, t[2]-idt, t[3]-ttitle, t[4]-tspeaker, t[5]-tday, t[6]-tcomment, t[7]-location
    #t[8]-bld, t[9]-floor, t[10]-room, t[11]-broadcasturl, t[12]-type, t[13]-cd, t[14]-md, t[15]-category
    #t[16]-stime, t[17]-repno, t[18]-affiliation, t[19]-duration, t[20]-email
    while t != None:  #if there is another talk
        if t[5] != None:
            if t[12] == 2:  #if talk is of type break
                br = schedule.BreakTimeSchEntry()
                br.setTitle(t[3])  #sets the break details
                br.setDescription(t[6])
                br.setColor("#90C0F0")
                br.setStartDate(
                    datetime(t[5].year, t[5].month, t[5].day,
                             int(t[16].seconds / 3600),
                             int((t[16].seconds % 3600) / 60), 2))
                try:
                    br.setDuration(int(t[19].seconds / 3600),
                                   int((t[19].seconds % 3600) / 60))
                except Exception, e:
                    log("error setting break end time %s-%s-%s: %s" %
                        (t[0], t[1], t[2], e))
                    #get_transaction().abort()
                slot.getSchedule().addEntry(br, 2)  #create a new break
                slot.getSchedule().reSchedule()
            else:
                talk = ses.newContribution(
                    id="%s%s" %
                    (t[1], t[2]))  #adds a contribution to the session
                if t[15] != '':
                    title = "<b>%s</b><br>%s" % (t[15], t[3])
                else:
                    title = t[3]
                talk.setTitle(title)  #sets the contribution details
                talk.setDescription(t[6])
                #talk.setCategory(t[15]) #sets category header for talks.  Mainly used in seminars for the week of.  Not in MaKaC
                if t[7] != "0--":
                    loc = conference.CustomLocation()
                    loc.setName(t[7])
                #get_transaction().commit()
                pw = genPW()  #generates random password
                if t[4] == None:
                    username = ''
                else:
                    username = t[4]
                if t[20] == None:
                    uemail = ''
                else:
                    uemail = t[20]
                if t[18]:
                    aff = t[18]
                else:
                    aff = ''
                if username == '' or uemail == '' or username.count(
                        " "
                ) >= max_white_space_in_names:  #if not full user details exist
                    if username != '' or uemail != '':
                        if username != '':
                            speakertext = username
                        else:
                            speakertext = uemail
                        if uemail != '':
                            speakertext = "<a href=\"mailto:%s\">%s</a>" % (
                                uemail, speakertext)
                        if aff != '':
                            speakertext = "%s (%s)" % (speakertext, aff)
                        talk.setSpeakerText(speakertext)
                else:
                    speaker = getUser(
                        username, uemail, aff,
                        pw)  #creates a user representing the speaker
                    part = conference.ContributionParticipation()
                    part.setDataFromAvatar(speaker)
                    talk.addPrimaryAuthor(part)
                    talk.addSpeaker(part)  #and adds the user to the list
                if t[10] != "0--":
                    talk.setLocation(loc)
                    loc = conference.CustomRoom()
                    loc.setName(t[10])
                    talk.setRoom(loc)
                if t[5] != None:
                    talk.setStartDate(
                        datetime(t[5].year, t[5].month, t[5].day,
                                 int(t[16].seconds / 3600),
                                 int((t[16].seconds % 3600) / 60)), 2)
                talk.setDuration(t[19].seconds / 3600,
                                 (t[19].seconds % 3600) / 60)
                #gets the files associated with this talk
                cf.execute(
                    "select * from FILE, FILE_EVENT where FILE.id = fileID and eventID = \'"
                    + t[0] + t[1] + t[2] + "\'")
                f = cf.fetchone()
                while f != None:
                    type = f[2]
                    if type == "minutes":
                        mi = talk.getMinutes()
                        if not mi:
                            mi = talk.createMinutes()
                        if f[5] == t[0] + t[1] + t[2] + ".txt":
                            getMinutes(mi, f)
                        else:
                            getFiles(mi, f)
                    else:
                        list = talk.getMaterialList()
                        found = 0
                        #if type in list get existing material
                        for i in list:
                            if i.getTitle() == type:
                                found = 1
                                mat = i
                        if found:
                            getFiles(mat, f)  #add resources to material
                        else:  #if not then create new material with name 'type'
                            mat = conference.Material()
                            mat.setTitle(type)
                            talk.addMaterial(mat)
                            getFiles(mat, f)  #add resources to material
                    f = cf.fetchone()  #get next file/resource
                getSubTalks(
                    t,
                    talk)  #call to the function which would map the subtalks
                sch = slot.getSchedule()
                try:
                    sch.addEntry(talk.getSchEntry(), 2)
                except Exception, e:
                    log("%s-%s-%s: %s" % (t[0], t[1], t[2], e))