Changeset 1558 for WAeUP_SRP


Ignore:
Timestamp:
15 Mar 2007, 16:44:41 (18 years ago)
Author:
joachim
Message:

merged trunk up to 1557

Location:
WAeUP_SRP/branches/joachim-event-branch
Files:
22 edited
1 copied

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/branches/joachim-event-branch/PatchCPSUserFolderUserFolder.py

    r1515 r1558  
    7373        if callable(real_object) and hasattr(real_object,'im_self'):
    7474            real_object = real_object.im_self
     75
    7576        if hasattr(real_object,'portal_type') and\
    7677                   real_object.portal_type not in ("Student","StudentClearance","StudentStudyLevel"):
    7778            break
     79
     80        #from pdb import set_trace;set_trace()
     81        # can be later simplified by replacing by students_catalog values - Henrik
     82        # getattr works always because of acquisition ?! Henrik
    7883        sc = getattr(real_object,'study_course',None)
    7984        if sc is None:
    8085            break
    8186        sc_obj = sc.getContent()
    82         res_sc = self.portal_catalog(portal_type="Certificate",
    83                                      id = sc_obj.study_course)
    84         if len(res_sc) != 1:
     87        cert_id = sc_obj.study_course
     88        res_cert = self.portal_catalog(id = cert_id)
     89        if len(res_cert) != 1:
    8590            break
    86         cert_path = res_sc[0].getPath().split('/')
     91        certificate_brain = res_cert[0]
     92        certificate_obj = certificate_brain.getObject()
     93        cert_path = certificate_brain.getPath().split('/')
    8794        fac_id = cert_path[-4]
    8895        dep_id = cert_path[-3]
    89 
    90 
    91         # temporary sel-healing function
     96        # temporary self-healing function
    9297        # deprecated after reindexing the students_catalog
    9398        student_id = self.getStudentId()
     
    95100        if len(res) != 1:
    96101            break
    97         self.students_catalog.modifyRecord(id = student_id,
     102        st_entry = res[0]
     103        if st_entry.faculty != fac_id or\
     104           st_entry.department != dep_id or\
     105           st_entry.course != cert_id:
     106               self.students_catalog.modifyRecord(id = student_id,
    98107                                                faculty = fac_id,
    99108                                                department = dep_id,
     109                                                course = cert_id
    100110                                                )
    101 
    102 
    103         res = self.portal_catalog(portal_type="Department",id=dep_id)
    104         if len(res) != 1:
    105             break
    106         dynamic_roles = self.getRolesInContext(res[0].getObject())
    107         for dr in ('ClearanceOfficer','CourseAdviser', 'SectionManager'):
     111        if real_object.portal_type == "StudentStudyLevel":
     112            context_obj = getattr(certificate_obj,real_object.getId())
     113            allowed = ('CourseAdviser', 'SectionManager')
     114        else:
     115            res = self.portal_catalog(portal_type="Department",id=dep_id)
     116            allowed = ('ClearanceOfficer', 'SectionManager')
     117            if len(res) != 1:
     118                break
     119            context_obj = res[0].getObject()
     120        dynamic_roles = self.getRolesInContext(context_obj)
     121        for dr in allowed:
    108122            if dr in dynamic_roles:
    109123                roles.append(dr)
  • WAeUP_SRP/branches/joachim-event-branch/WAeUPTables.py

    r1306 r1558  
    210210
    211211class StudentsCatalog(WAeUPTable): ###(
     212    security = ClassSecurityInfo()
    212213
    213214    meta_type = 'WAeUP Students Catalog'
    214215    name = "students_catalog"
    215216    key = "id"
     217    interesting_types = ('Student',
     218                         'StudentApplication',
     219                         'StudentCLearance',
     220                         'StudentPersonal',
     221                         'StudentStudyCourse',
     222                         )
    216223    def __init__(self):
    217224        WAeUPTable.__init__(self, 'students_catalog')
    218225
     226    security.declarePrivate('notify_event_listener')
     227    def notify_event_listener(self,event_type,object,infos):
     228        "listen for events"
     229        pt = object.portal_type
     230        mt = object.meta_type
     231        students_catalog = self.students_catalog
     232        #if pt not in self.interesting_types:
     233        #    return
     234        #print "%(pt)s\n %(event_type)s \n %(infos)s\n" % vars()
     235        if not infos.has_key('rpath'):
     236            return
     237        if pt == 'Student' and event_type == "workflow":
     238            pass
     239        elif mt == 'StudentApplication':
     240            if event_type not in ('sys_modify_object'):
     241                return
     242            print "%(pt)s\n %(event_type)s \n %(infos)s\n" % vars()
     243            from pdb import set_trace;set_trace()
     244            jamb_reg_no = getattr(object,'jamb_reg_no',None)
     245            if jamb_reg_no is None:
     246                return
     247            student_id = infos['rpath'].split('/')[2]
     248            student_entry = students_catalog(id = student_id)[0]
     249            if student_entry.jamb_reg_no == jamb_reg_no:
     250                return
     251            students_catalog.modifyRecord(id = student_id,
     252                                          jamb_reg_no = jamb_reg_no)
     253       
     254           
    219255
    220256InitializeClass(StudentsCatalog)
  • WAeUP_SRP/branches/joachim-event-branch/Widgets.py

    r1449 r1558  
    719719            err ='You are not a Student. PIN neither checked nor used.'
    720720            s_logger.info('"%s","tried to use Scratchcard", "%s"' % (s_id,pin_str))
     721        elif len(b) > 1 and b.find('-') > -1:
     722            do = 0
     723            err = 'PIN must not contain the "-"'
     724            s_logger.info('"%s","Invalid PIN-Number, contains -"' % (s_id))
     725        elif n.find('-') > -1:
     726            do = 0
     727            err = 'PIN must not contain the "-"'
     728            s_logger.info('"%s","Invalid PIN-Number, contains -"' % (s_id))
    721729        elif len(n) != 10:
    722730            do = 0
  • WAeUP_SRP/branches/joachim-event-branch/profiles/default/accommodation.xml

    r1410 r1558  
    11<?xml version="1.0"?>
    22<?xml-stylesheet type="text/xsl" href="catalog.xsl"?>
    3 <object name="portal_catalog" meta_type="WAeUP Table">
     3<object name="portal_accommodation" meta_type="WAeUP Table">
    44 <column value="bed"/>
    55 <column value="bed_type"/>
  • WAeUP_SRP/branches/joachim-event-branch/profiles/default/payments_catalog.xml

    r1403 r1558  
    11<?xml version="1.0"?>
    22<?xml-stylesheet type="text/xsl" href="catalog.xsl"?>
    3 <object name="payments_catalog" meta_type="CMF Catalog">
     3<object name="payments_catalog" meta_type="WAeUP Table">
    44 <column value="id"/>
    55 <column value="student_id"/>
  • WAeUP_SRP/branches/joachim-event-branch/profiles/default/pumeresults.xml

    r1456 r1558  
    11<?xml version="1.0"?>
    22<?xml-stylesheet type="text/xsl" href="catalog.xsl"?>
    3 <object name="portal_catalog" meta_type="WAeUP Table">
     3<object name="portal_pumeresults" meta_type="WAeUP Table">
    44 <column value="jamb_reg_no"/>
    55 <column value="name"/>
  • WAeUP_SRP/branches/joachim-event-branch/profiles/default/results_import.xml

    r1456 r1558  
    11<?xml version="1.0"?>
    22<?xml-stylesheet type="text/xsl" href="catalog.xsl"?>
    3 <object name="portal_catalog" meta_type="CMF Catalog">
     3<object name="results_import" meta_type="WAeUP Table">
    44 <column value="key"/>
    55 <column value="matric_no"/>
  • WAeUP_SRP/branches/joachim-event-branch/profiles/default/returning_import.xml

    r1456 r1558  
    11<?xml version="1.0"?>
    22<?xml-stylesheet type="text/xsl" href="catalog.xsl"?>
    3 <object name="portal_catalog" meta_type="CMF Catalog">
     3<object name="returning_import" meta_type="WAeUP Table">
    44 <column value="matric_no"/>
    55 <column value="Entryregno"/>
  • WAeUP_SRP/branches/joachim-event-branch/profiles/default/schemas/import_student_course_results.xml

    r1533 r1558  
    66 <field name="score" meta_type="CPS String Field"/>
    77</object>
    8 
  • WAeUP_SRP/branches/joachim-event-branch/profiles/default/types/StudyLevel.xml

    r1449 r1558  
    3737  <permission value="View"/>
    3838 </action>
    39    <action title="Add Course" action_id="new_entry" category="object"
    40     condition_expr=""
    41     url_expr="string:${object_url}/content_create?type_name=CertificateCourse"
    42     visible="True">
    43   <permission value="Modify portal content"/>
     39  <action title="Add Course" action_id="new_entry" category="object"
     40          condition_expr=""
     41          url_expr="string:${object_url}/content_create?type_name=CertificateCourse"
     42          visible="True">
     43    <permission value="Modify portal content"/>
     44  </action>
     45  <action title="Delegate" action_id="localroles" category="object"
     46          condition_expr="" url_expr="string:${object_url}/folder_localrole_form"
     47          visible="True">
     48    <permission value="Modify portal content"/>
    4449 </action>
     50
    4551</object>
  • WAeUP_SRP/branches/joachim-event-branch/profiles/default/vocabularies/searchable_student_states.xml

    r1516 r1558  
    1919 <item key="clearance_requested" msgid="">clearance requested</item>
    2020 <item key="cleared_and_validated" msgid="">cleared and validated</item>
     21 <item key="courses_registered" msgid="">courses registered</item>
     22 <item key="courses_validated" msgid="">courses validated</item>
    2123 <item key="content_addable" msgid="">content addable</item>
    2224</object>
  • WAeUP_SRP/branches/joachim-event-branch/skins/waeup_default/isCourseAdviser.py

    r1515 r1558  
    1616mtool = context.portal_membership
    1717roles = mtool.getAuthenticatedMember().getRolesInContext(context)
     18<<<<<<< .working
     19return str("CourseAdviser" in roles)
     20=======
     21return str("CourseAdviser" in roles)
    1822return "CourseAdviser" in roles
     23>>>>>>> .merge-rechts.r1557
    1924
  • WAeUP_SRP/branches/joachim-event-branch/skins/waeup_default/waeup_edit.py

    r1456 r1558  
    4242if is_valid:
    4343    comments = REQUEST.get('comments')
    44     context.cpsdocument_notify_modification(comments=comments)
     44    #context.cpsdocument_notify_modification(comments=comments)
    4545    if context.portal_type == "StudentStudyCourse":
    4646        course = ds.get('study_course')
  • WAeUP_SRP/branches/joachim-event-branch/skins/waeup_student/course_result_delete.py

    r1482 r1558  
    1818ret_url = here.absolute_url()
    1919
     20message = ''
    2021if ids:
    21     here.manage_delObjects(ids)
    22     message = 'portal_status_message=psm_item(s)_deleted'
     22    real_ids = []
     23    for id in ids:
     24        if context.hasObject(id):
     25            real_ids.append(id)
     26    if real_ids:
     27        context.manage_delObjects(real_ids)
     28        message = 'portal_status_message=psm_item(s)_deleted'
    2329else:
    2430    message = 'portal_status_message=psm_select_at_least_one_document'
  • WAeUP_SRP/branches/joachim-event-branch/skins/waeup_student/create_level.py

    r1513 r1558  
    4141elif in_progress == 'started':
    4242    return
     43
     44if context.hasObject(current_level):
     45    return
     46    level = getattr(context,current_level)
     47    return response.redirect("%s" % level.absolute_url())
     48   
    4349context.invokeFactory('StudentStudyLevel',"%s" % current_level)
    4450level = getattr(context,"%s" % current_level)
     
    101107session.set('in_progress','finished')
    102108return
    103 return response.redirect("%s" % level.absolute_url())
  • WAeUP_SRP/branches/joachim-event-branch/skins/waeup_student/getRetStudentStatistics.py

    r1536 r1558  
    1313"""
    1414import logging
    15 logger = logging.getLogger('Student.Statistics')
     15logger = logging.getLogger('Skins.getRetStudentStatistics')
    1616
    1717try:
     
    2121except:
    2222    evalAdvancedQuery = None
    23 logger.info('"%s","invoked returning statistics"' % context.portal_membership.getAuthenticatedMember())
     23logger.info('%s invoked returning statistics' % context.portal_membership.getAuthenticatedMember())
    2424l = []
    2525if not context.isStaff():
    2626    return l
    2727dep = {}
    28 sum = 0
    2928dep['id'] = "All Faculties"
    3029
    31 #from Products.zdb import set_trace;set_trace()
    3230
    33 ret_res = context.portal_catalog(review_state ='returning')
    34 ret_ids = [r.getId for r in ret_res]
    35 ret = len(ret_res)
    36 dep['total'] = ret
     31ret_res1 = context.portal_catalog(review_state = 'returning')
     32ret_ids1 = [r.getId for r in ret_res1]
     33total_ret = len(ret_ids1)
     34
     35ret_res2 = context.portal_catalog(review_state = ('school_fee_paid','courses_registered','courses_validated',))
     36ret_ids2 = [r.getId for r in ret_res2]
     37
     38retquery = Ge('level','300') | (Eq('level','200') & Eq('entry_mode','UME'))
     39ret_res3 = aq_students(retquery)
     40ret_ids3 = [r.id for r in ret_res3]
    3741
    3842l.append(dep)
     43sum_ret = 0
     44sum_sfp = 0
    3945fs = context.portal_catalog(portal_type="Faculty")
    4046for fid in [f.getId for f in fs]:
     
    4551    stud_ids = [r.id for r in stud_res]
    4652    total = float(len(stud_res))
    47 
    4853    if total == 0:
    4954        continue
    50 
    51     ret = len([s for s in stud_ids if s in ret_ids])
    52     dep['returned'] = ret
    53     sum += ret
    54 
    55     if ret == 0:
    56         continue
    57 
     55    sfp = len([s for s in stud_ids if s in ret_ids2 and s in ret_ids3])
     56    dep['sfp'] = sfp
     57    ret = len([s for s in stud_ids if s in ret_ids1])
     58    dep['ret'] = ret
     59    sum_ret += ret
     60    sum_sfp += sfp
     61       
    5862    l.append(dep)
    5963
    60 l[0]['sum'] = sum
     64l[0]['ret'] = sum_ret
     65l[0]['sfp'] = sum_sfp
     66l[0]['total_ret'] = total_ret + sum_sfp
     67l[0]['total_li'] = sum_ret + sum_sfp
     68
    6169
    6270return l
  • WAeUP_SRP/branches/joachim-event-branch/skins/waeup_student/get_searchable_student_states.py

    r1033 r1558  
    2323    return [item for item in voc.items() if item[0].startswith('clear') or
    2424                                         item[0] in ("all",)]
     25elif "CourseAdvisers" in member.getGroups():
     26    return [item for item in voc.items() if item[0].startswith('courses') or
     27                                         item[0] in ("all",)]
    2528return voc.items()
    2629
  • WAeUP_SRP/branches/joachim-event-branch/skins/waeup_student/search_students.py

    r1500 r1558  
    6161user_info['faculties'] = []
    6262co_view = False
     63ca_view = False
    6364faculties =  fget('faculties')
    6465departments = fget('departments')
    65 dep_str = fac_str = ''
     66certificate_level = fget('certificate_level')
     67dep_str = fac_str = certificate_level_str = ''
    6668if "ClearanceOfficers" in member.getGroups():
    6769    state = "clearance_requested"
     
    9395        user_info['departments'] = departments
    9496        dep_str = " ".join(departments)
     97elif "CourseAdvisers" in member.getGroups():
     98    state = "courses_registered"
     99    only_review = False
     100    ca_view = True
     101    if certificate_level:
     102        #from Products.zdb import set_trace;set_trace()
     103        certificate_level_str = certificate_level
     104        certificate_level = certificate_level.split()
     105    else:
     106        query = In('portal_type',('StudyLevel',)) &\
     107                 In('localUsersWithRoles', ("user:%s" % member,))
     108        res = evalAdvancedQuery(query)
     109        certificate_level = []
     110        if res:
     111            certificate_level = ['/'.join(f.getPath().split('/')[-2:]) for f in res]
     112        user_info['certificate_level'] = certificate_level
     113        certificate_level_str = " ".join(certificate_level)
    95114default = {'search_mode': 'student_id',
    96115        'review_state': state,
     
    106125                      faculties = fac_str,
    107126                      departments = dep_str,
     127                      certificate_level = certificate_level_str,
    108128                      commit = False,
    109129                      )
     
    200220        end = DateTime().timeTime()
    201221        logger.info('"%s","searchtime","%6.2f"' % (member,end-start))
     222elif ca_view:
     223    only_review = False
     224    with_review = True
     225    if with_timer:
     226        start = DateTime().timeTime()
     227        logger.info('"%s","start 200"' % member)
     228    courses = [cl.split('/')[0] for cl in certificate_level]
     229    levels = [cl.split('/')[1] for cl in certificate_level]
     230    query = In('course',courses) & In('level',levels)
     231    res = aq_students(query)
     232    if with_timer:
     233        end = DateTime().timeTime()
     234        logger.info('"%s","searchtime","%6.2f"' % (member,end-start))
     235        start = DateTime().timeTime()
     236    search_set = [r.id for r in res]
     237    if with_timer:
     238        end = DateTime().timeTime()
     239        logger.info('"%s","searchtime","%6.2f"' % (member,end-start))
    202240if with_timer:
    203241    logger.info('"%s","start 300"' % member)
  • WAeUP_SRP/branches/joachim-event-branch/skins/waeup_student/search_students_form.pt

    r1531 r1558  
    3535      </span>
    3636      </strong>
    37      
    38              
    3937        <h3> Search Student Section</h3><br />
    4038          You are logged in as member <span tal:replace="info/member|nothing" />
     
    4543          <span tal:condition="info/departments|nothing" tal:omit-tag="">
    4644            and <span tal:repeat="department info/departments|nothing" tal:content="department"/></span>.
     45          <span tal:condition="info/certificate_level|nothing" tal:omit-tag="">
     46            who is CourseAdviser for
     47            <span tal:repeat="cl info/certificate_level" tal:content="cl" />
     48          </span>
    4749          <br /><br />
    4850        <span tal:replace="structure rendered" />
  • WAeUP_SRP/branches/joachim-event-branch/skins/waeup_student/statistics_ret_view.pt

    r1532 r1558  
    2424      <h3>Returning Student Statistics</h3>
    2525      <br />     
     26      <span tal:content="python:departments[0]['total_ret']" />
     27      returning student records have been imported.
     28      <span tal:content="python:departments[0]['total_li']" /> returning students
     29      have logged in.
     30      <br /><br />
    2631      <span tal:condition="not:isAnon">
    2732        <table>
    2833          <tr class="odd ajaxtd">
    2934            <th >Faculty</th>
    30             <th align="right">Returning</th>
     35            <th align="right">RET</th>
     36            <th align="right">SFP</th>
    3137          </tr>
    3238          <tr tal:define="d python:departments[0]"
     
    3440              <td width="80px">All Faculties</td>
    3541              <td width="80px" align="right">
    36                 <span tal:content="d/sum" /> of <span tal:content="d/total" />
     42                <span tal:content="d/ret" />
     43              </td>   
     44              <td width="80px" align="right">
     45                <span tal:content="d/sfp" />
    3746              </td>             
    3847          </tr>
     
    4150              <td width="80px"> <span tal:content="d/id" /> </td>
    4251              <td width="80px" align="right">
    43                 <span tal:content="d/returned " />
    44               </td>             
     52                <span tal:content="d/ret" />
     53              </td>       
     54              <td width="80px" align="right">
     55                <span tal:content="d/sfp" />
     56              </td>                             
    4557          </tr>
    4658        </table>
    4759        <br />
     60        <table>
     61        <tr><td>RET:</td> <td>Returning students who only logged in</td></tr>
     62        <tr><td>SFP:</td> <td>Returning students who paid their school fee</td></tr>
     63        </table>       
    4864      </span>
    4965      </span>
  • WAeUP_SRP/branches/joachim-event-branch/skins/waeup_student/students_index.py

    r1239 r1558  
    2323students_url = "%s/campus/students" % (context.portal_url())
    2424
    25 if "ClearanceOfficers" in member.getGroups():
     25if "ClearanceOfficers" in member.getGroups() or\
     26   "CourseAdvisers" in member.getGroups():
    2627    return redirect("%s/search_students" % context.portal_url())
    2728if context.isSectionOfficer():
  • WAeUP_SRP/branches/joachim-event-branch/skins/waeup_student/study_level_view.pt

    r1519 r1558  
    6363        <h4>Session Courses</h4>
    6464        <br />
    65         <table class="contentListing" width="100%" summary="content layout" id="folder_content">     
     65      <div class="" tal:condition="not: info/normal">
     66        Your faculty has not yet provided the list of courses for your certificate. Please contact your faculty!
     67      </div>
     68        <table class="contentListing" width="100%" id="folder_content"
     69               tal:condition="info/normal">     
    6670          <tr tal:repeat="row info/normal"
    6771              tal:attributes="class python:test(repeat['row'].even(), 'even ajaxtd', 'odd ajaxtd')">
     
    106110                       />
    107111                <br /><br />
    108                 <input type="submit" name="register_courses:method"
     112                <input tal:condition="info/normal"
     113                       type="submit" name="register_courses:method"
    109114                       class="context" value="Submit" />
    110115            </td>
Note: See TracChangeset for help on using the changeset viewer.