diff --git a/ccm-cms/src/main/java/com/arsdigita/cms/ui/assets/AssetForm.java b/ccm-cms/src/main/java/com/arsdigita/cms/ui/assets/AssetForm.java
index f4f91ca21..3f1988266 100644
--- a/ccm-cms/src/main/java/com/arsdigita/cms/ui/assets/AssetForm.java
+++ b/ccm-cms/src/main/java/com/arsdigita/cms/ui/assets/AssetForm.java
@@ -18,21 +18,153 @@
*/
package com.arsdigita.cms.ui.assets;
-import com.arsdigita.bebop.Container;
+import com.arsdigita.bebop.ColumnPanel;
import com.arsdigita.bebop.Form;
+import com.arsdigita.bebop.FormProcessException;
+import com.arsdigita.bebop.Label;
+import com.arsdigita.bebop.PageState;
+import com.arsdigita.bebop.SaveCancelSection;
+import com.arsdigita.bebop.SingleSelectionModel;
+import com.arsdigita.bebop.event.FormInitListener;
+import com.arsdigita.bebop.event.FormProcessListener;
+import com.arsdigita.bebop.event.FormSectionEvent;
+import com.arsdigita.bebop.event.FormSubmissionListener;
+import com.arsdigita.bebop.form.TextField;
+import com.arsdigita.globalization.GlobalizedMessage;
+import com.arsdigita.kernel.KernelConfig;
+
+import org.libreccm.cdi.utils.CdiUtil;
+import org.librecms.CmsConstants;
+import org.librecms.contentsection.Asset;
+import org.librecms.contentsection.AssetRepository;
+
+import java.util.Optional;
/**
*
* @author Jens Pelzetter
*/
-public class AssetForm extends Form {
-
- public AssetForm(final String name) {
- super(name);
+public abstract class AssetForm extends Form implements FormInitListener,
+ FormProcessListener,
+ FormSubmissionListener {
+
+ private static final String ASSET_TITLE = "asset-title";
+
+ private final AssetPane assetPane;
+ private final SingleSelectionModel selectionModel;
+
+ private TextField title;
+ private SaveCancelSection saveCancelSection;
+
+ public AssetForm(final AssetPane assetPane) {
+ super("asset-form", new ColumnPanel(2));
+
+ this.assetPane = assetPane;
+ selectionModel = assetPane.getSelectedAssetModel();
+
+ initComponents();
}
-
- public AssetForm(final String name, final Container container) {
- super(name, container);
+
+ private void initComponents() {
+ add(new Label(new GlobalizedMessage("cms.ui.asset.title",
+ CmsConstants.CMS_BUNDLE)));
+ title = new TextField(ASSET_TITLE);
+ add(title);
+
+ addWidgets();
+
+ saveCancelSection = new SaveCancelSection();
+ add(saveCancelSection);
}
-
+
+ protected void addWidgets() {
+ //Nothing here
+ }
+
+ protected String getTitle(final PageState state) {
+ return (String) title.getValue(state);
+ }
+
+ protected Optional getSelectedAsset(final PageState state) {
+
+ if (selectionModel.getSelectedKey(state) == null) {
+ return Optional.empty();
+ } else {
+ final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
+ final AssetRepository assetRepo = cdiUtil.findBean(
+ AssetRepository.class);
+ final Asset asset = assetRepo
+ .findById(selectionModel.getSelectedKey(state))
+ .orElseThrow(() -> new IllegalArgumentException(String.format(
+ "No asset with ID %d in the database.",
+ selectionModel.getSelectedKey(state))));
+ return Optional.of(asset);
+ }
+ }
+
+ @Override
+ public void init(final FormSectionEvent event) throws FormProcessException {
+
+ final PageState state = event.getPageState();
+
+ final Optional selectedAsset = getSelectedAsset(state);
+
+ if (selectedAsset.isPresent()) {
+ title.setValue(state,
+ selectedAsset
+ .get()
+ .getTitle()
+ .getValue(KernelConfig
+ .getConfig()
+ .getDefaultLocale()));
+ }
+
+ }
+
+ @Override
+ public void process(final FormSectionEvent event)
+ throws FormProcessException {
+
+ final PageState state = event.getPageState();
+
+ if (saveCancelSection.getSaveButton().isSelected(state)) {
+ final Optional selectedAsset = getSelectedAsset(state);
+ final Asset asset;
+ if (selectedAsset.isPresent()) {
+ asset = selectedAsset.get();
+ updateAsset(asset, state);
+ } else {
+ asset = createAsset(state);
+ }
+
+ asset.getTitle().addValue(
+ KernelConfig.getConfig().getDefaultLocale(),
+ (String) title.getValue(state));
+
+ final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
+ final AssetRepository assetRepo = cdiUtil
+ .findBean(AssetRepository.class);
+ assetRepo.save(asset);
+ }
+ }
+
+ protected abstract Asset createAsset(final PageState state)
+ throws FormProcessException;
+
+ protected abstract void updateAsset(final Asset asset,
+ final PageState state)
+ throws FormProcessException;
+
+ @Override
+ public void submitted(final FormSectionEvent event)
+ throws FormProcessException {
+
+ final PageState state = event.getPageState();
+
+ if (saveCancelSection.getCancelButton().isSelected(state)) {
+ selectionModel.clearSelection(state);
+ assetPane.browseMode(state);
+ }
+ }
+
}
diff --git a/ccm-cms/src/main/java/com/arsdigita/cms/ui/assets/AssetFormController.java b/ccm-cms/src/main/java/com/arsdigita/cms/ui/assets/AssetFormController.java
new file mode 100644
index 000000000..268258d11
--- /dev/null
+++ b/ccm-cms/src/main/java/com/arsdigita/cms/ui/assets/AssetFormController.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2017 LibreCCM Foundation.
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+package com.arsdigita.cms.ui.assets;
+
+import javax.enterprise.context.RequestScoped;
+
+/**
+ *
+ * @author Jens Pelzetter
+ */
+@RequestScoped
+public class AssetFormController {
+
+
+
+}
diff --git a/ccm-cms/src/main/java/com/arsdigita/cms/ui/assets/AssetPane.java b/ccm-cms/src/main/java/com/arsdigita/cms/ui/assets/AssetPane.java
index 8698967a4..748e68727 100644
--- a/ccm-cms/src/main/java/com/arsdigita/cms/ui/assets/AssetPane.java
+++ b/ccm-cms/src/main/java/com/arsdigita/cms/ui/assets/AssetPane.java
@@ -29,6 +29,7 @@ import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.Page;
import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.Paginator;
+import com.arsdigita.bebop.ParameterSingleSelectionModel;
import com.arsdigita.bebop.RequestLocal;
import com.arsdigita.bebop.Resettable;
import com.arsdigita.bebop.SaveCancelSection;
@@ -52,6 +53,7 @@ import com.arsdigita.bebop.form.Option;
import com.arsdigita.bebop.form.SingleSelect;
import com.arsdigita.bebop.form.Submit;
import com.arsdigita.bebop.parameters.ArrayParameter;
+import com.arsdigita.bebop.parameters.LongParameter;
import com.arsdigita.bebop.parameters.StringParameter;
import com.arsdigita.bebop.table.TableCellRenderer;
import com.arsdigita.bebop.table.TableColumn;
@@ -83,6 +85,8 @@ import org.libreccm.categorization.CategoryManager;
import org.libreccm.core.CcmObject;
import org.libreccm.core.UnexpectedErrorException;
import org.libreccm.security.PermissionChecker;
+import org.librecms.assets.AssetTypeInfo;
+import org.librecms.assets.AssetTypesManager;
import org.librecms.contentsection.Asset;
import org.librecms.contentsection.AssetManager;
import org.librecms.contentsection.AssetRepository;
@@ -92,6 +96,8 @@ import org.librecms.contentsection.privileges.ItemPrivileges;
import java.util.Arrays;
import java.util.Objects;
+import java.util.ResourceBundle;
+import java.util.TooManyListenersException;
import static org.librecms.CmsConstants.*;
@@ -113,10 +119,11 @@ public class AssetPane extends LayoutPanel implements Resettable {
private final SingleSelectionModel selectionModel;
private final FolderSelectionModel folderSelectionModel;
private final FolderRequestLocal folderRequestLocal;
+ private final SingleSelectionModel selectedAssetModel;
private final ArrayParameter sourcesParameter = new ArrayParameter(
- new StringParameter(SOURCES_PARAM));
+ new StringParameter(SOURCES_PARAM));
private final StringParameter actionParameter = new StringParameter(
- ACTION_PARAM);
+ ACTION_PARAM);
private AssetFolderBrowser folderBrowser;
private Form browserForm;
@@ -129,6 +136,7 @@ public class AssetPane extends LayoutPanel implements Resettable {
private SegmentedPanel.Segment actionsSegment;
private SegmentedPanel.Segment newFolderSegment;
private SegmentedPanel.Segment editFolderSegment;
+ private SegmentedPanel.Segment editAssetSegement;
@SuppressWarnings("unchecked")
public AssetPane() {
@@ -137,8 +145,8 @@ public class AssetPane extends LayoutPanel implements Resettable {
@Override
protected Folder getRootFolder(final PageState state) {
final ContentSection section = CMS
- .getContext()
- .getContentSection();
+ .getContext()
+ .getContentSection();
return section.getRootAssetsFolder();
}
@@ -149,20 +157,23 @@ public class AssetPane extends LayoutPanel implements Resettable {
@Override
protected Long getRootFolderID(final PageState state) {
final ContentSection section = CMS
- .getContext()
- .getContentSection();
+ .getContext()
+ .getContentSection();
return section.getRootAssetsFolder().getObjectId();
}
};
folderRequestLocal = new FolderRequestLocal(folderSelectionModel);
+ selectedAssetModel = new ParameterSingleSelectionModel<>(
+ new LongParameter("selected-asset"));
+
final SegmentedPanel left = new SegmentedPanel();
setLeft(left);
final Label heading = new Label(
- new GlobalizedMessage("cms.ui.folder_browser",
- CmsConstants.CMS_BUNDLE));
+ new GlobalizedMessage("cms.ui.folder_browser",
+ CmsConstants.CMS_BUNDLE));
left.addSegment(heading, tree);
// final Text placeholder = new Text("Placeholder");
@@ -180,15 +191,15 @@ public class AssetPane extends LayoutPanel implements Resettable {
browserForm.setMethod(Form.GET);
folderBrowser = new AssetFolderBrowser(folderSelectionModel);
final Paginator paginator = new Paginator(
- new AssetFolderBrowserPaginationModelBuilder(folderBrowser),
- CMSConfig.getConfig().getFolderBrowseListSize());
+ new AssetFolderBrowserPaginationModelBuilder(folderBrowser),
+ CMSConfig.getConfig().getFolderBrowseListSize());
folderBrowser.setPaginator(paginator);
final CheckboxGroup checkboxGroup = new CheckboxGroup(sourcesParameter);
browserForm.add(checkboxGroup);
final TableColumn checkboxCol = new TableColumn();
checkboxCol.setHeaderValue(
- new GlobalizedMessage("empty_text", CmsConstants.CMS_BUNDLE));
+ new GlobalizedMessage("empty_text", CmsConstants.CMS_BUNDLE));
checkboxCol.setCellRenderer(new TableCellRenderer() {
@Override
@@ -213,31 +224,31 @@ public class AssetPane extends LayoutPanel implements Resettable {
browserForm.add(folderBrowser);
final SimpleContainer actionFormContainer = new SimpleContainer();
actionFormContainer.add(new Label(
- new GlobalizedMessage(
- "cms.ui.folder.edit_selection",
- CmsConstants.CMS_FOLDER_BUNDLE)));
+ new GlobalizedMessage(
+ "cms.ui.folder.edit_selection",
+ CmsConstants.CMS_FOLDER_BUNDLE)));
actionSelect = new SingleSelect(actionParameter);
actionSelect.addOption(
- new Option(COPY,
- new Label(new GlobalizedMessage(
- "cms.ui.folder.copy.action",
- CmsConstants.CMS_FOLDER_BUNDLE))));
+ new Option(COPY,
+ new Label(new GlobalizedMessage(
+ "cms.ui.folder.copy.action",
+ CmsConstants.CMS_FOLDER_BUNDLE))));
actionSelect.addOption(
- new Option(MOVE,
- new Label(new GlobalizedMessage(
- "cms.ui.folder.move.action",
- CmsConstants.CMS_FOLDER_BUNDLE))));
+ new Option(MOVE,
+ new Label(new GlobalizedMessage(
+ "cms.ui.folder.move.action",
+ CmsConstants.CMS_FOLDER_BUNDLE))));
actionFormContainer.add(actionSelect);
actionSubmit = new Submit(
- "Go",
- new GlobalizedMessage("cms.ui.folder.go",
- CmsConstants.CMS_FOLDER_BUNDLE));
+ "Go",
+ new GlobalizedMessage("cms.ui.folder.go",
+ CmsConstants.CMS_FOLDER_BUNDLE));
actionFormContainer.add(actionSubmit);
browserForm.addProcessListener(new FormProcessListener() {
@Override
public void process(final FormSectionEvent event)
- throws FormProcessException {
+ throws FormProcessException {
final PageState state = event.getPageState();
@@ -253,7 +264,7 @@ public class AssetPane extends LayoutPanel implements Resettable {
@Override
public void process(final FormSectionEvent event)
- throws FormProcessException {
+ throws FormProcessException {
final PageState state = event.getPageState();
@@ -274,12 +285,12 @@ public class AssetPane extends LayoutPanel implements Resettable {
});
targetSelector.addValidationListener(
- new TargetSelectorValidationListener());
+ new TargetSelectorValidationListener());
targetSelector.addSubmissionListener(new FormSubmissionListener() {
@Override
public void submitted(final FormSectionEvent event)
- throws FormProcessException {
+ throws FormProcessException {
final PageState state = event.getPageState();
@@ -287,8 +298,8 @@ public class AssetPane extends LayoutPanel implements Resettable {
reset(state);
browseMode(state);
throw new FormProcessException(new GlobalizedMessage(
- "cms.ui.folder.cancelled",
- CmsConstants.CMS_FOLDER_BUNDLE));
+ "cms.ui.folder.cancelled",
+ CmsConstants.CMS_FOLDER_BUNDLE));
}
}
@@ -310,13 +321,13 @@ public class AssetPane extends LayoutPanel implements Resettable {
final Label target = (Label) event.getTarget();
final long selectedId = Long.parseLong(selectionModel
- .getSelectedKey(state).toString());
+ .getSelectedKey(state).toString());
final long currentFolderId = folderSelectionModel
- .getSelectedObject(state).getObjectId();
+ .getSelectedObject(state).getObjectId();
target.setLabel(String.format(
- "selectedId = %d; currentFolderId = %d",
- selectedId,
- currentFolderId));
+ "selectedId = %d; currentFolderId = %d",
+ selectedId,
+ currentFolderId));
}
});
@@ -329,19 +340,19 @@ public class AssetPane extends LayoutPanel implements Resettable {
actionsSegment.add(actions);
final FolderCreateForm folderCreateForm = new FolderCreateForm(
- "fcreat", folderSelectionModel);
+ "fcreat", folderSelectionModel);
folderCreateForm.addSubmissionListener(new FormSubmissionListener() {
@Override
public void submitted(final FormSectionEvent event)
- throws FormProcessException {
+ throws FormProcessException {
final PageState state = event.getPageState();
if (event.getSource() == folderCreateForm
- && folderCreateForm.isCancelled(state)) {
+ && folderCreateForm.isCancelled(state)) {
browseMode(state);
throw new FormProcessException(new GlobalizedMessage(
- "cms.ui.cancelled", CmsConstants.CMS_BUNDLE));
+ "cms.ui.cancelled", CmsConstants.CMS_BUNDLE));
}
}
@@ -351,7 +362,7 @@ public class AssetPane extends LayoutPanel implements Resettable {
@Override
public void process(final FormSectionEvent event)
- throws FormProcessException {
+ throws FormProcessException {
final PageState state = event.getPageState();
final Object source = event.getSource();
@@ -362,24 +373,24 @@ public class AssetPane extends LayoutPanel implements Resettable {
});
newFolderSegment = panel.addSegment(
- new Label(new GlobalizedMessage("cms.ui.new_folder",
- CmsConstants.CMS_BUNDLE)),
- folderCreateForm);
+ new Label(new GlobalizedMessage("cms.ui.new_folder",
+ CmsConstants.CMS_BUNDLE)),
+ folderCreateForm);
final FolderEditorForm folderEditorForm = new FolderEditorForm(
- "fedit", folderSelectionModel);
+ "fedit", folderSelectionModel);
folderEditorForm.addSubmissionListener(new FormSubmissionListener() {
@Override
public void submitted(final FormSectionEvent event)
- throws FormProcessException {
+ throws FormProcessException {
final PageState state = event.getPageState();
if (event.getSource() == folderEditorForm
- && folderEditorForm.isCancelled(state)) {
+ && folderEditorForm.isCancelled(state)) {
browseMode(state);
throw new FormProcessException(new GlobalizedMessage(
- "cms.ui.cancelled", CmsConstants.CMS_BUNDLE));
+ "cms.ui.cancelled", CmsConstants.CMS_BUNDLE));
}
}
@@ -388,7 +399,7 @@ public class AssetPane extends LayoutPanel implements Resettable {
@Override
public void process(final FormSectionEvent event)
- throws FormProcessException {
+ throws FormProcessException {
final PageState state = event.getPageState();
final Object source = event.getSource();
@@ -399,13 +410,13 @@ public class AssetPane extends LayoutPanel implements Resettable {
});
editFolderSegment = panel.addSegment(
- new Label(new GlobalizedMessage("cms.ui.edit_folder",
- CmsConstants.CMS_BUNDLE)),
- folderEditorForm);
+ new Label(new GlobalizedMessage("cms.ui.edit_folder",
+ CmsConstants.CMS_BUNDLE)),
+ folderEditorForm);
final ActionLink createFolderAction = new ActionLink(
- new Label(new GlobalizedMessage("cms.ui.new_folder",
- CmsConstants.CMS_BUNDLE)));
+ new Label(new GlobalizedMessage("cms.ui.new_folder",
+ CmsConstants.CMS_BUNDLE)));
createFolderAction.addActionListener(new ActionListener() {
@Override
@@ -421,8 +432,8 @@ public class AssetPane extends LayoutPanel implements Resettable {
actions.addAction(createFolderAction);
final ActionLink editFolderAction = new ActionLink(
- new Label(new GlobalizedMessage("cms.ui.edit_folder",
- CmsConstants.CMS_BUNDLE)));
+ new Label(new GlobalizedMessage("cms.ui.edit_folder",
+ CmsConstants.CMS_BUNDLE)));
editFolderAction.addActionListener(new ActionListener() {
@Override
@@ -437,6 +448,54 @@ public class AssetPane extends LayoutPanel implements Resettable {
});
actions.addAction(editFolderAction);
+ final Form newAssetForm = new Form("new-asset-form",
+ new BoxPanel(BoxPanel.HORIZONTAL));
+ newAssetForm.add(new Label(new GlobalizedMessage(
+ "cms.ui.assets.new", CmsConstants.CMS_BUNDLE)));
+ final SingleSelect newAssetTypeSelect = new SingleSelect(
+ "new-asset-type-select");
+ try {
+ newAssetTypeSelect.addPrintListener(new PrintListener() {
+
+ @Override
+ public void prepare(final PrintEvent event) {
+ final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
+ final AssetTypesManager typesManager = cdiUtil
+ .findBean(AssetTypesManager.class);
+ final SingleSelect target = (SingleSelect) event.getTarget();
+ for (final AssetTypeInfo type : typesManager
+ .getAvailableAssetTypes()) {
+ final String labelKey = type.getLabelKey();
+ final String labelBundle = type.getLabelBundle();
+ final ResourceBundle bundle = ResourceBundle
+ .getBundle(labelBundle);
+ final String label = bundle.getString(labelKey);
+ target.addOption(new Option(
+ type.getAssetClass().getName(),
+ new Text(label)));
+ }
+ }
+
+ });
+ } catch (TooManyListenersException ex) {
+ throw new UnexpectedErrorException(ex);
+ }
+ newAssetForm.add(newAssetTypeSelect);
+ newAssetForm.add(new Submit(new GlobalizedMessage(
+ "cms.ui.assets.new.create", CmsConstants.CMS_BUNDLE)));
+ newAssetForm.addProcessListener(new FormProcessListener() {
+
+ @Override
+ public void process(final FormSectionEvent event)
+ throws FormProcessException {
+
+ //Nothing yet
+ }
+
+ });
+
+ actionsSegment.add(newAssetForm);
+
return panel;
}
@@ -518,6 +577,10 @@ public class AssetPane extends LayoutPanel implements Resettable {
}
+ protected SingleSelectionModel getSelectedAssetModel() {
+ return selectedAssetModel;
+ }
+
private String[] getSources(final PageState state) {
final String[] result = (String[]) state.getValue(sourcesParameter);
@@ -545,7 +608,7 @@ public class AssetPane extends LayoutPanel implements Resettable {
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
final AssetFolderBrowserController controller = cdiUtil.findBean(
- AssetFolderBrowserController.class);
+ AssetFolderBrowserController.class);
controller.moveObjects(target, objectIds);
}
@@ -554,7 +617,7 @@ public class AssetPane extends LayoutPanel implements Resettable {
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
final AssetFolderBrowserController controller = cdiUtil.findBean(
- AssetFolderBrowserController.class);
+ AssetFolderBrowserController.class);
controller.copyObjects(target, objectIds);
}
@@ -569,14 +632,14 @@ public class AssetPane extends LayoutPanel implements Resettable {
if (!selectionModel.isSelected(state)) {
final String folder = state
- .getRequest()
- .getParameter(SET_FOLDER);
+ .getRequest()
+ .getParameter(SET_FOLDER);
if (folder == null) {
final Category root = CMS
- .getContext()
- .getContentSection()
- .getRootAssetsFolder();
+ .getContext()
+ .getContentSection()
+ .getRootAssetsFolder();
final Long folderId = root.getObjectId();
selectionModel.setSelectedKey(state, folderId);
@@ -596,18 +659,18 @@ public class AssetPane extends LayoutPanel implements Resettable {
final PageState state = event.getPageState();
final Category root = CMS
- .getContext()
- .getContentSection()
- .getRootAssetsFolder();
+ .getContext()
+ .getContentSection()
+ .getRootAssetsFolder();
if (!root.equals(folderRequestLocal.getFolder(state))) {
// Expand the ancestor nodes of the currently
// selected node.
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
final FolderTreeModelController controller = cdiUtil.findBean(
- FolderTreeModelController.class);
+ FolderTreeModelController.class);
final List ancestorIds = controller.findAncestorIds(
- folderRequestLocal.getFolder(state));
+ folderRequestLocal.getFolder(state));
ancestorIds.forEach(id -> tree.expand(id.toString(), state));
}
@@ -629,8 +692,8 @@ public class AssetPane extends LayoutPanel implements Resettable {
@Override
protected Long getRootFolderID(final PageState state) {
final ContentSection section = CMS
- .getContext()
- .getContentSection();
+ .getContext()
+ .getContentSection();
return section.getRootAssetsFolder().getObjectId();
}
@@ -648,37 +711,37 @@ public class AssetPane extends LayoutPanel implements Resettable {
final Label label = (Label) event.getTarget();
final int numberOfItems = getSources(state).length;
final Category folder = (Category) folderSelectionModel
- .getSelectedObject(state);
+ .getSelectedObject(state);
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
final CategoryManager categoryManager = cdiUtil
- .findBean(CategoryManager.class);
+ .findBean(CategoryManager.class);
final String targetFolderPath;
if (targetFolderModel.getSelectedObject(state) == null) {
targetFolderPath = "";
} else {
targetFolderPath = categoryManager.getCategoryPath(
- targetFolderModel.getSelectedObject(state));
+ targetFolderModel.getSelectedObject(state));
}
if (isMove(state)) {
label.setLabel(new GlobalizedMessage(
- "cms.ui.folder.move",
- CmsConstants.CMS_FOLDER_BUNDLE,
- new Object[]{
- numberOfItems,
- categoryManager.getCategoryPath(folder),
- targetFolderPath
- }));
+ "cms.ui.folder.move",
+ CmsConstants.CMS_FOLDER_BUNDLE,
+ new Object[]{
+ numberOfItems,
+ categoryManager.getCategoryPath(folder),
+ targetFolderPath
+ }));
} else if (isCopy(state)) {
label.setLabel(new GlobalizedMessage(
- "cms.ui.folder.copy",
- CMS_BUNDLE,
- new Object[]{
- numberOfItems,
- categoryManager.getCategoryPath(folder),
- targetFolderPath
- }));
+ "cms.ui.folder.copy",
+ CMS_BUNDLE,
+ new Object[]{
+ numberOfItems,
+ categoryManager.getCategoryPath(folder),
+ targetFolderPath
+ }));
}
}
@@ -707,18 +770,18 @@ public class AssetPane extends LayoutPanel implements Resettable {
if (folder != null) {
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
final FolderManager folderManager = cdiUtil.findBean(
- FolderManager.class);
+ FolderManager.class);
if (!folderManager.getParentFolder(folder).isPresent()) {
folderTree.expand(Long.toString(folder.getObjectId()),
state);
} else {
final List parents = folderManager
- .getParentFolders(folder);
+ .getParentFolders(folder);
parents
- .stream()
- .map(parent -> Long.toString(parent.getObjectId()))
- .forEach(folderId -> folderTree.expand(folderId,
- state));
+ .stream()
+ .map(parent -> Long.toString(parent.getObjectId()))
+ .forEach(folderId -> folderTree.expand(folderId,
+ state));
}
}
}
@@ -743,7 +806,7 @@ public class AssetPane extends LayoutPanel implements Resettable {
private class FolderTreeCellRenderer implements TreeCellRenderer {
private final RequestLocal invalidFoldersRequestLocal
- = new RequestLocal();
+ = new RequestLocal();
/**
* Render the folders appropriately. The selected folder is a bold
@@ -767,18 +830,18 @@ public class AssetPane extends LayoutPanel implements Resettable {
if (invalidFoldersRequestLocal.get(state) == null) {
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
final AssetFolderBrowserController controller = cdiUtil
- .findBean(AssetFolderBrowserController.class);
+ .findBean(AssetFolderBrowserController.class);
invalidFolders = controller.createInvalidTargetsList(
- Arrays.asList(getSources(state)));
+ Arrays.asList(getSources(state)));
invalidFoldersRequestLocal.set(state, invalidFolders);
} else {
invalidFolders = (List) invalidFoldersRequestLocal
- .get(state);
+ .get(state);
}
final Label label = new Label(value.toString());
if (invalidFolders.contains(String.format(
- FOLDER_BROWSER_KEY_PREFIX_FOLDER + "%s", key))) {
+ FOLDER_BROWSER_KEY_PREFIX_FOLDER + "%s", key))) {
return label;
}
@@ -794,11 +857,11 @@ public class AssetPane extends LayoutPanel implements Resettable {
}
private class TargetSelectorValidationListener
- implements FormValidationListener {
+ implements FormValidationListener {
@Override
public void validate(final FormSectionEvent event)
- throws FormProcessException {
+ throws FormProcessException {
final PageState state = event.getPageState();
@@ -810,24 +873,24 @@ public class AssetPane extends LayoutPanel implements Resettable {
final FormData data = event.getFormData();
if (target == null) {
data.addError(new GlobalizedMessage(
- "cms.ui.folder.need_select_target_folder",
- CmsConstants.CMS_FOLDER_BUNDLE));
+ "cms.ui.folder.need_select_target_folder",
+ CmsConstants.CMS_FOLDER_BUNDLE));
//If the target is null, we can skip the rest of the checks
return;
}
if (target.equals(folderSelectionModel.getSelectedObject(state))) {
data.addError(new GlobalizedMessage(
- "cms.ui.folder.not_within_same_folder",
- CmsConstants.CMS_FOLDER_BUNDLE));
+ "cms.ui.folder.not_within_same_folder",
+ CmsConstants.CMS_FOLDER_BUNDLE));
}
// check create item permission
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
final PermissionChecker permissionChecker = cdiUtil.findBean(
- PermissionChecker.class);
+ PermissionChecker.class);
if (!permissionChecker.isPermitted(
- ItemPrivileges.CREATE_NEW, target)) {
+ ItemPrivileges.CREATE_NEW, target)) {
data.addError("cms.ui.folder.no_permission_for_item",
CmsConstants.CMS_FOLDER_BUNDLE);
}
@@ -848,34 +911,34 @@ public class AssetPane extends LayoutPanel implements Resettable {
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
final FolderRepository folderRepo = cdiUtil
- .findBean(FolderRepository.class);
+ .findBean(FolderRepository.class);
final AssetRepository assetRepo = cdiUtil
- .findBean(AssetRepository.class);
+ .findBean(AssetRepository.class);
final AssetManager assetManager = cdiUtil
- .findBean(AssetManager.class);
+ .findBean(AssetManager.class);
final AssetFolderBrowserController controller = cdiUtil
- .findBean(AssetFolderBrowserController.class);
+ .findBean(AssetFolderBrowserController.class);
final FolderManager folderManager = cdiUtil
- .findBean(FolderManager.class);
+ .findBean(FolderManager.class);
final PermissionChecker permissionChecker = cdiUtil.findBean(
- PermissionChecker.class);
+ PermissionChecker.class);
final CcmObject object;
final String name;
if (objectId.startsWith(FOLDER_BROWSER_KEY_PREFIX_FOLDER)) {
final long folderId = Long.parseLong(objectId.substring(
- FOLDER_BROWSER_KEY_PREFIX_FOLDER.length()));
+ FOLDER_BROWSER_KEY_PREFIX_FOLDER.length()));
final Folder folder = folderRepo.findById(folderId).orElseThrow(
- () -> new IllegalArgumentException(String.format(
- "No folder with id %d in database.", folderId)));
+ () -> new IllegalArgumentException(String.format(
+ "No folder with id %d in database.", folderId)));
name = folder.getName();
//Check if folder or subfolder contains in use assets
if (isMove(state)) {
final FolderManager.FolderIsMovable movable = folderManager
- .folderIsMovable(folder, target);
+ .folderIsMovable(folder, target);
switch (movable) {
case DIFFERENT_SECTIONS:
addErrorMessage(data,
@@ -907,23 +970,23 @@ public class AssetPane extends LayoutPanel implements Resettable {
break;
default:
throw new UnexpectedErrorException(String.format(
- "Unknown state '%s' for '%s'.",
- movable,
- FolderManager.FolderIsMovable.class.
- getName()));
+ "Unknown state '%s' for '%s'.",
+ movable,
+ FolderManager.FolderIsMovable.class.
+ getName()));
}
}
object = folder;
} else if (objectId.startsWith(FOLDER_BROWSER_KEY_PREFIX_ASSET)) {
final long assetId = Long.parseLong(objectId.substring(
- FOLDER_BROWSER_KEY_PREFIX_ASSET.length()));
+ FOLDER_BROWSER_KEY_PREFIX_ASSET.length()));
final Asset asset = assetRepo
- .findById(assetId)
- .orElseThrow(() -> new IllegalArgumentException(
- String.format(
- "No asset with id %d in the database.",
- assetId)));
+ .findById(assetId)
+ .orElseThrow(() -> new IllegalArgumentException(
+ String.format(
+ "No asset with id %d in the database.",
+ assetId)));
name = asset.getDisplayName();
@@ -934,11 +997,11 @@ public class AssetPane extends LayoutPanel implements Resettable {
object = asset;
} else {
throw new IllegalArgumentException(String.format(
- "Provided objectId '%s' does not start with '%s' "
- + "or '%s'.",
- objectId,
- FOLDER_BROWSER_KEY_PREFIX_FOLDER,
- FOLDER_BROWSER_KEY_PREFIX_ASSET));
+ "Provided objectId '%s' does not start with '%s' "
+ + "or '%s'.",
+ objectId,
+ FOLDER_BROWSER_KEY_PREFIX_FOLDER,
+ FOLDER_BROWSER_KEY_PREFIX_ASSET));
}
final long count = controller.countObjects(target, name);
@@ -950,7 +1013,7 @@ public class AssetPane extends LayoutPanel implements Resettable {
if (!(permissionChecker.isPermitted(
ItemPrivileges.DELETE, object))
- && isMove(state)) {
+ && isMove(state)) {
addErrorMessage(data,
"cms.ui.folder.no_permission_for_item",
object.getDisplayName());
@@ -977,8 +1040,8 @@ public class AssetPane extends LayoutPanel implements Resettable {
@Override
protected Folder getRootFolder(final PageState state) {
final ContentSection section = CMS
- .getContext()
- .getContentSection();
+ .getContext()
+ .getContentSection();
return section.getRootAssetsFolder();
}
@@ -992,9 +1055,9 @@ public class AssetPane extends LayoutPanel implements Resettable {
if (key instanceof String) {
final Long keyAsLong;
if (((String) key).startsWith(
- FOLDER_BROWSER_KEY_PREFIX_FOLDER)) {
+ FOLDER_BROWSER_KEY_PREFIX_FOLDER)) {
keyAsLong = Long.parseLong(((String) key).substring(
- FOLDER_BROWSER_KEY_PREFIX_FOLDER.length()));
+ FOLDER_BROWSER_KEY_PREFIX_FOLDER.length()));
} else {
keyAsLong = Long.parseLong((String) key);
}
diff --git a/ccm-cms/src/main/java/com/arsdigita/cms/ui/assets/forms/BookmarkForm.java b/ccm-cms/src/main/java/com/arsdigita/cms/ui/assets/forms/BookmarkForm.java
new file mode 100644
index 000000000..d09a9c741
--- /dev/null
+++ b/ccm-cms/src/main/java/com/arsdigita/cms/ui/assets/forms/BookmarkForm.java
@@ -0,0 +1,149 @@
+/*
+ * Copyright (C) 2017 LibreCCM Foundation.
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+package com.arsdigita.cms.ui.assets.forms;
+
+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.event.FormValidationListener;
+import com.arsdigita.bebop.form.TextArea;
+import com.arsdigita.bebop.form.TextField;
+import com.arsdigita.cms.ui.assets.AssetForm;
+import com.arsdigita.cms.ui.assets.AssetPane;
+import com.arsdigita.globalization.GlobalizedMessage;
+import com.arsdigita.kernel.KernelConfig;
+
+import org.librecms.CmsConstants;
+import org.librecms.assets.Bookmark;
+import org.librecms.contentsection.Asset;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Objects;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ *
+ * @author Jens Pelzetter
+ */
+public class BookmarkForm extends AssetForm {
+
+ private TextArea description;
+ private TextField url;
+
+ public BookmarkForm(final AssetPane assetPane) {
+ super(assetPane);
+ }
+
+ @Override
+ protected void addWidgets() {
+
+ add(new Label(
+ new GlobalizedMessage("cms.ui.assets.bookmark.description",
+ CmsConstants.CMS_BUNDLE)));
+ description = new TextArea("bookmark-description");
+ add(description);
+
+ add(new Label(new GlobalizedMessage("cms.ui.assets.bookmark.url",
+ CmsConstants.CMS_BUNDLE)));
+ url = new TextField("bookmark-url");
+ add(url);
+
+ addValidationListener(new FormValidationListener() {
+
+ @Override
+ public void validate(final FormSectionEvent event)
+ throws FormProcessException {
+
+ final PageState state = event.getPageState();
+ final FormData data = event.getFormData();
+
+ try {
+ new URL((String) url.getValue(state));
+ } catch (MalformedURLException ex) {
+ data.addError(new GlobalizedMessage(
+ "cms.ui.assets.bookmark.url.malformed",
+ CmsConstants.CMS_BUNDLE));
+ }
+ }
+
+ });
+
+ }
+
+ @Override
+ protected Asset createAsset(final PageState state)
+ throws FormProcessException {
+
+ Objects.requireNonNull(state);
+
+ final Bookmark bookmark = new Bookmark();
+
+ bookmark
+ .getDescription()
+ .addValue(KernelConfig.getConfig().getDefaultLocale(),
+ (String) description.getValue(state));
+
+ try {
+ bookmark.setUrl(new URL((String) url.getValue(state)));
+ } catch (MalformedURLException ex) {
+ throw new FormProcessException(new GlobalizedMessage(
+ "cms.ui.assets.bookmark.url.malformed",
+ CmsConstants.CMS_BUNDLE));
+ }
+
+ return bookmark;
+ }
+
+ @Override
+ protected void updateAsset(final Asset asset, final PageState state)
+ throws FormProcessException {
+
+ Objects.requireNonNull(asset);
+ Objects.requireNonNull(state);
+
+ if (!(asset instanceof Bookmark)) {
+ throw new IllegalArgumentException(String.format(
+ "Provided asset is not an instance of class (or sub class of) "
+ + "'%s' but is an instance of class '%s'",
+ Bookmark.class.getName(),
+ asset.getClass().getName()));
+ }
+
+ final Bookmark bookmark = (Bookmark) asset;
+
+ bookmark
+ .getDescription()
+ .addValue(KernelConfig.getConfig().getDefaultLocale(),
+ (String) description.getValue(state));
+
+ try {
+ bookmark.setUrl(new URL((String) url.getValue(state)));
+ } catch (MalformedURLException ex) {
+ throw new FormProcessException(new GlobalizedMessage(
+ "cms.ui.assets.bookmark.url.malformed",
+ CmsConstants.CMS_BUNDLE));
+ }
+
+ }
+
+}
diff --git a/ccm-cms/src/main/java/com/arsdigita/cms/ui/assets/forms/LegalMetadataForm.java b/ccm-cms/src/main/java/com/arsdigita/cms/ui/assets/forms/LegalMetadataForm.java
new file mode 100644
index 000000000..f3bc1249d
--- /dev/null
+++ b/ccm-cms/src/main/java/com/arsdigita/cms/ui/assets/forms/LegalMetadataForm.java
@@ -0,0 +1,116 @@
+/*
+ * Copyright (C) 2017 LibreCCM Foundation.
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+package com.arsdigita.cms.ui.assets.forms;
+
+import com.arsdigita.bebop.FormProcessException;
+import com.arsdigita.bebop.Label;
+import com.arsdigita.bebop.PageState;
+import com.arsdigita.bebop.form.TextArea;
+import com.arsdigita.bebop.form.TextField;
+import com.arsdigita.cms.ui.assets.AssetForm;
+import com.arsdigita.cms.ui.assets.AssetPane;
+import com.arsdigita.globalization.GlobalizedMessage;
+import com.arsdigita.kernel.KernelConfig;
+
+import org.librecms.CmsConstants;
+import org.librecms.assets.LegalMetadata;
+import org.librecms.contentsection.Asset;
+
+import java.util.Objects;
+
+/**
+ *
+ * @author Jens Pelzetter
+ */
+public class LegalMetadataForm extends AssetForm {
+
+ private TextArea rightsHolder;
+ private TextArea rights;
+ private TextArea publisher;
+ private TextArea creator;
+
+ public LegalMetadataForm(final AssetPane assetPane) {
+ super(assetPane);
+ }
+
+ @Override
+ protected void addWidgets() {
+ add(new Label(new GlobalizedMessage(
+ "cms.ui.assets.legalmetadata.rightsholder",
+ CmsConstants.CMS_BUNDLE)));
+
+ rightsHolder = new TextArea("legalmetadata-rightsholder");
+ add(rightsHolder);
+
+ rights = new TextArea("legalmetadata-rights");
+ add(rights);
+
+ publisher = new TextArea("legalmetadata-rights");
+ add(publisher);
+
+ creator = new TextArea("legalmetadata-creator");
+ add(creator);
+ }
+
+ @Override
+ protected Asset createAsset(final PageState state)
+ throws FormProcessException {
+
+ Objects.requireNonNull(state);
+
+ final LegalMetadata legalMetadata = new LegalMetadata();
+
+ legalMetadata.setRightsHolder((String) rightsHolder.getValue(state));
+ legalMetadata.getRights().addValue(
+ KernelConfig.getConfig().getDefaultLocale(),
+ (String) rights.getValue(state));
+
+ legalMetadata.setPublisher((String) publisher.getValue(state));
+ legalMetadata.setCreator((String) creator.getValue(state));
+
+ return legalMetadata;
+ }
+
+ @Override
+ protected void updateAsset(final Asset asset, final PageState state)
+ throws FormProcessException {
+
+ Objects.requireNonNull(asset);
+ Objects.requireNonNull(state);
+
+ if (!(asset instanceof LegalMetadata)) {
+ throw new IllegalArgumentException(String.format(
+ "Provided asset is not an instance of '%s' (or a sub class) "
+ + "but is an instance of class '%s'.",
+ LegalMetadata.class.getName(),
+ asset.getClass().getName()));
+ }
+
+ final LegalMetadata legalMetadata = (LegalMetadata) asset;
+
+ legalMetadata.setRightsHolder((String) rightsHolder.getValue(state));
+ legalMetadata.getRights().addValue(
+ KernelConfig.getConfig().getDefaultLocale(),
+ (String) rights.getValue(state));
+
+ legalMetadata.setPublisher((String) publisher.getValue(state));
+ legalMetadata.setCreator((String) creator.getValue(state));
+ }
+
+}
diff --git a/ccm-cms/src/main/java/org/librecms/Cms.java b/ccm-cms/src/main/java/org/librecms/Cms.java
index c04bc3fb3..260911a23 100644
--- a/ccm-cms/src/main/java/org/librecms/Cms.java
+++ b/ccm-cms/src/main/java/org/librecms/Cms.java
@@ -19,6 +19,9 @@ import org.libreccm.modules.ShutdownEvent;
import org.libreccm.modules.UnInstallEvent;
import org.libreccm.web.ApplicationType;
import org.libreccm.web.CcmApplication;
+import org.librecms.assets.AssetTypes;
+import org.librecms.assets.Bookmark;
+import org.librecms.assets.LegalMetadata;
import org.librecms.contentsection.ContentSection;
import org.librecms.contentsection.ContentSectionCreator;
import org.librecms.contentsection.ContentSectionSetup;
@@ -57,6 +60,7 @@ import java.util.Properties;
}
)
@ContentTypes({Article.class, Event.class, MultiPartArticle.class, News.class})
+@AssetTypes({Bookmark.class, LegalMetadata.class})
public class Cms implements CcmModule {
private static final Logger LOGGER = LogManager.getLogger(Cms.class);
diff --git a/ccm-cms/src/main/java/org/librecms/assets/AssetConstants.java b/ccm-cms/src/main/java/org/librecms/assets/AssetConstants.java
new file mode 100644
index 000000000..9b3080307
--- /dev/null
+++ b/ccm-cms/src/main/java/org/librecms/assets/AssetConstants.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2017 LibreCCM Foundation.
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+package org.librecms.assets;
+
+/**
+ * Constants for assets.
+ *
+ * @author Jens Pelzetter
+ */
+public final class AssetConstants {
+
+ private AssetConstants() {
+ //Nothing
+ }
+
+ public static final String ASSETS_BUNDLE = "org.librecms.assets.Assets";
+
+}
diff --git a/ccm-cms/src/main/java/org/librecms/assets/Bookmark.java b/ccm-cms/src/main/java/org/librecms/assets/Bookmark.java
index 5cec78538..92ad4d009 100644
--- a/ccm-cms/src/main/java/org/librecms/assets/Bookmark.java
+++ b/ccm-cms/src/main/java/org/librecms/assets/Bookmark.java
@@ -18,6 +18,8 @@
*/
package org.librecms.assets;
+import com.arsdigita.cms.ui.assets.forms.BookmarkForm;
+
import org.librecms.contentsection.Asset;
import java.io.Serializable;
@@ -37,13 +39,19 @@ import org.hibernate.validator.constraints.NotEmpty;
import org.libreccm.l10n.LocalizedString;
import static org.librecms.CmsConstants.*;
+import static org.librecms.assets.AssetConstants.*;
/**
- * An assets for managing bookmarks which can be used to create links. Useful
- * if the same link appears in multiple places.
- *
+ * An assets for managing bookmarks which can be used to create links. Useful if
+ * the same link appears in multiple places.
+ *
* @author Jens Pelzetter
*/
+@AssetType(assetForm = BookmarkForm.class,
+ labelBundle = ASSETS_BUNDLE,
+ labelKey = "bookmark.label",
+ descriptionBundle = ASSETS_BUNDLE,
+ descriptionKey = "bookmark.description")
@Entity
@Table(name = "BOOKMARKS", schema = DB_SCHEMA)
@Audited
@@ -53,13 +61,13 @@ public class Bookmark extends Asset implements Serializable {
@Embedded
@AssociationOverride(
- name = "values",
- joinTable = @JoinTable(name = "BOOKMARK_DESCRIPTIONS",
- schema = DB_SCHEMA,
- joinColumns = {
- @JoinColumn(name = "ASSET_ID")
- }
- )
+ name = "values",
+ joinTable = @JoinTable(name = "BOOKMARK_DESCRIPTIONS",
+ schema = DB_SCHEMA,
+ joinColumns = {
+ @JoinColumn(name = "ASSET_ID")
+ }
+ )
)
private LocalizedString description;
@@ -130,7 +138,7 @@ public class Bookmark extends Asset implements Serializable {
@Override
public String toString(final String data) {
return super.toString(String.format(", description = %s, "
- + "url = %s%s",
+ + "url = %s%s",
Objects.toString(description),
Objects.toString(url),
data));
diff --git a/ccm-cms/src/main/java/org/librecms/assets/LegalMetadata.java b/ccm-cms/src/main/java/org/librecms/assets/LegalMetadata.java
index 4f3c9447b..261ac4b9e 100644
--- a/ccm-cms/src/main/java/org/librecms/assets/LegalMetadata.java
+++ b/ccm-cms/src/main/java/org/librecms/assets/LegalMetadata.java
@@ -18,6 +18,8 @@
*/
package org.librecms.assets;
+import com.arsdigita.cms.ui.assets.forms.LegalMetadataForm;
+
import org.librecms.contentsection.Asset;
import org.hibernate.envers.Audited;
import org.libreccm.l10n.LocalizedString;
@@ -39,6 +41,7 @@ import javax.persistence.JoinTable;
import javax.persistence.Table;
import static org.librecms.CmsConstants.*;
+import static org.librecms.assets.AssetConstants.*;
/**
* Container for storing legal metadata about a resource (a content item or an
@@ -46,6 +49,11 @@ import static org.librecms.CmsConstants.*;
*
* @author Jens Pelzetter
*/
+@AssetType(assetForm = LegalMetadataForm.class,
+ labelKey = "legal_metadata.label",
+ labelBundle = ASSETS_BUNDLE,
+ descriptionKey = "legal_metadata.description",
+ descriptionBundle = ASSETS_BUNDLE)
@Entity
@Table(name = "LEGAL_METADATA", schema = DB_SCHEMA)
@Audited
@@ -86,7 +94,7 @@ public class LegalMetadata extends Asset implements Serializable {
joinColumns = {
@JoinColumn(name = "LEGAL_METADATA_ID")
})
- @Column(name ="CONTRIBUTORS")
+ @Column(name = "CONTRIBUTORS")
private List contributors;
public LegalMetadata() {
diff --git a/ccm-cms/src/main/resources/org/librecms/CmsResources.properties b/ccm-cms/src/main/resources/org/librecms/CmsResources.properties
index fbedc422d..d9bbdd8b1 100644
--- a/ccm-cms/src/main/resources/org/librecms/CmsResources.properties
+++ b/ccm-cms/src/main/resources/org/librecms/CmsResources.properties
@@ -246,3 +246,5 @@ cms.ui.type.select=Select Content Type
cms.ui.type.select.none=There are no available content types to select
cms.ui.assets=Assets
cms.ui.folder.no_assets=No assets
+cms.ui.assets.new=Create new asset
+cms.ui.assets.new.create=Create asset
diff --git a/ccm-cms/src/main/resources/org/librecms/CmsResources_de.properties b/ccm-cms/src/main/resources/org/librecms/CmsResources_de.properties
index da570f196..e666e32e1 100644
--- a/ccm-cms/src/main/resources/org/librecms/CmsResources_de.properties
+++ b/ccm-cms/src/main/resources/org/librecms/CmsResources_de.properties
@@ -245,3 +245,5 @@ cms.ui.type.select=Dolkumententype ausw\u00e4hlen
cms.ui.type.select.none=Keine verf\u00fcgbaren Dokumententypen
cms.ui.assets=Medien & Daten
cms.ui.folder.no_assets=Keine Medien oder Datens\u00e4tze vorhanden
+cms.ui.assets.new=Neues Asset anlegen
+cms.ui.assets.new.create=Asset anlegen
diff --git a/ccm-cms/src/main/resources/org/librecms/CmsResources_fr.properties b/ccm-cms/src/main/resources/org/librecms/CmsResources_fr.properties
index fe78c70d9..f3a9b9a73 100644
--- a/ccm-cms/src/main/resources/org/librecms/CmsResources_fr.properties
+++ b/ccm-cms/src/main/resources/org/librecms/CmsResources_fr.properties
@@ -204,3 +204,5 @@ cms.ui.type.select=Select Content Type
cms.ui.type.select.none=There are no available content types to select
cms.ui.assets=Assets
cms.ui.folder.no_assets=No assets
+cms.ui.assets.new=Create new asset
+cms.ui.assets.new.create=Create asset
diff --git a/ccm-cms/src/main/resources/org/librecms/assets/Assets.properties b/ccm-cms/src/main/resources/org/librecms/assets/Assets.properties
new file mode 100644
index 000000000..4763ec1e3
--- /dev/null
+++ b/ccm-cms/src/main/resources/org/librecms/assets/Assets.properties
@@ -0,0 +1,5 @@
+
+bookmark.label=Bookmark
+bookmark.description=Asset type to store URLs to external resources.
+legal_metadata.label=Legal metadata
+legal_metadata.description=Stores legal metadata like the informations about the creator of an image etc.
diff --git a/ccm-cms/src/main/resources/org/librecms/assets/Assets_de.properties b/ccm-cms/src/main/resources/org/librecms/assets/Assets_de.properties
new file mode 100644
index 000000000..d120e9769
--- /dev/null
+++ b/ccm-cms/src/main/resources/org/librecms/assets/Assets_de.properties
@@ -0,0 +1,5 @@
+
+bookmark.label=Lesezeichen (URL)
+bookmark.description=Dieser Asset-Typ dient zur Ablage von URLs zu externen Resourcen.
+legal_metadata.label=Rechtliche Informationen
+legal_metadata.description=Rechtliche Informationen, z.B. die Urheberschaft von Bildern etc.