Changeset d6c8f0 in indico


Ignore:
Timestamp:
07/29/11 15:34:28 (22 months ago)
Author:
Jose Benito <jose.benito.gonzalez@…>
Branches:
master, hello-world-walkthrough, ipv6, v0.98-series, v0.98.2, v0.98.3, v0.98b2, v0.99, 051b2622c51afb171a1dedb46a0df4fbb0cbd02e, d9941f8582b36b24821a11ea5ba16fda6a457fb1
Children:
9d8047
Parents:
df7898
git-author:
Adrian Moennich <jerome.ernst.monnich@…> (07/06/11 10:18:12)
git-committer:
Jose Benito <jose.benito.gonzalez@…> (07/29/11 15:34:28)
Message:

[IMP] Allow places limit for yesno fields

Location:
indico/MaKaC
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • indico/MaKaC/registration.py

    rdf7898 rd6c8f0  
    17131713            tmp= """%s&nbsp;&nbsp;%s&nbsp;%s """%(tmp, price, currency) 
    17141714        if self.getParent().getPlacesLimit(): 
    1715             tmp += """&nbsp;(%s left)""" % (self.getParent().getNoPlacesLeft()) 
     1715            tmp += """&nbsp;<span style='color:green; font-style:italic;'>[%s place(s) left]</span>""" % (self.getParent().getNoPlacesLeft()) 
    17161716        tmp += """</td>""" 
    17171717        if description: 
     
    17391739    def _getSpecialOptionsHTML(self): 
    17401740        html = FieldInputType._getSpecialOptionsHTML(self) 
    1741         html += _("""<tr> 
     1741        html += i18nformat("""<tr> 
    17421742                  <td class="titleCellTD"><span class="titleCellFormat"> _("Places (0 for unlimited)")</span></td> 
    17431743                  <td bgcolor="white" class="blacktext" width="100%%"> 
     
    17871787        elif v=="no": 
    17881788            checkedNo="selected" 
    1789         tmp = """%s <select id="%s" name="%s" %s><option value="">-- Choose a value --</option><option value="yes" %s>yes</option><option value="no" %s>no</option></select>%s""" % (caption, htmlName, htmlName, disable, checkedYes, checkedNo, param) 
     1789        placesInfo = "" 
     1790        if self.getParent().getPlacesLimit(): 
     1791            placesInfo = """&nbsp;[%s place(s) left]""" % (self.getParent().getNoPlacesLeft()) 
     1792            if v != "yes" and not self.getParent().hasAvailablePlaces(): 
     1793                checkedYes += " disabled" 
     1794        tmp = """%s <select id="%s" name="%s" %s><option value="">-- Choose a value --</option><option value="yes" %s>yes%s</option><option value="no" %s>no</option></select>%s""" % (caption, htmlName, htmlName, disable, checkedYes, placesInfo, checkedNo, param) 
    17901795        tmp= """ <td>%s</td><td align="right" align="bottom">"""%tmp 
    17911796        if billable: 
     
    18211826        item.setMandatory(self.getParent().isMandatory()) 
    18221827        item.setHTMLName(self.getHTMLName()) 
     1828 
     1829    def _getSpecialOptionsHTML(self): 
     1830        html = FieldInputType._getSpecialOptionsHTML(self) 
     1831        html += i18nformat("""<tr> 
     1832                  <td class="titleCellTD"><span class="titleCellFormat"> _("Places (0 for unlimited)")</span></td> 
     1833                  <td bgcolor="white" class="blacktext" width="100%%"> 
     1834                    <input type="text" name="placesLimit" size="60" value=%s> 
     1835                  </td> 
     1836                </tr>""")%(self._parent.getPlacesLimit()) 
     1837        return html 
    18231838 
    18241839class RadioItem(Persistent): 
     
    21252140 
    21262141        tmp = """%s""" % (caption) 
    2127         tmp = [""" <td>%s</td><td align="right" align="bottom">""" % tmp] 
    2128         tmp.append(""" </td> """) 
     2142        tmp = [""" <td>%s</td><td align="right" align="bottom" colspan="2"></td>""" % tmp] 
    21292143 
    21302144        counter = 0 
     
    21442158            elif not value and val.getCaption() == self.getDefaultItem(): 
    21452159                checked = "checked" 
    2146             placesInfo = "" 
    2147             if val.getPlacesLimit(): 
    2148                 placesInfo = """&nbsp;(%s/%s left)""" % (val.getNoPlacesLeft(),val.getPlacesLimit()) 
    2149             tmp.append("""<tr><td></td><td><input type="radio" style="vertical-align:sub;" id="%s" name="%s" value="%s" %s %s> %s%s</td><td align="right" style="vertical-align: bottom;" >""" % (itemId, self.getHTMLName(), val.getId(), checked, disable, val.getCaption(), placesInfo)) 
     2160            tmp.append("""<tr><td></td><td><input type="radio" style="vertical-align:sub;" id="%s" name="%s" value="%s" %s %s> %s</td><td align="right" style="vertical-align: bottom;" >""" % (itemId, self.getHTMLName(), val.getId(), checked, disable, val.getCaption())) 
    21502161            if val.isBillable(): 
    21512162                tmp.append("""&nbsp;&nbsp;%s&nbsp;%s""" % (val.getPrice(), currency)) 
     2163            tmp.append("""</td><td align="right" style="vertical-align: bottom;" >""") 
     2164            if val.getPlacesLimit(): 
     2165                tmp.append("""&nbsp;<span style='color:green; font-style:italic;'>[%s place(s) left]</span>""" % (val.getNoPlacesLeft())) 
    21522166            tmp.append(""" </td></tr> """) 
    21532167 
     
    22042218                placesInfo = "" 
    22052219                if radioItem.getPlacesLimit(): 
    2206                     placesInfo = """&nbsp;(%s/%s left)""" % (radioItem.getNoPlacesLeft(),radioItem.getPlacesLimit()) 
     2220                    placesInfo = """&nbsp;[%s place(s) left]""" % (radioItem.getNoPlacesLeft()) 
    22072221 
    22082222                disabled = "" 
     
    26662680        if self.getPlacesLimit() > 0 : 
    26672681            if self.getCurrentNoPlaces() >= self.getPlacesLimit(): 
    2668                 raise FormValuesError( _("""The limit for the number of places is smaller than the current amount registered for this item. Please, set a higher limit.""")) 
     2682                raise FormValuesError( _("""The limit for the number of places is smaller than the current amount registered for this item.""")) 
    26692683            self._currentNoPlaces += 1 
    26702684 
  • indico/MaKaC/webinterface/pages/registrationForm.py

    r4bd7cb rd6c8f0  
    19371937                    placesLeft = "" 
    19381938                    if atype.getNoPlacesLeft() > 0: 
    1939                         placesLeft = " <font color='green'><i>[%s place(s) left]</i></font>"%atype.getNoPlacesLeft() 
     1939                        placesLeft = " <span style='color:green; font-style:italic;'>[%s place(s) left]</span>"%atype.getNoPlacesLeft() 
    19401940                    priceCol = "" 
    19411941                    if atype.isBillable(): 
     
    20282028                placesLeft = "" 
    20292029                if seItem.getPlacesLimit() > 0: 
    2030                     placesLeft = " <font color='green'><i>[%s place(s) left]</i></font>"%seItem.getNoPlacesLeft() 
     2030                    placesLeft = "<span style='color:green; font-style:italic;'>[%s place(s) left]</span>"%seItem.getNoPlacesLeft() 
    20312031                priceCol = "" 
    20322032                if seItem.isBillable(): 
Note: See TracChangeset for help on using the changeset viewer.