- Timestamp:
- 13 Nov 2014, 16:54:17 (10 years ago)
- Location:
- main/waeup.kofa/branches/henrik-regista/src/waeup/ikoba/browser
- Files:
-
- 13 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/branches/henrik-regista/src/waeup/ikoba/browser/batchprocessing.txt
r11952 r11954 21 21 Create a site: 22 22 23 >>> from waeup.ikoba.app import Institution24 >>> getRootFolder()['app'] = Institution()23 >>> from waeup.ikoba.app import Company 24 >>> getRootFolder()['app'] = Company() 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
r11952 r11954 28 28 from waeup.ikoba.browser.interfaces import ( 29 29 IBreadcrumb, IBreadcrumbIgnorable, IBreadcrumbContainer, IIkobaObject, 30 I Institution, IUsersContainer, IDataCenter,30 ICompany, IUsersContainer, IDataCenter, 31 31 ) 32 32 from waeup.ikoba.reports import IReportsContainer … … 86 86 return self.viewname 87 87 88 class InstitutionBreadcrumb(Breadcrumb):89 """A breadcrumb for institutionindex pages.90 """ 91 grok.context(I Institution)88 class CompanyBreadcrumb(Breadcrumb): 89 """A breadcrumb for company index pages. 90 """ 91 grok.context(ICompany) 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 Institutionobject has no99 parent object is not a real parent (the Company 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 Institution)104 grok.context(ICompany) 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 Institutioninstances.116 """ 117 grok.context(I Institution)115 """A breadcrumb for administration areas of Company instances. 116 """ 117 grok.context(ICompany) 118 118 grok.name('administration') 119 119 title = _(u'Administration') -
main/waeup.kofa/branches/henrik-regista/src/waeup/ikoba/browser/breadcrumbs.txt
r11952 r11954 9 9 =============================== 10 10 11 We create a institutionto check the breadcrumb functionality.12 13 >>> from waeup.ikoba.app import Institution11 We create a company to check the breadcrumb functionality. 12 13 >>> from waeup.ikoba.app import Company 14 14 >>> root = getRootFolder() 15 >>> root['app'] = Institution()15 >>> root['app'] = Company() 16 16 >>> app = root['app'] 17 17 … … 25 25 >>> blist1 = getBreadcrumbList(app, 'index') 26 26 >>> blist1 27 [<waeup.ikoba.browser.breadcrumbs. InstitutionBreadcrumb object at 0x...>]27 [<waeup.ikoba.browser.breadcrumbs.CompanyBreadcrumb 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. InstitutionBreadcrumb object at 0x...>,34 [<waeup.ikoba.browser.breadcrumbs.CompanyBreadcrumb 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 institution, administration area and data38 We get a breadcrumb for company, 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. Institutionobject at 0x...>, 'index'),50 (<waeup.ikoba.app. Institutionobject at 0x...>, 'administration'),49 [(<waeup.ikoba.app.Company object at 0x...>, 'index'), 50 (<waeup.ikoba.app.Company 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 institutionobject.55 a certain view (the 'administration' view) on the company 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 Institution64 generated for instance for the administration view of Company 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. InstitutionBreadcrumb object at 0x...>,120 [<...breadcrumbs.CompanyBreadcrumb 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 Institutionobject:130 breadcrumb for the 'index' view of our Company 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. InstitutionBreadcrumb object at 0x...>136 <waeup.ikoba.browser.breadcrumbs.CompanyBreadcrumb object at 0x...> 137 137 138 138 Breadcrumb objects provide a title: … … 168 168 169 169 >>> b2.parent 170 (<waeup.ikoba.app. Institutionobject at 0x...>, 'administration')171 172 This result denotes a new context object (the Institutioninstance we170 (<waeup.ikoba.app.Company object at 0x...>, 'administration') 171 172 This result denotes a new context object (the Company 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 Institutioninstance as above:190 Company 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. Institutionobject at 0x...>, 'index')199 (<waeup.ikoba.app.Company object at 0x...>, 'index') 200 200 201 201 We create last breadcrumb: -
main/waeup.kofa/branches/henrik-regista/src/waeup/ikoba/browser/browser.txt
r11952 r11954 4 4 Here we visit all parts of a Ikoba portal using a browser. 5 5 6 Institution 6 Company 7 7 ========== 8 8 9 9 We can watch universities in the browser. 10 10 11 We create an institutionobject and put into the ZODB root::11 We create an company object and put into the ZODB root:: 12 12 13 13 >>> root = getRootFolder() … … 15 15 [] 16 16 17 >>> from waeup.ikoba.app import Institution18 >>> u = Institution()19 >>> root['my institution'] = u17 >>> from waeup.ikoba.app import Company 18 >>> u = Company() 19 >>> root['mycompany'] = u 20 20 >>> list(root) 21 [u'my institution']21 [u'mycompany'] 22 22 23 23 >>> from zope.component.hooks import setSite 24 >>> setSite(root['my institution'])24 >>> setSite(root['mycompany']) 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 institution::33 34 >>> browser.open('http://localhost/my institution')32 Let's get the default view of a company:: 33 34 >>> browser.open('http://localhost/mycompany') 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 institution')57 >>> browser.open('http://localhost/mycompany') 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 institution']['users'].addUser('forgetful', 'secret',title='Bob Forgetful',76 >>> root['mycompany']['users'].addUser('forgetful', 'secret',title='Bob Forgetful', 77 77 ... description='A forgetful user', email='aa@aa.ng') 78 >>> browser.open('http://localhost/my institution/changepw')78 >>> browser.open('http://localhost/mycompany/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 institution/configuration')94 >>> print browser.contents 95 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"... 96 ...<form action="http://localhost/my institution/configuration/@@index"97 ... 98 99 The edit form contains the default value for the institutionname::100 101 >>> 'Sample Institution' in browser.contents93 >>> browser.open('http://localhost/mycompany/configuration') 94 >>> print browser.contents 95 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"... 96 ...<form action="http://localhost/mycompany/configuration/@@index" 97 ... 98 99 The edit form contains the default value for the company name:: 100 101 >>> 'Sample Company' in browser.contents 102 102 True 103 103 … … 110 110 ... 111 111 112 >>> browser.open('http://localhost/my institution/configuration')112 >>> browser.open('http://localhost/mycompany/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 institution')122 >>> browser.open('http://localhost/mycompany') 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 institution//@@change_language?lang=de')136 >>> browser.open('http://localhost/mycompany//@@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 institution//@@change_language?lang=en')149 >>> browser.open('http://localhost/mycompany//@@change_language?lang=en') 150 150 151 151 … … 153 153 ============ 154 154 155 >>> browser.open('http://localhost/my institution')155 >>> browser.open('http://localhost/mycompany') 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 institution']['users']['bob'].roles189 >>> print root['mycompany']['users']['bob'].roles 190 190 [] 191 >>> root['my institution']['users']['bob'].roles = ['waeup.UsersManager']192 >>> print root['my institution']['users']['bob'].roles191 >>> root['mycompany']['users']['bob'].roles = ['waeup.UsersManager'] 192 >>> print root['mycompany']['users']['bob'].roles 193 193 ['waeup.UsersManager'] 194 >>> browser.open('http://localhost/my institution/users')194 >>> browser.open('http://localhost/mycompany/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 institution/users/add')202 >>> browser.open('http://localhost/mycompany/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 institution/users')217 >>> browser.open('http://localhost/mycompany/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 institution/contactadmin')229 >>> browser.open('http://localhost/mycompany/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 institution/contactadmin')238 >>> browser.open('http://localhost/mycompany/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 institution')255 >>> browser.open('http://localhost/mycompany') 256 256 >>> browser.getLink('Data Center').click() 257 257 -
main/waeup.kofa/branches/henrik-regista/src/waeup/ikoba/browser/captcha.py
r11952 r11954 32 32 ICaptchaRequest, ICaptchaResponse, ICaptcha, ICaptchaConfig, 33 33 ICaptchaManager) 34 from waeup.ikoba.interfaces import I Institution34 from waeup.ikoba.interfaces import ICompany 35 35 36 36 # … … 322 322 # A test page to see a captcha in action 323 323 grok.name('captcha') 324 grok.context(I Institution)324 grok.context(ICompany) 325 325 grok.require('waeup.Public') 326 326 title = 'Captcha Test' -
main/waeup.kofa/branches/henrik-regista/src/waeup/ikoba/browser/exceptions.py
r11952 r11954 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. Institution.66 XXX: This page won't work for objects above a w.k.Company. 67 67 """ 68 68 grok.context(INotFound) -
main/waeup.kofa/branches/henrik-regista/src/waeup/ikoba/browser/interfaces.py
r11952 r11954 21 21 from zope.interface import Interface, Attribute 22 22 from waeup.ikoba.interfaces import ( 23 IIkobaObject, I Institution, IUsersContainer, IDataCenter, validate_email)23 IIkobaObject, ICompany, 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 institution).163 of company). 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
r11952 r11954 227 227 228 228 def getAppTitle(self): 229 return getattr(grok.getSite()['configuration'], 'name', u'Sample Institution')229 return getattr(grok.getSite()['configuration'], 'name', u'Sample Company') 230 230 231 231 def getAppAcronym(self): -
main/waeup.kofa/branches/henrik-regista/src/waeup/ikoba/browser/pages.py
r11952 r11954 46 46 IkobaDisplayFormPage, NullValidator) 47 47 from waeup.ikoba.browser.interfaces import ( 48 I Institution, ICaptchaManager, IChangePassword)48 ICompany, ICaptchaManager, IChangePassword) 49 49 from waeup.ikoba.browser.layout import jsaction, action, UtilityView 50 50 from waeup.ikoba.interfaces import MessageFactory as _ … … 325 325 class ContactAdminForm(IkobaForm): 326 326 grok.name('contactadmin') 327 #grok.context(I Institution)327 #grok.context(ICompany) 328 328 grok.template('contactform') 329 329 grok.require('waeup.Authenticated') … … 405 405 406 406 # 407 # Institutionrelated pages...407 # Company related pages... 408 408 # 409 409 410 class InstitutionPage(IkobaDisplayFormPage):411 """ The main institutionpage.410 class CompanyPage(IkobaDisplayFormPage): 411 """ The main company page. 412 412 """ 413 413 grok.require('waeup.Public') 414 414 grok.name('index') 415 grok.context(I Institution)415 grok.context(ICompany) 416 416 pnav = 0 417 417 label = '' … … 434 434 """ 435 435 grok.name('administration') 436 grok.context(I Institution)436 grok.context(ICompany) 437 437 grok.require('waeup.managePortal') 438 438 label = _(u'Administration') … … 443 443 """ 444 444 grok.name('feed.rss') 445 grok.context(I Institution)445 grok.context(ICompany) 446 446 grok.require('waeup.Public') 447 grok.template(' institutionrss20feed')447 grok.template('companyrss20feed') 448 448 449 449 name = 'General news feed' … … 457 457 @property 458 458 def title(self): 459 return getattr(grok.getSite(), 'name', u'Sample Institution')459 return getattr(grok.getSite(), 'name', u'Sample Company') 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 Institution)1570 grok.context(ICompany) 1571 1571 grok.name('changepw') 1572 1572 grok.require('waeup.Anonymous') -
main/waeup.kofa/branches/henrik-regista/src/waeup/ikoba/browser/pdf.py
r11952 r11954 710 710 doc, 'ikoba_headtitle', getattr( 711 711 site_config, 'name', 712 u'Sample Institution'))712 u'Sample Company')) 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/tests/test_async.py
r11952 r11954 8 8 from zope.security.interfaces import Unauthorized 9 9 from zope.testbrowser.testing import Browser 10 from waeup.ikoba.app import Institution10 from waeup.ikoba.app import Company 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 = Institution()31 app = Company() 32 32 app['datacenter'].setStoragePath(self.storage) 33 33 -
main/waeup.kofa/branches/henrik-regista/src/waeup/ikoba/browser/tests/test_permissions.py
r11952 r11954 31 31 from zope.security.interfaces import Unauthorized 32 32 from zope.testbrowser.testing import Browser 33 from waeup.ikoba.app import Institution33 from waeup.ikoba.app import Company 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 institutionto have every page available...61 app = Institution()60 # Set up a complete company to have every page available... 61 app = Company() 62 62 self.getRootFolder()['app'] = app 63 63 setSite(self.getRootFolder()['app']) -
main/waeup.kofa/branches/henrik-regista/src/waeup/ikoba/browser/viewlets.py
r11952 r11954 24 24 from zope.traversing.browser import absoluteURL 25 25 from waeup.ikoba.browser.pages import ( 26 InstitutionPage, DatacenterPage,26 CompanyPage, DatacenterPage, 27 27 UsersContainerPage, UserManageFormPage) 28 28 from waeup.ikoba.browser.interfaces import ( 29 IBreadcrumbContainer, I Institution, IUsersContainer)29 IBreadcrumbContainer, ICompany, IUsersContainer) 30 30 from waeup.ikoba.interfaces import ( 31 31 IIkobaUtils, IIkobaObject, IIkobaXMLExporter,
Note: See TracChangeset for help on using the changeset viewer.