Changeset 3473


Ignore:
Timestamp:
29 Apr 2008, 09:24:51 (16 years ago)
Author:
joachim
Message:

remove Title from all StudentObjects?,
adjust templates to use getStudentObjectitles,
remove waeup_academics.getDocumentInfo (was duplicate),
do not use portal_catalog for listing faculties and departments.

Location:
WAeUP_SRP/base
Files:
2 added
4 deleted
14 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/base/Students.py

    r3454 r3473  
    707707    security = ClassSecurityInfo()
    708708
    709     security.declareProtected(View,"Title")
    710     def Title(self):
    711         """compose title"""
    712         content = self.getContent()
    713         session_id = content.session
    714         try:
    715             y = int(session_id[-2:])
    716         except:
    717             return "Accommodation Data for Session %s" % session_id
    718         session_str = self.portal_vocabularies.sessions.get(y)
    719         #return "Accommodation Data for %s %s" % (content.firstname,content.lastname)
    720         return "Accommodation Data for Session %s" % session_str
     709    # security.declareProtected(View,"Title")
     710    # def Title(self):
     711    #     """compose title"""
     712    #     content = self.getContent()
     713    #     session_id = content.session
     714    #     try:
     715    #         y = int(session_id[-2:])
     716    #     except:
     717    #         return "Accommodation Data for Session %s" % session_id
     718    #     session_str = self.portal_vocabularies.sessions.get(y)
     719    #     #return "Accommodation Data for %s %s" % (content.firstname,content.lastname)
     720    #     return "Accommodation Data for Session %s" % session_str
    721721
    722722
     
    738738    security = ClassSecurityInfo()
    739739
    740     security.declareProtected(View,"Title")
    741     def Title(self):
    742         """compose title"""
    743         #content = self.getContent()
    744         #return "Personal Data for %s %s" % (content.firstname,content.lastname)
    745         return "Personal Data"
     740    # security.declareProtected(View,"Title")
     741    # def Title(self):
     742    #     """compose title"""
     743    #     #content = self.getContent()
     744    #     #return "Personal Data for %s %s" % (content.firstname,content.lastname)
     745    #     return "Personal Data"
    746746
    747747
     
    763763    security = ClassSecurityInfo()
    764764
    765     security.declareProtected(View,"Title")
    766     def Title(self):
    767         """compose title"""
    768         #content = self.getContent()
    769         #return "Clearance/Eligibility Record for %s %s" % (content.firstname,content.lastname)
    770         return "Clearance/Eligibility Record"
     765    # security.declareProtected(View,"Title")
     766    # def Title(self):
     767    #     """compose title"""
     768    #     #content = self.getContent()
     769    #     #return "Clearance/Eligibility Record for %s %s" % (content.firstname,content.lastname)
     770    #     return "Clearance/Eligibility Record"
    771771
    772772
     
    788788    security = ClassSecurityInfo()
    789789
    790     security.declareProtected(View,"Title")
    791     def Title(self):
    792         """compose title"""
    793         return self.portal_vocabularies.student_levels.get(self.aq_parent.getId())
    794         #return "Level %s" % self.aq_parent.getId()
     790    # security.declareProtected(View,"Title")
     791    # def Title(self):
     792    #     """compose title"""
     793    #     return self.portal_vocabularies.student_levels.get(self.aq_parent.getId())
     794    #     #return "Level %s" % self.aq_parent.getId()
    795795
    796796    def create_course_results(self,cert_id,current_level): ###(
     
    835835    security = ClassSecurityInfo()
    836836
    837     security.declareProtected(View,"Title")
    838     def Title(self):
    839         """compose title"""
    840         #content = self.getContent()
    841         return "Study Course"
     837    # security.declareProtected(View,"Title")
     838    # def Title(self):
     839    #     """compose title"""
     840    #     #content = self.getContent()
     841    #     return "Study Course"
    842842
    843843
     
    859859    security = ClassSecurityInfo()
    860860
    861     security.declareProtected(View,"Title")
    862     def Title(self):
    863         """compose title"""
    864         return "Application Data"
     861    # security.declareProtected(View,"Title")
     862    # def Title(self):
     863    #     """compose title"""
     864    #     return "Application Data"
    865865
    866866
     
    890890            return None
    891891
    892     security.declareProtected(View,"Title")
    893     def Title(self):
    894         """compose title"""
    895         cid = self.aq_parent.getId()
    896         ce = self.getCourseEntry(cid)
    897         if ce:
    898             return "%s" % ce.Title
    899         return "No course with id %s" % cid
    900 
     892    # security.declareProtected(View,"Title")
     893    # def Title(self):
     894    #     """compose title"""
     895    #     cid = self.aq_parent.getId()
     896    #     ce = self.getCourseEntry(cid)
     897    #     if ce:
     898    #         return "%s" % ce.Title
     899    #     return "No course with id %s" % cid
     900 
    901901InitializeClass(StudentCourseResult)
    902902
     
    915915    security = ClassSecurityInfo()
    916916
    917     security.declareProtected(View,"Title")
    918     def Title(self):
    919         """compose title"""
    920         return "PUME Results"
     917    # security.declareProtected(View,"Title")
     918    # def Title(self):
     919    #     """compose title"""
     920    #     return "PUME Results"
    921921
    922922
  • WAeUP_SRP/base/WAeUPTool.py

    r3452 r3473  
    106106        time.sleep(secs)
    107107        return
    108 
    109 ###)
     108    ###)
    110109
    111110    security.declareProtected(View,'updateRoleMappingsFor') ###(
     
    189188            if not is_student and requested_id:
    190189                student_id  = requested_id
    191             elif is_anonymous or member_id != requested_id:
     190            elif not is_staff and (is_anonymous or member_id != requested_id):
    192191                logger.info('%s tried to access %s of %s' % (member_id,context.portal_type,requested_id))
    193192            else:
     
    377376        """write to the log file"""
    378377        logfile.write(s)
    379 
    380 ###)
     378    ###)
    381379
    382380    def generateStudentId(self,letter): ###(
     
    388386        sid = "%c%d" % (letter,r.randint(99999,1000000))
    389387        students = self.portal_url.getPortalObject().campus.students
    390 ##        while hasattr(students, sid):
    391 ##            sid = "%c%d" % (letter,r.randint(99999,1000000))
     388        # while hasattr(students, sid):
     389        #     sid = "%c%d" % (letter,r.randint(99999,1000000))
    392390        while self.students_catalog(id = sid):
    393391            sid = "%c%d" % (letter,r.randint(99999,1000000))
     
    570568                transaction.commit()
    571569        logger.info('finished removing %d unused docids ' % (to_delete))
    572 
    573 
    574 ###)
     570    ###)
    575571
    576572    security.declareProtected(View,'getCredential') ###(
     
    878874        # Level
    879875        #
    880 ##        l = getattr(studycourse,level,None)
    881 ##        if l is None:
    882 ##            studycourse.invokeFactory('StudentStudyLevel', level)
    883 ##            l = getattr(studycourse, level)
    884 ##            self.portal_workflow.doActionFor(l,'open',dest_container=l)
    885 ##            l.getContent().edit(mapping={'Title': "Level %s" % level})
    886 ###)
     876        # l = getattr(studycourse,level,None)
     877        # if l is None:
     878        #     studycourse.invokeFactory('StudentStudyLevel', level)
     879        #     l = getattr(studycourse, level)
     880        #     self.portal_workflow.doActionFor(l,'open',dest_container=l)
     881        #     l.getContent().edit(mapping={'Title': "Level %s" % level})
     882        ###)
    887883
    888884    def init_timing(self): ###(
     
    899895            self.i_elapse = time.time()
    900896            self.c_elapse = time.clock()
    901 
    902 ###)
     897    ###)
    903898
    904899    def do_timing(self): ###(
     
    927922            self.timer_step +=1
    928923            self.i_elapse = time.time()
    929 
    930 ###)
     924    ###)
    931925
    932926    security.declareProtected(ModifyPortalContent,'print_timing') ###( ###(
     
    949943            out.write("\r\n".join(l))
    950944            out.close()
    951 
    952 ###)
     945    ###)
    953946
    954947    security.declareProtected(ModifyPortalContent,'get_timing_data') ###( ###(
  • WAeUP_SRP/base/skins/waeup_academics/academics_view.pt

    r1783 r3473  
    1 <metal:html tal:define="info context/getFacultiesInfo;
    2             is_so context/isSectionOfficer;"
     1<metal:html tal:define="info context/getFolderObjectsInfo;
     2            is_so info/is_sectionofficer;"
    33            >
    44  <metal:body use-macro="here/main_template/macros/master">
  • WAeUP_SRP/base/skins/waeup_academics/courses_view.pt

    r1783 r3473  
    1010        Up one level
    1111      </a>
    12       <h3 tal:content="here/title_or_id">
    13         Page Title
    14       </h3>
     12      <h3 tal:content="here/aq_parent/LongTitle|here/aq_parent/title_or_id" />
     13      <h4 tal:content="here/title_or_id" />
    1514      <div tal:condition="python:0" tal:content="info/container_path"/>
    1615      <div tal:condition="python:0" tal:content="info/dep_id"/>
  • WAeUP_SRP/base/skins/waeup_academics/department_view.pt

    r1783 r3473  
    99        Up one level
    1010      </a>
    11       <h3 tal:content="here/title_or_id" />
    12       <div tal:condition="nothing" tal:content="info/container_path"/>
     11      <h3 tal:content="info/doc/LongTitle|here/title_or_id" />
    1312      <br />
    1413    </metal:block>
  • WAeUP_SRP/base/skins/waeup_academics/faculty_view.pt

    r1783 r3473  
    1 <metal:html tal:define="info context/getDepartmentsInfo;
    2             is_so context/isSectionOfficer;"
     1<metal:html tal:define="info context/getFolderObjectsInfo;
     2            is_so info/is_sectionofficer;"
    33            >
    44  <metal:body use-macro="here/main_template/macros/master">
     
    99        Up one level
    1010      </a>
    11       <h3 tal:content="here/title_or_id" />
    12       <div tal:condition="python:0" tal:content="info/container_path"/>
     11      <h3 tal:content="info/doc/LongTitle|here/title_or_id" />
    1312      <br />
    1413    </metal:block>
  • WAeUP_SRP/base/skins/waeup_academics/getCoursesCertificatesInfo.py

    r2273 r3473  
    1010# $Id$
    1111"""
    12 return Info about the Faculties
     12return Info about a Department
    1313"""
    1414request = context.REQUEST
     
    1717path_info = request.get('PATH_INFO').split('/')
    1818
    19 info = {}
     19#info = context.waeup_tool.getAccessInfo(context)
     20info = context.certificates.getFolderObjectsInfo()
    2021info['action'] = "%s/faculty_view" % context.absolute_url()
    2122info['choosen_ids'] = request.get('ids',[])
    2223info['doc'] = context.getContent()
    23 brain = context.portal_catalog(meta_type="Department", id = context.getId())[-1]
    24 cp = brain.getPath()
    25 info['container_path'] = cp
    26 #res = context.portal_catalog(container_path="%s/courses" % cp)
    27 #items = []
    28 #for r in res:
    29 #    row = {}
    30 #    ro = r.getObject()
    31 #    rd = ro.getContent()
    32 #    row['id'] = r.getId
    33 #    row['title'] = rd.Title()
    34 #    row['url'] = ro.absolute_url()
    35 #    items.append(row)
    36 #info['courses'] = items
    37 res = context.portal_catalog(container_path="%s/certificates" % cp)
    38 items = []
    39 for r in res:
    40     row = {}
    41     try:
    42         ro = r.getObject()
    43         rd = ro.getContent()
    44         row['id'] = r.getId
    45         row['title'] = rd.Title()
    46         row['url'] = ro.absolute_url()
    47         items.append(row)
    48     except AttributeError:
    49         continue
    50 info['certificates'] = items
     24info['certificates'] = info['items']
    5125return info
    5226
  • WAeUP_SRP/base/skins/waeup_academics/getLevelInfo.py

    r2614 r3473  
    1010# $Id$
    1111"""
    12 return Info about the Faculties
     12return Info about the Level
    1313"""
     14try:
     15    from Products.zdb import set_trace
     16except:
     17    def set_trace():
     18        pass
    1419request = context.REQUEST
    1520
     
    3944second = []
    4045combined = []
     46set_trace()
    4147for course_id,course in context.objectItems():
    4248    row = {}
  • WAeUP_SRP/base/skins/waeup_default/getDocumentInfo.py

    r2013 r3473  
    1010# $Id:getDocumentInfo.py 486 2006-09-06 10:09:39Z joachim $
    1111"""
    12 return Info about the Faculties
     12return Info about a document
    1313"""
     14try:
     15    from Products.zdb import set_trace
     16except:
     17    def set_trace():
     18        pass
     19
    1420request = context.REQUEST
    1521
    16 wf = context.portal_workflow
    17 path_info = request.get('PATH_INFO').split('/')
     22#wf = context.portal_workflow
     23#path_info = request.get('PATH_INFO').split('/')
    1824
    19 mtool = context.portal_membership
    20 if mtool.isAnonymousUser():
     25# mtool = context.portal_membership
     26# if mtool.isAnonymousUser():
     27#     return None
     28
     29info = context.waeup_tool.getAccessInfo(context)
     30#set_trace()
     31
     32student_id = info['student_id']
     33if not info['is_staff'] and student_id is None:
    2134    return None
    2235
    23 info = {}
     36titles = context.getStudentObjectTitles()
     37info['title'] = titles.get(context.portal_type,'') or context.title_or_id
    2438try:
    2539    info['doc'] = context.getContent()
  • WAeUP_SRP/base/skins/waeup_default/waeup_document_view.pt

    r3294 r3473  
    33                tal:define="info context/getDocumentInfo;
    44                s_name context/getStudentNameInContext;
    5                 is_so context/isSectionOfficer;">
     5                is_so info/is_sectionofficer;">
    66
    77      <span tal:condition="not: info">
     
    1010      <span tal:condition="info">
    1111   
    12       <a href="" tal:attributes="href string:${here/academicsParent}">
     12      <a href="" tal:attributes="href string:${here/aq_parent/absolute_url}">
    1313        <img tal:attributes="src string:${here/portal_url}/arrow_up.gif"/>
    1414        Up one level
    1515      </a>
    1616     
    17       <h3 tal:condition="here/title_or_id">
     17      <h3>
    1818         <span tal:condition="python:is_so and s_name">
    1919           <span tal:content="s_name" />:
    2020         </span>
    21          <span tal:content="here/title_or_id" />
     21         <span tal:content="info/title" />
    2222      </h3>
    2323     
  • WAeUP_SRP/base/skins/waeup_documents/getDocumentsInfo.py

    r2013 r3473  
    3131info['doc'] = context.getContent()
    3232
     33# items = []
     34# facs = context.portal_catalog(portal_type='WAeUPDocument')
     35# for f in facs:
     36#     row = {}
     37#     fo = f.getObject()
     38#     fd = fo.getContent()
     39#     row['id'] = fo.getId()
     40#     row['title'] = fd.Title()
     41#     row['url'] = fo.absolute_url()
     42#     row['is_editable'] = mtool.checkPermission('Modify portal content', fo)
     43#     items.append(row)
     44# items.sort(cmp_id)
    3345items = []
    34 facs = context.portal_catalog(portal_type='WAeUPDocument')
    35 for f in facs:
     46for id, doc in context.objectItems():
    3647    row = {}
    37     fo = f.getObject()
    38     fd = fo.getContent()
    39     row['id'] = fo.getId()
    40     row['title'] = fd.Title()
    41     row['url'] = fo.absolute_url()
    42     row['is_editable'] = mtool.checkPermission('Modify portal content', fo)
     48    row['id'] = id
     49    row['title'] = doc.getContent().Title()
     50    row['url'] = doc.absolute_url()
     51    row['is_editable'] = mtool.checkPermission('Modify portal content', doc)
    4352    items.append(row)
    44 items.sort(cmp_id)
     53items.sort(cmp=lambda x,y: cmp(x['id'].lower(), y['id'].lower()))
    4554info['items'] = items
    4655return info
  • WAeUP_SRP/base/skins/waeup_student/clearance_view.pt

    r3457 r3473  
    2929          My
    3030        </span>
    31         <span tal:content="context/title_or_id" />
     31        Clearance/Elegibility Record
    3232      </h3>       
    3333     
  • WAeUP_SRP/base/skins/waeup_student/getStudentFolderInfo.py

    r3235 r3473  
    9696              'PaymentsFolder': 'payments_view',
    9797              }
     98s_view_titles = context.getStudentObjectTitles()
    9899
    99100student_obj = getattr(students_folder,student_id)
     
    103104    row = {}
    104105    row['id'] = subobject.getId()
    105     row['title'] = subobject.Title()
     106    if subobject.portal_type == 'StudentAccommodation':
     107        row['title'] = s_view_titles.get(subobject.portal_type,'') %\
     108                       context.portal_vocabularies.sessions.get(subobject.getContent().session)
     109    else:
     110        row['title'] = s_view_titles.get(subobject.portal_type,'')
    106111    url = row['url'] = subobject.absolute_url()
    107112    row['type'] = subobject.portal_type
  • WAeUP_SRP/base/skins/waeup_student/study_course_view.pt

    r2989 r3473  
    1717         <span tal:content="info/student/name" />:
    1818       </span>
    19       <span tal:content="here/title_or_id" />
     19        Study Course
    2020    </h3>
    2121    <br /> 
Note: See TracChangeset for help on using the changeset viewer.