Added an additional field to ContentItem which is used in the FolderBrowser in the ContentCenter to display additional informations about the content item. For example, it

would be very helpful for authors to see the authors of a publications in the FolderBrowser. An upgrade for the publication module providing this informations for existing applications is included. New publications will set this information automatically.


git-svn-id: https://svn.libreccm.org/ccm/trunk@2328 8810af33-2d31-482b-a856-94f89814c4df
master
jensp 2013-09-30 05:37:04 +00:00
parent ff5dbab75c
commit a366c1de76
18 changed files with 94 additions and 18 deletions

View File

@ -2,7 +2,7 @@
<ccm:application xmlns:ccm="http://ccm.redhat.com/ccm-project" <ccm:application xmlns:ccm="http://ccm.redhat.com/ccm-project"
name="ccm-cms" name="ccm-cms"
prettyName="Red Hat CCM Content Management System" prettyName="Red Hat CCM Content Management System"
version="6.6.9" version="6.6.10"
release="1" release="1"
webapp="ROOT"> webapp="ROOT">
<ccm:dependencies> <ccm:dependencies>

View File

@ -38,6 +38,8 @@ object type ContentItem extends VersionedACSObject {
// a 'connect by' statement. // a 'connect by' statement.
String[0..1] ancestors = cms_items.ancestors VARCHAR(3209); String[0..1] ancestors = cms_items.ancestors VARCHAR(3209);
String[0..1] additionalInfo = cms_items.additional_info VARCHAR(1024);
reference key (cms_items.item_id); reference key (cms_items.item_id);
// Basic auditing info for content items // Basic auditing info for content items

View File

@ -73,4 +73,8 @@
<!-- Make RelationAttribute SubClass of ACSObject --> <!-- Make RelationAttribute SubClass of ACSObject -->
<script class="com.arsdigita.cms.upgrade.RelationAttributeACSObject"/> <script class="com.arsdigita.cms.upgrade.RelationAttributeACSObject"/>
</version> </version>
<version from="6.6.9" to="6.6.10">
<!-- Add an additional field to ContentItem for displaying additional information in the folder browser. -->
<script sql="ccm-cms/upgrade/::database::-6.6.9-6.6.10.sql"/>
</version>
</upgrade> </upgrade>

View File

@ -1059,3 +1059,4 @@ cms.contenttypes.ui.title_hint=The title of the item readable by the user. Besid
cms.contenttypes.ui.name_hint=Nicht Teil des Dokumentes wie es Besuchern angezeigt wird. Es handelt sich um den letzten Teil der URL (nach dem letzten "/") und ist somit Teil der Internet Addresse dieses Dokumentes. Es wird oben im Adressfeld des Browsers angezeigt. Es wird automatisch aus dem Titel generiert, wobei unzul\u00e4ssige Zeichen ersetzt werden. Bei einem sehr langen Titel kann eine manuelle K\u00fcrzung sinnvoll sein, um \u00fcberlange Adresszeilen zu vermeiden. cms.contenttypes.ui.name_hint=Nicht Teil des Dokumentes wie es Besuchern angezeigt wird. Es handelt sich um den letzten Teil der URL (nach dem letzten "/") und ist somit Teil der Internet Addresse dieses Dokumentes. Es wird oben im Adressfeld des Browsers angezeigt. Es wird automatisch aus dem Titel generiert, wobei unzul\u00e4ssige Zeichen ersetzt werden. Bei einem sehr langen Titel kann eine manuelle K\u00fcrzung sinnvoll sein, um \u00fcberlange Adresszeilen zu vermeiden.
#used for tabs in content section #used for tabs in content section
cms.ui.images=Images cms.ui.images=Images
cms.ui.folder.additionalInfo=Info

View File

@ -1053,3 +1053,4 @@ cms.contenttypes.ui.title_hint=Titel des Dokuments wie ihn Besucher lesen sollen
cms.contenttypes.ui.name_hint=Not part of the item as displayed to the user. It is the last part of the URL (after the last "/") and is part of the internet address of this item. It is displayed in the browsers address field. Made up automatically using the title, illegal characters replaced. With a long title you may choose to shorten it to avoid overly long internet addresses. cms.contenttypes.ui.name_hint=Not part of the item as displayed to the user. It is the last part of the URL (after the last "/") and is part of the internet address of this item. It is displayed in the browsers address field. Made up automatically using the title, illegal characters replaced. With a long title you may choose to shorten it to avoid overly long internet addresses.
#used for tabs in content section #used for tabs in content section
cms.ui.images=Bilder cms.ui.images=Bilder
cms.ui.folder.additionalInfo=Info

View File

@ -107,3 +107,4 @@ cms.contenttypes.ui.title_hint=The title of the item readable by the user. Besid
cms.contenttypes.ui.name_hint=Not part of the item as displayed to the user. It is the last part of the URL (after the last "/") and is part of the internet address of this item. It is displayed in the browsers address field. Made up automatically using the title, illegal characters replaced. With a long title you may choose to shorten it to avoid overly long internet addresses. cms.contenttypes.ui.name_hint=Not part of the item as displayed to the user. It is the last part of the URL (after the last "/") and is part of the internet address of this item. It is displayed in the browsers address field. Made up automatically using the title, illegal characters replaced. With a long title you may choose to shorten it to avoid overly long internet addresses.
#used for tabs in content section #used for tabs in content section
cms.ui.images=Images cms.ui.images=Images
cms.ui.folder.additionalInfo=

View File

@ -581,3 +581,4 @@ cms.contenttypes.ui.title_hint=The title of the item readable by the user. Besid
cms.contenttypes.ui.name_hint=Not part of the item as displayed to the user. It is the last part of the URL (after the last "/") and is part of the internet address of this item. It is displayed in the browsers address field. Made up automatically using the title, illegal characters replaced. With a long title you may choose to shorten it to avoid overly long internet addresses. cms.contenttypes.ui.name_hint=Not part of the item as displayed to the user. It is the last part of the URL (after the last "/") and is part of the internet address of this item. It is displayed in the browsers address field. Made up automatically using the title, illegal characters replaced. With a long title you may choose to shorten it to avoid overly long internet addresses.
#used for tabs in content section #used for tabs in content section
cms.ui.images=Images cms.ui.images=Images
cms.ui.folder.additionalInfo=

View File

@ -218,6 +218,7 @@ public class ContentItem extends VersionedACSObject implements CustomCopy {
public static final String CONTENT_TYPE = "type"; public static final String CONTENT_TYPE = "type";
public static final String VERSION = "version"; public static final String VERSION = "version";
public static final String NAME = "name"; public static final String NAME = "name";
public static final String ADDITIONAL_INFO = "additionalInfo";
public static final String LANGUAGE = "language"; public static final String LANGUAGE = "language";
public static final String AUDITING = "auditing"; public static final String AUDITING = "auditing";
public static final String DRAFT_VERSION = "masterVersion"; public static final String DRAFT_VERSION = "masterVersion";
@ -508,6 +509,14 @@ public class ContentItem extends VersionedACSObject implements CustomCopy {
m_reporter.mutated("name"); m_reporter.mutated("name");
} }
public String getAdditionalInfo() {
return (String) get(ADDITIONAL_INFO);
}
public void setAdditionalInfo(final String additionalInfo) {
set(ADDITIONAL_INFO, additionalInfo);
}
/** /**
* Get the parent object. * Get the parent object.
*/ */

View File

@ -72,3 +72,4 @@ cms.ui.folder.filter=Filter for work
cms.ui.folder.filter_do=Filter cms.ui.folder.filter_do=Filter
cms.ui.folder.languages=Languages cms.ui.folder.languages=Languages
cms.ui.folder.delete_confirmation=Permanently delete this item? cms.ui.folder.delete_confirmation=Permanently delete this item?
cms.ui.folder.additionalInfo=Info

View File

@ -72,3 +72,4 @@ cms.ui.folder.edit_selection=Ausgew\u00e4hlte Items kopieren oder verschieben:
cms.ui.folder.creation_date=Erstellungsdatum cms.ui.folder.creation_date=Erstellungsdatum
cms.ui.folder.last_modified=Letzte \u00c4nderung cms.ui.folder.last_modified=Letzte \u00c4nderung
cms.ui.folder.index=Index cms.ui.folder.index=Index
cms.ui.folder.additionalInfo=Info

View File

@ -67,3 +67,4 @@ cms.ui.folder.no_such_item=L'identifiant fourni pour l'\u00e9l\u00e9ment ne corr
cms.ui.folder.filter.all= cms.ui.folder.filter.all=
cms.ui.folder.languages= cms.ui.folder.languages=
cms.ui.folder.delete_confirmation= cms.ui.folder.delete_confirmation=
cms.ui.folder.additionalInfo=

View File

@ -80,6 +80,7 @@ public class FolderBrowser extends Table {
globalize("cms.ui.folder.name"), globalize("cms.ui.folder.name"),
globalize("cms.ui.folder.languages"), globalize("cms.ui.folder.languages"),
globalize("cms.ui.folder.title"), globalize("cms.ui.folder.title"),
globalize("cms.ui.folder.additionalInfo"),
globalize("cms.ui.folder.type"), globalize("cms.ui.folder.type"),
globalize("cms.ui.folder.creation_date"), globalize("cms.ui.folder.creation_date"),
globalize("cms.ui.folder.last_modified"), globalize("cms.ui.folder.last_modified"),
@ -89,6 +90,7 @@ public class FolderBrowser extends Table {
globalize("cms.ui.folder.name"), globalize("cms.ui.folder.name"),
globalize("cms.ui.folder.languages"), globalize("cms.ui.folder.languages"),
globalize("cms.ui.folder.title"), globalize("cms.ui.folder.title"),
globalize("cms.ui.folder.additionalInfo"),
globalize("cms.ui.folder.type"), globalize("cms.ui.folder.type"),
globalize("cms.ui.folder.creation_date"), globalize("cms.ui.folder.creation_date"),
globalize("cms.ui.folder.last_modified"), globalize("cms.ui.folder.last_modified"),
@ -165,15 +167,15 @@ public class FolderBrowser extends Table {
m_nameColumn.setHeaderRenderer(new HeaderCellRenderer(SORT_KEY_NAME)); m_nameColumn.setHeaderRenderer(new HeaderCellRenderer(SORT_KEY_NAME));
getColumn(1).setCellRenderer(new LanguagesCellRenderer()); getColumn(1).setCellRenderer(new LanguagesCellRenderer());
getColumn(2).setHeaderRenderer(new HeaderCellRenderer(SORT_KEY_TITLE)); getColumn(2).setHeaderRenderer(new HeaderCellRenderer(SORT_KEY_TITLE));
getColumn(4).setHeaderRenderer(new HeaderCellRenderer(
SORT_KEY_CREATION_DATE));
getColumn(5).setHeaderRenderer(new HeaderCellRenderer( getColumn(5).setHeaderRenderer(new HeaderCellRenderer(
SORT_KEY_CREATION_DATE));
getColumn(6).setHeaderRenderer(new HeaderCellRenderer(
SORT_KEY_LAST_MODIFIED_DATE)); SORT_KEY_LAST_MODIFIED_DATE));
m_deleteColumn = getColumn(6); m_deleteColumn = getColumn(7);
m_deleteColumn.setCellRenderer(new ActionCellRenderer()); m_deleteColumn.setCellRenderer(new ActionCellRenderer());
m_deleteColumn.setAlign("center"); m_deleteColumn.setAlign("center");
if (!hideIndexColumn()) { if (!hideIndexColumn()) {
m_indexColumn = getColumn(7); m_indexColumn = getColumn(8);
m_indexColumn.setCellRenderer(new IndexToggleRenderer()); m_indexColumn.setCellRenderer(new IndexToggleRenderer());
m_indexColumn.setAlign("center"); m_indexColumn.setAlign("center");
@ -693,11 +695,12 @@ public class FolderBrowser extends Table {
private static final int NAME = 0; private static final int NAME = 0;
private static final int LANGUAGES = 1; private static final int LANGUAGES = 1;
private static final int TITLE = 2; private static final int TITLE = 2;
private static final int TYPE = 3; private static final int ADDITIONAL_INFO = 3;
private static final int CREATION_DATE = 4; private static final int TYPE = 4;
private static final int LAST_MODIFIED = 5; private static final int CREATION_DATE = 5;
private static final int DELETABLE = 6; private static final int LAST_MODIFIED = 6;
private static final int IS_INDEX = 7; private static final int DELETABLE = 7;
private static final int IS_INDEX = 8;
private PageState m_state; private PageState m_state;
private FolderBrowser m_table; private FolderBrowser m_table;
private Folder.ItemCollection m_itemColl; private Folder.ItemCollection m_itemColl;
@ -742,6 +745,8 @@ public class FolderBrowser extends Table {
return m_itemColl; return m_itemColl;
case TITLE: case TITLE:
return m_itemColl.getDisplayName(); return m_itemColl.getDisplayName();
case ADDITIONAL_INFO:
return m_itemColl.getContentItem().getAdditionalInfo();
case TYPE: case TYPE:
return m_itemColl.getTypeLabel(); return m_itemColl.getTypeLabel();
case CREATION_DATE: { case CREATION_DATE: {

View File

@ -2,12 +2,12 @@
<ccm:application xmlns:ccm="http://ccm.redhat.com/ccm-project" <ccm:application xmlns:ccm="http://ccm.redhat.com/ccm-project"
name="ccm-sci-publications" name="ccm-sci-publications"
prettyName="OpenCCM Content Types" prettyName="OpenCCM Content Types"
version="6.6.5" version="6.6.6"
release="1" release="1"
webapp="ROOT"> webapp="ROOT">
<ccm:dependencies> <ccm:dependencies>
<ccm:requires name="ccm-core" version="6.6.4" relation="ge"/> <ccm:requires name="ccm-core" version="6.6.4" relation="ge"/>
<ccm:requires name="ccm-cms" version="6.6.7" relation="ge"/> <ccm:requires name="ccm-cms" version="6.6.10" relation="ge"/>
</ccm:dependencies> </ccm:dependencies>
<ccm:directories> <ccm:directories>
<ccm:directory name="pdl"/> <ccm:directory name="pdl"/>

View File

@ -15,4 +15,7 @@
<version from="6.6.4" to="6.6.5"> <version from="6.6.4" to="6.6.5">
<script sql="ccm-sci-publications/upgrade/::database::-6.6.4-6.6.5.sql" /> <script sql="ccm-sci-publications/upgrade/::database::-6.6.4-6.6.5.sql" />
</version> </version>
<version from="6.6.5" to="6.6.6">
<script class="com.arsdigita.cms.contenttypes.upgrades.SciPublicationsUpgrade665to666"/>
</version>
</upgrade> </upgrade>

View File

@ -242,6 +242,7 @@ public class Publication extends ContentPage {
builder.append(authors.getGivenName()); builder.append(authors.getGivenName());
} }
set(AUTHORS_STR, builder.toString()); set(AUTHORS_STR, builder.toString());
setAdditionalInfo(builder.toString());
} }
/** /**

View File

@ -282,6 +282,7 @@ public class PublicationBundle extends ContentBundle {
while (instances.next()) { while (instances.next()) {
publication = (Publication) instances.getDomainObject(); publication = (Publication) instances.getDomainObject();
publication.set(Publication.AUTHORS_STR, authorsStr); publication.set(Publication.AUTHORS_STR, authorsStr);
publication.setAdditionalInfo(authorsStr);
} }
} }

View File

@ -0,0 +1,44 @@
package com.arsdigita.cms.contenttypes.upgrades;
import com.arsdigita.cms.contenttypes.Publication;
import com.arsdigita.domain.DomainObjectFactory;
import com.arsdigita.persistence.DataCollection;
import com.arsdigita.persistence.DataObject;
import com.arsdigita.persistence.Session;
import com.arsdigita.persistence.SessionManager;
import com.arsdigita.util.cmd.Program;
import org.apache.commons.cli.CommandLine;
/**
*
* @author Jens Pelzetter <jens@jp-digital.de>
* @version $Id$
*/
public class SciPublicationsUpgrade665to666 extends Program {
public SciPublicationsUpgrade665to666() {
super("SciPublicationsUpgrade665to666", "1.0.0", "", true, true);
}
@Override
public void doRun(final CommandLine cmdLine) {
final Session session = SessionManager.getSession();
final DataCollection dataCollection = session.retrieve(Publication.BASE_DATA_OBJECT_TYPE);
while (dataCollection.next()) {
setContentItemInfo(dataCollection.getDataObject());
}
}
private void setContentItemInfo(final DataObject dataObject) {
final Publication publication = (Publication) DomainObjectFactory.newInstance(dataObject);
publication.setAdditionalInfo((String) publication.get("authorsStr"));
}
public static void main(final String[] args) {
new SciPublicationsUpgrade665to666().run(args);
}
}