Hi,
here are the 2 usecases/kupu files I edited.
Best regards,
Sebastian
Sebastian Stelmasik schrieb:
Hi Annie,
I've found a solution - I've uncommented the other links section in
linklibraries.xlm.jx, wrote a other2kupulibrary.xsl (all under
ressources) and edited usecase-kupu.js and .xmap (under usecases). Now
I have a additional section "Other Links" under internal links, where
I can add download links to uploaded PDFs, DOCs, XLS, ... and other
files I define in other2kupulibrary.xsl.
Bye,
Sebastian
Annie Dumont schrieb:
Hi Sebastian,
I don't know if this is the easier method, but this is the one i use.
You have two things to know to make the link :
- the ID of the document
- the name of your pdf
The ID of the document is readable on the Site tab of lenya. It is in
the "Overview"
You take just the last part of the adress after the last slash :
If Document ID is /description/adress you have to keep "adress"
If it is /description/adress/south keep "south"
If it is /description keep "description"
In your document under kupu, the adress for the link will be
PartOfID/NameOfTheDocument
Exemple : if the document is named MyDocument.pdf the adress will
be, in the same order than above :
adress/MyDocument.pdf
south/MyDocument.pdf
description/MyDocument.pdf
Make link !
Hope it helps.
Annie
Sebastian Stelmasik a écrit :
Hi all,
I've a Problems with Lenya/Kopu and attachments:
1.) How do I create links to other ressources then pictures (i.e.
I've uploaded some PDFs and would like to link them within the page).
I have to use kopu, because we have to use IE...
Best regards,
Sebastian
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
Sebastian Stelmasik
X-CELL COMMUNICATIONS GmbH
--------------------------
Office Ratingen
Broichhofstr. 13
40880 Ratingen
Phone: +49 (0)2102/55344-39
Fax: +49 (0)2102/55344-40
--------------------------
Office Düsseldorf
Glockenstr. 33c
40476 Düsseldorf
Phone: +49 (0)211/58040-30
Fax: +49 (0)211/58040-31
--------------------------
web: www.x-cell.com
e-mail: [EMAIL PROTECTED]
--------------------------
X-CELL COMMUNICATIONS unterstützt Ihren Unternehmenserfolg durch Konzeption,
Realisierung und Betreuung von innovativen webbasierten
Kommunikationslösungen.
X-CELL COMMUNICATIONS ensures the success of your company by conceptual
design, development and support of innovative web-based solutions for
optimization of communication processes.
/*
* 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.
*
*/
importClass(Packages.java.util.ArrayList);
importClass(Packages.org.apache.lenya.cms.cocoon.flow.FlowHelper);
importClass(Packages.org.apache.lenya.cms.publication.DocumentHelper);
importClass(Packages.org.apache.lenya.cms.publication.PublicationHelper);
importClass(Packages.org.apache.lenya.cms.publication.ResourcesManager);
/**
* Kupu usecase flow.
* @version $Id$
*/
/**
* Collects all link/url information from a publication's siteree.
* This information is used to generate xml for the Kupu (link) library drawer.
*/
function sitetree_link_library() {
var flowHelper = new FlowHelper();
var documentHelper = flowHelper.getDocumentHelper(cocoon);
var pageEnvelope = flowHelper.getPageEnvelope(cocoon);
var siteTree =
pageEnvelope.getPublication().getTree(pageEnvelope.getDocument().getArea());
var allNodes = siteTree.getNode("/").preOrder();
var resources = new ArrayList(allNodes.size()-1);
var addedResourcesCount = 0;
for(var i=1; i<allNodes.size(); i++) {
var languageLabel =
allNodes.get(i).getLabel(pageEnvelope.getDocument().getLanguage())
/* If the current sitree node does not exist in the displayed
document's language
* Continue with next node. This is a quick fix for bug #32808.
* Next step would be to offer all links to the available
languages.
* by roku
*/
if (languageLabel == null) continue;
resources.add(addedResourcesCount, {
"url" :
documentHelper.getDocumentUrl(allNodes.get(i).getAbsoluteId(),
pageEnvelope.getDocument().getArea(), null),
"label" : languageLabel.getLabel(),
"id" : allNodes.get(i).getId(),
"fullid" : allNodes.get(i).getAbsoluteId(),
"language" : pageEnvelope.getDocument().getLanguage()});
addedResourcesCount++;
}
cocoon.sendPage("sitetree_link_library_template", {"resources" :
resources});
}
/**
* Collects infos about all image resources in a publication.
*/
function publication_image_library() {
var pageEnvelope = new FlowHelper().getPageEnvelope(cocoon);
var pubHelper = new PublicationHelper(pageEnvelope.getPublication());
var allDocs =
pubHelper.getAllDocuments(pageEnvelope.getDocument().getArea(),
pageEnvelope.getDocument().getLanguage());
var imageInfos = new ArrayList();
for(var i=0; i<allDocs.length; i++) {
if(allDocs[i].getId().equals(pageEnvelope.getDocument().getId()))
continue;
var resourcesMgr = new ResourcesManager(allDocs[i]);
var imageResources = resourcesMgr.getImageResources();
for(var j=0; j<imageResources.length; j++) {
var metaDoc =
org.apache.lenya.xml.DocumentHelper.readDocument(resourcesMgr.getMetaFile(imageResources[j]));
var title =
metaDoc.getElementsByTagNameNS("http://purl.org/dc/elements/1.1/",
"title").item(0).getChildNodes().item(0).getNodeValue();
imageInfos.add({
"url" : pageEnvelope.getContext() + "/" +
resourcesMgr.getResourceUrl(imageResources[j]),
"name" : imageResources[j].getName(),
"title" : title,
"length" : imageResources[j].length(),
"iconUrl" : cocoon.parameters["iconUrl"]
});
}
}
cocoon.sendPage(cocoon.parameters["template"], {"imageInfos" : imageInfos});
}
function other_link_library() {
var pageEnvelope = new FlowHelper().getPageEnvelope(cocoon);
var pubHelper = new PublicationHelper(pageEnvelope.getPublication());
var allDocs =
pubHelper.getAllDocuments(pageEnvelope.getDocument().getArea(),
pageEnvelope.getDocument().getLanguage());
var imageInfos = new ArrayList();
for(var i=0; i<allDocs.length; i++) {
if(allDocs[i].getId().equals(pageEnvelope.getDocument().getId()))
continue;
var resourcesMgr = new ResourcesManager(allDocs[i]);
var imageResources = resourcesMgr.getImageResources();
for(var j=0; j<imageResources.length; j++) {
var metaDoc =
org.apache.lenya.xml.DocumentHelper.readDocument(resourcesMgr.getMetaFile(imageResources[j]));
var title =
metaDoc.getElementsByTagNameNS("http://purl.org/dc/elements/1.1/",
"title").item(0).getChildNodes().item(0).getNodeValue();
imageInfos.add({
"url" : pageEnvelope.getContext() + "/" +
resourcesMgr.getResourceUrl(imageResources[j]),
"name" : imageResources[j].getName(),
"title" : title,
"length" : imageResources[j].length(),
"iconUrl" : cocoon.parameters["iconUrl"]
});
}
}
cocoon.sendPage(cocoon.parameters["template"], {"imageInfos" : imageInfos});
}
<?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.
-->
<!-- $Id: usecase-kupu.xmap 155802 2005-03-01 17:10:58Z tschlabach $ -->
<!--
Kupu usecase sitemaps. Integrates the Kupu editor (http://kupu.oscom.org/) into Lenya.
Most matchers serve as callbacks for Kupu running in a client's browser.
Make sure that Kupu is installed under lenya/resources/kupu.
Most of (re)sources used in generators and transfomers of this sitemap
are located in the Kupu distribution.
Enjoy using Kupu.
-->
<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
<!-- =========================== Components ================================ -->
<map:components/>
<!-- =========================== Resources ================================ -->
<map:resources>
<map:resource name="style-cms-page">
<map:transform type="i18n">
<map:parameter name="locale" value="{request:locale}"/>
</map:transform>
<map:transform src="{global:basedir}/xslt/util/page2xhtml.xsl">
<map:parameter name="contextprefix" value="{request:contextPath}"/>
</map:transform>
<map:transform src="{global:basedir}/xslt/util/strip_namespaces.xsl"/>
<map:serialize type="xhtml"/>
</map:resource>
</map:resources>
<!-- =========================== Flow ===================================== -->
<map:flow language="javascript">
<map:script src="usecase-kupu.js"/>
<map:script src="../edit-document.js"/>
</map:flow>
<!-- =========================== Pipelines ================================ -->
<map:pipelines>
<map:component-configurations>
<global-variables>
<!-- To access core resources -->
<basedir>../..</basedir>
<resourceIconUrl>kupu/apache-lenya/lenya/images/right_arrow.png</resourceIconUrl>
</global-variables>
</map:component-configurations>
<map:pipeline internal-only="true">
<map:match pattern="kupu-stream">
<map:generate type="stream"/>
<map:serialize type="xml"/>
</map:match>
<!-- Flow callbacks -->
<map:match pattern="sitetree_link_library_template">
<map:generate src="{fallback:resources/kupu/apache-lenya/lenya/drawers/sitetree_link_library.xml.jx}" type="jx">
<map:parameter name="resource-icon-url" value="{page-envelope:context-prefix}/kupu/apache-lenya/lenya/images/right_arrow.png"/>
</map:generate>
<map:serialize type="xml"/>
</map:match>
<map:match pattern="publication_image_library_template">
<map:generate src="{fallback:resources/kupu/apache-lenya/lenya/drawers/publication_image_library.xml.jx}" type="jx">
<map:parameter name="resource-icon-url" value="{page-envelope:context-prefix}/{global:resourceIconUrl}"/>
</map:generate>
<map:serialize type="xml"/>
</map:match>
<map:match pattern="other_link_library_template">
<map:generate src="{fallback:resources/kupu/apache-lenya/lenya/drawers/other_link_library.xml.jx}" type="jx">
<map:parameter name="resource-icon-url" value="{page-envelope:context-prefix}/{global:resourceIconUrl}"/>
</map:generate>
<map:serialize type="xml"/>
</map:match>
<map:match pattern="request2document">
<map:aggregate element="edit-envelope">
<map:part element="edited" src="cocoon:/kupu-stream"/>
<map:part element="original"
src="{global:basedir}/pubs/{page-envelope:publication-id}/content/authoring/{page-envelope:document-path}"/>
</map:aggregate>
<map:transform src="{fallback:resources/kupu/apache-lenya/lenya/kupusave.xsl}"/>
<map:serialize type="xml"/>
</map:match>
</map:pipeline>
<!-- Usecase pipeline -->
<map:pipeline>
<map:match pattern="kupu" type="usecase">
<map:match pattern="open" type="step">
<map:match pattern="*/authoring/**.html">
<!-- Check if Kupu is installed -->
<map:act type="resource-exists"
src="{global:basedir}/resources/kupu/apache-lenya/kupu/kupumacros.html">
<map:act type="reserved-checkout">
<map:generate type="serverpages"
src="{global:basedir}/content/rc/{exception}.xsp">
<map:parameter name="user" value="{user}"/>
<map:parameter name="filename" value="{filename}"/>
<map:parameter name="date" value="{date}"/>
<map:parameter name="message" value="{message}"/>
</map:generate>
<map:transform src="{global:basedir}/xslt/rc/rco-exception.xsl"/>
<map:call resource="style-cms-page"/>
</map:act>
<map:generate
src="{fallback:resources/kupu/apache-lenya/kupu/kupumacros.html}"/>
<map:transform src="{fallback:resources/kupu/apache-lenya/lenya/kupumacros.xsl}">
<map:parameter name="contentfile"
value="{request:requestURI}?lenya.usecase=kupu&lenya.step=content"/>
<map:parameter name="context-prefix" value="{request:contextPath}"/>
<!-- Only used to display the document path of the edited doc -->
<map:parameter name="document-path" value="{page-envelope:document-path}"/>
<map:parameter name="save-destination"
value="{request:requestURI}?lenya.usecase=kupu&lenya.step=save"/>
<map:parameter name="exit-destination"
value="{request:requestURI}?lenya.usecase=kupu&lenya.step=exit"/>
<map:parameter name="reload-after-save" value="1"/>
<map:parameter name="use-css" value="1"/>
<map:parameter name="imagedrawer-xsl-uri"
value="{request:requestURI}?lenya.usecase=kupu&lenya.step=imagedrawerxsl"/>
<map:parameter name="linkdrawer-xsl-uri"
value="{request:requestURI}?lenya.usecase=kupu&lenya.step=linkdrawerxsl"/>
<map:parameter name="image-libraries-uri"
value="{request:requestURI}?lenya.usecase=kupu&lenya.step=image_libraries"/>
<map:parameter name="link-libraries-uri"
value="{request:requestURI}?lenya.usecase=kupu&lenya.step=link_libraries"/>
</map:transform>
<map:serialize type="html"/>
</map:act>
<!-- If Kupu is not installed; Action failed -->
<map:generate src="{global:basedir}/resources/misc/kupu/download.xhtml"/>
<map:call resource="style-cms-page"/>
</map:match>
</map:match>
<!-- Requested by Kupu to load the document into the editor -->
<map:match pattern="content" type="step">
<map:match pattern="*/authoring/**">
<map:generate src="{global:basedir}/pubs/{1}/content/authoring/{page-envelope:document-path}"/>
<map:transform
src="{fallback:resources/kupu/apache-lenya/lenya/content2edit.xsl}">
<map:parameter name="css"
value="{page-envelope:context-prefix}/{1}/authoring/css/page.css"/>
<map:parameter name="nodeid" value="{page-envelope:document-node-id}"/>
</map:transform>
<map:transform src="{global:basedir}/xslt/util/strip_namespaces.xsl"/>
<map:serialize type="html"/>
</map:match>
</map:match>
<!-- Kupu Image Drawer -->
<map:match pattern="*drawerxsl" type="step">
<map:generate type="jx" src="{fallback:resources/kupu/apache-lenya/lenya/drawers/{1}drawer.xsl}">
<!-- We need to use the hole uri scheme i.e. http://servername:port/, since IE xslt processor
throws an access violation upon loading of xslts from the internet.
-->
<map:parameter name="import-stylesheet-url"
value="{request:scheme}://{request:serverName}:{request:serverPort}{page-envelope:context-prefix}/kupu/common/kupudrawers/drawer.xsl"/>
</map:generate>
<map:serialize type="xml"/>
</map:match>
<map:match pattern="image_libraries" type="step">
<map:generate src="{fallback:resources/kupu/apache-lenya/lenya/drawers/imagelibraries.xml.jx}" type="jx">
<map:parameter name="pubLibUrl" value="{request:requestURI}?lenya.usecase=kupu&lenya.step=publication_image_library"/>
<map:parameter name="pageLibUrl" value="{request:requestURI}?lenya.usecase=kupu&lenya.step=page_image_library"/>
<map:parameter name="imageBaseUrl" value="{page-envelope:context-prefix}/kupu/apache-lenya/lenya/images"/>
</map:generate>
<map:serialize type="xml"/>
</map:match>
<map:match pattern="link_libraries" type="step">
<map:generate src="{fallback:resources/kupu/apache-lenya/lenya/drawers/linklibraries.xml.jx}" type="jx">
<map:parameter name="pubLibUrl" value="{request:requestURI}?lenya.usecase=kupu&lenya.step=sitetree_link_library"/>
<map:parameter name="pageLibUrl" value="{request:requestURI}?lenya.usecase=kupu&lenya.step=other_link_library"/>
<map:parameter name="imageBaseUrl" value="{page-envelope:context-prefix}/kupu/apache-lenya/lenya/images"/>
</map:generate>
<map:serialize type="xml"/>
</map:match>
<map:match pattern="page_image_library" type="step">
<map:generate src="{fallback:content/info/assets.xsp}" type="serverpages"/>
<map:transform src="{fallback:resources/kupu/apache-lenya/lenya/pageassets2kupulibrary.xsl}">
<map:parameter name="iconUrl" value="{page-envelope:context-prefix}/{global:resourceIconUrl}"/>
<map:parameter name="nodeid" value="{page-envelope:document-node-id}"/>
</map:transform>
<map:serialize type="xml"/>
</map:match>
<map:match pattern="other_link_library" type="step">
<map:generate src="{fallback:content/info/assets.xsp}" type="serverpages"/>
<map:transform src="{fallback:resources/kupu/apache-lenya/lenya/other2kupulibrary.xsl}">
<map:parameter name="iconUrl" value="{page-envelope:context-prefix}/{global:resourceIconUrl}"/>
<map:parameter name="nodeid" value="{page-envelope:document-node-id}"/>
</map:transform>
<map:serialize type="xml"/>
</map:match>
<map:match pattern="sitetree_link_library" type="step">
<map:call function="sitetree_link_library"/>
</map:match>
<map:match pattern="publication_image_library" type="step">
<map:call function="publication_image_library">
<map:parameter name="template" value="publication_image_library_template"/>
<map:parameter name="iconUrl" value="{page-envelope:context-prefix}/{global:resourceIconUrl}"/>
</map:call>
</map:match>
<map:match pattern="other_link_library" type="step">
<map:call function="other_link_library">
<map:parameter name="template" value="other_link_library_template"/>
<map:parameter name="iconUrl" value="{page-envelope:context-prefix}/{global:resourceIconUrl}"/>
</map:call>
</map:match>
<map:match pattern="*_library" type="step">
<map:generate src="{fallback:resources/kupu/apache-lenya/lenya/drawers/{1}_library.xml.jx}" type="jx"/>
<map:serialize type="xml"/>
</map:match>
<!-- /Kupu Image Drawer -->
<!-- Checkin document on exit and trigger workflow -->
<map:match pattern="exit" type="step">
<map:act type="reserved-checkin">
<map:generate src="{global:basedir}/content/rc/{exception}.xsp" type="serverpages">
<map:parameter name="user" value="{user}"/>
<map:parameter name="filename" value="{filename}"/>
<map:parameter name="checkType" value="{checkType}"/>
<map:parameter name="date" value="{date}"/>
<map:parameter name="message" value="{message}"/>
</map:generate>
<map:transform src="{global:basedir}/xslt/rc/rco-exception.xsl"/>
<map:call resource="style-cms-page"/>
</map:act>
<map:redirect-to uri="{request:requestURI}"/>
</map:match>
<!--
Kupu uses PUT to transmit the edited file for save.
The problem is, Kupu removes namespace information.
That means we can not use the StreamGenerator, because
it complains about an unbound element.
-->
<map:match pattern="save" type="step">
<map:select type="request-method">
<map:when test="PUT">
<map:act type="reserved-checkout-test">
<map:generate type="serverpages"
src="{global:basedir}/../../content/rc/{exception}.xsp">
<map:parameter name="user" value="{user}"/>
<map:parameter name="filename" value="{filename}"/>
<map:parameter name="date" value="{date}"/>
<map:parameter name="message" value="{message}"/>
</map:generate>
<map:transform src="{global:basedir}/../../xslt/rc/rco-exception.xsl"/>
<map:call resource="style-cms-page"/>
</map:act>
<map:call function="editDocument">
<map:parameter name="sourceUri" value="cocoon:/request2document"/>
<map:parameter name="useBuffer" value="true"/>
<map:parameter name="noCheckin" value="true"/>
</map:call>
</map:when>
</map:select>
</map:match>
</map:match>
</map:pipeline>
</map:pipelines>
</map:sitemap>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]