Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Lenya Wiki" for change 
notification.

The following page has been changed by BobHarner:
http://wiki.apache.org/lenya/HowToDefaultPublicationUsefulChanges

The comment on the change is:
Added "Interface 1" to "Allow users to override checkouts by other users"

------------------------------------------------------------------------------
  
  '''Why?''' 
  
- Lenya users often begin to edit a document (impicitly checking it out) but 
fail to exit the editor normally -- either by using the browser's Back button, 
by exiting the browser, or by letting the session time out.  This leaves the 
document in a "checked out" state, and only that same user can subsequently 
re-enter the document in the editor.  To others, the page will be locked and 
uneditable.
+ Lenya users often begin to edit a document (implicitly checking it out) but 
fail to exit the editor normally -- by using the browser's Back button, or by 
exiting the browser, or by letting the session time out.  This leaves the 
document in a "checked out" state, and only that same user can subsequently 
re-enter the document in the editor.  To others, the page will be locked and 
uneditable.
  
- Of course, overriding someone else's checkout circumvents the purpose of the 
checkout, and the original editor may loose any unsaved changes.  But in most 
environments the ability to override another's checkout is essential to normal 
web site operations.
+ Of course, overriding someone else's checkout partially subverts the purpose 
of the checkout, and the original editor may loose any unsaved changes.  But in 
most environments the ability to occasionally override another's checkout is 
important to normal web site operations.
  
  '''How?'''
  
+ Step 1: Add an "override-checkout" usecase in {{{lenya/usecases.xmap}}}:
- '''Note: The approach here is not very clean ... but it works!'''
- 
- First of all, you need to decide what "unlock" interface suits your needs:  
1) an "Unlock" button on the error page that tells you that the page is locked 
by another editor, or 2) a menu entry in the Site tab.
- 
- === Interface 1: Unlock Button on Error Page ===
- 
- === Interface 2: Unlock Menu Item on Site Tab ===
- 
- This is done by inserting a new block into the file 
{{{lenya/pubs/<your-pub>/config/menus/generic.xsp}}}:
- 
- {{{
-       <block authoring="false">
- 
-         <xsp:logic>
-         {
-           if (isDocument) {
-             <item uc:usecase="override-checkout" uc:step="showscreen" 
href="?"><i18n:text>Override Checkout</i18n:text></item>
-           }
-           else {
-             <item><i18n:text>Override Checkout</i18n:text></item>
-           }
-         }
-         </xsp:logic>
- 
-       </block>
- 
-       <!-- end inserting here -->
- 
-       </menu>
- 
-       <menu i18n:attr="name" name="Workflow" label="Help">
-           <xsp:logic>
- }}}
- 
- Next we need to have a usecase in {{{lenya/usecases.xmap}}}:
  
  {{{
          <!-- Rename a Label -->
@@ -308, +274 @@

  
  ''To be added: Configure the new usecase in the authorization framework so it 
will not be grayed out!''
  
- Make sure the new {{{forced-checkin}}} action is available in 
{{{global-sitemap.xmap}}}:
+ Step 2: Add a {{{forced-checkin}}} action to {{{global-sitemap.xmap}}}:
  
  {{{
     <map:action name="reserved-checkin" 
src="org.apache.lenya.cms.cocoon.acting.ReservedCheckinAction" 
logger="sitemap.action.reserved-checkin"/>
@@ -318, +284 @@

     <map:action name="rollback" 
src="org.apache.lenya.cms.cocoon.acting.RollbackAction"/>
  }}}
  
- The {{{org.apache.lenya.cms.cocoon.acting.ForcedCheckinAction}}} class and 
the CMS screens are here:
+ Step 3: If you're working with the binary copy of Lenya, copy the 
[attachment:ForcedCheckinAction.class] file into your 
build/lenya/classes/org/apache/lenya/cms/cocoon/acting/ folder. Or, if you're 
working with the Lenya source code, instead copy 
[attachment:ForcedCheckinAction.java] into your existing 
src/java/org/apache/lenya/cms/cocoon/acting/ folder and rebuild Lenya.
  
   * [attachment:override-checkout2.tar.gz]
   * [attachment:ForcedCheckinAction.java]
   * [attachment:ForcedCheckinAction.class]
  
- This solution is based on the fact that the RevisionControler bypasses all 
checks if the user is "System". It might be a better way to introduce a 
parameter in the ReservedCheckinAction class that would allow to set the 
Identity or to set an override flag.
+ Step 4: Decide what "unlock" interface suits your needs.  You can either 1) 
add an "Unlock" button on the error page that tells you that the page is locked 
by another editor, or 2) add a menu entry in the Site tab.  Decide which 
interface to use base on how difficult you want to make it for editors to 
unlock pages.  The first approach is the easiest and most natural for the 
users, but some believe that an unlock action should be difficult to use so as 
to discourage its use.
  
+ === Unlock Interface 1: Button on Error Page ===
+ 
+ In webapp/lenya/resources/i18n/cmsui.xml, add these lines:
+ 
+ {{{
+ <message key="lenya.rc.checkedoutalready.overridewarning">
+     WARNING - To avoid loss of unsaved changes, only unlock a document 
checked out
+     by another user if you require immediate access and that user is 
unavailable.
+ </message>
+ }}}
+ 
+ Add a similar line in any other desired languages to cmsui_LL.xml, where LL 
is the language code.
+ 
+ Modify lenya/lenya/xslt/rc/rco-exception.xsl as follows:
+ 
+ a. After this line:
+ 
+ <p><i18n:text>lenya.rc.checkedoutalready</i18n:text></p>
+ 
+ add this line:
+ 
+ <p><i18n:text>lenya.rc.checkedoutalready.overridewarning</i18n:text></p>
+ 
+ b. Replace the first occurance of these lines (that is, within the 
"rc:file-reserved-checkout-exception" section):
+ 
+ {{{
+ <form>
+ <input type="button" value="OK" onClick="history.go(-1)"/>
+ </form>
+ }}}
+ 
+ with these:
+ 
+ {{{
+ <xsl:param name="lenya.event" select="'delete'"/>
+ <xsl:output version="1.0" indent="yes" encoding="UTF-8"/>
+ <xsl:variable name="document-id"><xsl:value-of 
select="/page/info/document-id"/></xsl:variable>
+ <xsl:variable name="area"><xsl:value-of 
select="/page/info/area"/></xsl:variable>
+ <xsl:variable name="task-id"><xsl:value-of 
select="/page/info/task-id"/></xsl:variable>
+ <xsl:variable name="request-uri"><xsl:value-of 
select="/page/info/request-uri"/></xsl:variable>
+ 
+ <xsl:variable name="nbsp" select="'&#160;'"/>
+ <xsl:value-of select="$document-id"/>
+ <xsl:value-of select="$area"/>
+ <xsl:value-of select="$task-id"/>
+ <xsl:value-of select="$request-uri"/>
+ <script language="JavaScript"  type="text/javascript">
+ function confirmation() {
+     var strMsg = 
"<i18n:text>lenya.rc.checkedoutalready.overridewarning</i18n:text>";
+     if (confirm(strMsg)) { return true;}
+     return false;
+ }
+ </script>
+ <form>
+     <input type="hidden" name="lenya.usecase" value="override-checkout" />
+     <input type="hidden" name="lenya.step" value="override-checkout" />
+     <input type="hidden" name="task-id" value="{$task-id}" />
+     <input type="hidden" name="properties.node.firstdocumentid" 
value="{$document-id}" />
+     <input type="hidden" name="properties.firstarea" value="{$area}" />
+     <input type="hidden" name="properties.secarea" value="trash" />
+     <input type="hidden" name="parenturl" value="{parent-url}" />
+     <input type="button" value="Cancel" onClick="history.go(-1)" />
+     <input type="submit" value="Unlock Document" onClick="return 
confirmation();" />
+ </form>
+ 
+ }}}
+ 
+ === Unlock Interface 2: Menu Item on Site Tab ===
+ 
+ This is done by inserting a new block into the file 
{{{lenya/pubs/<your-pub>/config/menus/generic.xsp}}}:
+ 
+ {{{
+       <block authoring="false">
+         <xsp:logic>
+         {
+           if (isDocument) {
+             <item uc:usecase="override-checkout" uc:step="showscreen" 
href="?"><i18n:text>Override Checkout</i18n:text></item>
+           }
+           else {
+             <item><i18n:text>Override Checkout</i18n:text></item>
+           }
+         }
+         </xsp:logic>
+       </block>
+ 
+       <!-- end inserting here -->
+ 
+       </menu>
+ 
+       <menu i18n:attr="name" name="Workflow" label="Help">
+           <xsp:logic>
+ }}}
+ 
+ 
+ This solution is based on the fact that the RevisionControler bypasses all 
checks if the user is "System". It might be better to introduce a parameter in 
the ReservedCheckinAction class that would enable setting the identity or to 
set an override flag.
+ 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to