Changeset 6000 for main/waeup.sirp/trunk/src/waeup
- Timestamp:
- 1 May 2011, 04:05:43 (14 years ago)
- Location:
- main/waeup.sirp/trunk/src/waeup/sirp/browser
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/browser/pages.py
r5999 r6000 155 155 return 156 156 157 class RemoveFormPage(WAeUPPage):158 grok.require('waeup.manageUniversity')159 grok.name('remove')160 grok.template('removesubobjectspage')161 pnav = 1162 163 def update(self):164 warning.need()165 form = self.request.form166 if 'CANCEL' in form.keys():167 self.redirect(self.url(self.context))168 if not 'REMOVE' in form.keys():169 return170 child_id = form['val_id']171 if not isinstance(child_id, list):172 child_id = [child_id]173 deleted = []174 for id in child_id:175 try:176 del self.context[id]177 deleted.append(id)178 except:179 self.flash('Could not delete %s: %s: %s' % (180 id, sys.exc_info()[0], sys.exc_info()[1]))181 if len(deleted):182 self.flash('Successfully removed: %s' % ', '.join(deleted))183 # We have to redirect to let flash messages appear immediately...184 self.redirect(self.url())185 return157 #class RemoveFormPage(WAeUPPage): 158 # grok.require('waeup.manageUniversity') 159 # grok.name('remove') 160 # grok.template('removesubobjectspage') 161 # pnav = 1 162 # 163 # def update(self): 164 # warning.need() 165 # form = self.request.form 166 # if 'CANCEL' in form.keys(): 167 # self.redirect(self.url(self.context)) 168 # if not 'REMOVE' in form.keys(): 169 # return 170 # child_id = form['val_id'] 171 # if not isinstance(child_id, list): 172 # child_id = [child_id] 173 # deleted = [] 174 # for id in child_id: 175 # try: 176 # del self.context[id] 177 # deleted.append(id) 178 # except: 179 # self.flash('Could not delete %s: %s: %s' % ( 180 # id, sys.exc_info()[0], sys.exc_info()[1])) 181 # if len(deleted): 182 # self.flash('Successfully removed: %s' % ', '.join(deleted)) 183 # # We have to redirect to let flash messages appear immediately... 184 # self.redirect(self.url()) 185 # return 186 186 187 187 class AdministrationPage(WAeUPPage): … … 846 846 grok.name('index') 847 847 title = 'Academics' 848 label = ' Faculties'848 label = 'Academic Section' 849 849 pnav = 1 850 850 grok.template('facultypage') … … 884 884 'in the database') 885 885 return 886 self.redirect(self.url(self.context ))886 self.redirect(self.url(self.context, u'@@manage')+'#tab-1') 887 887 888 888 @grok.action('Cancel') … … 890 890 self.redirect(self.url(self.context)) 891 891 892 class RemoveFacultyFormPage(RemoveFormPage):893 894 """895 grok.context(IFacultyContainer)896 title = "Remove faculty"897 pnav = 1892 #class RemoveFacultyFormPage(RemoveFormPage): 893 # """ Remove Faculty Page 894 # """ 895 # grok.context(IFacultyContainer) 896 # title = "Remove faculty" 897 # pnav = 1 898 898 899 899 # … … 953 953 'in the database') 954 954 return 955 self.redirect(self.url(self.context, u'@@manage') )955 self.redirect(self.url(self.context, u'@@manage')+'#tab-2') 956 956 957 957 @grok.action('Cancel') … … 969 969 taboneactions = ['Save','Save and return','Cancel'] 970 970 tabtwoactions = ['Add department', 'Remove selected','Cancel'] 971 subunits = 'Departments' 971 972 972 973 form_fields = grok.AutoFields(IFaculty) … … 1007 1008 if len(deleted): 1008 1009 self.flash('Successfully removed: %s' % ', '.join(deleted)) 1010 self.redirect(self.url(self.context, u'@@manage')+'#tab-2') 1009 1011 return 1010 1012 1011 1013 @grok.action('Add department', validator=NullValidator) 1012 1014 def addDepartment(self, **data): 1015 self.redirect(self.url(self.context, '@@add')) 1016 return 1017 1018 @grok.action('Cancel', validator=NullValidator) 1019 def cancel(self, **data): 1020 self.redirect(self.url(self.context)) 1021 return 1022 1023 class ManageFacultyContainerFormPage(WAeUPEditFormPage): 1024 """Manage the basic properties of a `Faculty` instance. 1025 """ 1026 grok.context(IFacultyContainer) 1027 grok.name('manage') 1028 grok.require('waeup.manageUniversity') 1029 grok.template('facultycontainermanagepage') 1030 pnav = 1 1031 taboneactions = ['Add faculty', 'Remove selected','Cancel'] 1032 subunits = 'Faculties' 1033 title = 'Academics' 1034 1035 @property 1036 def label(self): 1037 return 'Manage academic section' 1038 1039 def update(self): 1040 tabs.need() 1041 #warning.need() 1042 return super(ManageFacultyContainerFormPage, self).update() 1043 1044 # ToDo: Show warning message before deletion 1045 @grok.action('Remove selected') 1046 def delFaculties(self, **data): 1047 form = self.request.form 1048 child_id = form['val_id'] 1049 if not isinstance(child_id, list): 1050 child_id = [child_id] 1051 deleted = [] 1052 for id in child_id: 1053 try: 1054 del self.context[id] 1055 deleted.append(id) 1056 except: 1057 self.flash('Could not delete %s: %s: %s' % ( 1058 id, sys.exc_info()[0], sys.exc_info()[1])) 1059 if len(deleted): 1060 self.flash('Successfully removed: %s' % ', '.join(deleted)) 1061 self.redirect(self.url(self.context, '@@manage')+'#tab-1') 1062 return 1063 1064 @grok.action('Add faculty', validator=NullValidator) 1065 def addFaculty(self, **data): 1013 1066 self.redirect(self.url(self.context, '@@add')) 1014 1067 return -
main/waeup.sirp/trunk/src/waeup/sirp/browser/templates/facultymanagepage.pt
r5999 r6000 25 25 <ul> 26 26 <li><a href="#tab-1"><span>Settings</span></a></li> 27 <li><a href="#tab-2"><span >Contents</span></a></li>27 <li><a href="#tab-2"><span tal:content="view/subunits">Contents</span></a></li> 28 28 </ul> 29 29 … … 73 73 74 74 <div id="tab-2"> 75 <h3 >Departments</h3>75 <h3 tal:content="view/subunits">Departments</h3> 76 76 <table class="zebra"> 77 77 <thead> -
main/waeup.sirp/trunk/src/waeup/sirp/browser/viewlets.py
r5999 r6000 310 310 grok.view(DatacenterPage) 311 311 text = 'Edit settings' 312 313 class ManageFacultyContainerActionButton(ManageActionButton): 314 """ 'Manage settings' button for faculties. 315 """ 316 grok.context(IFacultyContainer) 317 grok.view(FacultyContainerPage) 318 text = 'Manage academic section' 312 319 313 320 class ManageFacultyActionButton(ManageActionButton): 314 """ ' Editsettings' button for faculties.321 """ 'Manage settings' button for faculties. 315 322 """ 316 323 grok.context(IFaculty) … … 356 363 text = 'Add user' 357 364 358 class AddFacultyActionButton(AddActionButton):359 grok.context(IFacultyContainer)360 grok.view(FacultyContainerPage)361 text = 'Add faculty'365 #class AddFacultyActionButton(AddActionButton): 366 # grok.context(IFacultyContainer) 367 # grok.view(FacultyContainerPage) 368 # text = 'Add faculty' 362 369 363 370 #class AddDepartmentActionButton(AddActionButton): … … 392 399 393 400 394 class RemoveFacultyActionButton(RemoveActionButton):395 grok.context(IFacultyContainer)396 grok.view(FacultyContainerPage)397 text = 'Remove faculty'401 #class RemoveFacultyActionButton(RemoveActionButton): 402 # grok.context(IFacultyContainer) 403 # grok.view(FacultyContainerPage) 404 # text = 'Remove faculty' 398 405 399 406 #class RemoveDepartmentActionButton(RemoveActionButton):
Note: See TracChangeset for help on using the changeset viewer.