Changeset 103


Ignore:
Timestamp:
27 Oct 2005, 16:06:03 (19 years ago)
Author:
joachim
Message:

=accommodationhall

Location:
waeup_product/trunk
Files:
7 added
9 edited

Legend:

Unmodified
Added
Removed
  • waeup_product/trunk/Extensions/install.py

    r100 r103  
    7070        # Actions
    7171        ##########################################
     72        waeup_ptypes = "'University','StudentsFolder','Student','Jamb','Faculty','Department','Course'"
     73        waeup_ptypes += ",'AccoFolder','Accommodation'"
    7274        if CPSSubscriptions: ###(
     75           
    7376            ptypes = "('Portal', 'CPSMailAccess Message', 'CPSMailAccess Box', 'CPSMailAccess Folder',"\
    74                      +  "'University', 'StudentsFolder', 'Student', 'Jamb', 'Faculty', 'Department','Course')"
     77                     + waeup_ptypes + ")"
    7578            condition = "object.portal_type not in %s" % ptypes
    7679   
     
    8588            self.verifyAction('portal_subscriptions', **action)
    8689        if CPSForum:
    87             ptypes = "('University','StudentsFolder','Student', 'Jamb','Faculty', 'Department','Course')"
    88             condition = "object.portal_type not in %s" % ptypes
     90            condition = "object.portal_type not in (%s)" % waeup_ptypes
    8991   
    9092            action = {'id' : 'activate_comments',
     
    156158                        'visible'   : 1,
    157159                      },
     160                      { 'tool'      : 'portal_actions',
     161                        'id'        : 'accomodation',
     162                        'name'      : 'Accommodation',
     163                        'action'    : 'string:${portal_url}/sections/waeup/Accommodation/accommodation_index_html',
     164                        'permissions': (ModifyPortalContent,UniversityManage,StudentManage),
     165                        'category'  : 'main_tabs',
     166                        'visible'   : 1,
     167                      },
    158168##                      { 'tool'      : 'portal_actions',
    159169##                        'id'        : 'add_jamb',
     
    288298                      'Department': 'waeup_section_wf',
    289299                      'Course': 'waeup_section_wf',
     300                      'AccoFolder': 'waeup_section_wf',
     301                      'Accommodation': 'waeup_section_wf',
    290302                      }
    291303
  • waeup_product/trunk/__init__.py

    r89 r103  
    77import University
    88import Students
     9import Accommodation
    910import Faculty
    1011import Widgets
     
    1415       Students.studentpersonal_fti,
    1516       Students.jamb_fti,
     17       Accommodation.accofolder_fti,
     18       Accommodation.accommodation_fti,
    1619       Faculty.faculty_fti,
    1720       Faculty.department_fti,
     
    2427                  Students.StudentPersonal,
    2528                  Students.Jamb,
     29                  Accommodation.AccoFolder,
     30                  Accommodation.Accommodation,
    2631                  Faculty.Faculty,
    2732                  Faculty.Department,
     
    3338                       Students.addStudent,
    3439                       Students.addStudentPersonal,
     40                       Accommodation.addAccommodation,
     41                       Accommodation.addAccoFolder,
    3542                       Students.addJamb,
    3643                       Faculty.addFaculty,
  • waeup_product/trunk/skins/waeup_default/create_common.py

    r96 r103  
    3939    context.invokeFactory(type_name,oid)
    4040    object = getattr(context,oid)   
    41     okw = {'Title': ds.get('Title'),
    42            'Description': ds.get('Description')
    43            }
    4441    object.getContent().edit(mapping=ds)
     42    context.notifyCPSDocumentCreation(ob=object)
    4543    psm = 'new %s created' % oid
    4644    context_ti = context.portal_types[context.portal_type]
    4745    index = context_ti.getActionById('view','university_view')
    4846    return getattr(context,index)(psm=psm)
    49     name = ds.get('name')
    50     student = getattr(context,s_id)   
    51     student.edit(mapping=skw)
    52     context.notifyCPSDocumentCreation(ob=student)
    53     jamb_id = 'JAMB'
    54     student.invokeFactory('Jamb',jamb_id)
    55     jamb = getattr(student,jamb_id)   
    56     ds.set('title', name)
    57     jamb.edit(mapping=ds)
    58     context.notifyCPSDocumentCreation(ob=jamb)
    59     psm = 'Student created'
    60     noCPSMember = False
    61     try:
    62         pr.addMember(s_id, 'UnSeT',roles=('Member','CPSMember','Student'))
    63     except:
    64         noCPSMember = True
    65     if noCPSMember:
    66         pr.addMember(s_id, 'UnSeT',roles=('Member',))
    67 ##    groups = context.portal_directories.groups
    68 ##    gm = list(groups.getEntry('Students')['members'])
    69 ##    gm.extend((s_id,))
    70 ##    groups.editEntry({'group': 'Students',
    71 ##                      'members': gm}) 
    72 ##    return context.create_jamb_form(rendered = res,
    73 ##                                 psm = psm,
    74 ##                                 ds = ds,
    75 ##                                 )
    76    
    77 return res,psm,ds
    7847
  • waeup_product/trunk/skins/waeup_default/getWAeUPLayouts.py

    r101 r103  
    826826course = { ###(
    827827    'widgets': {
    828         'heading': Heading,
     828        'heading': {
     829         'type': 'Heading Widget',
     830         'data': {
     831                'fields': ['heading'],
     832                'level': 1,
     833                'is_i18n': 0,
     834                'is_required': 1,
     835                'label_edit': 'Title',
     836                'help': 'Course Title',
     837                'display_width': 40,
     838                'size_max': 40,
     839            },
     840        },
    829841        'text': Text,
    830842        'level': {
    831             'type': 'String Widget',
     843            'type': 'Select Widget',
    832844            'data': {
    833845                'title': '',
     
    839851                'help': '',
    840852                'is_i18n': False,
    841                 'display_width': 10,
    842                 'size_max': 0,
     853                'vocabulary': 'courselevel',
    843854            },
    844855        },
     
    925936###)
    926937
    927 accomodation = { ###(
     938accommodation = { ###(
    928939    'widgets': {
    929         'heading': Heading,
     940        'heading': {
     941         'type': 'Heading Widget',
     942         'data': {
     943                'fields': ['heading'],
     944                'level': 1,
     945                'is_i18n': 0,
     946                'is_required': 1,
     947                'label_edit': 'Hallname',
     948                'help': '',
     949                'display_width': 40,
     950                'size_max': 40,
     951            },
     952        },
    930953        'text': Text,
    931         '': {
    932             'type': 'String Widget',
    933             'data': {
    934                 'title': '',
    935                 'fields': ('level',),
    936                 'is_required': True,
    937                 'label': 'Level',
    938                 'label_edit': 'Level',
    939                 'description': '',
    940                 'help': '',
    941                 'is_i18n': False,
    942                 'display_width': 10,
    943                 'size_max': 0,
    944             },
    945         },
    946         'code': {
    947             'type': 'String Widget',
    948             'data': {
    949                 'title': 'Code',
    950                 'fields': ('code',),
    951                 'is_required': True,
    952                 'label': 'Code',
    953                 'label_edit': 'Code',
    954                 'description': '',
    955                 'help': '',
    956                 'is_i18n': False,
    957                 'display_width': 10,
    958                 'size_max': 0,
    959             },
    960         },
    961         'semester': {
     954        'which_sex': {
    962955            'type': 'Boolean Widget',
    963956            'data': {
    964957                'title': '',
    965                 'fields': ('semester',),
    966                 'is_required': True,
    967                 'label': 'Semester',
    968                 'label_edit': 'Semester',
    969                 'label_false': 'Second Semester',
    970                 'label_true': 'First Semester',
    971                 'description': '',
    972                 'help': '',
    973                 'is_i18n': False,
    974                 'display_width': 10,
    975                 'size_max': 0,
    976             },
    977         },
    978         'credit': {
    979             'type': 'Int Widget',
    980             'data': {
    981                 'title': '',
    982                 'fields': ('credit',),
    983                 'is_required': True,
    984                 'label': 'Credit',
    985                 'label_edit': 'Credit',
    986                 'description': '',
    987                 'help': '',
    988                 'is_i18n': False,
    989                 'display_width': 2,
    990                 'size_max': 0,
    991             },
    992         },
    993         'core_elective': {
    994             'type': 'Boolean Widget',
    995             'data': {
    996                 'title': '',
    997                 'fields': ('core_elective',),
    998                 'is_required': True,
    999                 'label': 'Core or elective',
    1000                 'label_edit': 'Core or elective',
    1001                 'label_true': 'Core Course',
    1002                 'label_false': 'Elective Course',
    1003                 'description': '',
    1004                 'help': '',
    1005                 'is_i18n': False,
    1006                 'display_width': 10,
    1007                 'size_max': 0,
     958                'fields': ('which_sex',),
     959                'is_required': False,
     960                'label': 'sex',
     961                'label_edit': 'sex',
     962                'label_false': 'male',
     963                'label_true': 'female',
     964                'description': '',
     965                'help': '',
     966                'is_i18n': False,
     967            },
     968        },
     969        'nr_of_blocks': {
     970            'type': 'Select Widget',
     971            'data': {
     972                'title': '',
     973                'fields': ('nr_of_blocks',),
     974                'is_required': True,
     975                'label': 'Nr of Blocks',
     976                'label_edit': 'Nr of Blocks',
     977                'description': '',
     978                'help': 'Number of Blocks this Hall has',
     979                'is_i18n': False,
     980                'vocabulary': 'range10',
     981            },
     982        },
     983        'nr_of_floors': {
     984            'type': 'Select Widget',
     985            'data': {
     986                'title': '',
     987                'fields': ('nr_of_floors',),
     988                'is_required': True,
     989                'label': 'Nr of Floors ',
     990                'label_edit': 'Nr of Floors',
     991                'description': '',
     992                'help': 'Number of Floors per Block this Hall has',
     993                'is_i18n': False,
     994                'vocabulary': 'range5',
     995            },
     996        },
     997        'rooms_per_floor': {
     998            'type': 'Select Widget',
     999            'data': {
     1000                'title': '',
     1001                'fields': ('rooms_per_floor',),
     1002                'is_required': True,
     1003                'label': 'Rooms per Floor',
     1004                'label_edit': 'Rooms per Floor',
     1005                'description': '',
     1006                'help': 'Number of Rooms per Floor this Hall has',
     1007                'is_i18n': False,
     1008                'vocabulary': 'range50',
     1009            },
     1010        },
     1011        'beds_per_room': {
     1012            'type': 'Select Widget',
     1013            'data': {
     1014                'title': '',
     1015                'fields': ('beds_per_room',),
     1016                'is_required': True,
     1017                'label': 'Beds per Room',
     1018                'label_edit': 'Beds per Room',
     1019                'description': '',
     1020                'help': 'Number of Beds per Room this Hall has',
     1021                'is_i18n': False,
     1022                'vocabulary': 'range10',
    10081023            },
    10091024        },
     
    10161031            [{'widget_id': 'heading', 'ncols': 1},],
    10171032            [{'widget_id': 'text', 'ncols': 1},],
    1018             [{'widget_id': 'level', 'ncols': 1},],
    1019             [{'widget_id': 'code', 'ncols': 1},],
    1020             [{'widget_id': 'semester', 'ncols': 1},],
    1021             [{'widget_id': 'credit', 'ncols': 1},],
    1022             [{'widget_id': 'core_elective', 'ncols': 1},],
     1033            [{'widget_id': 'which_sex', 'ncols': 1},],
     1034            [{'widget_id': 'nr_of_blocks', 'ncols': 1},],
     1035            [{'widget_id': 'nr_of_floors', 'ncols': 1},],
     1036            [{'widget_id': 'rooms_per_floor', 'ncols': 1},],
     1037            [{'widget_id': 'beds_per_room', 'ncols': 1},],
    10231038        ]
    10241039    },
     
    10311046layouts['student'] = student_layout
    10321047layouts['student_personal'] = student_personal_layout
     1048layouts['accommodation'] = accommodation
    10331049layouts['scratch_card'] = scratch_card
    10341050layouts['admission'] = admission
  • waeup_product/trunk/skins/waeup_default/getWAeUPSchemas.py

    r101 r103  
    290290}###)
    291291
    292 accomodation_schema = { ###(
     292accommodation = { ###(
    293293    'heading': {
    294294        'type': 'CPS String Field',
     
    305305        },
    306306    },
    307     '': {
    308         'type': 'CPS String Field',
    309         'data': {
    310             'default_expr': 'string:',
    311             'is_searchabletext': True,
    312         },
    313     },
    314     'code': {
    315         'type': 'CPS String Field',
    316         'data': {
    317             'default_expr': 'string:',
    318             'is_searchabletext': True,
    319         },
    320     },
    321     'semester': {
    322         'type': 'CPS Boolean Field',
    323         'data': {
    324             'default_expr': 'python:True',
    325             'is_searchabletext': False,
    326         },
    327     },
    328     'credit': {
    329         'type': 'CPS Int Field',
    330         'data': {
    331             'default_expr': 'string:',
    332             'is_searchabletext': False,
    333         },
    334     },
    335     'core_elective': {
    336         'type': 'CPS Boolean Field',
    337         'data': {
    338             'default_expr': 'python:True',
     307    'which_sex': {
     308        'type': 'CPS Boolean Field',
     309        'data': {
     310            'default_expr': 'string:',
     311            'is_searchabletext': True,
     312        },
     313    },
     314    'nr_of_blocks': {
     315        'type': 'CPS Int Field',
     316        'data': {
     317            'default_expr': 'string:',
     318            'is_searchabletext': False,
     319        },
     320    },
     321    'nr_of_floors': {
     322        'type': 'CPS Int Field',
     323        'data': {
     324            'default_expr': 'string:',
     325            'is_searchabletext': False,
     326        },
     327    },
     328    'rooms_per_floor': {
     329        'type': 'CPS Int Field',
     330        'data': {
     331            'default_expr': 'string:',
     332            'is_searchabletext': False,
     333        },
     334    },
     335    'beds_per_room': {
     336        'type': 'CPS Int Field',
     337        'data': {
     338            'default_expr': 'string:',
    339339            'is_searchabletext': False,
    340340        },
     
    394394schemas['student'] = student_schema
    395395schemas['student_personal'] = student_personal_schema
     396schemas['accommodation'] = accommodation
    396397schemas['jamb'] = jamb_schema
    397398#schemas['scratch_card'] = scratch_card
  • waeup_product/trunk/skins/waeup_default/getWAeUPTypes.py

    r102 r103  
    2020    'global_allow': 1,
    2121    'filter_content_types': 1,
    22     'allowed_content_types': ('StudentsFolder','Faculty'),
     22    'allowed_content_types': ('StudentsFolder','Faculty','AccoFolder'),
    2323    'allow_discussion': 0,
    2424    'cps_is_searchable': 1,
     
    3737                 'name': 'Add a Faculty',
    3838                 'action'    : 'string:${object/absolute_url}/create_common?type_name=Faculty',
     39                 #'action': 'folder_factories',
     40                 'permissions': (ModifyPortalContent,UniversityManage,)},
     41                {'id': 'add_accommodation',
     42                 'name': 'Add an Accomodation Hall',
     43                 'action'    : 'string:${object/absolute_url}/add_accommodation',
    3944                 #'action': 'folder_factories',
    4045                 'permissions': (ModifyPortalContent,UniversityManage,)},
     
    5459                 'condition': "python:member and 'Manager' in member.getRoles()",
    5560                 'permissions': (ModifyPortalContent,)},
    56                 {'id': 'localroles',
    57                  'name': 'action_local_roles',
    58                  'action': 'folder_localrole_form',
    59                  'condition': 'python:0',
    60                  'permissions': (ModifyPortalContent,)},
     61          {'id': 'localroles',
     62          'name': 'delegate',
     63          'action': 'folder_localrole_form',
     64          'permissions': (UniversityManage,)
     65          },
    6166                 )
    6267        }
     
    99104                'action'    : 'string:${object/absolute_url}/create_jamb',
    100105                'permissions': (UniversityManage,StudentManage)},
     106          {'id': 'localroles',
     107          'name': 'delegate',
     108          'action': 'folder_localrole_form',
     109          'permissions': (UniversityManage,)
     110          },
    101111##                {'id': 'contents',
    102112##                 'name': 'action_folder_contents',
     
    154164          'condition': "python:member and 'Manager' in member.getRoles()",
    155165          'permissions': (UniversityManage,)},
     166          {'id': 'localroles',
     167          'name': 'delegate',
     168          'action': 'folder_localrole_form',
     169          'permissions': (UniversityManage,)
     170          },
    156171          )
    157172}
     
    247262          'permission': (ModifyPortalContent,StudentManage),
    248263          },
     264          {'id': 'localroles',
     265          'name': 'delegate',
     266          'action': 'folder_localrole_form',
     267          'permissions': (UniversityManage,)
     268          },
    249269          {
    250270          'id'        : 'add_content',
     
    364384          'permissions': (ModifyPortalContent,)},
    365385          {'id': 'localroles',
    366           'name': 'action_local_roles',
    367           'action': 'folder_localrole_form',
    368           'condition': 'python:0',
    369           'permissions': (ModifyPortalContent,)},
     386          'name': 'delegate',
     387          'action': 'folder_localrole_form',
     388          'permissions': (UniversityManage,)
     389          },
    370390          )
    371391}
     
    426446          'permissions': (ModifyPortalContent,)},
    427447          {'id': 'localroles',
    428           'name': 'action_local_roles',
    429           'action': 'folder_localrole_form',
    430           'condition': 'python:0',
    431           'permissions': (ModifyPortalContent,)},
     448          'name': 'delegate',
     449          'action': 'folder_localrole_form',
     450          'permissions': (UniversityManage,)
     451          },
    432452          )
    433453}
     
    452472    'layouts': ['course',],
    453473    'flexible_layouts': (),
    454     'layout_clusters': ['metadata:metadata','coursetotal:metadata,course'],
     474    'layout_clusters': ['metadata:metadata',],
    455475    'cps_section_wf': 'waeup_section_wf',
    456476    'use_content_status_history': 0,
     
    486506          'permissions': (ModifyPortalContent,)},
    487507          {'id': 'localroles',
    488           'name': 'action_local_roles',
    489           'action': 'folder_localrole_form',
    490           'condition': 'python:0',
     508          'name': 'delegate',
     509          'action': 'folder_localrole_form',
     510          'permissions': (UniversityManage,)
     511          },
     512          )
     513    }
     514###)
     515
     516acco_folder = { ###(
     517    'title': 'WAeUP Accommodation Folder',
     518    'description': '',
     519    'content_icon': '',
     520    'content_meta_type': 'AccoFolder',
     521    'product': 'WAeUP',
     522    'factory': 'addAccoFolder',
     523    'immediate_view': 'folder_view',
     524    'global_allow': True,
     525    'filter_content_types': True,
     526    'allowed_content_types': ('Accommodation',),
     527    'allow_discussion': False,
     528    'cps_is_searchable': True,
     529    'cps_proxy_type': 'cpsdocument',
     530    'cps_display_as_document_in_listing': True,
     531    'schemas': ['metadata','common',],
     532    'layouts': ['waeup_common',],
     533    'flexible_layouts': (),
     534    'layout_clusters': ['metadata:metadata'],
     535    'cps_section_wf': 'waeup_section_wf',
     536    'use_content_status_history': 0,
     537    'actions': (
     538         {'id': 'view',
     539          'name': 'action_view',
     540          'action': 'string:${portal_url}/sections/waeup/Accomodation/accommodation_index_html',
     541          'condition': '',
     542          'permission': (View,),
     543          'category': 'object',
     544          'visible': True,},
     545         {'id': 'metadata',
     546          'name': 'action_metadata',
     547          'action': 'cpsdocument_metadata',
     548          'condition': "python:member and 'Manager' in member.getRoles()",
     549          'permissions': (UniversityManage,)},
     550          {'id': 'localroles',
     551          'name': 'delegate',
     552          'action': 'folder_localrole_form',
     553          'permissions': (UniversityManage,),
     554          'visible': 0,
     555          },
     556          )
     557}
     558###)
     559
     560accommodation = { ###( 
     561    'title': 'WAeUP Accommodation',
     562    'description': '',
     563    'content_icon': 'student.gif',
     564    'content_meta_type': 'Accommodation',
     565    'product': 'WAeUP',
     566    'factory': 'addAccommodation',
     567    'immediate_view': 'cpsdocument_view',
     568    'global_allow': True,
     569    'filter_content_types': True,
     570    'allowed_content_types': (),
     571    'allow_discussion': False,
     572    'cps_is_searchable': True,
     573    'cps_proxy_type': 'document',
     574    'cps_display_as_document_in_listing': True,
     575    'schemas': ['metadata','common','accommodation'],
     576    'layouts': ['accommodation',],
     577    'flexible_layouts': (),
     578    'layout_clusters': ['metadata:metadata',],
     579    'cps_section_wf': 'waeup_section_wf',
     580    'use_content_status_history': 0,
     581    'actions': (
     582         {'id': 'view',
     583          'name': 'action_view',
     584          'action': 'string:${object_url}/accommodation_index_html',
     585          'condition': '',
     586          'permission': ('View',),
     587          'category': 'object',
     588          'visible': True,},
     589         {'id': 'edit',
     590          'name': 'edit',
     591          'action': 'string:${object_url}/waeup_edit_form',
     592          'permission': (UniversityManage,StudentManage),
     593          'category': 'object',
     594          'visible': True,},
     595          {'id': 'metadata',
     596          'name': 'action_metadata',
     597          'action': 'cpsdocument_metadata',
     598          'condition': "python:member and 'Manager' in member.getRoles()",
    491599          'permissions': (ModifyPortalContent,)},
     600          {'id': 'localroles',
     601          'name': 'delegate',
     602          'action': 'folder_localrole_form',
     603          'permissions': (UniversityManage,),
     604          'visible' : 0,
     605          },
    492606          )
    493607}
     
    499613types['Student'] = student_type
    500614types['StudentPersonal'] = student_personal_type
     615types['AccoFolder'] = acco_folder
     616types['Accommodation'] = accommodation
    501617types['ScratchCard'] = scratch_card
    502618types['Jamb'] = jamb_type
  • waeup_product/trunk/skins/waeup_default/getWAeUPVocabularies.py

    r57 r103  
    7272            )},
    7373        }
     74vocabularies['faculties'] = faculties_voc
     75level_voc = {
     76        'type': 'CPS Vocabulary',
     77        'data': {'tuples': (
     78            ('100', "Year 1 (100 Level)", ''),
     79            ('200', "Year 2 (200 Level)", ''),
     80            ('300', "Year 3 (300 Level)", ''),
     81            ('400', "Year 4 (100 Level)", ''),
     82            )},
     83        }
     84vocabularies['courselevel'] = level_voc
    7485
    75 vocabularies['faculties'] = faculties_voc
     86vocabularies['range5'] = {'type': 'CPS Vocabulary',
     87                               'data': {'tuples': ([('%d' % i,i,'') for i in range(1,6)])},
     88                          }
     89vocabularies['range10'] = {'type': 'CPS Vocabulary',
     90                               'data': {'tuples': ([('%d' % i,i,'') for i in range(1,11)])},
     91                          }
     92vocabularies['range20'] = {'type': 'CPS Vocabulary',
     93                               'data': {'tuples': ([('%d' % i,i,'') for i in range(1,21)])},
     94                          }
     95vocabularies['range50'] = {'type': 'CPS Vocabulary',
     96                               'data': {'tuples': ([('%d' % i,i,'') for i in range(1,51)])},
     97                          }
     98##'xxx_voc': {
     99##        'type': 'CPS Vocabulary',
     100##        'data': {'tuples': (
     101##            ('', "", ''),
     102##            )},
     103##        },
     104
    76105
    77106return vocabularies
  • waeup_product/trunk/skins/waeup_faculty/create_course.py

    r96 r103  
    4141    context.invokeFactory(type_name,oid)
    4242    object = getattr(context,oid)   
    43 ##    okw = {'Title': ds.get('Title'),
    44 ##           'Description': ds.get('Description')
    45 ##           }
    4643    object.getContent().edit(mapping=ds,proxy=object)
     44    context.notifyCPSDocumentCreation(ob=object)
    4745    psm = 'new %s created' % oid
    4846    context_ti = context.portal_types[context.portal_type]
    4947    index = context_ti.getActionById('view','university_view')
    5048    return getattr(context,index)(psm=psm)
    51 ##    ret = getattr(context,index)
    52 ##    return REQUEST.RESPONSE.redirect(ret.absolute_url())
    5349
  • waeup_product/trunk/skins/waeup_student/create_jamb.py

    r96 r103  
    2424                      layout_mode='create',
    2525                      )
    26 if psm == 'invalid' or psm == '':
     26if psm == 'invalid':
    2727    return context.create_jamb_form(rendered = res,
    2828                                 psm = 'Please correct your errors',
Note: See TracChangeset for help on using the changeset viewer.