svn commit: r634844 - in /lenya/trunk/src: modules-core/administration/config/cocoon-xconf/ modules-core/administration/usecases/ modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/ pubs/default/config/access-control/

[email protected]
Newsgroups gmane.comp.cms.lenya.cvs
Message-ID <[email protected]>
Author: rfrovarp
Date: Fri Mar  7 14:17:14 2008
New Revision: 634844

URL: http://svn.apache.org/viewvc?rev=634844&view=rev
Log:
Adds admin option to fix 44563

Added:
    lenya/trunk/src/modules-core/administration/config/cocoon-xconf/usecase-admin-forceLiveCheckIn.xconf
    lenya/trunk/src/modules-core/administration/usecases/forceLiveCheckIn.jx
    lenya/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/ForceLiveCheckIn.java
Modified:
    lenya/trunk/src/modules-core/administration/config/cocoon-xconf/tabs.xconf
    lenya/trunk/src/pubs/default/config/access-control/usecase-policies.xml

Modified: lenya/trunk/src/modules-core/administration/config/cocoon-xconf/tabs.xconf
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules-core/administration/config/cocoon-xconf/tabs.xconf?rev=634844&r1=634843&r2=634844&view=diff
==============================================================================
--- lenya/trunk/src/modules-core/administration/config/cocoon-xconf/tabs.xconf (original)
+++ lenya/trunk/src/modules-core/administration/config/cocoon-xconf/tabs.xconf Fri Mar  7 14:17:14 2008
@@ -33,5 +33,6 @@
       <tab name="pubConf" label="Publication" usecase="admin.showPubConf"/>
       <tab name="siteOverview" label="Overview" usecase="admin.siteOverview"/>
       <tab name="reports" label="Reports" usecase="admin.reports"/>
+      <tab name="forceLiveCheckIn" label="Live CheckIn" usecase="admin.liveCheckIn"/>
     </tab-group>
   </xconf>

Added: lenya/trunk/src/modules-core/administration/config/cocoon-xconf/usecase-admin-forceLiveCheckIn.xconf
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules-core/administration/config/cocoon-xconf/usecase-admin-forceLiveCheckIn.xconf?rev=634844&view=auto
==============================================================================
--- lenya/trunk/src/modules-core/administration/config/cocoon-xconf/usecase-admin-forceLiveCheckIn.xconf (added)
+++ lenya/trunk/src/modules-core/administration/config/cocoon-xconf/usecase-admin-forceLiveCheckIn.xconf Fri Mar  7 14:17:14 2008
@@ -0,0 +1,31 @@
+<?xml version="1.0"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+<!-- $Id: usecases-workflow-deactivate.xconf 348547 2005-11-23 20:13:01Z chestnut $ -->
+<!--
+    This file defines the publication specific use-cases
+-->
+
+  <xconf xpath="/cocoon/usecases" unless="/cocoon/usecases/component-instance[@name = 'admin.liveCheckIn']">
+    <component-instance name="admin.liveCheckIn" logger="lenya.admin" class="org.apache.lenya.cms.site.usecases.ForceLiveCheckIn">
+      <view uri="modules/administration/usecases/forceLiveCheckIn.jx" menu="true">
+        <tab group="admin" name="forceLiveCheckIn"/>
+      </view>
+      <exit usecase="admin.liveCheckIn"/>
+    </component-instance>
+  </xconf>

Added: lenya/trunk/src/modules-core/administration/usecases/forceLiveCheckIn.jx
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules-core/administration/usecases/forceLiveCheckIn.jx?rev=634844&view=auto
==============================================================================
--- lenya/trunk/src/modules-core/administration/usecases/forceLiveCheckIn.jx (added)
+++ lenya/trunk/src/modules-core/administration/usecases/forceLiveCheckIn.jx Fri Mar  7 14:17:14 2008
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<!-- $Id: emptyTrash.jx 509523 2007-02-20 11:59:48Z andreas $ -->
+
+<page:page
+  xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
+  xmlns:page="http://apache.org/cocoon/lenya/cms-page/1.0"
+  xmlns="http://www.w3.org/1999/xhtml"
+  xmlns:i18n="http://apache.org/cocoon/i18n/2.1"    
+  >
+  
+  <page:body>
+    <jx:import uri="fallback://lenya/modules/usecase/templates/tabs.jx"/>
+    <div id="contentblock1" class="lenya-tab">
+    <h1><i18n:text>Live CheckIn</i18n:text></h1>
+      
+      <jx:import uri="fallback://lenya/modules/usecase/templates/messages.jx"/>
+    <form id="form-live_checkin" style="margin-top: 20px">
+      <input type="hidden" name="lenya.continuation" value="${continuation.id}"/>
+      <input type="hidden" name="lenya.usecase" value="${request.getParameter('lenya.usecase')}"/>
+      <input i18n:attr="value" name="submit" type="submit" value="Submit"/>
+    </form>
+    </div>
+  </page:body>
+</page:page>

Added: lenya/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/ForceLiveCheckIn.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/ForceLiveCheckIn.java?rev=634844&view=auto
==============================================================================
--- lenya/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/ForceLiveCheckIn.java (added)
+++ lenya/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/ForceLiveCheckIn.java Fri Mar  7 14:17:14 2008
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+package org.apache.lenya.cms.site.usecases;
+
+import org.apache.lenya.cms.publication.Publication;
+import org.apache.lenya.cms.publication.PublicationException;
+import org.apache.lenya.cms.publication.PublicationUtil;
+import org.apache.lenya.cms.repository.Node;
+import org.apache.lenya.cms.usecase.AbstractUsecase;
+
+/**
+ * Force check in of the live node 
+ * 
+ */
+public class ForceLiveCheckIn extends AbstractUsecase {
+
+    /**
+     * @see org.apache.lenya.cms.usecase.AbstractUsecase#doCheckPreconditions()
+     */
+    protected void doCheckPreconditions() throws Exception {
+        super.doCheckPreconditions();
+        Publication pub = getPublication();
+        if(pub == null) {
+            return;
+        }
+        Node node = getNode();
+        if (!node.isCheckedOut()) {
+            String[] params = { "Live" };
+            addErrorMessage("not-checked-out", params);
+        }
+    }
+
+    /**
+     * @see org.apache.lenya.cms.usecase.AbstractUsecase#doExecute()
+     */
+    protected void doExecute() throws Exception {
+        super.doExecute();
+
+        getNode().forceCheckIn();
+
+    }
+
+    private Node getNode() throws PublicationException {
+        return getPublication().getArea(Publication.LIVE_AREA).getSite().getRepositoryNode();
+    }
+ 
+    private Publication getPublication() throws PublicationException {
+        return PublicationUtil.getPublicationFromUrl(this.manager, getDocumentFactory(),getSourceURL());
+    }
+}

Modified: lenya/trunk/src/pubs/default/config/access-control/usecase-policies.xml
URL: http://svn.apache.org/viewvc/lenya/trunk/src/pubs/default/config/access-control/usecase-policies.xml?rev=634844&r1=634843&r2=634844&view=diff
==============================================================================
--- lenya/trunk/src/pubs/default/config/access-control/usecase-policies.xml (original)
+++ lenya/trunk/src/pubs/default/config/access-control/usecase-policies.xml Fri Mar  7 14:17:14 2008
@@ -251,6 +251,9 @@
   <usecase id="admin.emptyTrash">
     <role id="admin" method="grant"/>
   </usecase>
+  <usecase id="admin.liveCheckIn">
+    <role id="admin" method="grant"/>
+  </usecase>
   <usecase id="admin.group">
     <role id="admin" method="grant"/>
   </usecase>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.