]> git.ipfire.org Git - ipfire.org.git/commitdiff
Drop more unused code
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 18 Jul 2018 17:54:33 +0000 (18:54 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 18 Jul 2018 17:54:33 +0000 (18:54 +0100)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/templates/modules/builds.html [deleted file]
src/templates/modules/donation-box.html [deleted file]
src/templates/modules/donation-button.html [deleted file]
src/templates/modules/donation-input-box.html [deleted file]
src/templates/modules/planet/search-box.html [deleted file]
src/templates/modules/sidebar-banner.html [deleted file]
src/templates/modules/sidebar-item.html [deleted file]
src/templates/modules/sidebar-release.html [deleted file]
src/templates/modules/stasy-table.html [deleted file]
src/web/__init__.py
src/web/ui_modules.py

diff --git a/src/templates/modules/builds.html b/src/templates/modules/builds.html
deleted file mode 100644 (file)
index 5b24269..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-<tr>
-       <td>
-               <img src="{{ static_url("images/icons/ipfire.png") }}" alt="IPFire" />
-       </td>
-       <td>
-               &nbsp;<br />
-               <strong>{{ build.release }}</strong> ({{ build.arch }})<br />
-               {{ build.date }}
-       </td>
-       <td>
-               &nbsp;<br />
-               <a href="#">{{ build.iso }}</a> | {{ build.size }}<br />
-               {{ build.pxe }}&nbsp;
-       </td>
-</tr>
diff --git a/src/templates/modules/donation-box.html b/src/templates/modules/donation-box.html
deleted file mode 100644 (file)
index c5ae877..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-<div class="row">
-       <div class="col-lg-6 col-md-6">
-               <h4 class="text-center">{{ _("Donate with PayPal") }}</h4>
-
-               <div class="ac">
-                       {% module DonationButton(reason_for_transfer=reason_for_transfer) %}
-
-                       <br>
-
-                       <ul class="list-inline">
-                               {% for currency in ("USD", "GBP", "CHF", "AUD", "NZD", "CAD") %}
-                                       <li>
-                                               {% module DonationButton(reason_for_transfer=reason_for_transfer, currency=currency) %}
-                                       </li>
-                               {% end %}
-                       </ul>
-               </div>
-       </div>
-
-       <div class="col-lg-6 col-md-6">
-               <h4 class="text-center">{{ _("Donate by Bank Transfer") }}</h4>
-
-               <dl class="dl-horizontal">
-                       <dt>{{ _("IBAN") }}</dt>
-                       <dd>DE76 3605 0105 1010 8206 84</dd>
-
-                       <dt>{{ _("BIC-/SWIFT-Code") }}</dt>
-                       <dd>SPESDE3EXXX</dd>
-
-                       {% if reason_for_transfer %}
-                               <dt>{{ _("Reason for transfer") }}</dt>
-                               <dd>{{ reason_for_transfer }}</dd>
-                       {% end %}
-               </dl>
-
-               <p class="ac">
-                       <small>
-                               The IPFire project is not a registered non-profit organisation.
-                               <br>
-                               Hence we are not able to issue a tax-deductible contribution receipt
-                               for your donation.
-                       </small>
-               </p>
-       </div>
-</div>
diff --git a/src/templates/modules/donation-button.html b/src/templates/modules/donation-button.html
deleted file mode 100644 (file)
index 2c22954..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
-       <input type="hidden" name="cmd" value="_donations">
-       <input type="hidden" name="business" value="QBQCHP9ZK7GYY">
-       <input type="hidden" name="lc" value="{{ lc }}">
-       <input type="hidden" name="item_name" value="{{ reason_for_transfer or "IPFire.org" }}">
-       <input type="hidden" name="no_note" value="0">
-       <input type="hidden" name="cn" value="{{ _("Send a note to the project:") }}">
-       <input type="hidden" name="no_shipping" value="1">
-       <input type="hidden" name="currency_code" value="{{ currency }}">
-       <input type="hidden" name="bn" value="PP-DonationsBF:btn_donate_LG.gif:NonHosted">
-       {% if primary %}
-               <input type="submit" class="btn btn-primary" value="{{ _("Donate %s") % currency }}">
-       {% else %}
-               <input type="submit" class="btn btn-link" value="{{ currency }}">
-       {% end %}
-</form>
diff --git a/src/templates/modules/donation-input-box.html b/src/templates/modules/donation-input-box.html
deleted file mode 100644 (file)
index d56e7e6..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-<form class="form-inline" action="https://www.paypal.com/cgi-bin/webscr" method="POST" target="_top">
-       <input type="hidden" name="cmd" value="_donations">
-       <input type="hidden" name="business" value="QBQCHP9ZK7GYY">
-       <input type="hidden" name="lc" value="{{ lc }}">
-       <input type="hidden" name="item_name" value="{{ _("Donation to the IPFire Project") }}">
-       <input type="hidden" name="no_note" value="0">
-       <input type="hidden" name="cn" value="{{ _("Send a note to the project:") }}">
-       <input type="hidden" name="no_shipping" value="1">
-       <input type="hidden" name="bn" value="PP-DonationsBF:btn_donate_LG.gif:NonHosted">
-
-       <div class="form-group d-flex justify-content-center flex-column d-inline-flex">
-               <label class="sr-only" for="InputAmount">{{ _("Amount") }}</label>
-               <div class="input-group d-flex flex-row-reverse justify-content-center">
-                       <div class="input-group-addon">
-                               <select class="form-control mx-3" name="currency_code">
-                                       {% for c in currencies %}
-                                               <option value="{{ c }}">
-                                                       {% if c == "EUR" %}
-                                                               €
-                                                       {% elif c == "USD" %}
-                                                               US$
-                                                       {% elif c == "GBP" %}
-                                                               £
-                                                       {% else %}
-                                                               {{ c }}
-                                                       {% end %}
-                                               </option>
-                                       {% end %}
-                               </select>
-                       </div>
-
-                       <input type="text" class="form-control input-lg" id="InputAmount"
-                               name="amount" placeholder="{{ _("Amount") }}">
-               </div>
-
-               <button type="submit" class="btn btn-lg btn-primary mt-3">{{ _("Donate with PayPal") }}</button>
-       </div>
-</form>
diff --git a/src/templates/modules/planet/search-box.html b/src/templates/modules/planet/search-box.html
deleted file mode 100644 (file)
index 3fc3f67..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-<div class="row">
-       <div class="col-lg-6 col-md-6 col-lg-offset-3 ac">
-               <form class="form-inline" action="/search" method="GET">
-                       <div class="form-group">
-                               <label class="sr-only" for="searchBox">{{ _("Search") }}</label>
-                               <input type="text" class="form-control" name="q" id="searchBox"
-                                       placeholder="{{ _("Search") }}" autocomplete="off" {% if query %}value="{{ query }}"{% end %}>
-                               <button type="submit" class="btn btn-default">
-                                       <i class="glyphicon glyphicon-search"></i>
-                               </button>
-                       </div>
-               </form>
-       </div>
-</div>
diff --git a/src/templates/modules/sidebar-banner.html b/src/templates/modules/sidebar-banner.html
deleted file mode 100644 (file)
index f15a4c2..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-{% if item %}
-       <h4>{{ item.caption }}</h4>
-       <a href="{{ item.uri }}" {% if item.uri.startswith("https://") %}target="_blank" {% end %}>
-               <img src="{{ static_url("images/banners/" + item.image) }}" border="0" alt="{{ _("Banner") }}" />
-       </a>
-{% end %}
diff --git a/src/templates/modules/sidebar-item.html b/src/templates/modules/sidebar-item.html
deleted file mode 100644 (file)
index 7ebff07..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-<h4>{% block heading %}{{ item.heading }}{% end block %}</h4>
-{% block body %}{{ item.body }}{% end block %}
diff --git a/src/templates/modules/sidebar-release.html b/src/templates/modules/sidebar-release.html
deleted file mode 100644 (file)
index 8796240..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-{% if latest %}
-       <!-- XXX not good style -->
-       <div style="text-align: center;">
-               <h3>{{ _("Latest release") }}</h3>
-               <p>
-                       <a href="/downloads">{{ latest.name }}</a>
-               </p>
-               <p>
-                       <a class="btn btn-success" href="/downloads">{{ _("Download now") }}</a>
-               </p>
-       </div>
-{% end %}
diff --git a/src/templates/modules/stasy-table.html b/src/templates/modules/stasy-table.html
deleted file mode 100644 (file)
index e5b63fd..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-<dl class="dl-horizontal">
-       {% for k, v in items %}
-               <dt>{{ k }}</dt>
-               <dd>
-                       <div class="progress">
-                               <div class="progress-bar" style="{{ "width: %.2f%%" % v }}">
-                                       {{ "%.2f" % v }}%
-                               </div>
-                       </div>
-               </dd>
-       {% end %}
-</dl>
index 686bbd21da62bd2d80d244a41e755a977e6dcda5..d0189fa9bd3db25faf49aefd6c1b49ba08bdcac9 100644 (file)
@@ -40,6 +40,8 @@ class Application(tornado.web.Application):
                                "format_month_name" : self.format_month_name,
                        },
                        "ui_modules" : {
+                               "Menu"                 : MenuModule,
+
                                # Blog
                                "BlogHistoryNavigation": blog.HistoryNavigationModule,
                                "BlogList"             : blog.ListModule,
@@ -50,13 +52,9 @@ class Application(tornado.web.Application):
                                "Map"                  : MapModule,
 
                                # Old modules
-                               "Advertisement"        : AdvertisementModule,
-                               "DonationBox"          : DonationBoxModule,
-                               "DonationButton"       : DonationButtonModule,
-                               "DonationInputBox"     : DonationInputBoxModule,
                                "DownloadButton"       : DownloadButtonModule,
                                "LanguageName"         : LanguageNameModule,
-                               "Menu"                 : MenuModule,
+
                                "MirrorItem"           : MirrorItemModule,
                                "MirrorsTable"         : MirrorsTableModule,
                                "NetBootMenuConfig"    : NetBootMenuConfigModule,
@@ -64,8 +62,6 @@ class Application(tornado.web.Application):
                                "NetBootMenuSeparator" : NetBootMenuSeparatorModule,
                                "ProgressBar"          : ProgressBarModule,
                                "ReleaseItem"          : ReleaseItemModule,
-                               "SidebarBanner"        : SidebarBannerModule,
-                               "SidebarRelease"       : SidebarReleaseModule,
                                "FireinfoDeviceTable"     : FireinfoDeviceTableModule,
                                "FireinfoDeviceAndGroupsTable" : FireinfoDeviceAndGroupsTableModule,
                                "FireinfoGeoTable"        : FireinfoGeoTableModule,
index b05440b5d166237d0a38a697befa58f5d42b51c8..c73a39563ad33673ec72666af317dfbaecf17eb3 100644 (file)
@@ -24,10 +24,6 @@ class UIModule(tornado.web.UIModule):
        def accounts(self):
                return self.handler.accounts
 
-       @property
-       def advertisements(self):
-               return self.handler.advertisements
-
        @property
        def banners(self):
                return self.handler.banners
@@ -49,20 +45,6 @@ class UIModule(tornado.web.UIModule):
                return self.handler.talk
 
 
-class AdvertisementModule(UIModule):
-       def render(self, where):
-               assert where in ("download-splash",), where
-
-               ad = self.advertisements.get(where)
-               if not ad:
-                       return ""
-
-               # Mark that advert has been shown.
-               ad.update_impressions()
-
-               return self.render_string("modules/ads/%s.html" % where, ad=ad)
-
-
 class FireinfoDeviceTableModule(UIModule):
        def render(self, devices):
                return self.render_string("fireinfo/modules/table-devices.html",
@@ -190,17 +172,6 @@ class NetBootMenuSeparatorModule(UIModule):
                return self.render_string("netboot/menu-separator.cfg")
 
 
-class SidebarItemModule(UIModule):
-       def render(self):
-               return self.render_string("modules/sidebar-item.html")
-
-
-class SidebarReleaseModule(UIModule):
-       def render(self):
-               return self.render_string("modules/sidebar-release.html",
-                       latest=self.releases.get_latest())
-
-
 class ReleaseItemModule(UIModule):
        def render(self, release, latest=False):
                arches = ("x86_64", "i586", "arm")
@@ -222,14 +193,6 @@ class ReleaseItemModule(UIModule):
                        release=release, latest=latest, downloads=downloads)
 
 
-class SidebarBannerModule(UIModule):
-       def render(self, item=None):
-               if not item:
-                       item = self.banners.get_random()
-
-               return self.render_string("modules/sidebar-banner.html", item=item)
-
-
 class DownloadButtonModule(UIModule):
        def render(self, release, text="Download now!"):
                best_image = None
@@ -301,93 +264,3 @@ class TalkOngoingCallsModule(UIModule):
 
                return self.render_string("talk/modules/ongoing-calls.html",
                        account=account, channels=channels, debug=debug)
-
-
-class DonationBoxModule(UIModule):
-       def render(self, reason_for_transfer=None):
-               if reason_for_transfer:
-                       reason_for_transfer = "IPFire.org - %s" % reason_for_transfer
-
-               return self.render_string("modules/donation-box.html",
-                       reason_for_transfer=reason_for_transfer)
-
-
-class DonationButtonModule(UIModule):
-       # https://developer.paypal.com/docs/classic/paypal-payments-standard/integration-guide/Appx_websitestandard_htmlvariables/
-       COUNTRIES = (
-               "AU",
-               "AT",
-               "BE",
-               "BR",
-               "CA",
-               "CH",
-               "CN",
-               "DE",
-               "ES",
-               "GB",
-               "FR",
-               "IT",
-               "NL",
-               "PL",
-               "PT",
-               "RU",
-               "US",
-       )
-
-       LOCALES = (
-               "da_DK",
-               "he_IL",
-               "id_ID",
-               "ja_JP",
-               "no_NO",
-               "pt_BR",
-               "ru_RU",
-               "sv_SE",
-               "th_TH",
-               "zh_CN",
-               "zh_HK",
-               "zh_TW",
-       )
-
-       def render(self, reason_for_transfer=None, currency="EUR"):
-               if not reason_for_transfer:
-                       reason_for_transfer = "IPFire.org"
-
-               primary = (currency == "EUR")
-
-               return self.render_string("modules/donation-button.html", primary=primary,
-                       reason_for_transfer=reason_for_transfer, currency=currency, lc=self.lc)
-
-       @property
-       def lc(self):
-               """
-                       Returns the locale of the user
-               """
-               try:
-                       locale, delimiter, encoding = self.locale.code.partition(".")
-
-                       # Break for languages in specific countries
-                       if locale in self.LOCALES:
-                               return locale
-
-                       lang, delimiter, country_code = locale.partition("_")
-
-                       if country_code and country_code in self.COUNTRIES:
-                               return country_code
-
-                       lang = lang.upper()
-                       if lang in self.COUNTRIES:
-                               return lang
-               except:
-                       pass
-
-               # If anything goes wrong, fall back to GB
-               return "GB"
-
-
-class DonationInputBoxModule(DonationButtonModule):
-       def render(self):
-               currencies = ("EUR", "USD", "GBP", "CHF", "AUD", "NZD", "CAD")
-
-               return self.render_string("modules/donation-input-box.html",
-                       currencies=currencies, lc=self.lc)