You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by mi...@apache.org on 2006/07/11 00:06:57 UTC
svn commit: r420643 - in /lenya/trunk/src/modules/neutron:
config/cocoon-xconf/usecase-neutron-put.xmap
java/src/org/apache/lenya/cms/usecases/neutron/Put.java neutron.js
sitemap.xmap xslt/addSourceTags.xsl xslt/introspection.xsl
xslt/removeSourceTags.xsl
Author: michi
Date: Mon Jul 10 15:06:57 2006
New Revision: 420643
URL: http://svn.apache.org/viewvc?rev=420643&view=rev
Log:
thanks to Jonathan Addison Neutron implementation has been finished
Added:
lenya/trunk/src/modules/neutron/xslt/addSourceTags.xsl
lenya/trunk/src/modules/neutron/xslt/removeSourceTags.xsl
Modified:
lenya/trunk/src/modules/neutron/config/cocoon-xconf/usecase-neutron-put.xmap
lenya/trunk/src/modules/neutron/java/src/org/apache/lenya/cms/usecases/neutron/Put.java
lenya/trunk/src/modules/neutron/neutron.js
lenya/trunk/src/modules/neutron/sitemap.xmap
lenya/trunk/src/modules/neutron/xslt/introspection.xsl
Modified: lenya/trunk/src/modules/neutron/config/cocoon-xconf/usecase-neutron-put.xmap
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/neutron/config/cocoon-xconf/usecase-neutron-put.xmap?rev=420643&r1=420642&r2=420643&view=diff
==============================================================================
--- lenya/trunk/src/modules/neutron/config/cocoon-xconf/usecase-neutron-put.xmap (original)
+++ lenya/trunk/src/modules/neutron/config/cocoon-xconf/usecase-neutron-put.xmap Mon Jul 10 15:06:57 2006
@@ -1,37 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-
-<!--
- This file defines the publication specific use-cases
--->
-
- <xconf xpath="/cocoon/usecases" unless="/cocoon/usecases/component-instance[@name = 'neutron.put']">
- <component-instance name="neutron.put" logger="lenya.publication"
- class="org.apache.lenya.cms.usecases.neutron.Put">
- <!-- You can configure which resource type and extension are connected.
- The idea is similar to the file system browser dialog that an operation system
- offers (open with) where you can register applications to open certain file extensions-->
- <extensions>
- <extension resource-type="xhtml">xml</extension>
- <extension resource-type="opendocument">odt</extension>
- <extension resource-type="xhtml">html</extension>
- <extension resource-type="xhtml">xhtml</extension>
- <!--Next extension is a wildcard (all others)-->
- <extension resource-type="xhtml">*</extension>
- </extensions>
- </component-instance>
- </xconf>
Modified: lenya/trunk/src/modules/neutron/java/src/org/apache/lenya/cms/usecases/neutron/Put.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/neutron/java/src/org/apache/lenya/cms/usecases/neutron/Put.java?rev=420643&r1=420642&r2=420643&view=diff
==============================================================================
--- lenya/trunk/src/modules/neutron/java/src/org/apache/lenya/cms/usecases/neutron/Put.java (original)
+++ lenya/trunk/src/modules/neutron/java/src/org/apache/lenya/cms/usecases/neutron/Put.java Mon Jul 10 15:06:57 2006
@@ -1,301 +0,0 @@
-/*
- * Copyright 1999-2006 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.
- *
- */
-package org.apache.lenya.cms.usecases.neutron;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
-import org.apache.avalon.framework.service.ServiceException;
-import org.apache.avalon.framework.service.ServiceSelector;
-import org.apache.excalibur.source.Source;
-import org.apache.excalibur.source.SourceResolver;
-import org.apache.lenya.cms.cocoon.source.SourceUtil;
-import org.apache.lenya.cms.metadata.dublincore.DublinCore;
-import org.apache.lenya.cms.publication.Document;
-import org.apache.lenya.cms.publication.DocumentException;
-import org.apache.lenya.cms.publication.DocumentFactory;
-import org.apache.lenya.cms.publication.DocumentManager;
-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.publication.ResourceType;
-import org.apache.lenya.cms.publication.util.DocumentSet;
-import org.apache.lenya.cms.repository.Node;
-import org.apache.lenya.cms.site.SiteStructure;
-import org.apache.lenya.cms.site.SiteUtil;
-import org.apache.lenya.cms.site.usecases.CreateDocument;
-import org.apache.lenya.cms.usecase.UsecaseException;
-import org.apache.lenya.workflow.WorkflowManager;
-import org.apache.lenya.xml.Schema;
-
-/**
- * Supports Neutron PUT.
- * @version $Id: $
- */
-public class Put extends CreateDocument {
- // registeredExtensions contain all known extension matching to a certain resource-type.
- private HashMap registeredExtensions = new HashMap();
-// default is xhtml and xml but you can override it with the config
- protected String TYPE = "xhtml";
- protected String EXTENSION = "*";
- protected static final String ATTRIBUTE_TYPE = "resource-type";
- protected static final String ELEMENT_ROOT = "extensions";
- protected static final String ELEMENT_EXTENSION = "extension";
-
- private boolean fallback = false;
-
- public void configure(Configuration config) throws ConfigurationException {
- super.configure(config);
- Configuration extensionsConfig = config.getChild(ELEMENT_ROOT, false);
- if (extensionsConfig != null) {
- Configuration [] extensions=extensionsConfig.getChildren(ELEMENT_EXTENSION);
- for (int i = 0; i < extensions.length; i++) {
- Configuration extension = extensions[i];
-// add extension to register (key: extension,value: resource-type)
- if (extension != null)
- registeredExtensions.put(extension.getValue(),extension.getAttribute(ATTRIBUTE_TYPE));
- }
- }else{
- registeredExtensions.put(this.EXTENSION,this.TYPE);
- }
- }
-
- /**
- * @see org.apache.lenya.cms.usecase.AbstractUsecase#doExecute()
- */
- protected void doExecute() throws Exception {
- SourceResolver resolver = null;
- WorkflowManager wfManager = null;
-
- try {
- resolver = (SourceResolver) this.manager.lookup(SourceResolver.ROLE);
-
- Document doc = getSourceDocument();
- String extension= getSourceExtension();
- // sanity check
- if (doc == null)
- throw new IllegalArgumentException("illegal usage, source document may not be null");
-
- // create new doc from PUT input
- if (!doc.exists()) {
- DocumentManager documentManager = null;
- ServiceSelector selector = null;
- ResourceType resourceType = null;
- try {
- selector = (ServiceSelector) this.manager.lookup(ResourceType.ROLE + "Selector");
-
- documentManager = (DocumentManager) this.manager.lookup(DocumentManager.ROLE);
-
- DocumentFactory map = getDocumentIdentityMap();
- Document document = map.get(getPublication(),
- doc.getArea(),
- doc.getId(),
- doc.getLanguage());
- //lookupResourceType(extension)
- resourceType = lookUpExtension(extension, selector);
- documentManager.add(document, resourceType, extension, doc.getName(), true);
- setMetaData(document);
- doc = document;
- } finally {
- if (documentManager != null) {
- this.manager.release(documentManager);
- }
- if (selector != null) {
- if (resourceType != null) {
- selector.release(resourceType);
- }
- this.manager.release(selector);
- }
- }
- }
-
- String sourceUri = "cocoon:/request/PUT/" + extension;
-
- // validate if a schema is provided and we are not using any fallback
- if (doc.getResourceType().getSchema() != null & fallback==false){
- validateDoc(resolver, sourceUri, doc);
- }
-
- if (!hasErrors()) {
- try {
- SourceUtil.copy(resolver, sourceUri, doc.getSourceURI(), true);
- } catch (Exception e) {
- addErrorMessage("invalid source xml. Full exception: "+ e);
- }
- }
-
- } finally {
- if (resolver != null) {
- this.manager.release(resolver);
- }
- if (wfManager != null) {
- this.manager.release(wfManager);
- }
- }
- }
-
-
- private ResourceType lookUpExtension(String extension, ServiceSelector selector) throws ServiceException {
- ResourceType resourceType;
- String resourceTypeName=(String) registeredExtensions.get(extension);
- if (resourceTypeName==null||resourceTypeName.equals("")){
- resourceTypeName=(String) registeredExtensions.get(this.EXTENSION);
- this.fallback=true;
- }
- if (selector.isSelectable(resourceTypeName)){
- resourceType = (ResourceType) selector.select(resourceTypeName);
- }else{
- //using a fallback resource type
- // FIXME this resource tye should be a more generic one like "media-assets" or "bin"
- resourceType = (ResourceType) selector.select(this.TYPE);
- this.fallback=true;
- }
- return resourceType;
- }
-
- private void validateDoc(SourceResolver resolver, String uploadSourceUri, Document doc) throws Exception {
- Source uploadSource = resolver.resolveURI(uploadSourceUri);
- if (!uploadSource.exists()) {
- throw new IllegalArgumentException("The upload file [" + uploadSource.getURI()
- + "] does not exist.");
- }
-
- ResourceType resourceType = doc.getResourceType();
- Schema schema = resourceType.getSchema();
-
- // FIXME not working yet, dunno why
- //org.w3c.dom.Document xmlDoc = DocumentHelper.readDocument(uploadSource.getInputStream());
- //ValidationUtil.validate(this.manager, xmlDoc, schema, new UsecaseErrorHandler(this));
- }
-
- /**
- * @see org.apache.lenya.cms.usecase.AbstractUsecase#getNodesToLock()
- */
- protected Node[] getNodesToLock() throws UsecaseException {
- try {
- Document doc = getSourceDocument();
- List nodes = new ArrayList();
-
- DocumentSet set = SiteUtil.getSubSite(this.manager, doc);
- Document[] documents = set.getDocuments();
- for (int i = 0; i < documents.length; i++) {
- nodes.add(documents[i].getRepositoryNode());
- }
-
- SiteStructure structure = SiteUtil.getSiteStructure(this.manager, getSourceDocument());
- nodes.add(structure.getRepositoryNode());
- return (Node[]) nodes.toArray(new Node[nodes.size()]);
-
- } catch (Exception e) {
- throw new UsecaseException(e);
- }
- }
- /**
- * Sets the meta data of the created document.
- *
- * @param document The document.
- * @throws DocumentException if an error occurs.
- */
- protected void setMetaData(Document document) throws DocumentException {
-
- if (document == null)
- throw new IllegalArgumentException("parameter document may not be null");
-
- Map dcMetaData = new HashMap();
- dcMetaData.put(DublinCore.ELEMENT_TITLE, document.getName());
- dcMetaData.put(DublinCore.ELEMENT_CREATOR, "");
- dcMetaData.put(DublinCore.ELEMENT_PUBLISHER, "");
- dcMetaData.put(DublinCore.ELEMENT_SUBJECT, "");
- dcMetaData.put(DublinCore.ELEMENT_DATE, "");
- dcMetaData.put(DublinCore.ELEMENT_RIGHTS, "");
- dcMetaData.put(DublinCore.ELEMENT_LANGUAGE, document.getLanguage());
-
- document.getMetaDataManager().setDublinCoreMetaData(dcMetaData);
- }
-
- private Publication publication;
-
- /**
- * Access to the current publication. Use this when the publication is not yet known in the
- * usecase: e.g. when creating a global asset. When adding a resource or a child to a document,
- * access the publication via that document's interface instead.
- *
- * @return the publication in which the use-case is being executed
- */
- protected Publication getPublication() {
- if (this.publication == null) {
- try {
- this.publication = PublicationUtil.getPublicationFromUrl(this.manager,
- getSourceURL());
- } catch (PublicationException e) {
- throw new RuntimeException(e);
- }
- }
- return this.publication;
- }
-
-
- protected String getSourceExtension() {
- String destinationUri = getParameterAsString(SOURCE_URL);
- String extension = null;
- if (destinationUri.indexOf(".") > 0) {
- extension = destinationUri.substring(destinationUri.lastIndexOf(".")+1,destinationUri.length());
- } else {
- extension = EXTENSION;
- }
- return extension;
- }
-
-
- protected String getNewDocumentName() {
- // TODO Auto-generated method stub
- return null;
- }
-
-
- protected String getNewDocumentId() {
- Document doc = getSourceDocument();
- return doc.getId();
- }
-
- protected boolean getVisibleInNav(){
- return true;
- }
-
- protected String getDocumentTypeName() {
- ResourceType resourceType = null;
- ServiceSelector selector = null;
- String docType="";
- try {
- selector = (ServiceSelector) this.manager.lookup(ResourceType.ROLE + "Selector");
- resourceType = lookUpExtension(getSourceExtension(), selector);
- docType=resourceType.getName();
- } catch (ServiceException e) {
- throw new RuntimeException(e);
- }finally {
- if (selector != null) {
- this.manager.release(selector);
- }
- }
- return docType;
- }
-
-}
Modified: lenya/trunk/src/modules/neutron/neutron.js
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/neutron/neutron.js?rev=420643&r1=420642&r2=420643&view=diff
==============================================================================
--- lenya/trunk/src/modules/neutron/neutron.js (original)
+++ lenya/trunk/src/modules/neutron/neutron.js Mon Jul 10 15:06:57 2006
@@ -1,264 +0,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.
-*/
-
-/* Helper method to add all request parameters to a usecase */
-function passRequestParameters(flowHelper, usecase) {
- var names = cocoon.request.getParameterNames();
- while (names.hasMoreElements()) {
- var name = names.nextElement();
- if (!name.equals("lenya.usecase")
- && !name.equals("lenya.continuation")
- && !name.equals("submit")) {
-
- var value = flowHelper.getRequest(cocoon).get(name);
-
- var string = new Packages.java.lang.String();
- if (string.getClass().isInstance(value)) {
- usecase.setParameter(name, value);
- }
- else {
- usecase.setPart(name, value);
- }
-
- }
- }
-}
-
-/* Helper method to add all request headers to a usecase */
-function passRequestHeaders(flowHelper, usecase) {
- var names = cocoon.request.getHeaderNames();
- while (names.hasMoreElements()) {
- var name = names.nextElement();
- var value = flowHelper.getRequest(cocoon).getHeader(name);
-
- var string = new Packages.java.lang.String();
- if (string.getClass().isInstance(value)) {
- usecase.setParameter("header-"+name, value);
- }
- else {
- usecase.setPart("header-"+name, value);
- }
- }
-}
-
-function selectMethod() {
- var page = cocoon.parameters["page"];
- var requestURI = cocoon.parameters["requestURI"];
- var method = cocoon.request.getMethod();
- cocoon.sendPage(method+"/"+page, {"requestURI":requestURI});
-}
-
-function sendStatus(sc) {
- cocoon.sendStatus(sc);
-}
-
-function put() {
- var status = executeUsecase("neutron.put");
- if(status)
- sendStatus(204);
- else {
- sendStatus(415);
- }
-}
-
-function get() {
- var uri = new java.lang.String(cocoon.parameters["forward"]);
- var uri = uri.substring(8, uri.length());
- cocoon.sendPage(uri);
-}
-
-/*
- * convert the overwrite header into a boolean type
- */
-function isOverwrite(header) {
- var overwrite = true;
- if (header == 'F') {
- overwrite = false;
- }
- return overwrite;
-}
-
-function executeUsecase(usecaseName) {
- var view;
- var proxy;
- var menu = "nomenu";
-
- var usecaseResolver;
- var usecase;
- var sourceUrl;
-
- if (cocoon.log.isDebugEnabled())
- cocoon.log.debug("usecases.js::executeUsecase() called, parameter lenya.usecase = [" + usecaseName + "]");
-
- try {
-
- var flowHelper = cocoon.getComponent("org.apache.lenya.cms.cocoon.flow.FlowHelper");
- var request = flowHelper.getRequest(cocoon);
- sourceUrl = Packages.org.apache.lenya.util.ServletHelper.getWebappURI(request);
-
- usecaseResolver = cocoon.getComponent("org.apache.lenya.cms.usecase.UsecaseResolver");
- usecase = usecaseResolver.resolve(sourceUrl, usecaseName);
- usecase.setSourceURL(sourceUrl);
- usecase.setName(usecaseName);
- view = usecase.getView();
-
- passRequestParameters(flowHelper, usecase);
- passRequestHeaders(flowHelper, usecase);
- usecase.checkPreconditions();
- usecase.lockInvolvedObjects();
- proxy = new Packages.org.apache.lenya.cms.usecase.UsecaseProxy(usecase);
- }
- finally {
- /* done with usecase component, tell usecaseResolver to release it */
- if (usecaseResolver != null) {
- if (usecase != null) {
- usecaseResolver.release(usecase);
- usecase = undefined;
- }
- cocoon.releaseComponent(usecaseResolver);
- }
- }
-
- var success = false;
- //var targetUrl;
- var form;
- var scriptString;
- var evalFunc;
- var generic;
-
- /*
- * If the usecase has a view, this means we want to display something
- * to the user before proceeding. This also means the usecase consists
- * several steps; repeated until the user chooses to submit or cancel.
- *
- * If the usecase does not have a view, it is simply executed.
- */
-
- if (view) {
- var ready = false;
- while (!ready) {
-
- try {
- var templateUri = view.getTemplateURI();
- if (templateUri) {
- var viewUri = "view/" + menu + "/" + view.getTemplateURI();
- if (cocoon.log.isDebugEnabled())
- cocoon.log.debug("usecases.js::executeUsecase() in usecase " + usecaseName + ", creating view, calling Cocoon with viewUri = [" + viewUri + "]");
-
- cocoon.sendPageAndWait(viewUri, {"usecase" : proxy});
-
- }
- else {
- var viewUri = view.getViewURI();
- cocoon.sendPage(viewUri);
- return;
- }
- }
- catch (exception) {
- /* if an exception was thrown by the view, allow the usecase to rollback the transition */
- try {
- usecaseResolver = cocoon.getComponent("org.apache.lenya.cms.usecase.UsecaseResolver");
- usecase = usecaseResolver.resolve(sourceUrl, usecaseName);
- proxy.setup(usecase);
- usecase.cancel();
- throw exception;
- }
- finally {
- if (usecaseResolver != null) {
- if (usecase != null) {
- usecaseResolver.release(usecase);
- usecase = undefined;
- }
- cocoon.releaseComponent(usecaseResolver);
- }
- }
- }
-
- if (cocoon.log.isDebugEnabled())
- cocoon.log.debug("usecases.js::executeUsecase() in usecase " + usecaseName + ", after view, now advancing in usecase");
-
- try {
- usecaseResolver = cocoon.getComponent("org.apache.lenya.cms.usecase.UsecaseResolver");
- usecase = usecaseResolver.resolve(sourceUrl, usecaseName);
- proxy.setup(usecase);
-
- passRequestParameters(flowHelper, usecase);
- usecase.advance();
-
- if (cocoon.request.getParameter("submit")) {
- usecase.checkExecutionConditions();
- if (! usecase.hasErrors()) {
- usecase.execute();
- if (! usecase.hasErrors()) {
- usecase.checkPostconditions();
- if (! usecase.hasErrors()) {
- ready = true;
- success = true;
- }
- }
- }
- }
- else if (cocoon.request.getParameter("cancel")) {
- usecase.cancel();
- ready = true;
- }
- proxy = new Packages.org.apache.lenya.cms.usecase.UsecaseProxy(usecase);
- }
- catch (exception) {
- /* allow usecase to rollback the transition */
- usecase.cancel();
- throw exception;
- }
- finally {
- if (usecaseResolver != null) {
- if (usecase != null) {
- usecaseResolver.release(usecase);
- usecase = undefined;
- }
- cocoon.releaseComponent(usecaseResolver);
- }
- }
- }
- }
- else {
- try {
- usecaseResolver = cocoon.getComponent("org.apache.lenya.cms.usecase.UsecaseResolver");
- usecase = usecaseResolver.resolve(sourceUrl, usecaseName);
- proxy.setup(usecase);
-
- usecase.execute();
- if (! usecase.hasErrors()) {
- usecase.checkPostconditions();
- if (! usecase.hasErrors()) {
- success = true;
- }
- }
- }
- catch (exception) {
- /* allow usecase to rollback the transition */
- usecase.cancel();
- throw exception;
- }
- finally {
- usecaseResolver.release(usecase);
- usecase = undefined;
- cocoon.releaseComponent(usecaseResolver);
- }
- }
-
- return success;
-
-}
Modified: lenya/trunk/src/modules/neutron/sitemap.xmap
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/neutron/sitemap.xmap?rev=420643&r1=420642&r2=420643&view=diff
==============================================================================
--- lenya/trunk/src/modules/neutron/sitemap.xmap (original)
+++ lenya/trunk/src/modules/neutron/sitemap.xmap Mon Jul 10 15:06:57 2006
@@ -15,18 +15,10 @@
limitations under the License.
-->
-<!-- $Id: usecase-bxe.xmap 345495 2005-11-18 15:11:30Z chestnut $ -->
+<!-- $Id: $ -->
<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
- <map:components/>
-
- <!-- =========================== Flow ===================================== -->
-
- <map:flow language="javascript">
- <map:script src="fallback://lenya/modules/neutron/neutron.js"/>
- </map:flow>
- <!-- =========================== Pipelines ================================ -->
<map:pipelines>
<!-- Introspection -->
@@ -44,6 +36,20 @@
</map:pipeline>
<map:pipeline>
+
+ <map:match pattern="open" type="step">
+ <map:select type="resource-exists">
+ <map:parameter name="prefix" value="lenyadoc:/"/>
+ <map:when test="{page-envelope:document-language}/{page-envelope:document-id}">
+ <map:read src="lenyadoc:/{page-envelope:document-language}/{page-envelope:document-id}"/>
+ </map:when>
+ <map:otherwise>
+ <map:generate src="context://lenya/content/util/empty.xml"/>
+ <map:serialize type="xml" status-code="412"/>
+ </map:otherwise>
+ </map:select>
+ </map:match>
+
<map:match pattern="checkout" type="step">
<map:select type="resource-exists">
<map:parameter name="prefix" value="lenyadoc:/"/>
@@ -61,17 +67,69 @@
</map:otherwise>
</map:select>
</map:match>
+
+ <map:match pattern="save" type="step">
+ <!-- test if the document is checked out -->
+ <map:act type="reserved-checkout-test">
+ <map:generate src="checkout-exception.xml"/>
+ <map:serialize type="xml" status-code="500"/>
+ </map:act>
+ <map:generate type="stream"/>
+ <map:transform src="fallback://lenya/modules/neutron/xslt/addSourceTags.xsl">
+ <map:parameter name="source" value="context://lenya/pubs/{page-envelope:publication-id}/content/{page-envelope:area}/{page-envelope:document-path}"/>
+ </map:transform>
+ <map:transform type="write-source">
+ <map:parameter name="serializer" value="xml"/>
+ </map:transform>
+ <map:serialize type="xml"/>
+ </map:match>
<map:match pattern="checkin" type="step">
+ <!-- test if the document is checked out -->
+ <map:act type="reserved-checkout-test">
+ <map:generate src="checkout-exception.xml"/>
+ <map:serialize type="xml" status-code="500"/>
+ </map:act>
+ <map:generate type="stream"/>
+ <map:transform src="fallback://lenya/modules/neutron/xslt/addSourceTags.xsl">
+ <map:parameter name="source" value="context://lenya/pubs/{page-envelope:publication-id}/content/{page-envelope:area}/{page-envelope:document-path}"/>
+ </map:transform>
+ <map:transform type="write-source">
+ <map:parameter name="serializer" value="xml"/>
+ </map:transform>
<map:act type="reserved-checkin">
<map:generate src="checkin-exception.xml"/>
<map:serialize type="xml" status-code="500"/>
</map:act>
- <map:call function="put"/>
- <map:generate src="context://lenya/content/util/empty.xml"/>
- <map:serialize type="xml" status-code="200"/>
- </map:match>
+ <map:serialize type="xml"/>
+ </map:match>
+
+ <map:match pattern="lock" type="step">
+ <map:select type="resource-exists">
+ <map:parameter name="prefix" value="lenyadoc:/"/>
+ <map:when test="{page-envelope:document-language}/{page-envelope:document-id}">
+ <map:act type="reserved-checkout">
+ <!-- TODO: add info from RCML ... -->
+ <map:generate src="checkout-exception.xml"/>
+ <map:serialize type="xml" status-code="500"/>
+ </map:act>
+ </map:when>
+ <map:otherwise>
+ <map:generate src="context://lenya/content/util/empty.xml"/>
+ <map:serialize type="xml" status-code="412"/>
+ </map:otherwise>
+ </map:select>
+ </map:match>
+
+ <map:match pattern="unlock" type="step">
+ <map:act type="reserved-checkin">
+ <map:generate src="checkin-exception.xml"/>
+ <map:serialize type="xml" status-code="500"/>
+ </map:act>
+ </map:match>
+
</map:pipeline>
+
</map:pipelines>
</map:sitemap>
Added: lenya/trunk/src/modules/neutron/xslt/addSourceTags.xsl
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/neutron/xslt/addSourceTags.xsl?rev=420643&view=auto
==============================================================================
--- lenya/trunk/src/modules/neutron/xslt/addSourceTags.xsl (added)
+++ lenya/trunk/src/modules/neutron/xslt/addSourceTags.xsl Mon Jul 10 15:06:57 2006
@@ -0,0 +1,24 @@
+<?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: removeSourceTags.xsl 42703 2004-03-13 12:57:53Z gregor $ -->
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+
+<xsl:import href="fallback://lenya/xslt/authoring/edit/addSourceTags.xsl"/>
+
+</xsl:stylesheet>
Modified: lenya/trunk/src/modules/neutron/xslt/introspection.xsl
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/neutron/xslt/introspection.xsl?rev=420643&r1=420642&r2=420643&view=diff
==============================================================================
--- lenya/trunk/src/modules/neutron/xslt/introspection.xsl (original)
+++ lenya/trunk/src/modules/neutron/xslt/introspection.xsl Mon Jul 10 15:06:57 2006
@@ -32,13 +32,13 @@
<introspection>
<edit mime-type="application/xml" name="Body Content">
-<!--
- <open url="{$context}/{$publication}/authoring/{$page-id}.xml" method="GET"/>
--->
+ <!--<open url="{$context}/{$publication}/authoring/{$page-id}.xml?lenya.module=neutron&lenya.step=open" method="GET"/>-->
<checkout url="{$context}/{$publication}/authoring/{$page-id}.xml?lenya.module=neutron&lenya.step=checkout" method="GET"/>
- <save url="{$context}/{$publication}/authoring/{$page-id}.xml?lenya.module=neutron&lenya.step=checkin" method="PUT"/>
+ <save url="{$context}/{$publication}/authoring/{$page-id}.xml?lenya.module=neutron&lenya.step=save" method="PUT"/>
+
+ <checkin url="{$context}/{$publication}/authoring/{$page-id}.xml?lenya.module=neutron&lenya.step=checkin" method="PUT"/>
Added: lenya/trunk/src/modules/neutron/xslt/removeSourceTags.xsl
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/neutron/xslt/removeSourceTags.xsl?rev=420643&view=auto
==============================================================================
--- lenya/trunk/src/modules/neutron/xslt/removeSourceTags.xsl (added)
+++ lenya/trunk/src/modules/neutron/xslt/removeSourceTags.xsl Mon Jul 10 15:06:57 2006
@@ -0,0 +1,24 @@
+<?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: removeSourceTags.xsl 42703 2004-03-13 12:57:53Z gregor $ -->
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+
+<xsl:import href="fallback://lenya/xslt/authoring/edit/removeSourceTags.xsl"/>
+
+</xsl:stylesheet>
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org