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 2005/01/11 06:35:41 UTC
svn commit: r124886 - in lenya/trunk: lib src/confpatch src/java/org/apache/lenya/cms/cocoon/acting src/webapp/lenya/pubs/blog src/webapp/lenya/pubs/blog/config/menus src/webapp/lenya/pubs/blog/java/src/org/apache/lenya/cms/site/usecase src/webapp/lenya/pubs/blog/lenya/content/authoring src/webapp/lenya/pubs/blog/lenya/xslt/authoring src/webapp/lenya/pubs/default/lenya/content/authoring src/webapp/lenya/pubs/default/lenya/xslt/authoring src/webapp/lenya/xslt/authoring
Author: gregor
Date: Mon Jan 10 21:35:39 2005
New Revision: 124886
URL: http://svn.apache.org/viewcvs?view=rev&rev=124886
Log:
Finished the new blog entry usecase. This allowed to remove dom4j and the ParentChildCreatorAction as well as create.xsp and create.xsl, which are now no longer used.
Removed:
lenya/trunk/lib/dom4j.jar
lenya/trunk/src/java/org/apache/lenya/cms/cocoon/acting/ParentChildCreatorAction.java
lenya/trunk/src/webapp/lenya/pubs/blog/lenya/content/authoring/create.xsp
lenya/trunk/src/webapp/lenya/pubs/blog/lenya/xslt/authoring/create.xsl
lenya/trunk/src/webapp/lenya/pubs/blog/usecase-create.xmap
lenya/trunk/src/webapp/lenya/pubs/default/lenya/content/authoring/create-language.xsp
lenya/trunk/src/webapp/lenya/pubs/default/lenya/content/authoring/create.xsp
lenya/trunk/src/webapp/lenya/pubs/default/lenya/content/authoring/upload.xsp
lenya/trunk/src/webapp/lenya/pubs/default/lenya/xslt/authoring/create-language.xsl
lenya/trunk/src/webapp/lenya/pubs/default/lenya/xslt/authoring/create.xsl
lenya/trunk/src/webapp/lenya/xslt/authoring/create.xsl
Modified:
lenya/trunk/src/confpatch/actions.xmap
lenya/trunk/src/webapp/lenya/pubs/blog/config/menus/feed.xsp
lenya/trunk/src/webapp/lenya/pubs/blog/java/src/org/apache/lenya/cms/site/usecase/CreateBlogEntry.java
Deleted: /lenya/trunk/lib/dom4j.jar
Url: http://svn.apache.org/viewcvs/lenya/trunk/lib/dom4j.jar?view=auto&rev=124885
==============================================================================
Modified: lenya/trunk/src/confpatch/actions.xmap
Url: http://svn.apache.org/viewcvs/lenya/trunk/src/confpatch/actions.xmap?view=diff&rev=124886&p1=lenya/trunk/src/confpatch/actions.xmap&r1=124885&p2=lenya/trunk/src/confpatch/actions.xmap&r2=124886
==============================================================================
--- lenya/trunk/src/confpatch/actions.xmap (original)
+++ lenya/trunk/src/confpatch/actions.xmap Mon Jan 10 21:35:39 2005
@@ -20,11 +20,6 @@
<map:action name="document-id-exists" logger="sitemap.action.document-id-exists" src="org.apache.lenya.cms.cocoon.acting.DocumentIdExistsAction" />
<map:action name="language-exists" logger="lenya.sitemap.action.language-exists" src="org.apache.lenya.cms.cocoon.acting.LanguageExistsAction"/>
<map:action name="oneformeditorsave" logger="sitemap.action.oneformeditormsave" src="org.apache.lenya.cms.cocoon.acting.OneFormEditorSaveAction" />
- <map:action name="parent-child" logger="sitemap.action.parent-child" src="org.apache.lenya.cms.cocoon.acting.ParentChildCreatorAction">
- <tree-authoring href="content/authoring/tree.xml"/>
- <docs href="content/authoring"/>
- <doctypes href="config/doctypes/"/>
- </map:action>
<map:action name="request-parameter-exists" logger="sitemap.action.requestParameterExists" src="org.apache.cocoon.acting.RequestParameterExistsAction" />
<map:action name="reserved-checkin" src="org.apache.lenya.cms.cocoon.acting.ReservedCheckinAction" logger="sitemap.action.reserved-checkin"/>
<map:action name="reserved-checkout" src="org.apache.lenya.cms.cocoon.acting.ReservedCheckoutAction" logger="sitemap.action.reserved-checkout"/>
Deleted: /lenya/trunk/src/java/org/apache/lenya/cms/cocoon/acting/ParentChildCreatorAction.java
Url: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/cms/cocoon/acting/ParentChildCreatorAction.java?view=auto&rev=124885
==============================================================================
Modified: lenya/trunk/src/webapp/lenya/pubs/blog/config/menus/feed.xsp
Url: http://svn.apache.org/viewcvs/lenya/trunk/src/webapp/lenya/pubs/blog/config/menus/feed.xsp?view=diff&rev=124886&p1=lenya/trunk/src/webapp/lenya/pubs/blog/config/menus/feed.xsp&r1=124885&p2=lenya/trunk/src/webapp/lenya/pubs/blog/config/menus/feed.xsp&r2=124886
==============================================================================
--- lenya/trunk/src/webapp/lenya/pubs/blog/config/menus/feed.xsp (original)
+++ lenya/trunk/src/webapp/lenya/pubs/blog/config/menus/feed.xsp Mon Jan 10 21:35:39 2005
@@ -44,7 +44,7 @@
<menus>
<menu name="File" label="File">
<block>
- <item uc:usecase="create" uc:step="showscreen" href="?doctype=entry">Add new Entry</item>
+ <item uc:usecase="site.create" href="">Add new Entry</item>
</block>
<block>
<item uc:usecase="edit" href="../../sidebar.html?lenya.step=open&form=sidebar">Edit Sidebar with Forms</item>
Modified: lenya/trunk/src/webapp/lenya/pubs/blog/java/src/org/apache/lenya/cms/site/usecase/CreateBlogEntry.java
Url: http://svn.apache.org/viewcvs/lenya/trunk/src/webapp/lenya/pubs/blog/java/src/org/apache/lenya/cms/site/usecase/CreateBlogEntry.java?view=diff&rev=124886&p1=lenya/trunk/src/webapp/lenya/pubs/blog/java/src/org/apache/lenya/cms/site/usecase/CreateBlogEntry.java&r1=124885&p2=lenya/trunk/src/webapp/lenya/pubs/blog/java/src/org/apache/lenya/cms/site/usecase/CreateBlogEntry.java&r2=124886
==============================================================================
--- lenya/trunk/src/webapp/lenya/pubs/blog/java/src/org/apache/lenya/cms/site/usecase/CreateBlogEntry.java (original)
+++ lenya/trunk/src/webapp/lenya/pubs/blog/java/src/org/apache/lenya/cms/site/usecase/CreateBlogEntry.java Mon Jan 10 21:35:39 2005
@@ -17,7 +17,19 @@
package org.apache.lenya.cms.site.usecases;
import java.io.File;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
import java.util.Collections;
+import java.util.Date;
+import java.util.Map;
+import java.util.HashMap;
+
+import org.apache.cocoon.components.ContextHelper;
+import org.apache.cocoon.environment.ObjectModelHelper;
+import org.apache.cocoon.environment.Request;
+import org.apache.cocoon.environment.Session;
+
+import org.apache.lenya.ac.Identity;
import org.apache.lenya.cms.authoring.ParentChildCreatorInterface;
import org.apache.lenya.cms.metadata.dublincore.DublinCore;
@@ -25,16 +37,18 @@
import org.apache.lenya.cms.publication.DocumentType;
import org.apache.lenya.cms.publication.DocumentTypeBuilder;
import org.apache.lenya.cms.publication.Publication;
+import org.apache.lenya.cms.usecase.DocumentUsecase;
/**
* Usecase to create a document.
*
- * @version $Id:$
+ * @version $Id$
*/
-public class CreateBlogEntry extends Create {
+public class CreateBlogEntry extends DocumentUsecase {
protected static final String PARENT_ID = "parentId";
protected static final String DOCUMENT_TYPE = "doctype";
+ protected static final String DOCUMENT_ID = "documentId";
/**
* @see org.apache.lenya.cms.usecase.AbstractUsecase#initParameters()
@@ -44,9 +58,6 @@
Document parent = getSourceDocument();
setParameter(PARENT_ID, parent.getId());
-
- String[] languages = parent.getPublication().getLanguages();
- setParameter(LANGUAGES, languages);
}
/**
@@ -67,16 +78,21 @@
super.doCheckExecutionConditions();
}
- /**
- * @see org.apache.lenya.cms.site.usecases.Create#createDocument()
- */
- protected Document createDocument() throws Exception {
+ protected void doExecute() throws Exception {
+ super.doExecute();
+
Document parent = getSourceDocument();
- String documentId = parent.getId() + "/" + getParameterAsString(DOCUMENT_ID);
- String navigationTitle = getParameterAsString(DublinCore.ELEMENT_TITLE);
+ Map objectModel = ContextHelper.getObjectModel(getContext());
+ Request request = ObjectModelHelper.getRequest(objectModel);
+ Session session = request.getSession(false);
+
+ String documentId = "/" + getParameterAsString(DOCUMENT_ID);
+ String title = getParameterAsString(DublinCore.ELEMENT_TITLE);
String documentTypeName = getDocumentTypeName();
- String language = getParameterAsString(LANGUAGE);
+
+ Publication publication = parent.getPublication();
+ String language = publication.getDefaultLanguage();
if (getLogger().isDebugEnabled()) {
getLogger().debug("Creating document");
@@ -84,31 +100,32 @@
getLogger().debug(" Child document: [" + documentId + "]");
getLogger().debug(" Language: [" + language + "]");
getLogger().debug(" Document Type: [" + documentTypeName + "]");
- getLogger().debug(" Navigation Title: [" + navigationTitle + "]");
+ getLogger().debug(" Title: [" + title + "]");
}
- Publication publication = parent.getPublication();
String area = parent.getArea();
Document document = parent.getIdentityMap().getFactory().get(area, documentId, language);
DocumentType documentType = DocumentTypeBuilder.buildDocumentType(documentTypeName,
publication);
- String parentId = parent.getId().substring(1);
String childId = document.getName();
File doctypesDirectory = new File(publication.getDirectory(),
DocumentTypeBuilder.DOCTYPE_DIRECTORY);
+ HashMap allParameters = new HashMap();
+ allParameters.put(Identity.class.getName(), session.getAttribute(Identity.class.getName()));
+ allParameters.put("title", title);
+
documentType.getCreator().create(new File(doctypesDirectory, "samples"),
- new File(publication.getContentDirectory(area), parentId),
+ new File(publication.getContentDirectory(area), ""),
childId,
- ParentChildCreatorInterface.BRANCH_NODE,
- navigationTitle,
+ ParentChildCreatorInterface.LEAF_NODE,
+ title,
language,
- Collections.EMPTY_MAP);
+ allParameters);
- return document;
}
/**
Deleted: /lenya/trunk/src/webapp/lenya/pubs/blog/lenya/content/authoring/create.xsp
Url: http://svn.apache.org/viewcvs/lenya/trunk/src/webapp/lenya/pubs/blog/lenya/content/authoring/create.xsp?view=auto&rev=124885
==============================================================================
Deleted: /lenya/trunk/src/webapp/lenya/pubs/blog/lenya/xslt/authoring/create.xsl
Url: http://svn.apache.org/viewcvs/lenya/trunk/src/webapp/lenya/pubs/blog/lenya/xslt/authoring/create.xsl?view=auto&rev=124885
==============================================================================
Deleted: /lenya/trunk/src/webapp/lenya/pubs/blog/usecase-create.xmap
Url: http://svn.apache.org/viewcvs/lenya/trunk/src/webapp/lenya/pubs/blog/usecase-create.xmap?view=auto&rev=124885
==============================================================================
Deleted: /lenya/trunk/src/webapp/lenya/pubs/default/lenya/content/authoring/create-language.xsp
Url: http://svn.apache.org/viewcvs/lenya/trunk/src/webapp/lenya/pubs/default/lenya/content/authoring/create-language.xsp?view=auto&rev=124885
==============================================================================
Deleted: /lenya/trunk/src/webapp/lenya/pubs/default/lenya/content/authoring/create.xsp
Url: http://svn.apache.org/viewcvs/lenya/trunk/src/webapp/lenya/pubs/default/lenya/content/authoring/create.xsp?view=auto&rev=124885
==============================================================================
Deleted: /lenya/trunk/src/webapp/lenya/pubs/default/lenya/content/authoring/upload.xsp
Url: http://svn.apache.org/viewcvs/lenya/trunk/src/webapp/lenya/pubs/default/lenya/content/authoring/upload.xsp?view=auto&rev=124885
==============================================================================
Deleted: /lenya/trunk/src/webapp/lenya/pubs/default/lenya/xslt/authoring/create-language.xsl
Url: http://svn.apache.org/viewcvs/lenya/trunk/src/webapp/lenya/pubs/default/lenya/xslt/authoring/create-language.xsl?view=auto&rev=124885
==============================================================================
Deleted: /lenya/trunk/src/webapp/lenya/pubs/default/lenya/xslt/authoring/create.xsl
Url: http://svn.apache.org/viewcvs/lenya/trunk/src/webapp/lenya/pubs/default/lenya/xslt/authoring/create.xsl?view=auto&rev=124885
==============================================================================
Deleted: /lenya/trunk/src/webapp/lenya/xslt/authoring/create.xsl
Url: http://svn.apache.org/viewcvs/lenya/trunk/src/webapp/lenya/xslt/authoring/create.xsl?view=auto&rev=124885
==============================================================================
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org