Changeset bdcdee in indico


Ignore:
Timestamp:
08/15/11 09:31:14 (22 months ago)
Author:
Pedro Ferreira <jose.pedro.ferreira@…>
Branches:
master, hello-world-walkthrough, ipv6, v0.98-series, v0.98.2, v0.98.3, v0.98b2, v0.99, 051b2622c51afb171a1dedb46a0df4fbb0cbd02e, 0da0c1403bae8e51d8229f460181c71b9e6dda72
Children:
9890af
Parents:
efefcc
git-author:
Adrian Moennich <jerome.ernst.monnich@…> (04/29/11 11:13:30)
git-committer:
Pedro Ferreira <jose.pedro.ferreira@…> (08/15/11 09:31:14)
Message:

[IMP] Use general section form for personal data

Location:
indico
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • indico/MaKaC/registration.py

    rd6c8f0 rbdcdee  
    4545 
    4646import string 
     47from MaKaC.webinterface.common.person_titles import TitlesRegistry 
    4748 
    4849PRICE_PATTERN = re.compile(r'^(\d+(?:[\.]\d+)?)$') 
     
    9192        #Multiple-Subforms 
    9293        self.personalData = PersonalData() 
     94        self.personalDataNew = PersonalDataForm(self) 
    9395        #Simple-SubForms 
    9496        self.sessionsForm = SessionsForm() 
     
    100102        self._generalSectionGenerator = Counter() 
    101103        self.generalSectionForms={} 
     104        self.addGeneralSectionForm(self.personalDataNew, True) 
    102105        #All SortedForms 
    103106        self._sortedForms=[] 
     107        self.addToSortedForms(self.personalDataNew) 
    104108        self.addToSortedForms(self.reasonParticipationForm) 
    105109        self.addToSortedForms(self.sessionsForm) 
     
    411415        return self.personalData 
    412416 
     417    def getPersonalDataNew(self): 
     418        return self.personalDataNew 
     419 
    413420    def getFurtherInformationForm(self): 
    414421        return self.furtherInformation 
     
    461468        return self.getGeneralSectionForms().values() 
    462469 
    463     def addGeneralSectionForm(self, gsf): 
     470    def addGeneralSectionForm(self, gsf, preserveTitle=False): 
    464471        id = str(self._getGeneralSectionGenerator().newCount()) 
    465472        while self.getGeneralSectionFormById(id) != None: 
    466473            id = str(self._getGeneralSectionGenerator().newCount()) 
    467474        gsf.setId( id ) 
    468         gsf.setTitle(  _("Miscellaneous information %s")%gsf.getId()) 
     475        if not preserveTitle: 
     476            gsf.setTitle(  _("Miscellaneous information %s")%gsf.getId()) 
    469477        self.generalSectionForms[gsf.getId()]=gsf 
    470478        self.addToSortedForms(gsf) 
     
    709717        return body 
    710718 
    711     def _getPDInfoText(self, regForm, rp): 
    712         personalData = regForm.getPersonalData() 
    713         sortedKeys = personalData.getSortedKeys() 
    714         text = "" 
    715         for key in sortedKeys: 
    716             pdfield = personalData.getDataItem(key) 
    717             fieldTitle = pdfield.getName() 
    718             fieldValue = "" 
    719             if key == "title": 
    720                 fieldValue = rp.getTitle() 
    721             elif key == "firstName": 
    722                 fieldValue = rp.getFirstName() 
    723             elif key == "surname": 
    724                 fieldValue = rp.getFamilyName() 
    725             elif key == "position": 
    726                 fieldValue = rp.getPosition() 
    727             elif key == "institution": 
    728                 fieldValue = rp.getInstitution() 
    729             elif key == "address": 
    730                 fieldValue = rp.getAddress() 
    731             elif key == "city": 
    732                 fieldValue = rp.getCity() 
    733             elif key == "country": 
    734                 fieldValue = rp.getCountry() 
    735             elif key == "phone": 
    736                 fieldValue = rp.getPhone() 
    737             elif key == "email": 
    738                 fieldValue = rp.getEmail() 
    739             elif key == "fax": 
    740                 fieldValue = rp.getFax() 
    741             elif key == "personalHomepage": 
    742                 fieldValue = rp.getPersonalHomepage() 
    743             if pdfield.isEnabled(): 
    744                 text += """\n%s: %s""" % (_(fieldTitle), fieldValue) 
    745         return text 
    746  
    747719    def createEmailNewRegistrant(self, regForm, rp): 
    748720        """ 
     
    763735        body = i18nformat(""" 
    764736_("Event"): %s 
    765 _("Registrant Id"): %s%s 
     737_("Registrant Id"): %s 
    766738%s 
    767739""") % (url, rp.getId(), \ 
    768                      self._getPDInfoText(regForm, rp), \ 
    769740                     self._printAllSections(regForm, rp)) 
    770741 
     
    10691040        return "*genfield*%s-%s"%(self.getParent().getParent().getId(), self.getParent().getId()) 
    10701041 
    1071     def getModifHTML(self, item, registrant): 
     1042    def getModifHTML(self, item, registrant, default=""): 
    10721043        """ 
    10731044        Method that display the form web which represents this object. 
     
    10761047        if (item is not None and item.isMandatory())or self.getParent().isMandatory(): 
    10771048            mandatory = """<td class="beforeRegistrationInput" valign="top"><font color="red">*</font></td>""" 
    1078         return "<table><tr>%s%s</tr></table>"%(mandatory, self._getModifHTML(item, registrant)) 
    1079  
    1080     def _getModifHTML(self,item, registrant): 
     1049        return "<table><tr>%s%s</tr></table>"%(mandatory, self._getModifHTML(item, registrant, default)) 
     1050 
     1051    def _getModifHTML(self,item, registrant, default=""): 
    10811052        """ 
    10821053        Method that should be overwritten by the classes inheriting from this one in order to display 
     
    11571128        self._length = '' 
    11581129 
    1159     def _getModifHTML(self,item, registrant): 
     1130    def _getModifHTML(self, item, registrant, default=""): 
    11601131        caption = self._parent.getCaption() 
    11611132        description = self._parent.getDescription() 
     
    11641135        currency=self._parent.getParent().getRegistrationForm().getCurrency() 
    11651136        htmlName=self.getHTMLName() 
    1166         v="" 
     1137        v=default 
    11671138        if item is not None: 
    11681139            v=item.getValue() 
     
    12581229        self._length = '' 
    12591230 
    1260     def _getModifHTML(self, item, registrant): 
     1231    def _getModifHTML(self, item, registrant, default=""): 
    12611232        caption = self._parent.getCaption() 
    12621233        description = self._parent.getDescription() 
    12631234        htmlName = self.getHTMLName() 
    12641235 
    1265         v = "" 
     1236        v = default 
    12661237        if item is not None: 
    12671238            v = item.getValue() 
     
    13521323        self._numberOfColumns = '' 
    13531324 
    1354     def _getModifHTML(self,item, registrant): 
     1325    def _getModifHTML(self, item, registrant, default=""): 
    13551326        caption = self._parent.getCaption() 
    13561327        description = self._parent.getDescription() 
     
    13591330        currency=self._parent.getParent().getRegistrationForm().getCurrency() 
    13601331        htmlName=self.getHTMLName() 
    1361         v="" 
     1332        v=default 
    13621333        if item is not None: 
    13631334            v=item.getValue() 
     
    14781449        self._minValue = 0 
    14791450 
    1480     def _getModifHTML(self,item, registrant): 
     1451    def _getModifHTML(self,item, registrant, default=""): 
    14811452        caption = self._parent.getCaption() 
    14821453        description = self._parent.getDescription() 
     
    14851456        currency=self._parent.getParent().getRegistrationForm().getCurrency() 
    14861457        htmlName=self.getHTMLName() 
    1487         v="0" 
     1458        v=default or "0" 
    14881459        if item is not None: 
    14891460            v=item.getValue() 
     
    16261597    getName=classmethod(getName) 
    16271598 
    1628     def _getModifHTML(self,item, registrant): 
     1599    def _getModifHTML(self, item, registrant, default=""): 
    16291600        caption = self._parent.getCaption() 
    16301601        description = self._parent.getDescription() 
     
    16331604        currency=self._parent.getParent().getRegistrationForm().getCurrency() 
    16341605        htmlName=self.getHTMLName() 
    1635         v="" 
     1606        v=default 
    16361607        if item is not None: 
    16371608            v=item.getValue() 
     
    16831654    getName=classmethod(getName) 
    16841655 
    1685     def _getModifHTML(self, item,registrant): 
     1656    def _getModifHTML(self, item, registrant, default=""): 
    16861657        disable="" 
    16871658        checked="" 
     
    16921663        currency = self._parent.getParent().getRegistrationForm().getCurrency() 
    16931664        htmlName = self.getHTMLName() 
    1694         v = "" 
     1665        v = default 
    16951666        quantity = 0 
    16961667        if item is not None: 
     
    17541725    getName=classmethod(getName) 
    17551726 
    1756     def _getModifHTML(self,item, registrant): 
     1727    def _getModifHTML(self, item, registrant, default=""): 
    17571728        caption = self._parent.getCaption() 
    17581729        description = self._parent.getDescription() 
     
    17621733        htmlName=self.getHTMLName() 
    17631734        caption=self._parent.getCaption() 
    1764         v="" 
     1735        v=default 
    17651736        if item is not None: 
    17661737            v=item.getValue() 
     
    19851956        self._defaultItem=None 
    19861957        self._inputType = "radiogroup" 
     1958        self._emptyCaption = '-- Choose a value --' 
    19871959 
    19881960    def getValues(self): 
     
    19991971        d["defaultItem"]=self.getDefaultItem() 
    20001972        d["inputType"] = self.getInputType() 
     1973        d["emptyCaption"] = self.getEmptyCaption() 
    20011974        return d 
    20021975 
     
    20091982                ri=RadioItem(self) 
    20101983                ri.setCaption(c["caption"]) 
    2011                 ri.setBillable(c["billable"]) 
    2012                 ri.setPrice(c["price"]) 
    2013                 ri.setEnabled(c["isEnabled"]) 
     1984                ri.setBillable(c.get("billable", False)) 
     1985                ri.setPrice(c.get("price", "")) 
     1986                ri.setEnabled(c.get("isEnabled", True)) 
    20141987                ri.setPlacesLimit(c.get("placesLimit")) 
    20151988                self.addItem(ri) 
     
    20181991        if data.has_key("inputType"): 
    20191992            self._inputType = data.get("inputType") 
     1993        if data.has_key("emptyCaption"): 
     1994            self._emptyCaption = data["emptyCaption"] 
    20201995 
    20211996    def _beforeValueChange(self, item, newItem): 
     
    21262101        return self._radioItemGenerator 
    21272102 
    2128     def _getRadioGroupModifHTML(self, item, registrant): 
     2103    def getEmptyCaption(self): 
     2104        try: 
     2105            return self._emptyCaption 
     2106        except: 
     2107            self._emptyCaption = '-- Choose a value --' 
     2108            return self._emptyCaption 
     2109 
     2110    def _getRadioGroupModifHTML(self, item, registrant, default=""): 
    21292111        caption = self._parent.getCaption() 
    21302112        description = self._parent.getDescription() 
     
    21322114        billable=self._parent.isBillable() 
    21332115        currency=self._parent.getParent().getRegistrationForm().getCurrency() 
    2134         value = "" 
     2116        value = default 
    21352117        if item is not None: 
    21362118            billable = item.isBillable() 
     
    21852167        return "".join(tmp) 
    21862168 
    2187     def _getDropDownModifHTML(self, item, registrant): 
     2169    def _getDropDownModifHTML(self, item, registrant, default=""): 
    21882170        caption = self._parent.getCaption() 
    21892171        description = self._parent.getDescription() 
    21902172        billable = self._parent.isBillable() 
    21912173        currency = self._parent.getParent().getRegistrationForm().getCurrency() 
    2192         value = "" 
     2174        value = default 
    21932175        if item is not None: 
    21942176            billable = item.isBillable() 
     
    22112193        tmp.append("""<td><select id="%s" name="%s">""" % (self.getHTMLName(), self.getHTMLName())) 
    22122194 
    2213         tmp.append("""<option value="">-- Choose a value --</option>""") 
     2195        tmp.append("""<option value="">%s</option>""" % self.getEmptyCaption()) 
    22142196 
    22152197        for radioItem in self.getItemsList(): 
     
    22442226        return "".join(tmp) 
    22452227 
    2246     def _getModifHTML(self, item, registrant): 
     2228    def _getModifHTML(self, item, registrant, default=""): 
    22472229        if self.getInputType() == 'radiogroup': 
    2248             return self._getRadioGroupModifHTML(item, registrant) 
     2230            return self._getRadioGroupModifHTML(item, registrant, default) 
    22492231        else: 
    2250             return self._getDropDownModifHTML(item, registrant) 
     2232            return self._getDropDownModifHTML(item, registrant, default) 
    22512233 
    22522234    def _setResponseValue(self, item, params, registrant): 
     
    23782360        return CountryHolder().getCountryById(value) 
    23792361 
    2380     def _getModifHTML(self, item, registrant): 
     2362    def _getModifHTML(self, item, registrant, default=""): 
    23812363        caption = self._parent.getCaption() 
    23822364        description = self._parent.getDescription() 
    23832365        htmlName = self.getHTMLName() 
    2384         value = "" 
     2366        value = default 
    23852367        if item is not None: 
    23862368            value = item.getValue() 
     
    24562438        return "_genfield_%s_%s_" % (self.getParent().getParent().getId(), self.getParent().getId()) 
    24572439 
    2458     def _getModifHTML(self, item, registrant): 
     2440    def _getModifHTML(self, item, registrant, default=""): 
    24592441        caption = self._parent.getCaption() 
    24602442        description = self._parent.getDescription() 
     
    24632445            htmlName = item.getHTMLName() 
    24642446        else: 
    2465             date = None 
     2447            date = default or None 
    24662448            htmlName = self.getHTMLName() 
    24672449 
     
    25742556            self._input.setValues(data) 
    25752557            self._mandatory = False 
     2558            self._locked = () 
    25762559            self._description = "" 
    25772560            self._billable =False 
     
    25792562            self._placesLimit = 0 
    25802563            self._currentNoPlaces = 0 
     2564            self._disabled = True 
     2565            self._pdField = None 
    25812566        else: 
    2582             self.setValues(data) 
     2567            self._mandatory = False 
     2568            self.setValues(data, True) 
    25832569 
    25842570    def clone(self, newsection): 
     
    25862572        return field 
    25872573 
    2588     def setValues(self, data): 
     2574    def setValues(self, data, firstTime=False): 
    25892575        caption=data.get("caption","") 
    25902576        if caption=="": 
    25912577            caption= _("General Field") 
    25922578        self.setCaption(caption) 
    2593         self.setInput(FieldInputs.getAvailableInputKlassById(data.get("input","text"))(self)) 
     2579        if firstTime or not self.isLocked('input'): 
     2580            self.setInput(FieldInputs.getAvailableInputKlassById(data.get("input","text"))(self)) 
    25942581        if data.has_key("inputObj"): 
    25952582            self._input.setValues(data["inputObj"].getValues()) 
     2583        elif data.has_key('inputValues'): 
     2584            self._input.setValues(data["inputValues"]) 
    25962585        else: 
    25972586            self._input.setValues(data) 
    2598         self.setMandatory(data.has_key("mandatory") and data["mandatory"]) 
     2587        if firstTime: 
     2588            self.setLocked(data.get("lock", ())) 
     2589        if self.isMandatory() and self.isLocked('mandatory'): 
     2590            self.setMandatory(True) 
     2591        else: 
     2592            self.setMandatory(data.has_key("mandatory") and data["mandatory"]) 
     2593        if self.isLocked('disable'): 
     2594            self.setDisabled(False) 
     2595        else: 
     2596            self.setDisabled(data.has_key("disabled") and data["disabled"]) 
    25992597        self.setBillable(data.has_key("billable") and data["billable"]) 
    26002598        self.setPrice(data.get("price","")) 
    26012599        self.setPlacesLimit(data.get("placesLimit", "0")) 
    26022600        self.setDescription(data.get("description","")) 
     2601        if firstTime: 
     2602            self.setPDField(data.get("pd")) 
    26032603 
    26042604    def getValues(self): 
     
    26072607        values["input"] = self.getInput().getId() 
    26082608        values["inputObj"] = self.getInput() 
     2609        values["lock"] = self.getLocked() 
    26092610        values["mandatory"] = self.isMandatory() 
     2611        values["disabled"] = self.isDisabled() 
    26102612        values["billable"]=self.isBillable() 
    26112613        values["price"]=self.getPrice() 
    26122614        values["placesLimit"] = self.getPlacesLimit() 
    26132615        values["description"]=self.getDescription() 
     2616        values["pd"] = self.getPDField() 
    26142617        return values 
    26152618 
    26162619    def isTemporary(self): 
    26172620        return False 
     2621 
     2622    def setPDField(self, v): 
     2623        self._pdField = v 
     2624 
     2625    def getPDField(self): 
     2626        try: 
     2627            return self._pdField 
     2628        except: 
     2629            self._pdField = None 
     2630            return self._pdField 
    26182631 
    26192632    def isBillable(self): 
     
    27282741        self._mandatory = v 
    27292742 
     2743    def getLocked(self): 
     2744        try: 
     2745            return self._locked 
     2746        except: 
     2747            self._locked = () 
     2748            return self._locked 
     2749 
     2750    def isLocked(self, what): 
     2751        return what in self.getLocked() 
     2752 
     2753    def setLocked(self, v): 
     2754        self._locked = v 
     2755 
     2756    def isDisabled(self): 
     2757        try: 
     2758            return self._disabled 
     2759        except: 
     2760            self._disabled = False 
     2761            return self._disabled 
     2762 
     2763    def setDisabled(self, v): 
     2764        self._disabled = v 
     2765 
    27302766    def getParent(self): 
    27312767        return self._parent 
     
    27422778class GeneralSectionForm(BaseForm): 
    27432779 
    2744     def __init__(self, regForm, data=None): 
     2780    def __init__(self, regForm, data=None, required=False): 
    27452781        BaseForm.__init__(self) 
    27462782        self._regForm=regForm 
     
    27482784        self._title = _("Miscellaneous information") 
    27492785        self._description = "" 
     2786        self._required = required 
    27502787 
    27512788        ##### 
     
    27662803        self.setTitle(title) 
    27672804        self.setDescription(data.get("description", "")) 
     2805        if 'required' in data: 
     2806            self.setRequired(data['required']) 
    27682807 
    27692808    def getValues(self): 
     
    27722811        values["description"] = self.getDescription() 
    27732812        values["enabled"] = self.isEnabled() 
     2813        values["required"] = self.isRequired() 
    27742814        return values 
    27752815 
     
    27792819        gsf.setValues(self.getValues()) 
    27802820        gsf.setEnabled(self.isEnabled()) 
     2821        gsf.setRequired(self.isRequired()) 
    27812822 
    27822823        #Mods to support sorting fields 
     
    28122853    def setDescription(self, n): 
    28132854        self._description = n 
     2855 
     2856    def isRequired(self): 
     2857        try: 
     2858            return self._required 
     2859        except: 
     2860            self._required = False 
     2861            return False 
     2862 
     2863    def setRequired(self, required): 
     2864        self._required = required 
    28142865 
    28152866    ########### 
     
    28822933        self._p_changed=1 
    28832934 
    2884 class PersonalDataFormItem(Persistent): 
     2935class PersonalDataForm(GeneralSectionForm): 
     2936    def __init__(self, regForm): 
     2937        GeneralSectionForm.__init__(self, regForm, {'title': 'Personal Data (New)'}, True) 
     2938 
     2939        fields = ( 
     2940            { 'pd': 'title', 
     2941              'caption': 'Title', 
     2942              'input': 'radio', 
     2943              'inputValues': { 
     2944                  'inputType':'dropdown', 
     2945                  'emptyCaption': '', 
     2946                  'radioitems': [{'caption':title} for title in TitlesRegistry.getList()[1:]] 
     2947              }, 
     2948              'lock': ('input', 'delete') 
     2949            }, 
     2950            { 'pd':'firstName', 'caption':'First Name', 'mandatory':True, 'lock':('mandatory', 'input', 'delete', 'disable') }, 
     2951            { 'pd':'surname', 'caption':'Surname', 'mandatory':True, 'lock':('mandatory', 'input', 'delete', 'disable') }, 
     2952            { 'pd':'position', 'caption':'Position', 'lock':('input', 'delete') }, 
     2953            { 'pd':'institution', 'caption':'Institution', 'mandatory':True, 'lock':('input', 'delete') }, 
     2954            { 'pd':'address', 'caption':'Address', 'lock':('input', 'delete') }, 
     2955            { 'pd':'city', 'caption':'City', 'mandatory':True, 'lock':('input', 'delete') }, 
     2956            { 'pd':'country', 'caption':'Country', 'input':'country', 'mandatory':True, 'lock':('input', 'delete') }, 
     2957            { 'pd':'phone', 'caption':'Phone', 'lock':('input', 'delete') }, 
     2958            { 'pd':'fax', 'caption':'Fax', 'lock':('input', 'delete') }, 
     2959            { 'pd':'email', 'caption':'Email', 'mandatory':True, 'lock':('mandatory', 'input', 'delete', 'disable') }, 
     2960            { 'pd':'personalHomepage', 'caption':'Personal homepage', 'lock':('input', 'delete') }, 
     2961        ) 
     2962 
     2963        self._pdMap = {} 
     2964        for fieldInfo in fields: 
     2965            field = GeneralField(self, fieldInfo) 
     2966            self._pdMap[fieldInfo['pd']] = field 
     2967            self.addToSortedFields(field) 
     2968 
     2969    def getValueFromParams(self, params, field): 
     2970        return params.get(self._pdMap[field].getInput().getHTMLName()) 
     2971 
     2972    def getField(self, field): 
     2973        return self._pdMap[field] 
     2974 
     2975    def getValues(self, registrant): 
     2976        mg = registrant.getMiscellaneousGroupById(self.getId()) 
     2977        return dict((name, mg.getResponseItemById(field.getId()).getValue()) for name, field in self._pdMap.iteritems()) 
     2978 
     2979    def getValuesFromAvatar(self, av): 
     2980        r = {} 
     2981        r['title'] = '' 
     2982        r['firstName'] = '' 
     2983        r['surname'] = '' 
     2984        r['institution'] = '' 
     2985        r['email'] = '' 
     2986        r['address'] = '' 
     2987        r['phone'] = '' 
     2988        r['fax'] = '' 
     2989        if av is not None: 
     2990            r['title'] = av.getTitle() 
     2991            r['firstName'] = av.getFirstName() 
     2992            r['surname'] = av.getFamilyName() 
     2993            r['institution'] = av.getOrganisation() 
     2994            r['email'] = av.getEmail() 
     2995            r['address'] = av.getAddress() 
     2996            r['phone'] = av.getTelephone() 
     2997            faxes = av.getFaxes() 
     2998            fax = '' 
     2999            if len(faxes)>0: 
     3000                fax = faxes[0] 
     3001            r['fax'] = fax 
     3002        return r 
     3003 
     3004    def getValuesFromRegistrant(self, reg): 
     3005        r = {} 
     3006        r['title'] = reg.getTitle() 
     3007        r['firstName'] = reg.getFirstName() 
     3008        r['surname'] = reg.getFamilyName() 
     3009        r['position'] = reg.getPosition() 
     3010        r['institution'] = reg.getInstitution() 
     3011        r['address'] = reg.getAddress() 
     3012        r['city'] = reg.getCity() 
     3013        r['country'] = reg.getCountry() 
     3014        r['phone'] = reg.getPhone() 
     3015        r['fax'] = reg.getFax() 
     3016        r['email'] = reg.getEmail() 
     3017        r['personalHomepage'] = reg.getPersonalHomepage() 
     3018        return r 
     3019 
     3020class PersonalDataFormItem(Persistent): # old 
    28853021 
    28863022    def __init__(self, data=None): 
     
    43784514        self._avatar = av 
    43794515 
    4380         self.setPersonalData(data) 
    4381  
    43824516        if self.getRegistrationForm().getReasonParticipationForm().isEnabled(): 
    43834517            self.setReasonParticipation(data.get("reason","")) 
     
    44594593                #for f in gs.getFields(): 
    44604594                for f in gs.getSortedFields(): 
    4461                     f.getInput().setResponseValue(mg.getResponseItemById(f.getId()),data, self, mg) 
     4595                    if not f.isDisabled(): 
     4596                        f.getInput().setResponseValue(mg.getResponseItemById(f.getId()),data, self, mg) 
    44624597                for miscItem in mg.getResponseItemList(): 
    44634598                    if miscItem.isBillable(): 
     
    44724607        if not self.getPayed(): 
    44734608            self.setTotal(total) 
     4609        self.setPersonalData(self.getRegistrationForm().getPersonalDataNew().getValues(self)) 
    44744610        self._complete = True 
    44754611 
  • indico/MaKaC/webinterface/pages/registrants.py

    r34d140 rbdcdee  
    127127 
    128128            for fld in sect.getSortedFields(): 
    129                 self._dispopts[sect.getId()].append("%s-%s"%(sect.getId(),fld.getId())) 
     129                if not fld.getPDField(): 
     130                    self._dispopts[sect.getId()].append("%s-%s"%(sect.getId(),fld.getId())) 
    130131 
    131132    def _getKeyDispOpts(self, value): 
     
    187188                #    columns["%s-%s"%(sect.getId(),fld.getId())]=fld.getCaption() 
    188189                for fld in sect.getSortedFields(): 
    189                     columns["%s-%s"%(sect.getId(),fld.getId())]=fld.getCaption() 
     190                    if not fld.getPDField(): 
     191                        columns["%s-%s"%(sect.getId(),fld.getId())]=fld.getCaption() 
    190192                # jmf-end 
    191193                ############ 
     
    12411243                       <td align="left" valign="top">%s</td> 
    12421244                    </tr> 
    1243                     <tr><td>&nbsp;</td></tr> 
    12441245                    """%(f.getCaption(), v)) 
    12451246        if miscGroup is not None: 
     
    12521253                                       <td align="left">%s <font color="red">(cancelled)</font></td> 
    12531254                                    </tr> 
    1254                                     <tr><td>&nbsp;</td></tr> 
    12551255                                    """) %(miscItem.getCaption(), self._getItemValueDisplay(miscItem)) ) 
    12561256        if len(html)==1: 
     
    13471347        if self._registrant.getRegistrationDate() is not None: 
    13481348            vars["registrationDate"] = "%s (%s)"%(self._registrant.getAdjustedRegistrationDate().strftime("%d-%B-%Y %H:%M"), self._conf.getTimezone()) 
    1349         vars["dataModificationURL"] = quoteattr(str(urlHandlers.UHRegistrantDataModification.getURL(self._registrant))) 
    13501349        vars["sections"] = self._getFormSections() 
    13511350        vars["statuses"]=self._getStatusesHTML() 
    13521351 
    13531352        vars["transaction"]=self._getTransactionHTML() 
    1354         return vars 
    1355  
    1356 class WPRegistrantDataModification( WPRegistrantModifMain ): 
    1357  
    1358     def _getTabContent( self, params ): 
    1359         wc = WRegistrantDataModification(self._registrant) 
    1360         return wc.getHTML() 
    1361  
    1362 class WRegistrantDataModification( wcomponents.WTemplated ): 
    1363  
    1364     def __init__( self, registrant ): 
    1365         self._registrant = registrant 
    1366         self._conf = self._registrant.getConference() 
    1367  
    1368     def _getItemHTML(self, item, value): 
    1369         inputHTML = "" 
    1370         if item.getInput() == "list": 
    1371             if item.getId() == "title": 
    1372                 for title in TitlesRegistry().getList(): 
    1373                     selected = "" 
    1374                     if value == title: 
    1375                         selected = "selected" 
    1376                     inputHTML += """<option value="%s" %s>%s</option>"""%(title, selected, title) 
    1377                 inputHTML = """<select name="%s">%s</select>"""%(item.getId(), inputHTML) 
    1378             elif item.getId() == "country": 
    1379                 for ck in CountryHolder().getCountrySortedKeys(): 
    1380                     selected = "" 
    1381                     if value == ck: 
    1382                         selected = "selected" 
    1383                     inputHTML += """<option value="%s" %s>%s</option>"""%(ck, selected, CountryHolder().getCountryById(ck)) 
    1384                 inputHTML = """<select name="%s">%s</select>"""%(item.getId(), inputHTML) 
    1385         else: 
    1386             input = item.getInput() 
    1387             if item.getId() == "email": 
    1388                 input = "text" 
    1389             inputHTML = """<input type="%s" name="%s" size="40" value="%s">"""%(input, item.getId(), value) 
    1390         mandatory="&nbsp; &nbsp;" 
    1391         if item.isMandatory(): 
    1392             mandatory = """<font color="red">* </font>""" 
    1393         html = """ 
    1394                 <tr> 
    1395                     <td nowrap class="titleCellTD">%s<span class="titleCellFormat">%s</span></td> 
    1396                     <td width="100%%" align="left" bgcolor="white" class="blacktext">%s</td> 
    1397                 </tr> 
    1398                 """%(mandatory, item.getName(), inputHTML) 
    1399         return html 
    1400  
    1401     def getVars( self ): 
    1402         vars = wcomponents.WTemplated.getVars( self ) 
    1403         personalData = self._conf.getRegistrationForm().getPersonalData() 
    1404         data = [] 
    1405         sortedKeys = personalData.getSortedKeys() 
    1406         formValues = personalData.getValuesFromRegistrant(self._registrant) 
    1407         for key in sortedKeys: 
    1408             item = personalData.getDataItem(key) 
    1409             data.append(self._getItemHTML(item, formValues.get(item.getId(), ""))) 
    1410         vars["data"] = "".join(data) 
    1411         vars["postURL"] = quoteattr(str(urlHandlers.UHRegistrantPerformDataModification.getURL(self._registrant))) 
    14121353        return vars 
    14131354 
     
    17251666        #for f in self._miscGroup.getGeneralSection().getFields(): 
    17261667        for f in self._miscGroup.getGeneralSection().getSortedFields(): 
     1668            if f.isDisabled(): 
     1669                continue 
    17271670        # jmf-start 
    17281671        ############ 
     
    18681811        fullName = reg.getFullName() 
    18691812        institution = "" 
    1870         if self._regForm.getPersonalData().getDataItem("institution").isEnabled(): 
     1813        if not self._regForm.getPersonalDataNew().getField("institution").isDisabled(): 
    18711814            institution = """<td valign="top" class="abstractDataCell">%s</td>"""%(self.htmlText(reg.getInstitution()) or "&nbsp;") 
    18721815        position = "" 
    1873         if self._regForm.getPersonalData().getDataItem("position").isEnabled(): 
     1816        if not self._regForm.getPersonalDataNew().getField("position").isDisabled(): 
    18741817            position = """<td valign="top" class="abstractDataCell">%s</td>"""%(self.htmlText(reg.getPosition()) or "&nbsp;") 
    18751818        city = "" 
    1876         if self._regForm.getPersonalData().getDataItem("city").isEnabled(): 
     1819        if not self._regForm.getPersonalDataNew().getField("city").isDisabled(): 
    18771820            city = """<td valign="top" class="abstractDataCell">%s</td>"""%(self.htmlText(reg.getCity()) or "&nbsp;") 
    18781821        country = "" 
    1879         if self._regForm.getPersonalData().getDataItem("country").isEnabled(): 
     1822        if not self._regForm.getPersonalDataNew().getField("country").isDisabled(): 
    18801823            country = """<td valign="top" class="abstractDataCell">%s</td>"""%(self.htmlText(CountryHolder().getCountryById(reg.getCountry())) or "&nbsp;") 
    18811824        sessions="" 
  • indico/MaKaC/webinterface/pages/registrationForm.py

    rd6c8f0 rbdcdee  
    109109        return urlHandlers.UHConfModifRegFormGeneralSection.getURL(sect) 
    110110 
    111     def _getPersonalFieldsHTML(self): 
    112         regForm=self._conf.getRegistrationForm() 
    113         html=[] 
    114         enabledBulb = Configuration.Config.getInstance().getSystemIconURL( "enabledSection" ) 
    115         notEnabledBulb = Configuration.Config.getInstance().getSystemIconURL( "disabledSection" ) 
    116         enabledText = "Click to disable" 
    117         disabledText = "Click to enable" 
    118         keys = regForm.getPersonalData().getSortedKeys() 
    119         for key in keys: 
    120             pdfield = regForm.getPersonalData().getDataItem(key) 
    121             urlStatus = urlHandlers.UHConfModifRegFormEnablePersonalField.getURL(self._conf) 
    122             urlStatus.addParam("personalfield", pdfield.getId()) 
    123             img = enabledBulb 
    124             text = enabledText 
    125             if not pdfield.isEnabled(): 
    126                 img = notEnabledBulb 
    127                 text = disabledText 
    128             urlSwitch = urlHandlers.UHConfModifRegFormSwitchPersonalField.getURL(self._conf) 
    129             urlSwitch.addParam("personalfield", pdfield.getId()) 
    130             switch = "optional" 
    131             if pdfield.isMandatory(): 
    132                 switch = "mandatory" 
    133             if pdfield.getId() not in ["email","firstName","surname"]: 
    134                 html.append(""" 
    135                         <tr> 
    136                         <td><a href=%s><img src="%s" alt="%s" class="imglink"></a></td><td>&nbsp;%s</td><td>&nbsp;<a href="%s">%s</a></td> 
    137                         </tr> 
    138                         """%(quoteattr(str(urlStatus)), img, text, pdfield.getName(), urlSwitch, switch) ) 
    139             else: 
    140                 html.append(""" 
    141                         <tr> 
    142                         <td></td><td>&nbsp;%s</td><td>&nbsp;%s</td> 
    143                         </tr> 
    144                         """%(pdfield.getName(), switch) ) 
    145  
    146         html.insert(0, """<table>""") 
    147         html.append("</table>") 
    148         return "".join(html) 
    149  
    150  
    151111    def _getSectionsHTML(self): 
    152112        regForm=self._conf.getRegistrationForm() 
     
    166126                text = disabledText 
    167127            checkbox="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" 
    168             if isinstance(gs, registration.GeneralSectionForm): 
     128            if isinstance(gs, registration.GeneralSectionForm) and not gs.isRequired(): 
    169129                checkbox=""" 
    170130                        <input type="checkbox" name="sectionsIds" value="%s">&nbsp; 
     
    178138            selbox += """ 
    179139                </select>""" 
     140            if not isinstance(gs, registration.GeneralSectionForm) or not gs.isRequired(): 
     141                toggleLink = """<a href=%s><img src="%s" alt="%s" class="imglink"></a>""" % (quoteattr(str(urlStatus)), img, text) 
     142            else: 
     143                toggleLink = "" 
    180144            html.append(""" 
    181145                        <tr> 
    182                         <td> 
    183                             <a href=%s><img src="%s" alt="%s" class="imglink"></a>&nbsp;%s&nbsp;%s<a href=%s>%s</a> 
    184                         </td> 
     146                        <td>%s</td> 
     147                        <td>%s&nbsp;%s<a href=%s>%s</a></td> 
    185148                        </tr> 
    186                         """%(quoteattr(str(urlStatus)), img, text, selbox, checkbox, quoteattr(str(urlModif)), gs.getTitle()) ) 
     149                        """%(toggleLink, selbox, checkbox, quoteattr(str(urlModif)), gs.getTitle()) ) 
    187150        html.insert(0, """<input type="hidden" name="oldpos"><table>""") 
    188151        html.append("</table>") 
     
    290253            vars["Currency"]="" 
    291254        vars["sections"] = self._getSectionsHTML() 
    292         vars["personalfields"] = self._getPersonalFieldsHTML() 
    293255        vars["actionSectionURL"]=quoteattr(str(urlHandlers.UHConfModifRegFormActionSection.getURL(self._conf))) 
    294256        vars["statuses"] = self._getStatusesHTML() 
     
    13061268    def _getGeneralFieldsHTML(self): 
    13071269        html=[] 
     1270        enabledBulb = Configuration.Config.getInstance().getSystemIconURL("enabledSection") 
     1271        notEnabledBulb = Configuration.Config.getInstance().getSystemIconURL("disabledSection") 
     1272        enabledText = "Click to disable" 
     1273        disabledText = "Click to enable" 
    13081274        ############## 
    13091275        #jmf-start 
     
    13361302                </select>""" 
    13371303 
     1304            chkbox = "" 
     1305            if not f.isLocked('delete'): 
     1306                chkbox = """<input type="checkbox" name="fieldsIds" value="%s">""" % f.getId() 
     1307 
     1308            urlStatus = urlHandlers.UHConfModifRegFormEnablePersonalField.getURL(self._conf) 
     1309            urlStatus.addParam("personalfield", f.getId()) 
     1310            img = enabledBulb 
     1311            imgAlt = enabledText 
     1312            if f.isDisabled(): 
     1313                img = notEnabledBulb 
     1314                imgAlt = disabledText 
     1315 
     1316            toggle = "" 
     1317            if not f.isLocked('disable') and self._generalSection is self._generalSection.getRegistrationForm().getPersonalDataNew(): 
     1318                toggle = """<a href=%s><img src="%s" alt="%s" class="imglink"></a>""" % (quoteattr(str(urlStatus)), img, imgAlt) 
     1319 
    13381320            html.append("""<tr> 
    1339                                 <td align="left" style="padding-left:10px">%s<input type="checkbox" name="fieldsIds" value="%s"><a href=%s>%s</a>%s</td> 
     1321                                <td align="left" style="padding-left:10px">%s</td><td>%s</td><td>%s</td><td><a href=%s>%s</a>%s</td> 
    13401322                            </tr> 
    1341                         """%(selbox,f.getId(), url, self.htmlText(f.getCaption()),spec) ) 
     1323                        """%(toggle, selbox, chkbox, url, self.htmlText(f.getCaption()),spec) ) 
    13421324                        #"""%(f.getId(), url, f.getCaption(),spec) ) 
    13431325        html.insert(0,"""<a href="" name="sections"></a><input type="hidden" name="oldpos"><table align="left">""") 
     
    13891371 
    13901372    def _getFieldTypesHTML(self): 
    1391         html=["""<select name="input" onchange="javascript:$E('WConfModifRegFormGeneralSectionFieldEdit').dom.submit();  $E('submitButton').dom.disabled=true; $E('cancelButton').dom.disabled=true;">"""] 
     1373        disabled = "" 
     1374        if self._generalField and self._generalField.isLocked('input'): 
     1375            disabled = """ disabled="disabled""" 
     1376        html=["""<select name="input" onchange="javascript:$E('WConfModifRegFormGeneralSectionFieldEdit').dom.submit();  $E('submitButton').dom.disabled=true; $E('cancelButton').dom.disabled=true;"%s>""" % disabled] 
    13921377        keylist=registration.FieldInputs.getAvailableInputKeys() 
    13931378        keylist.sort() 
     
    14081393        vars["description"] = "" 
    14091394        vars["mandatory"] =  """ checked="checked" """ 
     1395        vars["mandatoryLocked"] = False 
    14101396        #vars["billable"]= """ checked="checked" """ 
    14111397        #vars["price"]="" 
     
    14161402            if not self._generalField.isMandatory(): 
    14171403                vars["mandatory"] =  "" 
     1404            vars["mandatoryLocked"] = self._generalField.isLocked('mandatory') 
    14181405            #if not self._generalField.isBillable(): 
    14191406            #    vars["billable"] =  "" 
     
    15901577        self._conf = conf 
    15911578 
    1592     def _getWComp(self, sect): 
     1579    def _getWComp(self, sect, pdFormValues): 
    15931580        if sect == self._conf.getRegistrationForm().getReasonParticipationForm(): 
    15941581            return WConfRegFormReasonParticipationDisplay(self._conf, self._currentUser) 
     
    16041591        if sect == self._conf.getRegistrationForm().getSocialEventForm(): 
    16051592            return WConfRegFormSocialEventDisplay(self._conf, self._currentUser) 
    1606         return WConfRegFormGeneralSectionDisplay(sect, self._currentUser) 
     1593        return WConfRegFormGeneralSectionDisplay(sect, self._currentUser, pdFormValues) 
    16071594 
    16081595    def _getOtherSectionsHTML(self): 
    1609         regForm=self._conf.getRegistrationForm() 
     1596        regForm = self._conf.getRegistrationForm() 
     1597        personalDataNew = regForm.getPersonalDataNew() 
     1598        if self._currentUser is not None and self._currentUser.isRegisteredInConf(self._conf): 
     1599            pdFormValues = personalDataNew.getValuesFromRegistrant(self._currentUser.getRegistrantById(self._conf.getId())) 
     1600        else: 
     1601            pdFormValues = personalDataNew.getValuesFromAvatar(self._currentUser) 
     1602 
    16101603        html=[] 
    16111604        for gs in regForm.getSortedForms(): 
    1612             wcomp=self._getWComp(gs) 
     1605            wcomp=self._getWComp(gs, pdFormValues) 
    16131606            if gs.isEnabled(): 
    16141607                html.append( """ 
     
    16291622        vars["title"] = regForm.getTitle() 
    16301623        vars["postURL"] = quoteattr(str(urlHandlers.UHConfRegistrationFormCreation.getURL(self._conf))) 
    1631         vars["personalData"] = WConfRegFormPersonalDataDisplay(self._conf, self._currentUser).getHTML() 
    16321624        vars["otherSections"]=self._getOtherSectionsHTML() 
    16331625        return vars 
     
    16441636class WConfRegFormGeneralSectionDisplay(wcomponents.WTemplated): 
    16451637 
    1646     def __init__(self, gs, currentUser): 
     1638    def __init__(self, gs, currentUser, pdFormValues=None): 
    16471639        self._generalSection = gs 
    16481640        self._currentUser = currentUser 
     1641        self._pdFormValues = pdFormValues 
    16491642 
    16501643    def _getFieldsHTML(self, miscGroup=None): 
     
    16551648        #jmf 
    16561649        for f in self._generalSection.getSortedFields(): 
     1650            if f.isDisabled(): 
     1651                continue 
    16571652            miscItem=None 
    16581653            if miscGroup is not None and miscGroup.getResponseItemById(f.getId()) is not None: 
    16591654                miscItem=miscGroup.getResponseItemById(f.getId()) 
     1655            default = "" 
     1656            if self._generalSection is self._generalSection.getRegistrationForm().getPersonalDataNew(): 
     1657                default = self._pdFormValues.get(f.getPDField(), "") 
    16601658            html.append(""" 
    16611659                        <tr> 
     
    16641662                          </td> 
    16651663                        </tr> 
    1666                         """%(f.getInput().getModifHTML(miscItem, registrant)) ) 
     1664                        """%(f.getInput().getModifHTML(miscItem, registrant, default)) ) 
    16671665        return "".join(html) 
    16681666 
     
    16771675        vars["fields"]=self._getFieldsHTML(miscGroup) 
    16781676        return vars 
     1677 
    16791678 
    16801679class WConfRegFormPersonalDataDisplay(wcomponents.WTemplated): 
     
    17431742        vars["data"] = "".join(data) 
    17441743        return vars 
     1744 
    17451745 
    17461746class WConfRegFormReasonParticipationDisplay(wcomponents.WTemplated): 
     
    24932493        return "".join(html) 
    24942494 
    2495     def _getPDInfoHTML(self): 
    2496         personalData = self._conf.getRegistrationForm().getPersonalData() 
    2497         sortedKeys = personalData.getSortedKeys() 
    2498         html = "" 
    2499         for key in sortedKeys: 
    2500             pdfield = personalData.getDataItem(key) 
    2501             fieldTitle = pdfield.getName() 
    2502             fieldValue = "" 
    2503             if key == "title": 
    2504                 fieldValue = self.htmlText( self._registrant.getTitle() ) 
    2505             elif key == "firstName": 
    2506                 fieldValue = self.htmlText( self._registrant.getFirstName() ) 
    2507             elif key == "surname": 
    2508                 fieldValue = self.htmlText( self._registrant.getFamilyName() ) 
    2509             elif key == "position": 
    2510                 fieldValue = self.htmlText( self._registrant.getPosition() ) 
    2511             elif key == "institution": 
    2512                 fieldValue = self.htmlText( self._registrant.getInstitution() ) 
    2513             elif key == "address": 
    2514                 fieldValue = self.htmlText( self._registrant.getAddress() ) 
    2515             elif key == "city": 
    2516                 fieldValue = self.htmlText( self._registrant.getCity() ) 
    2517             elif key == "country": 
    2518                 fieldValue = self.htmlText( self._registrant.getCountry() ) 
    2519             elif key == "phone": 
    2520                 fieldValue = self.htmlText( self._registrant.getPhone() ) 
    2521             elif key == "email": 
    2522                 fieldValue = self.htmlText( self._registrant.getEmail() ) 
    2523             elif key == "fax": 
    2524                 fieldValue = self.htmlText( self._registrant.getFax() ) 
    2525             elif key == "personalHomepage": 
    2526                 fieldValue = self.htmlText( self._registrant.getPersonalHomepage() ) 
    2527             if pdfield.isEnabled(): 
    2528                 html += """ 
    2529                             <tr> 
    2530                               <td style="color:black"><b>%s</b></td> 
    2531                               <td bgcolor="white" class="blacktext">%s</td> 
    2532                             </tr>""" % (fieldTitle,fieldValue) 
    2533         return html 
    2534  
    25352495    def _getFormSections(self): 
    25362496        sects = [] 
     
    25562516        vars["pdfields"] = self._getPDInfoHTML() 
    25572517        vars["registrationDate"] = i18nformat("""--_("date unknown")--""") 
     2518 
    25582519        if self._registrant.getRegistrationDate() is not None: 
    25592520            vars["registrationDate"] = self._registrant.getAdjustedRegistrationDate().strftime("%d-%B-%Y %H:%M") 
    2560         vars["dataModificationURL"] = quoteattr(str(urlHandlers.UHRegistrantDataModification.getURL(self._registrant))) 
    25612521        vars["otherSections"] = self._getFormSections() 
    25622522        vars["paymentInfo"]  = self._getPaymentInfo() 
  • indico/MaKaC/webinterface/rh/registrantsModif.py

    r2cf43b4 rbdcdee  
    461461        return p.display() 
    462462 
    463 class RHRegistrantDataModification( RHRegistrantModifBase ): 
    464  
    465     def _process( self ): 
    466         p = registrants.WPRegistrantDataModification( self, self._registrant ) 
    467         return p.display() 
    468  
    469463class RHRegistrantSendEmail( RHRegistrationFormModifBase ): 
    470464 
     
    756750    def _process( self ): 
    757751        if not self._cancel: 
    758             params=self._getRequestParams() 
     752            params = self._getRequestParams() 
     753            pdForm = self._registrant.getRegistrationForm().getPersonalDataNew() 
     754            if self._miscInfo.getGeneralSection() is pdForm: 
     755                email = pdForm.getValueFromParams(params, 'email') 
     756                if self._conf.hasRegistrantByEmail(email, self._registrant): 
     757                    raise FormValuesError("""There is already a user with the email "%s". Please choose another one""" % email) 
    759758            for f in self._miscInfo.getGeneralSection().getSortedFields(): 
    760                 f.getInput().setResponseValue(self._miscInfo.getResponseItemById(f.getId()),params, self._registrant, self._miscInfo) 
     759                if not f.isDisabled(): 
     760                    f.getInput().setResponseValue(self._miscInfo.getResponseItemById(f.getId()), params, self._registrant, self._miscInfo) 
     761            if self._miscInfo.getGeneralSection() is pdForm: 
     762                self._registrant.setPersonalData(pdForm.getValues(self._registrant)) 
    761763        self._registrant.updateTotal() 
    762764        self._redirect(urlHandlers.UHRegistrantModification.getURL(self._registrant)) 
  • indico/MaKaC/webinterface/rh/registrationFormDisplay.py

    r6bbcc8 rbdcdee  
    122122        RHBaseRegistrationForm._checkParams(self, params) 
    123123        self._regForm = self._conf.getRegistrationForm() 
    124         pd = self._regForm.getPersonalData() 
    125         keys = pd.getMandatoryItems() 
    126         for key in keys: 
    127             if key not in params.keys() or params.get(key,"").strip() == "": 
    128                 raise FormValuesError("The field \"%s\" is mandatory and you must fill it in order to register"%(pd.getData()[key].getName())) 
    129124        # SESSIONS 
    130125        sessionForm = self._regForm.getSessionsForm() 
     
    146141            return p.display() 
    147142        params = self._getRequestParams() 
    148  
    149         matchedUsers = AvatarHolder().match({"email": params["email"]}) 
    150         if matchedUsers: 
    151             user = matchedUsers[0] 
     143        email = self._regForm.getPersonalDataNew().getValueFromParams(params, 'email') 
     144        if canManageRegistration: 
     145            matchedUsers = AvatarHolder().match({"email": email}) 
     146            if matchedUsers: 
     147                user = matchedUsers[0] 
     148            else: 
     149                user = None 
    152150        else: 
    153151            user = None 
     
    161159                return p.display() 
    162160        if user is None: 
    163             if self._conf.hasRegistrantByEmail(self._getRequestParams().get("email","")): 
    164                 raise FormValuesError("There is already a user with the email \"%s\". Please choose another one"%self._getRequestParams().get("email","--no email--")) 
     161            if self._conf.hasRegistrantByEmail(email): 
     162                raise FormValuesError("There is already a user with the email \"%s\". Please choose another one"%email) 
    165163        else: 
    166164            if user.isRegisteredInConf(self._conf): 
     
    169167            if self._conf.hasRegistrantByEmail(user.getEmail()): 
    170168                raise FormValuesError("You have already registered with the email address \"%s\". If you need to modify your registration, please contact the managers of the conference."%self._getUser().getEmail()) 
     169            elif self._conf.hasRegistrantByEmail(email): 
     170                raise FormValuesError("There is already a user with the email \"%s\". Please choose another one"%email) 
    171171        rp = registration.Registrant() 
    172172        self._conf.addRegistrant(rp) 
  • indico/MaKaC/webinterface/rh/registrationFormModif.py

    rd0809f rbdcdee  
    492492        section = self._conf.getRegistrationForm().getSectionById(self._section) 
    493493        if section is not None: 
    494             section.setEnabled(not section.isEnabled()) 
     494            if not isinstance(section, GeneralSectionForm) or not section.isRequired(): 
     495                section.setEnabled(not section.isEnabled()) 
    495496        self._redirect(str(urlHandlers.UHConfModifRegForm.getURL(self._conf)) + "#sections", True) 
    496497 
     
    503504 
    504505    def _process( self ): 
    505         pdfield = self._conf.getRegistrationForm().getPersonalData().getDataItem(self._personalfield) 
    506         if pdfield is not None: 
    507             pdfield.setEnabled(not pdfield.isEnabled()) 
    508         url = str(urlHandlers.UHConfModifRegForm.getURL(self._conf)) + "#personalfields" 
     506        pdForm = self._conf.getRegistrationForm().getPersonalDataNew() 
     507        field = pdForm.getFieldById(self._personalfield) 
     508        if field and not field.isLocked('disable'): 
     509            field.setDisabled(not field.isDisabled()) 
     510        url = urlHandlers.UHConfModifRegFormGeneralSection.getURL(pdForm) 
    509511        self._redirect(url, True) 
    510512 
    511  
    512 class RHRegistrationFormModifSwitchPersonalField( RHRegistrationFormModifBase ): 
    513  
    514     def _checkParams( self, params ): 
    515         RHRegistrationFormModifBase._checkParams( self, params ) 
    516         self._personalfield = params.get("personalfield", "") 
    517  
    518     def _process( self ): 
    519         pdfield = self._conf.getRegistrationForm().getPersonalData().getDataItem(self._personalfield) 
    520         if pdfield is not None: 
    521             pdfield.setMandatory(not pdfield.isMandatory()) 
    522         url = str(urlHandlers.UHConfModifRegForm.getURL(self._conf)) + "#personalfields" 
    523         self._redirect(url, True) 
    524513 
    525514 
     
    573562            if self._confirm: 
    574563                for sect in self._sections: 
    575                     self._conf.getRegistrationForm().removeGeneralSectionForm(sect) 
     564                    if not sect.isRequired(): 
     565                        self._conf.getRegistrationForm().removeGeneralSectionForm(sect) 
    576566            else: 
    577567                return registrationForm.WPConfModifRegFormGeneralSectionRemConfirm( self._rh, self._conf, self.sects).display() 
     
    619609        if type(self._fields) == type('string'): 
    620610            field = self._gsf.getFieldById(self._fields) 
    621             self._gsf.removeField(field) 
     611            if not field.isLocked('delete'): 
     612                self._gsf.removeField(field) 
    622613        elif self._fields is not None: 
    623614            for fieldID in self._fields: 
    624615                field = self._gsf.getFieldById(fieldID) 
    625                 self._gsf.removeField(field) 
     616                if not field.isLocked('delete'): 
     617                    self._gsf.removeField(field) 
    626618 
    627619 
     
    660652        self._caption="" 
    661653        self._mandatory="" 
     654        self._locked = () 
    662655        self._description="" 
    663656        self._input=None 
     
    668661            self._caption=generalField.getCaption() 
    669662            self._mandatory=generalField.isMandatory() 
     663            self._locked = generalField.getLocked() 
    670664            self._description = generalField.getDescription() 
    671665            self._input=generalField.getInput().clone(self) 
     
    683677        d['placesLimit']=self.getPlacesLimit() 
    684678 
    685         if self.isMandatory(): 
     679        if self.isMandatory() and not self.isLocked('mandatory'): 
    686680            d['mandatory']='True' 
    687681        if self.isBillable(): 
    688682            d['billable']='True' 
    689         d['input']=self.getInput().getId() 
     683        if not self.isLocked('input'): 
     684            d['input']=self.getInput().getId() 
    690685        d.update(self.getInput().getValues()) 
    691686        return d 
     
    805800        return None 
    806801 
     802    def isLocked(self, what): 
     803        return what in self._locked 
     804 
     805 
    807806class RHRegistrationFormModifGeneralSectionFieldAdd( RHRegistrationFormModifGeneralSectionBase ): 
    808807 
  • indico/MaKaC/webinterface/tpls/ConfModifRegForm.tpl

    rc0de5a rbdcdee  
    115115  <tr> 
    116116    <td class="dataCaptionTD"> 
    117       <a name="personalfields"></a> 
    118       <span class="dataCaptionFormat">${ _("Personal Data")}</span> 
    119       <br/> 
    120       <br/> 
    121       <img src=${ enablePic } alt="${ _("Click to disable")}"> <small>${ _("Enabled field") }</small> 
    122       <br/> 
    123       <img src=${ disablePic } alt="${ _("Click to enable")}"> <small>${ _("Disabled field") }</small> 
    124     </td> 
    125     <td class="blacktext" style="padding-left:20px"> 
    126       ${ personalfields } 
    127     </td> 
    128     <td> 
    129     </td> 
    130   </tr> 
    131   <tr> 
    132     <td colspan="3" class="horizontalLine">&nbsp;</td> 
    133   </tr> 
    134   <tr> 
    135     <td class="dataCaptionTD"> 
    136117      <a name="sections"></a> 
    137118      <span class="dataCaptionFormat">${ _("Sections of the form")}</span> 
  • indico/MaKaC/webinterface/tpls/ConfModifRegFormGeneralSectionFieldEdit.tpl

    rc0de5a rbdcdee  
    6161      <td class="titleCellTD"><span class="titleCellFormat"> ${ _("Mandatory field")}</span></td> 
    6262      <td bgcolor="white" class="blacktext" width="100%"> 
    63       <input type="checkbox" name="mandatory" size="60" ${ mandatory }> ( ${ _("uncheck if it is not a mandatory field")}) 
     63      <input type="checkbox" name="mandatory" size="60" ${ mandatory } ${ 'disabled="disabled"' if mandatoryLocked else '' }> ( ${ _("uncheck if it is not a mandatory field")}) 
    6464      </td> 
    6565    </tr> 
  • indico/MaKaC/webinterface/tpls/ConfRegistrantsList.tpl

    rc0de5a rbdcdee  
    1717            <tr> 
    1818                <td nowrap class="titleCellFormat" style="border-right:5px solid #FFFFFF;border-left:5px solid #FFFFFF;border-bottom: 1px solid #5294CC;">${ imgNameTitle }<a href=${ urlNameTitle }>${ _("name")}</a></td> 
    19                 ${'<td class="titleCellFormat" style="border-right:5px solid #FFFFFF;border-left:5px solid #FFFFFF;border-bottom: 1px solid #5294CC;">'+ imgInstitutionTitle +'<a href='+ urlInstitutionTitle +'>'+ _("institution")+'</a></td>' if regForm.getPersonalData().getDataItem("institution").isEnabled() else ""} 
    20                 ${'<td class="titleCellFormat" style="border-right:5px solid #FFFFFF;border-left:5px solid #FFFFFF;border-bottom: 1px solid #5294CC;">'+ imgPositionTitle +'<a href='+ urlPositionTitle +'>'+ _("position")+'</a></td>' if regForm.getPersonalData().getDataItem("position").isEnabled() else ""} 
    21                 ${'<td class="titleCellFormat" style="border-right:5px solid #FFFFFF;border-left:5px solid #FFFFFF;border-bottom: 1px solid #5294CC;">'+ imgCityTitle +'<a href='+ urlCityTitle +'>'+ _("city")+'</a></td>' if regForm.getPersonalData().getDataItem("city").isEnabled() else ""} 
    22                 ${'<td class="titleCellFormat" style="border-right:5px solid #FFFFFF;border-left:5px solid #FFFFFF;border-bottom: 1px solid #5294CC;">'+ imgCountryTitle +'<a href='+ urlCountryTitle +'>'+ _("country/region")+'</a></td>' if regForm.getPersonalData().getDataItem("country").isEnabled() else ""} 
     19                ${'<td class="titleCellFormat" style="border-right:5px solid #FFFFFF;border-left:5px solid #FFFFFF;border-bottom: 1px solid #5294CC;">'+ imgInstitutionTitle +'<a href='+ urlInstitutionTitle +'>'+ _("institution")+'</a></td>' if not regForm.getPersonalDataNew().getField("institution").isDisabled() else ""} 
     20                ${'<td class="titleCellFormat" style="border-right:5px solid #FFFFFF;border-left:5px solid #FFFFFF;border-bottom: 1px solid #5294CC;">'+ imgPositionTitle +'<a href='+ urlPositionTitle +'>'+ _("position")+'</a></td>' if not regForm.getPersonalDataNew().getField("position").isDisabled() else ""} 
     21                ${'<td class="titleCellFormat" style="border-right:5px solid #FFFFFF;border-left:5px solid #FFFFFF;border-bottom: 1px solid #5294CC;">'+ imgCityTitle +'<a href='+ urlCityTitle +'>'+ _("city")+'</a></td>' if not regForm.getPersonalDataNew().getField("city").isDisabled() else ""} 
     22                ${'<td class="titleCellFormat" style="border-right:5px solid #FFFFFF;border-left:5px solid #FFFFFF;border-bottom: 1px solid #5294CC;">'+ imgCountryTitle +'<a href='+ urlCountryTitle +'>'+ _("country/region")+'</a></td>' if not regForm.getPersonalDataNew().getField("country").isDisabled() else ""} 
    2323                ${ sessionsTitle } 
    2424            </tr> 
  • indico/MaKaC/webinterface/tpls/ConfRegistrationFormCreationDone.tpl

    rc0de5a rbdcdee  
    4141                              <td bgcolor="white">${ id }</td> 
    4242                            </tr> 
    43                             ${ pdfields } 
    4443                            <tr> 
    4544                              <td style="color:black"><b>${ _("Registration date")}</b></td> 
  • indico/MaKaC/webinterface/tpls/ConfRegistrationFormDisplay.tpl

    rc0de5a rbdcdee  
    4646        <td><br></td> 
    4747    </tr> 
    48     <tr> 
    49         <td> 
    50             ${ personalData } 
    51         </td> 
    52     </tr> 
    5348    ${ otherSections } 
    5449    <tr> 
  • indico/MaKaC/webinterface/tpls/ConfRegistrationFormModify.tpl

    rc0de5a rbdcdee  
    4141        <td><br></td> 
    4242    </tr> 
    43     <tr> 
    44         <td> 
    45             ${ personalData } 
    46         </td> 
    47     </tr> 
    4843    ${ otherSections } 
    4944    <tr> 
  • indico/MaKaC/webinterface/tpls/ConfRegistrationFormPreview.tpl

    rc0de5a rbdcdee  
    2020        <td><br></td> 
    2121    </tr> 
    22     <tr> 
    23         <td> 
    24             ${ personalData } 
    25         </td> 
    26     </tr> 
    2722    ${ otherSections } 
    2823    <tr> 
  • indico/MaKaC/webinterface/tpls/RegistrantModifMain.tpl

    rc0de5a rbdcdee  
    66          <td class="dataCaptionTD"><span class="dataCaptionFormat"> ${ _("Registrant ID")}</span></td> 
    77          <td bgcolor="white">${ id }</td> 
    8           <form action=${ dataModificationURL } method="POST"> 
    9             <td rowspan="14" valign="bottom" align="right" width="1%"><input type="submit" class="btn" value="${ _("modify")}"></td> 
    10           </form> 
    11         </tr> 
    12         <tr> 
    13           <td class="dataCaptionTD"><span class="dataCaptionFormat"> ${ _("Title")}</span></td> 
    14           <td bgcolor="white" class="blacktext">${ title }</td> 
    15         </tr> 
    16         <tr> 
    17           <td class="dataCaptionTD"><span class="dataCaptionFormat"> ${ _("Family Name")}</span></td> 
    18           <td bgcolor="white" class="blacktext"><b>${ familyName }</b></td> 
    19         </tr> 
    20         <tr> 
    21           <td class="dataCaptionTD"><span class="dataCaptionFormat"> ${ _("First Name")}</span></td> 
    22           <td bgcolor="white" class="blacktext">${ firstName }</td> 
    23         </tr> 
    24         <tr> 
    25           <td class="dataCaptionTD"><span class="dataCaptionFormat"> ${ _("Position")}</span></td> 
    26           <td bgcolor="white" class="blacktext">${ position }</td> 
    27         </tr> 
    28         <tr> 
    29           <td class="dataCaptionTD"><span class="dataCaptionFormat"> ${ _("Institution")}</span></td> 
    30           <td bgcolor="white" class="blacktext">${ institution }</td> 
    31         </tr> 
    32         <tr> 
    33           <td class="dataCaptionTD"><span class="dataCaptionFormat"> ${ _("Address")}</span></td> 
    34           <td bgcolor="white" class="blacktext">${ address }</td> 
    35         </tr> 
    36         <tr> 
    37           <td class="dataCaptionTD"><span class="dataCaptionFormat"> ${ _("City")}</span></td> 
    38           <td bgcolor="white" class="blacktext">${ city }</td> 
    39         </tr> 
    40         <tr> 
    41           <td class="dataCaptionTD"><span class="dataCaptionFormat"> ${ _("Country")}</span></td> 
    42           <td bgcolor="white" class="blacktext">${ country }</td> 
    43         </tr> 
    44         <tr> 
    45           <td class="dataCaptionTD"><span class="dataCaptionFormat"> ${ _("Phone")}</span></td> 
    46           <td bgcolor="white" class="blacktext">${ phone }</td> 
    47         </tr> 
    48         <tr> 
    49           <td class="dataCaptionTD"><span class="dataCaptionFormat"> ${ _("Fax")}</span></td> 
    50           <td bgcolor="white" class="blacktext">${ fax }</td> 
    51         </tr> 
    52         <tr> 
    53           <td class="dataCaptionTD"><span class="dataCaptionFormat"> ${ _("Email")}</span></td> 
    54           <td bgcolor="white" class="blacktext">${ email }</td> 
    55         </tr> 
    56         <tr> 
    57           <td class="dataCaptionTD"><span class="dataCaptionFormat"> ${ _("Personal Homepage")}</span></td> 
    58           <td bgcolor="white" class="blacktext">${ personalHomepage }</td> 
    598        </tr> 
    609        <tr> 
  • indico/htdocs/confModifRegistrants.py

    rbdd862 rbdcdee  
    3535    return registrantsModif.RHRegistrantModification( req ).process( params ) 
    3636 
    37 def dataModification(req, **params): 
    38     return registrantsModif.RHRegistrantDataModification( req ).process( params ) 
    39  
    40 def performDataModification(req, **params): 
    41     return registrantsModif.RHRegistrantPerformDataModification( req ).process( params ) 
    42  
    4337def getPDF(req, **params): 
    4438    return registrantsModif.RHRegistrantListPDF( req ).process( params ) 
     
    5246def modifyTransaction(req, **params): 
    5347    return registrantsModif.RHRegistrantTransactionModify( req ).process( params ) 
    54      
     48 
    5549def peformModifyTransaction (req, **params): 
    5650    return registrantsModif.RHRegistrantTransactionPerformModify( req ).process( params ) 
  • indico/htdocs/confModifRegistrationForm.py

    r4b2050 rbdcdee  
    124124    return registrationFormModif.RHRegistrationFormModifEnablePersonalField( req ).process( params ) 
    125125 
    126 def switchPersonalField(req, **params): 
    127     return registrationFormModif.RHRegistrationFormModifSwitchPersonalField( req ).process( params ) 
    128  
    129126def modifySocialEventItem(req, **params): 
    130127    return registrationFormModif.RHRegistrationFormSocialEventItemModify( req ).process( params ) 
Note: See TracChangeset for help on using the changeset viewer.