You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by gr...@apache.org on 2004/10/26 05:53:10 UTC
svn commit: rev 55566 - in incubator/lenya/branches/BRANCH_1_2_X/src: java/org/apache/lenya/cms/ant java/org/apache/lenya/cms/authoring java/org/apache/lenya/cms/cocoon/acting java/org/apache/lenya/cms/publication test/org/apache/lenya/cms/authoring test/org/apache/lenya/cms/publication webapp/lenya webapp/lenya/content/info webapp/lenya/pubs/default/config/menus webapp/lenya/pubs/default/config/tasks webapp/lenya/pubs/default/lenya/xslt/authoring webapp/lenya/resources/i18n webapp/lenya/xslt/info webapp/lenya/xslt/navigation
Author: gregor
Date: Mon Oct 25 20:53:08 2004
New Revision: 55566
Added:
incubator/lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/cms/ant/ChangeVisibilityTask.java
incubator/lenya/branches/BRANCH_1_2_X/src/webapp/lenya/xslt/info/change-visibility.xsl
Modified:
incubator/lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/cms/ant/DocumentCreatorTask.java
incubator/lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/cms/ant/TreePublisher.java
incubator/lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/cms/authoring/DocumentCreator.java
incubator/lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/cms/cocoon/acting/DefaultCreatorAction.java
incubator/lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/cms/publication/AbstractPublication.java
incubator/lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/cms/publication/DefaultSiteTree.java
incubator/lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/cms/publication/SiteTree.java
incubator/lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/cms/publication/SiteTreeNode.java
incubator/lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/cms/publication/SiteTreeNodeImpl.java
incubator/lenya/branches/BRANCH_1_2_X/src/test/org/apache/lenya/cms/authoring/DocumentCreatorTest.java
incubator/lenya/branches/BRANCH_1_2_X/src/test/org/apache/lenya/cms/publication/SiteTreeNodeImplTest.java
incubator/lenya/branches/BRANCH_1_2_X/src/webapp/lenya/content/info/overview.xsp
incubator/lenya/branches/BRANCH_1_2_X/src/webapp/lenya/pubs/default/config/menus/generic.xsp
incubator/lenya/branches/BRANCH_1_2_X/src/webapp/lenya/pubs/default/config/tasks/targets.xml
incubator/lenya/branches/BRANCH_1_2_X/src/webapp/lenya/pubs/default/config/tasks/tasks.xconf
incubator/lenya/branches/BRANCH_1_2_X/src/webapp/lenya/pubs/default/lenya/xslt/authoring/create.xsl
incubator/lenya/branches/BRANCH_1_2_X/src/webapp/lenya/resources/i18n/cmsui.xml
incubator/lenya/branches/BRANCH_1_2_X/src/webapp/lenya/resources/i18n/cmsui_de.xml
incubator/lenya/branches/BRANCH_1_2_X/src/webapp/lenya/usecase.xmap
incubator/lenya/branches/BRANCH_1_2_X/src/webapp/lenya/xslt/info/info.xsl
incubator/lenya/branches/BRANCH_1_2_X/src/webapp/lenya/xslt/navigation/menu.xsl
incubator/lenya/branches/BRANCH_1_2_X/src/webapp/lenya/xslt/navigation/sitetree2nav.xsl
Log:
#31357
[Patch] Add visibility attribute to node within sitetree (against lenya-1.2.x)
Added: incubator/lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/cms/ant/ChangeVisibilityTask.java
==============================================================================
--- (empty file)
+++ incubator/lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/cms/ant/ChangeVisibilityTask.java Mon Oct 25 20:53:08 2004
@@ -0,0 +1,124 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation
+ *
+ * Licensed 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: ChangeVisibilityTask.java 42616 2004-09-22 12:56:33Z jaf $ */
+
+package org.apache.lenya.cms.ant;
+
+import org.apache.lenya.cms.publication.DefaultSiteTree;
+import org.apache.lenya.cms.publication.DocumentException;
+import org.apache.lenya.cms.publication.Label;
+import org.apache.lenya.cms.publication.SiteTreeException;
+import org.apache.lenya.cms.publication.SiteTreeNode;
+import org.apache.lenya.cms.publication.SiteTreeNodeImpl;
+import org.apache.tools.ant.BuildException;
+
+/**
+ * Ant task to change the visbility of a node in the navigation.
+ */
+public class ChangeVisibilityTask extends PublicationTask {
+ private String documentid;
+ private String area;
+
+ /**
+ * Creates a new instance of InsertLabelTask
+ */
+ public ChangeVisibilityTask() {
+ super();
+ }
+
+ /**
+ * Get the area of the site tree.
+ *
+ * @return the area of the tree.
+ */
+ protected String getArea() {
+ return area;
+ }
+
+ /**
+ * Set the area.
+ *
+ * @param area the area.
+ */
+ public void setArea(String area) {
+ this.area = area;
+ }
+
+ /**
+ * Return the document-id corresponding to the node to delete.
+ *
+ * @return string The document-id.
+ */
+ protected String getDocumentid() {
+ return documentid;
+ }
+
+ /**
+ * Set the value of the document-id corresponding to the node to delete.
+ *
+ * @param string The document-id.
+ */
+ public void setDocumentid(String string) {
+ documentid = string;
+ }
+
+ /**
+ * Change the visibility of an existing node in the tree.
+ *
+ * @param documentid the document-id of the document.
+ * @param area determines in which sitetree the label is to be renamed
+ *
+ * @throws SiteTreeException if an error occurs.
+ */
+ public void changeVisibility(
+ String documentid,
+ String area)
+ throws SiteTreeException, DocumentException {
+
+ DefaultSiteTree tree = null;
+ tree = getPublication().getSiteTree(area);
+ SiteTreeNode node = tree.getNode(documentid);
+
+ if (node == null) {
+ throw new DocumentException(
+ "Document-id " + documentid + " not found.");
+ }
+
+ //if node is visible change to fale and vice versa
+ String visibility = "false";
+ if (!node.visibleInNav()) visibility = "true";
+ node.setNodeAttribute(SiteTreeNodeImpl.VISIBLEINNAV_ATTRIBUTE_NAME, visibility);
+
+ tree.save();
+ }
+
+ /** (non-Javadoc)
+ * @see org.apache.tools.ant.Task#execute()
+ */
+ public void execute() throws BuildException {
+ try {
+ log("document-id corresponding to the node: " + getDocumentid());
+ log("area: " + getArea());
+ changeVisibility(
+ getDocumentid(),
+ getArea());
+ } catch (Exception e) {
+ throw new BuildException(e);
+ }
+ }
+}
Modified: incubator/lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/cms/ant/DocumentCreatorTask.java
==============================================================================
--- incubator/lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/cms/ant/DocumentCreatorTask.java (original)
+++ incubator/lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/cms/ant/DocumentCreatorTask.java Mon Oct 25 20:53:08 2004
@@ -15,7 +15,7 @@
*
*/
-/* $Id: DocumentCreatorTask.java,v 1.8 2004/03/03 12:56:30 gregor Exp $ */
+/* $Id$ */
package org.apache.lenya.cms.ant;
@@ -34,6 +34,7 @@
private String area;
private String authoringPath;
private String language;
+ private boolean visibleInNav;
/**
* (non-Javadoc)
@@ -52,7 +53,8 @@
getChildName(),
getChildType(),
documentType,
- getLanguage());
+ getLanguage(),
+ getVisibleInNav());
} catch (CreatorException e) {
throw new BuildException(e);
}
@@ -219,5 +221,24 @@
public void setArea(String area) {
this.area = area;
}
+
+ /**
+ * Set the visiblity of a node
+ *
+ * @param boolean visibleInNav
+ */
+ public void setVisibleInNav(boolean visible) {
+ visibleInNav = visible;
+ }
+
+ /**
+ * Get the visiblity of a node
+ *
+ * @param boolean visibleinnav
+ */
+ public boolean getVisibleInNav() {
+; return visibleInNav;
+ }
+
}
Modified: incubator/lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/cms/ant/TreePublisher.java
==============================================================================
--- incubator/lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/cms/ant/TreePublisher.java (original)
+++ incubator/lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/cms/ant/TreePublisher.java Mon Oct 25 20:53:08 2004
@@ -15,7 +15,7 @@
*
*/
-/* $Id: TreePublisher.java,v 1.14 2004/08/16 12:06:45 andreas Exp $ */
+/* $Id$ */
package org.apache.lenya.cms.ant;
@@ -136,9 +136,9 @@
// add the specified label to it.
Label[] labels = { label };
try {
- liveTree.addNode(documentId, labels, authoringNode.getHref(),
- authoringNode.getSuffix(), authoringNode.hasLink(),
- siblingDocId);
+ liveTree.addNode(documentId, labels, authoringNode.visibleInNav(),
+ authoringNode.getHref(),authoringNode.getSuffix(),
+ authoringNode.hasLink(),siblingDocId);
} catch (SiteTreeException e1) {
throw new ParentNodeNotFoundException("Couldn't add document: "
+ documentId + " to live tree.", e1);
Modified: incubator/lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/cms/authoring/DocumentCreator.java
==============================================================================
--- incubator/lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/cms/authoring/DocumentCreator.java (original)
+++ incubator/lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/cms/authoring/DocumentCreator.java Mon Oct 25 20:53:08 2004
@@ -15,7 +15,7 @@
*
*/
-/* $Id: DocumentCreator.java,v 1.7 2004/03/03 12:56:32 gregor Exp $ */
+/* $Id$ */
package org.apache.lenya.cms.authoring;
@@ -42,6 +42,7 @@
* @param childTypeString DOCUMENT ME!
* @param documentTypeName DOCUMENT ME!
* @param language the language of the document to be created.
+ * @param visibleInNav boolean determines wether the node.
*
* @throws CreatorException DOCUMENT ME!
*/
@@ -54,7 +55,8 @@
String childName,
String childTypeString,
String documentTypeName,
- String language)
+ String language,
+ boolean visibleInNav)
throws CreatorException {
short childType;
@@ -104,7 +106,8 @@
siteTree.addNode(
parentId,
creator.generateTreeId(childId, childType),
- labels);
+ labels,
+ visibleInNav);
} catch (Exception e) {
throw new CreatorException(e);
}
Modified: incubator/lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/cms/cocoon/acting/DefaultCreatorAction.java
==============================================================================
--- incubator/lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/cms/cocoon/acting/DefaultCreatorAction.java (original)
+++ incubator/lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/cms/cocoon/acting/DefaultCreatorAction.java Mon Oct 25 20:53:08 2004
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-/* $Id: DefaultCreatorAction.java,v 1.12 2004/03/02 16:41:43 michi Exp $ */
+/* $Id$ */
package org.apache.lenya.cms.cocoon.acting;
@@ -115,9 +115,15 @@
//String childtype = request.getParameter("childtype");
String childtype = request.getParameter("properties.create.child-type");
log.debug("properties.create.childtype = " + childtype);
-
-
-
+
+ //String visibleInNav = request.getParameter("visible");
+ String visible = request.getParameter("properties.create.visible");
+
+ boolean visibleInNav = true;
+ if (visible.equals("no")){
+ visibleInNav = false;
+ }
+
short childType;
if (childtype.equals("branch")) {
childType = ParentChildCreatorInterface.BRANCH_NODE;
@@ -199,7 +205,7 @@
DefaultSiteTree siteTree = publication.getSiteTree(Publication.AUTHORING_AREA);
Label[] labels = new Label[1];
labels[0] = new Label(childname, language);
- siteTree.addNode(parentid, creator.generateTreeId(childid, childType), labels);
+ siteTree.addNode(parentid, creator.generateTreeId(childid, childType), labels, visibleInNav);
// Transaction should actually be finished here!
// Create actual document
Modified: incubator/lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/cms/publication/AbstractPublication.java
==============================================================================
--- incubator/lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/cms/publication/AbstractPublication.java (original)
+++ incubator/lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/cms/publication/AbstractPublication.java Mon Oct 25 20:53:08 2004
@@ -15,7 +15,7 @@
*
*/
-/* $Id: AbstractPublication.java,v 1.21 2004/07/22 13:44:16 andreas Exp $ */
+/* $Id$ */
package org.apache.lenya.cms.publication;
@@ -438,7 +438,8 @@
}
}
}
-
+
+
Label label = sourceNode.getLabel(sourceDocument.getLanguage());
if (label == null) {
// the node that we're trying to publish
@@ -454,10 +455,10 @@
if (siblingDocId == null) {
destinationTree.addNode(destinationDocument.getId(), labels,
- sourceNode.getHref(), sourceNode.getSuffix(), sourceNode
+ sourceNode.visibleInNav(), sourceNode.getHref(), sourceNode.getSuffix(), sourceNode
.hasLink());
} else {
- destinationTree.addNode(destinationDocument.getId(), labels,
+ destinationTree.addNode(destinationDocument.getId(), labels, sourceNode.visibleInNav(),
sourceNode.getHref(), sourceNode.getSuffix(), sourceNode
.hasLink(), siblingDocId);
}
@@ -467,6 +468,12 @@
// tree simply insert the label in the
// live tree
destinationTree.setLabel(destinationDocument.getId(), label);
+ //and synchronize visibilityinnav attribute with the one in the source area
+ String visibility ="true";
+ if (!sourceNode.visibleInNav()) visibility = "false";
+ destinationNode.setNodeAttribute(SiteTreeNodeImpl.VISIBLEINNAV_ATTRIBUTE_NAME,
+ visibility);
+
}
}
}
Modified: incubator/lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/cms/publication/DefaultSiteTree.java
==============================================================================
--- incubator/lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/cms/publication/DefaultSiteTree.java (original)
+++ incubator/lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/cms/publication/DefaultSiteTree.java Mon Oct 25 20:53:08 2004
@@ -15,7 +15,7 @@
*
*/
-/* @version $Id: DefaultSiteTree.java,v 1.46 2004/08/16 12:23:52 andreas Exp $ */
+/* @version $Id$ */
package org.apache.lenya.cms.publication;
@@ -206,6 +206,7 @@
node.getAbsoluteParentId(),
node.getId(),
node.getLabels(),
+ node.visibleInNav(),
node.getHref(),
node.getSuffix(),
node.hasLink(),
@@ -214,8 +215,8 @@
/** (non-Javadoc)
* @see org.apache.lenya.cms.publication.SiteTree#addNode(java.lang.String, java.lang.String, org.apache.lenya.cms.publication.Label[])
*/
- public void addNode(String parentid, String id, Label[] labels) throws SiteTreeException {
- addNode(parentid, id, labels, null, null, false);
+ public void addNode(String parentid, String id, Label[] labels, boolean visibleInNav ) throws SiteTreeException {
+ addNode(parentid, id, labels, visibleInNav, null, null, false);
}
/** (non-Javadoc)
@@ -231,6 +232,7 @@
public void addNode(
String documentid,
Label[] labels,
+ boolean visibleInNav,
String href,
String suffix,
boolean link,
@@ -245,7 +247,7 @@
}
String id = st.nextToken();
- this.addNode(parentid, id, labels, href, suffix, link, refDocumentId);
+ this.addNode(parentid, id, labels, visibleInNav, href, suffix, link, refDocumentId);
}
/** (non-Javadoc)
@@ -254,11 +256,12 @@
public void addNode(
String documentid,
Label[] labels,
+ boolean visibleInNav,
String href,
String suffix,
boolean link)
throws SiteTreeException {
- this.addNode(documentid, labels, href, suffix, link, null);
+ this.addNode(documentid, labels, visibleInNav, href, suffix, link, null);
}
/** (non-Javadoc)
* @see org.apache.lenya.cms.publication.SiteTree#addNode(java.lang.String, java.lang.String, org.apache.lenya.cms.publication.Label[], java.lang.String, java.lang.String, boolean)
@@ -267,11 +270,12 @@
String parentid,
String id,
Label[] labels,
+ boolean visibleInNav,
String href,
String suffix,
boolean link)
throws SiteTreeException {
- this.addNode(parentid, id, labels, href, suffix, link, null);
+ this.addNode(parentid, id, labels, visibleInNav, href, suffix, link, null);
}
/** (non-Javadoc)
@@ -281,6 +285,7 @@
String parentid,
String id,
Label[] labels,
+ boolean visibleInNav,
String href,
String suffix,
boolean link,
@@ -309,6 +314,12 @@
NamespaceHelper helper = new NamespaceHelper(NAMESPACE_URI, "", document);
Element child = helper.createElement(SiteTreeNodeImpl.NODE_NAME);
child.setAttribute(SiteTreeNodeImpl.ID_ATTRIBUTE_NAME, id);
+
+ if (visibleInNav) {
+ child.setAttribute(SiteTreeNodeImpl.VISIBLEINNAV_ATTRIBUTE_NAME, "true");
+ } else {
+ child.setAttribute(SiteTreeNodeImpl.VISIBLEINNAV_ATTRIBUTE_NAME, "false");
+ }
if ((href != null) && (href.length() > 0)) {
child.setAttribute(SiteTreeNodeImpl.HREF_ATTRIBUTE_NAME, href);
@@ -525,6 +536,7 @@
parentId,
id,
subtreeRoot.getLabels(),
+ true,
subtreeRoot.getHref(),
subtreeRoot.getSuffix(),
subtreeRoot.hasLink(),
Modified: incubator/lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/cms/publication/SiteTree.java
==============================================================================
--- incubator/lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/cms/publication/SiteTree.java (original)
+++ incubator/lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/cms/publication/SiteTree.java Mon Oct 25 20:53:08 2004
@@ -15,7 +15,7 @@
*
*/
-/* $Id: SiteTree.java,v 1.21 2004/03/01 16:18:16 gregor Exp $ */
+/* $Id$ */
package org.apache.lenya.cms.publication;
@@ -30,7 +30,7 @@
*
* @throws SiteTreeException if the addition failed
*/
- void addNode(String parentid, String id, Label[] labels)
+ void addNode(String parentid, String id, Label[] labels, boolean visibleInNav)
throws SiteTreeException;
/**
@@ -39,6 +39,7 @@
* @param parentid the node where the new node is to be inserted
* @param id the node id
* @param labels the labels
+ * @param visibleInNav the visibility of a node in the navigation
* @param href the href of the new node
* @param suffix the suffix of the new node
* @param link the link
@@ -49,6 +50,7 @@
String parentid,
String id,
Label[] labels,
+ boolean visibleInNav,
String href,
String suffix,
boolean link)
@@ -59,7 +61,8 @@
*
* @param parentid the node where the new node is to be inserted
* @param id the node id
- * @param labels the labels
+ * @param labels the labels
+ * @param visibleInNav the visibility of a node in the navigation
* @param href the href of the new node
* @param suffix the suffix of the new node
* @param link the link
@@ -71,6 +74,7 @@
String parentid,
String id,
Label[] labels,
+ boolean visibleInNav,
String href,
String suffix,
boolean link,
@@ -93,6 +97,7 @@
void addNode(
String documentid,
Label[] labels,
+ boolean visibleInNav,
String href,
String suffix,
boolean link)
@@ -115,6 +120,7 @@
void addNode(
String documentid,
Label[] labels,
+ boolean visibleInNav,
String href,
String suffix,
boolean link,
Modified: incubator/lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/cms/publication/SiteTreeNode.java
==============================================================================
--- incubator/lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/cms/publication/SiteTreeNode.java (original)
+++ incubator/lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/cms/publication/SiteTreeNode.java Mon Oct 25 20:53:08 2004
@@ -15,7 +15,7 @@
*
*/
-/* $Id: SiteTreeNode.java,v 1.19 2004/03/01 16:18:17 gregor Exp $ */
+/* $Id$ */
package org.apache.lenya.cms.publication;
@@ -101,6 +101,15 @@
void removeLabel(Label label);
/**
+ * Check whether this node is visible in the navigation
+ *
+ * @return true if this node is visible. The method should also
+ * return true if the attribute is not set. That means a node missing
+ * this attribute becomes visible by default.
+ */
+ boolean visibleInNav();
+
+ /**
* Get the href of this node.
*
* @return the href.
@@ -183,13 +192,22 @@
* @throws DocumentException if an error occurs
*/
void acceptReverseSubtree(SiteTreeNodeVisitor visitor) throws DocumentException;
- /**
+
+ /**
* Sets a label of an this node. If the label does not exist, it is added.
* Otherwise, the existing label is replaced.
*
* @param label the label to add
*/
void setLabel(Label label);
+
+ /**
+ * Sets an attribute of this node. If the attribute already exists its value will be overwritten
+ *
+ * @param attributeName name of the attribute
+ * @param attributeValue the value of the respective attribute
+ */
+ void setNodeAttribute (String attributeName, String attributeValue);
/**
* Give a list of the children and this node in a pre order way
Modified: incubator/lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/cms/publication/SiteTreeNodeImpl.java
==============================================================================
--- incubator/lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/cms/publication/SiteTreeNodeImpl.java (original)
+++ incubator/lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/cms/publication/SiteTreeNodeImpl.java Mon Oct 25 20:53:08 2004
@@ -15,7 +15,7 @@
*
*/
-/* $Id: SiteTreeNodeImpl.java,v 1.27 2004/03/01 16:18:17 gregor Exp $ */
+/* $Id$ */
package org.apache.lenya.cms.publication;
@@ -38,6 +38,7 @@
public class SiteTreeNodeImpl implements SiteTreeNode {
private static Category log = Category.getInstance(SiteTreeNodeImpl.class);
public static final String ID_ATTRIBUTE_NAME = "id";
+ public static final String VISIBLEINNAV_ATTRIBUTE_NAME="visibleinnav";
public static final String HREF_ATTRIBUTE_NAME = "href";
public static final String SUFFIX_ATTRIBUTE_NAME = "suffix";
public static final String LINK_ATTRIBUTE_NAME = "link";
@@ -107,6 +108,7 @@
public String getAbsoluteId() {
String absoluteId = "";
Node currentNode = node;
+
NamedNodeMap attributes = null;
Node idAttribute = null;
@@ -228,7 +230,20 @@
}
}
}
+
+ /**
+ * @see org.apache.lenya.cms.publication.SiteTreeNode#hasLink()
+ */
+ public boolean visibleInNav() {
+ Node attribute = node.getAttributes().getNamedItem(VISIBLEINNAV_ATTRIBUTE_NAME);
+ if (attribute != null) {
+ return attribute.getNodeValue().equals("true");
+ } else {
+ return true;
+ }
+ }
+
/**
* @see org.apache.lenya.cms.publication.SiteTreeNode#getHref()
*/
@@ -241,7 +256,7 @@
return null;
}
}
-
+
/**
* @see org.apache.lenya.cms.publication.SiteTreeNode#getSuffix()
*/
@@ -387,6 +402,14 @@
addLabel(label);
}
+ /**
+ * @see org.apache.lenya.cms.publication.SiteTreeNode#setLabel(org.apache.lenya.cms.publication.Label)
+ */
+ public void setNodeAttribute (String attributeName, String attributeValue) {
+ Element element = (Element) node;
+ element.setAttribute(attributeName, attributeValue);
+ }
+
/**
* @see org.apache.lenya.cms.publication.SiteTreeNode#getChildren(java.lang.String)
*/
Modified: incubator/lenya/branches/BRANCH_1_2_X/src/test/org/apache/lenya/cms/authoring/DocumentCreatorTest.java
==============================================================================
--- incubator/lenya/branches/BRANCH_1_2_X/src/test/org/apache/lenya/cms/authoring/DocumentCreatorTest.java (original)
+++ incubator/lenya/branches/BRANCH_1_2_X/src/test/org/apache/lenya/cms/authoring/DocumentCreatorTest.java Mon Oct 25 20:53:08 2004
@@ -15,7 +15,7 @@
*
*/
-/* $Id: DocumentCreatorTest.java,v 1.8 2004/03/04 15:41:09 egli Exp $ */
+/* $Id$ */
package org.apache.lenya.cms.authoring;
@@ -78,7 +78,7 @@
File authoringDirectory = new File(publication.getDirectory(), AUTHORING_DIR);
creator.create(publication, authoringDirectory, AREA, PARENT_ID, CHILD_ID, CHILD_NAME,
- CHILD_TYPE, DOCUMENT_TYPE, DOCUMENT_LANGUAGE);
+ CHILD_TYPE, DOCUMENT_TYPE, DOCUMENT_LANGUAGE, VISIBLEINNAV);
File documentFile = new File(authoringDirectory, CREATED_FILE);
assertTrue(documentFile.exists());
@@ -100,6 +100,7 @@
protected static final String CREATED_FILE = "tutorial/test-document/index_en.xml";
protected static final String DOCUMENT_LANGUAGE = "en";
protected static final String AREA = "authoring";
+ protected static final boolean VISIBLEINNAV =true;
/** @see junit.framework.TestCase#setUp() */
protected void setUp() throws Exception {
Modified: incubator/lenya/branches/BRANCH_1_2_X/src/test/org/apache/lenya/cms/publication/SiteTreeNodeImplTest.java
==============================================================================
--- incubator/lenya/branches/BRANCH_1_2_X/src/test/org/apache/lenya/cms/publication/SiteTreeNodeImplTest.java (original)
+++ incubator/lenya/branches/BRANCH_1_2_X/src/test/org/apache/lenya/cms/publication/SiteTreeNodeImplTest.java Mon Oct 25 20:53:08 2004
@@ -15,7 +15,7 @@
*
*/
-/* $Id: SiteTreeNodeImplTest.java,v 1.4 2004/03/04 15:41:09 egli Exp $ */
+/* $Id$ */
package org.apache.lenya.cms.publication;
@@ -51,13 +51,14 @@
DefaultSiteTree siteTree = new DefaultSiteTree("testTree");
Label label = new Label("Foo", "en");
Label[] fooLabels = { label };
- siteTree.addNode("/foo", fooLabels, null, null, false);
+ siteTree.addNode("/foo", fooLabels, true, null, null, false);
label = new Label("Bar", "en");
Label label_de = new Label("Stab", "de");
Label[] barLabels = { label, label_de };
siteTree.addNode(
"/foo/bar",
barLabels,
+ true,
"http://exact.biz",
"suffix",
true);
Modified: incubator/lenya/branches/BRANCH_1_2_X/src/webapp/lenya/content/info/overview.xsp
==============================================================================
--- incubator/lenya/branches/BRANCH_1_2_X/src/webapp/lenya/content/info/overview.xsp (original)
+++ incubator/lenya/branches/BRANCH_1_2_X/src/webapp/lenya/content/info/overview.xsp Mon Oct 25 20:53:08 2004
@@ -15,7 +15,7 @@
limitations under the License.
-->
-<!-- $Id: overview.xsp,v 1.11 2004/03/13 12:31:30 gregor Exp $ -->
+<!-- $Id$ -->
<xsp:page
language="java"
@@ -36,6 +36,7 @@
<xsp:include>org.apache.lenya.cms.publication.Document</xsp:include>
<xsp:include>org.apache.lenya.cms.publication.DocumentException</xsp:include>
<xsp:include>org.apache.lenya.cms.publication.xsp.DocumentLanguagesHelper</xsp:include>
+ <xsp:include>org.apache.lenya.cms.publication.SiteTreeNode</xsp:include>
</xsp:structure>
<lenya-info:info>
@@ -43,6 +44,11 @@
<xsp:logic>
Document doc = (Document)<input:get-attribute module="page-envelope" as="object" name="document"/>;
+
+ SiteTreeNode node = (SiteTreeNode) <input:get-attribute module="sitetree" as="object" name="authoring-node"/>;
+ String visibility = "visible";
+ if (!node.visibleInNav()) visibility = "hidden";
+
boolean exists = false;
boolean existsLanguage = false;
@@ -87,6 +93,7 @@
<lenya-info:area></lenya-info:area>
<lenya-info:workflow-state><input:get-attribute module="workflow" as="string" name="state"/></lenya-info:workflow-state>
<lenya-info:is-live><input:get-attribute module="workflow" as="string" name="variable.is_live"/></lenya-info:is-live>
+ <lenya-info:visibleinnav><xsp:expr>visibility</xsp:expr></lenya-info:visibleinnav>
}
Modified: incubator/lenya/branches/BRANCH_1_2_X/src/webapp/lenya/pubs/default/config/menus/generic.xsp
==============================================================================
--- incubator/lenya/branches/BRANCH_1_2_X/src/webapp/lenya/pubs/default/config/menus/generic.xsp (original)
+++ incubator/lenya/branches/BRANCH_1_2_X/src/webapp/lenya/pubs/default/config/menus/generic.xsp Mon Oct 25 20:53:08 2004
@@ -15,7 +15,7 @@
limitations under the License.
-->
-<!-- $Id: generic.xsp,v 1.73 2004/05/14 15:10:11 michi Exp $ -->
+<!-- $Id$ -->
<xsp:page
language="java"
@@ -127,7 +127,6 @@
<item wf:event="edit" uc:usecase="bxeng" uc:step="open" href="?"><i18n:text>Edit with BXE</i18n:text></item>
<item wf:event="edit" uc:usecase="edit" uc:step="open"><xsp:attribute name="href"><xsp:expr>"?form=" + docType</xsp:expr></xsp:attribute><i18n:text>Edit with Forms</i18n:text></item>
<item wf:event="edit" uc:usecase="1formedit" uc:step="open" href="?"><i18n:text>Edit with one Form</i18n:text></item>
- <!--<item wf:event="edit" uc:usecase="uploaddocument" uc:step="showscreen" href="?"><i18n:text>Upload Document</i18n:text></item>-->
</block>
<block info="false">
<item wf:event="edit" uc:usecase="info-meta" uc:step="showscreen"><xsp:attribute name="href"><xsp-request:get-context-path/>/<input:get-attribute module="page-envelope" as="string" name="publication-id"/>/info-<input:get-attribute module="page-envelope" as="string" name="area"/><input:get-attribute module="page-envelope" as="string" name="document-url"/>?</xsp:attribute><i18n:text>Edit Metadata</i18n:text></item>
@@ -193,6 +192,12 @@
}
else {
<item>Edit Navigation Title</item>
+ }
+ if (isDocument) {
+ <item uc:usecase="change-visibility" uc:step="showscreen" href="?"><i18n:text>Change node visibility</i18n:text></item>
+ }
+ else {
+ <item>Change node visibility</item>
}
</xsp:logic>
</block>
Modified: incubator/lenya/branches/BRANCH_1_2_X/src/webapp/lenya/pubs/default/config/tasks/targets.xml
==============================================================================
--- incubator/lenya/branches/BRANCH_1_2_X/src/webapp/lenya/pubs/default/config/tasks/targets.xml (original)
+++ incubator/lenya/branches/BRANCH_1_2_X/src/webapp/lenya/pubs/default/config/tasks/targets.xml Mon Oct 25 20:53:08 2004
@@ -15,7 +15,7 @@
limitations under the License.
-->
-<!-- $Id: targets.xml,v 1.29 2004/08/11 18:52:17 gregor Exp $ -->
+<!-- $Id$ -->
<project name="Ant Test Project" default="test" basedir=".">
@@ -122,6 +122,7 @@
<property name="create.columns" value=""/>
<property name="create.userid" value=""/>
<property name="create.ipaddress" value=""/>
+ <property name="create.visible" value=""/>
<taskdef name="create" classname="org.apache.lenya.cms.ant.DocumentCreatorTask"/>
<create
@@ -133,6 +134,7 @@
childtype="${create.child-type}"
documenttype="${create.doctype}"
language="${create.language}"
+ visibleinnav="${create.visible}"
/>
<!-- Init the workflow history -->
@@ -635,6 +637,19 @@
labelName="${rename.label.label-name}"
language="${rename.label.language}"
area="${rename.label.area}"
+ />
+ </target>
+
+ <taskdef name="changeVisibility" classname="org.apache.lenya.cms.ant.ChangeVisibilityTask"/>
+
+ <target name = "change-visibility">
+ <property name="change.visibility.document-id" value=""/>
+ <property name="change.visibility.area" value=""/>
+
+ <echo>Change Visibility</echo>
+ <changeVisibility
+ documentid="${change.visibility.document-id}"
+ area="${change.visibility.area}"
/>
</target>
Modified: incubator/lenya/branches/BRANCH_1_2_X/src/webapp/lenya/pubs/default/config/tasks/tasks.xconf
==============================================================================
--- incubator/lenya/branches/BRANCH_1_2_X/src/webapp/lenya/pubs/default/config/tasks/tasks.xconf (original)
+++ incubator/lenya/branches/BRANCH_1_2_X/src/webapp/lenya/pubs/default/config/tasks/tasks.xconf Mon Oct 25 20:53:08 2004
@@ -15,7 +15,7 @@
limitations under the License.
-->
-<!-- $Id: tasks.xconf,v 1.13 2004/05/27 12:23:23 gregor Exp $ -->
+<!-- $Id$ -->
<tasks>
@@ -60,6 +60,11 @@
<task id="rename-label" class="org.apache.lenya.cms.task.AntTask">
<label>Edit Navigation Title</label>
<parameter name="target" value="rename-label"/>
+ </task>
+
+ <task id="change-visibility" class="org.apache.lenya.cms.task.AntTask">
+ <label>Change Node Visibility</label>
+ <parameter name="target" value="change-visibility"/>
</task>
<task id="save-meta-data" class="org.apache.lenya.cms.task.AntTask">
Modified: incubator/lenya/branches/BRANCH_1_2_X/src/webapp/lenya/pubs/default/lenya/xslt/authoring/create.xsl
==============================================================================
--- incubator/lenya/branches/BRANCH_1_2_X/src/webapp/lenya/pubs/default/lenya/xslt/authoring/create.xsl (original)
+++ incubator/lenya/branches/BRANCH_1_2_X/src/webapp/lenya/pubs/default/lenya/xslt/authoring/create.xsl Mon Oct 25 20:53:08 2004
@@ -15,7 +15,7 @@
limitations under the License.
-->
-<!-- $Id: create.xsl,v 1.15 2004/03/14 16:42:15 roku Exp $ -->
+<!-- $Id$ -->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
@@ -113,6 +113,10 @@
</tr>
<tr>
<td class="lenya-entry-caption"><i18n:text>Navigation Title</i18n:text>*: </td><td><input class="lenya-form-element" type="text" name="properties.create.child-name"/></td>
+ </tr>
+ <tr>
+ <td class="lenya-form-caption">Document visible in navigation:</td><td><select class="lenya-form-element" name="properties.create.visible"><option selected="true">yes</option><option>no</option></select>
+ </td>
</tr>
<xsl:apply-templates select="allowedLanguages"/>
<tr>
Modified: incubator/lenya/branches/BRANCH_1_2_X/src/webapp/lenya/resources/i18n/cmsui.xml
==============================================================================
--- incubator/lenya/branches/BRANCH_1_2_X/src/webapp/lenya/resources/i18n/cmsui.xml (original)
+++ incubator/lenya/branches/BRANCH_1_2_X/src/webapp/lenya/resources/i18n/cmsui.xml Mon Oct 25 20:53:08 2004
@@ -249,6 +249,12 @@
<message key="Cut Document">Cut Document</message>
<message key="cut-doc">Cut document {0}</message>
<message key="cut-doc-to-clip?">Do you want to cut the document {0} and move it to the clipboard? You can paste the document later at the location of your choosing.</message>
+ <!--Change visibility in navigation -->
+ <message key="Change">Change</message>
+ <message key="Change Document visiblity in navigation">Change document visibility in navigation</message>
+ <message key="Visibility in navigation">Visibility in navigation</message>
+ <message key="visible">visible</message>
+ <message key="hidden">hidden</message>
<!-- Info Asset -->
<message key="Insert Image">Insert Image</message>
Modified: incubator/lenya/branches/BRANCH_1_2_X/src/webapp/lenya/resources/i18n/cmsui_de.xml
==============================================================================
--- incubator/lenya/branches/BRANCH_1_2_X/src/webapp/lenya/resources/i18n/cmsui_de.xml (original)
+++ incubator/lenya/branches/BRANCH_1_2_X/src/webapp/lenya/resources/i18n/cmsui_de.xml Mon Oct 25 20:53:08 2004
@@ -142,6 +142,7 @@
<message key="Edit Metadata">Metadata bearbeiten</message>
<message key="Edit Navigation Title">Navigationstitel bearbeiten</message>
<message key="Rename URL">URL umbenennen</message>
+ <message key="Change node visiblity">Sichtbarkeit in Navigation ändern</message>
<!-- cms tabs -->
<message key="Server Time">Serverzeit</message>
@@ -250,6 +251,12 @@
<message key="Cut Document">Dokument ausschneiden</message>
<message key="cut-doc">Ausschneiden von Dokument {0}</message>
<message key="cut-doc-to-clip?">Wollen Sie das Dokument {0} ausschneiden und in die Zwischenablage verschieben? Sie können das Dokument später an gewünschter Stelle einfügen.</message>
+ <!--Change visibility in navigation -->
+ <message key="Change">Ändern</message>
+ <message key="Change Document visiblity in navigation">Sichtbarkeit in Navigation ändern</message>
+ <message key="Visibility in navigation">Sichtbarkeit in der Navigation</message>
+ <message key="visible">sichtbar</message>
+ <message key="hidden">versteckt</message>
<!-- Info Asset -->
<message key="Insert Image">Bild einfügen</message>
Modified: incubator/lenya/branches/BRANCH_1_2_X/src/webapp/lenya/usecase.xmap
==============================================================================
--- incubator/lenya/branches/BRANCH_1_2_X/src/webapp/lenya/usecase.xmap (original)
+++ incubator/lenya/branches/BRANCH_1_2_X/src/webapp/lenya/usecase.xmap Mon Oct 25 20:53:08 2004
@@ -792,7 +792,30 @@
</map:match>
</map:match>
-
+
+ <!-- Change visibility of a node in navigation -->
+ <map:match pattern="change-visibility" type="usecase">
+
+ <map:match pattern="showscreen" type="step">
+ <map:generate src="content/util/empty.xml"/>
+ <map:transform src="xslt/info/change-visibility.xsl">
+ <map:parameter name="use-request-parameters" value="true"/>
+ <map:parameter name="requesturi" value="{request:requestURI}"/>
+ <map:parameter name="area" value="{page-envelope:area}"/>
+ <map:parameter name="documentid" value="{page-envelope:document-id}"/>
+ <map:parameter name="taskid" value="change-visibility"/>
+ </map:transform>
+ <map:call resource="style-cms-page"/>
+ </map:match>
+
+ <map:match pattern="change-visibility" type="step">
+ <map:act type="task">
+ <map:redirect-to session="true" uri="{request:requestURI}"/>
+ </map:act>
+ </map:match>
+
+ </map:match>
+
<!-- initialize the workflow -->
<map:match type="usecase" pattern="initworkflow">
<map:act type="task">
Added: incubator/lenya/branches/BRANCH_1_2_X/src/webapp/lenya/xslt/info/change-visibility.xsl
==============================================================================
--- (empty file)
+++ incubator/lenya/branches/BRANCH_1_2_X/src/webapp/lenya/xslt/info/change-visibility.xsl Mon Oct 25 20:53:08 2004
@@ -0,0 +1,66 @@
+<?xml version="1.0"?>
+<!--
+ Copyright 1999-2004 The Apache Software Foundation
+
+ Licensed 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: change-visibility.xsl 42703 2004-09-22 12:57:53Z jaf $ -->
+
+ <xsl:stylesheet version="1.0"
+ xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
+ xmlns:page="http://apache.org/cocoon/lenya/cms-page/1.0"
+ >
+
+ <xsl:param name="requesturi"/>
+ <xsl:param name="area"/>
+ <xsl:param name="documentid"/>
+ <xsl:param name="taskid"/>
+ <xsl:param name="lenya.event"/>
+
+ <xsl:template match="/">
+ <page:page>
+ <page:title><i18n:text>Change document visibility in navigation</i18n:text></page:title>
+ <page:body>
+ <div class="lenya-box">
+ <div class="lenya-box-title"><i18n:text>Change document visibility in navigation</i18n:text></div>
+ <div class="lenya-box-body">
+ <form method="get">
+ <xsl:attribute name="action"></xsl:attribute>
+ <input type="hidden" name="task-id" value="{$taskid}"/>
+ <input type="hidden" name="properties.change.visibility.document-id" value="{$documentid}"/>
+ <input type="hidden" name="properties.change.visibility.area" value="{$area}"/>
+ <input type="hidden" name="lenya.usecase" value="change-visibility"/>
+ <input type="hidden" name="lenya.step" value="change-visibility"/>
+ <input type="hidden" name="lenya.event" value="edit"/>
+
+ <table class="lenya-table-noborder">
+ <tr>
+ <td/>
+ <td>
+ <br/>
+ <input i18n:attr="value" type="submit" value="Change"/> 
+ <input i18n:attr="value" type="button" onClick="location.href='{$requesturi}';" value="Cancel"/>
+ </td>
+ </tr>
+ </table>
+ </form>
+ </div>
+ </div>
+ </page:body>
+ </page:page>
+ </xsl:template>
+
+</xsl:stylesheet>
\ No newline at end of file
Modified: incubator/lenya/branches/BRANCH_1_2_X/src/webapp/lenya/xslt/info/info.xsl
==============================================================================
--- incubator/lenya/branches/BRANCH_1_2_X/src/webapp/lenya/xslt/info/info.xsl (original)
+++ incubator/lenya/branches/BRANCH_1_2_X/src/webapp/lenya/xslt/info/info.xsl Mon Oct 25 20:53:08 2004
@@ -15,7 +15,7 @@
limitations under the License.
-->
-<!-- $Id: info.xsl,v 1.67 2004/08/22 22:50:41 roku Exp $ -->
+<!-- $Id$ -->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
@@ -108,6 +108,7 @@
<!-- <tr><td>Last edited by:</td><td><xsl:value-of select="lenya-info:lastmodifiedby"/></td></tr> -->
<tr><td class="lenya-entry-caption"><i18n:text>Last modified</i18n:text>:</td><td><xsl:value-of select="lenya-info:lastmodified"/></td></tr>
<tr><td class="lenya-entry-caption"><i18n:text>Document ID</i18n:text>:</td><td><xsl:value-of select="lenya-info:documentid"/></td></tr>
+ <tr><td class="lenya-entry-caption"><i18n:text>Visibility in navigation</i18n:text>:</td><td><i18n:text><xsl:value-of select="lenya-info:visibleinnav"/></i18n:text></td></tr>
</table>
</xsl:when>
<xsl:when test="$languageexists = 'false'">
Modified: incubator/lenya/branches/BRANCH_1_2_X/src/webapp/lenya/xslt/navigation/menu.xsl
==============================================================================
--- incubator/lenya/branches/BRANCH_1_2_X/src/webapp/lenya/xslt/navigation/menu.xsl (original)
+++ incubator/lenya/branches/BRANCH_1_2_X/src/webapp/lenya/xslt/navigation/menu.xsl Mon Oct 25 20:53:08 2004
@@ -15,7 +15,7 @@
limitations under the License.
-->
-<!-- $Id: menu.xsl,v 1.15 2004/03/13 12:42:05 gregor Exp $ -->
+<!-- $Id$ -->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
@@ -31,6 +31,7 @@
</div>
</xsl:template>
+<xsl:template match="nav:node[@visibleinnav = 'false']"/>
<xsl:template match="nav:node">
<xsl:choose>
Modified: incubator/lenya/branches/BRANCH_1_2_X/src/webapp/lenya/xslt/navigation/sitetree2nav.xsl
==============================================================================
--- incubator/lenya/branches/BRANCH_1_2_X/src/webapp/lenya/xslt/navigation/sitetree2nav.xsl (original)
+++ incubator/lenya/branches/BRANCH_1_2_X/src/webapp/lenya/xslt/navigation/sitetree2nav.xsl Mon Oct 25 20:53:08 2004
@@ -15,7 +15,7 @@
limitations under the License.
-->
-<!-- $Id: sitetree2nav.xsl,v 1.23 2004/06/01 14:29:22 andreas Exp $ -->
+<!-- $Id$ -->
<xsl:stylesheet
version="1.0"
@@ -81,6 +81,7 @@
<nav:node>
<xsl:copy-of select="@id"/>
+ <xsl:copy-of select="@visibleinnav"/>
<xsl:copy-of select="@protected"/>
<!-- basic url - for all nodes -->
---------------------------------------------------------------------
To unsubscribe, e-mail: lenya-cvs-unsubscribe@cocoon.apache.org
For additional commands, e-mail: lenya-cvs-help@cocoon.apache.org