|
Profiles /
Scott ConnardHello Fellow PmWikians, I am using PmWiki for everything I can think of. I've set up a farm on a Mac OS X system at work and use it for two separate work projects and also a Community Theater that I am very active with. So far I have experimented with farm installation, CleanURLs, setting skins, RSS feeds, user authorization, WikiForms, Pm Calendar and Save Draft. I like PmWiki a lot, but as I've seen mentioned elsewhere, it is wonderfully simple to set up and begin to use, but some of the more in-depth features take some time to research and get used to. All in all, a great product and a helpful group of people using it. While I am a programmer, I do not (yet) know php, so I'm not contributing anything to the project at this point. Scott Connard (email: connard (at) dsg-inc (dot) com) PmWiki scripts I use:AuthUser
Cookbook recipes I use:Action Log
My Farm Implementation (with CleanURLs)Since there are so many different variants on PmWiki farm implementations, I thought I'd document mine. I'm running a Mac OS X system so I have complete access to all the configuration files.
Save DraftI wanted to have Save Draft turned on for a single group ("Test" in the following examples). I needed to allow authorized users perform the draft edits and a small group of special people "publish" the drafts. I used the built-in AuthUser script and its associated Site.AuthUser page to declare users and groups. This feature become much easier to implement after 2.2.0-beta43. Site.SideBarI have login/logout links in my Site.SideBar.
(:if ! enabled AuthPw:)
* [[{$FullName}?action=login | Login]]
(:if enabled AuthPw:)
* [[Main/HomePage?action=logout | Logout {$AuthId}]]
(:ifend:)
Test.EditForm (This change is not needed any longer)This EditForm simply displays different Save buttons depending on your authorization level. (:if auth publish:) (:input e_savebutton:) (:input e_saveeditbutton:) (:input e_savedraftbutton:) \\ (:input e_previewbutton:) (:input e_cancelbutton:) (:if ! auth publish:) (:input e_savedraftbutton value="Save Draft":) (:input e_previewbutton:) (:input e_cancelbutton:) (:ifend:) You can see that users without the publish permission can only use the Save Draft button to save a draft copy, while the privileged publishers can Save or Save Draft. I did not get as fancy as some of the suggested button naming schemes suggest (see PITS/00755). You must create the EditForm page before creating the following Test.phpThe group configuration parameters that would have gone in the
<?php
# turn on draft edits
$EnableDrafts = 1;
# use special edit form with button swapping
$PageEditForm = 'Test.EditForm';
# create a publish password for Drafts
$DefaultPasswords['publish'] = crypt('publish');
$AuthCascade['publish'] = 'edit';
$PageAttributes['passwdpublish'] = '$[Set new publish password:]';
After 2.2.0-beta43, only the following configuration is necessary.
<?php
# turn on draft edits
$EnableDrafts = 1;
$EnablePublish = 1;
# create a publish password for Drafts
$DefaultPasswords['publish'] = crypt('publish');
Test.GroupAttributesI created this file using ?action=attr so I could specify a group edit password and allow all registered users to edit (editpassword id:*) and set the publish password (@publishers). Test.GroupHeaderI placed some conditional code in the group header to let the users know if a draft page existed so that they had the choice of viewing the official page or the draft page. PmWiki automatically selects the draft page (if it exists) for editing if a user decides to edit either page.
(:if exists {$FullName}-Draft:)
%red bgcolor=pink padding=10px border='1px solid black'%[[{$FullName}-Draft]] exists%%
(:ifend:)
With the new PmWiki 2.1.beta, the # define Basename of draft documents $BaseNamePatterns['/-Draft$/'] = '';
(:if exists {$FullName}-Draft:)
%red bgcolor=pink padding=10px border='1px solid black'% [[{$FullName}-Draft]] exists %%
(:if ( name {$BaseName}-Draft && exists {$BaseName} ) :)
%red bgcolor=lightblue padding=10px border='1px solid black'% [[{$BaseName} | official {$BaseName}]] %%
(:ifend:)
With PmWiki 2.2 beta, I'm using the following.
(:if exists {*$FullName}-Draft:)
%red bgcolor=pink padding=10px border='1px solid black'% A DRAFT page exists: [[{*$FullName}-Draft]] %%
(:if ( name {*$BaseName}-Draft && exists {*$BaseName} ) :)
%red bgcolor=pink padding=10px border='1px solid black'% This is a DRAFT page of [[{*$BaseName}]] %%
(:if ( name *-Draft && equal {$BaseName} '' ) :)
%red bgcolor=pink padding=10px border='1px solid black'% This is a DRAFT page %%
(:if:)
|