Changeset 7328
- Timestamp:
- 11 Dec 2011, 10:17:35 (13 years ago)
- Location:
- main/waeup.sirp/trunk/src/waeup/sirp/browser
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/browser/layout.py
r7321 r7328 22 22 from datetime import date, datetime 23 23 import grokcore.view 24 from cgi import escape 25 from zope.i18nmessageid import Message 24 26 from hurry.resource import mode 25 27 from megrok.layout import Page, Layout, Form, EditForm, DisplayForm, AddForm … … 27 29 from zope.component import getUtility, queryUtility, ComponentLookupError 28 30 from zope.formlib.utility import setUpWidgets 31 from grokcore.formlib.formlib import Action 29 32 from zope.interface import Interface 30 33 from zope.site.hooks import getSite … … 49 52 default_primary_nav_template.__grok_name__ = 'default_primary_nav' 50 53 54 class jsaction(grok.action): 55 56 def __call__(self, success): 57 action = JSAction(self.label, success=success, **self.options) 58 self.actions.append(action) 59 return action 60 61 class JSAction(Action): 62 63 msg = '\'Are you sure?\'' 64 65 def render(self): 66 if not self.available(): 67 return '' 68 label = self.label 69 if isinstance(label, Message): 70 label = zope.i18n.translate(self.label, context=self.form.request) 71 return ('<input type="submit" id="%s" name="%s" value="%s"' 72 ' class="button" onclick="return confirmPost(%s)" />' % 73 (self.__name__, self.__name__, escape(label, quote=True), self.msg) 74 ) 51 75 52 76 def NullValidator(*args, **kw): -
main/waeup.sirp/trunk/src/waeup/sirp/browser/pages.py
r7321 r7328 59 59 from waeup.sirp.authentication import get_principal_role_manager 60 60 from waeup.sirp.utils.helpers import get_user_account, send_mail 61 from waeup.sirp.browser.layout import jsaction, JSAction 61 62 62 63 grok.context(ISIRPObject) … … 595 596 tabs.need() 596 597 datatable.need() 598 warning.need() 597 599 return super(ConfigurationContainerManageFormPage, self).update() 598 600 … … 617 619 yield(dict(url=url, name=key, title=title)) 618 620 619 # ToDo: Show warning message before deletion 620 @grok.action('Remove selected') 621 @jsaction('Remove selected') 621 622 def delSessonConfigurations(self, **data): 622 623 delSubobjects(self, redirect='@@index', tab='2') … … 1204 1205 def update(self): 1205 1206 tabs.need() 1206 #warning.need()1207 warning.need() 1207 1208 return super(FacultyContainerManageFormPage, self).update() 1208 1209 1209 # ToDo: Show warning message before deletion 1210 @grok.action('Remove selected') 1210 @jsaction('Remove selected') 1211 1211 def delFaculties(self, **data): 1212 1212 delSubobjects(self, redirect='@@manage', tab='1') … … 1295 1295 def update(self): 1296 1296 tabs.need() 1297 warning.need() 1297 1298 datatable.need() 1298 1299 return super(FacultyManageFormPage, self).update() … … 1312 1313 return get_users_with_local_roles(self.context) 1313 1314 1314 # ToDo: Show warning message before deletion 1315 @grok.action('Remove selected') 1315 @jsaction('Remove selected') 1316 1316 def delDepartments(self, **data): 1317 1317 delSubobjects(self, redirect='@@manage', tab='2') … … 1471 1471 def update(self): 1472 1472 tabs.need() 1473 warning.need() 1473 1474 datatable.need() 1474 1475 super(DepartmentManageFormPage, self).update() … … 1494 1495 return 1495 1496 1496 # ToDo: Show warning message before deletion 1497 @grok.action('Remove selected courses') 1497 @jsaction('Remove selected courses') 1498 1498 def delCourses(self, **data): 1499 1499 delSubobjects( … … 1501 1501 return 1502 1502 1503 @ grok.action('Remove selected certificates')1503 @jsaction('Remove selected certificates') 1504 1504 def delCertificates(self, **data): 1505 1505 delSubobjects( … … 1710 1710 def update(self): 1711 1711 tabs.need() 1712 #warning.need()1712 warning.need() 1713 1713 datatable.need() 1714 1714 return super(CertificateManageFormPage, self).update() … … 1721 1721 return 1722 1722 1723 # ToDo: Show warning message before deletion 1724 @grok.action('Remove selected course referrers') 1723 @jsaction('Remove selected course referrers') 1725 1724 def delCertificateCourses(self, **data): 1726 1725 delSubobjects(self, redirect='@@manage', tab='2') -
main/waeup.sirp/trunk/src/waeup/sirp/browser/resources.py
r7321 r7328 113 113 #: .. code-block:: html 114 114 #: 115 #: <input type="submit" name="xyz" value="abc" />116 #: onclick="return confirmPost('Are you sure?')" >115 #: <input type="submit" name="xyz" value="abc"> 116 #: onclick="return confirmPost('Are you sure?')"/> 117 117 warning = ResourceInclusion(waeup_sirp, 'warning.js') 118 118
Note: See TracChangeset for help on using the changeset viewer.