Commits

Anonymous committed 05cfbe4

add in trunk as 0.6 code

Comments (0)

Files changed (12)

 --------
 
 Ed Crewe, `ILRT
-<http://www.ilrt.bris.ac.uk/>`_ at University of Bristol, June 10th 2009
+<http://www.ilrt.bris.ac.uk/>`_ at University of Bristol, September 10th 2009
 
 Formal workflow is designed for sites where there may be many editors
 for whom unmoderated access to change live published content on the 
 via the the portal_workflow tool. You could also choose to only apply formal workflow 
 to the high profile parts of your site, via `placeful workflow
 <http://pypi.python.org/pypi/Products.CMFPlacefulWorkflow>`_.
+
+If you dont want users questioned over the location for their checkouts then you can
+specify a checkout locator globally in the site properties. Currently this would be
+global_checkout_locator = 'plone.app.iterate.home' or 'plone.app.iterate.parent'
+If not set then the default behaviour is used.
+
 
     (name of developer listed in brackets)
 
+ilrt.formalworkflow - 0.6 Released - 10th September 2009
+
+    - Tested against plone 3.3 - fixed tests
+    - Added option to globally set check out location in site properties.
+
+    [Ed Crewe, ILRT - University of Bristol]
+
 ilrt.formalworkflow - 0.5 Released - 10th June 2009
 
     - Added a subclass of the iterate info viewlet to redeclare the security so that 
 To Do list
 ----------
 
-Find a better way to allow permissions of objects to be used rather 
-than those of their containers for delete, copy and paste.
-Currently it uses a workaround that needs proxy manager then does a
-manual permission check, within the skins.
+#. Find a better way to allow permissions of objects to be used rather 
+   than those of their containers for delete, copy and paste.
+   Currently it uses a workaround that needs proxy manager then does a
+   manual permission check, within the skins.
 
 
 

ilrt.formalworkflow.egg-info/PKG-INFO

         To Do list
         ----------
         
-        Find a better way to allow permissions of objects to be used rather
+        #. Fix tests for plone 3.3
+        
+        #. Add a preferences properties tab to allow switching of the working draft
+        location at a global level, e.g. user or parent folder. Perhaps a free
+        text box for specifying it as [user]/drafts, [parent], /globaldrafts etc.
+        The main aim being if anything is specified then the extra question during
+        workflow can be dropped.
+        
+        #. Find a better way to allow permissions of objects to be used rather
         than those of their containers for delete, copy and paste.
         Currently it uses a workaround that needs proxy manager then does a
         manual permission check, within the skins.

ilrt/formalworkflow/browser/checkout.py

+from Acquisition import aq_inner
+from Products.CMFPlone.utils import getToolByName
+from zope.component import getAdapters
+from plone.app.iterate.interfaces import IWCContainerLocator
 from plone.app.iterate.browser.checkout import Checkout as BaseCheckout
 from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
 
 class Checkout(BaseCheckout):
-    """ This seems to be the only way to override the template 
-        because its set in the base class and so the zcml template directive
-        is unusable
+    """ Override the template and modify available containers if
+        global_checkout_location is set in site_properties
     """
     template = ViewPageTemplateFile('checkout.pt')
 
+    def containers(self):
+        """Get a list of potential containers
+        """
+        context = aq_inner(self.context)
+        portal_props = getToolByName(context, 'portal_properties')
+        site_props = portal_props.get('site_properties')
+        if site_props:
+            gc_location = site_props.getProperty('global_checkout_locator', '') 
+        else:
+            gc_location = ''
 
+        location = {}    
+        for name, locator in getAdapters((context,), IWCContainerLocator):
+            if locator.available:
+                location[name] = locator
+
+        if gc_location not in location.keys():
+            for name in location.keys():
+                yield dict(name=name, locator=location[name])
+        else:
+            yield dict(name=gc_location, locator=location[gc_location]) 

ilrt/formalworkflow/profiles/default/propertiestool.xml

+<?xml version="1.0"?>
+<object name="portal_properties" meta_type="Plone Properties Tool">
+ <object name="site_properties" meta_type="Plone Property Sheet">
+  <property name="global_checkout_locator" type="string"></property>
+ </object>
+</object>

ilrt/formalworkflow/tests/editorpastedelete.txt

     >>> title  = 'boss'
     >>> browser.getControl(name="title").value = title
     >>> browser.getControl(name='text').value = "<h1>Test Bosses page</h1>\n\n"
-    >>> browser.getControl(name='form_submit').click()
+    >>> browser.getControl('Save').click()
     >>> "Changes saved." in browser.contents
     True
     >>> title in browser.contents
     >>> another_title  = 'quack'
     >>> browser.getControl(name="title").value = another_title
     >>> browser.getControl(name='text').value = "<h1>Test Delete page</h1>\n\n"
-    >>> browser.getControl(name='form_submit').click()
+    >>> browser.getControl('Save').click()
     >>> "Changes saved." in browser.contents
     True
     >>> another_title in browser.contents

ilrt/formalworkflow/tests/iterationlocation.txt

+======================================================
+Functional test of setting a global iteration location
+======================================================
+
+Functional tests for the formalworkflow iteration locator property 
+
+by Ed Crewe, ILRT (University of Bristol) September 2009
+
+    >>> from Products.Five.testbrowser import Browser
+    >>> from Products.PloneTestCase.setup import portal_owner, default_password
+    >>> from Products.CMFPlone.utils import getToolByName
+    >>> from mechanize._mechanize import LinkNotFoundError
+
+
+Site layer security setup 
+=========================
+
+Confirm we are in the skin that allows access to the iterate
+checkout for the Copy or Move permission ... rather than 
+modify portal content - so we can take an iteration of content 
+when we are not allowed to modify the (published) original 
+
+    >>> wftool = getToolByName(portal, "portal_workflow")
+    >>> wftool._default_chain
+    ('formal_workflow',)    
+    >>> wftool.getChainForPortalType('Document')
+    ('formal_workflow',)    
+
+Make sure that the membership area creation is now toggled on
+
+    >>> membership = getToolByName(portal,'portal_membership')
+    >>> if not membership.getMemberareaCreationFlag():
+    ...    update = membership.setMemberareaCreationFlag()
+
+Set up the browser tests
+
+    >>> portal_url = portal.absolute_url()
+    >>> browser = Browser()
+    >>> browser.handleErrors = True
+
+
+Log in as the manager and create and a document
+===============================================
+
+Login as the manager
+
+    >>> browser.open(portal_url)
+    >>> browser.getControl(name='__ac_name').value = portal_owner
+    >>> browser.getControl(name='__ac_password').value = default_password
+    >>> browser.getControl(name='submit').click()
+    >>> "You are now logged in" in browser.contents
+    True
+
+Open the create document link
+
+    >>> browser.open(portal_url)
+    >>> browser.getLink(url=portal_url + '/createObject?type_name=Document').click()
+    >>> "/portal_factory/Document/document." in browser.contents
+    True
+
+Fill in the form with dummy content for the test page
+
+    >>> title  = 'yetanotherpage'
+    >>> browser.getControl(name="title").value = title
+    >>> browser.getControl(name='text').value = "<h1>Test Another Bosses page</h1>\n\n"
+    >>> browser.getControl('Save').click()
+    >>> "Changes saved." in browser.contents
+    True
+    >>> title in browser.contents
+    True
+
+Publish the document
+
+    >>> doc_url = portal_url + '/' + title
+    >>> submit_url =  doc_url + '/content_status_modify?workflow_action=publish'
+    >>> browser.getLink(url=submit_url).click()
+    >>> browser.getLink(url=doc_url + '/content_status_history').click()
+    >>> browser.getControl(name='workflow_action').value
+    ['published']
+
+Now lets spin out an iteration
+==============================
+
+Check to see that we can checkout a version
+
+    >>> browser.open(doc_url)
+    >>> checkout_url =  doc_url + '/@@make-changes'
+    >>> try:
+    ...    checkoutlink = browser.getLink(url=checkout_url)
+    ... except LinkNotFoundError:
+    ...    checkoutlink = None
+
+We should have a checkout link from plone.app.iterate
+
+   >>> checkoutlink != None
+   True
+
+We should be able to check out
+
+    >>> checkoutlink.click()
+
+But then we get the irritating extra 'where do you want it?' step
+
+    >>> 'checkout_location_plone' in browser.contents
+    True
+
+Set the global checkout location
+================================
+
+Check we now have the new global checkout location property
+
+    >>> portal_props = getToolByName(portal, 'portal_properties')
+    >>> site_props = portal_props.get('site_properties')
+    >>> site_props.getProperty('global_checkout_locator') == ''
+    True
+
+So lets set the checkout location property to the parent folder
+
+    >>> site_props.global_checkout_locator = 'plone.app.iterate.parent'
+
+Test it works
+=============
+
+Confirm we now get it automatically created in that folder
+
+    >>> browser.open(checkout_url)
+    >>> browser.open(portal_url + '/folder_contents')
+    >>> iteration_url = portal_url + '/copy_of_' + title
+    >>> try:
+    ...    iterationlink = browser.getLink(url=iteration_url)
+    ... except LinkNotFoundError:
+    ...    iterationlink = None
+    >>> iterationlink == None
+    False
+
+Cancel the checkout
+
+    >>> browser.open(iteration_url)
+    >>> cancel = browser.getLink(url=iteration_url + '/@@cancel-changes')
+    >>> cancel.click()
+    >>> browser.getControl('Cancel changes').click()
+    >>> 'Checkout cancelled' in browser.contents
+    True
+
+Now set the global location to the user's folder
+
+    >>> site_props.global_checkout_locator = 'plone.app.iterate.home'
+
+Confirm we now get it automatically created in their folder
+
+    >>> browser.open(checkout_url)
+    >>> browser.open(portal_url + '/Members/' + portal_owner)
+    >>> iteration_url = portal_url + '/' + title
+    >>> try:
+    ...    iterationlink = browser.getLink(url=iteration_url)
+    ... except LinkNotFoundError:
+    ...    iterationlink = None
+    >>> iterationlink == None
+    False
+
+

ilrt/formalworkflow/tests/test_functional.py

             'tests/editorpastedelete.txt', package='ilrt.formalworkflow',
             test_class=base.BaseFunctionalTestCase),
 
+        ztc.ZopeDocFileSuite(
+            'tests/iterationlocation.txt', package='ilrt.formalworkflow',
+            test_class=base.BaseFunctionalTestCase),
+
         ])
 
 if __name__ == '__main__':

ilrt/formalworkflow/tests/workflowprocess.txt

     >>> descrip = "A dummy page created by the test handler"
     >>> browser.getControl(name='description').value = descrip
     >>> browser.getControl(name='text').value = "<h1>Test new page</h1>\n\n"
-    >>> browser.getControl(name='form_submit').click()
+    >>> browser.getControl('Save').click()
     >>> "Changes saved." in browser.contents
     True
     >>> new_title in browser.contents
     ...    editlink.click()
     ...    text = "<h1>My manager looks like a duck and walks like a duck</h1>\n"
     ...    browser.getControl(name='text').value = text
-    ...    browser.getControl(name='form_submit').click()
+    ...    browser.getControl('Save').click()
 
 Check to see if the editor has been stopped from publically 
 insulting his manager with formal workflow ...
 
     >>> text = "<h1>My manager looks like a pony</h1>\n"
     >>> browser.getControl(name='text').value = text
-    >>> browser.getControl(name='form_submit').click()
+    >>> browser.getControl('Save').click()
     >>> 'like a pony' in browser.contents
     True
 

ilrt/formalworkflow/version.txt

-0.5
+0.6
 from setuptools import setup, find_packages
 import os
 
-version = '0.5'
+version = '0.6'
 
 setup(name='ilrt.formalworkflow',
       version=version,
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.