[Mpuls-commits] r3816 - in base/trunk: . mpulsweb/lib mpulsweb/model mpulsweb/templates/casemanagement mpulsweb/templates/phase

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Sep 29 10:36:56 CEST 2010


Author: torsten
Date: 2010-09-29 10:36:54 +0200 (Wed, 29 Sep 2010)
New Revision: 3816

Modified:
   base/trunk/ChangeLog
   base/trunk/mpulsweb/lib/config.py
   base/trunk/mpulsweb/model/phase.py
   base/trunk/mpulsweb/templates/casemanagement/digest.mako
   base/trunk/mpulsweb/templates/phase/phase.mako
Log:
Issue1114: Prepared phasenmodell for including the unknown phase as it is
somehow part of the phasemodell.


Modified: base/trunk/ChangeLog
===================================================================
--- base/trunk/ChangeLog	2010-09-28 18:11:06 UTC (rev 3815)
+++ base/trunk/ChangeLog	2010-09-29 08:36:54 UTC (rev 3816)
@@ -46,6 +46,21 @@
 
 2010-09-28  Torsten Irländer <torsten.irlaender at intevation.de>
 
+	Issue1114:
+
+	* mpulsweb/lib/config.py: Added new config variable to hide the
+	  "unknown" phase in the gui. Defaults to True.
+	* templates/phase/phase.mako: Use new config var to hide "unknown"
+	  phase. Render "no required fields found" label if a phase has no
+	  required fields. 
+	* templates/casemanagement/digest.mako: Use new config var to hide
+	  "unknown" phase.  
+	* model/phase.py: Fixed handling phases with no required fields. Fixed
+	  building of predesessors. Currently each phase is limited to one
+	  predesessor. 
+
+2010-09-28  Torsten Irländer <torsten.irlaender at intevation.de>
+
 	* mpulsweb/lib/helper/case.py (phase_time_in_weeks): Issue1121: Added
 	new function to format duration of phase in casedigest in a more human
 	readable form

Modified: base/trunk/mpulsweb/lib/config.py
===================================================================
--- base/trunk/mpulsweb/lib/config.py	2010-09-28 18:11:06 UTC (rev 3815)
+++ base/trunk/mpulsweb/lib/config.py	2010-09-29 08:36:54 UTC (rev 3816)
@@ -227,6 +227,11 @@
         #   * 2 = Full automatic
         set('phases', 'changemode', '0')
 
+        # Hide "unknown" phase in GUI. The unknown phase is part of the
+        # phasemodel but we very likley do not want it to be displayed in the
+        # GUI. So set this value to 1 on default  
+        set('phases', 'hideunknown', '1')
+
         # Depending on the set phasepart the case is considered as CM-Case or Beratungs-Case.
         # Here you can define the type of case for each phasepart
         set('phases', 'casetype', [{}])

Modified: base/trunk/mpulsweb/model/phase.py
===================================================================
--- base/trunk/mpulsweb/model/phase.py	2010-09-28 18:11:06 UTC (rev 3815)
+++ base/trunk/mpulsweb/model/phase.py	2010-09-29 08:36:54 UTC (rev 3816)
@@ -84,7 +84,7 @@
         for k, v in self.suc.iteritems():
             for p in v:
                 self.pre[p] = []
-                self.pre[p].extend(k)
+                self.pre[p].append(k)
 
     def build(self):
         '''Build phaselist from metadata'''
@@ -329,10 +329,9 @@
     def getLinks(self):
         pages = {}
         order = []
+        p2 = {}
         if len(self.fields) > 0:
-            p2 = {}
             for field in [field for field in self.fields]:
-                log.debug(field.page)
                 if not p2.has_key(field.page):
                     p2[field.page] = []
                 p2[field.page].append(field)

Modified: base/trunk/mpulsweb/templates/casemanagement/digest.mako
===================================================================
--- base/trunk/mpulsweb/templates/casemanagement/digest.mako	2010-09-28 18:11:06 UTC (rev 3815)
+++ base/trunk/mpulsweb/templates/casemanagement/digest.mako	2010-09-29 08:36:54 UTC (rev 3816)
@@ -138,6 +138,7 @@
                          str(c.case.getState().getPhase()),only_reachable=False) 
           %>
           % for phase in c.case.get_phaseslist():
+            <% if phase.id == "-1" and g.mpuls_config.is_enabled('phases', 'hideunknown'): continue  %>
             %  if phase.getStart().id in reachable or phase.getEnd().id in reachable:
               <li>
                 ${phase.description}<br>

Modified: base/trunk/mpulsweb/templates/phase/phase.mako
===================================================================
--- base/trunk/mpulsweb/templates/phase/phase.mako	2010-09-28 18:11:06 UTC (rev 3815)
+++ base/trunk/mpulsweb/templates/phase/phase.mako	2010-09-29 08:36:54 UTC (rev 3816)
@@ -31,6 +31,7 @@
       <% phases_are_valid = c.phases.is_valid() %>
       <% current_phase = c.phases.get_current_phase_id() %>
       % for num, phase in enumerate(c.phases): 
+      <% if phase.id == "-1" and g.mpuls_config.is_enabled('phases', 'hideunknown'): continue  %>
 
       <% p1, p2 = phase.getStart(), phase.getEnd()  %>
       ## Only show phases which are are on the path of the current phase, or
@@ -63,14 +64,18 @@
           % endif
           <td class="note" style="border-bottom: 1pt dotted; border-color: #000;">
             <% pages, order = p1.getLinks() %>
-            % for key in order:
-              <% fields = pages.get(key, []) %>
-              % if len(fields) > 0:
-                <strong>${key}</strong>:
-                ${h.literal(", ".join([f.get_link() for f in fields]))}
-              % endif
-              <br>
-            % endfor
+            % if len(pages) > 0:
+              % for key in order:
+                <% fields = pages.get(key, []) %>
+                % if len(fields) > 0:
+                  <strong>${key}</strong>:
+                  ${h.literal(", ".join([f.get_link() for f in fields]))}
+                % endif
+                <br>
+              % endfor
+            % else:
+              ${_('No required fields found')} 
+            % endif
           </td>
           <td class="note center middle" style="border-bottom: 1pt dotted; border-color: #000;">
             ${h.NA(h.format_date(p1.getTime()))}
@@ -91,14 +96,18 @@
           % endif
           <td class="note">
             <% pages, order = p2.getLinks() %>
-            % for key in order:
-              <% fields = pages.get(key) %>
-              % if len(fields) > 0:
-                <strong>${key}</strong>:
-                ${h.literal(", ".join([f.get_link() for f in fields]))}
-              % endif
-              <br>
-            % endfor
+            % if len(pages) > 0:
+              % for key in order:
+                <% fields = pages.get(key) %>
+                % if len(fields) > 0:
+                  <strong>${key}</strong>:
+                  ${h.literal(", ".join([f.get_link() for f in fields]))}
+                % endif
+                <br>
+              % endfor
+            % else:
+              ${_('No required fields found')}
+            % endif
           </td>
           <td class="note center middle">${h.NA(h.format_date(p2.getTime()))}</td>
           <td class="actions">
@@ -127,6 +136,7 @@
       <th class="actions">${_('Duration in weeks')}</th>
     </tr>
     % for num, phase in enumerate(c.phases): 
+      <% if phase.id == "-1" and g.mpuls_config.is_enabled('phases', 'hideunknown'): continue  %>
       <% 
         t = phase.getDuration() 
         if t: total = total and (total + t) or t



More information about the Mpuls-commits mailing list