Changeset 7700 for main/waeup.sirp/trunk/src/waeup/sirp/browser
- Timestamp:
- 24 Feb 2012, 23:04:05 (13 years ago)
- Location:
- main/waeup.sirp/trunk/src/waeup/sirp/browser
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/browser/breadcrumbs.py
r7333 r7700 25 25 from waeup.sirp.interfaces import ( 26 26 IConfigurationContainer, ISessionConfiguration) 27 from waeup.sirp.interfaces import MessageFactory as _ 27 28 from waeup.sirp.browser import interfaces 28 29 from waeup.sirp.browser.interfaces import (IBreadcrumb, … … 87 88 """ 88 89 grok.context(interfaces.IUniversity) 89 title = u'Home'90 title = _(u'Home') 90 91 parent = None 91 92 … … 101 102 grok.context(interfaces.IUniversity) 102 103 grok.name('manage') 103 title = u'Portal Settings'104 title = _(u'Portal Settings') 104 105 105 106 @property … … 113 114 """ 114 115 grok.context(interfaces.IFacultiesContainer) 115 title = u'Academics'116 title = _(u'Academics') 116 117 117 118 class AdministrationBreadcrumb(Breadcrumb): … … 120 121 grok.context(interfaces.IUniversity) 121 122 grok.name('administration') 122 title = u'Administration'123 title = _(u'Administration') 123 124 viewname = 'administration' 124 125 … … 127 128 """ 128 129 grok.context(IConfigurationContainer) 129 title = u'Portal Configuration'130 title = _(u'Portal Configuration') 130 131 parent_viewname = 'administration' 131 132 … … 145 146 """ 146 147 grok.context(interfaces.IUsersContainer) 147 title = u'Portal Users'148 title = _(u'Portal Users') 148 149 parent_viewname = 'administration' 149 150 … … 152 153 """ 153 154 grok.context(interfaces.IDataCenter) 154 title = u'Data Center'155 title = _(u'Data Center') 155 156 parent_viewname = 'administration' 156 157 -
main/waeup.sirp/trunk/src/waeup/sirp/browser/browser.txt
r7681 r7700 344 344 >>> print browser.contents 345 345 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"... 346 ... Successfully removed:...346 ...Local role successfully removed... 347 347 ... 348 348 … … 494 494 >>> print browser.contents 495 495 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"... 496 ... Successfully removed:...496 ...Local role successfully removed... 497 497 ... 498 498 -
main/waeup.sirp/trunk/src/waeup/sirp/browser/layout.py
r7649 r7700 24 24 from grokcore.formlib.formlib import Action 25 25 from cgi import escape 26 from zope.i18n import translate 26 27 from zope.i18nmessageid import Message 27 28 from hurry.resource import mode … … 70 71 label = self.label 71 72 if isinstance(label, Message): 72 label = zope.i18n.translate(self.label, context=self.form.request)73 label = translate(self.label, context=self.form.request) 73 74 return ('<input type="submit" id="%s" name="%s" value="%s"' 74 75 ' class="btn %s"/>' % … … 92 93 label = self.label 93 94 if isinstance(label, Message): 94 label = zope.i18n.translate(self.label, context=self.form.request)95 label = translate(self.label, context=self.form.request) 95 96 return ('<input type="submit" id="%s" name="%s" value="%s"' 96 97 ' class="btn" onclick="return confirmPost(%s)" />' % -
main/waeup.sirp/trunk/src/waeup/sirp/browser/pages.py
r7694 r7700 44 44 IDepartment, IDepartmentAdd, ICourse, ICourseAdd, ICertificate, 45 45 ICertificateAdd, ICertificateCourse, ICertificateCourseAdd) 46 from waeup.sirp.interfaces import MessageFactory as _ 46 47 from waeup.sirp.browser.resources import warning, datepicker, tabs, datatable 47 48 from waeup.sirp.interfaces import( … … 80 81 child_ids = view.request.form.get('role_id', None) 81 82 if child_ids is None: 82 view.flash( 'No local role selected.')83 view.flash(_('No local role selected.')) 83 84 view.redirect(view.url(view.context, '@@manage')+'?tab%s' % tab) 84 85 return … … 99 100 child_id, sys.exc_info()[0], sys.exc_info()[1])) 100 101 if len(deleted): 101 view.flash('Successfully removed: %s' % ', '.join(deleted)) 102 view.flash( 103 _('Local role successfully removed: ${a}', 104 mapping = {'a':', '.join(deleted)})) 102 105 view.redirect(view.url(view.context, u'@@manage')+'?tab%s' % tab) 103 106 return … … 108 111 child_id = form['val_id'] 109 112 else: 110 view.flash( 'No item selected.')113 view.flash(_('No item selected.')) 111 114 if tab: 112 115 view.redirect(view.url(view.context, redirect)+'?tab%s' % tab) … … 129 132 id, sys.exc_info()[0], sys.exc_info()[1])) 130 133 if len(deleted): 131 view.flash('Successfully removed: %s' % ', '.join(deleted)) 134 view.flash(_('Successfully removed: ${a}', 135 mapping = {'a': ', '.join(deleted)})) 132 136 if tab: 133 137 view.redirect(view.url(view.context, redirect)+'?tab%s' % tab) … … 146 150 grok.context(ISIRPObject) 147 151 grok.require('waeup.Public') 148 label = u'Login'152 label = _(u'Login') 149 153 camefrom = None 150 154 … … 153 157 if SUBMIT is not None: 154 158 if self.request.principal.id != 'zope.anybody': 155 self.flash( 'You logged in.')159 self.flash(_('You logged in.')) 156 160 if self.request.principal.user_type == 'student': 157 161 rel_link = '/students/%s' % self.request.principal.id … … 171 175 self.redirect(self.camefrom) 172 176 return 173 self.flash( 'You entered wrong credentials.')177 self.flash(_('You entered wrong credentials.')) 174 178 175 179 … … 185 189 auth = getUtility(IAuthentication) 186 190 ILogout(auth).logout(self.request) 187 self.flash( "You have been logged out. Thanks for using WAeUP SIRP!")191 self.flash(_("You have been logged out. Thanks for using WAeUP SIRP!")) 188 192 self.redirect(self.application_url()) 189 193 … … 221 225 222 226 def label(self): 223 return u'Contact %s' % self.config.name_admin227 return _(u'Contact ${a}', mapping = {'a': self.config.name_admin}) 224 228 225 229 @property … … 227 231 return get_user_account(self.request) 228 232 229 @action( 'Send message now', style='primary')233 @action(_('Send message now'), style='primary') 230 234 def send(self, *args, **data): 231 235 fullname = self.request.principal.title … … 246 250 # TODO: Catch exceptions. 247 251 if success: 248 self.flash( 'Your message has been sent.')252 self.flash(_('Your message has been sent.')) 249 253 return 250 254 … … 256 260 'fullname', 'email_from', 'body') 257 261 258 @action( 'Send now', style='primary')262 @action(_('Send now'), style='primary') 259 263 def send(self, *args, **data): 260 264 sirp_utils = getUtility(ISIRPUtils) … … 265 269 data['body'],self.config.email_subject) 266 270 if success: 267 self.flash( 'Your message has been sent.')271 self.flash(_('Your message has been sent.')) 268 272 else: 269 self.flash( 'A smtp server error occurred.')273 self.flash(_('A smtp server error occurred.')) 270 274 return 271 275 … … 296 300 grok.context(IUniversity) 297 301 grok.require('waeup.manageUniversity') 298 label = u'Administration'302 label = _(u'Administration') 299 303 pnav = 0 300 304 … … 373 377 grok.context(IUsersContainer) 374 378 grok.name('index') 375 label = 'Portal Users'379 label = _('Portal Users') 376 380 377 381 def update(self, userid=None, adduser=None, manage=None, delete=None): … … 380 384 if delete is not None and userid is not None: 381 385 self.context.delUser(userid) 382 self.flash('User account %s successfully deleted.' % userid) 386 self.flash(_('User account ${a} successfully deleted.', 387 mapping = {'a': userid})) 383 388 384 389 def getLocalRoles(self, account): … … 410 415 grok.template('usereditformpage') 411 416 form_fields = grok.AutoFields(IUserAccount) 412 label = 'Add user'413 414 @action( 'Add user', style='primary')417 label = _('Add user') 418 419 @action(_('Add user'), style='primary') 415 420 def addUser(self, **data): 416 421 name = data['name'] … … 434 439 phone=phone, description=description, 435 440 roles=roles) 436 self.flash('User account %s successfully added.' % name) 441 self.flash(_('User account ${a} successfully added.', 442 mapping = {'a': name})) 437 443 except KeyError: 438 444 self.status = self.flash('The userid chosen already exists ' … … 452 458 453 459 def label(self): 454 return "Edit user %s" % self.context.__name__460 return _("Edit user ${a}", mapping = {'a':self.context.__name__}) 455 461 456 462 def setUpWidgets(self, ignore_request=False): … … 459 465 self.widgets['description'].height = 3 460 466 461 @action( 'Save', style='primary')467 @action(_('Save'), style='primary') 462 468 def save(self, **data): 463 469 form = self.request.form … … 483 489 self.context.__parent__.logger.info( 484 490 'User account %s edited: %s' % (self.context.name,fields_string)) 485 self.flash( 'User settings have been saved.')486 return 487 488 @action( 'Cancel', validator=NullValidator)491 self.flash(_('User settings have been saved.')) 492 return 493 494 @action(_('Cancel'), validator=NullValidator) 489 495 def cancel(self, **data): 490 496 self.redirect(self.url(self.context.__parent__)) … … 500 506 501 507 def label(self): 502 return u'Send message to %s' % self.context.title503 504 @action( 'Send message now', style='primary')508 return _(u'Send message to ${a}', mapping = {'a':self.context.title}) 509 510 @action(_('Send message now'), style='primary') 505 511 def send(self, *args, **data): 506 512 try: … … 519 525 # TODO: Catch exceptions. 520 526 if success: 521 self.flash( 'Your message has been sent.')527 self.flash(_('Your message has been sent.')) 522 528 return 523 529 … … 529 535 form_fields = grok.AutoFields(IUserAccount).omit( 530 536 'name', 'description', 'roles') 531 label = u"My Preferences"537 label = _(u"My Preferences") 532 538 533 539 def setUpWidgets(self, ignore_request=False): … … 542 548 grok.context(IUserAccount) 543 549 grok.template('myrolespage') 544 label = u"My Roles"550 label = _(u"My Roles") 545 551 546 552 @property … … 573 579 grok.template('searchpage') 574 580 grok.require('waeup.manageUniversity') 575 label = u"Search Academic Section"581 label = _(u"Search Academic Section") 576 582 pnav = 1 577 583 … … 599 605 grok.context(IConfigurationContainer) 600 606 pnav = 0 601 label = u'View portal configuration'607 label = _(u'View portal configuration') 602 608 form_fields = grok.AutoFields(IConfigurationContainer) 603 609 form_fields['frontpage'].custom_widget = ReSTDisplayWidget … … 612 618 grok.template('configurationmanagepage') 613 619 pnav = 0 614 label = u'Edit portal configuration'615 taboneactions = [ 'Save', 'Update plugins']620 label = _(u'Edit portal configuration') 621 taboneactions = [_('Save'), _('Update plugins')] 616 622 tabtwoactions = [ 617 'Add session configuration',618 'Remove selected']623 _('Add session configuration'), 624 _('Remove selected')] 619 625 620 626 form_fields = grok.AutoFields(IConfigurationContainer) … … 642 648 self.applyData(self.context, **data) 643 649 self.context.frontpage_html = self.frontpage() 644 self.flash( 'Settings have been saved.')645 return 646 647 @action( 'Add session configuration', validator=NullValidator, style='primary')650 self.flash(_('Settings have been saved.')) 651 return 652 653 @action(_('Add session configuration'), validator=NullValidator, style='primary') 648 654 def addSubunit(self, **data): 649 655 self.redirect(self.url(self.context, '@@add')) … … 656 662 url = self.url(val) 657 663 session_string = val.getSessionString() 658 title = 'Session %s Configuration' % session_string664 title = _('Session ${a} Configuration', mapping = {'a':session_string}) 659 665 yield(dict(url=url, name=key, title=title)) 660 666 661 @jsaction( 'Remove selected')667 @jsaction(_('Remove selected')) 662 668 def delSessonConfigurations(self, **data): 663 669 delSubobjects(self, redirect='@@index', tab='2') 664 670 return 665 671 666 @action( 'Update plugins', validator=NullValidator)672 @action(_('Update plugins'), validator=NullValidator) 667 673 def updatePlugins(self, **data): 668 674 grok.getSite().updatePlugins() 669 self.flash( 'Plugins were updated. See log file for details.')675 self.flash(_('Plugins were updated. See log file for details.')) 670 676 return 671 677 … … 676 682 grok.name('add') 677 683 grok.require('waeup.managePortalConfiguration') 678 label = 'Add session configuration'684 label = _('Add session configuration') 679 685 form_fields = grok.AutoFields(ISessionConfigurationAdd) 680 686 pnav = 0 681 687 682 @action( 'Add Session Configuration', style='primary')688 @action(_('Add Session Configuration'), style='primary') 683 689 def addSessionConfiguration(self, **data): 684 690 sessionconfiguration = createObject(u'waeup.SessionConfiguration') … … 687 693 self.context.addSessionConfiguration(sessionconfiguration) 688 694 except KeyError: 689 self.flash( 'The session chosen already exists ')695 self.flash(_('The session chosen already exists.')) 690 696 return 691 697 self.redirect(self.url(self.context, '@@index')+'?tab2') 692 698 return 693 699 694 @action( 'Cancel', validator=NullValidator)700 @action(_('Cancel'), validator=NullValidator) 695 701 def cancel(self): 696 702 self.redirect(self.url(self.context, '@@index')+'?tab2') … … 709 715 def label(self): 710 716 session_string = self.context.getSessionString() 711 return 'Edit academic session %s configuration' % session_string 712 713 @action('Save', style='primary') 717 return _('Edit academic session ${a} configuration', 718 mapping = {'a':session_string}) 719 720 @action(_('Save'), style='primary') 714 721 def save(self, **data): 715 722 self.applyData(self.context, **data) 716 self.flash( 'Settings have been saved.')723 self.flash(_('Settings have been saved.')) 717 724 self.redirect(self.url(self.context.__parent__, '@@index')+'?tab2') 718 725 return 719 726 720 @action( 'Cancel', validator=NullValidator)727 @action(_('Cancel'), validator=NullValidator) 721 728 def cancel(self): 722 729 self.redirect(self.url(self.context.__parent__, '@@index')+'?tab2') … … 731 738 grok.name('index') 732 739 grok.require('waeup.manageUniversity') 733 label = u'Data Center'740 label = _(u'Data Center') 734 741 pnav = 0 735 742 … … 738 745 grok.name('upload') 739 746 grok.require('waeup.manageUniversity') 740 label = u'Upload file'747 label = _(u'Upload file') 741 748 pnav = 0 742 749 … … 784 791 grok.template('datacenterimport1page') 785 792 grok.require('waeup.manageUniversity') 786 label = u'Process CSV file'793 label = _(u'Process CSV file') 787 794 pnav = 0 788 795 … … 797 804 def update(self, filename=None, select=None, cancel=None): 798 805 if cancel is not None: 799 self.flash( 'Import aborted.')806 self.flash(_('Import aborted.')) 800 807 self.redirect(self.url(self.context)) 801 808 return … … 813 820 grok.template('datacenterimport2page') 814 821 grok.require('waeup.manageUniversity') 815 label = u'Process CSV file'822 label = _(u'Process CSV file') 816 823 pnav = 0 817 824 … … 874 881 if len(headerfields) > len(headerfields_clean): 875 882 result.append( 876 "Double headers: each column name may only appear once. ")883 _("Double headers: each column name may only appear once. ")) 877 884 except: 878 885 fatal = '%s' % sys.exc_info()[1] … … 882 889 for line in result: 883 890 warnings += line + '<br />' 884 warnings += 'Replace imported file!'891 warnings += _('Replace imported file!') 885 892 return warnings 886 893 return False … … 895 902 return 896 903 if cancel is not None: 897 self.flash( 'Import aborted.')904 self.flash(_('Import aborted.')) 898 905 self.redirect(self.url(self.context)) 899 906 return … … 907 914 if self.importer and 'update' in self.importer: 908 915 if self.mode != 'update': 909 self.flash( 'Update mode only!')916 self.flash(_('Update mode only!')) 910 917 self.mode_locked = True 911 918 self.mode = 'update' … … 930 937 grok.template('datacenterimport3page') 931 938 grok.require('waeup.manageUniversity') 932 label = u'Process CSV file'939 label = _(u'Process CSV file') 933 940 pnav = 0 934 941 … … 988 995 for line in result: 989 996 warnings += line + '<br />' 990 warnings += 'Edit headers or replace imported file!'997 warnings += _('Edit headers or replace imported file!') 991 998 return warnings 992 999 return False … … 1009 1016 return 1010 1017 if cancel is not None: 1011 self.flash( 'Import aborted.')1018 self.flash(_('Import aborted.')) 1012 1019 self.redirect(self.url(self.context)) 1013 1020 return … … 1033 1040 grok.template('datacenterimport4page') 1034 1041 grok.require('waeup.manageUniversity') 1035 label = u'Process CSV file'1042 label = _(u'Process CSV file') 1036 1043 pnav = 0 1037 1044 … … 1078 1085 1079 1086 if self.warn_num: 1080 self.flash('Processing of %d rows failed.' % self.warn_num) 1081 self.flash('Successfully processed %s rows.' % ( 1082 linenum - (self.warn_num))) 1087 self.flash(_('Processing of ${a} rows failed.', 1088 mapping = {'a':self.warn_num})) 1089 self.flash(_('Successfully processed ${a} rows.', 1090 mapping = {'a':linenum - self.warn_num})) 1083 1091 1084 1092 class DatacenterLogsOverview(SIRPPage): … … 1087 1095 grok.template('datacenterlogspage') 1088 1096 grok.require('waeup.manageUniversity') 1089 label = u'Show logfiles'1097 label = _(u'Show logfiles') 1090 1098 pnav = 0 1091 1099 … … 1107 1115 grok.template('datacenterlogsshowfilepage') 1108 1116 grok.require('waeup.manageUniversity') 1109 title = u'Data Center'1117 title = _(u'Data Center') 1110 1118 pnav = 0 1111 1119 … … 1129 1137 grok.template('datacentermanagepage') 1130 1138 grok.require('waeup.manageUniversity') 1131 label = 'Edit data center settings'1139 label = _('Edit data center settings') 1132 1140 pnav = 0 1133 1141 … … 1146 1154 not_copied = self.context.setStoragePath(newpath, move=move) 1147 1155 for name in not_copied: 1148 self.flash( 'File already existed (not copied):%s' % name)1156 self.flash(_('File already existed (not copied):') + ' %s' % name) 1149 1157 except: 1150 self.flash( 'Given storage path cannot be used.')1151 self.flash( 'Error:%s' %sys.exc_info()[1])1158 self.flash(_('Given storage path cannot be used.')) 1159 self.flash(_('Error:') + '%s' %sys.exc_info()[1]) 1152 1160 return 1153 1161 if newpath: 1154 self.flash( 'New storage path succefully set.')1162 self.flash(_('New storage path succefully set.')) 1155 1163 self.redirect(self.url(self.context)) 1156 1164 return … … 1212 1220 grok.require('waeup.viewAcademics') 1213 1221 grok.name('index') 1214 label = 'Academic Section'1222 label = _('Academic Section') 1215 1223 pnav = 1 1216 1224 grok.template('facultypage') … … 1224 1232 grok.template('facultiescontainermanagepage') 1225 1233 pnav = 1 1226 taboneactions = [ 'Add faculty', 'Remove selected','Cancel']1227 subunits = 'Faculties'1234 taboneactions = [_('Add faculty'), _('Remove selected'),_('Cancel')] 1235 subunits = _('Faculties') 1228 1236 1229 1237 @property 1230 1238 def label(self): 1231 return 'Manage academic section'1239 return _('Manage academic section') 1232 1240 1233 1241 def update(self): … … 1235 1243 return super(FacultiesContainerManageFormPage, self).update() 1236 1244 1237 @jsaction( 'Remove selected')1245 @jsaction(_('Remove selected')) 1238 1246 def delFaculties(self, **data): 1239 1247 delSubobjects(self, redirect='@@manage', tab='1') 1240 1248 return 1241 1249 1242 @action( 'Add faculty', validator=NullValidator)1250 @action(_('Add faculty'), validator=NullValidator) 1243 1251 def addFaculty(self, **data): 1244 1252 self.redirect(self.url(self.context, '@@add')) 1245 1253 return 1246 1254 1247 @action( 'Cancel', validator=NullValidator)1255 @action(_('Cancel'), validator=NullValidator) 1248 1256 def cancel(self, **data): 1249 1257 self.redirect(self.url(self.context)) … … 1257 1265 grok.require('waeup.manageUniversity') 1258 1266 grok.name('add') 1259 label = 'Add faculty'1267 label = _('Add faculty') 1260 1268 form_fields = grok.AutoFields(IFacultyAdd) 1261 1269 pnav = 1 1262 1270 1263 @action( 'Add faculty', style='primary')1271 @action(_('Add faculty'), style='primary') 1264 1272 def addFaculty(self, **data): 1265 1273 faculty = createObject(u'waeup.Faculty') … … 1268 1276 self.context.addFaculty(faculty) 1269 1277 except KeyError: 1270 self.flash( 'The faculty code chosen already exists.')1278 self.flash(_('The faculty code chosen already exists.')) 1271 1279 return 1272 1280 self.redirect(self.url(self.context, u'@@manage')+'?tab1') 1273 1281 1274 @action( 'Cancel')1282 @action(_('Cancel')) 1275 1283 def cancel(self, **data): 1276 1284 self.redirect(self.url(self.context)) … … 1289 1297 @property 1290 1298 def label(self): 1291 return 'Departments'1299 return _('Departments') 1292 1300 1293 1301 class FacultyManageFormPage(SIRPEditFormPage): … … 1299 1307 grok.template('facultymanagepage') 1300 1308 pnav = 1 1301 subunits = 'Departments'1302 taboneactions = [ 'Save','Cancel']1303 tabtwoactions = [ 'Add department', 'Remove selected','Cancel']1304 tabthreeactions1 = [ 'Remove selected local roles']1305 tabthreeactions2 = [ 'Add local role']1309 subunits = _('Departments') 1310 taboneactions = [_('Save'),_('Cancel')] 1311 tabtwoactions = [_('Add department'), _('Remove selected'),_('Cancel')] 1312 tabthreeactions1 = [_('Remove selected local roles')] 1313 tabthreeactions2 = [_('Add local role')] 1306 1314 1307 1315 form_fields = grok.AutoFields(IFaculty) … … 1309 1317 @property 1310 1318 def label(self): 1311 return 'Manage faculty'1319 return _('Manage faculty') 1312 1320 1313 1321 def update(self): … … 1336 1344 return get_users_with_local_roles(self.context) 1337 1345 1338 @jsaction( 'Remove selected')1346 @jsaction(_('Remove selected')) 1339 1347 def delDepartments(self, **data): 1340 1348 delSubobjects(self, redirect='@@manage', tab='2') … … 1344 1352 def save(self, **data): 1345 1353 self.applyData(self.context, **data) 1346 self.flash( 'Form has been saved.')1347 return 1348 1349 @action( 'Cancel', validator=NullValidator)1354 self.flash(_('Form has been saved.')) 1355 return 1356 1357 @action(_('Cancel'), validator=NullValidator) 1350 1358 def cancel(self, **data): 1351 1359 self.redirect(self.url(self.context)) 1352 1360 return 1353 1361 1354 @action( 'Add department', validator=NullValidator)1362 @action(_('Add department'), validator=NullValidator) 1355 1363 def addSubunit(self, **data): 1356 1364 self.redirect(self.url(self.context, '@@add')) 1357 1365 return 1358 1366 1359 @action( 'Add local role', validator=NullValidator)1367 @action(_('Add local role'), validator=NullValidator) 1360 1368 def addLocalRole(self, **data): 1361 1369 return add_local_role(self, '3', **data) 1362 1370 1363 @action( 'Remove selected local roles')1371 @action(_('Remove selected local roles')) 1364 1372 def delLocalRoles(self, **data): 1365 1373 return del_local_roles(self,3,**data) … … 1371 1379 grok.name('add') 1372 1380 grok.require('waeup.manageUniversity') 1373 label = 'Add department'1381 label = _('Add department') 1374 1382 form_fields = grok.AutoFields(IDepartmentAdd) 1375 1383 pnav = 1 1376 1384 1377 @action( 'Add department', style='primary')1385 @action(_('Add department'), style='primary') 1378 1386 def addDepartment(self, **data): 1379 1387 department = createObject(u'waeup.Department') … … 1382 1390 self.context.addDepartment(department) 1383 1391 except KeyError: 1384 self.flash('The code chosen already exists ' 1385 'in this faculty.') 1392 self.flash(_('The code chosen already exists in this faculty.')) 1386 1393 return 1387 1394 self.status = self.flash( 1388 "Department %s added." % data['code'])1395 _("Department ${a} added.", mapping = {'a':data['code']})) 1389 1396 self.redirect(self.url(self.context, u'@@manage')+'?tab2') 1390 1397 1391 @action( 'Cancel')1398 @action(_('Cancel')) 1392 1399 def cancel(self, **data): 1393 1400 self.redirect(self.url(self.context)) … … 1403 1410 grok.name('index') 1404 1411 pnav = 1 1405 label = 'Courses and Certificates'1412 label = _('Courses and Certificates') 1406 1413 1407 1414 def update(self): … … 1433 1440 grok.template('showstudentspage') 1434 1441 pnav = 1 1435 label = 'Students'1442 label = _('Students') 1436 1443 1437 1444 @property … … 1452 1459 grok.name('showcertstudents') 1453 1460 pnav = 1 1454 label = 'Students'1461 label = _('Students') 1455 1462 1456 1463 @property … … 1468 1475 pnav = 1 1469 1476 grok.template('departmentmanagepage') 1470 taboneactions = [ 'Save','Cancel']1471 tabtwoactions = [ 'Add course', 'Remove selected courses','Cancel']1472 tabthreeactions = [ 'Add certificate', 'Remove selected certificates',1473 'Cancel']1474 tabfouractions1 = [ 'Remove selected local roles']1475 tabfouractions2 = [ 'Add local role']1477 taboneactions = [_('Save'),_('Cancel')] 1478 tabtwoactions = [_('Add course'), _('Remove selected courses'),_('Cancel')] 1479 tabthreeactions = [_('Add certificate'), _('Remove selected certificates'), 1480 _('Cancel')] 1481 tabfouractions1 = [_('Remove selected local roles')] 1482 tabfouractions2 = [_('Add local role')] 1476 1483 1477 1484 form_fields = grok.AutoFields(IDepartment) … … 1479 1486 @property 1480 1487 def label(self): 1481 return 'Manage department'1488 return _('Manage department') 1482 1489 1483 1490 def getCourses(self): … … 1521 1528 return get_users_with_local_roles(self.context) 1522 1529 1523 @action( 'Save', style='primary')1530 @action(_('Save'), style='primary') 1524 1531 def save(self, **data): 1525 1532 self.applyData(self.context, **data) … … 1527 1534 return 1528 1535 1529 @jsaction( 'Remove selected courses')1536 @jsaction(_('Remove selected courses')) 1530 1537 def delCourses(self, **data): 1531 1538 delSubobjects( … … 1533 1540 return 1534 1541 1535 @jsaction( 'Remove selected certificates')1542 @jsaction(_('Remove selected certificates')) 1536 1543 def delCertificates(self, **data): 1537 1544 delSubobjects( … … 1539 1546 return 1540 1547 1541 @action( 'Add course', validator=NullValidator)1548 @action(_('Add course'), validator=NullValidator) 1542 1549 def addCourse(self, **data): 1543 1550 self.redirect(self.url(self.context, 'addcourse')) 1544 1551 return 1545 1552 1546 @action( 'Add certificate', validator=NullValidator)1553 @action(_('Add certificate'), validator=NullValidator) 1547 1554 def addCertificate(self, **data): 1548 1555 self.redirect(self.url(self.context, 'addcertificate')) 1549 1556 return 1550 1557 1551 @action( 'Cancel', validator=NullValidator)1558 @action(_('Cancel'), validator=NullValidator) 1552 1559 def cancel(self, **data): 1553 1560 self.redirect(self.url(self.context)) 1554 1561 return 1555 1562 1556 @action( 'Add local role', validator=NullValidator)1563 @action(_('Add local role'), validator=NullValidator) 1557 1564 def addLocalRole(self, **data): 1558 1565 return add_local_role(self, 4, **data) 1559 1566 1560 @action( 'Remove selected local roles')1567 @action(_('Remove selected local roles')) 1561 1568 def delLocalRoles(self, **data): 1562 1569 return del_local_roles(self,4,**data)
Note: See TracChangeset for help on using the changeset viewer.