CCM NG/ccm-cms: Some bugfixes

git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@4985 8810af33-2d31-482b-a856-94f89814c4df
pull/2/head
jensp 2017-09-06 08:41:30 +00:00
parent 47dd3de972
commit e59e148feb
12 changed files with 125 additions and 26 deletions

View File

@ -149,6 +149,7 @@ public class WizardSelector extends AuthoringKitSelector
/**
* Reset the state of the current wizard
*/
@Override
public void reset(final PageState state) {
final Resettable resettable = (Resettable) getCurrentWizard(state);
if (resettable != null) {

View File

@ -31,6 +31,7 @@ import com.arsdigita.bebop.table.TableCellRenderer;
import com.arsdigita.bebop.table.TableColumn;
import com.arsdigita.bebop.table.TableColumnModel;
import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.ui.GlobalNavigation;
import com.arsdigita.cms.ui.authoring.assets.AttachmentListSelectionModel;
import com.arsdigita.cms.ui.authoring.assets.AttachmentSelectionModel;
import com.arsdigita.globalization.GlobalizedMessage;
@ -108,6 +109,10 @@ class AttachmentsTable extends Table {
.getColumn(COL_REMOVE)
.setCellRenderer(new ControlLinkCellRenderer());
setEmptyView(new Label(new GlobalizedMessage(
"cms.ui.authoring.assets.related_info_step.attachment.none",
CmsConstants.CMS_BUNDLE)));
super
.addTableActionListener(new TableActionListener() {

View File

@ -20,6 +20,7 @@ package com.arsdigita.cms.ui.authoring.assets.relatedinfo;
import com.arsdigita.bebop.Form;
import com.arsdigita.bebop.FormProcessException;
import com.arsdigita.bebop.Page;
import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.SaveCancelSection;
import com.arsdigita.bebop.event.FormInitListener;
@ -79,9 +80,20 @@ class RelatedInfoAttachAssetForm
super.addSubmissionListener(this);
}
@Override
public void register(final Page page) {
super.register(page);
page.addComponentStateParam(this, itemSelectionModel.getStateParameter());
page.addComponentStateParam(this, listSelectionModel.getStateParameter());
}
@Override
public void init(final FormSectionEvent event) throws FormProcessException {
// Nothing yet
if (listSelectionModel.getSelectedKey(event.getPageState()) == null) {
throw new UnexpectedErrorException("The selected list null. "
+ "This should not happen.");
}
}
@Override
@ -90,6 +102,11 @@ class RelatedInfoAttachAssetForm
final PageState state = event.getPageState();
if (listSelectionModel.getSelectedKey(state) == null) {
throw new UnexpectedErrorException("The selected list null. "
+ "This should not happen.");
}
final Object value = searchWidget.getValue(state);
if (value != null) {
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();

View File

@ -37,7 +37,6 @@ import com.arsdigita.bebop.form.TextArea;
import com.arsdigita.bebop.form.TextField;
import com.arsdigita.bebop.parameters.GlobalizedParameterListener;
import com.arsdigita.bebop.parameters.ParameterData;
import com.arsdigita.bebop.parameters.StringIsLettersOrDigitsValidationListener;
import com.arsdigita.bebop.parameters.StringParameter;
import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.ui.authoring.assets.AttachmentListSelectionModel;
@ -365,6 +364,8 @@ class RelatedInfoListForm
controller.saveAttachmentList(attachmentList);
}
relatedInfoStep.showAttachmentListTable(state);
}
@Override

View File

@ -122,6 +122,10 @@ class RelatedInfoListTable extends Table {
.getColumn(COL_DELETE)
.setCellRenderer(new ControlLinkCellRenderer());
super.setEmptyView(new Label(new GlobalizedMessage(
"cms.ui.authoring.assets.related_info_step.list.none",
CmsConstants.CMS_BUNDLE)));
super
.addTableActionListener(new TableActionListener() {

View File

@ -20,6 +20,7 @@ package com.arsdigita.cms.ui.authoring.assets.relatedinfo;
import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.Text;
import com.arsdigita.bebop.table.TableModel;
import com.arsdigita.cms.ui.authoring.assets.AttachmentListSelectionModel;
import com.arsdigita.globalization.GlobalizedMessage;
@ -71,14 +72,15 @@ class RelatedInfoListTableModel implements TableModel {
switch (columnIndex) {
case RelatedInfoListTable.COL_NAME:
return currentRow.getName();
return new Text(currentRow.getName());
case RelatedInfoListTable.COL_TITLE:
return currentRow.getTitle();
return new Text(currentRow.getTitle());
case RelatedInfoListTable.COL_DESC:
return currentRow.getDescription();
return new Text(currentRow.getDescription());
case RelatedInfoListTable.COL_EDIT:
return new Label(new GlobalizedMessage(
"cms.ui.authoring.assets.related_info_step.list.edit"));
"cms.ui.authoring.assets.related_info_step.list.edit",
CmsConstants.CMS_BUNDLE));
case RelatedInfoListTable.COL_MOVE:
if (moveListModel.getSelectedAttachmentList(state) == null) {
return new Label(new GlobalizedMessage(
@ -91,7 +93,8 @@ class RelatedInfoListTableModel implements TableModel {
}
case RelatedInfoListTable.COL_DELETE:
return new Label(new GlobalizedMessage(
"cms.ui.authoring.assets.related_info_step.list.delete"));
"cms.ui.authoring.assets.related_info_step.list.delete",
CmsConstants.CMS_BUNDLE));
default:
throw new IllegalArgumentException(String.format(
"Illegal column index %d.", columnIndex));

View File

@ -19,6 +19,7 @@
package com.arsdigita.cms.ui.authoring.assets.relatedinfo;
import com.arsdigita.bebop.ActionLink;
import com.arsdigita.bebop.BoxPanel;
import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.Page;
import com.arsdigita.bebop.PageState;
@ -91,9 +92,6 @@ public class RelatedInfoStep extends ResettableContainer {
selectedListModel,
selectedLanguageParam);
super.add(listTable);
super.add(listForm);
addListLink = new ActionLink(new Label(new GlobalizedMessage(
"cms.ui.authoring.assets.related_info_step.add_list",
CmsConstants.CMS_BUNDLE)));
@ -160,8 +158,7 @@ public class RelatedInfoStep extends ResettableContainer {
CmsConstants.CMS_BUNDLE));
attachmentToFirstLink.addActionListener(event -> {
final PageState state = event.getPageState();
final ItemAttachment<?>
toMove = moveAttachmentModel
final ItemAttachment<?> toMove = moveAttachmentModel
.getSelectedAttachment(state);
final RelatedInfoStepController controller = CdiUtil
@ -186,6 +183,20 @@ public class RelatedInfoStep extends ResettableContainer {
attachmentToFirstLink.setVisible(state, true);
}
});
final BoxPanel panel = new BoxPanel(BoxPanel.VERTICAL);
panel.add(addListLink);
panel.add(listToFirstLink);
panel.add(listTable);
panel.add(listForm);
panel.add(attachAssetLink);
panel.add(attachmentToFirstLink);
panel.add(attachmentsTable);
panel.add(attachAssetForm);
super.add(panel);
}
@Override

View File

@ -20,7 +20,6 @@ package com.arsdigita.cms.ui.authoring.assets.relatedinfo;
import com.arsdigita.kernel.KernelConfig;
import org.apache.commons.fileupload.MultipartStream;
import org.libreccm.configuration.ConfigurationManager;
import org.librecms.assets.RelatedLink;
import org.librecms.contentsection.AttachmentList;
@ -284,7 +283,7 @@ class RelatedInfoStepController {
protected void createInternalLink(final AttachmentList attachmentList,
final long targetItemId,
final String title,
// final String description,
// final String description,
final String selectedLanguage) {
final ContentItem targetItem = itemRepo
@ -297,7 +296,6 @@ class RelatedInfoStepController {
final Locale selectedLocale = new Locale(selectedLanguage);
link.getTitle().addValue(selectedLocale, title);
itemAttachmentManager.attachAsset(link, attachmentList);
}
@ -319,15 +317,15 @@ class RelatedInfoStepController {
}
if (attachmentList.getDescription().hasValue(selectedLocale)) {
row.setTitle(shortenDescription(attachmentList
row.setDescription(shortenDescription(attachmentList
.getDescription()
.getValue(selectedLocale)));
} else if (attachmentList.getDescription().hasValue(defaultLocale)) {
row.setTitle(shortenDescription(attachmentList
row.setDescription(shortenDescription(attachmentList
.getDescription()
.getValue(defaultLocale)));
} else {
row.setTitle(shortenDescription(attachmentList
row.setDescription(shortenDescription(attachmentList
.getDescription()
.getValue()));
}
@ -366,7 +364,9 @@ class RelatedInfoStepController {
private String shortenDescription(final String description) {
if (description.trim().length() < 140) {
if (description == null) {
return "";
} else if (description.trim().length() < 140) {
return description.trim();
} else {
final String tmp = description.trim().substring(0, 140);

View File

@ -420,3 +420,22 @@ cms.ui.assetlist.add_locale=Add data for language
cms.ui.assetlist.name=Name
cms.ui.assetlist.title=Title
cms.ui.assetlist.description=Description
cms.ui.authoring.assets.related_info_step.add_list=Add list
cms.ui.authoring.assets.related_info_step.attachment_list.move_to_beginning=Move to first position
cms.ui.authoring.assets.related_info_step.attach_asset=Add related information
cms.ui.authoring.assets.related_info_step.attachment.move_to_first=Move to first position
cms.ui.authoring.assets.related_info_step.list.name=Name of list
cms.ui.authoring.assets.related_info_step.list.title=Title of list
cms.ui.authoring.assets.related_info_step.list.description=Description
cms.ui.authoring.assets.related_info_step.list.edit=Edit
cms.ui.authoring.assets.related_info_step.list.move=Move
cms.ui.authoring.assets.related_info_step.list.delete=Delete
cms.ui.authoring.assets.related_info_step.attachment.title=Attachment title
cms.ui.authoring.assets.related_info_step.attachment.type=Type
cms.ui.authoring.assets.related_info_step.attachment.move=Move
cms.ui.authoring.assets.related_info_step.attachment.remove=Remove
cms.ui.authoring.assets.related_info_step.attachment.none=No related information in this list yet
cms.ui.authoring.assets.related_info_step.attachment.move_here=Move here
cms.ui.authoring.assets.related_info_step.list.move_here=Move here
cms.ui.authoring.assets.related_info_step.list.none=No related informations yet
cms.ui.authoring.assets.related_info_step.list.edit\ \t=Edit

View File

@ -417,3 +417,22 @@ cms.ui.assetlist.add_locale=Daten f\u00fcr folgende Sprache hinzuf\u00fcgen
cms.ui.assetlist.name=Name
cms.ui.assetlist.title=Titel
cms.ui.assetlist.description=Beschreibung
cms.ui.authoring.assets.related_info_step.add_list=Liste hinzuf\u00fcgen
cms.ui.authoring.assets.related_info_step.attachment_list.move_to_beginning=An die erste Position verschieben
cms.ui.authoring.assets.related_info_step.attach_asset=Weiterf\u00fchrende Informationen hinzuf\u00fcgen
cms.ui.authoring.assets.related_info_step.attachment.move_to_first=An die erste Position verschieben
cms.ui.authoring.assets.related_info_step.list.name=Name der Liste
cms.ui.authoring.assets.related_info_step.list.title=Titel der Liste
cms.ui.authoring.assets.related_info_step.list.description=Beschreibung
cms.ui.authoring.assets.related_info_step.list.edit=Bearbeiten
cms.ui.authoring.assets.related_info_step.list.move=Verschieben
cms.ui.authoring.assets.related_info_step.list.delete=L\u00f6schen
cms.ui.authoring.assets.related_info_step.attachment.title=Titel
cms.ui.authoring.assets.related_info_step.attachment.type=Typ
cms.ui.authoring.assets.related_info_step.attachment.move=Verschieben
cms.ui.authoring.assets.related_info_step.attachment.remove=Entfernen
cms.ui.authoring.assets.related_info_step.attachment.none=Diese Liste enth\u00e4lt noch keine weiterf\u00fchrenden Informationen
cms.ui.authoring.assets.related_info_step.attachment.move_here=Hierher verschieben
cms.ui.authoring.assets.related_info_step.list.move_here=Hierher verschieben
cms.ui.authoring.assets.related_info_step.list.none=Es wurden noch keine weiterf\u00fchrenden Informationen hinzugef\u00fcgt
cms.ui.authoring.assets.related_info_step.list.edit\ \t=Bearbeiten

View File

@ -376,3 +376,22 @@ cms.ui.assetlist.add_locale=Add data for language
cms.ui.assetlist.name=Name
cms.ui.assetlist.title=Title
cms.ui.assetlist.description=Description
cms.ui.authoring.assets.related_info_step.add_list=Add list
cms.ui.authoring.assets.related_info_step.attachment_list.move_to_beginning=Move to first position
cms.ui.authoring.assets.related_info_step.attach_asset=Add related information
cms.ui.authoring.assets.related_info_step.attachment.move_to_first=Move to first position
cms.ui.authoring.assets.related_info_step.list.name=Name of list
cms.ui.authoring.assets.related_info_step.list.title=Title of list
cms.ui.authoring.assets.related_info_step.list.description=Description
cms.ui.authoring.assets.related_info_step.list.edit=Edit
cms.ui.authoring.assets.related_info_step.list.move=Move
cms.ui.authoring.assets.related_info_step.list.delete=Delete
cms.ui.authoring.assets.related_info_step.attachment.title=Attachment title
cms.ui.authoring.assets.related_info_step.attachment.type=Type
cms.ui.authoring.assets.related_info_step.attachment.move=Move
cms.ui.authoring.assets.related_info_step.attachment.remove=Remove
cms.ui.authoring.assets.related_info_step.attachment.none=No related information in this list yet
cms.ui.authoring.assets.related_info_step.attachment.move_here=Move here
cms.ui.authoring.assets.related_info_step.list.move_here=Move here
cms.ui.authoring.assets.related_info_step.list.none=No related informations yet
cms.ui.authoring.assets.related_info_step.list.edit\ \t=Edit

View File

@ -84,7 +84,7 @@ public class Document {
// Explicitly create elements & attributes to avoid namespace
// problems
private final static String identityXSL =
"<xsl:stylesheet version=\"2 .0\""
"<xsl:stylesheet version=\"2.0\""
+ " xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\">\n"
+ "<xsl:output method=\"xml\"/>\n"
+ "<xsl:template match=\"text()|comment()|processing-instruction()\">\n"