- Timestamp:
- 16 Apr 2021, 15:12:37 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py
r16459 r16465 43 43 from waeup.kofa.browser.interfaces import ICaptchaManager 44 44 from waeup.kofa.browser.layout import ( 45 KofaPage, Kofa EditFormPage, KofaAddFormPage, KofaDisplayFormPage,45 KofaPage, KofaFormPage, KofaEditFormPage, KofaAddFormPage, KofaDisplayFormPage, 46 46 NullValidator, jsaction, action, UtilityView) 47 47 from waeup.kofa.browser.pages import ( … … 56 56 from waeup.kofa.mandates.mandate import PasswordMandate, ParentsPasswordMandate 57 57 from waeup.kofa.university.interfaces import ( 58 IDepartment, ICertificate, ICourse )58 IDepartment, ICertificate, ICourse, IFlashNotice) 59 59 from waeup.kofa.university.certificate import ( 60 60 VirtualCertificateExportJobContainer) … … 3796 3796 return 3797 3797 3798 class RemoveFlashNoticeAllStudentsInDepartmentView(UtilityView, grok.View): 3799 """ Remove flash notices of all students in a department. 3798 #class RemoveFlashNoticeAllStudentsInDepartmentView(UtilityView, grok.View): 3799 # """ Remove flash notices of all students in a department. 3800 # """ 3801 # grok.context(IDepartment) 3802 # grok.name('removeflash') 3803 # grok.require('waeup.manageStudent') 3804 3805 # def update(self): 3806 # cat = queryUtility(ICatalog, name='students_catalog') 3807 # students = cat.searchResults( 3808 # depcode=(self.context.code, self.context.code), 3809 # ) 3810 # num = 0 3811 # for student in students: 3812 # student.flash_notice = u'' 3813 # num += 1 3814 # self.flash(_('%d flash notices have been removed.' % num)) 3815 # self.redirect(self.url(self.context)) 3816 # return 3817 3818 # def render(self): 3819 # return 3820 3821 class EditFlashNoticesFormPage(KofaFormPage): 3822 """Edit all flash notices of students in a department. 3800 3823 """ 3801 3824 grok.context(IDepartment) 3802 grok.name('removeflash') 3825 grok.name('edit_flash_notices') 3826 grok.template('editflashnotices') 3803 3827 grok.require('waeup.manageStudent') 3804 3805 def update(self): 3828 form_fields = grok.AutoFields(IFlashNotice) 3829 pnav = 0 3830 3831 def label(self): 3832 return _(u'Set flash notices for all students in ${a}', 3833 mapping = {'a':self.context.longtitle}) 3834 3835 @action('Save flash notices', style='primary') 3836 def save(self, *args, **data): 3806 3837 cat = queryUtility(ICatalog, name='students_catalog') 3807 3838 students = cat.searchResults( … … 3810 3841 num = 0 3811 3842 for student in students: 3812 student.flash_notice = u''3843 student.flash_notice = data['flash_notice'] 3813 3844 num += 1 3814 self.flash(_('%d flash notices have been removed.' % num)) 3845 ob_class = self.__implemented__.__name__.replace('waeup.kofa.','') 3846 grok.getSite().logger.info( 3847 '%s - %s - saved flash notice: %s' 3848 % (ob_class, self.context.__name__, data['flash_notice'])) 3849 self.flash(_('%d flash notices have been edited.' % num)) 3815 3850 self.redirect(self.url(self.context)) 3816 3851 return 3817 3852 3818 def render(self): 3819 return 3853 @action(_('Cancel'), validator=NullValidator) 3854 def cancel(self, **data): 3855 self.redirect(self.url(self.context)) 3820 3856 3821 3857 class EditScoresPage(KofaPage):
Note: See TracChangeset for help on using the changeset viewer.