[Mpuls-commits] r312 - in wasko/trunk: . waskaweb/controllers waskaweb/model waskaweb/public/styles

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu Feb 26 17:01:37 CET 2009


Author: teichmann
Date: 2009-02-26 17:01:32 +0100 (Thu, 26 Feb 2009)
New Revision: 312

Modified:
   wasko/trunk/ChangeLog.txt
   wasko/trunk/waskaweb/controllers/case.py
   wasko/trunk/waskaweb/model/phases_factory.py
   wasko/trunk/waskaweb/public/styles/color3.css
Log:
Increased the usability of the phase overview page.



Modified: wasko/trunk/ChangeLog.txt
===================================================================
--- wasko/trunk/ChangeLog.txt	2009-02-26 14:51:53 UTC (rev 311)
+++ wasko/trunk/ChangeLog.txt	2009-02-26 16:01:32 UTC (rev 312)
@@ -1,5 +1,19 @@
 2009-02-26	Sascha L. Teichmann <teichmann at intevation.de>
 
+	Increased the usability of the phase overview page.
+
+	* waskaweb/model/phases_factory.py: If the number of missing fields in a 
+	  phase are less than six, now direct links into the case are generated.
+	  Reduce the use of color red, emphasize page names, short long item 
+	  descriptions to length of 15 and render more descriptive title for the links.
+
+	* waskaweb/controllers/case.py: link generator callback now allows trailing
+	  text to be able to render '#' offsets in page.
+
+	* waskaweb/public/styles/color3.css: Made .require_field a general class.
+
+2009-02-26	Sascha L. Teichmann <teichmann at intevation.de>
+
 	* waskaweb/model/phases_factory.py: Fixed one code path the inverts
 	  the results of rule evaluation leading to wrong list of missing fields.
 	  Left debug code in. (commented out)

Modified: wasko/trunk/waskaweb/controllers/case.py
===================================================================
--- wasko/trunk/waskaweb/controllers/case.py	2009-02-26 14:51:53 UTC (rev 311)
+++ wasko/trunk/waskaweb/controllers/case.py	2009-02-26 16:01:32 UTC (rev 312)
@@ -587,7 +587,7 @@
         session_case = session.get('case')
 
         mode = session_case and session_case.getMode() or "show" 
-        link = lambda ti: '"/case/%s/%d/%s"' % (mode, id, ti.key)
+        link = lambda ti, extra = "": '"/case/%s/%d/%s%s"' % (mode, id, ti.key, extra)
 
         rf = RequiredFields(g.formedTree)
 

Modified: wasko/trunk/waskaweb/model/phases_factory.py
===================================================================
--- wasko/trunk/waskaweb/model/phases_factory.py	2009-02-26 14:51:53 UTC (rev 311)
+++ wasko/trunk/waskaweb/model/phases_factory.py	2009-02-26 16:01:32 UTC (rev 312)
@@ -35,6 +35,8 @@
 
 from waskaweb.model.casedocument     import WARNING
 
+from xml.sax.saxutils                import quoteattr
+
 import re
 import sys
 import traceback
@@ -43,7 +45,7 @@
 
 PAIRS = (
     (CLEAR_START, CLEAR_ENDE, u"Eingangs-<wbr />Dokumentation"),
-    (CM_START,    CM_ENDE,    u"Case<wbr />Management"),
+    (CM_START,    CM_ENDE,    u"Case Management"),
     (NB_START,    NB_ENDE,    u"Nach&shy;betreuung"))
 
 def description(nc):
@@ -64,6 +66,9 @@
         p = p.parent
     return p
 
+def nescape(s):
+    return escape(s).replace(' ', '&nbsp;')
+
 class RequiredFields:
 
     def __init__(self, formed):
@@ -184,25 +189,53 @@
                 tree_item = navigation.findTreeItemByPageName(p_name)
                 if not tree_item: continue
                 tree_item = tree_item.deepest_item()
-                t = [tree_item, 0]
+                t = [tree_item, []]
                 pages.append(t)
                 used_pages[p_name] = t
 
             if var.getName() in missing_set:
-                t[1] += 1
+                t[1].append(var)
 
-        out = []
-        for tree_item, misses in pages:
-            #print >> sys.stderr, "page: %s %s" % (tree_item.name, miss)
-            warn, errors = misses and ('class="required_missing"', (" (%d)" % misses)) or ("", "")
-            out.append('<a href=%s %s title="%s">%s' % (
-                link(tree_item),
-                warn,
-                (misses and u"Anzahl der fehlenden Felder in Klammern" or u"Phase vollständig"),
-                escape(tree_item.description + errors).replace(' ', '&nbsp;')))
+        if not pages: return u""
 
-        return u",</a> ".join(out) + (out and "</a>" or "")
+        out = [u"<ul>"]
+        for tree_item, warn in pages:
+            out.append(u"<li>")
+            if not warn:
+                out.append(u'<a href=%s title="Seite für Phase vollständig ausgefüllt"><strong>%s</strong></a>' % (
+                    link(tree_item), nescape(tree_item.description)))
+            else:
+                if len(warn) < 6:
+                    out2 = []
+                    for v in warn:
+                        desc = description(v)
+                        if len(desc) > 15:
+                            title = quoteattr(u"Fehlende Angabe: %s" % desc)
+                            desc  = escape(desc[0:15] + "...")
+                        else:
+                            title = u'"Fehlende Angabe für diese Phase"'
+                            desc  = escape(desc)
 
+                        out2.append(
+                            u'<a href=%s class="required_missing" '
+                            u'title=%s>%s' % (
+                                link(tree_item, u"#f_" + v.getName()),
+                                title, desc))
+                    links = u",</a> ".join(out2) + u"</a>"
+                    out.append(u'<strong>%s</strong>: %s' % (nescape(tree_item.description), links))
+                else:
+                    out.append(
+                        u'<a href=%s '
+                        u'title="Auf dieser Seite sind noch %d Felder auszufüllen." '
+                        u'><strong>%s <span class="required_missing">(%d)</span></strong></a>' % (
+                            link(tree_item), len(warn), 
+                            nescape(tree_item.description), len(warn)))
+            out.append(u"</li>")
+
+        out.append(u"</ul>")
+
+        return u"".join(out)
+
     def phases_pairs(self, current_phase, navigation=None, link=None):
 
         pairs = []

Modified: wasko/trunk/waskaweb/public/styles/color3.css
===================================================================
--- wasko/trunk/waskaweb/public/styles/color3.css	2009-02-26 14:51:53 UTC (rev 311)
+++ wasko/trunk/waskaweb/public/styles/color3.css	2009-02-26 16:01:32 UTC (rev 312)
@@ -143,10 +143,16 @@
 	background:#d5d5d5; /**/
 }
 
-table#cmphases td.required_field a.required_missing {
+/*
+table#cmphases td.required_field {
 	color:#a5103b;
 }
+*/
 
+.required_missing {
+	color:#a5103b;
+}
+
 table#cmphases td.cm_phase_state_valid {
 	background:green;
 }



More information about the Mpuls-commits mailing list