Changeset 639 for WAeUP_SRP/trunk


Ignore:
Timestamp:
10 Oct 2006, 13:48:43 (18 years ago)
Author:
joachim
Message:

added

Location:
WAeUP_SRP/trunk
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/trunk/Students.py

    r606 r639  
    456456###)
    457457
     458class StudentAccommodation(CPSDocument): ###(
     459    """
     460    WAeUP Student container for the various student data
     461    """
     462    meta_type = 'StudentAccommodation'
     463    portal_type = meta_type
     464    security = ClassSecurityInfo()
     465
     466    security.declareProtected(View,"Title")
     467    def Title(self):
     468        """compose title"""
     469        content = self.getContent()
     470        #return "Accommodation Data for %s %s" % (content.firstname,content.lastname)
     471        return "Accommodation Data for Session %s" % content.session
     472
     473
     474InitializeClass(StudentAccommodation)
     475
     476def addStudentAccommodation(container, id, REQUEST=None, **kw):
     477    """Add a Students personal data."""
     478    ob = StudentAccommodation(id, **kw)
     479    return CPSBase_adder(container, ob, REQUEST=REQUEST)
     480
     481###)
     482
    458483class StudentPersonal(CPSDocument): ###(
    459484    """
  • WAeUP_SRP/trunk/__init__.py

    r622 r639  
    4242        ("StudentsFolder",
    4343         "Student",
     44         "StudentAccommodation",
    4445         "StudentStudyCourse",
    4546         "StudentCourseResult",
  • WAeUP_SRP/trunk/profiles/default/types/Student.xml

    r542 r639  
    1212 <property name="filter_content_types">True</property>
    1313 <property name="allowed_content_types">
     14  <element value="StudentAccommodation"/>
    1415  <element value="StudentDocuments"/>
    1516  <element value="StudentPersonal"/>
  • WAeUP_SRP/trunk/profiles/default/workflows.xml

    r622 r639  
    6464   <bound-workflow workflow_id="waeup_student_wf"/>
    6565  </type>
     66  <type type_id="StudentAccommodation">
     67   <bound-workflow workflow_id="waeup_student_subobject_wf"/>
     68  </type>
    6669  <type type_id="StudentApplication">
    6770   <bound-workflow workflow_id="waeup_student_subobject_wf"/>
  • WAeUP_SRP/trunk/skins/waeup_accommodation/reserve_acco.py

    r636 r639  
    1414lt = context.portal_layouts
    1515pr = context.portal_registration
    16 
     16session = current.year()
     17acco_id = 'Acco_%s' % session
     18info = context.getStudentInfo()
     19student = info['student']
     20if info['acco']:
     21    return student.hostal_reservation_slip()
    1722res,psm,ds = lt.renderLayout(layout_id= 'student_acco_reserve',
    1823                      schema_id= 'student_acco_reserve',
     
    4449    pa = context.portal_accommodation
    4550    code,bed = pa.searchAndReserveBed(s_id,"%s_%s" % (info['sex'],ds.get('student_status')))
    46     if code < 0:
     51    if code < -10:
    4752        return context.reserve_acco_form(rendered = res,
    4853                                 psm = bed,
     
    5156                                 ds = ds,
    5257                                 )
    53     else:
    54         return context.reserve_acco_form(rendered = res,
     58student.invokeFactory('StudentAccommodation',acco_id)
     59acco = getattr(student,acco_id)
     60ds['acco_res_date'] = current
     61ds['bed'] = bed
     62ds['session'] = session
     63acco.getContent().edit(mapping=ds)
     64return student.hostal_reservation_slip()
     65return context.reserve_acco_form(rendered = res,
    5566                                 psm = "successfully reserved bed %s" % bed,
    5667                                 firstlayout = True,
     
    5970                                 )
    6071
    61 
  • WAeUP_SRP/trunk/skins/waeup_student/getStudentInfo.py

    r635 r639  
    2323info['is_manager'] = context.isManager
    2424member_id = str(member)
    25 if student is None:
    26     students = getattr(context,'students',None)
    27     if students is None:
    28         students = getattr(context.campus,'students',None)
    29     student = getattr(students,member_id,None)
    30     if student is None:
    31         return None
     25res = context.portal_catalog(portal_type='Student',id=member_id)
     26if not res:
     27    return None
     28brain = res[0]
     29student = brain.getObject()
     30student_path = brain.getPath()   
     31##if student is None:
     32##    students = getattr(context,'students',None)
     33##    if students is None:
     34##        students = getattr(context.campus,'students',None)
     35##    student = getattr(students,member_id,None)
     36##    if student is None:
     37##        return None
    3238info['review_state'] = wf.getInfoFor(student,'review_state','keiner')
    3339#info['wf_state'] = 'keiner'
     
    4248if info['per_doc'].sex:
    4349    info['sex'] = 'female'
     50res = context.portal_catalog(container_path=student_path,
     51                             portal_type='StudentAccommodation')
     52if res:
     53    acco = res[0].getObject()
     54    info['acco'] = acco
     55    info['acco_doc'] = acco.getContent()
     56else:
     57    info['acco'] = None
    4458return info
Note: See TracChangeset for help on using the changeset viewer.