Changeset 12186 for main/waeup.ikoba/trunk/src/waeup/ikoba/browser/pages.py
- Timestamp:
- 9 Dec 2014, 16:45:52 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.ikoba/trunk/src/waeup/ikoba/browser/pages.py
r11979 r12186 53 53 IIkobaXMLImporter, IIkobaXMLExporter, IBatchProcessor, 54 54 ILocalRolesAssignable, DuplicationError, IConfigurationContainer, 55 ISessionConfiguration, ISessionConfigurationAdd, IJobManager, 56 IPasswordValidator, IContactForm, IIkobaUtils, ICSVExporter, 57 application_sessions_vocab) 55 IJobManager, 56 IPasswordValidator, IContactForm, IIkobaUtils, ICSVExporter) 58 57 from waeup.ikoba.permissions import ( 59 58 get_users_with_local_roles, get_all_roles, get_all_users, … … 743 742 grok.name('index') 744 743 grok.context(IConfigurationContainer) 745 grok.template('configurationmanagepage')746 744 pnav = 0 747 745 label = _(u'Edit portal configuration') 748 taboneactions = [_('Save'), _('Update plugins')]749 tabtwoactions = [750 _('Add session configuration'),751 _('Remove selected')]752 746 form_fields = grok.AutoFields(IConfigurationContainer).omit( 753 747 'frontpage_dict') … … 763 757 msave(self, **data) 764 758 self.context.frontpage_dict = self._frontpage() 765 return766 767 @action(_('Add session configuration'), validator=NullValidator,768 style='primary')769 def addSubunit(self, **data):770 self.redirect(self.url(self.context, '@@add'))771 return772 773 def getSessionConfigurations(self):774 """Get a list of all stored session configuration objects.775 """776 for key, val in self.context.items():777 url = self.url(val)778 session_string = val.getSessionString()779 title = _('Session ${a} Configuration',780 mapping = {'a':session_string})781 yield(dict(url=url, name=key, title=title))782 783 @jsaction(_('Remove selected'))784 def delSessonConfigurations(self, **data):785 delSubobjects(self, redirect='@@index', tab='2')786 759 return 787 760 … … 794 767 grok.getSite().updatePlugins() 795 768 self.flash(_('Plugins were updated. See log file for details.')) 796 return797 798 class SessionConfigurationAddFormPage(IkobaAddFormPage):799 """Add a session configuration object to configuration container.800 """801 grok.context(IConfigurationContainer)802 grok.name('add')803 grok.require('waeup.managePortalConfiguration')804 label = _('Add session configuration')805 form_fields = grok.AutoFields(ISessionConfigurationAdd)806 pnav = 0807 808 @action(_('Add Session Configuration'), style='primary')809 def addSessionConfiguration(self, **data):810 sessionconfiguration = createObject(u'waeup.SessionConfiguration')811 self.applyData(sessionconfiguration, **data)812 try:813 self.context.addSessionConfiguration(sessionconfiguration)814 ob_class = self.__implemented__.__name__.replace('waeup.ikoba.','')815 self.context.__parent__.logger.info(816 '%s - added: %s' % (817 ob_class, sessionconfiguration.application_session))818 except KeyError:819 self.flash(_('The session chosen already exists.'), type='danger')820 return821 self.redirect(self.url(self.context, '@@index')+'#tab2')822 return823 824 @action(_('Cancel'), validator=NullValidator)825 def cancel(self):826 self.redirect(self.url(self.context, '@@index')+'#tab2')827 return828 829 class SessionConfigurationManageFormPage(IkobaEditFormPage):830 """Manage session configuration object.831 """832 grok.context(ISessionConfiguration)833 grok.name('index')834 grok.require('waeup.managePortalConfiguration')835 form_fields = grok.AutoFields(ISessionConfiguration)836 pnav = 0837 838 @property839 def label(self):840 session_string = self.context.getSessionString()841 return _('Edit academic session ${a} configuration',842 mapping = {'a':session_string})843 844 @action(_('Save'), style='primary')845 def save(self, **data):846 msave(self, **data)847 self.redirect(self.url(self.context.__parent__, '@@index')+'#tab2')848 return849 850 @action(_('Cancel'), validator=NullValidator)851 def cancel(self):852 self.redirect(self.url(self.context.__parent__, '@@index')+'#tab2')853 769 return 854 770
Note: See TracChangeset for help on using the changeset viewer.