Module: check_mk
Branch: master
Commit: 02afa8e6538849a5a7977b5843c4c1206c1774c8
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=02afa8e6538849…
Author: Bastian Kuhn <bk(a)mathias-kettner.de>
Date: Thu Jan 12 13:24:51 2012 +0100
MobileUI: New sorting for main page
---
ChangeLog | 3 +++
web/htdocs/mobile.py | 33 ++++++++++++++++++++-------------
2 files changed, 23 insertions(+), 13 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index f27558c..ae87de8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -39,6 +39,9 @@
* FIX: Fixed auth problem when following logwatch icon links while using
the form based auth
+ Mobile:
+ * Improved sorting of views in main page
+
WATO:
* Removed IP-Address attribute from folders
* FIX: Fixed missing folders in "move to" dropdown fields
diff --git a/web/htdocs/mobile.py b/web/htdocs/mobile.py
index 9d441bc..0409e17 100644
--- a/web/htdocs/mobile.py
+++ b/web/htdocs/mobile.py
@@ -117,19 +117,26 @@ def jqm_page_navfooter(items, current, page_id):
html.write('</div>') # close page-div
-def jqm_page_index(title, items):
- last_topic = ''
- first_run = True
- items.sort(cmp = lambda a,b: cmp((a[0],a[2]),(b[0],b[2])))
- for topic, href, title in items:
- if last_topic != topic:
- if first_run != True:
- html.write("</ul>")
- last_topic = topic
- html.write('<p>%s</p><ul data-role="listview"
data-inset="true">\n' % topic)
- first_run = False;
- html.write('<li><a data-ajax="false"
data-transition="flip" href="%s">%s</a></li>\n' %
(href, title))
- html.write("</ul>\n")
+def jqm_page_index(title, items):
+ manual_sort = [_("Hosts"), _("Services"), _("Events")]
+
+ for topic in manual_sort:
+ jqm_page_index_topic_renderer(topic, items)
+
+ other_topics = list(set([ x[0] for x in items if x[0] not in manual_sort]))
+ other_topics.sort()
+
+ for topic in other_topics:
+ jqm_page_index_topic_renderer(topic, items)
+
+
+def jqm_page_index_topic_renderer(topic, items):
+ html.write('<p>%s</p><ul data-role="listview"
data-inset="true">\n' % topic)
+ for top, href, title in items:
+ if top == topic:
+ html.write('<li><a data-ajax="false"
data-transition="flip" href="%s">%s</a></li>\n' %
(href, title))
+ html.write('</ul>')
+
def jqm_page(title, content, foot, id=None):
jqm_page_header(title, id)