Index: /main/waeup.ikoba/trunk/src/waeup/ikoba/app.py
===================================================================
--- /main/waeup.ikoba/trunk/src/waeup/ikoba/app.py	(revision 12090)
+++ /main/waeup.ikoba/trunk/src/waeup/ikoba/app.py	(revision 12091)
@@ -87,5 +87,5 @@
         """
         # lock.acquire() # lock data
-        new_id = u'd%s' % (self._curr_app_id)
+        new_id = u'a%s' % (self._curr_app_id)
         self._curr_app_id += 1
         # self._p_changed = True
Index: /main/waeup.ikoba/trunk/src/waeup/ikoba/customers/browser.py
===================================================================
--- /main/waeup.ikoba/trunk/src/waeup/ikoba/customers/browser.py	(revision 12090)
+++ /main/waeup.ikoba/trunk/src/waeup/ikoba/customers/browser.py	(revision 12091)
@@ -36,5 +36,5 @@
     IContactForm, IObjectHistory, IIkobaObject, IIkobaUtils,
     IPasswordValidator, IUserAccount,
-    VERIFIED, REJECTED, EXPIRED)
+    VERIFIED, REJECTED, EXPIRED, APPROVED)
 from waeup.ikoba.browser.layout import (
     IkobaPage, IkobaEditFormPage, IkobaAddFormPage, IkobaDisplayFormPage,
@@ -70,5 +70,6 @@
     view.flash(_('Form has been saved.'))
     if fields_string:
-        view.context.writeLogMessage(view, 'saved: %s' % fields_string)
+        view.context.writeLogMessage(
+            view, 'saved %s: %s' % (view.context.__name__, fields_string))
     return
 
@@ -938,5 +939,5 @@
     """
     grok.context(ICustomerDocumentsContainer)
-    grok.name('overview_slip.pdf')
+    grok.name('documents_overview_slip.pdf')
     grok.require('waeup.viewCustomer')
     prefix = 'form'
@@ -1047,5 +1048,5 @@
     """ Page to manage the customer applications
 
-    This manage form page is for both customers and customers officers.
+    This manage form page is for both customers and officers.
     """
     grok.context(IApplicationsContainer)
@@ -1251,5 +1252,5 @@
     """
     grok.context(IApplicationsContainer)
-    grok.name('overview_slip.pdf')
+    grok.name('applications_overview_slip.pdf')
     grok.require('waeup.viewCustomer')
     prefix = 'form'
Index: /main/waeup.ikoba/trunk/src/waeup/ikoba/customers/permissions.py
===================================================================
--- /main/waeup.ikoba/trunk/src/waeup/ikoba/customers/permissions.py	(revision 12090)
+++ /main/waeup.ikoba/trunk/src/waeup/ikoba/customers/permissions.py	(revision 12091)
@@ -73,5 +73,6 @@
     grok.title(u'Customer Record Owner')
     grok.permissions('waeup.handleCustomer', 'waeup.uploadCustomerFile',
-                     'waeup.viewCustomer', 'waeup.editCustomerDocuments')
+                     'waeup.viewCustomer', 'waeup.editCustomerDocuments',
+                     'waeup.editApplications')
 
 
Index: /main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_browser.py
===================================================================
--- /main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_browser.py	(revision 12090)
+++ /main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_browser.py	(revision 12091)
@@ -107,4 +107,7 @@
         document.title = u'My first document'
         self.customer['documents'].addDocument(document)
+        application = createObject('waeup.SampleApplication')
+        application.title = u'My first application'
+        self.customer['applications'].addApplication(application)
 
         # Set password
@@ -121,4 +124,5 @@
         self.history_path = self.customer_path + '/history'
         self.documents_path = self.customer_path + '/documents'
+        self.applications_path = self.customer_path + '/applications'
 
         self.app['configuration'].carry_over = True
@@ -849,12 +853,10 @@
         self.assertTrue(
             'INFO - zope.mgr - customers.browser.DocumentManageFormPage '
-            '- K1000000 - saved: title'
+            '- K1000000 - saved d102: title'
             in logcontent)
-
         self.assertTrue(
             'INFO - zope.mgr - customers.browser.DocumentAddFormPage '
             '- K1000000 - added: PDF Document %s'
             % document.document_id in logcontent)
-
         self.assertTrue(
             'INFO - zope.mgr - customers.browser.DocumentsManageFormPage '
@@ -1030,5 +1032,5 @@
         self.assertEqual(self.browser.headers['Status'], '200 Ok')
         self.assertEqual(self.browser.headers['Content-Type'], 'application/pdf')
-        path = os.path.join(samples_dir(), 'overview_slip.pdf')
+        path = os.path.join(samples_dir(), 'documents_overview_slip.pdf')
         open(path, 'wb').write(self.browser.contents)
         print "Sample PDF overview_slip.pdf written to %s" % path
@@ -1041,2 +1043,122 @@
         open(path, 'wb').write(self.browser.contents)
         print "Sample document_slip.pdf written to %s" % path
+
+
+class ApplicationUITests(CustomersFullSetup):
+    # Tests for CustomerSampleApplication relates views and pages
+
+    def test_manage_application(self):
+        # Managers can access the pages of customer applicationsconter
+        # and can perform actions
+        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
+        self.browser.open(self.customer_path)
+        self.assertEqual(self.browser.headers['Status'], '200 Ok')
+        self.assertEqual(self.browser.url, self.customer_path)
+        self.browser.open(self.customer_path)
+        self.browser.getLink("Applications").click()
+        self.browser.getLink("Add application").click()
+        self.browser.getControl(name="apptype").value = ['SampleApplication']
+        self.browser.getControl("Create application").click()
+        self.assertTrue('Sample Application created.' in self.browser.contents)
+        application = self.customer['applications']['a102']
+
+        # Application can be edited
+        self.browser.getLink("a102").click()
+        self.browser.getLink("Manage").click()
+        self.browser.getControl(name="form.title").value = 'My second app'
+        self.browser.getControl("Save").click()
+        self.assertTrue('Form has been saved.' in self.browser.contents)
+        self.browser.getLink("View").click()
+        self.assertEqual(self.browser.url, self.applications_path + '/a102/index')
+
+        # Transitions can be performed
+        self.browser.getLink("Transition").click()
+        self.browser.getControl(name="transition").value = ['submit']
+        self.browser.getControl("Save").click()
+        self.browser.getControl(name="transition").value = ['approve']
+        self.browser.getControl("Save").click()
+        self.assertEqual(application.state, 'approved')
+
+        # Applications can be removed
+        self.browser.getLink("Applications").click()
+        ctrl = self.browser.getControl(name='val_id')
+        ctrl.getControl(value=application.application_id).selected = True
+        self.browser.getControl("Remove selected", index=0).click()
+        self.assertTrue('Successfully removed' in self.browser.contents)
+
+        # All actions are being logged
+        logfile = os.path.join(
+            self.app['datacenter'].storage, 'logs', 'customers.log')
+        logcontent = open(logfile).read()
+        self.assertTrue(
+            'INFO - zope.mgr - customers.browser.ApplicationManageFormPage '
+            '- K1000000 - saved a102: title'
+            in logcontent)
+        self.assertTrue(
+            'INFO - zope.mgr - customers.browser.ApplicationAddFormPage '
+            '- K1000000 - added: Sample Application %s'
+            % application.application_id in logcontent)
+        self.assertTrue(
+            'INFO - zope.mgr - customers.browser.ApplicationsManageFormPage '
+            '- K1000000 - removed: %s'
+            % application.application_id in logcontent)
+
+    def test_edit_sample_application(self):
+        # Customers can manage applications under certain conditions
+        self.browser.open(self.login_path)
+        self.browser.getControl(name="form.login").value = self.customer_id
+        self.browser.getControl(name="form.password").value = 'cpwd'
+        self.browser.getControl("Login").click()
+        self.assertMatches(
+            '...You logged in...', self.browser.contents)
+        self.browser.getLink("Applications").click()
+        self.browser.getLink("Add application").click()
+        self.browser.getControl(name="apptype").value = ['SampleApplication']
+        self.browser.getControl("Create application").click()
+        self.assertTrue('Sample Application created.' in self.browser.contents)
+        application = self.customer['applications']['a102']
+
+        # Application can be edited ...
+        self.browser.getLink("a102").click()
+        self.browser.open(self.applications_path + '/a102/edit')
+        #self.browser.getLink("Edit").click()
+        self.assertTrue('The requested form is locked' in self.browser.contents)
+        # Customer is in wrong state
+        IWorkflowState(self.customer).setState(APPROVED)
+        self.browser.open(self.applications_path + '/a102/edit')
+        self.browser.getControl(name="form.title").value = 'My second app'
+        self.browser.getControl("Save").click()
+        self.assertEqual(application.title, 'My second app')
+        self.assertTrue('Form has been saved.' in self.browser.contents)
+        self.browser.getLink("View").click()
+        self.assertEqual(self.browser.url, self.applications_path + '/a102/index')
+        # Customer can submit the form. The form is also saved.
+        self.browser.getLink("Edit").click()
+        self.browser.getControl(name="form.title").value = 'My third app'
+        self.browser.getControl("Final Submit").click()
+        self.assertEqual(application.title, 'My third app')
+        self.assertEqual(application.state, 'submitted')
+        self.assertTrue('Application State: submitted for approval' in self.browser.contents)
+        # Customer can't edit the application once it has been submitted
+        self.browser.open(self.applications_path + '/a102/edit')
+        self.assertTrue('The requested form is locked' in self.browser.contents)
+
+    def test_view_slips(self):
+        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
+        # Officers can open the application overview
+        self.browser.open(self.customer_path + '/applications')
+        self.browser.getLink("Download applications overview").click()
+        self.assertEqual(self.browser.headers['Status'], '200 Ok')
+        self.assertEqual(self.browser.headers['Content-Type'], 'application/pdf')
+        path = os.path.join(samples_dir(), 'applications_overview_slip.pdf')
+        open(path, 'wb').write(self.browser.contents)
+        print "Sample PDF overview_slip.pdf written to %s" % path
+        # Officers can open application slips
+        self.browser.open(self.customer_path + '/applications/a101')
+        self.browser.getLink("Download application slip").click()
+        self.assertEqual(self.browser.headers['Status'], '200 Ok')
+        self.assertEqual(self.browser.headers['Content-Type'], 'application/pdf')
+        path = os.path.join(samples_dir(), 'application_slip.pdf')
+        open(path, 'wb').write(self.browser.contents)
+        print "Sample application_slip.pdf written to %s" % path
+
Index: /main/waeup.ikoba/trunk/src/waeup/ikoba/customers/utils.py
===================================================================
--- /main/waeup.ikoba/trunk/src/waeup/ikoba/customers/utils.py	(revision 12090)
+++ /main/waeup.ikoba/trunk/src/waeup/ikoba/customers/utils.py	(revision 12091)
@@ -289,5 +289,5 @@
     APPMANAGE_CUSTOMER_STATES = DOCMANAGE_CUSTOMER_STATES
 
-    APPMANAGE_APPLICATION_STATES = ()
+    APPMANAGE_APPLICATION_STATES = (CREATED,)
 
     SKIP_UPLOAD_VIEWLETS = ()
@@ -378,5 +378,7 @@
         if show_history:
             if getattr(view.context, 'history', None):
-                hist_translation = trans(_('Document Workflow History'), portal_language)
+                hist_translation = trans(_('${a} Workflow History',
+                                           mapping = {'a':view.context.translated_class_name}),
+                                        portal_language)
                 data.append(Paragraph(hist_translation, HEADING_STYLE))
                 data.extend(creator.fromStringList(view.context.history.messages))
Index: /main/waeup.ikoba/trunk/src/waeup/ikoba/customers/viewlets.py
===================================================================
--- /main/waeup.ikoba/trunk/src/waeup/ikoba/customers/viewlets.py	(revision 12090)
+++ /main/waeup.ikoba/trunk/src/waeup/ikoba/customers/viewlets.py	(revision 12091)
@@ -316,5 +316,5 @@
     icon = 'actionicon_pdf.png'
     text = _('Download documents overview')
-    target = 'overview_slip.pdf'
+    target = 'documents_overview_slip.pdf'
 
 
@@ -390,5 +390,5 @@
     icon = 'actionicon_pdf.png'
     text = _('Download applications overview')
-    target = 'overview_slip.pdf'
+    target = 'applications_overview_slip.pdf'
 
 
