From 56943bc5e298c8da1c783901842b651a441fb557 Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Tue, 5 Aug 2008 12:09:21 -0700 Subject: [PATCH] web: add 'report incident' button at the bottom of the welcome page --- src/allmydata/web/root.py | 25 ++++++++++++++++++++++++- src/allmydata/web/welcome.xhtml | 6 +++--- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/src/allmydata/web/root.py b/src/allmydata/web/root.py index a110bc55..7326a17f 100644 --- a/src/allmydata/web/root.py +++ b/src/allmydata/web/root.py @@ -12,7 +12,7 @@ from formless import webform import allmydata # to display import path from allmydata import get_package_versions_string from allmydata import provisioning -from allmydata.util import idlib +from allmydata.util import idlib, log from allmydata.interfaces import IFileNode from allmydata.web import filenode, directory, unlinked, status from allmydata.web.common import abbreviate_size, IClient, getxmlfile, \ @@ -104,6 +104,15 @@ class FileHandler(rend.Page): raise WebError("/file must be followed by a file-cap and a name", http.NOT_FOUND) +class IncidentReporter(RenderMixin, rend.Page): + def render_POST(self, ctx): + req = IRequest(ctx) + log.msg(format="User reports incident through web page: %(details)s", + details=get_arg(req, "details", ""), + level=log.WEIRD) + req.setHeader("content-type", "text/plain") + return "Thank you for your report!" + class Root(rend.Page): addSlash = True @@ -122,6 +131,8 @@ class Root(rend.Page): child_helper_status = status.HelperStatus() child_statistics = status.Statistics() + child_report_incident = IncidentReporter() + def data_version(self, ctx, data): return get_package_versions_string() def data_import_path(self, ctx, data): @@ -279,3 +290,15 @@ class Root(rend.Page): ]] return T.div[form] + def render_incident_button(self, ctx, data): + # this button triggers a foolscap-logging "incident" + form = T.form(action="report_incident", method="post", + enctype="multipart/form-data")[ + T.fieldset[ + T.legend(class_="freeform-form-label")["Report an Incident"], + T.input(type="hidden", name="t", value="report-incident"), + "What went wrong?: ", + T.input(type="text", name="details"), " ", + T.input(type="submit", value="Report!"), + ]] + return T.div[form] diff --git a/src/allmydata/web/welcome.xhtml b/src/allmydata/web/welcome.xhtml index 874e0930..d0acb197 100644 --- a/src/allmydata/web/welcome.xhtml +++ b/src/allmydata/web/welcome.xhtml @@ -73,11 +73,11 @@

Other Resources

Please visit the Tahoe home page for - code updates and bug reporting.
+code updates and bug reporting. -
The provisioning - tool may also be useful.
+
The provisioning tool may also be useful.
+
-- 2.45.2