- Timestamp:
- 28 Aug 2010, 06:35:39 (14 years ago)
- Location:
- WAeUP_SRP/trunk
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/trunk/Widgets.py
r5186 r5505 9 9 ##from Products.CPSSchemas.Widget import CPSWidgetType 10 10 from Products.CMFCore.utils import getToolByName 11 from Products.CPSSchemas.BasicWidgets import CPSBooleanWidget, CPSWidget, CPSStringWidget, CPSEmailWidget,CPSImageWidget 11 from Products.CPSSchemas.BasicWidgets import CPSBooleanWidget, CPSWidget, CPSStringWidget, CPSEmailWidget,CPSImageWidget,CPSIntWidget 12 12 from Products.CPSSchemas.BasicWidgets import CPSFileWidget, CPSPasswordWidget 13 13 from Products.CPSSchemas.BasicWidgets import renderHtmlTag,CPSSelectWidget, CPSStringWidget … … 2553 2553 ###) 2554 2554 2555 class PhoneWidget(CPSIntWidget): ###( 2556 """ Phone Widget""" 2557 meta_type = "Phone Widget" 2558 2559 def validate(self, datastructure, **kw): 2560 """Validate datastructure and update datamodel.""" 2561 2562 valid = CPSIntWidget.validate(self, datastructure, **kw) 2563 if not valid: 2564 return 0 2565 else: 2566 widget_id = self.getWidgetId() 2567 value = datastructure[widget_id] 2568 #import pdb;pdb.set_trace() 2569 if value == '234': 2570 value = '' 2571 datamodel = datastructure.getDataModel() 2572 datamodel[self.fields[0]] = value 2573 elif value.startswith('2340'): 2574 err = 'Wrong Nigerian phone format' 2575 datastructure.setError(widget_id, err) 2576 return 0 2577 return 1 2578 2579 def render(self, mode, datastructure, **kw): 2580 """Render in mode from datastructure.""" 2581 value = datastructure[self.getWidgetId()] 2582 #import pdb;pdb.set_trace() 2583 if mode == 'view': 2584 if value == '': 2585 return '' 2586 else: 2587 return '+' + escape(value) 2588 elif mode == 'edit': 2589 if value == '': 2590 value = 234 2591 tag = renderHtmlTag('input', 2592 type='text', 2593 name=self.getHtmlWidgetId(), 2594 value=value) 2595 return '<strong>+</strong>' + tag 2596 raise RuntimeError('unknown mode %s' % mode) 2597 2598 2599 InitializeClass(PhoneWidget) 2600 2601 widgetRegistry.register(PhoneWidget) 2602 2603 2604 2605 2555 2606 ########### 2556 2607 -
WAeUP_SRP/trunk/profiles/default/layouts/application_cest.xml
r5170 r5505 329 329 <property name="allow_resize">True</property> 330 330 </widget> 331 <widget name="phone" meta_type=" StringWidget">331 <widget name="phone" meta_type="Phone Widget"> 332 332 <property name="title">Phone</property> 333 333 <property name="fields"> -
WAeUP_SRP/trunk/profiles/default/layouts/application_cest_2.xml
r3791 r5505 329 329 <property name="allow_resize">True</property> 330 330 </widget> 331 <widget name="phone" meta_type=" StringWidget">331 <widget name="phone" meta_type="Phone Widget"> 332 332 <property name="title">Phone</property> 333 333 <property name="fields"> -
WAeUP_SRP/trunk/profiles/default/layouts/application_ct.xml
r4241 r5505 329 329 <property name="allow_resize">True</property> 330 330 </widget> 331 <widget name="phone" meta_type=" StringWidget">331 <widget name="phone" meta_type="Phone Widget"> 332 332 <property name="title">Phone</property> 333 333 <property name="fields"> -
WAeUP_SRP/trunk/profiles/default/layouts/application_dp.xml
r5185 r5505 329 329 <property name="allow_resize">True</property> 330 330 </widget> 331 <widget name="phone" meta_type=" StringWidget">331 <widget name="phone" meta_type="Phone Widget"> 332 332 <property name="title">Phone</property> 333 333 <property name="fields"> -
WAeUP_SRP/trunk/profiles/default/layouts/application_manage.xml
r5258 r5505 448 448 <property name="allow_resize">True</property> 449 449 </widget> 450 <widget name="phone" meta_type=" StringWidget">450 <widget name="phone" meta_type="Phone Widget"> 451 451 <property name="title">Phone</property> 452 452 <property name="fields"> -
WAeUP_SRP/trunk/profiles/default/layouts/application_pce.xml
r3689 r5505 284 284 <property name="allow_resize">True</property> 285 285 </widget> 286 <widget name="phone" meta_type=" StringWidget">286 <widget name="phone" meta_type="Phone Widget"> 287 287 <property name="title">Phone</property> 288 288 <property name="fields"> -
WAeUP_SRP/trunk/profiles/default/layouts/application_pde.xml
r4553 r5505 489 489 <property name="allow_resize">True</property> 490 490 </widget> 491 <widget name="phone" meta_type=" StringWidget">491 <widget name="phone" meta_type="Phone Widget"> 492 492 <property name="title">Phone</property> 493 493 <property name="fields"> -
WAeUP_SRP/trunk/profiles/default/layouts/application_prence.xml
r3689 r5505 428 428 <property name="allow_resize">True</property> 429 429 </widget> 430 <widget name="phone" meta_type=" StringWidget">430 <widget name="phone" meta_type="Phone Widget"> 431 431 <property name="title">Phone</property> 432 432 <property name="fields"> -
WAeUP_SRP/trunk/profiles/default/layouts/application_pt.xml
r4241 r5505 329 329 <property name="allow_resize">True</property> 330 330 </widget> 331 <widget name="phone" meta_type=" StringWidget">331 <widget name="phone" meta_type="Phone Widget"> 332 332 <property name="title">Phone</property> 333 333 <property name="fields"> -
WAeUP_SRP/trunk/profiles/default/layouts/application_pume.xml
r5256 r5505 281 281 <property name="allow_resize">True</property> 282 282 </widget> 283 <widget name="phone" meta_type=" StringWidget">283 <widget name="phone" meta_type="Phone Widget"> 284 284 <property name="title">Phone</property> 285 285 <property name="fields"> -
WAeUP_SRP/trunk/profiles/default/layouts/application_pume2.xml
r5279 r5505 329 329 <property name="allow_resize">True</property> 330 330 </widget> 331 <widget name="phone" meta_type=" StringWidget">331 <widget name="phone" meta_type="Phone Widget"> 332 332 <property name="title">Phone</property> 333 333 <property name="fields"> -
WAeUP_SRP/trunk/profiles/default/layouts/application_sandwich.xml
r5174 r5505 329 329 <property name="allow_resize">True</property> 330 330 </widget> 331 <widget name="phone" meta_type=" StringWidget">331 <widget name="phone" meta_type="Phone Widget"> 332 332 <property name="title">Phone</property> 333 333 <property name="fields"> -
WAeUP_SRP/trunk/profiles/default/layouts/application_sandwich2008.xml
r5165 r5505 329 329 <property name="allow_resize">True</property> 330 330 </widget> 331 <widget name="phone" meta_type=" StringWidget">331 <widget name="phone" meta_type="Phone Widget"> 332 332 <property name="title">Phone</property> 333 333 <property name="fields"> -
WAeUP_SRP/trunk/profiles/default/layouts/student_firsttime_login.xml
r4034 r5505 73 73 <property name="check_digit">True</property> 74 74 </widget> 75 <widget name="phone_nr" meta_type=" StringWidget">75 <widget name="phone_nr" meta_type="Phone Widget"> 76 76 <property name="title">Phone Number</property> 77 77 <property name="fields"> … … 85 85 </property> 86 86 <property name="hidden_readonly_layout_modes"/> 87 <property name="display_width">15</property>88 <property name="size_max">15</property>89 87 </widget> 90 88 <widget name="repeat_password" meta_type="Password Widget"> -
WAeUP_SRP/trunk/profiles/uniben/layouts/student_personal_fe.xml
r5065 r5505 230 230 <property name="hidden_readonly_layout_modes"/> 231 231 </widget> 232 <widget name="next_kin_phone" meta_type=" StringWidget">232 <widget name="next_kin_phone" meta_type="Phone Widget"> 233 233 <property name="title">Next of Kin Phone</property> 234 234 <property name="fields"> … … 296 296 <property name="hidden_readonly_layout_modes"/> 297 297 </widget> 298 <widget name="phone" meta_type=" StringWidget">298 <widget name="phone" meta_type="Phone Widget"> 299 299 <property name="title">Phone</property> 300 300 <property name="fields"> … … 423 423 <property name="hidden_readonly_layout_modes"/> 424 424 </widget> 425 <widget name="sponsor_phone" meta_type=" StringWidget">425 <widget name="sponsor_phone" meta_type="Phone Widget"> 426 426 <property name="title">Sponsor Phone</property> 427 427 <property name="fields">
Note: See TracChangeset for help on using the changeset viewer.