]> git.ipfire.org Git - ipfire.org.git/commitdiff
dnsbl: search: Allow to pre-select a couple of values
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 7 Jan 2026 17:22:51 +0000 (17:22 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 7 Jan 2026 17:22:51 +0000 (17:22 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/templates/dnsbl/reports/submit.html
src/web/dnsbl.py

index c38da4a38bb1c2ed8afdd6839902bc1fe1c661cf..5db70c19f78df48a0aac08c2f821e8ddc2df141e 100644 (file)
@@ -60,7 +60,7 @@
                                                                                        <option value="">- {{ _("Choose One") }} -</option>
 
                                                                                        {% for l in sorted(lists) %}
-                                                                                               <option value="{{ l.slug }}">
+                                                                                               <option value="{{ l.slug }}" {% if list == l %}selected{% end %}>
                                                                                                        {{ l.name }} {% if l.description %}&dash; {{ l.description }}{% end %}
                                                                                                </option>
                                                                                        {% end %}
@@ -81,7 +81,8 @@
                                                        <div class="field">
                                                                <p class="control">
                                                                        <input class="input" name="name" type="text" placeholder="{{ _("Domain") }}" required
-                                                                               pattern="^(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$" />
+                                                                               pattern="^(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$"
+                                                                               {% if name %}value="{{ name }}"{% end %} />
                                                                </p>
                                                        </div>
                                                </div>
index 741ba1b53fd7bb52a5428dfa2e9b0984a0ae7298..540b2a16f09067d1ab44374aa178c271d95e4388 100644 (file)
@@ -96,8 +96,14 @@ class SubmitReportHandler(base.AnalyticsMixin, BaseHandler):
                # Fetch all lists
                lists = await self.backend.dnsbl.get_lists()
 
+               # Fetch any pre-selected lists
+               list = await self.get_list("list", None)
+
+               # Fetch any pre-selected names
+               name = self.get_argument("name", None)
+
                # Render the page
-               self.render("dnsbl/reports/submit.html", lists=lists)
+               self.render("dnsbl/reports/submit.html", lists=lists, list=list, name=name)
 
        @tornado.web.authenticated
        #@base.ratelimit(minutes=60, requests=10)