text
stringlengths
0
828
@return: the string representation of month
""""""
ln = default_ln(ln)
_ = gettext_set_language(ln)
if display == 'short':
months = {0: _(""Month""),
1: _(""Jan""),
2: _(""Feb""),
3: _(""Mar""),
4: _(""Apr""),
5: _(""May""),
6: _(""Jun""),
7: _(""Jul""),
8: _(""Aug""),
9: _(""Sep""),
10: _(""Oct""),
11: _(""Nov""),
12: _(""Dec"")}
else:
months = {0: _(""Month""),
1: _(""January""),
2: _(""February""),
3: _(""March""),
4: _(""April""),
5: _(""May ""), # trailing space distinguishes short/long form
6: _(""June""),
7: _(""July""),
8: _(""August""),
9: _(""September""),
10: _(""October""),
11: _(""November""),
12: _(""December"")}
return months[month_nb].strip()"
4383,"def create_day_selectbox(name, selected_day=0, ln=None):
""""""Creates an HTML menu for day selection. (0..31 values).
@param name: name of the control (i.e. name of the var you'll get)
@param selected_day: preselect a day. Use 0 for the label 'Day'
@param ln: language of the menu
@return: html a string
""""""
ln = default_ln(ln)
_ = gettext_set_language(ln)
out = ""<select name=\""%s\"">\n"" % name
for i in range(0, 32):
out += "" <option value=\""%i\"""" % i
if (i == selected_day):
out += "" selected=\""selected\""""
if (i == 0):
out += "">%s</option>\n"" % _(""Day"")
else:
out += "">%i</option>\n"" % i
out += ""</select>\n""
return out"
4384,"def create_month_selectbox(name, selected_month=0, ln=None):
""""""Creates an HTML menu for month selection. Value of selected field is
numeric.
@param name: name of the control, your form will be sent with name=value...
@param selected_month: preselect a month. use 0 for the Label 'Month'
@param ln: language of the menu
@return: html as string
""""""
ln = default_ln(ln)
out = ""<select name=\""%s\"">\n"" % name
for i in range(0, 13):
out += ""<option value=\""%i\"""" % i
if (i == selected_month):
out += "" selected=\""selected\""""
out += "">%s</option>\n"" % get_i18n_month_name(i, ln)
out += ""</select>\n""
return out"
4385,"def create_year_selectbox(name, from_year=-1, length=10, selected_year=0,
ln=None):
""""""Creates an HTML menu (dropdownbox) for year selection.
@param name: name of control( i.e. name of the variable you'll get)
@param from_year: year on which to begin. if <0 assume it is current year
@param length: number of items in menu
@param selected_year: initial selected year (if in range), else: label is
selected
@param ln: language
@return: html as string
""""""
ln = default_ln(ln)
_ = gettext_set_language(ln)
if from_year < 0:
from_year = time.localtime()[0]
out = ""<select name=\""%s\"">\n"" % name
out += ' <option value=""0""'
if selected_year == 0:
out += ' selected=""selected""'
out += "">%s</option>\n"" % _(""Year"")
for i in range(from_year, from_year + length):
out += ""<option value=\""%i\"""" % i
if (i == selected_year):
out += "" selected=\""selected\""""
out += "">%i</option>\n"" % i
out += ""</select>\n""