Skip to content

/ Zope / gocept svn checkins / Archive / 2005 / 2005-08 / SVN: r3259 - in glome/trunk: . skins/glome_ecmascript skins/glome_widgets

[ << ] [ >> ]

[ SVN: r3228 - LeuBsm/trunk/skins/leu_content / ... ] [ SVN: r3294 - branches tags trunk ... ]

SVN: r3259 - in glome/trunk: . skins/glome_ecmascript skins/glome_widgets
Christian Theune <ct(at)gocept.com>
2005-08-19 10:53:50 [ FULL ]
Author: ctheune
Date: Fri Aug 19 10:55:11 2005
New Revision: 3259

Added:
   glome/trunk/skins/glome_ecmascript/instant_selection.js
   glome/trunk/skins/glome_widgets/iframe_widget.pt
   glome/trunk/skins/glome_widgets/instant_selection_widget.pt
Modified:
   glome/trunk/widgets.py
Log:
 - Two new widgets: InstantSelection and IFrame



Added: glome/trunk/skins/glome_ecmascript/instant_selection.js
==============================================================================
--- (empty file)
+++ glome/trunk/skins/glome_ecmascript/instant_selection.js	Fri Aug 19 10:55:11
2005
(at)(at) -0,0 +1,7 (at)(at)
+// Copyright (c) 2004 gocept gmbh & co. kg
+// See also LICENSE.txt
+// $Id$
+
+function notifyInstantSelectionChange(changed) {
+    changed.form.submit();
+}

Added: glome/trunk/skins/glome_widgets/iframe_widget.pt
==============================================================================
--- (empty file)
+++ glome/trunk/skins/glome_widgets/iframe_widget.pt	Fri Aug 19 10:55:11 2005
(at)(at) -0,0 +1,41 (at)(at)
+<html xmlns="http://www.w3.org/1999/xhtml"
+      xmlns:tal="http://xml.zope.org/namespaces/tal"
+      xmlns:metal="http://xml.zope.org/namespaces/metal"
+      xmlns:i18n="http://xml.zope.org/namespaces/i18n"
+      i18n:domain="plone">
+
+<head>
+    <title></title>
+</head>
+
+<body>
+
+    <!-- Selection Widgets -->
+
+    <metal:view_macro define-macro="view"
+                      tal:define="value python:accessor();">
+          <iframe 
+            height="400" 
+            width="500" 
+            frameborder="0"
+            tal:condition="value"
+            tal:attributes="src value">
+          </iframe>
+    </metal:view_macro>
+
+    <metal:define define-macro="edit">
+        <metal:use use-macro="field_macro |
here/widgets/field/macros/edit">
+            <metal:fill fill-slot="widget_body">
+                  <div
metal:use-macro="here/widgets/iframe_widget/macros/view" />
+            </metal:fill>
+        </metal:use>
+    </metal:define>
+
+    <div metal:define-macro="search">
+        <div metal:use-macro="here/widgets/iframe_widget/macros/view" />
+    </div>
+
+
+</body>
+
+</html>

Added: glome/trunk/skins/glome_widgets/instant_selection_widget.pt
==============================================================================
--- (empty file)
+++ glome/trunk/skins/glome_widgets/instant_selection_widget.pt	Fri Aug 19
10:55:11 2005
(at)(at) -0,0 +1,54 (at)(at)
+<html xmlns="http://www.w3.org/1999/xhtml"
+      xmlns:tal="http://xml.zope.org/namespaces/tal"
+      xmlns:metal="http://xml.zope.org/namespaces/metal"
+      xmlns:i18n="http://xml.zope.org/namespaces/i18n"
+      i18n:domain="plone">
+
+<head>
+    <title></title>
+</head>
+
+<body>
+
+    <!-- Selection Widgets -->
+
+    <metal:view_macro define-macro="view"
+                      tal:define="vocab python:field.Vocabulary(here);
+                                  value python:accessor();
+                                  display python:here.displayValue(vocab,
value)"
+                      tal:replace="structure display" />
+
+    <metal:define define-macro="edit">
+
+        <metal:use use-macro="field_macro |
here/widgets/field/macros/edit">
+
+            <metal:fill fill-slot="widget_body"
+                        tal:define="vocab python:field.Vocabulary(here)" >
+
+                    <!-- Pulldown when longer -->
+                    <select tal:attributes="name fieldName;
+                                            id fieldName;
+                                            tabindex tabindex/next;"
+                                           
onChange="notifyInstantSelectionChange(this);">
+
+                        <option tal:repeat="item vocab"
+                                tal:attributes="value item;
+                                                selected
python:here.checkSelected(item, value) and 'selected' or None"
+                               
tal:content="python:here.translate(vocab.getMsgId(item),
default=vocab.getValue(item))"
+                                i18n:translate=""
+                                />
+                    </select>
+
+            </metal:fill>
+
+        </metal:use>
+
+    </metal:define>
+
+    <div metal:define-macro="search">
+        <div
metal:use-macro="here/widgets/instant_selection_widget/macros/edit" />
+    </div>
+
+</body>
+
+</html>

Modified: glome/trunk/widgets.py
==============================================================================
--- glome/trunk/widgets.py	(original)
+++ glome/trunk/widgets.py	Fri Aug 19 10:55:11 2005
(at)(at) -2,12 +2,14 (at)(at)
 # See also LICENSE.txt
 # $Id$
 
-__all__ = ('ExtFileWidget',
+__all__ = ('ComputedWidget',
            'DefaultOrCustomWidget',
            'DictWidget',
            'DynamicSelectionWidget',
+           'ExtFileWidget',
+           'IFrameWidget',
            'InputCalendarWidget',
-           'ComputedWidget',
+           'InstantSelectionWidget',
            'QuoteStringWidget',
            )
 
(at)(at) -24,6 +26,20 (at)(at)
             'macro':'extfile_widget'
             })
 
+
+class InstantSelectionWidget(TypesWidget):
+    _properties = TypesWidget._properties.copy()
+    _properties.update({
+        'helper_js': ('instant_selection.js',),
+        'macro' : "instant_selection_widget",
+        })
+
+
+class IFrameWidget(TypesWidget):
+    _properties = TypesWidget._properties.copy()
+    _properties.update({
+        'macro' : "iframe_widget",
+        })
 
 
 class DefaultOrCustomWidget(TypesWidget):

SVN: r3264 - in glome/trunk: . skins/glome_widgets
Christian Theune <ct(at)gocept.com>
2005-08-21 13:08:42 [ FULL ]
Author: ctheune
Date: Sun Aug 21 13:10:26 2005
New Revision: 3264

Modified:
   glome/trunk/skins/glome_widgets/calendarwidget.pt
   glome/trunk/widgets.py
Log:
 - made calendar picker optional. you can use the calendar input widget as a
normal string field now
   with the ability to display date/time values according to the given format.


Modified: glome/trunk/skins/glome_widgets/calendarwidget.pt
==============================================================================
--- glome/trunk/skins/glome_widgets/calendarwidget.pt	(original)
+++ glome/trunk/skins/glome_widgets/calendarwidget.pt	Sun Aug 21 13:10:26 2005
(at)(at) -16,21 +16,30 (at)(at)
                    formatted python:format and d and d.strftime(format);
                    result python:(format and formatted) or (d and
here.toPortalTime(d, long_format=1));"
        tal:replace="structure python:result" />
-    
+
+
+
     <metal:define define-macro="edit"
-       tal:define="format widget/format">
-      <metal:use use-macro="field_macro |
here/widgets/field/macros/edit">
-        <metal:fill fill-slot="widget_body">
-          <tal:define define="id fieldName;
-                              inputname fieldName;
-                              formname string:edit_form;
-                              inputvalue python:test(value!='None', value,
'');">
-            <metal:use
use-macro="here/inputcalendar_slot/macros/inputcalendarDatePickerBox">
-              a calendar, hopefully
-            </metal:use>
-          </tal:define>
-        </metal:fill>
-      </metal:use>
+      tal:define="format widget/format">
+
+      <tal:calendar condition="widget/calendar">
+        <metal:use use-macro="field_macro |
here/widgets/field/macros/edit">
+          <metal:fill fill-slot="widget_body">
+            <tal:define define="id fieldName;
+                                inputname fieldName;
+                                formname string:edit_form;
+                                inputvalue python:test(value!='None', value,
'');">
+              <metal:use
use-macro="here/inputcalendar_slot/macros/inputcalendarDatePickerBox">
+                a calendar, hopefully
+              </metal:use>
+            </tal:define>
+          </metal:fill>
+        </metal:use>
+      </tal:calendar>
+
+      <tal:nocalendar condition="not:widget/calendar">
+        <metal:block use-macro="here/widgets/string/macros/edit"/>
+      </tal:nocalendar>
     </metal:define>
     
     <metal:define define-macro="search">

Modified: glome/trunk/widgets.py
==============================================================================
--- glome/trunk/widgets.py	(original)
+++ glome/trunk/widgets.py	Sun Aug 21 13:10:26 2005
(at)(at) -151,12 +151,13 (at)(at)
     _properties = CalendarWidget._properties.copy()
     _properties.update({
         'macro':'calendarwidget',
+        'calendar':True,
         'format':'%d.%m.%Y',
+        'size':30,
+        'maxlength':255,
         'helper_js': _properties['helper_js'] + ('inputcalendar.js',)
         })
 
-
-
 class ComputedWidget(atapi.ComputedWidget):
 
     _properties = atapi.ComputedWidget._properties.copy()

SVN: r3272 - in LeuBsm/trunk: . Extensions skins/leu_content skins/leu_scripts
Christian Zagrodnick <cz(at)gocept.com>
2005-08-22 14:41:47 [ FULL ]
Author: zagy
Date: Mon Aug 22 13:58:55 2005
New Revision: 3272

Added:
   LeuBsm/trunk/skins/leu_content/notify_reviewer_example_eingereicht.dtml
      - copied unchanged from r3267,
LeuBsm/trunk/skins/leu_content/notify_reviewer_eingereicht.dtml
   LeuBsm/trunk/skins/leu_content/notify_reviewer_example_geprueft.dtml
      - copied unchanged from r3267,
LeuBsm/trunk/skins/leu_content/notify_reviewer_geprueft.dtml
   LeuBsm/trunk/skins/leu_content/notify_reviewer_example_neu.dtml
      - copied unchanged from r3267,
LeuBsm/trunk/skins/leu_content/notify_reviewer_neu.dtml
   LeuBsm/trunk/skins/leu_content/notify_reviewer_niveau_eingereicht.dtml  
(contents, props changed)
   LeuBsm/trunk/skins/leu_content/notify_reviewer_niveau_neu.dtml   (contents,
props changed)
   LeuBsm/trunk/skins/leu_content/notify_reviewer_niveau_zurueckgerufen.dtml  
(contents, props changed)
Removed:
   LeuBsm/trunk/skins/leu_content/notify_reviewer_eingereicht.dtml
   LeuBsm/trunk/skins/leu_content/notify_reviewer_geprueft.dtml
   LeuBsm/trunk/skins/leu_content/notify_reviewer_neu.dtml
Modified:
   LeuBsm/trunk/Extensions/niveau_workflow_scripts.py
   LeuBsm/trunk/skins/leu_scripts/example_displayCategories.py
   LeuBsm/trunk/tool.py
Log:
added email support in niveau workflow



Modified: LeuBsm/trunk/Extensions/niveau_workflow_scripts.py
==============================================================================
--- LeuBsm/trunk/Extensions/niveau_workflow_scripts.py	(original)
+++ LeuBsm/trunk/Extensions/niveau_workflow_scripts.py	Mon Aug 22 13:58:55 2005
(at)(at) -11,13 +11,13 (at)(at)
 def neu_eingereicht_before(self, sci, notify=True):
     lt = getToolByName(sci.object, 'leubsm_tool')
     newObj = lt.moveToCentralStorage(sci.object)
+    if notify:
+        lt = getToolByName(newObj, 'leubsm_tool')
+        lt.notifyReviewers(newObj, "neu_eingereicht")
     raise sci.ObjectMoved(newObj)
 
 def neu_eingereicht_after(self, sci):
     setWorkflowPermissions(self, sci)
-    #if notify:
-    #    lt = getToolByName(sci.object, 'leubsm_tool')
-    #    lt.notifyReviewers(sci.object, "eingereicht_geprueft")
 
     
 
(at)(at) -37,21 +37,21 (at)(at)
     user = getSecurityManager().getUser()
     sci.object.setLastReviewer(user.getId())
     setWorkflowPermissions(self, sci)
-    #if notify:
-    #    lt = getToolByName(sci.object, 'leubsm_tool')
-    #    lt.notifyReviewers(sci.object, "geprueft_freigegeben")
+    if notify:
+        lt = getToolByName(sci.object, 'leubsm_tool')
+        lt.notifyReviewers(sci.object, "eingereicht_freigegeben")
 
 
 
 def eingereicht_neu_before(self, sci, notify=True):
     lt = getToolByName(sci.object, 'leubsm_tool')
     newObj = lt.moveToMemberFolder(sci.object)
+    if notify:
+        lt.notifyReviewers(newObj, "eingereicht_neu")
     raise sci.ObjectMoved(newObj)
 
 def eingereicht_neu_after(self, sci, notify=True):
     setWorkflowPermissions(self, sci)
-    #if notify:
-    #    lt.notifyReviewers(newObj, "eingereicht_neu")
 
 
 
(at)(at) -59,6 +59,7 (at)(at)
 def freigegeben_neu_before(self, sci):
     lt = getToolByName(sci.object, 'leubsm_tool')
     newObj = lt.moveToMemberFolder(sci.object)
+    lt.notifyReviewers(newObj, "freigegeben_neu")
     raise sci.ObjectMoved(newObj)
 
 
(at)(at) -66,7 +67,6 (at)(at)
 def freigegeben_neu_after(self, sci):
     modifyMaterials(sci.object, "private",
         comment="Automatic reject because example got rejected.")
-    #lt.notifyReviewers(newObj, "freigegeben_neu")
     setWorkflowPermissions(self, sci)
 
 

Added: LeuBsm/trunk/skins/leu_content/notify_reviewer_niveau_eingereicht.dtml
==============================================================================
--- (empty file)
+++ LeuBsm/trunk/skins/leu_content/notify_reviewer_niveau_eingereicht.dtml	Mon
Aug 22 13:58:55 2005
(at)(at) -0,0 +1,24 (at)(at)
+<dtml-with portal_properties>
+From: "&dtml-email_from_name;" <&dtml-email_from_address;>
+To: <dtml-var "member.getProperty('email')">
+Errors-to: <&dtml-email_from_address;>
+Subject: Niveaukonkretisierung eingereicht: "<dtml-var
"example.Title()">"
+Content-Type: text/plain; charset=latin1
+
+Ein Standardexperte hat eine Niveaukonkretisierung eingereicht:
+
+id: <dtml-var "example.getId()">
+Titel: <dtml-var "example.Title()">
+Schulart: <dtml-var "example.getSchool().Title()">
+Fach: <dtml-var "', '.join([ s.Title() for s in example.getSchoolSubjects()
])">
+Klasse: <dtml-var "example.getDefaultClass()">
+Redakteur: <dtml-var getCurrentFullName>
+
+Bitte prüfen Sie die eingereichte Niveaukonkretisierung.
+
+-- 
+Diese Benachrichtigung wurde automatisch vom Server "Bildung stärkt Menschen" 
+verschickt. Antworten Sie bitte möglichst nicht auf diese Mail.
+
+
+</dtml-with>

Added: LeuBsm/trunk/skins/leu_content/notify_reviewer_niveau_neu.dtml
==============================================================================
--- (empty file)
+++ LeuBsm/trunk/skins/leu_content/notify_reviewer_niveau_neu.dtml	Mon Aug 22
13:58:55 2005
(at)(at) -0,0 +1,24 (at)(at)
+<dtml-with portal_properties>
+From: "&dtml-email_from_name;" <&dtml-email_from_address;>
+To: <dtml-var "member.getProperty('email')">
+Errors-to: <&dtml-email_from_address;>
+Subject: Niveaukonkretisierung zurückgegeben: "<dtml-var
"example.Title()">"
+Content-Type: text/plain; charset=latin1
+
+Eine Niveaukonkretisierung wurde zurückgegeben oder in der Prüfung abgelehnt: 
+
+id: <dtml-var "example.getId()">
+Titel: <dtml-var "example.Title()">
+Schulart: <dtml-var "example.getSchool().Title()">
+Fach: <dtml-var "', '.join([ s.Title() for s in example.getSchoolSubjects()
])">
+Klasse: <dtml-var "example.getDefaultClass()">
+Redakteur: <dtml-var getCurrentFullName>
+Letzter Reviewer: <dtml-var "example.getLastReviewerData()['fullname']">
+
+
+-- 
+Diese Benachrichtigung wurde automatisch vom Server "Bildung stärkt Menschen" 
+verschickt. Antworten Sie bitte möglichst nicht auf diese Mail.
+
+
+</dtml-with>

Added:
LeuBsm/trunk/skins/leu_content/notify_reviewer_niveau_zurueckgerufen.dtml
==============================================================================
--- (empty file)
+++
LeuBsm/trunk/skins/leu_content/notify_reviewer_niveau_zurueckgerufen.dtml	Mon
Aug 22 13:58:55 2005
(at)(at) -0,0 +1,24 (at)(at)
+<dtml-with portal_properties>
+From: "&dtml-email_from_name;" <&dtml-email_from_address;>
+To: <dtml-var "member.getProperty('email')">
+Errors-to: <&dtml-email_from_address;>
+Subject: Niveaukonkretisierung eingereicht: "<dtml-var
"example.Title()">"
+Content-Type: text/plain; charset=latin1
+
+Eine Niveaukonkretisierung wurde vom Redakteur zur Überarbeitung
zurückgerufen:
+
+id: <dtml-var "example.getId()">
+Titel: <dtml-var "example.Title()">
+Schulart: <dtml-var "example.getSchool().Title()">
+Fach: <dtml-var "', '.join([ s.Title() for s in example.getSchoolSubjects()
])">
+Klasse: <dtml-var "example.getDefaultClass()">
+Redakteur: <dtml-var getCurrentFullName>
+
+Bitte prüfen Sie den Rücknahmeantrag.
+
+-- 
+Diese Benachrichtigung wurde automatisch vom Server "Bildung stärkt Menschen" 
+verschickt. Antworten Sie bitte möglichst nicht auf diese Mail.
+
+
+</dtml-with>

Modified: LeuBsm/trunk/skins/leu_scripts/example_displayCategories.py
==============================================================================
--- LeuBsm/trunk/skins/leu_scripts/example_displayCategories.py	(original)
+++ LeuBsm/trunk/skins/leu_scripts/example_displayCategories.py	Mon Aug 22
13:58:55 2005
(at)(at) -1,4 +1,4 (at)(at)
-from Products.LeuBsm.config import materialCategories, assignmentCategories
+from Products.LeuBsm.config import materialCategories, assignmentCategories!*
 
 is_spanning = context.getSpanning()
 categories = []

Modified: LeuBsm/trunk/tool.py
==============================================================================
--- LeuBsm/trunk/tool.py	(original)
+++ LeuBsm/trunk/tool.py	Mon Aug 22 13:58:55 2005
(at)(at) -54,6 +54,7 (at)(at)
     manage_collisions = PageTemplateFile('www/collisions', globals(),
             __name__='manage_collisions')
 
+
     security.declareProtected(config.EDIT_CONTENT_PERMISSION,
'getNewUniqueId')
     def getNewUniqueId(self):
         "see ILeuBsmTool"
(at)(at) -180,8 +181,8 (at)(at)
         """
         # Check permissions
         security = getSecurityManager()
-        if not security.checkPermission(config.EDIT_EXAMPLE_PERMISSION, obj):
-            raise "Unauthorized", "You can't move this example."
+        if not security.checkPermission(permission.Modify, obj):
+            raise "Unauthorized", "You can't move this object."
 
         cs = self._getCentralStorage()
         return self._move_object(obj, cs)
(at)(at) -192,8 +193,8 (at)(at)
         """
         # Check permissions
         security = getSecurityManager()
-        if not security.checkPermission(config.EDIT_EXAMPLE_PERMISSION, obj):
-            raise "Unauthorized", "You can't move this example."
+        if not security.checkPermission(permission.Modify, obj):
+            raise "Unauthorized", "You can't move this object."
 
         creator = obj.Creator()
         portal_membership = getToolByName(self, 'portal_membership')
(at)(at) -206,30 +207,29 (at)(at)
     def notifyReviewers(self, obj, transition='neu_eingereicht'):
         """Nachricht an Standardexperten der Fächer des Examples.
 
-        obj ... IEXample
+        obj ... Example or Niveau
         """
-        if not config.SEND_NOTIFICATIONS:
-            return
-
-        if transition.endswith('eingereicht'):
-            reviewers = self.getReviewersForExample(obj)
-            message_id = 'eingereicht'
-        elif transition.endswith('neu'):
-            reviewers = self.getOwnerForExample(obj)
-            message_id = 'neu'
-        elif (transition.endswith('geprueft') or
transition.endswith('zurueckgerufen')):
-            reviewers = self.getLeuReviewersForExample(obj)
-            message_id = 'geprueft'
+        typ = obj.portal_type
+        if typ == config.mtExample:
+            reviewers, message_id = self._get_example_notification(obj,
+                                                                   transition)
+        elif typ == config.mtNiveau:
+            reviewers, message_id = self._get_niveau_notification(obj,
+                                                                  transition)
         else:
-            return  # No matching message available
+            raise ValueError, 'Unsupport object for notification %r' % obj
 
-        message = getattr(self, 'notify_reviewer_%s' % message_id)
-
-        for reviewer in reviewers:
-            if reviewer is None:
-                continue
-            mail_text = message(self, self.REQUEST, member=reviewer,
example=obj)
-            self.MailHost.send(mail_text)
+        if reviewers and message_id:
+            message = getattr(self, 'notify_reviewer_%s_%s' % (typ.lower(),
+                                                               message_id))
+
+            for reviewer in reviewers:
+                if reviewer is None:
+                    continue
+                mail_text = message(self, self.REQUEST, member=reviewer,
+                                    example=obj, obj=obj)
+                if config.SEND_NOTIFICATIONS:
+                    self.MailHost.send(mail_text)
 
     security.declarePublic('notifyProfileChange')
     def notifyProfileChange(self, changes):
(at)(at) -899,6 +899,38 (at)(at)
         new.reindexObject(['Creator'])
         return new
 
+    def _get_example_notification(self, obj, transition):
+        if transition.endswith('eingereicht'):
+            reviewers = self.getReviewersForExample(obj)
+            message_id = 'eingereicht'
+        elif transition.endswith('neu'):
+            reviewers = self.getOwnerForExample(obj)
+            message_id = 'neu'
+        elif (transition.endswith('geprueft') or
+              transition.endswith('zurueckgerufen')):
+            reviewers = self.getLeuReviewersForExample(obj)
+            message_id = 'geprueft'
+        else:
+            reviewers = []
+            message_id = None
+
+        return reviewers, message_id
+        
+    def _get_niveau_notification(self, obj, transition):
+        if transition.endswith('eingereicht'):
+            reviewers = self.getLeuReviewersForExample(obj)
+            message_id = 'eingereicht'
+        elif transition.endswith('neu'):
+            reviewers = self.getOwnerForExample(obj)
+            message_id = 'neu'
+        elif transition.endswith('zurueckgerufen'):
+            reviewers = self.getLeuReviewersForExample(obj)
+            message_id = 'zurueckgerufen'
+        else:
+            reviewers = []
+            message_id = None
+
+        return reviewers, message_id
         
 Globals.InitializeClass(LeuBsmTool)

SVN: r3275 - in glome/trunk: . skins/glome_widgets
Christian Theune <ct(at)gocept.com>
2005-08-22 16:13:59 [ FULL ]
Author: ctheune
Date: Mon Aug 22 16:13:54 2005
New Revision: 3275

Modified:
   glome/trunk/skins/glome_widgets/def_or_custom_widget.pt
   glome/trunk/widgets.py
Log:
 - added unit option for default or custom widget


Modified: glome/trunk/skins/glome_widgets/def_or_custom_widget.pt
==============================================================================
--- glome/trunk/skins/glome_widgets/def_or_custom_widget.pt	(original)
+++ glome/trunk/skins/glome_widgets/def_or_custom_widget.pt	Mon Aug 22 16:13:54
2005
(at)(at) -12,8 +12,9 (at)(at)
                       tal:define="display python:accessor()">
           <span tal:condition="python: display and hasattr(display,
'Title')"
                     tal:replace="display/Title"/>
-            <span tal:condition="python: display and not hasattr(display,
'Title')"
+          <span tal:condition="python: display and not hasattr(display,
'Title')"
                     tal:replace="display"/>
+                  <span tal:replace="python:widget.getUnitLabel(here)"/>
       </metal:view_macro>
       
       
(at)(at) -35,7 +36,7 (at)(at)
                                     checked python:test(widget.isDefault(here,
field, value), 'checked', None);" />
             <!-- not vocab && default is string type: display text
w. hidden field -->
             <tal:block tal:condition="not: vocab">
-              <label tal:attributes="for string:${fieldName}"><span
tal:replace="default"/></label>
+              <label tal:attributes="for string:${fieldName}"><span
tal:replace="default"/> <span
tal:replace="python:widget.getUnitLabel(here)"/></label>
                 <input type="hidden" name="" 
                     tal:attributes="name valuefield_name;
                                     value default"/>
(at)(at) -49,7 +50,7 (at)(at)
                     <option tal:repeat="key vocab"
                             tal:attributes="value key;
                                             selected python: test(key ==
value, 'selected', None);"
-                            tal:content="python: vocab.getValue(key)">Title
+                            tal:content="python: vocab.getValue(key) +
widget.getUnitLabel(here)">Title
                     </option>
                 </select>
             </tal:block>
(at)(at) -70,7 +71,7 (at)(at)
                                    onClick
string:javascript:form.${fieldName}_def[1].checked=true;
                                    onChange
string:javascript:form.${fieldName}_def[1].checked=true;
                           	       tabindex tabindex/next;"/>
-
+                  <span tal:replace="python:widget.getUnitLabel(here)"/>
           </metal:fill>
         </metal:use>
       </metal:define>

Modified: glome/trunk/widgets.py
==============================================================================
--- glome/trunk/widgets.py	(original)
+++ glome/trunk/widgets.py	Mon Aug 22 16:13:54 2005
(at)(at) -49,6 +49,8 (at)(at)
     _properties.update({
         'macro': 'def_or_custom_widget',
         'use_accessor': 'edit',
+        'unit':None,    # Use as descriptor for units, e.g: EUR, USD ... km
+                        # This is a python expression!
         })
 
     def process_form(self, instance, field, form, empty_marker=None,
(at)(at) -79,6 +81,14 (at)(at)
 
         return False
 
+    def getUnitLabel(self, instance):
+        if self.unit is None:
+            return ""
+        else:
+            try:
+                return eval(self.unit, {'object': instance})
+            except:     # XXX log this?
+                return ''
 
 
 class DictWidget(TypesWidget):

SVN: r3277 - in LeuBsm/trunk: . skins/leu_content skins/leu_scripts skins/leu_templates
Thomas Lotze <tl(at)gocept.com>
2005-08-23 16:17:46 [ FULL ]
Author: thomas
Date: Tue Aug 23 16:17:49 2005
New Revision: 3277

Added:
   LeuBsm/trunk/skins/leu_scripts/niveaus_sort.py
Modified:
   LeuBsm/trunk/interfaces.py
   LeuBsm/trunk/skins/leu_content/listing_macros.pt
   LeuBsm/trunk/skins/leu_content/public_listing.pt
   LeuBsm/trunk/skins/leu_content/reviews_listing.pt
   LeuBsm/trunk/skins/leu_scripts/getReviewsListing.py
   LeuBsm/trunk/skins/leu_templates/global_personalbar.pt
   LeuBsm/trunk/tool.py
Log:
Prüfliste hat jetzt Niveau.

Modified: LeuBsm/trunk/interfaces.py
==============================================================================
--- LeuBsm/trunk/interfaces.py	(original)
+++ LeuBsm/trunk/interfaces.py	Tue Aug 23 16:17:49 2005
(at)(at) -635,7 +635,7 (at)(at)
             returns sequence of IListing instances
         """
 
-    def getExamplePermissions(obj):
+    def getPermissions(obj):
         """Check whether EDIT_EXAMPLE_PERMISSION and
            VIEW_EXAMPLE_PERMISSION are granted on an object.
 

Modified: LeuBsm/trunk/skins/leu_content/listing_macros.pt
==============================================================================
--- LeuBsm/trunk/skins/leu_content/listing_macros.pt	(original)
+++ LeuBsm/trunk/skins/leu_content/listing_macros.pt	Tue Aug 23 16:17:49 2005
(at)(at) -5,17 +5,19 (at)(at)
       (Redakteur:
       <a href="mailto:" title="Mail an den Redakteur"
         tal:on-error="string:(Daten nicht freigegeben)"
-        tal:define="authordata ex/getAuthorData"
-        tal:attributes="href
string:mailto:${authordata/email}?Subject=Umsetzungsbeispiel: ${ex/Title}"
+        tal:define="authordata it/getAuthorData;
+                    typename python:{'Example': 'Umsetzungsbeispiel',
+                                     'Niveau':
'Niveaukonkretisierung'}[it.getPortalTypeName()]"
+        tal:attributes="href
string:mailto:${authordata/email}?Subject=${typename}: ${it/Title}"
         tal:content="authordata/fullname">
           Hans Hansen
       </a>
       <tal:reviewer
-        tal:define="revdata ex/getLastReviewerData"
+        tal:define="revdata it/getLastReviewerData"
         tal:condition="revdata">
           Prüfer:
           <a href="mailto:" title="Mail an den Reviewer"
-            tal:attributes="href
string:mailto:${revdata/email}?Subject=Prüfung des Beispiels: ${ex/Title}"
+            tal:attributes="href
string:mailto:${revdata/email}?Subject=Prüfung des Beispiels: ${it/Title}"
             tal:content="revdata/fullname">
               Peter Peterson
           </a>

Modified: LeuBsm/trunk/skins/leu_content/public_listing.pt
==============================================================================
--- LeuBsm/trunk/skins/leu_content/public_listing.pt	(original)
+++ LeuBsm/trunk/skins/leu_content/public_listing.pt	Tue Aug 23 16:17:49 2005
(at)(at) -45,7 +45,7 (at)(at)
                                     </div>
 
                                     <div class="leu-actions"
-                                         tal:define="permissions
python:here.leubsm_tool.getExamplePermissions(it)">
+                                         tal:define="permissions
python:here.leubsm_tool.getPermissions(it)">
                                         <tal:buttons
condition="permissions/EDIT">
                                             <a class="leu-actionlink"
href=""
                                                tal:attributes="href url">

Modified: LeuBsm/trunk/skins/leu_content/reviews_listing.pt
==============================================================================
--- LeuBsm/trunk/skins/leu_content/reviews_listing.pt	(original)
+++ LeuBsm/trunk/skins/leu_content/reviews_listing.pt	Tue Aug 23 16:17:49 2005
(at)(at) -13,31 +13,36 (at)(at)
 
     <div metal:fill-slot="content">
 
-        <h1 class="documentFirstHeading">Zu prüfende
Umsetzungsbeispiele</h1>
+        <h1 class="documentFirstHeading">Zu prüfende
+          Umsetzungsbeispiele und Niveaukonkretisierungen</h1>
 
-        <tal:roles define="roles here/getReviewRoles">
+        <tal:roles define="roles python:here.getReviewRoles();
+                           what python:'LEU' in roles and roles + ['Niveau']
or roles;
+                           schools here/leubsm_tool/listAllSchools">
             <div tal:condition="not:roles">
                 Sie sind weder als fachlicher noch als formaler Prüfer
                 registriert.
             </div>
     
-            <tal:role define="schools here/leubsm_tool/listAllSchools"
-                      repeat="role roles">
-                <h2 tal:content="python:{'Fach': 'Fachliche Prüfung',
-                                         'LEU': 'Formale Prüfung'}[role]"
/>
+            <tal:role repeat="role what">
+                <h2 tal:content="python:{'Fach': 'Fachlich zu prüfende
Umsetzungsbeispiele',
+                                         'LEU': 'Formal zu prüfende
Umsetzungsbeispiele',
+                                         'Niveau': 'Zu prüfende
Niveaukonkretisierungen'}[role]" />
     
-                <tal:examples define="allexamples
python:here.getReviewsListing(role, sorted=True)">
-                    <div tal:condition="not:allexamples">
+                <tal:items define="allitems
python:here.getReviewsListing(role, sorted=True);
+                                   typename python:role == 'Niveau' and
'niveau' or 'example';
+                                   typename_macros
string:${typename}s_macros">
+                    <div tal:condition="not:allitems">
                         Derzeit liegen keine zu prüfenden
-                        Umsetzungsbeispiele vor.
+                        <span tal:replace="python:role == 'Niveau' and
'Niveaukonkretisierungen' or 'Umsetzungsbeispiele'" /> vor.
                     </div>
     
                     <tal:schools repeat="school schools">
-                        <tal:school define="examples python:[e for e in
allexamples if e.getSchool() == school]">
-                            <h3 tal:condition="examples"
+                        <tal:school define="items python:[e for e in
allitems if e.getSchool() == school]">
+                            <h3 tal:condition="items"
                                 tal:content="school/Title"/>
         
-                            <tal:example repeat="it examples">
+                            <tal:item repeat="it items">
                                 <div class="leu-item"
                                      tal:define="url
python:it.absolute_url()">
                                     <div tal:define="icon
python:it.getIcon(1)"
(at)(at) -53,14 +58,14 (at)(at)
                                     </div>
             
                                     <div class="leu-actions"
-                                         tal:define="permissions
python:here.leubsm_tool.getExamplePermissions(it)">
+                                         tal:define="permissions
python:here.leubsm_tool.getPermissions(it)">
                                         <tal:buttons
condition="permissions/EDIT">
                                             <a class="leu-actionlink"
href=""
-                                                tal:attributes="href
string:$url/example_preview?return_to=${here/absolute_url}/${template/getId}">
+                                                tal:attributes="href
string:$url/${typename}_preview?return_to=${here/absolute_url}/${template/getId}">
                                                 Vorschau</a>
 
                                             <a class="leu-actionlink"
href=""
-                                               tal:attributes="href
string:${url}/example_edit">
+                                               tal:attributes="href
string:${url}/${typename}_edit">
                                                 Bearbeiten</a>
 
                                             <a class="leu-actionlink"
href=""
(at)(at) -88,13 +93,13 (at)(at)
                                         </tal:button>
                                     </div>
             
-                                    <div
metal:use-macro="here/examples_macros/macros/shortview"/>
+                                    <div
metal:use-macro="here/?typename_macros/macros/shortview"/>
 
                                 </div>
-                            </tal:example>
+                            </tal:item>
                         </tal:school>
                     </tal:schools>
-                </tal:examples>
+                </tal:items>
             </tal:role>
         </tal:roles>
     </div>

Modified: LeuBsm/trunk/skins/leu_scripts/getReviewsListing.py
==============================================================================
--- LeuBsm/trunk/skins/leu_scripts/getReviewsListing.py	(original)
+++ LeuBsm/trunk/skins/leu_scripts/getReviewsListing.py	Tue Aug 23 16:17:49
2005
(at)(at) -1,27 +1,36 (at)(at)
-##parameters=role, sorted=False
+##parameters=what, sorted=False
 from Products.CMFCore.utils import getToolByName
 
 
-cat = getToolByName(context, 'portal_catalog')
-lt = getToolByName(context, 'leubsm_tool')
-
-if role == 'Fach':
-    wf_state = ['eingereicht',]
-    permission = 'EDIT'
-elif role == 'LEU':
-    wf_state = ['geprueft', 'zurueckgerufen']
+if what == 'Niveau':
+    portal_type = 'Niveau'
+    items_sort = context.niveaus_sort
+    wf_state = ['eingereicht', 'zurueckgerufen']
     permission = 'VIEW'
 else:
-    return []
+    portal_type = 'Example'
+    items_sort = context.examples_sort
+
+    if what == 'Fach':
+        wf_state = ['eingereicht',]
+        permission = 'EDIT'
+    elif what == 'LEU':
+        wf_state = ['geprueft', 'zurueckgerufen']
+        permission = 'VIEW'
+    else:
+        return []
+
+cat = getToolByName(context, 'portal_catalog')
+lt = getToolByName(context, 'leubsm_tool')
 
 brains = cat(review_state=wf_state,
-             portal_type='Example')
-examples = [ b.getObject() for b in brains ]
-examples = [ e
-    for e in examples
-    if lt.getExamplePermissions(e)[permission] ]
+             portal_type=portal_type)
+items = [ b.getObject() for b in brains ]
+items = [ e
+    for e in items
+    if lt.getPermissions(e)[permission] ]
 
 if sorted:
-    examples.sort(context.examples_sort)
+    items.sort(items_sort)
 
-return examples
+return items

Added: LeuBsm/trunk/skins/leu_scripts/niveaus_sort.py
==============================================================================
--- (empty file)
+++ LeuBsm/trunk/skins/leu_scripts/niveaus_sort.py	Tue Aug 23 16:17:49 2005
(at)(at) -0,0 +1,14 (at)(at)
+##parameters=x, y
+
+result = cmp(x.getSchool().Title(), y.getSchool().Title())
+if result != 0:  # just being explicit ...
+    return result
+x_subject = x.getPrimarySubject()
+y_subject = y.getPrimarySubject()
+if x_subject and y_subject:
+    result = cmp(x.getPrimarySubject().Title(),
+        y.getPrimarySubject().Title())
+if result != 0:
+    return result
+return cmp(x.Title(), y.Title())
+

Modified: LeuBsm/trunk/skins/leu_templates/global_personalbar.pt
==============================================================================
--- LeuBsm/trunk/skins/leu_templates/global_personalbar.pt	(original)
+++ LeuBsm/trunk/skins/leu_templates/global_personalbar.pt	Tue Aug 23 16:17:49
2005
(at)(at) -13,7 +13,8 (at)(at)
 
 <ul id="portal-personaltools"
     tal:define="isManagerOrLeu here/isManagerOrLeu;
-                review_roles here/getReviewRoles">i
+                roles here/getReviewRoles;
+                review_roles python:'LEU' in roles and roles + ['Niveau'] or
roles">
     <li class="portalUser">
         <span class="visualCaseSensitive"
               tal:replace="user/getUserName">
(at)(at) -39,7 +40,9 (at)(at)
     <li tal:condition="review_roles">
         <a href=""
            tal:attributes="href
string:${mtool/getHomeUrl}/reviews_listing">Prüfliste
-            (<span
tal:replace="python:'/'.join([`len(here.getReviewsListing(r))` for r in
review_roles])" />)</a>
+            (<span
+           tal:replace="python:'/'.join([`len(here.getReviewsListing(r))`
+                        for r in review_roles])" />)</a>
     </li>
 
     <tal:block condition="isManagerOrLeu">

Modified: LeuBsm/trunk/tool.py
==============================================================================
--- LeuBsm/trunk/tool.py	(original)
+++ LeuBsm/trunk/tool.py	Tue Aug 23 16:17:49 2005
(at)(at) -83,17 +83,23 (at)(at)
             self._v_workflowstatenames = titles
         return titles
 
-    security.declarePublic('getExamplePermissions')
-    def getExamplePermissions(self, obj):
+    security.declarePublic('getPermissions')
+    def getPermissions(self, obj):
         """see ILeuBsmTool
         """
         security = getSecurityManager()
-        permissions = {
-            'EDIT': security.checkPermission(config.EDIT_EXAMPLE_PERMISSION,
-                        obj),
-            'VIEW': security.checkPermission(config.VIEW_EXAMPLE_PERMISSION,
-                        obj)
-        }
+        if obj.getPortalTypeName() == 'Niveau':
+            permissions = {
+                'EDIT': security.checkPermission(permission.Modify, obj),
+                'VIEW': security.checkPermission(permission.View, obj)
+            }
+        else:
+            permissions = {
+                'EDIT':
security.checkPermission(config.EDIT_EXAMPLE_PERMISSION,
+                            obj),
+                'VIEW':
security.checkPermission(config.VIEW_EXAMPLE_PERMISSION,
+                            obj)
+            }
         return permissions
 
     security.declarePublic('getListing')

SVN: r3318 - glome/trunk/skins/glome_widgets
Michael Howitz <mh(at)gocept.com>
2005-08-29 10:51:35 [ FULL ]
Author: mac
Date: Mon Aug 29 10:52:50 2005
New Revision: 3318

Modified:
   glome/trunk/skins/glome_widgets/glome_computedwidget.pt
Log:
added Display of required or not to edit mode of computed field


Modified: glome/trunk/skins/glome_widgets/glome_computedwidget.pt
==============================================================================
--- glome/trunk/skins/glome_widgets/glome_computedwidget.pt	(original)
+++ glome/trunk/skins/glome_widgets/glome_computedwidget.pt	Mon Aug 29 10:52:50
2005
(at)(at) -19,6 +19,11 (at)(at)
                  tal:content="python:widget.Label(here)"
                  tal:attributes="for python:field.getName()">
           </label>
+          <span class="fieldRequired"
+                tal:condition="field/required"
+                title="Required">
+            (Required)
+          </span>
           <div class="formHelp"
                tal:define="description python:widget.Description(here)"
                tal:content="structure description"

MailBoxer