Ignore:
Timestamp:
26 Jan 2011, 11:57:41 (14 years ago)
Author:
uli
Message:

Commit crap/work-in-progress to prepare moving of jambtables to applicants.

Location:
main/waeup.sirp/trunk/src/waeup/sirp/jambtables
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/jambtables/browser.py

    r5488 r5686  
    2424import grok
    2525
     26from zope.formlib.widgets import FileWidget
    2627from waeup.sirp.browser import (
    2728    WAeUPPage, WAeUPEditFormPage, WAeUPAddFormPage,
     
    3334from waeup.sirp.jambtables.interfaces import (
    3435    IApplicant, IApplicantContainer, IApplicantPrincipal, IApplicantPDEEditData)
    35                                              
    36 
     36from waeup.sirp.widgets.passportwidget import (
     37    PassportWidget, PassportDisplayWidget
     38    )
    3739#from zope.formlib.objectwidget import ObjectWidget
    3840from zope.formlib.sequencewidget import ListSequenceWidget, SequenceDisplayWidget
     
    4345from waeup.sirp.widgets.multilistwidget import (
    4446    MultiListWidget, MultiListDisplayWidget)
     47from waeup.sirp.image.browser.widget import (
     48    ThumbnailWidget, EncodingImageFileWidget,
     49    )
    4550
    4651results_widget = CustomWidgetFactory(
     
    7782    form_fields = grok.AutoFields(IApplicant)
    7883    form_fields['fst_sit_results'].custom_widget = list_results_widget
     84    form_fields['passport'].custom_widget = EncodingImageFileWidget
    7985    label = 'Add Applicant'
    8086    title = 'Add Applicant'
     
    100106    form_fields = grok.AutoFields(IApplicant)
    101107    form_fields['fst_sit_results'].custom_widget = list_results_display_widget
     108    #form_fields['passport'].custom_widget = PassportDisplayWidget
     109    form_fields['passport'].custom_widget = ThumbnailWidget
    102110    label = 'Applicant'
    103111    title = 'Applicant'
     
    108116    grok.name('edit')
    109117    form_fields = grok.AutoFields(IApplicantPDEEditData)
     118    #form_fields['passport'].custom_widget = FileWidget
     119    #form_fields['passport'].custom_widget = PassportWidget
     120    form_fields['passport'].custom_widget = EncodingImageFileWidget
    110121    grok.template('form_edit_pde')
    111122
     123    def update(self):
     124        super(EditApplicant, self).update()
     125        print self.request.form
     126        return
     127   
    112128    @property
    113129    def label(self):
  • main/waeup.sirp/trunk/src/waeup/sirp/jambtables/interfaces.py

    r5486 r5686  
    2222"""Interfaces for JAMB data tables and related components.
    2323"""
    24 from waeup.sirp.interfaces import IWAeUPObject
     24import os
     25import waeup.sirp.browser
     26from hurry.file import HurryFile
    2527from zc.sourcefactory.basic import BasicSourceFactory
    2628from zope import schema
     29from zope.app.file.interfaces import IImage
    2730from zope.interface import Interface, Attribute
    2831from zope.pluggableauth.interfaces import IPrincipalInfo
    2932from zope.security.interfaces import IGroupClosureAwarePrincipal as IPrincipal
    30 
     33from waeup.sirp.interfaces import IWAeUPObject
     34from waeup.sirp.image.schema import ImageFile
     35
     36IMAGE_PATH = os.path.join(
     37    os.path.dirname(waeup.sirp.browser.__file__),
     38    'static'
     39    )
     40DEFAULT_PASSPORT_IMAGE_MALE = HurryFile(
     41    'passport.jpg',
     42    open(os.path.join(IMAGE_PATH, 'placeholder_m.jpg')).read(),
     43    )
     44DEFAULT_PASSPORT_IMAGE_FEMALE = HurryFile(
     45    'passport.jpg',
     46    open(os.path.join(IMAGE_PATH, 'placeholder_f.jpg')).read(),
     47    )
    3148
    3249class GenderSource(BasicSourceFactory):
     
    179196        required = False,
    180197        )
    181     passport = schema.Bool(
     198    #passport = schema.Bool(
     199    #    title = u'Passport Photograph',
     200    #    default = True,
     201    #    required = False,
     202    #    )
     203    passport = ImageFile(
    182204        title = u'Passport Photograph',
    183         default = True,
    184         required = False,
     205        default = DEFAULT_PASSPORT_IMAGE_MALE,
     206        required = True,
    185207        )
    186208    aos = schema.TextLine(
     
    422444        default = u'm',
    423445        )
    424     passport = schema.Bool(
     446    #passport = schema.Bool(
     447    #    title = u'Passport Photograph',
     448    #    default = True,
     449    #    )
     450    passport = ImageFile(
    425451        title = u'Passport Photograph',
    426         default = True,
     452        default = DEFAULT_PASSPORT_IMAGE_MALE,
     453        required = True,
    427454        )
    428455    #
     
    578605        readonly = True,
    579606        )
    580     passport = schema.Bool(
     607    #passport = schema.Bool(
     608    #    title = u'Passport Photograph',
     609    #    default = True,
     610    #    required = False,
     611    #    ),
     612    #passport = schema.Bytes(
     613    #    title = u'Passport Photograph',
     614    #    required = True,
     615    #    )
     616    #passport = schema.Object(
     617    #    title = u'Passport Photograph',
     618    #    required = True,
     619    #    schema = IImage)
     620    passport = ImageFile(
    581621        title = u'Passport Photograph',
    582         default = True,
    583         required = False,
    584         )
    585 
     622        default = DEFAULT_PASSPORT_IMAGE_MALE,
     623        required = True,
     624        )
    586625
    587626class IApplicantPDEImportData(IApplicantBaseData):
Note: See TracChangeset for help on using the changeset viewer.