First part of the asset for associating publications which are talking about each other.
git-svn-id: https://svn.libreccm.org/ccm/trunk@2612 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
e62f9c1727
commit
0faaa1bddb
|
|
@ -0,0 +1,30 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<ccm:application xmlns:ccm="http://ccm.redhat.com/ccm-project"
|
||||||
|
name="ccm-sci-assets-publicationsabout"
|
||||||
|
prettyName="ScientificCMS Publications module asset for relatating publications which discussing another publication"
|
||||||
|
version="6.6.0"
|
||||||
|
release="1"
|
||||||
|
webapp="ROOT">
|
||||||
|
|
||||||
|
<ccm:dependencies>
|
||||||
|
<ccm:requires name="ccm-core" version="6.6.0" release="ge"/>
|
||||||
|
<ccm:requires name="ccm-cms" version="6.6.0" release="ge"/>
|
||||||
|
<ccm:requires name="ccm-sci-publications" version="6.6.5" relation="ge"/>
|
||||||
|
</ccm:dependencies>
|
||||||
|
|
||||||
|
<ccm:directories>
|
||||||
|
<ccm:directory name="pdl"/>
|
||||||
|
<ccm:directory name="sql"/>
|
||||||
|
<ccm:directory name="src"/>
|
||||||
|
</ccm:directories>
|
||||||
|
|
||||||
|
<ccm:contacts>
|
||||||
|
<ccm:contact uri="http://www.scientificcms.org" type="website"/>
|
||||||
|
<ccm:contact uri="mailto:info@scientificcms.org" type="support"/>
|
||||||
|
</ccm:contacts>
|
||||||
|
|
||||||
|
<ccm:description>
|
||||||
|
This assets for the SciPublications allows it to define associatons between a publication and one or more other publications which are discussed by the publication.
|
||||||
|
</ccm:description>
|
||||||
|
|
||||||
|
</ccm:application>
|
||||||
|
|
@ -0,0 +1,36 @@
|
||||||
|
//
|
||||||
|
// Copyright (C) 2014 Jens Pelzetter
|
||||||
|
//
|
||||||
|
// This library is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU Lesser General Public License
|
||||||
|
// as published by the Free Software Foundation; either version 2.1 of
|
||||||
|
// the License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This library 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
|
||||||
|
// Lesser General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Lesser General Public
|
||||||
|
// License along with this library; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
//
|
||||||
|
//
|
||||||
|
|
||||||
|
model com.arsdigita.cms.contentassets;
|
||||||
|
|
||||||
|
import com.arsdigita.cms.contenttypes.PublicationBundle;
|
||||||
|
import com.arsdigita.kernel.ACSObjects;
|
||||||
|
|
||||||
|
association {
|
||||||
|
|
||||||
|
PublicationBundle[0..n] discussedBy = join ct_publication_bundles.bundle_id
|
||||||
|
to ca_publications_about.discussed_publication_id,
|
||||||
|
join ca_publications_about.discussing_publication_id
|
||||||
|
to ct_publication_bundles.bundle_id;
|
||||||
|
|
||||||
|
PublicationBundle[0..n] discusses = join ct_publication_bundles.bundle_id
|
||||||
|
to ca_publications_about.discussing_publication_id,
|
||||||
|
join ca_publications_about.discussed_publication_id
|
||||||
|
to ct_publication_bundles.bundle_id;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
@@ ddl/oracle-se/create.sql
|
||||||
|
@@ ddl/oracle-se/deferred.sql
|
||||||
|
|
@ -0,0 +1,4 @@
|
||||||
|
begin;
|
||||||
|
\i ddl/postgres/create.sql
|
||||||
|
\i ddl/postgres/deferred.sql
|
||||||
|
commit;
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<xrd:adapters
|
||||||
|
xmlns:xrd="http://xmlns.redhat.com/schemas/waf/xml-renderer-rules"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://rhea.redhat.com/schemas/waf/xml-renderer-rules xml-renderer-rules.xsd">
|
||||||
|
|
||||||
|
<xrd:context name="com.arsdigita.cms.dispatcher.SimpleXMLGenerator">
|
||||||
|
<xrd:adapter objectType="com.arsdigita.cms.contentassets.SciPublicationsAbout">
|
||||||
|
|
||||||
|
</xrd:adapter>
|
||||||
|
</xrd:context>
|
||||||
|
|
||||||
|
</xrd:adapters>
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
<load>
|
||||||
|
<requires>
|
||||||
|
<table name="inits"/>
|
||||||
|
<table name="acs_objects"/>
|
||||||
|
<table name="cms_items"/>
|
||||||
|
<table name="ct_publications"/>
|
||||||
|
|
||||||
|
<initializer class="com.arsdigita.cms.Initializer"/>
|
||||||
|
<initializer class="com.arsdigita.cms.contenttypes.PublicationInitializer"/>
|
||||||
|
</requires>
|
||||||
|
|
||||||
|
<provides>
|
||||||
|
<table name="ca_publications_about"/>
|
||||||
|
<initializer class="com.arsdigita.cms.contentassets.SciPublicationsAboutInitializer"/>
|
||||||
|
</provides>
|
||||||
|
|
||||||
|
<scripts>
|
||||||
|
<schema directory="ccm-sci-assets-publicationsabout"/>
|
||||||
|
<data class="com.arsdigita.cms.contentassets.SciPublicationsAboutLoader"/>
|
||||||
|
</scripts>
|
||||||
|
</load>
|
||||||
|
|
@ -0,0 +1,4 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<registry>
|
||||||
|
<!--Nothing yet-->
|
||||||
|
</registry>
|
||||||
|
|
@ -0,0 +1,56 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2010 Jens Pelzetter
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2.1 of
|
||||||
|
* the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library 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
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package com.arsdigita.cms.contentassets;
|
||||||
|
|
||||||
|
import com.arsdigita.cms.ContentBundle;
|
||||||
|
import com.arsdigita.cms.contenttypes.Publication;
|
||||||
|
import com.arsdigita.domain.DomainCollection;
|
||||||
|
import com.arsdigita.domain.DomainObjectFactory;
|
||||||
|
import com.arsdigita.persistence.DataCollection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter <jens@jp-digital.de>
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
|
public class PublicationCollection extends DomainCollection {
|
||||||
|
|
||||||
|
public PublicationCollection(final DataCollection dataCollection) {
|
||||||
|
super(dataCollection);
|
||||||
|
|
||||||
|
m_dataCollection.addOrder("name");
|
||||||
|
}
|
||||||
|
|
||||||
|
public Publication getPublication() {
|
||||||
|
|
||||||
|
final ContentBundle bundle = (ContentBundle) DomainObjectFactory.newInstance(
|
||||||
|
m_dataCollection.getDataObject());
|
||||||
|
|
||||||
|
return (Publication) bundle.getPrimaryInstance();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Publication getPublication(final String language) {
|
||||||
|
final ContentBundle bundle = (ContentBundle) DomainObjectFactory.newInstance(
|
||||||
|
m_dataCollection.getDataObject()
|
||||||
|
);
|
||||||
|
|
||||||
|
return (Publication) bundle.getInstance(language);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,44 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2013 Jens Pelzetter
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2.1 of
|
||||||
|
* the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library 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
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package com.arsdigita.cms.contentassets;
|
||||||
|
|
||||||
|
import com.arsdigita.globalization.GlobalizedMessage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter <jens@jp-digital.de>
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
|
public class SciPublicationsAboutGlobalizationUtil {
|
||||||
|
|
||||||
|
private SciPublicationsAboutGlobalizationUtil() {
|
||||||
|
//Nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final String BUNDLE_NAME = "com.arsdigita.cms.contentassets.SciPublicationsAboutResources";
|
||||||
|
|
||||||
|
public static GlobalizedMessage globalize(final String key) {
|
||||||
|
return new GlobalizedMessage(key, BUNDLE_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static GlobalizedMessage globalize(final String key, final Object[] args) {
|
||||||
|
return new GlobalizedMessage(key, BUNDLE_NAME, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,92 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2013 Jens Pelzetter
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2.1 of
|
||||||
|
* the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library 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
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package com.arsdigita.cms.contentassets;
|
||||||
|
|
||||||
|
import com.arsdigita.cms.contentassets.ui.SciPublicationsAboutDiscussesStep;
|
||||||
|
import com.arsdigita.cms.contentassets.ui.SciPublicationsAboutDiscussingStep;
|
||||||
|
import com.arsdigita.cms.contenttypes.ContentItemTraversalAdapter;
|
||||||
|
import com.arsdigita.cms.contenttypes.Publication;
|
||||||
|
import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
|
||||||
|
import com.arsdigita.db.DbHelper;
|
||||||
|
import com.arsdigita.domain.DomainObjectTraversalAdapter;
|
||||||
|
import com.arsdigita.domain.xml.TraversalHandler;
|
||||||
|
import com.arsdigita.globalization.GlobalizedMessage;
|
||||||
|
import com.arsdigita.persistence.pdl.ManifestSource;
|
||||||
|
import com.arsdigita.persistence.pdl.NameFilter;
|
||||||
|
import com.arsdigita.runtime.CompoundInitializer;
|
||||||
|
import com.arsdigita.runtime.DomainInitEvent;
|
||||||
|
import com.arsdigita.runtime.PDLInitializer;
|
||||||
|
import com.arsdigita.runtime.RuntimeConfig;
|
||||||
|
import com.arsdigita.xml.XML;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter <jens@jp-digital.de>
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
|
public class SciPublicationsAboutInitializer extends CompoundInitializer {
|
||||||
|
|
||||||
|
public SciPublicationsAboutInitializer() {
|
||||||
|
final String url = RuntimeConfig.getConfig().getJDBCURL();
|
||||||
|
final int database = DbHelper.getDatabaseFromURL(url);
|
||||||
|
|
||||||
|
add(new PDLInitializer(new ManifestSource(
|
||||||
|
"ccm-sci-assets-publicationsabout.pdl.mf",
|
||||||
|
new NameFilter(DbHelper.getDatabaseSuffix(database), "pdl"))));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init(final DomainInitEvent event) {
|
||||||
|
|
||||||
|
super.init(event);
|
||||||
|
|
||||||
|
final String traversal = "/WEB-INF/traversal-adapters/com/arsdigita/cms/contentassets/"
|
||||||
|
+ "SciPublicationsAbout.xml";
|
||||||
|
XML.parseResource(traversal, new TraversalHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void registerAdapter(final String objectType,
|
||||||
|
final DomainObjectTraversalAdapter adapter,
|
||||||
|
final String context) {
|
||||||
|
ContentItemTraversalAdapter.registerAssetAdapter("discussedBy", adapter, context);
|
||||||
|
ContentItemTraversalAdapter.registerAssetAdapter("discusses", adapter, context);
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
AuthoringKitWizard.registerAssetStep(
|
||||||
|
Publication.BASE_DATA_OBJECT_TYPE,
|
||||||
|
SciPublicationsAboutDiscussesStep.class,
|
||||||
|
new GlobalizedMessage("com.arsdigita.cms.contentassets.about.discusses.label",
|
||||||
|
"com.arsdigita.cms.contentassets.SciPublicationsAboutResources"),
|
||||||
|
new GlobalizedMessage("com.arsdigita.cms.contentassets.about.discusses.desc",
|
||||||
|
"com.arsdigita.cms.contentassets.SciPublicationsAboutResources"),
|
||||||
|
30);
|
||||||
|
|
||||||
|
AuthoringKitWizard.registerAssetStep(
|
||||||
|
Publication.BASE_DATA_OBJECT_TYPE,
|
||||||
|
SciPublicationsAboutDiscussingStep.class,
|
||||||
|
new GlobalizedMessage("com.arsdigita.cms.contentassets.about.discussing.label",
|
||||||
|
"com.arsdigita.cms.contentassets.SciPublicationsAboutResources"),
|
||||||
|
new GlobalizedMessage("com.arsdigita.cms.contentassets.about.discussing.desc",
|
||||||
|
"com.arsdigita.cms.contentassets.SciPublicationsAboutResources"),
|
||||||
|
40);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,37 @@
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2014 Jens Pelzetter
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2.1 of
|
||||||
|
* the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library 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
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package com.arsdigita.cms.contentassets;
|
||||||
|
|
||||||
|
import com.arsdigita.loader.PackageLoader;
|
||||||
|
import com.arsdigita.runtime.ScriptContext;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter <jens@jp-digital.de>
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
|
public class SciPublicationsAboutLoader extends PackageLoader {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run(final ScriptContext ctx) {
|
||||||
|
//Nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
|
||||||
|
com.arsdigita.cms.contentassets.about.discusses.label=Discusses
|
||||||
|
com.arsdigita.cms.contentassets.about.discussing.label=Discussed by
|
||||||
|
com.arsdigita.cms.contentassets.about.discusses.add=Add a discussed publication
|
||||||
|
com.arsdigita.cms.contentassets.about.discusses.none=No publications found
|
||||||
|
com.arsdigita.cms.contentassets.about.discusses.publication=Publication
|
||||||
|
com.arsdigita.cms.contentassets.about.discusses.publication.remove=Remove
|
||||||
|
com.arsdigita.cms.contentassets.about.discusses.publication.remove.confirm=Are you sure to remove this publication?
|
||||||
|
com.arsdigita.cms.contentassets.about.discusses.publication.none_selected=No publication selected
|
||||||
|
com.arsdigita.cms.contentassets.about.discussing.add=Add a discussing publication
|
||||||
|
com.arsdigita.cms.contentassets.about.discussing.none=No publications found
|
||||||
|
com.arsdigita.cms.contentassets.about.discussing.publication=Publication
|
||||||
|
com.arsdigita.cms.contentassets.about.discussing.publication.remove=Remove
|
||||||
|
com.arsdigita.cms.contentassets.about.discussing.publication.remove.confirm=Are you sure to remove this publication?
|
||||||
|
com.arsdigita.cms.contentassets.about.discusses.publication.select_discussing=Select discussing publication
|
||||||
|
com.arsdigita.cms.contentassets.about.discussing.publication.none_selected=No publication selected
|
||||||
|
com.arsdigita.cms.contentassets.about.discusses.publication.select_discussed=Selected discussed publication
|
||||||
|
=
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
|
||||||
|
com.arsdigita.cms.contentassets.about.discusses.label=Behandelt
|
||||||
|
com.arsdigita.cms.contentassets.about.discussing.label=Wird behandelt in
|
||||||
|
com.arsdigita.cms.contentassets.about.discusses.add=Behandelte Publikation hinzuf\u00fcgen
|
||||||
|
com.arsdigita.cms.contentassets.about.discusses.none=Keine Publikationen gefunden
|
||||||
|
com.arsdigita.cms.contentassets.about.discusses.publication=Publikation
|
||||||
|
com.arsdigita.cms.contentassets.about.discusses.publication.remove=Entfernen
|
||||||
|
com.arsdigita.cms.contentassets.about.discusses.publication.remove.confirm=Sind Sie sicher das Sie diese Publikation entfernen wollen?
|
||||||
|
com.arsdigita.cms.contentassets.about.discusses.publication.none_selected=Keine Publikation ausgew\u00e4hlt
|
||||||
|
com.arsdigita.cms.contentassets.about.discussing.add=Behandelende Publikation hinzuf\u00fcgen
|
||||||
|
com.arsdigita.cms.contentassets.about.discussing.none=Keine Publikationen gefunden
|
||||||
|
com.arsdigita.cms.contentassets.about.discussing.publication=Publikation
|
||||||
|
com.arsdigita.cms.contentassets.about.discussing.publication.remove=Entfernen
|
||||||
|
com.arsdigita.cms.contentassets.about.discussing.publication.remove.confirm=Sind Sie sicher das Sie diese Publikation entfernen wollen?
|
||||||
|
com.arsdigita.cms.contentassets.about.discusses.publication.select_discussing=Behandelende Publikation ausw\u00e4hlen
|
||||||
|
com.arsdigita.cms.contentassets.about.discussing.publication.none_selected=Keine Publikation ausgew\u00e4hlt
|
||||||
|
com.arsdigita.cms.contentassets.about.discusses.publication.select_discussed=Behandelete Publikation ausw\u00e4hlen
|
||||||
|
=
|
||||||
|
|
@ -0,0 +1,107 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2010 Jens Pelzetter
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2.1 of
|
||||||
|
* the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library 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
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package com.arsdigita.cms.contentassets;
|
||||||
|
|
||||||
|
import com.arsdigita.cms.contenttypes.Publication;
|
||||||
|
import com.arsdigita.cms.contenttypes.PublicationBundle;
|
||||||
|
import com.arsdigita.persistence.DataCollection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class provides some convenient methods for dealing with the About asset/mixin.
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter <jens@jp-digital.de>
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
|
public class SciPublicationsAboutService {
|
||||||
|
|
||||||
|
public static final String DISCUSSED_BY = "discussedBy";
|
||||||
|
public static final String DISCUSSING = "discusses";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get all publications which are discussed by the provided publication.
|
||||||
|
*
|
||||||
|
* @param discussing
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public PublicationCollection getDiscussedPublications(final Publication discussing) {
|
||||||
|
final PublicationBundle bundle = discussing.getPublicationBundle();
|
||||||
|
|
||||||
|
final DataCollection dataCollection = (DataCollection) bundle.get(DISCUSSING);
|
||||||
|
|
||||||
|
return new PublicationCollection(dataCollection);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a discussed publication.
|
||||||
|
*
|
||||||
|
* @param discussing The publications which is discussing the other publication.
|
||||||
|
* @param discussed The publication discussed by the other publication
|
||||||
|
*/
|
||||||
|
public void addDiscussedPublication(final Publication discussing, final Publication discussed) {
|
||||||
|
final PublicationBundle discussingBundle = discussing.getPublicationBundle();
|
||||||
|
final PublicationBundle discussedBundle = discussed.getPublicationBundle();
|
||||||
|
|
||||||
|
discussingBundle.add(DISCUSSING, discussedBundle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove a discussed publication.
|
||||||
|
*
|
||||||
|
* @param discussing The publications which is discussing the other publication.
|
||||||
|
* @param discussed The publication discussed by the other publication
|
||||||
|
*/
|
||||||
|
public void removeDiscussedPublication(final Publication discussing,
|
||||||
|
final Publication discussed) {
|
||||||
|
final PublicationBundle discussingBundle = discussing.getPublicationBundle();
|
||||||
|
final PublicationBundle discussedBundle = discussed.getPublicationBundle();
|
||||||
|
|
||||||
|
discussingBundle.remove(DISCUSSING, discussedBundle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves all publications which are discussing the provided publication.
|
||||||
|
*
|
||||||
|
* @param discussed
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public PublicationCollection getDiscussingPublications(final Publication discussed) {
|
||||||
|
final PublicationBundle bundle = discussed.getPublicationBundle();
|
||||||
|
|
||||||
|
final DataCollection dataCollection = (DataCollection) bundle.get(DISCUSSED_BY);
|
||||||
|
|
||||||
|
return new PublicationCollection(dataCollection);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addDiscussingPublication(final Publication discussed,
|
||||||
|
final Publication discussing) {
|
||||||
|
final PublicationBundle discussedBundle = discussed.getPublicationBundle();
|
||||||
|
final PublicationBundle discussingBundle = discussing.getPublicationBundle();
|
||||||
|
|
||||||
|
discussedBundle.add(DISCUSSED_BY, discussingBundle);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeDiscussingPublication(final Publication discussed,
|
||||||
|
final Publication discussing) {
|
||||||
|
final PublicationBundle discussedBundle = discussed.getPublicationBundle();
|
||||||
|
final PublicationBundle discussingBundle = discussing.getPublicationBundle();
|
||||||
|
|
||||||
|
discussedBundle.remove(DISCUSSED_BY, discussingBundle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,98 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2014 Jens Pelzetter
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2.1 of
|
||||||
|
* the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library 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
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package com.arsdigita.cms.contentassets.ui;
|
||||||
|
|
||||||
|
import com.arsdigita.bebop.FormData;
|
||||||
|
import com.arsdigita.bebop.FormProcessException;
|
||||||
|
import com.arsdigita.bebop.Label;
|
||||||
|
import com.arsdigita.bebop.PageState;
|
||||||
|
import com.arsdigita.bebop.event.FormInitListener;
|
||||||
|
import com.arsdigita.bebop.event.FormProcessListener;
|
||||||
|
import com.arsdigita.bebop.event.FormSectionEvent;
|
||||||
|
import com.arsdigita.cms.ContentType;
|
||||||
|
import com.arsdigita.cms.ItemSelectionModel;
|
||||||
|
import com.arsdigita.cms.contentassets.SciPublicationsAboutGlobalizationUtil;
|
||||||
|
import com.arsdigita.cms.contentassets.SciPublicationsAboutService;
|
||||||
|
import com.arsdigita.cms.contenttypes.Publication;
|
||||||
|
import com.arsdigita.cms.ui.ItemSearchWidget;
|
||||||
|
import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter <jens@jp-digital.de>
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
|
public class SciPublicationsAboutDiscussesForm extends BasicItemForm implements FormProcessListener,
|
||||||
|
FormInitListener {
|
||||||
|
|
||||||
|
private ItemSearchWidget itemSearch;
|
||||||
|
private final static String ITEM_SEARCH = "discussedPublications";
|
||||||
|
private final ItemSelectionModel itemModel;
|
||||||
|
|
||||||
|
public SciPublicationsAboutDiscussesForm(final ItemSelectionModel itemModel) {
|
||||||
|
|
||||||
|
super("SciPublicationsAboutDisussesForm", itemModel);
|
||||||
|
this.itemModel = itemModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void addWidgets() {
|
||||||
|
add(new Label(SciPublicationsAboutGlobalizationUtil.globalize(
|
||||||
|
"com.arsdigita.cms.contentassets.about.discusses.publication.select_discussed")));
|
||||||
|
itemSearch = new ItemSearchWidget(
|
||||||
|
ITEM_SEARCH,
|
||||||
|
ContentType.findByAssociatedObjectType(Publication.class.getName()));
|
||||||
|
itemSearch.setDisableCreatePane(true);
|
||||||
|
add(itemSearch);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init(final FormSectionEvent event) throws FormProcessException {
|
||||||
|
|
||||||
|
setVisible(event.getPageState(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void process(final FormSectionEvent event) throws FormProcessException {
|
||||||
|
|
||||||
|
final FormData data = event.getFormData();
|
||||||
|
final PageState state = event.getPageState();
|
||||||
|
final Publication discussing = (Publication) itemModel.getSelectedObject(state);
|
||||||
|
final SciPublicationsAboutService service = new SciPublicationsAboutService();
|
||||||
|
|
||||||
|
if (!(getSaveCancelSection().getCancelButton().isSelected(state))) {
|
||||||
|
final Publication discussed = (Publication) data.get(ITEM_SEARCH);
|
||||||
|
service.addDiscussedPublication(discussing, discussed);
|
||||||
|
}
|
||||||
|
|
||||||
|
init(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void validate(final FormSectionEvent event) throws FormProcessException {
|
||||||
|
//final PageState state = event.getPageState();
|
||||||
|
final FormData data = event.getFormData();
|
||||||
|
|
||||||
|
if (data.get(ITEM_SEARCH) == null) {
|
||||||
|
data.addError(SciPublicationsAboutGlobalizationUtil.globalize(
|
||||||
|
"com.arsdigita.cms.contentassets.about.discusses.publication.none_selected"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,57 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2014 Jens Pelzetter
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2.1 of
|
||||||
|
* the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library 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
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package com.arsdigita.cms.contentassets.ui;
|
||||||
|
|
||||||
|
import com.arsdigita.cms.ItemSelectionModel;
|
||||||
|
import com.arsdigita.cms.contentassets.SciPublicationsAboutGlobalizationUtil;
|
||||||
|
import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
|
||||||
|
import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
||||||
|
import com.arsdigita.cms.ui.authoring.SimpleEditStep;
|
||||||
|
import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter <jens@jp-digital.de>
|
||||||
|
*/
|
||||||
|
public class SciPublicationsAboutDiscussesStep extends SimpleEditStep {
|
||||||
|
|
||||||
|
protected static final String ADD_DISCUSSED = "add_discussed_publication";
|
||||||
|
|
||||||
|
public SciPublicationsAboutDiscussesStep(final ItemSelectionModel itemModel,
|
||||||
|
final AuthoringKitWizard parent) {
|
||||||
|
this(itemModel, parent, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SciPublicationsAboutDiscussesStep(final ItemSelectionModel itemModel,
|
||||||
|
final AuthoringKitWizard parent,
|
||||||
|
final String prefix) {
|
||||||
|
super(itemModel, parent, prefix);
|
||||||
|
|
||||||
|
final BasicItemForm addDiscussedSheet = new SciPublicationsAboutDiscussesForm(itemModel);
|
||||||
|
add(ADD_DISCUSSED,
|
||||||
|
SciPublicationsAboutGlobalizationUtil.globalize(
|
||||||
|
"com.arsdigita.cms.contentassets.about.discusses.add"),
|
||||||
|
new WorkflowLockedComponentAccess(addDiscussedSheet, itemModel),
|
||||||
|
addDiscussedSheet.getSaveCancelSection().getCancelButton());
|
||||||
|
|
||||||
|
final SciPublicationsAboutDiscussesTable discussedTable = new SciPublicationsAboutDiscussesTable(itemModel);
|
||||||
|
setDisplayComponent(discussedTable);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,251 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2010 Jens Pelzetter
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2.1 of
|
||||||
|
* the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library 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
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package com.arsdigita.cms.contentassets.ui;
|
||||||
|
|
||||||
|
import com.arsdigita.bebop.Component;
|
||||||
|
import com.arsdigita.bebop.ControlLink;
|
||||||
|
import com.arsdigita.bebop.Label;
|
||||||
|
import com.arsdigita.bebop.Link;
|
||||||
|
import com.arsdigita.bebop.PageState;
|
||||||
|
import com.arsdigita.bebop.Table;
|
||||||
|
import com.arsdigita.bebop.event.TableActionEvent;
|
||||||
|
import com.arsdigita.bebop.event.TableActionListener;
|
||||||
|
import com.arsdigita.bebop.table.TableCellRenderer;
|
||||||
|
import com.arsdigita.bebop.table.TableColumn;
|
||||||
|
import com.arsdigita.bebop.table.TableColumnModel;
|
||||||
|
import com.arsdigita.bebop.table.TableModel;
|
||||||
|
import com.arsdigita.bebop.table.TableModelBuilder;
|
||||||
|
import com.arsdigita.cms.CMS;
|
||||||
|
import com.arsdigita.cms.ContentSection;
|
||||||
|
import com.arsdigita.cms.ItemSelectionModel;
|
||||||
|
import com.arsdigita.cms.contentassets.PublicationCollection;
|
||||||
|
import com.arsdigita.cms.contentassets.SciPublicationsAboutGlobalizationUtil;
|
||||||
|
import com.arsdigita.cms.contentassets.SciPublicationsAboutService;
|
||||||
|
import com.arsdigita.cms.contenttypes.Publication;
|
||||||
|
import com.arsdigita.cms.dispatcher.ItemResolver;
|
||||||
|
import com.arsdigita.dispatcher.ObjectNotFoundException;
|
||||||
|
import com.arsdigita.globalization.GlobalizedMessage;
|
||||||
|
import com.arsdigita.util.LockableImpl;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter <jens@jp-digital.de>
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
|
public class SciPublicationsAboutDiscussesTable extends Table implements TableActionListener {
|
||||||
|
|
||||||
|
private static final String TABLE_COL_DEL = "table_col_del";
|
||||||
|
private final ItemSelectionModel itemModel;
|
||||||
|
|
||||||
|
public SciPublicationsAboutDiscussesTable(final ItemSelectionModel itemModel) {
|
||||||
|
|
||||||
|
super();
|
||||||
|
|
||||||
|
this.itemModel = itemModel;
|
||||||
|
|
||||||
|
setEmptyView(new Label(SciPublicationsAboutGlobalizationUtil.globalize(
|
||||||
|
"com.arsdigita.cms.contentassets.about.discusses.none")));
|
||||||
|
|
||||||
|
final TableColumnModel colModel = getColumnModel();
|
||||||
|
colModel.add(new TableColumn(
|
||||||
|
0,
|
||||||
|
SciPublicationsAboutGlobalizationUtil.globalize(
|
||||||
|
"com.arsdigita.cms.contentassets.about.discusses.publication")));
|
||||||
|
colModel.add(new TableColumn(
|
||||||
|
1,
|
||||||
|
SciPublicationsAboutGlobalizationUtil.globalize(
|
||||||
|
"com.arsdigita.cms.contentassets.about.discusses.publication.remove"),
|
||||||
|
TABLE_COL_DEL));
|
||||||
|
|
||||||
|
setModelBuilder(new SciPublicationsAboutTableModelBuilder(itemModel));
|
||||||
|
|
||||||
|
colModel.get(0).setCellRenderer(new PublicationCellRenderer());
|
||||||
|
colModel.get(1).setCellRenderer(new DeleteCellRenderer());
|
||||||
|
|
||||||
|
addTableActionListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
private class SciPublicationsAboutTableModelBuilder extends LockableImpl
|
||||||
|
implements TableModelBuilder {
|
||||||
|
|
||||||
|
private final ItemSelectionModel itemModel;
|
||||||
|
|
||||||
|
public SciPublicationsAboutTableModelBuilder(final ItemSelectionModel itemModel) {
|
||||||
|
super();
|
||||||
|
this.itemModel = itemModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TableModel makeModel(final Table table, final PageState state) {
|
||||||
|
table.getRowSelectionModel().clearSelection(state);
|
||||||
|
final Publication publication = (Publication) itemModel.getSelectedObject(state);
|
||||||
|
return new SciPublicationsAboutTableModel(table, publication);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private class SciPublicationsAboutTableModel implements TableModel {
|
||||||
|
|
||||||
|
private final Table table;
|
||||||
|
private final PublicationCollection discussedPublications;
|
||||||
|
private Publication discussed;
|
||||||
|
|
||||||
|
public SciPublicationsAboutTableModel(final Table table,
|
||||||
|
final Publication publication) {
|
||||||
|
this.table = table;
|
||||||
|
|
||||||
|
final SciPublicationsAboutService service = new SciPublicationsAboutService();
|
||||||
|
|
||||||
|
discussedPublications = service.getDiscussedPublications(publication);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getColumnCount() {
|
||||||
|
return table.getColumnModel().size();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean nextRow() {
|
||||||
|
boolean ret;
|
||||||
|
|
||||||
|
if (discussedPublications != null && discussedPublications.next()) {
|
||||||
|
discussed = discussedPublications.getPublication();
|
||||||
|
ret = true;
|
||||||
|
} else {
|
||||||
|
ret = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object getElementAt(final int columnIndex) {
|
||||||
|
switch (columnIndex) {
|
||||||
|
case 0:
|
||||||
|
return discussed.getTitle();
|
||||||
|
case 1:
|
||||||
|
return SciPublicationsAboutGlobalizationUtil.globalize(
|
||||||
|
"com.arsdigita.cms.contentassets.about.discusses.publication.remove");
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object getKeyAt(final int columnIndex) {
|
||||||
|
return discussed.getID();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private class PublicationCellRenderer extends LockableImpl implements TableCellRenderer {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Component getComponent(final Table table,
|
||||||
|
final PageState state,
|
||||||
|
final Object value,
|
||||||
|
final boolean isSelected,
|
||||||
|
final Object key,
|
||||||
|
final int row,
|
||||||
|
final int column) {
|
||||||
|
final com.arsdigita.cms.SecurityManager securityManager = CMS.getSecurityManager(state);
|
||||||
|
final Publication discussing = (Publication) itemModel.getSelectedObject(state);
|
||||||
|
|
||||||
|
final boolean canEdit = securityManager.canAccess(
|
||||||
|
state.getRequest(),
|
||||||
|
com.arsdigita.cms.SecurityManager.EDIT_ITEM,
|
||||||
|
discussing);
|
||||||
|
|
||||||
|
if (canEdit) {
|
||||||
|
final Publication discussed;
|
||||||
|
try {
|
||||||
|
discussed = new Publication((BigDecimal) key);
|
||||||
|
} catch (ObjectNotFoundException ex) {
|
||||||
|
return new Label(value.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
final ContentSection section = discussed.getContentSection();
|
||||||
|
final ItemResolver resolver = section.getItemResolver();
|
||||||
|
final Link link = new Link(value.toString(),
|
||||||
|
resolver.generateItemURL(state,
|
||||||
|
discussed,
|
||||||
|
section,
|
||||||
|
discussed.getVersion()));
|
||||||
|
return link;
|
||||||
|
} else {
|
||||||
|
return new Label(value.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private class DeleteCellRenderer extends LockableImpl implements TableCellRenderer {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Component getComponent(final Table table,
|
||||||
|
final PageState state,
|
||||||
|
final Object value,
|
||||||
|
final boolean isSelected,
|
||||||
|
final Object key,
|
||||||
|
final int row,
|
||||||
|
final int column) {
|
||||||
|
final com.arsdigita.cms.SecurityManager securityManager = CMS.getSecurityManager(state);
|
||||||
|
final Publication discussing = (Publication) itemModel.getSelectedObject(state);
|
||||||
|
|
||||||
|
final boolean canEdit = securityManager.canAccess(
|
||||||
|
state.getRequest(),
|
||||||
|
com.arsdigita.cms.SecurityManager.DELETE_ITEM,
|
||||||
|
discussing);
|
||||||
|
|
||||||
|
if (canEdit) {
|
||||||
|
final ControlLink link = new ControlLink(new Label((GlobalizedMessage) value));
|
||||||
|
link.setConfirmation(SciPublicationsAboutGlobalizationUtil.globalize(
|
||||||
|
"com.arsdigita.cms.contentassets.about.discusses.publication.remove.confirm"));
|
||||||
|
return link;
|
||||||
|
} else {
|
||||||
|
return new Label(value.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void cellSelected(final TableActionEvent event) {
|
||||||
|
|
||||||
|
final PageState state = event.getPageState();
|
||||||
|
|
||||||
|
final Publication discussed = new Publication(new BigDecimal(event.getRowKey().toString()));
|
||||||
|
final Publication discussing = (Publication) itemModel.getSelectedObject(state);
|
||||||
|
final SciPublicationsAboutService service = new SciPublicationsAboutService();
|
||||||
|
|
||||||
|
final TableColumn column = getColumnModel().get(event.getColumn().intValue());
|
||||||
|
|
||||||
|
if (TABLE_COL_DEL.equals(column.getHeaderKey())) {
|
||||||
|
service.removeDiscussedPublication(discussing, discussed);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void headSelected(final TableActionEvent event) {
|
||||||
|
//Nothing to do
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,98 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2014 Jens Pelzetter
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2.1 of
|
||||||
|
* the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library 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
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package com.arsdigita.cms.contentassets.ui;
|
||||||
|
|
||||||
|
import com.arsdigita.bebop.FormData;
|
||||||
|
import com.arsdigita.bebop.FormProcessException;
|
||||||
|
import com.arsdigita.bebop.Label;
|
||||||
|
import com.arsdigita.bebop.PageState;
|
||||||
|
import com.arsdigita.bebop.event.FormInitListener;
|
||||||
|
import com.arsdigita.bebop.event.FormProcessListener;
|
||||||
|
import com.arsdigita.bebop.event.FormSectionEvent;
|
||||||
|
import com.arsdigita.cms.ContentType;
|
||||||
|
import com.arsdigita.cms.ItemSelectionModel;
|
||||||
|
import com.arsdigita.cms.contentassets.SciPublicationsAboutGlobalizationUtil;
|
||||||
|
import com.arsdigita.cms.contentassets.SciPublicationsAboutService;
|
||||||
|
import com.arsdigita.cms.contenttypes.Publication;
|
||||||
|
import com.arsdigita.cms.ui.ItemSearchWidget;
|
||||||
|
import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter <jens@jp-digital.de>
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
|
public class SciPublicationsAboutDiscussingForm extends BasicItemForm implements FormProcessListener,
|
||||||
|
FormInitListener {
|
||||||
|
|
||||||
|
private ItemSearchWidget itemSearch;
|
||||||
|
private final static String ITEM_SEARCH = "discussingPublications";
|
||||||
|
private final ItemSelectionModel itemModel;
|
||||||
|
|
||||||
|
public SciPublicationsAboutDiscussingForm(final ItemSelectionModel itemModel) {
|
||||||
|
|
||||||
|
super("SciPublicationsAboutDiscussingForm", itemModel);
|
||||||
|
this.itemModel = itemModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addWidgets() {
|
||||||
|
add(new Label(SciPublicationsAboutGlobalizationUtil.globalize(
|
||||||
|
"com.arsdigita.cms.contentassets.about.discusses.publication.select_discussing")));
|
||||||
|
itemSearch = new ItemSearchWidget(
|
||||||
|
ITEM_SEARCH,
|
||||||
|
ContentType.findByAssociatedObjectType(Publication.class.getName()));
|
||||||
|
add(itemSearch);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init(final FormSectionEvent event) throws FormProcessException {
|
||||||
|
|
||||||
|
setVisible(event.getPageState(), true);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void process(final FormSectionEvent event) throws FormProcessException {
|
||||||
|
|
||||||
|
final FormData data = event.getFormData();
|
||||||
|
final PageState state = event.getPageState();
|
||||||
|
final Publication discussed = (Publication) itemModel.getSelectedObject(state);
|
||||||
|
final SciPublicationsAboutService service = new SciPublicationsAboutService();
|
||||||
|
|
||||||
|
if (!(getSaveCancelSection().getCancelButton().isSelected(state))) {
|
||||||
|
final Publication discussing = (Publication) data.get(ITEM_SEARCH);
|
||||||
|
service.addDiscussingPublication(discussed, discussing);
|
||||||
|
}
|
||||||
|
|
||||||
|
init(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void validate(final FormSectionEvent event) throws FormProcessException {
|
||||||
|
|
||||||
|
final FormData data = event.getFormData();
|
||||||
|
|
||||||
|
if (data.get(ITEM_SEARCH) == null) {
|
||||||
|
data.addError(SciPublicationsAboutGlobalizationUtil.globalize(
|
||||||
|
"com.arsdigita.cms.contentassets.about.discussing.publication.none_selected"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,59 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2014 Jens Pelzetter
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2.1 of
|
||||||
|
* the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library 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
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.arsdigita.cms.contentassets.ui;
|
||||||
|
|
||||||
|
import com.arsdigita.cms.ItemSelectionModel;
|
||||||
|
import com.arsdigita.cms.contentassets.SciPublicationsAboutGlobalizationUtil;
|
||||||
|
import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
|
||||||
|
import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
||||||
|
import com.arsdigita.cms.ui.authoring.SimpleEditStep;
|
||||||
|
import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter <jens@jp-digital.de>
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
|
public class SciPublicationsAboutDiscussingStep extends SimpleEditStep {
|
||||||
|
|
||||||
|
protected static final String ADD_DISCUSSING = "add_discussing_publication";
|
||||||
|
|
||||||
|
public SciPublicationsAboutDiscussingStep(final ItemSelectionModel itemModel,
|
||||||
|
final AuthoringKitWizard parent) {
|
||||||
|
this(itemModel, parent, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SciPublicationsAboutDiscussingStep(final ItemSelectionModel itemModel,
|
||||||
|
final AuthoringKitWizard parent,
|
||||||
|
final String prefix) {
|
||||||
|
super(itemModel, parent, prefix);
|
||||||
|
|
||||||
|
final BasicItemForm addDiscussingSheet = new SciPublicationsAboutDiscussingForm(itemModel);
|
||||||
|
add(ADD_DISCUSSING,
|
||||||
|
SciPublicationsAboutGlobalizationUtil.globalize("com.arsdigita.cms.contentassets.about.discussing.add"),
|
||||||
|
new WorkflowLockedComponentAccess(addDiscussingSheet, itemModel),
|
||||||
|
addDiscussingSheet.getSaveCancelSection().getCancelButton());
|
||||||
|
|
||||||
|
final SciPublicationsAboutDiscussingTable discussingTable = new SciPublicationsAboutDiscussingTable(itemModel);
|
||||||
|
setDisplayComponent(discussingTable);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,249 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2010 Jens Pelzetter
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2.1 of
|
||||||
|
* the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library 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
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package com.arsdigita.cms.contentassets.ui;
|
||||||
|
|
||||||
|
import com.arsdigita.bebop.Component;
|
||||||
|
import com.arsdigita.bebop.ControlLink;
|
||||||
|
import com.arsdigita.bebop.Label;
|
||||||
|
import com.arsdigita.bebop.Link;
|
||||||
|
import com.arsdigita.bebop.PageState;
|
||||||
|
import com.arsdigita.bebop.Table;
|
||||||
|
import com.arsdigita.bebop.event.TableActionEvent;
|
||||||
|
import com.arsdigita.bebop.event.TableActionListener;
|
||||||
|
import com.arsdigita.bebop.table.TableCellRenderer;
|
||||||
|
import com.arsdigita.bebop.table.TableColumn;
|
||||||
|
import com.arsdigita.bebop.table.TableColumnModel;
|
||||||
|
import com.arsdigita.bebop.table.TableModel;
|
||||||
|
import com.arsdigita.bebop.table.TableModelBuilder;
|
||||||
|
import com.arsdigita.cms.CMS;
|
||||||
|
import com.arsdigita.cms.ContentSection;
|
||||||
|
import com.arsdigita.cms.ItemSelectionModel;
|
||||||
|
import com.arsdigita.cms.contentassets.PublicationCollection;
|
||||||
|
import com.arsdigita.cms.contentassets.SciPublicationsAboutGlobalizationUtil;
|
||||||
|
import com.arsdigita.cms.contentassets.SciPublicationsAboutService;
|
||||||
|
import com.arsdigita.cms.contenttypes.Publication;
|
||||||
|
import com.arsdigita.cms.dispatcher.ItemResolver;
|
||||||
|
import com.arsdigita.dispatcher.ObjectNotFoundException;
|
||||||
|
import com.arsdigita.globalization.GlobalizedMessage;
|
||||||
|
import com.arsdigita.util.LockableImpl;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter <jens@jp-digital.de>
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
|
public class SciPublicationsAboutDiscussingTable extends Table implements TableActionListener {
|
||||||
|
|
||||||
|
private static final String TABLE_COL_DEL = "table_col_del";
|
||||||
|
private final ItemSelectionModel itemModel;
|
||||||
|
|
||||||
|
public SciPublicationsAboutDiscussingTable(final ItemSelectionModel itemModel) {
|
||||||
|
|
||||||
|
super();
|
||||||
|
|
||||||
|
this.itemModel = itemModel;
|
||||||
|
|
||||||
|
setEmptyView(new Label(SciPublicationsAboutGlobalizationUtil.globalize(
|
||||||
|
"com.arsdigita.cms.contentassets.about.discussing.none")));
|
||||||
|
|
||||||
|
final TableColumnModel colModel = getColumnModel();
|
||||||
|
colModel.add(new TableColumn(
|
||||||
|
0,
|
||||||
|
SciPublicationsAboutGlobalizationUtil.globalize(
|
||||||
|
"com.arsdigita.cms.contentassets.about.discussing.publication")));
|
||||||
|
colModel.add(new TableColumn(
|
||||||
|
1,
|
||||||
|
SciPublicationsAboutGlobalizationUtil.globalize(
|
||||||
|
"com.arsdigita.cms.contentassets.about.discussing.publication.remove"),
|
||||||
|
TABLE_COL_DEL));
|
||||||
|
|
||||||
|
setModelBuilder(new SciPublicationsAboutTableModelBuilder(itemModel));
|
||||||
|
|
||||||
|
colModel.get(0).setCellRenderer(new PublicationCellRenderer());
|
||||||
|
colModel.get(1).setCellRenderer(new DeleteCellRenderer());
|
||||||
|
|
||||||
|
addTableActionListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
private class SciPublicationsAboutTableModelBuilder extends LockableImpl
|
||||||
|
implements TableModelBuilder {
|
||||||
|
|
||||||
|
private final ItemSelectionModel itemModel;
|
||||||
|
|
||||||
|
public SciPublicationsAboutTableModelBuilder(final ItemSelectionModel itemModel) {
|
||||||
|
super();
|
||||||
|
this.itemModel = itemModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TableModel makeModel(final Table table, final PageState state) {
|
||||||
|
table.getRowSelectionModel().clearSelection(state);
|
||||||
|
final Publication publication = (Publication) itemModel.getSelectedObject(state);
|
||||||
|
return new SciPublicationsAboutTableModel(table, publication);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private class SciPublicationsAboutTableModel implements TableModel {
|
||||||
|
|
||||||
|
private final Table table;
|
||||||
|
private final PublicationCollection discussingPublications;
|
||||||
|
private Publication discussing;
|
||||||
|
|
||||||
|
public SciPublicationsAboutTableModel(final Table table,
|
||||||
|
final Publication publication) {
|
||||||
|
this.table = table;
|
||||||
|
|
||||||
|
final SciPublicationsAboutService service = new SciPublicationsAboutService();
|
||||||
|
|
||||||
|
discussingPublications = service.getDiscussingPublications(publication);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getColumnCount() {
|
||||||
|
return table.getColumnModel().size();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean nextRow() {
|
||||||
|
boolean ret;
|
||||||
|
|
||||||
|
if (discussingPublications != null && discussingPublications.next()) {
|
||||||
|
discussing = discussingPublications.getPublication();
|
||||||
|
ret = true;
|
||||||
|
} else {
|
||||||
|
ret = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object getElementAt(final int columnIndex) {
|
||||||
|
switch (columnIndex) {
|
||||||
|
case 0:
|
||||||
|
return discussing.getTitle();
|
||||||
|
case 1:
|
||||||
|
return SciPublicationsAboutGlobalizationUtil.globalize(
|
||||||
|
"com.arsdigita.cms.contentassets.about.discussing.publication.remove");
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object getKeyAt(final int columnIndex) {
|
||||||
|
return discussing.getID();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class PublicationCellRenderer extends LockableImpl implements TableCellRenderer {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Component getComponent(final Table table,
|
||||||
|
final PageState state,
|
||||||
|
final Object value,
|
||||||
|
final boolean isSelected,
|
||||||
|
final Object key,
|
||||||
|
final int row,
|
||||||
|
final int column) {
|
||||||
|
final com.arsdigita.cms.SecurityManager securityManager = CMS.getSecurityManager(state);
|
||||||
|
final Publication discussed = (Publication) itemModel.getSelectedObject(state);
|
||||||
|
|
||||||
|
final boolean canEdit = securityManager.canAccess(
|
||||||
|
state.getRequest(),
|
||||||
|
com.arsdigita.cms.SecurityManager.EDIT_ITEM,
|
||||||
|
discussed);
|
||||||
|
|
||||||
|
if (canEdit) {
|
||||||
|
final Publication discussing;
|
||||||
|
try {
|
||||||
|
discussing = new Publication((BigDecimal) key);
|
||||||
|
} catch (ObjectNotFoundException ex) {
|
||||||
|
return new Label(value.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
final ContentSection section = discussing.getContentSection();
|
||||||
|
final ItemResolver resolver = section.getItemResolver();
|
||||||
|
final Link link = new Link(value.toString(),
|
||||||
|
resolver.generateItemURL(state,
|
||||||
|
discussing,
|
||||||
|
section,
|
||||||
|
discussing.getVersion()));
|
||||||
|
return link;
|
||||||
|
} else {
|
||||||
|
return new Label(value.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private class DeleteCellRenderer extends LockableImpl implements TableCellRenderer {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Component getComponent(final Table table,
|
||||||
|
final PageState state,
|
||||||
|
final Object value,
|
||||||
|
final boolean isSelected,
|
||||||
|
final Object key,
|
||||||
|
final int row,
|
||||||
|
final int column) {
|
||||||
|
final com.arsdigita.cms.SecurityManager securityManager = CMS.getSecurityManager(state);
|
||||||
|
final Publication discussed = (Publication) itemModel.getSelectedObject(state);
|
||||||
|
|
||||||
|
final boolean canEdit = securityManager.canAccess(
|
||||||
|
state.getRequest(),
|
||||||
|
com.arsdigita.cms.SecurityManager.DELETE_ITEM,
|
||||||
|
discussed);
|
||||||
|
|
||||||
|
if (canEdit) {
|
||||||
|
final ControlLink link = new ControlLink(new Label((GlobalizedMessage) value));
|
||||||
|
link.setConfirmation(SciPublicationsAboutGlobalizationUtil.globalize(
|
||||||
|
"com.arsdigita.cms.contentassets.about.discussing.publication.remove.confirm"));
|
||||||
|
return link;
|
||||||
|
} else {
|
||||||
|
return new Label(value.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void cellSelected(final TableActionEvent event) {
|
||||||
|
|
||||||
|
final PageState state = event.getPageState();
|
||||||
|
|
||||||
|
final Publication discussing = new Publication(new BigDecimal(event.getRowKey().toString()));
|
||||||
|
final Publication discussed = (Publication) itemModel.getSelectedObject(state);
|
||||||
|
final SciPublicationsAboutService service = new SciPublicationsAboutService();
|
||||||
|
|
||||||
|
final TableColumn column = getColumn(event.getColumn().intValue());
|
||||||
|
|
||||||
|
if (TABLE_COL_DEL.equals(column.getHeaderKey())) {
|
||||||
|
service.removeDiscussingPublication(discussed, discussing);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void headSelected(final TableActionEvent event) {
|
||||||
|
//Nothing to do
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -123,7 +123,7 @@
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
|
|
||||||
<xsl:when test="$position = 0">
|
<xsl:when test="$position = 0">
|
||||||
<xsl:value-of select="'default'"/>
|
<xsl:value-of select="'default/'"/>
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
|
|
||||||
<xsl:otherwise>
|
<xsl:otherwise>
|
||||||
|
|
|
||||||
|
|
@ -1,89 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<!DOCTYPE stylesheet [<!ENTITY nbsp '<xsl:text disable-output-escaping="yes">&</xsl:text>nbsp;'>]>
|
|
||||||
|
|
||||||
<!--
|
|
||||||
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: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:ui="http://www.arsdigita.com/ui/1.0"
|
|
||||||
xmlns:nav="http://ccm.redhat.com/navigation"
|
|
||||||
xmlns:mandalay="http://mandalay.quasiweb.de"
|
|
||||||
exclude-result-prefixes="xsl bebop cms ui mandalay nav"
|
|
||||||
version="1.0">
|
|
||||||
|
|
||||||
<xsl:template name="mandalay:minimizeHeader">
|
|
||||||
<xsl:param name="imageClass" select="''"/>
|
|
||||||
<xsl:param name="linkClass" select="''"/>
|
|
||||||
<xsl:param name="minimizeText" select="concat($imageClass, '/minimize')"/>
|
|
||||||
<xsl:param name="maximizeText" select="concat($imageClass, '/maximize')"/>
|
|
||||||
|
|
||||||
<xsl:variable name="minimizeLabel">
|
|
||||||
<xsl:choose>
|
|
||||||
<xsl:when test="string-length($minimizeText) > 0">
|
|
||||||
<xsl:call-template name="mandalay:getStaticText">
|
|
||||||
<xsl:with-param name="id" select="$minimizeText"/>
|
|
||||||
</xsl:call-template>
|
|
||||||
</xsl:when>
|
|
||||||
<xsl:otherwise>
|
|
||||||
<xsl:call-template name="mandalay:getStaticText">
|
|
||||||
<xsl:with-param name="id" select="concat($imageClass, '/minimize')"/>
|
|
||||||
</xsl:call-template>
|
|
||||||
</xsl:otherwise>
|
|
||||||
</xsl:choose>
|
|
||||||
</xsl:variable>
|
|
||||||
|
|
||||||
<xsl:variable name="maximizeLabel">
|
|
||||||
<xsl:choose>
|
|
||||||
<xsl:when test="string-length($minimizeText) > 0">
|
|
||||||
<xsl:call-template name="mandalay:getStaticText">
|
|
||||||
<xsl:with-param name="id" select="$maximizeText"/>
|
|
||||||
</xsl:call-template>
|
|
||||||
</xsl:when>
|
|
||||||
<xsl:otherwise>
|
|
||||||
<xsl:call-template name="mandalay:getStaticText">
|
|
||||||
<xsl:with-param name="id" select="concat($imageClass, '/maximize')"/>
|
|
||||||
</xsl:call-template>
|
|
||||||
</xsl:otherwise>
|
|
||||||
</xsl:choose>
|
|
||||||
</xsl:variable>
|
|
||||||
|
|
||||||
<a>
|
|
||||||
<xsl:attribute name="class">
|
|
||||||
<xsl:value-of select="concat($linkClass, ' maximized')"/>
|
|
||||||
</xsl:attribute>
|
|
||||||
<xsl:attribute name="href">
|
|
||||||
<xsl:value-of select="'#'"/>
|
|
||||||
</xsl:attribute>
|
|
||||||
<xsl:attribute name="onClick">
|
|
||||||
<!--<xsl:value-of select="concat('$(".', $imageID, ' img").attr("src", "', $minimizedImage, '");return false;')"/>-->
|
|
||||||
<xsl:value-of select="concat('minimizeImage.minimize("', $imageClass, '", "', $linkClass ,'", "', $minimizeLabel, '", "', $maximizeLabel, '")')"/>
|
|
||||||
</xsl:attribute>
|
|
||||||
<xsl:value-of select="$minimizeLabel"/>
|
|
||||||
|
|
||||||
</a>
|
|
||||||
<script type="text/javascript">
|
|
||||||
<xsl:value-of select="'$(document).ready(function() {'"/>
|
|
||||||
<xsl:value-of select="concat('minimizeImage.restore("', $imageClass, '", "', $linkClass ,'", "', $minimizeLabel, '", "', $maximizeLabel, '")')"/>
|
|
||||||
<xsl:value-of select="'});'"/>
|
|
||||||
</script>
|
|
||||||
</xsl:template>
|
|
||||||
|
|
||||||
</xsl:stylesheet>
|
|
||||||
Loading…
Reference in New Issue