- Timestamp:
- 13 Nov 2014, 16:03:08 (10 years ago)
- Location:
- main/waeup.kofa/branches/henrik-regista/src/waeup/ikoba/browser
- Files:
-
- 16 edited
- 3 moved
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/branches/henrik-regista/src/waeup/ikoba/browser/batchprocessing.txt
r11949 r11952 21 21 Create a site: 22 22 23 >>> from waeup.ikoba.app import University24 >>> getRootFolder()['app'] = University()23 >>> from waeup.ikoba.app import Institution 24 >>> getRootFolder()['app'] = Institution() 25 25 >>> from zope.component.hooks import setSite 26 26 >>> setSite(getRootFolder()['app']) -
main/waeup.kofa/branches/henrik-regista/src/waeup/ikoba/browser/breadcrumbs.py
r11949 r11952 28 28 from waeup.ikoba.browser.interfaces import ( 29 29 IBreadcrumb, IBreadcrumbIgnorable, IBreadcrumbContainer, IIkobaObject, 30 I University, IUsersContainer, IDataCenter,30 IInstitution, IUsersContainer, IDataCenter, 31 31 ) 32 32 from waeup.ikoba.reports import IReportsContainer … … 86 86 return self.viewname 87 87 88 class UniversityBreadcrumb(Breadcrumb):89 """A breadcrumb for universityindex pages.90 """ 91 grok.context(I University)88 class InstitutionBreadcrumb(Breadcrumb): 89 """A breadcrumb for institution index pages. 90 """ 91 grok.context(IInstitution) 92 92 title = _(u'Home') 93 93 parent = None … … 97 97 98 98 Here we need a special `parent()` implementation, because the 99 parent object is not a real parent (the Universityobject has no99 parent object is not a real parent (the Institution object has no 100 100 valid parent in terms of breadcrumbs). Instead it is the 101 101 ``administration`` view of the same context the ``manage`` page 102 102 itself is bound to. 103 103 """ 104 grok.context(I University)104 grok.context(IInstitution) 105 105 grok.name('manage') 106 106 title = _(u'Portal Settings') … … 113 113 114 114 class AdministrationBreadcrumb(Breadcrumb): 115 """A breadcrumb for administration areas of Universityinstances.116 """ 117 grok.context(I University)115 """A breadcrumb for administration areas of Institution instances. 116 """ 117 grok.context(IInstitution) 118 118 grok.name('administration') 119 119 title = _(u'Administration') … … 158 158 title = _(u'Reports') 159 159 parent_viewname = 'administration' 160 target = None161 162 class ExportsBreadcrumb(Breadcrumb):163 """A breadcrumb for exports.164 """165 grok.context(IExportJobContainer)166 title = _(u'Student Data Exports')167 160 target = None 168 161 -
main/waeup.kofa/branches/henrik-regista/src/waeup/ikoba/browser/breadcrumbs.txt
r11949 r11952 9 9 =============================== 10 10 11 We create a universityto check the breadcrumb functionality.12 13 >>> from waeup.ikoba.app import University11 We create a institution to check the breadcrumb functionality. 12 13 >>> from waeup.ikoba.app import Institution 14 14 >>> root = getRootFolder() 15 >>> root['app'] = University()15 >>> root['app'] = Institution() 16 16 >>> app = root['app'] 17 17 … … 25 25 >>> blist1 = getBreadcrumbList(app, 'index') 26 26 >>> blist1 27 [<waeup.ikoba.browser.breadcrumbs. UniversityBreadcrumb object at 0x...>]27 [<waeup.ikoba.browser.breadcrumbs.InstitutionBreadcrumb object at 0x...>] 28 28 29 29 A slightly more extensive list for the datacenter: … … 32 32 >>> from pprint import pprint 33 33 >>> pprint(blist2) 34 [<waeup.ikoba.browser.breadcrumbs. UniversityBreadcrumb object at 0x...>,34 [<waeup.ikoba.browser.breadcrumbs.InstitutionBreadcrumb object at 0x...>, 35 35 <waeup.ikoba.browser.breadcrumbs.AdministrationBreadcrumb object at 0x...>, 36 36 <waeup.ikoba.browser.breadcrumbs.DataCenterBreadcrumb object at 0x...>] 37 37 38 We get a breadcrumb for university, administration area and data38 We get a breadcrumb for institution, administration area and data 39 39 center in that order. 40 40 … … 47 47 48 48 >>> pprint([(x.context, x.viewname) for x in blist2]) 49 [(<waeup.ikoba.app. Universityobject at 0x...>, 'index'),50 (<waeup.ikoba.app. Universityobject at 0x...>, 'administration'),49 [(<waeup.ikoba.app.Institution object at 0x...>, 'index'), 50 (<waeup.ikoba.app.Institution object at 0x...>, 'administration'), 51 51 (<waeup.ikoba.datacenter.DataCenter object at 0x...>, 'index')] 52 52 53 53 The administration area breadcrumb might be a surprise, as there is no 54 54 equivalent object in the ZODB. In fact the administration area is only 55 a certain view (the 'administration' view) on the universityobject.55 a certain view (the 'administration' view) on the institution object. 56 56 57 57 We will show below, how you can define breadcrumbs this way. … … 62 62 63 63 This way we can make sure, that there are different breadcrumb lists 64 generated for instance for the administration view of University64 generated for instance for the administration view of Institution 65 65 instances and the index view. While the first should look something 66 66 like:: … … 118 118 119 119 >>> pprint(mybccontainer.getList()) 120 [<...breadcrumbs. UniversityBreadcrumb object at 0x...>,120 [<...breadcrumbs.InstitutionBreadcrumb object at 0x...>, 121 121 <...breadcrumbs.AdministrationBreadcrumb object at 0x...>, 122 122 <...breadcrumbs.UsersContainerBreadcrumb object at 0x...>] … … 128 128 129 129 Now we can get breadcrumbs for contexts and view names. For example a 130 breadcrumb for the 'index' view of our Universityobject:130 breadcrumb for the 'index' view of our Institution object: 131 131 132 132 >>> from zope.component import getAdapter … … 134 134 >>> b1 = getAdapter(app, IBreadcrumb, 'index') 135 135 >>> b1 136 <waeup.ikoba.browser.breadcrumbs. UniversityBreadcrumb object at 0x...>136 <waeup.ikoba.browser.breadcrumbs.InstitutionBreadcrumb object at 0x...> 137 137 138 138 Breadcrumb objects provide a title: … … 168 168 169 169 >>> b2.parent 170 (<waeup.ikoba.app. Universityobject at 0x...>, 'administration')171 172 This result denotes a new context object (the Universityinstance we170 (<waeup.ikoba.app.Institution object at 0x...>, 'administration') 171 172 This result denotes a new context object (the Institution instance we 173 173 created above) and a view name ('administration'). 174 174 … … 188 188 As you can see, we get an AdministrationBreadcrumb, although the 189 189 context object, for which the breadcrumb was created is also the 190 Universityinstance as above:190 Institution instance as above: 191 191 192 192 >>> b3.context is b1.context … … 197 197 >>> context, viewname = b3.parent 198 198 >>> context, viewname 199 (<waeup.ikoba.app. Universityobject at 0x...>, 'index')199 (<waeup.ikoba.app.Institution object at 0x...>, 'index') 200 200 201 201 We create last breadcrumb: -
main/waeup.kofa/branches/henrik-regista/src/waeup/ikoba/browser/browser.txt
r11949 r11952 4 4 Here we visit all parts of a Ikoba portal using a browser. 5 5 6 University 6 Institution 7 7 ========== 8 8 9 9 We can watch universities in the browser. 10 10 11 We create an universityobject and put into the ZODB root::11 We create an institution object and put into the ZODB root:: 12 12 13 13 >>> root = getRootFolder() … … 15 15 [] 16 16 17 >>> from waeup.ikoba.app import University18 >>> u = University()19 >>> root['my university'] = u17 >>> from waeup.ikoba.app import Institution 18 >>> u = Institution() 19 >>> root['myinstitution'] = u 20 20 >>> list(root) 21 [u'my university']21 [u'myinstitution'] 22 22 23 23 >>> from zope.component.hooks import setSite 24 >>> setSite(root['my university'])24 >>> setSite(root['myinstitution']) 25 25 26 26 To make sure, we can 'watch' pages, we first have to initialize out … … 30 30 >>> browser = Browser() 31 31 32 Let's get the default view of a university::33 34 >>> browser.open('http://localhost/my university')32 Let's get the default view of a institution:: 33 34 >>> browser.open('http://localhost/myinstitution') 35 35 >>> print browser.contents 36 36 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"... … … 55 55 The contact form for anonymous users is called 'Enquiries':: 56 56 57 >>> browser.open('http://localhost/my university')57 >>> browser.open('http://localhost/myinstitution') 58 58 >>> browser.getLink('Enquiries').click() 59 59 >>> browser.getControl('Send').click() … … 74 74 Registered users with an email address can request a password change: 75 75 76 >>> root['my university']['users'].addUser('forgetful', 'secret',title='Bob Forgetful',76 >>> root['myinstitution']['users'].addUser('forgetful', 'secret',title='Bob Forgetful', 77 77 ... description='A forgetful user', email='aa@aa.ng') 78 >>> browser.open('http://localhost/my university/changepw')78 >>> browser.open('http://localhost/myinstitution/changepw') 79 79 >>> browser.getControl(name="form.identifier").value = 'forgetful' 80 80 >>> browser.getControl(name="form.email").value = 'aa@aa.ng' … … 91 91 We can then get an edit view of the configuration container:: 92 92 93 >>> browser.open('http://localhost/my university/configuration')94 >>> print browser.contents 95 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"... 96 ...<form action="http://localhost/my university/configuration/@@index"97 ... 98 99 The edit form contains the default value for the universityname::100 101 >>> 'Sample University' in browser.contents93 >>> browser.open('http://localhost/myinstitution/configuration') 94 >>> print browser.contents 95 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"... 96 ...<form action="http://localhost/myinstitution/configuration/@@index" 97 ... 98 99 The edit form contains the default value for the institution name:: 100 101 >>> 'Sample Institution' in browser.contents 102 102 True 103 103 … … 110 110 ... 111 111 112 >>> browser.open('http://localhost/my university/configuration')112 >>> browser.open('http://localhost/myinstitution/configuration') 113 113 >>> browser.getControl("Update plugins").click() 114 114 >>> print browser.contents … … 120 120 and is properly rendered on the frontpage of the portal: 121 121 122 >>> browser.open('http://localhost/my university')122 >>> browser.open('http://localhost/myinstitution') 123 123 >>> print browser.contents 124 124 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"... … … 134 134 If we change to German so that the German part of frontpage.rst is rendered: 135 135 136 >>> browser.open('http://localhost/my university//@@change_language?lang=de')136 >>> browser.open('http://localhost/myinstitution//@@change_language?lang=de') 137 137 >>> print browser.contents 138 138 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"... … … 147 147 Switch back to English: 148 148 149 >>> browser.open('http://localhost/my university//@@change_language?lang=en')149 >>> browser.open('http://localhost/myinstitution//@@change_language?lang=en') 150 150 151 151 … … 153 153 ============ 154 154 155 >>> browser.open('http://localhost/my university')155 >>> browser.open('http://localhost/myinstitution') 156 156 >>> browser.getLink('Portal Users').click() 157 157 >>> print browser.contents … … 187 187 manually by setting the roles attribute: 188 188 189 >>> print root['my university']['users']['bob'].roles189 >>> print root['myinstitution']['users']['bob'].roles 190 190 [] 191 >>> root['my university']['users']['bob'].roles = ['waeup.UsersManager']192 >>> print root['my university']['users']['bob'].roles191 >>> root['myinstitution']['users']['bob'].roles = ['waeup.UsersManager'] 192 >>> print root['myinstitution']['users']['bob'].roles 193 193 ['waeup.UsersManager'] 194 >>> browser.open('http://localhost/my university/users')194 >>> browser.open('http://localhost/myinstitution/users') 195 195 >>> print browser.contents 196 196 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"... … … 200 200 Users can't be added twice: 201 201 202 >>> browser.open('http://localhost/my university/users/add')202 >>> browser.open('http://localhost/myinstitution/users/add') 203 203 >>> browser.getControl(name="form.name").value = 'bob' 204 204 >>> browser.getControl(name="form.title").value = 'Bob The User' … … 215 215 Users can be deleted: 216 216 217 >>> browser.open('http://localhost/my university/users')217 >>> browser.open('http://localhost/myinstitution/users') 218 218 >>> browser.getControl("Remove", index=0).click() 219 219 >>> 'User account bob successfully deleted' in browser.contents … … 227 227 Let's enter the contact form:: 228 228 229 >>> browser.open('http://localhost/my university/contactadmin')229 >>> browser.open('http://localhost/myinstitution/contactadmin') 230 230 >>> print browser.contents 231 231 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"... … … 236 236 contact@waeup.org):: 237 237 238 >>> browser.open('http://localhost/my university/contactadmin')238 >>> browser.open('http://localhost/myinstitution/contactadmin') 239 239 >>> browser.getControl(name='form.body').value = "test message" 240 240 >>> browser.getControl('Send').click() … … 253 253 The data center helps us uploading files for later import or similar. 254 254 255 >>> browser.open('http://localhost/my university')255 >>> browser.open('http://localhost/myinstitution') 256 256 >>> browser.getLink('Data Center').click() 257 257 -
main/waeup.kofa/branches/henrik-regista/src/waeup/ikoba/browser/captcha.py
r11949 r11952 32 32 ICaptchaRequest, ICaptchaResponse, ICaptcha, ICaptchaConfig, 33 33 ICaptchaManager) 34 from waeup.ikoba.interfaces import I University34 from waeup.ikoba.interfaces import IInstitution 35 35 36 36 # … … 322 322 # A test page to see a captcha in action 323 323 grok.name('captcha') 324 grok.context(I University)324 grok.context(IInstitution) 325 325 grok.require('waeup.Public') 326 326 title = 'Captcha Test' -
main/waeup.kofa/branches/henrik-regista/src/waeup/ikoba/browser/exceptions.py
r11949 r11952 64 64 """A page rendered when an object cannot be found. 65 65 66 XXX: This page won't work for objects above a w.k. University.66 XXX: This page won't work for objects above a w.k.Institution. 67 67 """ 68 68 grok.context(INotFound) -
main/waeup.kofa/branches/henrik-regista/src/waeup/ikoba/browser/interfaces.py
r11949 r11952 21 21 from zope.interface import Interface, Attribute 22 22 from waeup.ikoba.interfaces import ( 23 IIkobaObject, I University, IUsersContainer, IDataCenter, validate_email)23 IIkobaObject, IInstitution, IUsersContainer, IDataCenter, validate_email) 24 24 from waeup.ikoba.interfaces import MessageFactory as _ 25 25 … … 161 161 162 162 If no `headerline` is given, a default will be rendered (name 163 of university).163 of institution). 164 164 165 165 If no `title` is given, nothing will be rendered. -
main/waeup.kofa/branches/henrik-regista/src/waeup/ikoba/browser/layout.py
r11949 r11952 220 220 #: An instance of the default theme to use for the site layout 221 221 stafftemp = grok.PageTemplateFile('templates/staffsitelayout.pt') 222 studenttemp = grok.PageTemplateFile('templates/studentsitelayout.pt')222 customertemp = grok.PageTemplateFile('templates/customersitelayout.pt') 223 223 224 224 @property … … 227 227 228 228 def getAppTitle(self): 229 return getattr(grok.getSite()['configuration'], 'name', u'Sample University')229 return getattr(grok.getSite()['configuration'], 'name', u'Sample Institution') 230 230 231 231 def getAppAcronym(self): … … 287 287 def render(self): 288 288 if self.isCustomer() or not self.isAuthenticated(): 289 return self. studenttemp.render(self)289 return self.customertemp.render(self) 290 290 return self.stafftemp.render(self) -
main/waeup.kofa/branches/henrik-regista/src/waeup/ikoba/browser/pages.py
r11949 r11952 46 46 IkobaDisplayFormPage, NullValidator) 47 47 from waeup.ikoba.browser.interfaces import ( 48 I University, ICaptchaManager, IChangePassword)48 IInstitution, ICaptchaManager, IChangePassword) 49 49 from waeup.ikoba.browser.layout import jsaction, action, UtilityView 50 50 from waeup.ikoba.interfaces import MessageFactory as _ … … 268 268 self.flash(_('You logged in.')) 269 269 if self.request.principal.user_type == 'customer': 270 student = grok.getSite()['customerss'][270 customer = grok.getSite()['customers'][ 271 271 self.request.principal.id] 272 272 rel_link = '/customers/%s' % self.request.principal.id 273 if student.personal_data_expired:273 if customer.personal_data_expired: 274 274 rel_link = '/customerss/%s/edit_personal' % ( 275 275 self.request.principal.id) … … 325 325 class ContactAdminForm(IkobaForm): 326 326 grok.name('contactadmin') 327 #grok.context(I University)327 #grok.context(IInstitution) 328 328 grok.template('contactform') 329 329 grok.require('waeup.Authenticated') … … 405 405 406 406 # 407 # Universityrelated pages...407 # Institution related pages... 408 408 # 409 409 410 class UniversityPage(IkobaDisplayFormPage):411 """ The main universitypage.410 class InstitutionPage(IkobaDisplayFormPage): 411 """ The main institution page. 412 412 """ 413 413 grok.require('waeup.Public') 414 414 grok.name('index') 415 grok.context(I University)415 grok.context(IInstitution) 416 416 pnav = 0 417 417 label = '' … … 434 434 """ 435 435 grok.name('administration') 436 grok.context(I University)436 grok.context(IInstitution) 437 437 grok.require('waeup.managePortal') 438 438 label = _(u'Administration') … … 443 443 """ 444 444 grok.name('feed.rss') 445 grok.context(I University)445 grok.context(IInstitution) 446 446 grok.require('waeup.Public') 447 grok.template(' universityrss20feed')447 grok.template('institutionrss20feed') 448 448 449 449 name = 'General news feed' … … 457 457 @property 458 458 def title(self): 459 return getattr(grok.getSite(), 'name', u'Sample University')459 return getattr(grok.getSite(), 'name', u'Sample Institution') 460 460 461 461 @property … … 1568 1568 """Captcha'd page for all kind of users to request a password change. 1569 1569 """ 1570 grok.context(I University)1570 grok.context(IInstitution) 1571 1571 grok.name('changepw') 1572 1572 grok.require('waeup.Anonymous') … … 1589 1589 # email=(email,email)) 1590 1590 #for result in results: 1591 # if result. student_id == identifier or \1591 # if result.customer_id == identifier or \ 1592 1592 # result.reg_number == identifier or \ 1593 1593 # result.matric_number == identifier: -
main/waeup.kofa/branches/henrik-regista/src/waeup/ikoba/browser/pdf.py
r11949 r11952 710 710 doc, 'ikoba_headtitle', getattr( 711 711 site_config, 'name', 712 u'Sample University'))712 u'Sample Institution')) 713 713 canvas.setFont("Helvetica-Bold", 18) 714 714 if self.header_logo_left_path is not None: -
main/waeup.kofa/branches/henrik-regista/src/waeup/ikoba/browser/templates/customersitelayout.pt
r11949 r11952 3 3 <head> 4 4 <title i18n:translate=""> 5 WAeUP.Ikoba - Student ManagementSystem5 WAeUP.Ikoba - Application and Registration System 6 6 </title> 7 7 <!--base href="http://localhost:8080/app/@@page" -
main/waeup.kofa/branches/henrik-regista/src/waeup/ikoba/browser/templates/datacenterexportpage.pt
r11949 r11952 1 1 <p i18n:translate=""> 2 Here you can create CSV files from parts of portal data except student data.2 Here you can create CSV files from parts of portal data. 3 3 Please pick the type of objects you want to export from the 4 4 selection below. The file will be generated and then be -
main/waeup.kofa/branches/henrik-regista/src/waeup/ikoba/browser/templates/loginpage.pt
r11949 r11952 22 22 </p> 23 23 <p i18n:translate="login_trouble2" tal:condition="python:False"> 24 You don't have an account because you are a fresh student, or your studentrecord has just been created?25 Acquire a Password Activation Code (PWD) and inititialize your studentaccount24 You don't have an account because you are a new customer, or your customer record has just been created? 25 Acquire a Password Activation Code (PWD) and inititialize your customer account 26 26 <strong><a href ="setpassword"> here</a></strong>. 27 27 </p> 28 28 <p i18n:translate="login_trouble4"> 29 You don't have an account because you are a fresh student, or your studentrecord has just been created?30 Inititialize your studentaccount <strong><a href="requestpw"> here</a></strong>.29 You don't have an account because you are a new customer, or your customer record has just been created? 30 Inititialize your customer account <strong><a href="requestpw"> here</a></strong>. 31 31 </p> 32 <p i18n:translate="login_trouble3"> Or simply forgot your student id, application id orpassword? Then request a new password32 <p i18n:translate="login_trouble3"> Or simply forgot your customer id password? Then request a new password 33 33 <strong><a href="changepw"> here</a></strong>. 34 34 </p> -
main/waeup.kofa/branches/henrik-regista/src/waeup/ikoba/browser/templates/staffsitelayout.pt
r11949 r11952 5 5 <!-- Diazo element--> 6 6 <title i18n:translate=""> 7 WAeUP.Ikoba - Student ManagementSystem7 WAeUP.Ikoba - Application and Registration System 8 8 </title> 9 9 <!-- /Diazo element--> -
main/waeup.kofa/branches/henrik-regista/src/waeup/ikoba/browser/tests/test_async.py
r11949 r11952 8 8 from zope.security.interfaces import Unauthorized 9 9 from zope.testbrowser.testing import Browser 10 from waeup.ikoba.app import University10 from waeup.ikoba.app import Institution 11 11 from waeup.ikoba.async import AsyncJob, get_job_id 12 12 from waeup.ikoba.interfaces import IJobManager … … 29 29 self.storage = os.path.join(self.workdir, 'storage') 30 30 os.mkdir(self.storage) 31 app = University()31 app = Institution() 32 32 app['datacenter'].setStoragePath(self.storage) 33 33 -
main/waeup.kofa/branches/henrik-regista/src/waeup/ikoba/browser/tests/test_permissions.py
r11949 r11952 31 31 from zope.security.interfaces import Unauthorized 32 32 from zope.testbrowser.testing import Browser 33 from waeup.ikoba.app import University33 from waeup.ikoba.app import Institution 34 34 from waeup.ikoba.testing import ( 35 35 FunctionalLayer, FunctionalTestCase, get_all_loggers, remove_new_loggers, … … 58 58 def setUp(self): 59 59 super(PermissionTest, self).setUp() 60 # Set up a complete universityto have every page available...61 app = University()60 # Set up a complete institution to have every page available... 61 app = Institution() 62 62 self.getRootFolder()['app'] = app 63 63 setSite(self.getRootFolder()['app']) -
main/waeup.kofa/branches/henrik-regista/src/waeup/ikoba/browser/viewlets.py
r11949 r11952 24 24 from zope.traversing.browser import absoluteURL 25 25 from waeup.ikoba.browser.pages import ( 26 UniversityPage, DatacenterPage,26 InstitutionPage, DatacenterPage, 27 27 UsersContainerPage, UserManageFormPage) 28 28 from waeup.ikoba.browser.interfaces import ( 29 IBreadcrumbContainer, I University, IUsersContainer)29 IBreadcrumbContainer, IInstitution, IUsersContainer) 30 30 from waeup.ikoba.interfaces import ( 31 31 IIkobaUtils, IIkobaObject, IIkobaXMLExporter,
Note: See TracChangeset for help on using the changeset viewer.