]> git.ipfire.org Git - ipfire.org.git/commitdiff
fireinfo: Add flags to geo statistics.
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 4 Jan 2011 19:28:57 +0000 (20:28 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 4 Jan 2011 19:28:57 +0000 (20:28 +0100)
www/static/images/flags/en.png [new symlink]
www/templates/modules/stasy-table.html
www/templates/stasy-stats-geo.html
www/webapp/ui_modules.py

diff --git a/www/static/images/flags/en.png b/www/static/images/flags/en.png
new file mode 120000 (symlink)
index 0000000..288cc7b
--- /dev/null
@@ -0,0 +1 @@
+gb.png
\ No newline at end of file
index 0c1353ed68d5727b08cd4b4bee12bfb8aa2eee71..7717b784de768eb8ddd88bcddb7c949ca995a591 100644 (file)
@@ -1,7 +1,12 @@
 <table class="stats">
        {% for k, v in items %}
                <tr>
-                       <td class="key">{{ k }}</td>
+                       <td class="key">
+                               {% if flags %}
+                                       <img src="{{ static_url("images/flags/%s.png" % k) }}" />
+                               {% end %}
+                               {{ k }}
+                       </td>
                        <td class="bar"><p style="{{ "width: %.2f%%" % v }}">&nbsp;</p></td>
                        <td class="value">{{ "%.2f" % v }}%</td>
                </tr>
index ca9d8aa56b67ae5d2d4f0f366b35c41ef68d1747..ee296e749c43cdff0f1f49453d709f175e40799a 100644 (file)
@@ -8,12 +8,12 @@
                This will give a short overview about what languages are configured
                on the IPFire webinterface.
        </p>
-       {{ modules.StasyTable(languages, sortby="percentage") }}
+       {{ modules.StasyTable(languages, sortby="percentage", flags=True) }}
 
 
        <h3>{{ _("Geo locations") }}</h3>
        <p>
                This chart shows us in which country IPFire is running.
        </p>
-       {{ modules.StasyTable(geo_locations, sortby="percentage") }}
+       {{ modules.StasyTable(geo_locations, sortby="percentage", flags=True) }}
 {% end block %}
index eefb842670a395286e70617a55fb8b667d81a4e8..a3964ffa041dd2b709972780c1cc150e88a5cf42 100644 (file)
@@ -141,7 +141,7 @@ class TrackerPeerListModule(UIModule):
 
 
 class StasyTableModule(UIModule):
-       def render(self, items, sortby="key", reverse=False, percentage=False):
+       def render(self, items, sortby="key", reverse=False, percentage=False, flags=False):
                hundred_percent = 0
                for v in items.values():
                        hundred_percent += v
@@ -174,7 +174,7 @@ class StasyTableModule(UIModule):
                                _items.append((k, v))
                        items = _items
 
-               return self.render_string("modules/stasy-table.html", items=items)
+               return self.render_string("modules/stasy-table.html", items=items, flags=flags)
 
 
 class StasyDeviceTableModule(UIModule):