Changeset 1016 for WAeUP_SRP/trunk


Ignore:
Timestamp:
8 Dec 2006, 19:38:39 (18 years ago)
Author:
joachim
Message:

M profiles/default/schemas/student_clearance.xml
M profiles/default/layouts/student_clearance_fe.xml
M profiles/default/layouts/student_clearance.xml
M skins/waeup_student/clearance_edit.py
added fields request_date, cleared_date

M skins/waeup_student/application_edit.py
M skins/waeup_student/getStudentInfo.py
M skins/waeup_custom/logged_in.py
M Widgets.py
cleaned up logging messages

M skins/waeup_student/start_clearance.py
added logging

Location:
WAeUP_SRP/trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/trunk/Widgets.py

    r997 r1016  
    458458    def validate(self, datastructure, **kw):
    459459        """Validate datastructure and update datamodel."""
    460         s_logger = logging.getLogger('students_pin_usage')
     460        s_logger = logging.getLogger('Student.Pin')
    461461        widget_id = self.getWidgetId()
    462462        v = datastructure[widget_id]
     
    498498                    if self.reference == "jamb_reg_no":
    499499                        err = "You are already logged in."
    500                         s_logger.info("Student %s logged in used Pin %s" % (ref,pin))
     500                        s_logger.info('"%s", "logged in", "%s"' % (ref,pin))
    501501                        break
    502                     s_logger.info("Student %s used Pin %s" % (s_id,pin))
     502                    s_logger.info('"%s", "used", "%s"' % (ref,pin))
    503503                    break
    504504                else:
    505505                    student = getStudentByRegNo(self,ref)
    506                     s_logger.info("Student RegNo %s used Pin %s" % (ref,pin))
     506                    s_logger.info('"jamb_reg_no:%s","used","%s"' % (ref,pin))
    507507                if student is None:
    508508                    err = "Student not found."
     
    513513                        if hasattr(self.portal_directories.students,s_id):
    514514                            err = "Please login with your Student Id %s and 10-digit PIN." % s_id
    515                             s_logger.info("Student %s double used Pin %s" % (s_id,pin))
     515                            s_logger.info('"%s", "double used", "%s"' % (s_id,pin))
    516516                            break
    517517                        else:
    518                             s_logger.info("Student not Member %s double used Pin %s" % (s_id,pin))
     518                            s_logger.info('"%s","notmember double used",  "%s"' % (s_id,pin))
    519519                    else:
    520520                        err = "Please login with your Student Id %s and 10-digit PIN." % s_id
    521                         s_logger.info("Student %s double used Pin %s" % (s_id,pin))
     521                        s_logger.info('"%s", "double used", "%s"' % (s_id,pin))
    522522                        break
    523523##                if self.reference == "jamb_reg_no":
     
    529529                try:
    530530                    student.getContent().makeStudentMember(s_id,password=pin[4:])
    531                     s_logger.info("Student %s created using Pin %s" % (s_id,pin))
     531                    s_logger.info('"%s", "created using", "%s"' % (s_id,pin))
    532532                except:
    533533                    err = "Please login with your Student Id %s and 10-digit PIN." % s_id
    534                     s_logger.info("Student %s double creation with Pin %s" % (s_id,ref))
     534                    s_logger.info('"%s", "double creation", "%s"' % (s_id,ref))
    535535                    break
    536536            break
  • WAeUP_SRP/trunk/profiles/default/layouts/student_clearance.xml

    r985 r1016  
    7070  </property>
    7171  <property name="hidden_readonly_layout_modes"/>
     72  <property name="view_format">iso8601_medium_easy</property>
    7273 </widget>
    7374 <widget name="alr_fname" meta_type="String Widget">
     
    159160  </property>
    160161  <property name="hidden_readonly_layout_modes"/>
     162  <property name="view_format">iso8601_medium_easy</property>
    161163 </widget>
    162164 <widget name="cert" meta_type="Image Widget">
     
    232234  <property name="label_edit">Entry Date</property>
    233235  <property name="readonly_layout_modes">
    234   </property>
    235   <property name="hidden_layout_modes">
    236    <element value="create"/>
    237   </property>
    238   <property name="hidden_readonly_layout_modes"/>
     236   <element value="edit"/>
     237  </property>
     238  <property name="hidden_layout_modes">
     239   <element value="create"/>
     240  </property>
     241  <property name="hidden_readonly_layout_modes"/>
     242  <property name="view_format">iso8601_medium_easy</property>
     243  </widget>
     244 <widget name="request_date" meta_type="Date Widget">
     245  <property name="title">Request Date</property>
     246  <property name="fields">
     247   <element value="request_date"/>
     248  </property>
     249  <property name="label">Request Date</property>
     250  <property name="label_edit">Request Date</property>
     251  <property name="readonly_layout_modes">
     252   <element value="edit"/>
     253  </property>
     254  <property name="hidden_layout_modes">
     255   <element value="create"/>
     256  </property>
     257  <property name="hidden_readonly_layout_modes"/>
     258  <property name="view_format">iso8601_medium_easy</property>
     259 </widget>
     260 <widget name="cleared_date" meta_type="Date Widget">
     261  <property name="title">cleared Date</property>
     262  <property name="fields">
     263   <element value="cleared_date"/>
     264  </property>
     265  <property name="label">Cleared Date</property>
     266  <property name="label_edit">Cleared Date</property>
     267  <property name="readonly_layout_modes">
     268   <element value="edit"/>
     269  </property>
     270  <property name="hidden_layout_modes">
     271   <element value="create"/>
     272  </property>
     273  <property name="hidden_readonly_layout_modes"/>
     274  <property name="view_format">iso8601_medium_easy</property>
    239275 </widget>
    240276 <widget name="entry_session" meta_type="String Widget">
     
    294330  </property>
    295331  <property name="hidden_readonly_layout_modes"/>
     332  <property name="view_format">iso8601_medium_easy</property>
    296333 </widget>
    297334 <widget name="fst_sit_fname" meta_type="String Widget">
     
    607644  </property>
    608645  <property name="hidden_readonly_layout_modes"/>
     646  <property name="view_format">iso8601_medium_easy</property>
    609647 </widget>
    610648 <widget name="scd_sit_fname" meta_type="String Widget">
     
    726764  </row>
    727765  <row>
     766   <cell name="request_date"/>
     767  </row>
     768  <row>
     769   <cell name="cleared_date"/>
     770  </row>
     771  <row>
    728772   <cell name="birthday"/>
    729773  </row>
  • WAeUP_SRP/trunk/profiles/default/layouts/student_clearance_fe.xml

    r985 r1016  
    7070  </property>
    7171  <property name="hidden_readonly_layout_modes"/>
     72  <property name="view_format">iso8601_medium_easy</property>
    7273 </widget>
    7374 <widget name="alr_fname" meta_type="String Widget">
     
    159160  </property>
    160161  <property name="hidden_readonly_layout_modes"/>
     162  <property name="view_format">iso8601_medium_easy</property>
    161163 </widget>
    162164 <widget name="cert" meta_type="Image Widget">
     
    238240  </property>
    239241  <property name="hidden_readonly_layout_modes"/>
     242  <property name="view_format">iso8601_medium_easy</property>
     243 </widget>
     244 <widget name="request_date" meta_type="Date Widget">
     245  <property name="title">Request Date</property>
     246  <property name="fields">
     247   <element value="request_date"/>
     248  </property>
     249  <property name="label">Request Date</property>
     250  <property name="label_edit">Request Date</property>
     251  <property name="readonly_layout_modes">
     252   <element value="edit"/>
     253  </property>
     254  <property name="hidden_layout_modes">
     255   <element value="create"/>
     256  </property>
     257  <property name="hidden_readonly_layout_modes"/>
     258  <property name="view_format">iso8601_medium_easy</property>
     259 </widget>
     260 <widget name="cleared_date" meta_type="Date Widget">
     261  <property name="title">Cleared Date</property>
     262  <property name="fields">
     263   <element value="cleared_date"/>
     264  </property>
     265  <property name="label">Cleared Date</property>
     266  <property name="label_edit">Cleared Date</property>
     267  <property name="readonly_layout_modes">
     268   <element value="edit"/>
     269  </property>
     270  <property name="hidden_layout_modes">
     271   <element value="create"/>
     272  </property>
     273  <property name="hidden_readonly_layout_modes"/>
     274  <property name="view_format">iso8601_medium_easy</property>
    240275 </widget>
    241276 <widget name="entry_session" meta_type="String Widget">
     
    296331  </property>
    297332  <property name="hidden_readonly_layout_modes"/>
     333  <property name="view_format">iso8601_medium_easy</property>
    298334 </widget>
    299335 <widget name="fst_sit_fname" meta_type="String Widget">
     
    509545  <property name="label">Local Government Area</property>
    510546  <property name="label_edit">Local Government Area</property>
    511   <property name="readonly_layout_modes"/>
     547  <property name="readonly_layout_modes">
     548  </property>
    512549  <property name="hidden_layout_modes">
    513550   <element value="create"/>
     
    557594  <property name="label">Nationality</property>
    558595  <property name="label_edit">Nationality</property>
    559   <property name="readonly_layout_modes"/>
     596  <property name="readonly_layout_modes">
     597  </property>
    560598  <property name="hidden_layout_modes">
    561599   <element value="create"/>
     
    610648  </property>
    611649  <property name="hidden_readonly_layout_modes"/>
     650  <property name="view_format">iso8601_medium_easy</property>
    612651 </widget>
    613652 <widget name="scd_sit_fname" meta_type="String Widget">
     
    729768  </row>
    730769  <row>
     770   <cell name="request_date"/>
     771  </row>
     772  <row>
     773   <cell name="cleared_date"/>
     774  </row>
     775  <row>
    731776   <cell name="birthday"/>
    732777  </row>
  • WAeUP_SRP/trunk/profiles/default/schemas/student_clearance.xml

    r852 r1016  
    1111
    1212 <field name="entry_date" meta_type="CPS DateTime Field"/>
     13 <field name="request_date" meta_type="CPS DateTime Field"/>
     14 <field name="cleared_date" meta_type="CPS DateTime Field"/>
    1315 <field name="entry_session" meta_type="CPS String Field"/>
    1416
  • WAeUP_SRP/trunk/skins/waeup_custom/logged_in.py

    r1009 r1016  
    1616current = DateTime.DateTime()
    1717import logging
    18 logger = logging.getLogger('student_login')
     18logger = logging.getLogger('Student.Login')
    1919
    2020
     
    6060            s_review_state = wftool.getInfoFor(student,'review_state',None)
    6161            a_review_state = wftool.getInfoFor(student_app,'review_state',None)
    62             logger.info('%s review_state %s' % (member,s_review_state))
     62            logger.info('"%s", "logged in", "review_state %s"' % (member,s_review_state))
    6363            app_doc = student_app.getContent()
    6464            #from Products.zdb import set_trace
  • WAeUP_SRP/trunk/skins/waeup_student/application_edit.py

    r892 r1016  
    1515import DateTime
    1616current = DateTime.DateTime()
     17import logging
     18logger = logging.getLogger('Student.Application.Edit')
    1719
    1820# Until ajax posts directly to its own script...
     
    2729info = context.getStudentInfo()
    2830
     31if info is None:
     32    logger.info('"anonymous access","%s"' % request.get('URL0'))
     33    REQUEST.RESPONSE.redirect("%s/srp_anonymous_view" % context.portal_url())
     34   
    2935student = info['student']
    3036app = info['app']
     
    5056    elif cpsdocument_edit_and_view_button:
    5157        if app_doc.passport is not None:
     58            logger.info('"%s", "continue' % (info['id']))
    5259            action = "/start_clearance"
    5360            base_url = student.absolute_url()
  • WAeUP_SRP/trunk/skins/waeup_student/clearance_edit.py

    r942 r1016  
    1515import DateTime
    1616current = DateTime.DateTime()
     17import logging
     18logger = logging.getLogger('Student.Clearance')
    1719
    1820cpsdocument_edit_button = REQUEST.has_key('cpsdocument_edit_button')
     
    3537clear = info['clear']
    3638clear_doc = info['clear_doc']
     39student_id = info['id']
     40member_id = str(context.portal_membership.getAuthenticatedMember())
    3741
    3842is_valid, ds = clear_doc.validate(request=REQUEST,
     
    5155           action = "/clearance_edit_form"       
    5256    elif cpsdocument_edit_and_view_button:
    53         if acknowledge:
     57        if acknowledge and info['review_state'] == "clearance_pin_entered":
     58            logger.info('"%s","requested clearance"' % (student_id))
     59            info['clear_doc'].edit(mapping = {'request_date': current,})
    5460            wftool.doActionFor(info['clear'],'close')
    5561            wftool.doActionFor(info['student'],'request_clearance',dest_container=1)
     
    5763            if context.isStudent():
    5864               action = "/clearance_view"
     65        elif acknowledge and info['review_state'] != "clearance_pin_entered":
     66            logger.info('"%s","double requested clearance"' % (student_id))
     67            psm = "You have already requested clearance"
     68            if context.isStudent():
     69               action = "/clearance_edit_form"
    5970        else:
    6071            psm = "You must tick the acknowledgement check box before submission!"
    6172            if context.isStudent():
    6273               action = "/clearance_edit_form"
    63     elif clear_and_validate_button:
     74    elif clear_and_validate_button and info['review_state'] == "clearance_requested":
     75        logger.info('"%s","cleared","%s"' % (member_id,student_id ))
    6476        wftool.doActionFor(info['student'],'clear_and_validate')
     77        info['clear_doc'].edit(mapping = {'cleared_date': current,})
    6578        psm = "Clearance and eligibility record is validated and and student is cleared!"
     79    elif clear_and_validate_button and info['review_state'] == "cleared_and_validated":
     80        psm = "This student is already cleared!"
    6681    elif reject_clearance_button:
     82        logger.info('"%s","rejected clearance for","%s"' % (member_id,student_id ))
    6783        wftool.doActionFor(info['clear'],'open')
    6884        wftool.doActionFor(info['student'],'reject_clearance')
  • WAeUP_SRP/trunk/skins/waeup_student/getStudentInfo.py

    r1007 r1016  
    3434        try:
    3535            requested_id = path_info[path_info.index('students')+1]
    36         except ValueError:
    37             student_id = member_id
    38             break
    39         except IndexError:
     36        except (ValueError,IndexError):
    4037            student_id = member_id
    4138            break
  • WAeUP_SRP/trunk/skins/waeup_student/start_clearance.py

    r892 r1016  
    77current = DateTime.DateTime()
    88pr = context.portal_registration
     9import logging
     10logger = logging.getLogger('Student.Clearance.Start')
    911
    1012type_name = 'Student'
     
    1820pr = context.portal_registration
    1921
     22info = context.getStudentInfo()
     23app_doc = info['app_doc']
     24review_state = info['review_state']
     25
    2026res,psm,ds = lt.renderLayout(layout_id='student_clearance',
    2127                      schema_id= 'student_clearance',
     
    2733                      button = "Start",
    2834                      )
    29 
    30 info = context.getStudentInfo()
    31 app_doc = info['app_doc']
    32 if app_doc.passport is None:
    33     return context.clearance_pin_form(rendered = res,
    34                                  psm = "You must upload your passport picture before you can start the registration process!",
    35                                  #psm = "%s, %s" % (psm,ds),
    36                                  firstlayout = True,
    37                                  lastlayout = True,
    38                                  ds = ds,
    39                                  )
    40 
    41 if psm == 'invalid':
    42     return context.clearance_pin_form(rendered = res,
    43                                  psm = "Please correct your input!",
    44                                  #psm = "%s, %s" % (psm,ds),
    45                                  firstlayout = True,
    46                                  lastlayout = True,
    47                                  ds = ds,
    48                                  )
    49 elif psm == '':
     35if psm == '':
    5036    return context.clearance_pin_form(rendered = res,
    5137                                 psm = None,
     
    5440                                 ds = ds,
    5541                                 )
    56 elif psm == 'valid':
    57     info = context.getStudentInfo()
    58     review_state = info['review_state']
    59     wf.doActionFor(info['student'],'enter_clearance_pin')
    60     wf.doActionFor(info['app'],'close')
    61     wf.doActionFor(info['clear'],'open')
    62     pin = str(ds.get('clr_ac_pin'))
    63     dc = {}
    64     dc['clr_ac_pin'] = pin
    65     dc['clr_ac_date'] = current
    66     dc['entry_date'] = current
    67     dc['entry_session'] = "2006/2007"
    68     info['clear_doc'].edit(mapping = dc)
     42error = False
     43if app_doc.passport is None:
     44    psm = "You must upload your passport picture before you can start the registration process!"
     45    error = True
     46elif review_state == "clearance_pin_entered":
     47    psm = "You have already entered a clearance pin"
     48    error = True
     49elif psm == 'invalid':
     50    psm = "Please correct your input!",
     51    error = True
     52if error:
     53    return context.clearance_pin_form(rendered = res,
     54                                 psm = psm,
     55                                 firstlayout = True,
     56                                 lastlayout = True,
     57                                 ds = ds,
     58                                 )
     59pin = str(ds.get('clr_ac_pin'))
     60logger.info('"%s", "%s"' % (info['id'],pin))
     61wf.doActionFor(info['student'],'enter_clearance_pin')
     62wf.doActionFor(info['clear'],'open')
     63dc = {}
     64app_doc = info['app_doc']
     65dc['lga_ident'] = app_doc.get('jamb_lga')
     66dc['lga'] = app_doc.get('jamb_state','no state') + ' / ' + app_doc.get('jamb_lga','no lga')
     67dc['clr_ac_date'] = current
     68dc['entry_date'] = current
     69dc['entry_session'] = "2006/2007"
     70wf.doActionFor(info['app'],'close')
     71info['clear_doc'].edit(mapping = dc)
    6972return redirect("%s/clearance_edit_form" % info['clear'].absolute_url())
Note: See TracChangeset for help on using the changeset viewer.