Changeset 388 for WAeUP_SRP


Ignore:
Timestamp:
17 Aug 2006, 20:26:31 (18 years ago)
Author:
joachim
Message:

added checking for duplicate Id's

Location:
WAeUP_SRP/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/trunk/Widgets.py

    r381 r388  
    143143###)
    144144
     145class WAeUPIdWidget(CPSStringWidget): ###(
     146    """ WAeUPId Widget"""
     147    meta_type = "WAeUPId Widget"
     148   
     149    def validate(self, datastructure, **kw):
     150        """Validate datastructure and update datamodel."""
     151       
     152        valid = CPSStringWidget.validate(self, datastructure, **kw)
     153        if not valid:
     154            return 0
     155        else:
     156            widget_id = self.getWidgetId()
     157            value = datastructure[widget_id].upper()
     158            err = 0
     159            if hasattr(self.aq_parent,value):
     160                err = 'An object with the Id %s already exists in this context' % (value)
     161            if err:
     162                datastructure.setError(widget_id, err)
     163            else:
     164                datamodel = datastructure.getDataModel()
     165                datamodel[self.fields[0]] = value
     166           
     167            return not err
     168
     169InitializeClass(WAeUPIdWidget)
     170
     171widgetRegistry.register(WAeUPIdWidget)
     172
     173
     174###)
     175
    145176class StudentIdWidget(CPSStringWidget): ###(
    146177    """ StudentId Widget"""
  • WAeUP_SRP/trunk/profiles/default/layouts/department.xml

    r370 r388  
    2828  <property name="size_max">200</property>
    2929 </widget>
    30  <widget name="code" meta_type="String Widget">
     30 <widget name="code" meta_type="WAeUPId Widget">
     31  <property name="title">Object ID</property>
     32  <property name="fields">
     33   <element value="code"/>
     34  </property>
     35  <property name="label">Object ID</property>
     36  <property name="label_edit">Object ID</property>
     37  <property name="readonly_layout_modes"/>
     38  <property name="hidden_layout_modes"/>
     39  <property name="hidden_readonly_layout_modes"/>
     40 </widget>
     41 <widget name="code_alt" meta_type="String Widget">
    3142  <property name="title">Object ID</property>
    3243  <property name="fields">
  • WAeUP_SRP/trunk/profiles/default/layouts/waeup_common.xml

    r370 r388  
    2020  <property name="size_max">200</property>
    2121 </widget>
    22  <widget name="code" meta_type="String Widget">
     22 <widget name="code" meta_type="WAeUPId Widget">
     23  <property name="title">Object ID</property>
     24  <property name="fields">
     25   <element value="code"/>
     26  </property>
     27  <property name="is_required">True</property>
     28  <property name="label">Object ID</property>
     29  <property name="label_edit">Object ID</property>
     30  <property name="readonly_layout_modes"/>
     31  <property name="hidden_layout_modes"/>
     32  <property name="hidden_readonly_layout_modes"/>
     33 </widget>
     34 <widget name="code_alt" meta_type="String Widget">
    2335  <property name="title">Object ID</property>
    2436  <property name="fields">
  • WAeUP_SRP/trunk/skins/waeup_custom/standard_error_message.pt

    r351 r388  
    1212<metal:main fill-slot="main">
    1313
     14   
    1415<tal:haserror condition="error_type">
    1516  <tal:NotFound condition="python:error_type == 'NotFound'">
     
    1718  </tal:NotFound>
    1819
    19   <tal:default condition="python:error_type != 'NotFound'">
     20  <tal:default condition="python:0 and error_type != 'NotFound'">
    2021    <metal:block use-macro="here/error_lib_other/macros/other" />
    2122  </tal:default>
    2223
    23   <tal:debugging condition="python:checkPerm('Manage portal', here)">
     24  <tal:debugging condition="python:1 or checkPerm('Manage portal', here)">
    2425    <table width="100%" cellpadding="2" cellspacing="2">
    2526      <tr>
Note: See TracChangeset for help on using the changeset viewer.