Asset für Bibliothekssignaturen von Publikationen (Ticket #1568).
git-svn-id: https://svn.libreccm.org/ccm/trunk@2257 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
82aa9815c0
commit
b2991a8b4a
|
|
@ -15,7 +15,6 @@
|
|||
* 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.AbstractSingleSelectionModel;
|
||||
|
|
@ -49,14 +48,11 @@ import org.apache.log4j.Logger;
|
|||
public class ImageStep extends SecurityPropertyEditor {
|
||||
|
||||
private static final Logger s_log = Logger.getLogger(ImageStep.class);
|
||||
|
||||
private final ItemSelectionModel m_itemSelection;
|
||||
private final AttachmentSelectionModel m_attachmentSelection;
|
||||
private final AuthoringKitWizard m_parent;
|
||||
|
||||
private final ImageStepDisplay m_display;
|
||||
private final ImageStepEdit m_add;
|
||||
|
||||
private final OIDParameter m_attachmentOID;
|
||||
|
||||
/**
|
||||
|
|
@ -65,37 +61,37 @@ public class ImageStep extends SecurityPropertyEditor {
|
|||
* @param itemModel
|
||||
* @param parent
|
||||
*/
|
||||
public ImageStep( ItemSelectionModel itemModel,
|
||||
AuthoringKitWizard parent ) {
|
||||
public ImageStep(ItemSelectionModel itemModel,
|
||||
AuthoringKitWizard parent) {
|
||||
super();
|
||||
|
||||
m_itemSelection = itemModel;
|
||||
m_parent = parent;
|
||||
|
||||
m_attachmentOID = new OIDParameter( "attachmentID" );
|
||||
m_attachmentOID = new OIDParameter("attachmentID");
|
||||
m_attachmentSelection = new AttachmentSelectionModel();
|
||||
|
||||
|
||||
/* Create ImageEditStep to add images to the current item */
|
||||
m_add = new ImageStepEdit( this );
|
||||
m_add = new ImageStepEdit(this);
|
||||
WorkflowLockedComponentAccess addCA =
|
||||
new WorkflowLockedComponentAccess( m_add, m_itemSelection );
|
||||
addComponent( "add",
|
||||
ImageStepGlobalizationUtil.globalize(
|
||||
"cms.contentassets.ui.image_step.add_image"),
|
||||
addCA );
|
||||
new WorkflowLockedComponentAccess(m_add, m_itemSelection);
|
||||
addComponent("add",
|
||||
ImageStepGlobalizationUtil.globalize(
|
||||
"cms.contentassets.ui.image_step.add_image"),
|
||||
addCA);
|
||||
|
||||
/* ImageDisplayStep to display all already attached images */
|
||||
m_display = new ImageStepDisplay( this ); // Component to display
|
||||
m_display = new ImageStepDisplay(this); // Component to display
|
||||
setDisplayComponent(m_display); // all attached images.
|
||||
|
||||
Iterator imageComponents = m_add.getImageComponents();
|
||||
while( imageComponents.hasNext() ) {
|
||||
while (imageComponents.hasNext()) {
|
||||
ImageComponent component =
|
||||
(ImageComponent) imageComponents.next();
|
||||
(ImageComponent) imageComponents.next();
|
||||
|
||||
addListeners( component.getForm(),
|
||||
component.getSaveCancelSection().getCancelButton() );
|
||||
addListeners(component.getForm(),
|
||||
component.getSaveCancelSection().getCancelButton());
|
||||
}
|
||||
|
||||
m_parent.getList().addActionListener(new ActionListener() {
|
||||
|
|
@ -103,14 +99,15 @@ public class ImageStep extends SecurityPropertyEditor {
|
|||
PageState state = event.getPageState();
|
||||
showDisplayPane(state);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void register( Page p ) {
|
||||
super.register( p );
|
||||
public void register(Page p) {
|
||||
super.register(p);
|
||||
|
||||
p.addComponentStateParam( this, m_attachmentOID );
|
||||
p.addComponentStateParam(this, m_attachmentOID);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -130,60 +127,61 @@ public class ImageStep extends SecurityPropertyEditor {
|
|||
/**
|
||||
* @return The currently selected item, null if there isn't one.
|
||||
*/
|
||||
public ContentItem getItem( PageState ps ) {
|
||||
return m_itemSelection.getSelectedItem( ps );
|
||||
public ContentItem getItem(PageState ps) {
|
||||
return m_itemSelection.getSelectedItem(ps);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The currently selected item, null if there isn't one.
|
||||
*/
|
||||
public ItemImageAttachment getAttachment( PageState ps ) {
|
||||
return (ItemImageAttachment)
|
||||
m_attachmentSelection.getSelectedAttachment( ps );
|
||||
public ItemImageAttachment getAttachment(PageState ps) {
|
||||
return (ItemImageAttachment) m_attachmentSelection.getSelectedAttachment(ps);
|
||||
}
|
||||
|
||||
private class AttachmentSelectionModel
|
||||
extends AbstractSingleSelectionModel
|
||||
{
|
||||
extends AbstractSingleSelectionModel {
|
||||
|
||||
private final RequestLocal m_attachment = new RequestLocal() {
|
||||
@Override
|
||||
protected Object initialValue( PageState ps ) {
|
||||
OID oid = (OID) getSelectedKey( ps );
|
||||
if( null == oid ) {
|
||||
protected Object initialValue(PageState ps) {
|
||||
OID oid = (OID) getSelectedKey(ps);
|
||||
if (null == oid) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return DomainObjectFactory.newInstance( oid );
|
||||
return DomainObjectFactory.newInstance(oid);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
public Object getSelectedKey( PageState ps ) {
|
||||
OID oid = (OID) ps.getValue( m_attachmentOID );
|
||||
if( null == oid ) {
|
||||
public Object getSelectedKey(PageState ps) {
|
||||
OID oid = (OID) ps.getValue(m_attachmentOID);
|
||||
if (null == oid) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return oid;
|
||||
}
|
||||
|
||||
public void setSelectedKey( PageState ps, Object oid ) {
|
||||
m_attachment.set( ps, null );
|
||||
ps.setValue( m_attachmentOID, oid );
|
||||
public void setSelectedKey(PageState ps, Object oid) {
|
||||
m_attachment.set(ps, null);
|
||||
ps.setValue(m_attachmentOID, oid);
|
||||
}
|
||||
|
||||
public ItemImageAttachment getSelectedAttachment( PageState ps ) {
|
||||
return (ItemImageAttachment) m_attachment.get( ps );
|
||||
public ItemImageAttachment getSelectedAttachment(PageState ps) {
|
||||
return (ItemImageAttachment) m_attachment.get(ps);
|
||||
}
|
||||
|
||||
public void setSelectedAttachment( PageState ps,
|
||||
ItemImageAttachment attachment ) {
|
||||
setSelectedKey( ps, attachment );
|
||||
m_attachment.set( ps, attachment );
|
||||
public void setSelectedAttachment(PageState ps,
|
||||
ItemImageAttachment attachment) {
|
||||
setSelectedKey(ps, attachment);
|
||||
m_attachment.set(ps, attachment);
|
||||
}
|
||||
|
||||
public ParameterModel getStateParameter() {
|
||||
return m_attachmentOID;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -198,4 +196,5 @@ public class ImageStep extends SecurityPropertyEditor {
|
|||
super.showDisplayPane(state);
|
||||
m_add.reset(state);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,29 @@
|
|||
<?xml version="1.0"?>
|
||||
<ccm:application xmlns:ccm="http://ccm.redhat.com/ccm-project"
|
||||
name="ccm-sci-publications-librarysignatures"
|
||||
prettyName="ScientificCMS Publications module asset for library signatures"
|
||||
version="6.6.5"
|
||||
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>
|
||||
An asset for library signatures of publications
|
||||
</ccm:description>
|
||||
|
||||
</ccm:application>
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -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.Note">
|
||||
|
||||
</xrd:adapter>
|
||||
</xrd:context>
|
||||
|
||||
</xrd:adapters>
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<registry>
|
||||
//Nothing yet
|
||||
</registry>
|
||||
|
|
@ -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_sci_publications_librarysignatures"/>
|
||||
<initializer class="com.arsdigita.cms.contentassets.LibrarySignaturesInitializer"/>
|
||||
</provides>
|
||||
|
||||
<scripts>
|
||||
<schema directory="ccm-sci-publications-librarysignatures"/>
|
||||
<data class="com.arsdigita.cms.contentassets.LibrarySignaturesLoader"/>
|
||||
</scripts>
|
||||
</load>
|
||||
|
|
@ -0,0 +1 @@
|
|||
com/arsdigita/cms/contentassets/SciPublicationsLibrarySignatures.pdl
|
||||
|
|
@ -0,0 +1 @@
|
|||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -0,0 +1,18 @@
|
|||
# To change this template, choose Tools | Templates
|
||||
# and open the template in the editor.
|
||||
|
||||
com.arsdigita.cms.contentassets.librarysignatures.label=Library signatures
|
||||
com.arsdigita.cms.contentassets.LibrarySignaturesResources=Library signatures of the publication
|
||||
scipublications.librarysignatures.none=No library signatures yet
|
||||
scipublications.librarysignatures.columns.library=Library
|
||||
scipublications.librarysignatures.columns.signature=Signature
|
||||
scipublications.librarysignatures.columns.library_link=Link
|
||||
scipublications.librarysignatures.columns.edit=Edit
|
||||
scipublications.librarysignatures.columns.delete=Delete
|
||||
scipublications.librarysignatures.edit=Edit
|
||||
scipublications.librarysignatures.delete=Delete
|
||||
scipublications.librarysignatures.add=Add library signature
|
||||
scipublications.librarysignatures.form.library=Library
|
||||
scipublications.librarysignatures.form.signature=Signature
|
||||
scipublications.librarysignatures.form.link=Link to the library catalog
|
||||
scipublications.librarysignatures.delete.confirm=Are you sure to delete this signature
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
# To change this template, choose Tools | Templates
|
||||
# and open the template in the editor.
|
||||
|
||||
com.arsdigita.cms.contentassets.librarysignatures.label=Bibliothekssignaturen
|
||||
com.arsdigita.cms.contentassets.LibrarySignaturesResources=Bibliothekssignaturen der Publikation
|
||||
scipublications.librarysignatures.none=Noch keine Bibliothekssignaturen vorhanden
|
||||
scipublications.librarysignatures.columns.library=Bibliothek
|
||||
scipublications.librarysignatures.columns.signature=Signatur
|
||||
scipublications.librarysignatures.columns.library_link=Link
|
||||
scipublications.librarysignatures.columns.edit=Bearbeiten
|
||||
scipublications.librarysignatures.columns.delete=L\u00f6schen
|
||||
scipublications.librarysignatures.edit=Bearbeiten
|
||||
scipublications.librarysignatures.delete=L\u00f6schen
|
||||
scipublications.librarysignatures.add=Bibliothekssignatur hinzuf\u00fcgen
|
||||
scipublications.librarysignatures.form.library=Bibliothek
|
||||
scipublications.librarysignatures.form.signature=Signatur
|
||||
scipublications.librarysignatures.form.link=Link zum Bibliothekskatalog
|
||||
scipublications.librarysignatures.delete.confirm=Sind Sie sicher, dass Sie diese Bibliothekssignatur entfernen wollen?
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -0,0 +1 @@
|
|||
ddl-timestamp
|
||||
|
|
@ -0,0 +1 @@
|
|||
@ ddl/oracle-se/table-ca_publications_librarysignatures-auto.sql
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
alter table ca_publications_librarysignatures add
|
||||
constraint ca_pub_librarys_pub_id_f_be8sv foreign key (publication_id)
|
||||
references ct_publications(publication_id);
|
||||
alter table ca_publications_librarysignatures add
|
||||
constraint ca_pub_librarys_sig_id_f_gk1cu foreign key (signature_id)
|
||||
references acs_objects(object_id);
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
alter table ca_publications_librarysignatures
|
||||
drop constraint ca_pub_librarys_pub_id_f_be8sv;
|
||||
alter table ca_publications_librarysignatures
|
||||
drop constraint ca_pub_librarys_sig_id_f_gk1cu;
|
||||
|
|
@ -0,0 +1 @@
|
|||
drop table ca_publications_librarysignatures;
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
create table ca_publications_librarysignatures (
|
||||
signature_id INTEGER not null
|
||||
constraint ca_pub_librarys_sig_id_p_7qh_1
|
||||
primary key,
|
||||
-- referential constraint for signature_id deferred due to circular dependencies
|
||||
library VARCHAR(512) not null,
|
||||
signature VARCHAR(512) not null,
|
||||
librarylink VARCHAR(2048),
|
||||
publication_id INTEGER not null
|
||||
-- referential constraint for publication_id deferred due to circular dependencies
|
||||
);
|
||||
|
|
@ -0,0 +1 @@
|
|||
\i ddl/postgres/table-ca_publications_librarysignatures-auto.sql
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
alter table ca_publications_librarysignatures add
|
||||
constraint ca_pub_librarys_pub_id_f_be8sv foreign key (publication_id)
|
||||
references ct_publications(publication_id);
|
||||
alter table ca_publications_librarysignatures add
|
||||
constraint ca_pub_librarys_sig_id_f_gk1cu foreign key (signature_id)
|
||||
references acs_objects(object_id);
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
alter table ca_publications_librarysignatures
|
||||
drop constraint ca_pub_librarys_pub_id_f_be8sv RESTRICT;
|
||||
alter table ca_publications_librarysignatures
|
||||
drop constraint ca_pub_librarys_sig_id_f_gk1cu RESTRICT;
|
||||
|
|
@ -0,0 +1 @@
|
|||
drop table ca_publications_librarysignatures;
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
create table ca_publications_librarysignatures (
|
||||
signature_id INTEGER not null
|
||||
constraint ca_pub_librarys_sig_id_p_7qh_1
|
||||
primary key,
|
||||
-- referential constraint for signature_id deferred due to circular dependencies
|
||||
library VARCHAR(512) not null,
|
||||
signature VARCHAR(512) not null,
|
||||
librarylink VARCHAR(2048),
|
||||
publication_id INTEGER not null
|
||||
-- referential constraint for publication_id deferred due to circular dependencies
|
||||
);
|
||||
|
|
@ -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,43 @@
|
|||
//
|
||||
// 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
|
||||
//
|
||||
//
|
||||
|
||||
model com.arsdigita.cms.contentassets;
|
||||
|
||||
import com.arsdigita.cms.contenttypes.Publication;
|
||||
import com.arsdigita.kernel.ACSObject;
|
||||
|
||||
object type LibrarySignature extends ACSObject {
|
||||
|
||||
String[1..1] library = ca_publications_librarysignatures.library VARCHAR(512);
|
||||
String[1..1] signature = ca_publications_librarysignatures.signature VARCHAR(512);
|
||||
|
||||
String[0..1] librarylink = ca_publications_librarysignatures.librarylink VARCHAR(2048);
|
||||
|
||||
reference key(ca_publications_librarysignatures.signature_id);
|
||||
}
|
||||
|
||||
association {
|
||||
|
||||
composite Publication[1..1] publication = join ca_publications_librarysignatures.publication_id
|
||||
to ct_publications.publication_id;
|
||||
|
||||
component LibrarySignature[0..n] librarysignatures = join ct_publications.publication_id
|
||||
to ca_publications_librarysignatures.publication_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.Note">
|
||||
|
||||
</xrd:adapter>
|
||||
</xrd:context>
|
||||
|
||||
</xrd:adapters>
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<registry>
|
||||
//Nothing yet
|
||||
</registry>
|
||||
|
|
@ -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_sci_publications_librarysignatures"/>
|
||||
<initializer class="com.arsdigita.cms.contentassets.LibrarySignaturesInitializer"/>
|
||||
</provides>
|
||||
|
||||
<scripts>
|
||||
<schema directory="ccm-sci-publications-librarysignatures"/>
|
||||
<data class="com.arsdigita.cms.contentassets.LibrarySignaturesLoader"/>
|
||||
</scripts>
|
||||
</load>
|
||||
|
|
@ -0,0 +1,112 @@
|
|||
/*
|
||||
* 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.contenttypes.Publication;
|
||||
import com.arsdigita.domain.DomainObjectFactory;
|
||||
import com.arsdigita.kernel.ACSObject;
|
||||
import com.arsdigita.persistence.DataCollection;
|
||||
import com.arsdigita.persistence.DataObject;
|
||||
import com.arsdigita.persistence.OID;
|
||||
import com.arsdigita.persistence.SessionManager;
|
||||
import com.arsdigita.util.Assert;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/*
|
||||
* @author Jens Pelzetter <jens@jp-digital.de>
|
||||
* @version $Id$
|
||||
*/
|
||||
public class LibrarySignature extends ACSObject {
|
||||
|
||||
public static final String BASE_DATA_OBJECT_TYPE = "com.arsdigita.cms.contentassets.LibrarySignature";
|
||||
|
||||
public static final String LIBRARY = "library";
|
||||
public static final String SIGNATURE = "signature";
|
||||
public static final String LIBRARY_LINK = "librarylink";
|
||||
public static final String PUBLICATION = "publication";
|
||||
|
||||
public LibrarySignature() {
|
||||
super(BASE_DATA_OBJECT_TYPE);
|
||||
}
|
||||
|
||||
public LibrarySignature(final BigDecimal signatureId) {
|
||||
super(new OID(BASE_DATA_OBJECT_TYPE, signatureId));
|
||||
}
|
||||
|
||||
public LibrarySignature(final String type) {
|
||||
super(type);
|
||||
}
|
||||
|
||||
public LibrarySignature(final DataObject dataObject) {
|
||||
super(dataObject);
|
||||
}
|
||||
|
||||
public static LibrarySignature create(final Publication publication) {
|
||||
final LibrarySignature signature = new LibrarySignature();
|
||||
signature.set(PUBLICATION, publication);
|
||||
|
||||
return signature;
|
||||
}
|
||||
|
||||
public static DataCollection getLibrarySignatures(final Publication publication) {
|
||||
|
||||
Assert.exists(publication, Publication.class);
|
||||
|
||||
final DataCollection signatures = SessionManager.getSession().retrieve(BASE_DATA_OBJECT_TYPE);
|
||||
|
||||
signatures.addEqualsFilter(PUBLICATION, publication.getID());
|
||||
signatures.addOrder(LIBRARY);
|
||||
signatures.addOrder(SIGNATURE);
|
||||
|
||||
return signatures;
|
||||
|
||||
}
|
||||
|
||||
public String getLibrary() {
|
||||
return (String) get(LIBRARY);
|
||||
}
|
||||
|
||||
public void setLibrary(final String library) {
|
||||
set(LIBRARY, library);
|
||||
}
|
||||
|
||||
public String getSignature() {
|
||||
return (String) get(SIGNATURE);
|
||||
}
|
||||
|
||||
public void setSignature(final String signature) {
|
||||
set(SIGNATURE, signature);
|
||||
}
|
||||
|
||||
public String getLibraryLink() {
|
||||
return (String) get(LIBRARY_LINK);
|
||||
}
|
||||
|
||||
public void setLibraryLink(final String libraryLink) {
|
||||
set(LIBRARY_LINK, libraryLink);
|
||||
}
|
||||
|
||||
public Publication getPublication() {
|
||||
final DataObject dataObject = (DataObject) get(PUBLICATION);
|
||||
|
||||
return (Publication) DomainObjectFactory.newInstance(dataObject);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,88 @@
|
|||
/*
|
||||
* 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.LibrarySignaturesStep;
|
||||
import com.arsdigita.cms.contenttypes.ContentAssetInitializer;
|
||||
import com.arsdigita.cms.contenttypes.Publication;
|
||||
import com.arsdigita.cms.dispatcher.SimpleXMLGenerator;
|
||||
import com.arsdigita.domain.DomainObjectTraversal;
|
||||
import com.arsdigita.domain.SimpleDomainObjectTraversalAdapter;
|
||||
import com.arsdigita.globalization.GlobalizedMessage;
|
||||
import com.arsdigita.runtime.DomainInitEvent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Jens Pelzetter <jens@jp-digital.de>
|
||||
* @version $Id$
|
||||
*/
|
||||
public class LibrarySignaturesInitializer extends ContentAssetInitializer {
|
||||
|
||||
public LibrarySignaturesInitializer() {
|
||||
super("ccm-sci-publications-librarysignatures.pdl.mf");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(final DomainInitEvent event) {
|
||||
super.init(event);
|
||||
|
||||
DomainObjectTraversal.registerAdapter(
|
||||
LibrarySignature.BASE_DATA_OBJECT_TYPE,
|
||||
new SimpleDomainObjectTraversalAdapter(),
|
||||
SimpleXMLGenerator.ADAPTER_CONTEXT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBaseType() {
|
||||
return Publication.BASE_DATA_OBJECT_TYPE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTraversalXML() {
|
||||
return TRAVERSAL_ADAPTER_BASE_DIR + "LibrarySignatures.xml";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getProperty() {
|
||||
return "librarysignatures";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class getAuthoringStep() {
|
||||
return LibrarySignaturesStep.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GlobalizedMessage getAuthoringStepLabel() {
|
||||
return new GlobalizedMessage("com.arsdigita.cms.contentassets.librarysignatures.label",
|
||||
"com.arsdigita.cms.contentassets.LibrarySignaturesResources");
|
||||
}
|
||||
|
||||
@Override
|
||||
public GlobalizedMessage getAuthoringStepDescription() {
|
||||
return new GlobalizedMessage("com.arsdigita.cms.contentassets.librarysignatures.description",
|
||||
"com.arsdigita.cms.contentassets.LibrarySignaturesResources");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAuthoringStepSortKey() {
|
||||
return 10;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
* 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.loader.PackageLoader;
|
||||
import com.arsdigita.runtime.ScriptContext;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Jens Pelzetter <jens@jp-digital.de>
|
||||
* @version $Id$
|
||||
*/
|
||||
public class LibrarySignaturesLoader extends PackageLoader {
|
||||
|
||||
public void run(final ScriptContext ctx) {
|
||||
//Nothing
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
# To change this template, choose Tools | Templates
|
||||
# and open the template in the editor.
|
||||
|
||||
com.arsdigita.cms.contentassets.librarysignatures.label=Library signatures
|
||||
com.arsdigita.cms.contentassets.LibrarySignaturesResources=Library signatures of the publication
|
||||
scipublications.librarysignatures.none=No library signatures yet
|
||||
scipublications.librarysignatures.columns.library=Library
|
||||
scipublications.librarysignatures.columns.signature=Signature
|
||||
scipublications.librarysignatures.columns.library_link=Link
|
||||
scipublications.librarysignatures.columns.edit=Edit
|
||||
scipublications.librarysignatures.columns.delete=Delete
|
||||
scipublications.librarysignatures.edit=Edit
|
||||
scipublications.librarysignatures.delete=Delete
|
||||
scipublications.librarysignatures.add=Add library signature
|
||||
scipublications.librarysignatures.form.library=Library
|
||||
scipublications.librarysignatures.form.signature=Signature
|
||||
scipublications.librarysignatures.form.link=Link to the library catalog
|
||||
scipublications.librarysignatures.delete.confirm=Are you sure to delete this signature
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
# To change this template, choose Tools | Templates
|
||||
# and open the template in the editor.
|
||||
|
||||
com.arsdigita.cms.contentassets.librarysignatures.label=Bibliothekssignaturen
|
||||
com.arsdigita.cms.contentassets.LibrarySignaturesResources=Bibliothekssignaturen der Publikation
|
||||
scipublications.librarysignatures.none=Noch keine Bibliothekssignaturen vorhanden
|
||||
scipublications.librarysignatures.columns.library=Bibliothek
|
||||
scipublications.librarysignatures.columns.signature=Signatur
|
||||
scipublications.librarysignatures.columns.library_link=Link
|
||||
scipublications.librarysignatures.columns.edit=Bearbeiten
|
||||
scipublications.librarysignatures.columns.delete=L\u00f6schen
|
||||
scipublications.librarysignatures.edit=Bearbeiten
|
||||
scipublications.librarysignatures.delete=L\u00f6schen
|
||||
scipublications.librarysignatures.add=Bibliothekssignatur hinzuf\u00fcgen
|
||||
scipublications.librarysignatures.form.library=Bibliothek
|
||||
scipublications.librarysignatures.form.signature=Signatur
|
||||
scipublications.librarysignatures.form.link=Link zum Bibliothekskatalog
|
||||
scipublications.librarysignatures.delete.confirm=Sind Sie sicher, dass Sie diese Bibliothekssignatur entfernen wollen?
|
||||
|
|
@ -0,0 +1,116 @@
|
|||
/*
|
||||
* 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.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.FormSectionEvent;
|
||||
import com.arsdigita.bebop.form.TextField;
|
||||
import com.arsdigita.bebop.parameters.NotEmptyValidationListener;
|
||||
import com.arsdigita.bebop.parameters.NotNullValidationListener;
|
||||
import com.arsdigita.cms.ItemSelectionModel;
|
||||
import com.arsdigita.cms.contentassets.LibrarySignature;
|
||||
import com.arsdigita.cms.contenttypes.Publication;
|
||||
import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
||||
import com.arsdigita.kernel.ui.ACSObjectSelectionModel;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Jens Pelzetter <jens@jp-digital.de>
|
||||
* @version $Id$
|
||||
*/
|
||||
public class LibrarySignaturesAddForm extends BasicItemForm {
|
||||
|
||||
private final static String LIBRARY = "library";
|
||||
private final static String SIGNATURE = "signature";
|
||||
private final static String LINK = "link";
|
||||
private final ItemSelectionModel itemModel;
|
||||
private final ACSObjectSelectionModel signatureModel;
|
||||
|
||||
public LibrarySignaturesAddForm(final ItemSelectionModel itemModel, final ACSObjectSelectionModel signatureModel) {
|
||||
super("LibrarySignaturesAddForm", itemModel);
|
||||
|
||||
this.itemModel = itemModel;
|
||||
this.signatureModel = signatureModel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addWidgets() {
|
||||
add(new Label(LibrarySignaturesGlobalizationUtil.globalize("scipublications.librarysignatures.form.library")));
|
||||
final TextField library = new TextField(LIBRARY);
|
||||
library.addValidationListener(new NotNullValidationListener(LibrarySignaturesGlobalizationUtil.globalize(
|
||||
"scipublications.librarysignatures.form.library.not_null")));
|
||||
library.addValidationListener(new NotEmptyValidationListener(LibrarySignaturesGlobalizationUtil.globalize(
|
||||
"scipublications.librarysignatures.form.library.not_empty")));
|
||||
add(library);
|
||||
|
||||
add(new Label(LibrarySignaturesGlobalizationUtil.globalize("scipublications.librarysignatures.form.signature")));
|
||||
final TextField signature = new TextField(SIGNATURE);
|
||||
signature.addValidationListener(new NotNullValidationListener(LibrarySignaturesGlobalizationUtil.globalize(
|
||||
"scipublications.librarysignatures.form.signature.not_null")));
|
||||
library.addValidationListener(new NotEmptyValidationListener(LibrarySignaturesGlobalizationUtil.globalize(
|
||||
"scipublications.librarysignatures.form.signature.not_empty")));
|
||||
add(signature);
|
||||
|
||||
add(new Label(LibrarySignaturesGlobalizationUtil.globalize("scipublications.librarysignatures.form.link")));
|
||||
add(new TextField(LINK));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(final FormSectionEvent event) throws FormProcessException {
|
||||
final PageState state = event.getPageState();
|
||||
|
||||
if (signatureModel.getSelectedObject(state) != null) {
|
||||
final LibrarySignature signature = (LibrarySignature) signatureModel.getSelectedObject(state);
|
||||
final FormData data = event.getFormData();
|
||||
|
||||
data.put(LIBRARY, signature.getLibrary());
|
||||
data.put(SIGNATURE, signature.getSignature());
|
||||
data.put(LINK, signature.getLibraryLink());
|
||||
}
|
||||
|
||||
setVisible(state, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(final FormSectionEvent event) throws FormProcessException {
|
||||
final FormData data = event.getFormData();
|
||||
final PageState state = event.getPageState();
|
||||
|
||||
final LibrarySignature signature;
|
||||
if (signatureModel.getSelectedObject(state) == null) {
|
||||
final Publication publication = (Publication) itemModel.getSelectedItem(state);
|
||||
|
||||
signature = LibrarySignature.create(publication);
|
||||
} else {
|
||||
signature = (LibrarySignature) signatureModel.getSelectedObject(state);
|
||||
|
||||
signatureModel.setSelectedObject(state, null);
|
||||
}
|
||||
|
||||
signature.setLibrary(data.getString(LIBRARY));
|
||||
signature.setSignature(data.getString(SIGNATURE));
|
||||
signature.setLibraryLink(data.getString(LINK));
|
||||
|
||||
signature.save();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -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.ui;
|
||||
|
||||
import com.arsdigita.globalization.GlobalizedMessage;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Jens Pelzetter <jens@jp-digital.de>
|
||||
* @version $Id$
|
||||
*/
|
||||
public final class LibrarySignaturesGlobalizationUtil {
|
||||
|
||||
private LibrarySignaturesGlobalizationUtil() {
|
||||
//Nothing
|
||||
}
|
||||
|
||||
public static final String BUNDLE_NAME = "com.arsdigita.cms.contentassets.LibrarySignaturesResources";
|
||||
|
||||
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,85 @@
|
|||
/*
|
||||
* 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.ui;
|
||||
|
||||
import com.arsdigita.bebop.Page;
|
||||
import com.arsdigita.bebop.PageState;
|
||||
import com.arsdigita.bebop.parameters.BigDecimalParameter;
|
||||
import com.arsdigita.cms.ItemSelectionModel;
|
||||
import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
|
||||
import com.arsdigita.cms.ui.authoring.SimpleEditStep;
|
||||
import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
|
||||
import com.arsdigita.kernel.ui.ACSObjectSelectionModel;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Jens Pelzetter <jens@jp-digital.de>
|
||||
* @version $Id$
|
||||
*/
|
||||
public class LibrarySignaturesStep extends SimpleEditStep {
|
||||
|
||||
|
||||
protected static final String EDIT = "edit";
|
||||
protected static final String SIGNATURE_PARAM = "library_signature";
|
||||
|
||||
private static final String FORM_KEY = "LibrarySignaturesAdd";
|
||||
|
||||
private final ItemSelectionModel itemModel;
|
||||
private final BigDecimalParameter signatureParam;
|
||||
final LibrarySignaturesAddForm addForm;
|
||||
|
||||
public LibrarySignaturesStep(final ItemSelectionModel itemModel, final AuthoringKitWizard parent) {
|
||||
this(itemModel, parent, null);
|
||||
}
|
||||
|
||||
public LibrarySignaturesStep(final ItemSelectionModel itemModel,
|
||||
final AuthoringKitWizard parent,
|
||||
final String prefix ) {
|
||||
|
||||
super(itemModel, parent, prefix);
|
||||
|
||||
this.itemModel = itemModel;
|
||||
|
||||
signatureParam = new BigDecimalParameter(SIGNATURE_PARAM);
|
||||
final ACSObjectSelectionModel signatureModel = new ACSObjectSelectionModel(signatureParam);
|
||||
|
||||
addForm = new LibrarySignaturesAddForm(itemModel, signatureModel);
|
||||
add(FORM_KEY,
|
||||
LibrarySignaturesGlobalizationUtil.globalize("scipublications.librarysignatures.add"),
|
||||
new WorkflowLockedComponentAccess(addForm, itemModel),
|
||||
addForm.getSaveCancelSection().getCancelButton());
|
||||
|
||||
final LibrarySignaturesTable table = new LibrarySignaturesTable(itemModel, signatureModel, this);
|
||||
setDisplayComponent(table);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void register(final Page page) {
|
||||
super.register(page);
|
||||
|
||||
page.addComponentStateParam(this, signatureParam);
|
||||
}
|
||||
|
||||
protected void setAddVisible(final PageState state) {
|
||||
showComponent(state, FORM_KEY);
|
||||
|
||||
//addForm.setVisible(state, true);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,303 @@
|
|||
/*
|
||||
* 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.ui;
|
||||
|
||||
import com.arsdigita.bebop.Component;
|
||||
import com.arsdigita.bebop.ControlLink;
|
||||
import com.arsdigita.bebop.Label;
|
||||
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.ContentItem;
|
||||
import com.arsdigita.cms.ItemSelectionModel;
|
||||
import com.arsdigita.cms.contentassets.LibrarySignature;
|
||||
import com.arsdigita.cms.contenttypes.Publication;
|
||||
import com.arsdigita.globalization.GlobalizedMessage;
|
||||
import com.arsdigita.kernel.ui.ACSObjectSelectionModel;
|
||||
import com.arsdigita.persistence.DataCollection;
|
||||
import com.arsdigita.persistence.DataObject;
|
||||
import com.arsdigita.persistence.SessionManager;
|
||||
import com.arsdigita.util.LockableImpl;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Jens Pelzetter <jens@jp-digital.de>
|
||||
* @version $Id$
|
||||
*/
|
||||
public class LibrarySignaturesTable extends Table {
|
||||
|
||||
private final static String TABLE_COL_LIBRARY = "table_col_library";
|
||||
private final static String TABLE_COL_SIGNATURE = "table_col_signature";
|
||||
private final static String TABLE_COL_LIBRARY_LINK = "table_col_library_link";
|
||||
private final static String TABLE_COL_EDIT = "table_col_edit";
|
||||
private final static String TABLE_COL_DEL = "table_col_del";
|
||||
//private final static String SELECTED_LIB_SIG = "selected_library_signature";
|
||||
private final LibrarySignaturesStep parent;
|
||||
private final ItemSelectionModel itemModel;
|
||||
private final ACSObjectSelectionModel signatureModel;
|
||||
|
||||
public LibrarySignaturesTable(final ItemSelectionModel itemModel,
|
||||
final ACSObjectSelectionModel signatureModel,
|
||||
final LibrarySignaturesStep parent) {
|
||||
|
||||
super();
|
||||
|
||||
this.parent = parent;
|
||||
this.itemModel = itemModel;
|
||||
this.signatureModel = signatureModel;
|
||||
|
||||
setEmptyView(new Label(LibrarySignaturesGlobalizationUtil.globalize("scipublications.librarysignatures.none")));
|
||||
|
||||
final TableColumnModel columnModel = getColumnModel();
|
||||
|
||||
columnModel.add(new TableColumn(
|
||||
0,
|
||||
LibrarySignaturesGlobalizationUtil.globalize("scipublications.librarysignatures.columns.library"),
|
||||
TABLE_COL_LIBRARY));
|
||||
columnModel.add(new TableColumn(
|
||||
1,
|
||||
LibrarySignaturesGlobalizationUtil.globalize("scipublications.librarysignatures.columns.signature"),
|
||||
TABLE_COL_SIGNATURE));
|
||||
columnModel.add(new TableColumn(
|
||||
2,
|
||||
LibrarySignaturesGlobalizationUtil.globalize("scipublications.librarysignatures.columns.library_link"),
|
||||
TABLE_COL_LIBRARY_LINK));
|
||||
columnModel.add(new TableColumn(
|
||||
3,
|
||||
LibrarySignaturesGlobalizationUtil.globalize("scipublications.librarysignatures.columns.edit"),
|
||||
TABLE_COL_EDIT));
|
||||
columnModel.add(new TableColumn(
|
||||
4,
|
||||
LibrarySignaturesGlobalizationUtil.globalize("scipublications.librarysignatures.columns.edit"),
|
||||
TABLE_COL_DEL));
|
||||
|
||||
setModelBuilder(new ModelBuilder(itemModel));
|
||||
|
||||
columnModel.get(3).setCellRenderer(new EditCellRenderer());
|
||||
columnModel.get(4).setCellRenderer(new DeleteCellRenderer());
|
||||
|
||||
addTableActionListener(new ActionListener());
|
||||
|
||||
}
|
||||
|
||||
private class ModelBuilder extends LockableImpl implements TableModelBuilder {
|
||||
|
||||
private final ItemSelectionModel itemModel;
|
||||
|
||||
public ModelBuilder(final ItemSelectionModel itemModel) {
|
||||
this.itemModel = itemModel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TableModel makeModel(final Table table, final PageState state) {
|
||||
table.getRowSelectionModel().clearSelection(state);
|
||||
|
||||
final Publication publication = (Publication) itemModel.getSelectedItem(state);
|
||||
|
||||
return new Model(table, state, publication);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private class Model implements TableModel {
|
||||
|
||||
private final Table table;
|
||||
private final DataCollection librarySignatures;
|
||||
|
||||
public Model(final Table table, final PageState state, final Publication publication) {
|
||||
this.table = table;
|
||||
|
||||
librarySignatures = LibrarySignature.getLibrarySignatures(publication);
|
||||
librarySignatures.addOrder(LibrarySignature.LIBRARY);
|
||||
librarySignatures.addOrder(LibrarySignature.SIGNATURE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColumnCount() {
|
||||
return table.getColumnModel().size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean nextRow() {
|
||||
// boolean ret;
|
||||
//
|
||||
// if ((librarySignatures != null) && librarySignatures.next()) {
|
||||
// ret = true;
|
||||
// } else {
|
||||
// ret = false;
|
||||
// }
|
||||
//
|
||||
// return ret;
|
||||
|
||||
return (librarySignatures != null) && librarySignatures.next();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getElementAt(final int columnIndex) {
|
||||
switch (columnIndex) {
|
||||
case 0:
|
||||
return librarySignatures.get(LibrarySignature.LIBRARY);
|
||||
case 1:
|
||||
return librarySignatures.get(LibrarySignature.SIGNATURE);
|
||||
case 2:
|
||||
return librarySignatures.get(LibrarySignature.LIBRARY_LINK);
|
||||
case 3:
|
||||
return LibrarySignaturesGlobalizationUtil.globalize("scipublications.librarysignatures.edit");
|
||||
case 4:
|
||||
return LibrarySignaturesGlobalizationUtil.globalize("scipublications.librarysignatures.delete");
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getKeyAt(final int columnIndex) {
|
||||
return librarySignatures.get(ContentItem.ID);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private class EditCellRenderer extends LockableImpl implements TableCellRenderer {
|
||||
|
||||
public EditCellRenderer() {
|
||||
//Nothing
|
||||
}
|
||||
|
||||
@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 publication = (Publication) itemModel.getSelectedItem(state);
|
||||
|
||||
final boolean canEdit = securityManager.canAccess(state.getRequest(),
|
||||
com.arsdigita.cms.SecurityManager.EDIT_ITEM,
|
||||
publication);
|
||||
|
||||
if (canEdit) {
|
||||
final ControlLink link;
|
||||
if (value instanceof GlobalizedMessage) {
|
||||
link = new ControlLink(new Label((GlobalizedMessage) value));
|
||||
} else if (value == null) {
|
||||
return new Label("???");
|
||||
} else {
|
||||
link = new ControlLink(value.toString());
|
||||
}
|
||||
return link;
|
||||
} else {
|
||||
final Label label;
|
||||
if (value instanceof GlobalizedMessage) {
|
||||
label = new Label((GlobalizedMessage) value);
|
||||
} else if (value == null) {
|
||||
return new Label("???");
|
||||
} else {
|
||||
label = new Label(value.toString());
|
||||
}
|
||||
return label;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private class DeleteCellRenderer extends LockableImpl implements TableCellRenderer {
|
||||
|
||||
public DeleteCellRenderer() {
|
||||
//Nothing
|
||||
}
|
||||
|
||||
@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 publication = (Publication) itemModel.getSelectedItem(state);
|
||||
|
||||
final boolean canEdit = securityManager.canAccess(state.getRequest(),
|
||||
com.arsdigita.cms.SecurityManager.EDIT_ITEM,
|
||||
publication);
|
||||
|
||||
if (canEdit) {
|
||||
final ControlLink link;
|
||||
if (value instanceof GlobalizedMessage) {
|
||||
link = new ControlLink(new Label((GlobalizedMessage) value));
|
||||
} else {
|
||||
link = new ControlLink(value.toString());
|
||||
}
|
||||
link.setConfirmation(LibrarySignaturesGlobalizationUtil.globalize(
|
||||
"scipublications.librarysignatures.delete.confirm"));
|
||||
return link;
|
||||
} else {
|
||||
final Label label;
|
||||
if (value instanceof GlobalizedMessage) {
|
||||
label = new Label((GlobalizedMessage) value);
|
||||
} else {
|
||||
label = new Label(value.toString());
|
||||
}
|
||||
return label;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private class ActionListener implements TableActionListener {
|
||||
|
||||
public ActionListener() {
|
||||
//Nothing for now
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cellSelected(final TableActionEvent event) {
|
||||
final PageState state = event.getPageState();
|
||||
|
||||
final LibrarySignature signature = new LibrarySignature(new BigDecimal(event.getRowKey().toString()));
|
||||
|
||||
final TableColumn column = getColumnModel().get(event.getColumn().intValue());
|
||||
|
||||
if (TABLE_COL_EDIT.equals(column.getHeaderKey().toString())) {
|
||||
signatureModel.setSelectedObject(state, signature);
|
||||
parent.setAddVisible(state);
|
||||
} else if (TABLE_COL_DEL.equals(column.getHeaderKey().toString())) {
|
||||
signature.delete();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void headSelected(final TableActionEvent event) {
|
||||
//Nothing to do here
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -42,6 +42,7 @@ import com.arsdigita.cms.dispatcher.ItemResolver;
|
|||
import com.arsdigita.cms.dispatcher.Utilities;
|
||||
import com.arsdigita.cms.ui.authoring.SimpleEditStep;
|
||||
import com.arsdigita.dispatcher.ObjectNotFoundException;
|
||||
import com.arsdigita.globalization.GlobalizedMessage;
|
||||
import com.arsdigita.util.LockableImpl;
|
||||
import java.math.BigDecimal;
|
||||
import org.apache.log4j.Logger;
|
||||
|
|
@ -223,7 +224,7 @@ public class PublicationAuthorsTable
|
|||
int row,
|
||||
int col) {
|
||||
SecurityManager securityManager =
|
||||
Utilities.getSecurityManager(state);
|
||||
CMS.getSecurityManager(state);
|
||||
Publication publication = (Publication) m_itemModel.
|
||||
getSelectedObject(state);
|
||||
|
||||
|
|
@ -240,7 +241,11 @@ public class PublicationAuthorsTable
|
|||
s_log.warn(String.format("No object with key '%s' found.",
|
||||
key),
|
||||
ex);
|
||||
return new Label(value.toString());
|
||||
if (value instanceof GlobalizedMessage) {
|
||||
return new Label((GlobalizedMessage) value);
|
||||
} else {
|
||||
return new Label(value.toString());
|
||||
}
|
||||
}
|
||||
|
||||
ContentSection section = author.getContentSection();//CMS.getContext().getContentSection();
|
||||
|
|
|
|||
|
|
@ -54,8 +54,7 @@ public class PublicationGenericOrganizationalUnitAddForm
|
|||
|
||||
@Override
|
||||
public void addWidgets() {
|
||||
add(new Label((String) PublicationGlobalizationUtil.globalize(
|
||||
"publications.ui.orgaunit.select").localize()));
|
||||
add(new Label(PublicationGlobalizationUtil.globalize("publications.ui.orgaunit.select")));
|
||||
itemSearch = new ItemSearchWidget(ITEM_SEARCH, ContentType.
|
||||
findByAssociatedObjectType(GenericOrganizationalUnit.class.
|
||||
getName()));
|
||||
|
|
@ -84,7 +83,7 @@ public class PublicationGenericOrganizationalUnitAddForm
|
|||
ITEM_SEARCH);
|
||||
orgaunit = (GenericOrganizationalUnit) orgaunit.getContentBundle().
|
||||
getInstance(publication.getLanguage(), true);
|
||||
|
||||
|
||||
publication.addOrganizationalUnit(orgaunit);
|
||||
itemSearch.publishCreatedItem(data, orgaunit);
|
||||
}
|
||||
|
|
@ -129,4 +128,5 @@ public class PublicationGenericOrganizationalUnitAddForm
|
|||
|
||||
orgaunits.close();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ public class PublicationGenericOrganizationalUnitsStep extends SimpleEditStep {
|
|||
final BasicItemForm addOrgaUnitSheet = new PublicationGenericOrganizationalUnitAddForm(
|
||||
itemModel);
|
||||
add(ADD_ORGAUNIT_SHEET_NAME,
|
||||
(String) PublicationGlobalizationUtil.globalize("publications.ui.orgaunit.add").localize(),
|
||||
PublicationGlobalizationUtil.globalize("publications.ui.orgaunit.add"),
|
||||
new WorkflowLockedComponentAccess(addOrgaUnitSheet, itemModel),
|
||||
addOrgaUnitSheet.getSaveCancelSection().getCancelButton());
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue