Mandalay support for ccm-sci-assets-publications-about

git-svn-id: https://svn.libreccm.org/ccm/trunk@2617 8810af33-2d31-482b-a856-94f89814c4df
master
jensp 2014-04-17 08:42:00 +00:00
parent a0625f19f9
commit 993b73d5de
9 changed files with 349 additions and 2 deletions

View File

@ -83,7 +83,7 @@ public class SciPublicationsAboutExtraXMLGenerator implements ExtraXMLGenerator
final Publication discussed,
final PageState state) {
final XmlGenerator generator = new XmlGenerator(discussed);
generator.setItemElemName("discussedPublication", "");
generator.setItemElemName("publication", "");
generator.setListMode(true);
generator.generateXML(state, parent, "");
}
@ -92,7 +92,7 @@ public class SciPublicationsAboutExtraXMLGenerator implements ExtraXMLGenerator
final Publication discussing,
final PageState state) {
final XmlGenerator generator = new XmlGenerator(discussing);
generator.setItemElemName("discussingPublication", "");
generator.setItemElemName("publication", "");
generator.setListMode(true);
generator.generateXML(state, parent, "");
}

View File

@ -57,6 +57,8 @@
<line id="RIS">RIS</line>
<line id="downloadAsRIS">Als RIS herunterladen</line>
<line id="discussingPublications/heading">Wird in folgenden Publikationen behandelt</line>
<line id="discussedPublications/heading">Behandelt folgende Publikationen</line>
<line id="librarySignatures/heading">Bibliotheken</line>
<line id="articleInCollectedVolume/abstract">Zusammenfassung</line>

View File

@ -81,6 +81,8 @@
<useLeadText/>
<useContent/>
<useEditLink/>
<showDiscussedPublications/>
<showDiscussingPublications/>
</showContent>
</div>

View File

@ -0,0 +1,117 @@
/*!
* jQuery Cookie Plugin v1.4.0
* https://github.com/carhartl/jquery-cookie
*
* Copyright 2013 Klaus Hartl
* Released under the MIT license
*/
(function (factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as anonymous module.
define(['jquery'], factory);
} else {
// Browser globals.
factory(jQuery);
}
}(function ($) {
var pluses = /\+/g;
function encode(s) {
return config.raw ? s : encodeURIComponent(s);
}
function decode(s) {
return config.raw ? s : decodeURIComponent(s);
}
function stringifyCookieValue(value) {
return encode(config.json ? JSON.stringify(value) : String(value));
}
function parseCookieValue(s) {
if (s.indexOf('"') === 0) {
// This is a quoted cookie as according to RFC2068, unescape...
s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
}
try {
// Replace server-side written pluses with spaces.
// If we can't decode the cookie, ignore it, it's unusable.
s = decodeURIComponent(s.replace(pluses, ' '));
} catch(e) {
return;
}
try {
// If we can't parse the cookie, ignore it, it's unusable.
return config.json ? JSON.parse(s) : s;
} catch(e) {}
}
function read(s, converter) {
var value = config.raw ? s : parseCookieValue(s);
return $.isFunction(converter) ? converter(value) : value;
}
var config = $.cookie = function (key, value, options) {
// Write
if (value !== undefined && !$.isFunction(value)) {
options = $.extend({}, config.defaults, options);
if (typeof options.expires === 'number') {
var days = options.expires, t = options.expires = new Date();
t.setDate(t.getDate() + days);
}
return (document.cookie = [
encode(key), '=', stringifyCookieValue(value),
options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
options.path ? '; path=' + options.path : '',
options.domain ? '; domain=' + options.domain : '',
options.secure ? '; secure' : ''
].join(''));
}
// Read
var result = key ? undefined : {};
// To prevent the for loop in the first place assign an empty array
// in case there are no cookies at all. Also prevents odd result when
// calling $.cookie().
var cookies = document.cookie ? document.cookie.split('; ') : [];
for (var i = 0, l = cookies.length; i < l; i++) {
var parts = cookies[i].split('=');
var name = decode(parts.shift());
var cookie = parts.join('=');
if (key && key === name) {
// If second argument (value) is a function it's a converter...
result = read(cookie, value);
break;
}
// Prevent storing a cookie that we couldn't decode.
if (!key && (cookie = read(cookie)) !== undefined) {
result[name] = cookie;
}
}
return result;
};
config.defaults = {};
$.removeCookie = function (key, options) {
if ($.cookie(key) !== undefined) {
// Must not alter options, thus extending a fresh object...
$.cookie(key, '', $.extend({}, options, { expires: -1 }));
return true;
}
return false;
};
}));

View File

@ -0,0 +1,92 @@
/**
JavaScript for minimizing/toggling the header image.
Uses JQuery and the JQuery cookie plugin
*/
//Create namespace to avoid possible naming conflicts
var minimizeImage = {};
/**
This function is called using the onClick attribute of the image toogle link.
@param imageClass The (css) class of the div encapsulating the img element
@param linkClass The (css) class assigned to the linkClass
@param minimizeLabel Text to show for the minimize link (image is maximized)
@param maximizeLabel Text to show for the maximize link (image is minimized)
*/
minimizeImage.minimize = function (imageClass,
linkClass,
minimizeLabel,
maximizeLabel) {
if ($("." + imageClass + " img.minimized").css("display") == "none") {
//Image is currently maximized, minimized image is not visible
//Display minimized image
$("." + imageClass + " img.minimized").css("display", "inline");
//Hide maximized image
$("." + imageClass + " img.maximized").css("display", "none");
//Toogle link text to maximizeLabel
$("." + linkClass).removeClass("maximized");
$("." + linkClass).addClass("minimized");
$("." + linkClass).text(maximizeLabel);
//Store status in cookie
$.cookie(imageClass + "Status", 'minimized', { path: "/" });
} else {
//Image is currently minimized.
//Hide minimized image
$("." + imageClass + " img.minimized").css("display", "none");
//Show maximized image
$("." + imageClass + " img.maximized").css("display", "inline");
//Toogle link text to minimizeLabel
$("." + linkClass).removeClass("minimized");
$("." + linkClass).addClass("maximized");
$("." + linkClass).text(minimizeLabel);
//Store status in cookie
$.cookie(imageClass + "Status", 'maximized', { path: "/" });
}
return false;
}
/**
This function is called by the JavaScript block inserted after the link when the
HTML document is loaded (using JQuery $(document).ready). It restores the
status from a previous visit on the site.
*/
minimizeImage.restore = function(imageClass,
linkClass,
minimizeLabel,
maximizeLabel) {
//alert("restoring!");
//var status = $.cookie(imageClass + "Status", { path: "/" });
var status = $.cookie(imageClass + "Status", String);
//alert("status = " + status);
if (status == 'minimized') {
$("." + imageClass + " img.minimized").css("display", "inline");
$("." + imageClass + " img.maximized").css("display", "none");
$("." + linkClass).removeClass("maximized");
$("." + linkClass).addClass("minimized");
$("." + linkClass).text(maximizeLabel);
} else {
$("." + imageClass + " img.minimized").css("display", "none");
$("." + imageClass + " img.maximized").css("display", "inline");
$("." + linkClass).removeClass("minimized");
$("." + linkClass).addClass("maximized");
$("." + linkClass).text(minimizeLabel);
}
//alert(imageClass + "Status = " + $.cookie(imageClass + "Status"));
}

View File

@ -108,6 +108,14 @@
<xsl:template match="showPublicationLibrarySignatures">
<xsl:call-template name="showPublicationLibrarySignatures"/>
</xsl:template>
<xsl:template match="showDiscussedPublications">
<xsl:call-template name="showDiscussedPublications"/>
</xsl:template>
<xsl:template match="showDiscussingPublications">
<xsl:call-template name="showDiscussingPublications"/>
</xsl:template>
<xsl:template match="showPPPOwnerName">
<xsl:apply-templates select="$resultTree//ppp:ownerName"/>

View File

@ -33,6 +33,7 @@
<xsl:import href="SciPublications/exportLinks.xsl"/>
<xsl:import href="SciPublications/formatParser.xsl"/>
<xsl:import href="SciPublications/librarySignatures.xsl"/>
<xsl:import href="SciPublications/publications-about.xsl"/>
<xsl:import href="SciPublications/SciPublicationsList.xsl"/>

View File

@ -516,6 +516,8 @@
<xsl:with-param name="useRelativeUrl" select="$useRelativeUrl" />
</xsl:call-template>
</xsl:template>
<xsl:template name="CT_CollectedVolume_List" match="nav:item[nav:attribute[@name='objectType'] = 'com.arsdigita.cms.contenttypes.CollectedVolume']" mode="list_view">
<xsl:param name="useRelativeUrl" select="'false'" />
<xsl:variable name="formatDefFile">

View File

@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE stylesheet [<!ENTITY nbsp '&#160;'>]>
<!--
Copyright: 2014 Jens Pelzetter
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/>.
-->
<!--
XSL file for displaying the informations provided by the ccm-sci-assets-publicationsabout module.
To show the data add the <showDiscussedPublications/> tag and/or the </showDiscussingPublications/>
tag to your layout file.
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:bebop="http://www.arsdigita.com/bebop/1.0"
xmlns:cms="http://www.arsdigita.com/cms/1.0"
xmlns:nav="http://ccm.redhat.com/navigation"
xmlns:mandalay="http://mandalay.quasiweb.de"
exclude-result-prefixes="xsl bebop cms nav mandalay"
version="1.0">
<xsl:template name="showDiscussedPublications">
<xsl:param name="layoutTree" select="."/>
<xsl:if test="$resultTree//discussedPublications">
<xsl:variable name="setHeading">
<xsl:call-template name="mandalay:getSetting">
<xsl:with-param name="node" select="$layoutTree/setHeading" />
<xsl:with-param name="module" select="'SciPublications'" />
<xsl:with-param name="setting" select="'discussedPublications/setHeading'" />
<xsl:with-param name="default" select="'true'" />
</xsl:call-template>
</xsl:variable>
<div class="discussedPublications">
<xsl:if test="$setHeading = 'true'">
<h2>
<xsl:call-template name="mandalay:getStaticText">
<xsl:with-param name="module"
select="'SciPublications'"/>
<xsl:with-param name="id"
select="'discussedPublications/heading'"/>
</xsl:call-template>
</h2>
</xsl:if>
<ul>
<xsl:for-each select="$resultTree//discussedPublications/publication">
<xsl:sort select="./yearOfPublication" data-type="number" order="descending"/>
<xsl:sort select="./title" data-type="text"/>
<li>
<xsl:apply-templates select="." mode="list_view"/>
</li>
</xsl:for-each>
</ul>
</div>
</xsl:if>
</xsl:template>
<xsl:template name="showDiscussingPublications">
<xsl:param name="layoutTree" select="."/>
<xsl:if test="$resultTree//discussingPublications">
<xsl:variable name="setHeading">
<xsl:call-template name="mandalay:getSetting">
<xsl:with-param name="node" select="$layoutTree/setHeading" />
<xsl:with-param name="module" select="'SciPublications'" />
<xsl:with-param name="setting" select="'discussingPublications/setHeading'" />
<xsl:with-param name="default" select="'true'" />
</xsl:call-template>
</xsl:variable>
<div class="discussingPublications">
<xsl:if test="$setHeading = 'true'">
<h2>
<xsl:call-template name="mandalay:getStaticText">
<xsl:with-param name="module"
select="'SciPublications'"/>
<xsl:with-param name="id"
select="'discussingPublications/heading'"/>
</xsl:call-template>
</h2>
</xsl:if>
<ul>
<xsl:for-each select="$resultTree//discussingPublications/publication">
<xsl:sort select="./yearOfPublication" data-type="number" order="descending"/>
<xsl:sort select="./title" data-type="text"/>
<li>
<xsl:apply-templates select="." mode="list_view"/>
</li>
</xsl:for-each>
</ul>
</div>
</xsl:if>
</xsl:template>
</xsl:stylesheet>