8-]


--
"Open source takes the bullshit out of software."
        - Charles Ferguson on TechnologyReview.com

--
Jörn Nettingsmeier, EDV-Administrator
Institut für Politikwissenschaft
Universität Duisburg-Essen, Standort Duisburg
Mail: [EMAIL PROTECTED], Telefon: 0203/379-2736


Index: src/modules/notification/java/src/org/apache/lenya/notification/usecases/ChangeNotification.java
===================================================================
--- src/modules/notification/java/src/org/apache/lenya/notification/usecases/ChangeNotification.java	(revision 0)
+++ src/modules/notification/java/src/org/apache/lenya/notification/usecases/ChangeNotification.java	(revision 0)
@@ -0,0 +1,56 @@
+package org.apache.lenya.notification.usecases;
+
+import org.apache.lenya.cms.usecase.DocumentUsecase;
+import org.apache.avalon.framework.service.ServiceSelector;
+import org.apache.lenya.cms.publication.Document;
+import org.apache.lenya.cms.repository.Node;
+import org.apache.lenya.cms.site.SiteManager;
+import org.apache.lenya.cms.site.SiteStructure;
+import org.apache.lenya.cms.site.SiteUtil;
+import org.apache.lenya.cms.usecase.UsecaseException;
+
+/**
+ * Switch the navigation visibility of a document.
+ */
+public class ChangeNotification extends DocumentUsecase {
+
+    protected void doExecute() throws Exception {
+
+        super.doExecute();
+
+        ServiceSelector selector = null;
+        SiteManager siteManager = null;
+        try {
+            Document document = getSourceDocument();
+            selector = (ServiceSelector) this.manager.lookup(SiteManager.ROLE + "Selector");
+            siteManager = (SiteManager) selector.select(document.getPublication()
+                    .getSiteManagerHint());
+
+            boolean visible = siteManager.isVisibleInNav(document);
+            siteManager.setVisibleInNav(document, !visible);
+        } catch (final Exception e) {
+            throw new RuntimeException(e);
+        } finally {
+            if (selector != null) {
+                if (siteManager != null) {
+                    selector.release(siteManager);
+                }
+                this.manager.release(selector);
+            }
+        }
+    }
+
+    /**
+     * @see org.apache.lenya.cms.usecase.AbstractUsecase#getNodesToLock()
+     */
+    protected Node[] getNodesToLock() throws UsecaseException {
+        try {
+            SiteStructure structure = SiteUtil.getSiteStructure(this.manager, getSourceDocument());
+            Node[] objects = { structure.getRepositoryNode() };
+            return objects;
+        } catch (Exception e) {
+            throw new UsecaseException(e);
+        }
+    }
+
+}
\ No newline at end of file
Index: src/modules/notification/config/cocoon-xconf/usecase-notification-changeNotification.xconf
===================================================================
--- src/modules/notification/config/cocoon-xconf/usecase-notification-changeNotification.xconf	(revision 0)
+++ src/modules/notification/config/cocoon-xconf/usecase-notification-changeNotification.xconf	(revision 0)
@@ -0,0 +1,5 @@
+<?xml version="1.0"?>
+
+<xconf xpath="/cocoon/usecases" unless="/cocoon/usecases/[EMAIL PROTECTED] = 'notification.changeNotification']">
+	<component-instance name="notification.changeNotification" logger="lenya.site" class="org.apache.lenya.notification.usecases.ChangeNotification"/>
+</xconf> 
Index: src/pubs/default/config/menus/generic.xsp
===================================================================
--- src/pubs/default/config/menus/generic.xsp	(revision 372885)
+++ src/pubs/default/config/menus/generic.xsp	(working copy)
@@ -66,6 +66,9 @@
           visibilityChar = "&#x2717;&#160;";
       }
       
+      String notificationChar;
+      notificationChar = "[&#x2713;&#x2717;]";
+      
     </xsp:logic>
     
     <menus>
@@ -117,6 +120,9 @@
           <item uc:usecase="workflow.publish" wf:event="publish" href="?"><i18n:text>Publish</i18n:text></item>
           <item uc:usecase="workflow.deactivate" wf:event="deactivate" href="?"><i18n:text>Deactivate</i18n:text></item>
        </block>
+       <block>
+          <item uc:usecase="notification.changeNotification"><xsp:expr>visibilityChar</xsp:expr><i18n:text>Notify submitter</i18n:text></item>
+       </block>  
       </menu>
 
       <menu i18n:attr="name" name="Help">

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

Reply via email to