Foundry Content-Center:

- Preview link is now shown
	- Item Category Step now works with Foundry


git-svn-id: https://svn.libreccm.org/ccm/trunk@2967 8810af33-2d31-482b-a856-94f89814c4df
master
jensp 2014-11-13 13:16:51 +00:00
parent 9d91cdda2a
commit 3ccb33927a
8 changed files with 513 additions and 23 deletions

View File

@ -1,4 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<foundry:configuration xmlns:foundry="http://foundry.libreccm.org">
<setting id="content-view-menu/layout">horizontal</setting>
<setting id="category-step-summary/show-delete-link">false</setting>
</foundry:configuration>

View File

@ -5,6 +5,7 @@
<application name = "" page-class=""></application>
-->
<application name="admin" internal="true">admin-layout.xml</application>
<application name="login" internal="true">admin-layout.xml</application>
<application name="navigation" class="portalPage">portal-workspace.xml</application>
<application name="navigation" class="portalGridPage">portal-workspace-grid.xml</application>
<application name="none" class="cms-admin" internal="true">admin-layout.xml</application>

View File

@ -1,4 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE stylesheet [<!ENTITY nbsp '&#160;'>
<!ENTITY shy '&#173;'>]>
<!--
Copyright 2014 Jens Pelzetter for the LibreCCM Foundation
@ -83,11 +85,11 @@
</xsl:choose>
</xsl:template>
<xsl:template match="show-global-navigation/show-help-link">
<xsl:template match="show-cms-global-navigation/show-help-link">
<xsl:apply-templates select="$data-tree/cms:globalNavigation/cms:help"/>
</xsl:template>
<xsl:template match="show-global-navigation/show-preview-link">
<xsl:template match="show-cms-global-navigation/show-preview-link">
<span class="cms-preview">
<xsl:apply-templates select="$data-tree/bebop:link[@id='preview_link']"/>
</span>
@ -194,4 +196,305 @@
</xsl:choose>
</xsl:template>
<!-- _______________________________________________________________________________________ -->
<!-- Begin of category step -->
<xsl:template match="cms:categoryStep">
<h2>
<xsl:value-of select="foundry:get-internal-static-text('cms', 'category-step/header')"/>
</h2>
<xsl:apply-templates/>
</xsl:template>
<!-- Show all category roots -->
<xsl:template match="cms:categoryRoots">
<dl class="cmsCategoryRoots">
<xsl:apply-templates/>
</dl>
</xsl:template>
<!-- Show selected categories and a link zu select more -->
<xsl:template match="cms:categoryRoot">
<xsl:variable name="cat-name" select="@name"/>
<dt class="cmsCategoryRoot">
<xsl:value-of select="@name"/>
</dt>
<dd>
<!-- Using two kinds of links. First, non-javascript link form addAction. Second, a
javascript link using ajax to manipulate categories. For the second method, the
onClick-event handler is overwriting the html link if javscript is running. -->
<a href="{@addAction}" onclick="this.href='{@addJSAction}';">
<xsl:value-of select="foundry:get-internal-static-text('cms', 'category-step/add-categories')"/>
</a>
<xsl:choose>
<xsl:when test="count(../../cms:itemCategories/cms:itemCategory[starts-with(@path, $cat-name)]) = 0">
<div>
<xsl:value-of select="foundry:get-internal-static-text('cms',
'category-step/no-categories')"/>
</div>
</xsl:when>
<xsl:otherwise>
<ul>
<xsl:apply-templates select="../../cms:itemCategories/cms:itemCategory[starts-with(@path, $cat-name)]"
mode="list">
<xsl:sort select="@path"/>
</xsl:apply-templates>
</ul>
</xsl:otherwise>
</xsl:choose>
</dd>
<br />
</xsl:template>
<!-- Show an assigned category and a link to remove this assignment. Because this template is meant
to be called only by cms:categoryRoot, there is a mode="list" added. Otherwise there will be
a duplicated list below the list of category roots. -->
<xsl:template match="cms:itemCategory" mode="list">
<xsl:variable name="show-delete-link"
select="foundry:get-setting('cms',
'category-step-summary/show-delete-link',
'false')"/>
<li>
<xsl:choose>
<xsl:when test="$show-delete-link = 'true' and @deleteAction">
<a href="{@deleteAction}">
<xsl:attribute name="title"
select="foundry:get-internal-static-text('cms', 'category-step/remove-category')"/>
<img alt="[X]">
<xsl:attribute name="src"
select="foundry:gen-path('images/cms/categoryDelete.png',
true())"/>
</img>
&nbsp;
<xsl:value-of select="@path"/>
</a>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@path"/>
</xsl:otherwise>
</xsl:choose>
</li>
</xsl:template>
<!-- Show categories to select -->
<xsl:template match="cms:categoryWidget">
<!-- <script type="text/javascript" src="/assets/prototype.js"/> -->
<!--<script type="text/javascript" src="{$context-prefix}/assets/jquery.js"/> -->
<!--<script type="text/javascript" src="{$theme-prefix}/includes/cms/category-step.js"/> -->
<xsl:choose>
<xsl:when test="@mode='javascript'">
<ul>
<xsl:apply-templates select="cms:category" mode="javascript"/>
</ul>
<xsl:apply-templates select="cms:selectedCategories"/>
</xsl:when>
<xsl:otherwise>
<select name="@name" size="30" multiple="multiple">
<xsl:apply-templates mode="plain">
<xsl:sort data-type="number" select="@sortKey"/>
</xsl:apply-templates>
</select>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="cms:selectedCategories">
<select id="catWdHd" name="{../@name}" size="5" multiple="multiple" style="display: none">
<xsl:apply-templates select="cms:category" mode="hidden"/>
</select>
</xsl:template>
<xsl:template match="cms:category" mode="hidden">
<option value="{@id}">
<xsl:value-of select="@id"/>
</option>
<xsl:apply-templates select="cms:category" mode="hidden"/>
</xsl:template>
<!-- Toggle parts of the category tree with AJAX -->
<!-- cms:category is using to different syntax. The other one is located in cmsSummary. -->
<xsl:template match="cms:category" mode="javascript">
<xsl:variable name="only-one-level">
<xsl:choose>
<xsl:when test="not(@root = '1' or cms:category/@expand = 'all')
and not(//cms:categoryWidget)">
<xsl:value-of select="'yes'"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="'no'"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<li id="catSelf{@id}">
<!-- Treefunctions (expand and collapse) -->
<xsl:variable name="tree-toogle-mode">
<xsl:choose>
<xsl:when test="@root = '1' or cms:category/@expand = 'all'">
<xsl:text>catBranchToggle</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>catToggle</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="selCats">
<xsl:for-each select="//cms:categoryWidget/cms:selectedCategories/cms:category">
<xsl:choose>
<xsl:when test="position() != last()">
<xsl:value-of select="concat(@id, ', ')"/>
</xsl:when>
<xsl:otherwise >
<xsl:value-of select="@id"/>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:variable>
<xsl:choose>
<xsl:when test="cms:category and $only-one-level = 'no'">
<a id="catTreeToggleLink{@node-id}" href="#"
onclick="{$tree-toogle-mode}('{@node-id}', '{$selCats}');">
<img id="catTreeToggleImage{@node-id}" alt="-">
<xsl:attribute name="src"
select="foundry:gen-path('images/cms/categoryCollapse.png',
true())"/>
</img>
</a>
</xsl:when>
<xsl:when test="(@root = '1' and not(cms:category))
or ($only-one-level = 'yes' and cms:category)">
<a id="catTreeToggleLink{@node-id}"
href="#"
onclick="{$tree-toogle-mode}('{@node-id}', '{$selCats}');">
<img id="catTreeToggleImage{@node-id}" alt="+">
<xsl:attribute name="src"
select="foundry:gen-path('images/cms/categoryExpand.png',
true())"/>
</img>
</a>
</xsl:when>
<xsl:otherwise>
<img id="catTreeToggleImage{@node-id}" alt=" ">
<xsl:attribute name="src"
select="foundry:gen-path('images/cms/categoryNode.png',
true())"/>
</img>
</xsl:otherwise>
</xsl:choose>
&nbsp;
<!-- Choose categories -->
<xsl:choose>
<xsl:when test="@isSelected = '1'">
<a id="catToggleLink{@id}" href="#" onclick="catDeselect({@id});">
<img id="catToggleImage{@id}" alt="[X]">
<xsl:attribute name="src"
select="foundry:gen-path('images/cms/categorySelected.gif',
true())"/>
</img>
</a>
</xsl:when>
<xsl:when test="@isAbstract = '1'">
<img id="catToggleImage{@id}" alt=" ">
<xsl:attribute name="src"
select="foundry:gen-path('images/cms/categoryAbstract.gif',
true())"/>
</img>
</xsl:when>
<xsl:otherwise>
<a id="catToggleLink{@id}" href="#" onclick="catSelect({@id});">
<img id="catToggleImage{@id}" alt="[ ]" title="Select">
<xsl:attribute name="src"
select="foundry:gen-path('images/cms/categoryUnselected.gif',
true())"/>
</img>
</a>
</xsl:otherwise>
</xsl:choose>
&nbsp;
<!-- DE Name der Kategorie -->
<!-- category name -->
<xsl:value-of select="@name"/>
<ul id="catBranch{@node-id}">
<xsl:if test="$only-one-level = 'yes'">
<xsl:attribute name="style">
<xsl:value-of select="'display: none;'"/>
</xsl:attribute>
</xsl:if>
<xsl:if test="./cms:category">
<xsl:choose>
<xsl:when test="@order='sortKey'">
<xsl:apply-templates mode="javascript">
<xsl:sort data-type="number" select="@sortKey"/>
</xsl:apply-templates>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates mode="javascript">
<xsl:sort data-type="text" select="@name"/>
</xsl:apply-templates>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</ul>
</li>
</xsl:template>
<!-- DE Kategorieeintrag ohne Javascript -->
<!-- Category entry without javascript -->
<!-- DE cms:category wird in zwei verschiedenen Syntax verwendet. Die andere ist in
cmsSummary zu finden. -->
<!-- cms:category is using to different syntax. The other one is located in cmsSummary. -->
<xsl:template match="cms:category" mode="plain">
<option value="{@id}">
<xsl:if test="@isSelected = '1'">
<xsl:attribute name="selected">
selected
</xsl:attribute>
</xsl:if>
<xsl:if test="@isAbstract = '1' or @isSelected = '1'">
<xsl:attribute name="disabled">
disabled
</xsl:attribute>
</xsl:if>
<xsl:value-of select="@fullname"/>
</option>
<xsl:apply-templates mode="plain">
<xsl:sort data-type="number" select="@sortKey"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="cms:emptyPage[@title='childCategories']">
<xsl:choose>
<xsl:when test="cms:category/@order='sortKey'">
<xsl:apply-templates select="cms:category/cms:category" mode="javascript">
<xsl:sort data-type="number" select="@sortKey"/>
</xsl:apply-templates>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="cms:category/cms:category" mode="javascript">
<xsl:sort data-type="text" select="@name"/>
</xsl:apply-templates>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="cms:emptyPage[@title='autoCategories']">
<xsl:choose>
<xsl:when test="cms:category/@order='sortKey'">
<xsl:apply-templates select="cms:category" mode="javascript" >
<xsl:sort data-type="number" select="@sortKey"/>
</xsl:apply-templates>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="cms:category" mode="javascript" >
<xsl:sort data-type="text" select="@name"/>
</xsl:apply-templates>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>

View File

@ -65,6 +65,10 @@
<xsl:apply-templates select="$data-tree//bebop:currentPane/bebop:boxPanel//bebop:layoutPanel/bebop:body
| $data-tree//bebop:currentPane/bebop:boxPanel//bebop:layoutPanel/bebop:right"/>
</xsl:when>
<xsl:when test="$data-tree/bebop:form">
<xsl:apply-templates select="$data-tree/bebop:form"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="$data-tree//bebop:currentPane/bebop:layoutPanel/bebop:body

View File

@ -1979,15 +1979,33 @@
<foundry:doc section="user" type="template-tag">
<foundry:doc-attributes>
<foundry:doc-attribute name="absolute">
<foundry:doc-attribute name="origin" mandatory="no">
<p>
If set to <code>true</code> the path in the <code>src</code> is used as it is.
The <code>origin</code> attribute determines the how the path provided in the
<code>src</code> attribute is interpreted. The following values are interpreted:
</p>
<dl>
<dt>absolute</dt>
<dd>
The path is interpreted as absolute path and is not processed by Foundry.
</dd>
<dt>internal</dt>
<dd>
The script is loaded from the internal (<code>foundry/scripts</code>)
scripts directory.
</dd>
<dt>theme</dt>
<dd>
This is default which is also used when the the <code>origin</code>
attribute is not present. The script is loaded from the <code>scripts</code>
directory of the theme.
</dd>
</dl>
</foundry:doc-attribute>
<foundry:doc-attribute name="src">
<foundry:doc-attribute name="src" mandatory="yes">
<p>
The path of the script to include. If the <code>absolute></code> attribute is not
set (or not set to <code>true</code> the path is interpreted relative to the
The path of the script to include. If the <code>origin</code> attribute is not
set (or not set to <code>absolute</code> the path is interpreted relative to the
theme directory. For example the path of a script included using
</p>
<pre>
@ -2002,10 +2020,10 @@
network.
</p>
</foundry:doc-attribute>
<foundry:doc-attribute name="type">
<foundry:doc-attribute name="type" mandatory="no">
<p>
The type of the script. Usally this is <code>text/javascript</code>. If the attribute
is not set in the layout template, it is automatically set to
The type of the script. Usally this is <code>text/javascript</code>. If the
attribute is not set in the layout template, it is automatically set to
<code>text/javascript</code>.
</p>
</foundry:doc-attribute>
@ -2036,17 +2054,21 @@
</xsl:choose>
</xsl:attribute>
<xsl:if test="./@src">
<xsl:attribute name="src">
<xsl:choose>
<xsl:when test="./@absolute = 'true'">
<xsl:attribute name="src"
select="if (./@origin = 'absolute')
then ./@src
else foundry:gen-path(./@src, ./@origin = 'internal')"/>
<!--<xsl:choose>
<xsl:when test="./@origin = 'absolute'">
<xsl:value-of select="./@src"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="foundry:gen-path(./@src)"/>
</xsl:otherwise>
<xsl:otherwise>
<xsl:value-of select="foundry:gen-path(./@src,
./@origin = 'internal')"/>
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
</xsl:attribute>-->
</xsl:if>
<xsl:if test="string-length(.)">
<xsl:value-of select="."/>

View File

@ -0,0 +1,137 @@
/*
Copyright: 2006, 2007, 2008 Sören Bernstein
This file is part of Mandalay.
Mandalay is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
Mandalay is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Mandalay. If not, see <http://www.gnu.org/licenses/>.
*/
/* DE
Diese Funktionen sind Teil der AJAX-Seite zum Zuweisen der Kategorien.
*/
/* EN
These functions are part of the ajax-pages to assign categories.
*/
// DE Lade einen Kategorienzweig nach, wenn dieser aufgeklappt wird
// EN Loading a branch of categories when it is expanded
function catBranchToggle(id, selCats) {
var elToggleTreeImage = document.getElementById("catTreeToggleImage" + id);
var elBranch = document.getElementById("catBranch" + id);
if(elBranch.style.display == "" || elBranch.style.display == "none") {
if(elBranch.innerHTML == "" || elBranch.innerHTML == "...") {
elBranch.innerHTML = "...";
elBranch.style.display = "block";
$(elBranch).load("load-cat.jsp", "nodeID=" + id + "&selectedCats=" + selCats);
} else {
elBranch.style.display = "block";
}
elToggleTreeImage.src = elToggleTreeImage.src.replace("Expand", "Collapse");
elToggleTreeImage.alt = "[-]";
} else {
elBranch.style.display = "none";
elToggleTreeImage.src = elToggleTreeImage.src.replace("Collapse", "Expand");
elToggleTreeImage.alt = "[+]";
}
return false;
}
// DE Wechselt die Ansicht eines Kategorienzweiges
// EN Toggles display of a branch of categories
function catToggle(id, selCats) {
var elToggleTreeImage = document.getElementById("catTreeToggleImage" + id);
var elBranch = document.getElementById("catBranch" + id);
if(elBranch.style.display == "" || elBranch.style.display == "none") {
elBranch.style.display = "block";
elToggleTreeImage.src = elToggleTreeImage.src.replace("Expand", "Collapse");
elToggleTreeImage.alt = "[-]";
} else {
elBranch.style.display = "none";
elToggleTreeImage.src = elToggleTreeImage.src.replace("Collapse", "Expand");
elToggleTreeImage.alt = "[+]";
}
return false;
}
// DE Wählt eine Kategorie aus
// EN Select a category
function catSelect(id) {
var elWidgetHidden = document.getElementById("catWdHd");
var found = 0;
for(var i = 0; i < elWidgetHidden.options.length && found == 0; i++) {
if(elWidgetHidden.options[i].value == id) {
found = 1;
}
}
if(! found) {
var optHidden = new Option('add ' + id, id, false, true);
elWidgetHidden.options[elWidgetHidden.options.length] = optHidden;
}
// DE Ändere den Link
// EN Change link
var elToggleLink = document.getElementById("catToggleLink" + id);
elToggleLink.removeAttribute("onclick");
elToggleLink.setAttribute("onclick", "catDeselect('" + id + "');");
// DE Ändere das Icon
// EN Change image
var elToggleImage = document.images["catToggleImage" + id];
elToggleImage.src = elToggleImage.src.replace("Unselected", "Selected");
elToggleImage.alt = "[X]";
return false;
}
// DE Macht eine Auswahl rückgängig
// EN Deselect a category
function catDeselect(id) {
var elWidgetHidden = document.getElementById("catWdHd");
var found = 0;
for(var i = 0; i < elWidgetHidden.options.length; i++) {
if(elWidgetHidden.options[i].value == id) {
if(elWidgetHidden.options[i].text == id) {
found = 1;
}
elWidgetHidden.removeChild(elWidgetHidden.options[i]);
}
}
if (found) {
var optHidden = new Option('del ' + id, id, false, true);
elWidgetHidden.options[elWidgetHidden.options.length] = optHidden;
}
// DE Ändert den Link
// EN Change link
var elToggleLink = document.getElementById("catToggleLink" + id);
elToggleLink.removeAttribute("onclick");
elToggleLink.setAttribute("onclick", "catSelect('" + id + "');");
// DE Ändert das Icon
// EN Change image
var elToggleImage = document.images["catToggleImage" + id];
elToggleImage.src = elToggleImage.src.replace("Selected", "Unselected");
elToggleImage.alt = "[ ]";
return false;
}

View File

@ -7,6 +7,8 @@
<show-page-title/>
</title>
<load-css-files/>
<load-jquery/>
<script src="scripts/category-step.js" origin="internal"/>
</head>
<body id="cms-page">
<div id="cms-header" class="header-height">
@ -56,12 +58,12 @@
<div class="content-title">
<show-bebop-page-title/>
</div>
</div>
<div id="content-view-menu">
<show-cms-content-view-menu/>
<show-cms-global-navigation>
<show-preview-link/>
</show-cms-global-navigation>
<div id="content-view-menu">
<show-cms-content-view-menu/>
<show-cms-global-navigation>
<show-preview-link/>
</show-cms-global-navigation>
</div>
</div>
<div id="content" class="column-content">
<show-body-column/>

View File

@ -4,4 +4,22 @@
<translation lang="de">Willkommen</translation>
<translation lang="en">Welcome</translation>
</text>
<text id="category-step/header">
<translation lang="de">Kategorienzuweisen bearbeiten</translation>
<translation lang="en">Edit assigned categories</translation>
</text>
<text id="category-step/add-categories">
<translation lang="de">Kategoriezuweisung ändern</translation>
<translation lang="en">Change associated categories</translation>
</text>
<text id="category-step/no-categories">
<translation lang="de">Es sind keine Kategorien dieses Kontextes zugewiesen</translation>
<translation lang="en">There are no categories assigned in this context.</translation>
</text>
<text id="category-step/remove-category">
<translation lang="de">Zuweisung aufheben</translation>
<translation lang="en">Remove assignment</translation>
</text>
</foundry:static-texts>