ApprovePageAction
Description
This action makes it possible to use MoinMoin wiki for ISO 900x documentation or other documentation systems which require identification of document versions and approval status. The action allow a user with approve acl right to approve a revision of a page.
Contents
Installation
Enable acl and add a new approve right in your wiki configuration:
acl_rights_valid = ["read", "write", "delete", "revert", "admin", "approve"] acl_enabled = 1
Put ApprovePage.py in your wiki/data/plugin/action/ directory
Put modified modern_iso.py in your wiki/data/plugin/theme/ directory
Discussion
First, there is no need to include this in 1.5 core code, this should be a separate action, I may be included in the future if it is usable for many users, and after we review the code.
If you need this action directly on the editbar and want to support 1.3 wikis copy the method in your theme and change it,like its done inModernCmsTheme. If you need only to support 1.5, simplyoverrideeditbarItems, introduced in patch-100. --NirSoffer2005-10-18 15:11:32
I changed it to the editbarItems, have a look. Robert Penz 2005-11-08 15:52:00 RobertPenz
Another approach to ISO (Moin Moin 1.5.x only)
I needed add support for some ISO procedures to my company wiki, with some requirements:
- The current pages to be left with the acl that we are working now
- The users can modify all pages normally, but not the ones for ISO
- Known Users must always be capable of reading the last approved version
- Reviewers and Managers must be able to edit the current version hidden from the user
- Managers must be able to release a version to the public
I used the macro and the theme but modifed Page.py to fit my need.
- I added an additional acl right: "review"
- All pages that want to be usable with the review/approve method must add to the page: "#review yes"
Todo/Known Issues
The redirecting code to the last approved revision has a bug, when you log out is can sometimes enter in a loop
PageApproval.diff (Patch Against MoinMoin 1.5.8)
MatiasVidal <matiasv AT gmail DOT com> - 2008-02-12 00:56:22
Update
Here is an update for the theme and the action so that it also works on Moin >1.5. Please remove the version number. Do also create a in htdocs a new folder modern_iso, which should be a simple clone of the existing modern directory.
approvepage2.py (Please do not change that in capital letters, just remove the version number..)
Moin 1.6.x
in order to get this action running on Moin >1.6 remove 'request, ' out of line 40 and 80 in approvepage.py
2008-04-10 FrankSteinhauer
- In the file approvepage2.py there are six occurences of "return page.send_page(request, msg=xxx)", and they all need to be converted to "return page.send_page(msg=xxx)"
- Page.py:
- The file is located in your python site-packages directory (e.g. /usr/local/lib/python2.5/site-packages/MoinMoin/Page.py).
QUESTION: The Diff above does not work her, what exactly is to be changed to get the "review"?
Moin 1.7.x
Does anyone know what needs to be changed to have this running on Moin1.7.2?
In my case (updated from 1.6.3; running on IIS; Python 2.5.1) the header-info if approved or not is working on existing as well as new pages. The action it self does nothing / does not ask 'really approve?'. The page is just reloads.
Moin 1.9.1 (Solenoid theme)
I found a feature like this very useful, so I adapted the action and the theme modifications discussed on this page to an installation of Moin 1.9.1 and the Solenoid theme. Since I'm completely new to Python and Moin development, I would really appreciate if anybody with some experience could review the code. Is there any way to make it more portable to future versions of Moin? Do you see any obvious issues with the code? -- 2010-02-05 <lameike AT gmx DOT net>
Features
- Two new user rights "review" and "approve"
- Displays a big admonition at the top of pages that contain "#review". This admonition tells the approval status of the page (draft, approved, outdated) and a history of previously approved versions.
Users with the "approve" right can use ApprovePageAction to mark a page version as approved
- Users with the "review" right may edit an approved version. These new versions will get the draft status
- Users without the "review" right may not edit approved versions. They will also be redirected to the latest approved version (instead of the newest draft version).
Screenshot
Changes
An updated version of ApproveAction.py (placed in the wiki directory at data/plugin/action/ApprovePage.py): ApprovePage.py
A modified version of the Solenoid theme (placed in the wiki directory at data/plugin/theme/solenoid_iso.py): solenoid_iso.py Diff to solenoid.py 2009.12.5
A modified version of Page.py to display version information about a page (in Moin installation directory): Page.py Diff to Moin 1.9.1 Page.py
Extension for CMS themes
By patching page.py as follows, only approved pages are visible to unknow, non-logged-in-visitors (Patch against MoinDesktop 1.5.5a-1).
Moin 1.9.3 (standard themes)
I upgraded the changes of Oliver Siemoneit, added some stuff of lameike and improved code a bit. The purpose is the same, add two new access rights (approve and review) and display only approved versions of a page if the review pragma is set.
Features:
show "approved by" after page name in header (not when doing the actions login, fullsearch, userprefs)
- show "Approve" Button in editbar (after "More Actions" pull-down menu) for users with "approve" right, only shown if current revision is not approved
show approval history below editbar (not when doing the actions login, fullsearch, userprefs)
- show last approved version if user has no "review" right
Files:
Theme modern_iso.py, to be placed in wiki directory at data/plugin/theme/modern_iso.py: modern_iso.py Diff to Moin 1.9.3 modern.py
Theme modernized_iso.py, to be placed in wiki directory at data/plugin/theme/modernized_iso.py: modernized_iso.py Diff to Moin 1.9.3 modernized.py
Theme rightsidebar_iso.py, to be placed in wiki directory at data/plugin/theme/rightsidebar_iso.py:rightsidebar_iso.py
Action approveAction.py, to be placed in the wiki directory at data/plugin/action/approvePage.py: approvePage.py
Page.py, to be placed in the pythyon MoinMoin directory: Page.py Diff to Moin 1.9.1 Page.py
Installation:
- download files and put them in directories as mentioned above
Every theme has a set of static files like css, js and images, and the new themes need those files too. There are two ways to provide those files under python-lib MoinMoin/web/static/htdocs:
for Unix simply create soft links to the appropriate original theme (go to dir and type ln -s modern_iso modern)
- for Windows copy the directories (maybe shortcuts work also - you have to test yourself...)
remove ALL non ISO-themes from MoinMoin/theme. The user must not be able to switch to a non-iso theme
- add approval and review right to acl_rights_valid and for super-user in acl_rights_before to your wikiconfig.py:
acl_rights_valid = ['read', 'write', 'delete', 'revert', 'admin', 'approve', 'review']
acl_rights_before = u"my-admin,AdminGroup:read,write,delete,revert,admin,approve,review"
- for every page that has to be approved add the review pragma:
#review yes
- and add the approval right for the appropriate user in the ACLs, e.g.
#acl ApprovalGroup:delete,read,write,revert,approve,review GsGroup:read,write All:read
-- FrankSteinhauer 2010-11-18 10:44:48
Notes:
The GUI Editor breaks the review pragma, the root cause is that the MoinMoin Wiki Parser do not acknowledge the pragma.
- To Fix it, edit: MoinMoin/parser/text_moin_wiki.py
1 ....
2 # ignore processing instructions
3 if self.in_processing_instructions:
4 found = False
5 for pi in ("##", "#format", "#refresh", "#redirect", "#deprecated",
6 "#pragma", "#form", "#acl", "#language", "#review"):
7 if line.lower().startswith(pi):
8 self.request.write(self.formatter.comment(line))
9 found = True
10 break
11 if not found:
12 self.in_processing_instructions = 0
13 else:
14 continue # do not parse this line
-- MatiasVidal 2014-03-31 18:01:08