def writeContent(self): wr = self.writeln qs = self.request().fields() id = qs.get('id') if self.request()._environ.get('REQUEST_METHOD') == 'POST': form = qs ntype, redir = 'news', "News" if form.get('annual') == '1': ntype, redir = 'annual', "Annual" delete_news_item(id, ntype) self.response().sendRedirect(redir) else: wr('<form action="News_Delete" method="POST">') wr(hidden('id', id)) if qs.get('annual') == '1': wr(hidden('annual', '1')) nii = get_news_item(id) wr('<h1>Are you sure you want to delete this news item?</h1>') wr('<h3>You cannot undo this operation.</h3>') wr('<h2>%s</h2>' % (nii.get('headline'))) wr('<p>%s</p>' % (nii.get('description'))) wr(submit('Delete News Item')) wr('</form>')
def writeContent(self): wr = self.writeln qs = self.request().fields() id = qs.get('id') username = self.request().cookies().get('username') wr('<h1>%s</h1>' % (self.title())) if self.request()._environ.get('REQUEST_METHOD') == 'POST': form = qs redir = "News" if form.get('annualnews') == 'true': redir = "Annual" if form.get('actionitem') == 'true': redir = "Action" save_news(form) self.response().sendRedirect(redir) else: wr('<form action="Action_Form" method="POST">') nii = {} if id: nii = get_news_item(id) wr(hidden('id', nii.get('id'))) wr(hidden('username', username)) wr(hidden('actionitem', 'true')) wr('<P>') wr('<b>Headline</b>') wr('<br />') wr(text('headline', value=nii.get('headline', ''), clss='input')) wr('</P>') wr('<P>') wr('<b>Description</b>') wr('<br />') wr('<textarea name="description" class="input" rows="8" cols="48" >%s</textarea>' % (nii.get('description', ''))) wr('</P>') wr(submit('Save & Publish Action Item')) wr('</form>')
def writeContent(self): wr = self.writeln qs = self.request().fields() id = qs.get('id') if self.request()._environ.get('REQUEST_METHOD') == 'POST': form = qs delete_news_item(id, "actionitem") self.response().sendRedirect("Action") else: wr('<form action="Action_Delete" method="POST">') wr(hidden('id', id)) nii = get_news_item(id) wr('<h1>Are you sure you want to delete this action item?</h1>') wr('<h3>You cannot undo this operation.</h3>') wr('<h2>%s</h2>' % (nii.get('headline'))) wr('<p>%s</p>' % (nii.get('description'))) wr(submit('Delete Action Item')) wr('</form>')
def writeContent(self): wr = self.writeln qs = self.request().fields() id = qs.get('id') username = self.request().cookies().get('username') wr('<h1>%s</h1>' % (self.title())) if self.request()._environ.get('REQUEST_METHOD') == 'POST': form = qs redir = "News" if form.get('annualnews') == 'true': redir = "Annual" save_news(form) # wr(form) self.response().sendRedirect(redir) else: wr('<form action="News_Form" method="POST">') nii = {} if id: nii = get_news_item(id) wr(hidden('id', nii.get('id'))) wr(hidden('username', username)) wr('<P>') wr('<b>Headline</b>') wr('<br />') wr(text('headline', value=nii.get('headline', ''), clss='input')) wr('</P>') wr('<P>') wr('<lable for="annewsck"><input type="checkbox" name="annualnews" value="true" id="annewsck"') if qs.get('annual') == '1': wr(' CHECKED') wr('> Check this box if this is for the Annual Meeting.</label>') wr('</P>') # wr('<P>') # wr('<b>Who can view this news item?</b>') # wr('<br />') # self.write('<input type="radio" name="visibility" value="all" id="vizall"') # if (nii.get('visibility') == 'all') or (not id): # self.write(' CHECKED ') # wr('/> <label for="vizall">Everyone</label>') # wr('<br />') # self.write('<input type="radio" name="visibility" value="restricted" id="vizres"') # if nii.get('visibility') == 'restricted': # self.write(' CHECKED ') # wr('/> <label for="vizres">Diplomates & Candidates Only</label>') # wr('</P>') # wr('<P>') # wr('<b>Website</b>') # wr('<br />') # wr('Is there another website you\'d like this news item linked to? If so, provide its URL here.') # wr('<br />') # wr(text('url', value=nii.get('url', ''), clss='input')) # wr('</P>') wr('<P>') wr('<b>Description</b>') wr('<br />') wr('<textarea name="description" class="input" rows="8" cols="48" >%s</textarea>' % (nii.get('description', ''))) wr('</P>') wr(submit('Save & Publish News Item')) wr('</form>')