[Mpuls-commits] r5058 - in base/trunk: . mpulsweb/controllers

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri Jun 3 11:14:04 CEST 2011


Author: ludwig
Date: 2011-06-03 11:14:03 +0200 (Fri, 03 Jun 2011)
New Revision: 5058

Modified:
   base/trunk/ChangeLog
   base/trunk/mpulsweb/controllers/administration.py
Log:
Issue1005: Move translated msgs inline.

Modified: base/trunk/ChangeLog
===================================================================
--- base/trunk/ChangeLog	2011-06-03 08:44:53 UTC (rev 5057)
+++ base/trunk/ChangeLog	2011-06-03 09:14:03 UTC (rev 5058)
@@ -1,5 +1,10 @@
 2011-06-03  Ludwig Reiter <ludwig.reiter at intevation.de>
 
+	* mpulsweb/controllers/administration.py:
+	Issue1005: Move translated msgs inline.
+
+2011-06-03  Ludwig Reiter <ludwig.reiter at intevation.de>
+
 	* mpulsweb/i18n/mpulsweb.pot,
 	mpulsweb/i18n/de/LC_MESSAGES/mpulsweb.po,
 	mpulsweb/controllers/privacy.py:

Modified: base/trunk/mpulsweb/controllers/administration.py
===================================================================
--- base/trunk/mpulsweb/controllers/administration.py	2011-06-03 08:44:53 UTC (rev 5057)
+++ base/trunk/mpulsweb/controllers/administration.py	2011-06-03 09:14:03 UTC (rev 5058)
@@ -18,54 +18,6 @@
 from mpulsweb.model.phase import PhaseFactory 
 from mpulsweb.controllers.case_overview import default_phases
 
-
-RESET_PASSWORD_CONFIRM = _('Reset user password?')
-RESET_PASSWORD_CONFIRM_QUESTION = _('Confirm reset user password:')
-EDIT_USER_SUCCESS_HEADER = _('User configs saved!')
-EDIT_USER_SUCCESS_TEXT = _("Please click okay to continue.")
-DELETE_USER_CONFIRM = _('Delete user?')
-DELETE_USER_CONFIRM_QUESTION = _('Please confirm to delete user <strong>%s, %s</strong> (login: %s).')
-DELETE_USER_SUCCESS_HEADER = _('User deleted!')
-DELETE_USER_SUCCESS_TEXT = _('User sucessfully deleted. Click okay to continue.')
-DELETE_SELFUSER_FAILURE = _('User not deleted!')
-DELETE_SELFUSER_FAILURE_TEXT = _('Not possible to delete current login user. Click on okay to continue.')
-DELETE_USER_HASCASES = _(u'The user can not be deleted')
-DELETE_USER_HASCASES_TEXT = \
-  _(u'The user can not be deleted, because he is agent of at least one case.'
-    u' Please move all cases of this agent to a different agent and repeat'
-    u' the action. Click on \"OK\" to navigate back to the user overview.')
-DIALOG_CONFIRM_SETEDITOR = _('Assign case document')
-SETEDITOR_NOTIFICATION_SUCCESS = _('Case document assigned to %s, %s. Please click on OK to delete %s, %s.')
-SETEDITOR_NOTIFICATION_SUCCESS_REST = \
-  _(u'Case document assigned to %s, %s. %s, %s has more case documents.'
-    u' Please click on OK to continue.')
-SETEDITOR_NOTIFICATION_SUCCESS_HEAD = _('Case document assigned!')
-SETEDITOR_NOTIFICATION_SUCCESS_REST_HEAD = \
-  _('Case document assigned. More case documents exist!')
-
-NEW_USERGROUP_SUCCESS_HEADER = _('Create user group!')
-NEW_USERGROUP_SUCCESS_TEXT = \
- _(u'User group successfully created. Please click on OK to continue to the'
-   u' user group overview')
-NEW_USERGROUP_FAILURE_HEADER = _('Failed to create user group!')
-NEW_USERGROUP_FAILURE_TEXT = _('Failed to create the user group.'
-  ' Please click on OK to continue in the user overview.')
-EDIT_USERGROUP_SUCCESS_HEADER =_('Edit user group!')
-EDIT_USERGROUP_SUCCESS_TEXT = \
-  _('The user group was successfully edited. Please click on OK '
-    'to continue in the user group overview.')
-DELETE_USERGROUP_CONFIRM = _('Delete user group?')
-DELETE_USERGROUP_CONFIRM_QUESTION = _('Do you want to delete the user group and lose the data?')
-DELETE_USERGROUP_SUCCESS_HEADER = _('User group deleted!')
-DELETE_USERGROUP_SUCCESS_TEXT = \
-  _('The user group was successfully deleted.'
-    ' Please click on OK to continue in the user group overview.')
-DELETE_USERGROUP_FAILED_HEADER = _('Failed to delete the user group!')
-DELETE_USERGROUP_FAILED_TEXT = \
-  _('Deletion of the user group failed. Please click on OK to continue'
-    ' in the user group overview.')
-
-
 log = logging.getLogger(__name__)
 
 
@@ -155,8 +107,8 @@
             form_result = validator.to_python(request.params)
             c.uo.setData(form_result)
             c.uo.store()
-            c.dialog_title = EDIT_USER_SUCCESS_HEADER
-            c.dialog_text = EDIT_USER_SUCCESS_TEXT
+            c.dialog_title = _('User configs saved!')
+            c.dialog_text = _("Please click okay to continue.")
             c.url_ok = url_for(controller='/administration',
                                action='overviewUser')
             return render('/administration/dialogs/success_edit_user.mako')
@@ -175,8 +127,8 @@
             return render('/administration/reset_password.mako')
         else:
             c.context = "../main.mako"
-            c.dialog_title = RESET_PASSWORD_CONFIRM
-            c.dialog_text = "%s %s, %s" % (RESET_PASSWORD_CONFIRM_QUESTION,
+            c.dialog_title = _('Reset user password?')
+            c.dialog_text = "%s %s, %s" % (_('Confirm reset user password:'),
                                            c.uo.last_name, c.uo.first_name)
 
             c.url_yes = url_for(controller='/administration',
@@ -197,8 +149,9 @@
 
     #    # Make sure that the user can not delete himself
     #    if uo.id == session.get('USER_AUTHORIZED').id:
-    #        c.dialog_title = DELETE_SELFUSER_FAILURE
-    #        c.dialog_text = DELETE_SELFUSER_FAILURE_TEXT
+    #        c.dialog_title = _('User not deleted!')
+    #        c.dialog_text = _('Not possible to delete current login user. '
+    #                          'Click on okay to continue.')
     #        c.url_ok = url_for(controller='/administration',
     #                           action='overviewUser')
     #        return render('/administration/dialogs/failed_delete_user.mako')
@@ -207,23 +160,28 @@
     #        # Check if there are cases for which the user is the editor. If
     #        # he is an editor then raise a error dialog
     #        if user_has_cases(uo):
-    #            c.dialog_title = DELETE_USER_HASCASES
-    #            c.dialog_text = DELETE_USER_HASCASES_TEXT
+    #            c.dialog_title = _(u'The user can not be deleted')
+    #            c.dialog_text = _(u'The user can not be deleted, because he '
+    #                              u'is agent of at least one case.'
+    #    u' Please move all cases of this agent to a different agent and repeat'
+    #    u' the action. Click on \"OK\" to navigate back to the user overview.')
     #            c.url_ok = url_for(controller='/administration',
     #                               action='overviewUser')
     #            return render('/administration/dialogs/failed_delete_user.mako')
     #        else:
     #            uo.delete()
-    #            c.dialog_title = DELETE_USER_SUCCESS_HEADER
-    #            c.dialog_text = DELETE_USER_SUCCESS_TEXT
+    #            c.dialog_title =  _('User deleted!')
+    #            c.dialog_text = _('User sucessfully deleted. '
+    #                              'Click okay to continue.')
     #            c.url_ok = url_for(controller='/administration',
     #                               action='overviewUser')
     #            return render('/administration/dialogs/success_delete_user.mako')
 
     #    else:
     #        c.context = "../main.mako"
-    #        c.dialog_title = DELETE_USER_CONFIRM
-    #        c.dialog_text = DELETE_USER_CONFIRM_QUESTION % (uo.last_name,
+    #        c.dialog_title = _('Delete user?')
+    #        c.dialog_text = _('Please confirm to delete user '
+    #          '<strong>%s, %s</strong> (login: %s).') % (uo.last_name,
     #                                                     uo.first_name,
     #                                                     uo.login)
     #        c.url_yes = url_for(controller='/administration',
@@ -239,8 +197,9 @@
         uo = UserObject(id)
         # Make sure that the user can not delete himself
         if uo.id == session.get('USER_AUTHORIZED').id:
-            c.failed_for = DELETE_SELFUSER_FAILURE
-            c.failed_text = DELETE_SELFUSER_FAILURE_TEXT
+            c.failed_for = _('User not deleted!')
+            c.failed_text = _('Not possible to delete current login user.'
+                    ' Click on okay to continue.')
             c.url_ok = url_for(controller='/administration',
                                action='overviewUser')
             return render('/administration/dialogs/failed_delete_user.mako')
@@ -268,8 +227,9 @@
                 return render('/administration/delete_user_helper.mako')
             else:
                 uo.delete()
-                c.success_for = DELETE_USER_SUCCESS_HEADER
-                c.success_text = DELETE_USER_SUCCESS_TEXT
+                c.success_for = _('User deleted!')
+                c.success_text = _('User sucessfully deleted. '
+                        'Click okay to continue.')
                 c.url_ok = url_for(controller='/administration',
                                    action='overviewUser')
                 return render('/administration/dialogs/'
@@ -277,8 +237,9 @@
 
         else:
             c.context = "../main.mako"
-            c.confirm_for = DELETE_USER_CONFIRM
-            c.question = DELETE_USER_CONFIRM_QUESTION % (uo.last_name,
+            c.confirm_for = _('Delete user?')
+            c.question = _('Please confirm to delete user '
+              '<strong>%s, %s</strong> (login: %s).') % (uo.last_name,
                                                          uo.first_name,
                                                          uo.login)
             c.url_yes = url_for(controller='/administration',
@@ -291,7 +252,7 @@
     def deleteUserHelper(self):
         validator = DeleteUserHelperForm()
         all_cases = MpulsCaseOverview()
-        c.notification_for = DIALOG_CONFIRM_SETEDITOR
+        c.notification_for = _('Assign case document')
         c.form_errors = {}
         c.form_result = {}
 
@@ -309,17 +270,21 @@
                 c.url_ok = url_for(controller='/administration',
                                    action='deleteUser',
                                    id=form_result.get('user_id'), confirmed=1)
-                c.success_for = SETEDITOR_NOTIFICATION_SUCCESS_HEAD
+                c.success_for = _('Case document assigned!')
                 if rest > 0:
-                    c.success_for = SETEDITOR_NOTIFICATION_SUCCESS_REST_HEAD
-                    c.success_text = (SETEDITOR_NOTIFICATION_SUCCESS_REST
+                    c.success_for = _('Case document assigned. '
+                            'More case documents exist!')
+                    c.success_text = (_(u'Case document assigned to %s, %s.'
+                        u' %s, %s has more case documents.'
+                        u' Please click on OK to continue.')
                                       % (new_editor.first_name,
                                          new_editor.last_name,
                                          del_user.first_name,
                                          del_user.last_name))
                 else:
-                    c.success_for = SETEDITOR_NOTIFICATION_SUCCESS_HEAD
-                    c.success_text = (SETEDITOR_NOTIFICATION_SUCCESS
+                    c.success_for = _('Case document assigned!')
+                    c.success_text = (_('Case document assigned to %s, %s.'
+                        ' Please click on OK to delete %s, %s.')
                                       % (new_editor.first_name,
                                          new_editor.last_name,
                                          del_user.first_name,
@@ -355,8 +320,10 @@
         try:
             c.form_result = validator.to_python(request.params)
             c.ugo = factory.create(c.form_result.get('name'))
-            c.dialog_title = NEW_USERGROUP_SUCCESS_HEADER
-            c.dialog_text = NEW_USERGROUP_SUCCESS_TEXT
+            c.dialog_title = _('Create user group!')
+            c.dialog_text =  _(u'User group successfully created. '
+                    u'Please click on OK to continue to the'
+                    u' user group overview')
             c.url_ok = url_for(controller='/administration',
                                action='overviewUserGroups')
             return render('/administration/dialogs/success_new_usergroup.mako')
@@ -370,8 +337,9 @@
                                               auto_insert_errors=False)
         except Exception, e:
             log.exception(e)
-            c.dialog_title = NEW_USERGROUP_FAILURE_HEADER
-            c.dialog_text = NEW_USERGOUP_FAILURE_TEXT
+            c.dialog_title = _('Failed to create user group!')
+            c.dialog_text =  _('Failed to create the user group.'
+  ' Please click on OK to continue in the user overview.')
             c.url_ok = url_for(controller='/administration',
                                action='overviewUserGroups')
             return render('/administration/dialogs/failed_new_usergroup.mako')
@@ -423,8 +391,10 @@
             group.setUser(form_result.get('standin'))
             group.store()
             c.group = group
-            c.dialog_title = EDIT_USERGROUP_SUCCESS_HEADER
-            c.dialog_text = EDIT_USERGROUP_SUCCESS_TEXT
+            c.dialog_title = _('Edit user group!')
+            c.dialog_text = _('The user group was successfully edited. '
+                    'Please click on OK '
+                    'to continue in the user group overview.')
             c.url_ok = url_for(controller='/administration',
                                action='overviewUserGroups')
             return render('/administration/dialogs/success_edit_usergroup.mako')
@@ -446,16 +416,18 @@
             ugo = factory.load(id)
             if confirmed:
                 ugo.delete()
-                c.dialog_title = DELETE_USERGROUP_SUCCESS_HEADER
-                c.dialog_text = DELETE_USERGROUP_SUCCESS_TEXT
+                c.dialog_title = _('User group deleted!')
+                c.dialog_text =  _('The user group was successfully deleted.'
+    ' Please click on OK to continue in the user group overview.')
                 c.url_ok = url_for(controller='/administration',
                                    action='overviewUserGroups')
                 return render('/administration/dialogs/'
                               'success_deletegroup_user.mako')
             else:
                 c.context = "../main.mako"
-                c.dialog_title = DELETE_USERGROUP_CONFIRM
-                c.dialog_text = DELETE_USERGROUP_CONFIRM_QUESTION
+                c.dialog_title = _('Delete user group?')
+                c.dialog_text =  _('Do you want to delete the user group and '
+                        'lose the data?')
                 c.url_yes = url_for(controller='/administration',
                                     action='deleteUserGroup', id=ugo.id,
                                     confirmed=1)
@@ -465,8 +437,10 @@
                               'confirm_deleteusergroup.mako')
         except Exception, e:
             log.exception(e)
-            c.dialog_title = DELETE_USERGROUP_FAILED_HEADER
-            c.dialog_text = DELETE_USERGROUP_FAILED_TEXT
+            c.dialog_title = _('User group deleted!')
+            c.dialog_text = _('Deletion of the user group failed. '
+                    'Please click on OK to continue'
+                    ' in the user group overview.')
             c.url_ok = url_for(controller='/administration',
                                action='overviewUserGroups')
             return render('/administration/dialogs/failed_new_usergroup.mako')



More information about the Mpuls-commits mailing list