Changeset 6907 for main/waeup.sirp
- Timestamp:
- 18 Oct 2011, 17:56:51 (13 years ago)
- Location:
- main/waeup.sirp/trunk/src/waeup/sirp
- Files:
-
- 1 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/app.py
r6839 r6907 14 14 from waeup.sirp.utils.logger import Logger 15 15 from waeup.sirp.utils.helpers import attrs_to_fields 16 from waeup.sirp.configuration import ConfigurationContainer 16 17 17 18 class University(grok.Application, grok.Container, Logger): … … 44 45 self['images'] = ImageStorage() 45 46 self['students'] = StudentsContainer() 47 self['configuration'] = ConfigurationContainer() 46 48 self._createPlugins() 47 49 -
main/waeup.sirp/trunk/src/waeup/sirp/app.txt
r6897 r6907 55 55 >>> from waeup.sirp.app import University 56 56 >>> myuniversity = University() 57 >>> myuniversity .name57 >>> myuniversity['configuration'].name 58 58 u'Sample University' 59 59 … … 69 69 >>> myuniversity['datacenter'] 70 70 <waeup.sirp.datacenter.DataCenter object at 0x...> 71 72 >>> myuniversity['configuration'] 73 <waeup.sirp.configuration.ConfigurationContainer object at 0x...> 71 74 72 75 We can export universities. For this we lookup an appropriate exporter -
main/waeup.sirp/trunk/src/waeup/sirp/browser/breadcrumbs.py
r6008 r6907 6 6 from zope.publisher.browser import TestRequest 7 7 8 from waeup.sirp.interfaces import IConfigurationContainer 8 9 from waeup.sirp.browser import interfaces 9 10 from waeup.sirp.browser.interfaces import (IBreadcrumb, IBreadcrumbIgnorable, … … 100 101 viewname = 'administration' 101 102 103 class ConfigurationContainerBreadcrumb(Breadcrumb): 104 """A breadcrumb for the configuration container. 105 """ 106 grok.context(IConfigurationContainer) 107 title = u'Portal Configuration' 108 parent_viewname = 'administration' 109 102 110 class UserContainerBreadcrumb(Breadcrumb): 103 111 """A breadcrumb for user containers. -
main/waeup.sirp/trunk/src/waeup/sirp/browser/browser.txt
r6734 r6907 62 62 >>> browser.handleErrors = False 63 63 64 We can then get an edit view of a university::65 66 >>> browser.open('http://localhost/myuniversity/ manage')67 >>> print browser.contents 68 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"... 69 ...<form action="http://localhost/myuniversity/ manage"64 We can then get an edit view of the configuration container:: 65 66 >>> browser.open('http://localhost/myuniversity/configuration') 67 >>> print browser.contents 68 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"... 69 ...<form action="http://localhost/myuniversity/configuration/@@index" 70 70 ... 71 71 … … 88 88 ... 89 89 90 >>> browser.getControl("Cancel").click() 91 >>> print browser.contents 92 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"... 93 ...<li class="message">Action cancelled.</li> 94 ... 95 96 >>> browser.open('http://localhost/myuniversity/manage') 97 >>> browser.getControl("Save and return").click() 98 >>> print browser.contents 99 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"... 100 ...<li class="message">Settings have been saved.</li> 101 ... 102 103 >>> browser.open('http://localhost/myuniversity/manage') 90 >>> browser.open('http://localhost/myuniversity/configuration') 104 91 >>> browser.getControl("Update plugins").click() 105 92 >>> print browser.contents -
main/waeup.sirp/trunk/src/waeup/sirp/browser/layout.py
r6818 r6907 133 133 134 134 def getAppTitle(self): 135 return getattr(grok.getSite() , 'name', u'Sample University')135 return getattr(grok.getSite()['configuration'], 'name', u'Sample University') 136 136 137 137 def isAuthenticated(self): … … 184 184 """ 185 185 mode('minified') 186 theme_name = getattr(grok.getSite() , 'skin', '')186 theme_name = getattr(grok.getSite()['configuration'], 'skin', '') 187 187 theme = queryUtility(ITheme, name=theme_name, 188 188 default=self.default_theme) -
main/waeup.sirp/trunk/src/waeup/sirp/browser/pages.py
r6853 r6907 34 34 IWAeUPObject, IUserContainer, IUserAccount, IDataCenter, 35 35 IWAeUPXMLImporter, IWAeUPXMLExporter, IBatchProcessor, 36 ILocalRolesAssignable, DuplicationError )36 ILocalRolesAssignable, DuplicationError, IConfigurationContainer) 37 37 from waeup.sirp.permissions import get_users_with_local_roles, getRoles 38 38 from waeup.sirp.university.catalog import search … … 153 153 pnav = 0 154 154 155 form_fields = grok.AutoFields(IUniversity)156 form_fields['frontpage'].custom_widget = ReSTDisplayWidget157 158 155 @property 159 156 def title(self): … … 162 159 @property 163 160 def label(self): 164 return self.context.title 165 166 class UniversityManageFormPage(WAeUPEditFormPage): 167 """Manage the basic properties of a `University` instance. 168 """ 169 form_fields = grok.AutoFields(IUniversity) 170 grok.context(IUniversity) 171 grok.require('waeup.manageUniversity') 172 title = u'Edit portal settings' 173 pnav = 0 174 grok.name('manage') 175 176 @grok.action('Save') 177 def save(self, **data): 178 self.applyData(self.context, **data) 179 self.flash('Settings have been saved.') 180 return 181 182 @grok.action('Save and return') 183 def saveAndReturn(self, **data): 184 self.applyData(self.context, **data) 185 self.redirect(self.url(self.context)) 186 self.flash('Settings have been saved.') 187 return 188 @grok.action('Cancel', validator=NullValidator) 189 def cancel(self, **data): 190 self.flash('Action cancelled.') 191 self.redirect(self.url(self.context)) 192 return 193 194 @grok.action('Update plugins', validator=NullValidator) 195 def updatePlugins(self, **data): 196 self.context.updatePlugins() 197 self.flash('Plugins were updated. See log file for details.') 198 self.redirect(self.url(self.context)) 199 return 161 return self.context['configuration'].title 162 163 @property 164 def frontpage(self): 165 view = ConfigurationContainerDisplayFormPage( 166 self.context['configuration'],self.request) 167 view.setUpWidgets() 168 return view.widgets['frontpage']() 200 169 201 170 class AdministrationPage(WAeUPPage): … … 430 399 self.flash('Your message has been sent.') 431 400 return 401 402 403 # 404 # Configuration pages... 405 # 406 407 class ConfigurationContainerDisplayFormPage(WAeUPDisplayFormPage): 408 """View page of the configuration container. 409 """ 410 grok.require('waeup.managePortalConfiguration') 411 grok.name('view') 412 grok.context(IConfigurationContainer) 413 pnav = 0 414 label = u'View portal configuration' 415 title = u'Portal Configuration' 416 form_fields = grok.AutoFields(IConfigurationContainer) 417 form_fields['frontpage'].custom_widget = ReSTDisplayWidget 418 419 #def renderFrontpage(self): 420 # self.setUpWidgets() 421 # return widgets['frontpage'] 422 423 class ConfigurationContainerManageFormPage(WAeUPEditFormPage): 424 """Manage page of the configuration container. 425 """ 426 grok.require('waeup.managePortalConfiguration') 427 grok.name('index') 428 grok.context(IConfigurationContainer) 429 pnav = 0 430 label = u'Edit portal configuration' 431 title = u'Portal Configuration' 432 433 form_fields = grok.AutoFields(IConfigurationContainer) 434 435 @grok.action('Save') 436 def save(self, **data): 437 self.applyData(self.context, **data) 438 self.flash('Settings have been saved.') 439 return 440 441 @grok.action('Update plugins', validator=NullValidator) 442 def updatePlugins(self, **data): 443 grok.getSite().updatePlugins() 444 self.flash('Plugins were updated. See log file for details.') 445 return 446 432 447 433 448 # -
main/waeup.sirp/trunk/src/waeup/sirp/browser/templates/administrationpage.pt
r5396 r6907 1 <h 3>Administration</h3>1 <h2>Administration</h2> 2 2 3 3 <p> -
main/waeup.sirp/trunk/src/waeup/sirp/browser/templates/universitypage.pt
r6065 r6907 1 1 <h2 tal:content="view/label">Title</h2> 2 2 3 <span tal:replace="structure view/ widgets/frontpage">Frontpage</span>3 <span tal:replace="structure view/frontpage">Frontpage</span> -
main/waeup.sirp/trunk/src/waeup/sirp/browser/viewlets.py
r6685 r6907 301 301 # This link is only displayed, if the user is 302 302 # allowed to use it! 303 grok.require('waeup.managePortal Settings')304 305 link = ' @@manage'306 text = u'Portal Settings'303 grok.require('waeup.managePortalConfiguration') 304 305 link = 'configuration' 306 text = u'Portal Configuration' 307 307 308 308 def render(self): … … 332 332 # Manage ("Edit settings") actions... 333 333 # 334 class ManageUniversityActionButton(ManageActionButton):335 """ 'Edit' button for University instances.336 """337 grok.context(IUniversity)338 grok.view(UniversityPage)339 text = 'Edit portal settings'334 #class ManageUniversityActionButton(ManageActionButton): 335 # """ 'Edit' button for University instances. 336 # """ 337 # grok.context(IUniversity) 338 # grok.view(UniversityPage) 339 # text = 'Edit portal settings' 340 340 341 341 #class ManageFacultiesActionButton(ManageActionButton): … … 618 618 return self.view.url(self.context[self.target_viewname]) 619 619 620 class AdminTaskPortal Settings(AdminTask):620 class AdminTaskPortalConfiguration(AdminTask): 621 621 """Entry on administration page that link to portal settings. 622 622 """ 623 623 grok.order(1) 624 grok.require('waeup.managePortal Settings')625 626 link_title = 'Portal Settings'624 grok.require('waeup.managePortalConfiguration') 625 626 link_title = 'Portal Configuration' 627 627 def link_target(self): 628 return self.view.url(self.view.context, ' @@manage')628 return self.view.url(self.view.context, 'configuration') 629 629 630 630 class AdminTaskUsers(AdminTask): -
main/waeup.sirp/trunk/src/waeup/sirp/interfaces.py
r6905 r6907 67 67 """Representation of a university. 68 68 """ 69 name = schema.TextLine(70 title = u'Name of University',71 default = u'Sample University',72 required = True,73 )74 75 title = schema.TextLine(76 title = u'Title of frontpage',77 default = u'Welcome to the Student Information and Registration ' +78 u'Portal of Sample University',79 required = False,80 )81 82 skin = schema.Choice(83 title = u'Skin',84 default = u'waeuptheme-gray1.css',85 vocabulary = 'waeup.sirp.browser.theming.ThemesVocabulary',86 required = True,87 )88 89 frontpage = schema.Text(90 title = u'Content in reST format',91 required = False,92 default = default_frontpage,93 )94 69 95 70 … … 210 185 """ 211 186 187 class IConfigurationContainer(IWAeUPObject): 188 """A container for session configuration objects. 189 """ 190 191 name = schema.TextLine( 192 title = u'Name of University', 193 default = u'Sample University', 194 required = True, 195 ) 196 197 title = schema.TextLine( 198 title = u'Title of frontpage', 199 default = u'Welcome to the Student Information and Registration ' + 200 u'Portal of Sample University', 201 required = False, 202 ) 203 204 skin = schema.Choice( 205 title = u'Skin', 206 default = u'gray waeup theme', 207 vocabulary = 'waeup.sirp.browser.theming.ThemesVocabulary', 208 required = True, 209 ) 210 211 frontpage = schema.Text( 212 title = u'Content in reST format', 213 required = False, 214 default = default_frontpage, 215 ) 216 217 class ISessionConfiguration(IWAeUPObject): 218 """A container for session configuration objects. 219 """ 220 212 221 class IDataCenter(IWAeUPObject): 213 222 """A data center. -
main/waeup.sirp/trunk/src/waeup/sirp/permissions.py
r6655 r6907 34 34 grok.name('waeup.manageDataCenter') 35 35 36 class ManagePortal Settings(grok.Permission):37 grok.name('waeup.managePortal Settings')36 class ManagePortalConfiguration(grok.Permission): 37 grok.name('waeup.managePortalConfiguration') 38 38 39 39 # Local Roles … … 67 67 'waeup.View', 'waeup.Public','waeup.manageACBatches', 68 68 'waeup.manageDataCenter','waeup.managePortalSettings', 69 'waeup.managePortalConfiguration', 69 70 'waeup.manageApplications', 'waeup.handleApplication', 70 71 'waeup.viewStudents', 'waeup.manageStudents')
Note: See TracChangeset for help on using the changeset viewer.