def main(): themeList = themes.themeNames() theme.PrintHeader('The Conversatron - Theme Manager') theme.PrintNavBanner('Theme Manager') print "<form method='post'>" print "<input type='hidden' name='op' value='change'>" print "<table>" print "<tr><td align='right'>Day Theme:</td><td><select name='daytheme'>" ShowThemeOptions(themeList, themes._daytheme) print "</select></td></tr>" print "<tr><td align='right'>Night Theme:</td><td><select name='nighttheme'>" ShowThemeOptions(themeList, themes._nighttheme) print "</select></td></tr>" print "<tr><td align='right'>Day Starts:</td><td> <input name='daystarts' value='%s' size=5></td></tr>" % (themes._daystarts) print "<tr><td align='right'>Night Starts:</td><td> <input name='nightstarts' value='%s' size=5></td></tr>" % (themes._nightstarts) # print "<tr><td align='right'>Override Home:</td><td> <input name='overridehome' value='%s' size=5></td></tr>" % (themes._overridehome) print "<tr><td align='right'>Use user's theme for posts:</td><td> <input name='overridepost' value='%s' size=5> (1=yes, 0=no)</td></tr>" % (themes._overridepost) print "<tr><td></td><td><input type='submit' value='Change'></td></tr>" print "</table>" print "</form>" theme.PrintFooter()
def ShowSettings(self): "View your preferences. NOW." theme = themes.LoadTheme() theme.PrintHeader('The Conversatron - Your Settings', { "javascript": page_script, "onload": "loaded()" }) if "message" in form: print "<div class='message'>%s</div>" % web.SanitizeHTML(form.getvalue('message','')) theme.PrintNavBanner('Settings') theme.StartUserBox('Settings for '+user.name) favs = ConvDB.GetUserFavorites(user) theuser = db.loadObject('select *, TO_DAYS(lastused)-TO_DAYS(created) as days from user where name="%s"' % (user.name)) userDays = 0 userYears = 0 if theuser.days is not None: userDays = theuser.days % 365 userYears = theuser.days / 365 print 'Account Created: '+str(user.created) + ', ' print str(userYears) + words.ChooseWord(userYears, ' year', ' years') if userDays: print ' ' + str(userDays) + words.ChooseWord(userDays, ' day', ' days') print ' ago.<br>' print '<br>' theform = """ <form method="post" action="settings.py" name="settings"> Gender:<br> <x:control name="gender:n" />None of your business<br> <x:control name="gender:m" />Male<br> <x:control name="gender:f" />Female<br> <br> <x:control name="gender:t" />The Toilet<br> <br><br> Theme:<br> Default: <x:control name="theme" /><br> <x:control name="themeoverride:y" /> My theme choice overrides the theme on posts.<br> <br> <x:control name="update_button" /> </form> """ t = Template.A(form_controls) theme_select = t.get_control('theme') theme_list = themes.themeNames() for item in theme_list: theme_select.add_option(Option(theme_select, value=item)) t.template = theform t.parse() t.fill(FormDict(form)) t.render() print '<form method="post" action="settings.py" name="settings">' genders = (('n', 'None of your business'), ('m', 'Male'), ('f', 'Female<br>'), ('t', 'Toilet Fixture<br>')) print 'Gender:<br>' for (abbr, desc) in genders: checked = "" if user.gender==abbr: checked="checked" print '<input name="gender" value="%s" type="radio" %s>%s<br>' % (abbr, checked, desc) print '<br>Default theme: <select name="theme"><option value="">(Whatever. I don\'t care.)' theme_list = themes.themeNames() for item in theme_list: selected = "" if item == user.theme: selected = "selected" print '<option value="%s" %s>%s' % (item, selected, item) print '</select><br>' checked = "" if theuser.themeoverride == "y": checked = " checked" print '<input type="checkbox" name="alwaysusemytheme" value="y" %s> My theme choice overrides the theme on posts.<br>' % (checked) print '<br>' if user.IsWriter(): print """ <div style="border:1px black solid;padding:5px;"> Favorites menu preview:<br> """ web.PrintFavoriteSelector(favs, 'favaskee') print """ <a href="prefs.py?op=favform">Edit Favorites</a> </div> <br><br>""" print """ <div style="padding:5px;border:1px solid black;"> <input id='chpass' name="chpass" type="checkbox" onclick="Display.set('passwords', this.checked)"> <label for='chpass'>Change Password?</label> <table id="passwords"> <tr> <td>Current Password:</td> <td><input type="password" name="oldpasswd" value="" size=12 maxlength=12></td> </tr> <tr> <td>New Password:</td> <td><input type="password" name="passwd" value="" size=12 maxlength=12></td> </tr> <tr> <td>And again:</td> <td><input type="password" name="passwd2" value="" size=12 maxlength=12></td> </tr> </table> </div>""" print '<br><input type="submit" name="update_button" value="Update"></form>' print "<br><br><a href='/'>Nevermind...</a><br>" theme.EndUserBox() theme.PrintFooter()