Changeset 885 for WAeUP_SRP


Ignore:
Timestamp:
17 Nov 2006, 16:06:47 (18 years ago)
Author:
joachim
Message:

cleaned up several things:

  1. the definitions for isManager, isStaff, and isClearanceOfficer

are now independant from eachother only based on roles or groups.
The Manager-Role is the superuser-role,
the is-Scripts document what is what.

since isStaff returns false if the member only has Manager-role,
in .cpsskins_theme it must now be:

if context.isStaff() or context.isManager():

return 'WAeUP_Backoffice'

todo: finish the merge of co_searchStudents and searchStudents

Location:
WAeUP_SRP/trunk
Files:
1 added
12 edited
1 moved

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/trunk/profiles/default/actions.xml

    r874 r885  
    119119  </action>
    120120  <action title="Students" action_id="view_students" category="navigation"
    121      condition_expr="here/isStaff" url_expr="string:${portal_url}/campus/students"
     121     condition_expr="python:here.isStaff() or here.isManager()" url_expr="string:${portal_url}/campus/students"
    122122     visible="True">
    123123   <permission>View</permission>
  • WAeUP_SRP/trunk/profiles/default/workflows/waeup_student_subobject_wf/definition.xml

    r883 r885  
    88 <permission>View</permission>
    99 <state state_id="closed" title="">
    10   <exit-transition transition_id="open"/>
     10  <permission-map name="Modify portal content"
     11                  acquired="True">
     12   <permission-role>ClearanceOfficer</permission-role>
     13  </permission-map>
     14 <exit-transition transition_id="open"/>
    1115 </state>
    1216 <state state_id="content_addable" title="">
  • WAeUP_SRP/trunk/skins/waeup_default/isClearanceOfficer.py

    r875 r885  
    55##bind script=script
    66##bind subpath=traverse_subpath
    7 ##parameters=info=None
     7##parameters=
    88##title=
    99##
    1010# $Id$
    11 """
    1211
    13 """
    14 wftool = context.portal_workflow
    1512mtool = context.portal_membership
    16 member = mtool.getAuthenticatedMember()
    17 
    18 if info is None:
    19     info = context.getStudentInfo()
    20 if info is None:
    21     return False
    22 if info['course'] is None:
    23     return False
    24 
    25 res = context.portal_catalog(portal_type="Department",id=info['course_doc'].department)
    26 if len(res) != 1:
    27     return False
    28 
    29 roles = member.getRolesInContext(res[0].getObject())
    30 
     13roles = mtool.getAuthenticatedMember().getRolesInContext(context)
    3114return "ClearanceOfficer" in roles
    3215
  • WAeUP_SRP/trunk/skins/waeup_default/isManager.py

    r874 r885  
    99##
    1010# $Id$
    11 """
    12 return True if the member is considered a Manager,
    13 consider all non-Student members to be Managers
    1411
    15 """
    16 return context.isStaff()
     12mtool = context.portal_membership
     13roles = mtool.getAuthenticatedMember().getRolesInContext(context)
     14return "Manager" in roles
  • WAeUP_SRP/trunk/skins/waeup_default/isStaff.py

    r879 r885  
    99##
    1010# $Id: $
    11 """
    1211
    13 """
    1412mtool = context.portal_membership
    15 if mtool.isAnonymousUser():
    16     return False
    17 roles = mtool.getAuthenticatedMember().getRolesInContext(context)
    18 return not "Student" in roles
     13member = mtool.getAuthenticatedMember()
     14roles = member.getRolesInContext(context)
    1915
     16return "SectionManager" in roles or\
     17       "ClearanceOfficer" in roles or\
     18       "ClearanceOfficers" in member.getGroups()
  • WAeUP_SRP/trunk/skins/waeup_default/isStudent.py

    r874 r885  
    99##
    1010# $Id$
    11 """
    12 return True if the member is considered a Student
    13 """
    14 roles = context.portal_membership.getAuthenticatedMember().getRolesInContext(context)
     11
     12mtool = context.portal_membership
     13roles = mtool.getAuthenticatedMember().getRolesInContext(context)
    1514return  "Student" in roles
  • WAeUP_SRP/trunk/skins/waeup_student/clearance_edit.py

    r852 r885  
    55##bind script=script
    66##bind subpath=traverse_subpath
    7 ##parameters=REQUEST, cpsdocument_edit_button=None, cpsdocument_edit_and_view_button=None, acknowledge=None
     7##parameters=REQUEST
    88##title=
    99# $Id$
     
    1616current = DateTime.DateTime()
    1717
     18cpsdocument_edit_button = REQUEST.has_key('cpsdocument_edit_button')
     19cpsdocument_edit_and_view_button = REQUEST.has_key('cpsdocument_edit_and_view_button')
     20clear_and_validate_button = REQUEST.has_key('clear_and_validate_button')
     21reject_clearance_button = REQUEST.has_key('reject_clearance_button')
    1822# Until ajax posts directly to its own script...
    1923##if 'ajax_edit' in REQUEST.form:
    2024##    return context.cpsdocument_edit_ajax(REQUEST, cluster=cluster)
    21 
    22 # Check flexible controls
    23 #context.editLayouts(REQUEST=REQUEST)
    2425
    2526# Validate the document and write it if it's valid
     
    3334clear = info['clear']
    3435clear_doc = info['clear_doc']
    35 state = context.getStudentInfo()['review_state']
     36review_state = info['review_state']
    3637
    3738is_valid, ds = clear_doc.validate(request=REQUEST,
    3839                                schema_id = 'student_clearance',
    39                                 layout_id = 'student_clearance_fe',
     40                                layout_id = 'student_clearance',
    4041                                proxy=clear,
    4142                                use_session=True)
     
    4849        psm = 'Content changed.'
    4950    elif cpsdocument_edit_and_view_button:
    50         if acknowledge:
    51             wftool.doActionFor(info['clear'],'close')
    52             wftool.doActionFor(info['student'],'request_clearance')
    53             return REQUEST.RESPONSE.redirect("%s/clearance_view" % info['url'])
    54         psm = "You must tick the Acknowledgement Check Box before submission!"
     51        wftool.doActionFor(info['clear'],'close')
     52        wftool.doActionFor(info['student'],'request_clearance',dest_container=1)
     53    elif clear_and_validate_button:
     54        wftool.doActionFor(info['student'],'clear_and_validate')
     55    elif reject_clearance_button:
     56        wftool.doActionFor(info['clear'],'open')
     57        wftool.doActionFor(info['student'],'reject_clearance')
    5558else:
    5659    psm = "Please correct your errors."
    5760args = getFormUidUrlArg(REQUEST)
     61args['review_state'] = review_state
    5862args['portal_status_message'] = psm
    5963if args:
  • WAeUP_SRP/trunk/skins/waeup_student/clearance_edit_form.pt

    r852 r885  
    11<tal:block define="
    22           info context/getStudentInfo;
     3           isManager context/isManager;
     4           isStaff context/isStaff;
     5           isClearanceOfficer context/isClearanceOfficer;
     6           isOwner context/isThisStudent;
     7           review_state info/review_state;
     8           edition python: (isOwner and review_state == 'clearance_pin_entered' or isManager) and not isClearanceOfficer;
     9           mode python: test(edition,'edit','view');
    310           rendered_main python:info['clear_doc'].render(request=request,
    4                                                layout_mode = 'edit',
     11                                               layout_mode = mode,
    512                                               schema_id='student_clearance',
    6                                                layout_id='student_clearance_fe',
    7                                                layout_mode='edit',
     13                                               layout_id='student_clearance',
    814                                               use_session=True);
    915           form_action string:clearance_edit;
    10            edition python:True;
    1116           creation python:False;
    12            metadata nothing;
    1317    ">
    14 <metal:block define-macro="edit_form">
    1518<metal:block use-macro="here/waeup_content_master/macros/master">
    16 
    1719  <metal:block fill-slot="header">
    18      <a href=""
    19        tal:attributes="href string:${here/academicsParent}">
    20       <img tal:attributes="src string:${here/portal_url}/arrow_up.gif"/>
    21       Up one level
    22     </a>
    23     <h3>Fill Your Clearance/Eligibility Form!</h3>
    24     <br />   
     20    <metal:block use-macro="here/clearance_edit_lib/macros/header" />
    2521  </metal:block>
    26 
    2722  <metal:block fill-slot="main">
    2823    <form action="ACTION" method="post" id="editForm"
     
    3934        </div>
    4035      </div>
    41 
    42       <div>
    43 
    44           <input type="checkbox" value="True" name="acknowledge" />     &nbsp;&nbsp; 
    45 
    46           I hereby acknowledge by ticking this check box
    47           that, if it is discovered at any time that I do not possess any of the
    48           qualifications which I claim to have obtained, I will be expelled from the
    49           University and shall not be re-admitted for the same or any other programme,
    50           even if I have upgraded my previous qualifications or possess additional
    51           qualifications.   
    52                        
    53 
    54       </div>
    55 
    56       <br />
    57      
    58       <input type="submit" class="standalone"
    59              name="cpsdocument_edit_button"
    60              value="Save & Return later"
    61              id="cpsdocument_edit_button"
    62              tal:condition="not:creation" />
    63       <input type="submit" class="standalone"
    64              name="cpsdocument_edit_and_view_button"
    65              value="Save & Submit"
    66              id="cpsdocument_edit_and_view_button"
    67              tal:condition="not:creation" />
     36      <metal:block use-macro="here/clearance_edit_lib/macros/buttons" />
    6837      </form>
    6938      <div id="ajax_psm" style="display:none">
     
    7241    </metal:block>
    7342  </metal:block>
    74 </metal:block>
    7543</tal:block>
  • WAeUP_SRP/trunk/skins/waeup_student/clearance_edit_form_manager.pt

    r876 r885  
    11<tal:block define="
    22           info context/getStudentInfo;
    3            mode python: test(context.isClearanceOfficer(info),'view','edit');
     3           isManager context/isManager;
     4           isStaff context/isStaff;
     5           isClearanceOfficer context/isClearanceOfficer;
     6           isOwner context/isThisStudent;
     7           edition python:(isOwner or isManager) and not isClearanceOfficer;
     8           mode python: test(edition,'edit','view');
    49           rendered_main python:info['clear_doc'].render(request=request,
    510                                               layout_mode = mode,
     
    813                                               use_session=True);
    914           form_action string:clearance_edit_manager;
    10            isManager context/isManager;
    11            edition python:True;
    1215           creation python:False;
    1316           review_state info/review_state
     
    1518<metal:block use-macro="here/waeup_content_master/macros/master">
    1619  <metal:block fill-slot="header">
    17     <span tal:condition="not: isManager">
     20    <span tal:condition="python: not(isStaff or isManager)">
    1821      <metal:block use-macro="here/error_not_found/macros/not_found" />
    1922    </span>
    20     <span tal:condition="isManager">
     23    <span tal:condition="python: isStaff or isManager">
    2124      <a href=""
    2225         tal:attributes="href string:${here/academicsParent}">
     
    4750        </div>
    4851      </div>
    49       <input type="submit" class="standalone"
    50              name="cpsdocument_edit_button"
    51              value="Save & Return Later"
    52              id="cpsdocument_edit_button"
    53              tal:condition="python: review_state == 'clearance_pin_entered'" />
    54       <input type="submit" class="standalone"
    55              name="cpsdocument_edit_and_view_button"
    56              value="Save & Submit"
    57              id="cpsdocument_edit_and_view_button"
    58              tal:condition="python: review_state == 'clearance_pin_entered'" />
    59       <input type="submit" class="standalone"
    60              name="clear_and_validate_button"
    61              value="Validate & Clear"
    62              id="clear_and_validate_button"
    63              tal:condition="python:review_state == 'clearance_requested'" />
    64       <input type="submit" class="standalone"
    65              name="reject_clearance_button"
    66              value="Reject Clearance"
    67              id="reject_clearance_button"
    68              tal:condition="python:review_state == 'cleared_and_validated'" />
     52      <metal:block use-macro="here/clearance_edit_lib/macros/buttons" />
    6953      </form>
    7054      <div id="ajax_psm" style="display:none">
  • WAeUP_SRP/trunk/skins/waeup_student/co_searchStudents.py

    r883 r885  
    4949pr = context.portal_registration
    5050path_info = request.get('PATH_INFO').split('/')
    51 is_manager = context.isManager
     51is_manager = context.isManager()
    5252validate = request.has_key("cpsdocument_edit_button")
    5353default = {'search_mode': 'name',
     
    6969                             #psm = "%s, %s" % (psm,ds),
    7070                             students = items,
    71                              is_manager = is_manager,
     71                             allowed = True,
    7272                             )
    7373what = ds.get('search_mode')
     
    9292                             #psm = "%s, %s" % (psm,ds),
    9393                             students = items,
    94                              is_manager = is_manager,
     94                             allowed = True,
    9595                             )
    9696items = []
     
    165165            info = context.getStudentInfo(item)
    166166            students.append(info)
    167     return context.students_co_view(rendered = rend,
     167    return context.students_manager_view(rendered = rend,
    168168                             psm = "",
    169169                             #psm = "%d,%d matching Students found QS = %s" %\
     
    171171                             #psm = "%d found QS = %s items: %s" % (len(items),query_step,items),
    172172                             students = students,
    173                              is_manager = is_manager,
     173                             allowed = True,
    174174                             )
    175 return context.students_co_view(rendered = rend,
     175return context.students_manager_view(rendered = rend,
    176176                             psm = """Step: %s found: %s Your search for "%s" in %s with state %s failed.<br\>%s""" % (query_step,len(items),st,what,state,bools),
    177177                             students = students,
    178                              is_manager = is_manager,
     178                             allowed = True,
    179179                             )
    180180
  • WAeUP_SRP/trunk/skins/waeup_student/getStudentInfo.py

    r883 r885  
    2727    if mtool.isAnonymousUser():
    2828        return None
    29     elif context.isManager() and 'students' in path_info:
     29    elif not context.isStudent() and 'students' in path_info:
    3030        student_id = path_info[path_info.index('students')+1]
    3131    else:
  • WAeUP_SRP/trunk/skins/waeup_student/searchStudents.py

    r845 r885  
    6464                             #psm = "%s, %s" % (psm,ds),
    6565                             students = items,
    66                              is_manager = is_manager,
     66                             allowed = True,
    6767                             )
    6868what = ds.get('search_mode')
     
    8787                             #psm = "%s, %s" % (psm,ds),
    8888                             students = items,
    89                              is_manager = is_manager,
     89                             allowed = True,
    9090                             )
    9191items = []
     
    162162                             #psm = "%d found QS = %s items: %s" % (len(items),query_step,items),
    163163                             students = students,
    164                              is_manager = is_manager,
     164                             allowed = True,
    165165                             )
    166166return context.students_manager_view(rendered = rend,
    167167                             psm = """Step: %s found: %s Your search for "%s" in %s with state %s failed.<br\>%s""" % (query_step,len(items),st,what,state,bools),
    168168                             students = students,
    169                              is_manager = is_manager,
     169                             allowed = True,
    170170                             )
  • WAeUP_SRP/trunk/skins/waeup_student/students_manager_view.pt

    r805 r885  
    22            portal_status_message options/psm;
    33            students options/students;
    4             is_manager options/is_manager;"
     4            allowed options/allowed|nothing"
    55            >
    66  <metal:body use-macro="here/main_template/macros/master">
     
    1313   
    1414    <metal:main fill-slot="main">
    15       <span tal:condition="not: is_manager">
     15      <span tal:condition="not: allowed">
    1616        <metal:block use-macro="here/error_not_found/macros/not_found" />
    1717      </span>
    18       <span tal:condition="is_manager"
     18      <span tal:condition="allowed"
    1919        tal:define="items students;
    2020        columns python:3;
Note: See TracChangeset for help on using the changeset viewer.