Index: main/plugin-web/i18n/messages_en.xml
===================================================================
--- main/plugin-web/i18n/messages_en.xml (revision 32590)
+++ main/plugin-web/i18n/messages_en.xml (working copy)
@@ -2440,5 +2440,11 @@
Selection error.
The sitemap does not exist.
+
+ Files transfert
+ Copy or move actions on page attachments files
+
\ No newline at end of file
Index: main/plugin-web/i18n/messages_fr.xml
===================================================================
--- main/plugin-web/i18n/messages_fr.xml (revision 32590)
+++ main/plugin-web/i18n/messages_fr.xml (working copy)
@@ -2442,5 +2442,11 @@
Erreur de sélection.
Le plan du site n'existe plus.
+
+ Transfert de fichiers
+ Actions de copie ou de déplacement des fichiers en pièce-jointe de la page
+
\ No newline at end of file
Index: main/plugin-web/plugin.xml
===================================================================
--- main/plugin-web/plugin.xml (revision 32590)
+++ main/plugin-web/plugin.xml (working copy)
@@ -5762,129 +5762,149 @@
-
-
-
+
+
+ js/Ametys/plugins/explorer/relations/ExplorerResourcesRelationHandler.js
+ js/Ametys/plugins/web/page/relations/DefaultPageAttachmentsRelationHandler.js
+
+
+
+
-
-
- uitool-content-attachments
-
- PLUGINS_WEB_CONTENT_ATTACHMENTS_UITOOL_TITLE
- PLUGINS_WEB_CONTENT_ATTACHMENTS_UITOOL_DESCRIPTION
- PLUGINS_WEB_CONTENT_ATTACHMENTS_UITOOL_FOOTER
-
- img/attach/attach_content_16.png
- img/attach/attach_content_32.png
- img/attach/attach_content_48.png
-
- l
-
-
- js/org/ametys/web/tool/explorer/SimpleResourcesExplorerTool.js
- js/org/ametys/web/tool/explorer/SimpleResourcesExplorerToolFactory.js
- js/org/ametys/web/tool/attach/ContentAttachmentsTool.js
- js/org/ametys/web/tool/attach/ContentAttachmentsToolFactory.js
- js/org/ametys/web/helper/ExplorerTree.js
- js/org/ametys/web/helper/AttachmentsExplorerTree.js
-
-
- css/all.css
-
- -->
-
-
-
+
+
+
-
-
-
-
+ Ametys.plugins.explorer.applications.resources.ResourcesControllerActions.Folder.rename
+ ^page$
+ ^(explorer-collection|resource)$
+ Ametys.plugins.explorer.applications.resources.Resources
- img/resources/file_new_16.png
- img/resources/file_new_32.png
- img/resources/file_new_50.png
-
-
- js/org/ametys/web/explorer/applications/resources/Actions.js
- js/org/ametys/explorer/applications/resources/ResourcesActions.js
- js/org/ametys/ribbon/control/button/ExplorerNodeButton.js
- js/org/ametys/ribbon/control/button/PageAttachmentButton.js
-
- Web_Rights_Page_AttachmentHandle// the right is checked on page
-
-
-
-
- org.ametys.web.explorer.applications.resources.File.rename
- ^page$
- ^resources-explorer-node$
- ^resource$
+
+ plugin.explorer:PLUGINS_EXPLORER_FOLDER_RENAME_DESCRIPTION
+
+ PLUGINS_WEB_EXPLORER_NO_SELECTED_FOLDER_DESCRIPTION
+ PLUGINS_WEB_EXPLORER_NO_RIGHT_DESCRIPTION
+
+ true
+ plugin.explorer:PLUGINS_EXPLORER_NO_MODIFIABLE_DESCRIPTION
+ true
- plugin.explorer:PLUGINS_EXPLORER_FILE_RENAME_LABEL
- plugin.explorer:PLUGINS_EXPLORER_FILE_RENAME_DESCRIPTION
- plugin.explorer:PLUGINS_EXPLORER_FILE_RENAME_FOOTER
- PLUGINS_WEB_EXPLORER_NO_SELECTED_FILE_DESCRIPTION
- PLUGINS_WEB_EXPLORER_NO_RIGHT_DESCRIPTION
+ img/resources/folder_rename_16.png
+ img/resources/folder_rename_32.png
+ img/resources/folder_rename_50.png
+
+
+ js/Ametys/explorer/controllers/ExplorerNodeController.js
+ js/Ametys/plugins/explorer/applications/resources/ResourcesControllerActions.js
+
+ Web_Rights_Page_AttachmentHandle
+
+
+
+
+ Ametys.plugins.explorer.applications.resources.ResourcesControllerActions.Folder.remove
+ ^page$
+ ^(explorer-collection|resource)$
+ Ametys.plugins.explorer.applications.resources.Resources
- img/resources/file_rename_16.png
- img/resources/file_rename_32.png
- img/resources/file_rename_50.png
-
-
- js/org/ametys/web/explorer/applications/resources/Actions.js
- js/org/ametys/explorer/applications/resources/ResourcesActions.js
-
- Web_Rights_Page_AttachmentHandle// the right is checked on page
-
-
-
-
- org.ametys.web.explorer.applications.resources.File.remove
- ^page$
- ^resources-explorer-node$
- ^resource$
+
+ plugin.explorer:PLUGINS_EXPLORER_FOLDER_DELETE_DESCRIPTION
+
+ PLUGINS_WEB_EXPLORER_NO_SELECTED_FOLDER_DESCRIPTION
+ PLUGINS_WEB_EXPLORER_NO_RIGHT_DESCRIPTION
+
+ true
+ plugin.explorer:PLUGINS_EXPLORER_NO_MODIFIABLE_DESCRIPTION
+ true
- plugin.explorer:PLUGINS_EXPLORER_FILE_DELETE_LABEL
- plugin.explorer:PLUGINS_EXPLORER_FILE_DELETE_DESCRIPTION
- plugin.explorer:PLUGINS_EXPLORER_FILE_DELETE_FOOTER
- PLUGINS_WEB_EXPLORER_NO_SELECTED_FILE_DESCRIPTION
- PLUGINS_WEB_EXPLORER_NO_RIGHT_DESCRIPTION
+ img/resources/folder_delete_16.png
+ img/resources/folder_delete_32.png
+ img/resources/folder_delete_50.png
+
+
+ js/Ametys/explorer/controllers/ExplorerNodeController.js
+ js/Ametys/plugins/explorer/applications/resources/ResourcesControllerActions.js
+
+ Web_Rights_Page_AttachmentHandle
+
+
+
+
+ Ametys.plugins.web.page.ResourcesControllerActions.openSearch
+ ^page$
+ ^explorer-collection$
+ Ametys.plugins.explorer.applications.resources.Resources
- img/resources/file_delete_16.png
- img/resources/file_delete_32.png
- img/resources/file_delete_50.png
-
-
- js/org/ametys/web/explorer/applications/resources/Actions.js
- js/org/ametys/explorer/applications/resources/ResourcesActions.js
-
- Web_Rights_Page_AttachmentHandle// the right is checked on page
-
-
-
-
- org.ametys.web.explorer.applications.resources.File.download
- ^page$
- ^resources-explorer-node$
- ^resource$
+
+ plugin.explorer:PLUGINS_EXPLORER_SEARCH_DESCRIPTION
+
+ PLUGINS_WEB_EXPLORER_NO_SELECTED_FOLDER_DESCRIPTION
+ PLUGINS_WEB_EXPLORER_NO_RIGHT_DESCRIPTION
- plugin.explorer:PLUGINS_EXPLORER_FILE_DOWNLOAD_LABEL
- plugin.explorer:PLUGINS_EXPLORER_FILE_DOWNLOAD_DESCRIPTION
- plugin.explorer:PLUGINS_EXPLORER_FILE_DOWNLOAD_FOOTER
- PLUGINS_WEB_EXPLORER_NO_SELECTED_FILE_DESCRIPTION
- PLUGINS_WEB_EXPLORER_NO_RIGHT_DESCRIPTION
+ img/resources/search_16.png
+ img/resources/search_32.png
+ img/resources/search_48.png
+
+
+ js/Ametys/explorer/controllers/ExplorerNodeController.js
+ js/Ametys/plugins/web/page/ResourcesControllerActions.js
+
+
+
+
+
+ Ametys.plugins.explorer.applications.resources.ResourcesControllerActions.Folder.archive
+ ^page$
+ ^(explorer-collection|resource)$
+ Ametys.plugins.explorer.applications.resources.Resources
- img/resources/file_download_16.png
- img/resources/file_download_32.png
- img/resources/file_download_50.png
-
-
- js/org/ametys/web/explorer/applications/resources/Actions.js
- js/org/ametys/explorer/applications/resources/ResourcesActions.js
-
-
-
-
-
- org.ametys.web.explorer.applications.resources.File.editDublinCore
- ^page$
- ^resources-explorer-node$
- ^resource$
+
+ plugin.explorer:PLUGINS_EXPLORER_FOLDER_ARCHIVE_DESCRIPTION
+
+ PLUGINS_WEB_EXPLORER_NO_SELECTED_FOLDER_DESCRIPTION
+ PLUGINS_WEB_EXPLORER_NO_RIGHT_DESCRIPTION
- plugin.explorer:PLUGINS_EXPLORER_FILE_DUBLINCORE_LABEL
- plugin.explorer:PLUGINS_EXPLORER_FILE_DUBLINCORE_DESCRIPTION
- plugin.explorer:PLUGINS_EXPLORER_FILE_DUBLINCORE_FOOTER
- PLUGINS_WEB_EXPLORER_NO_SELECTED_FILE_DESCRIPTION
- PLUGINS_WEB_EXPLORER_NO_RIGHT_DESCRIPTION
+ img/resources/folder_archive_16.png
+ img/resources/folder_archive_32.png
+ img/resources/folder_archive_50.png
+
+
+ js/Ametys/explorer/controllers/ExplorerNodeController.js
+ js/Ametys/plugins/explorer/applications/resources/ResourcesControllerActions.js
+
+ Web_Rights_Page_AttachmentHandle
+
+
+
+
+ Ametys.plugins.explorer.applications.resources.ResourcesControllerActions.File.add
+ ^page$
+ ^(explorer-collection|resource)$
+ Ametys.plugins.explorer.applications.resources.Resources
+
+ 12
- img/resources/dublincore_16.png
- img/resources/dublincore_32.png
- img/resources/dublincore_16.png
-
+
+ plugin.explorer:PLUGINS_EXPLORER_FILE_ADD_DESCRIPTION
+
+ PLUGINS_WEB_EXPLORER_NO_SELECTED_FOLDER_DESCRIPTION
+ PLUGINS_WEB_EXPLORER_NO_RIGHT_DESCRIPTION
+
+ true
+ plugin.explorer:PLUGINS_EXPLORER_NO_MODIFIABLE_DESCRIPTION
+ true
+ plugin.explorer:PLUGINS_EXPLORER_NO_TRAVERSABLE_DESCRIPTION
+
+ img/resources/file_new_16.png
+ img/resources/file_new_32.png
+ img/resources/file_new_50.png
+
- js/org/ametys/web/explorer/applications/resources/Actions.js
- js/org/ametys/explorer/applications/resources/ResourcesActions.js
- js/org/ametys/explorer/applications/resources/DublinCore.js
- js/org/ametys/explorer/applications/resources/DublinCoreDialog.js
+ js/Ametys/explorer/controllers/ExplorerNodeController.js
+ js/Ametys/plugins/explorer/applications/resources/ResourcesControllerActions.js
-
-
-
-
- org.ametys.web.explorer.applications.resources.File.copy
- ^page$
- ^resources-explorer-node$
- ^resource$
+ Web_Rights_Page_AttachmentHandle
+
+
+
+
+ Ametys.plugins.explorer.applications.resources.ResourcesControllerActions.File.rename
+ ^page$
+ ^resource$
+
+ 12
+
+
+ plugin.explorer:PLUGINS_EXPLORER_FILE_RENAME_DESCRIPTION
+
+ PLUGINS_WEB_EXPLORER_NO_SELECTED_FILE_DESCRIPTION
+ PLUGINS_WEB_EXPLORER_NO_RIGHT_DESCRIPTION
+
+ true
+ plugin.explorer:PLUGINS_EXPLORER_NO_MODIFIABLE_DESCRIPTION
- plugin.explorer:PLUGINS_EXPLORER_FILE_COPY_LABEL
- plugin.explorer:PLUGINS_EXPLORER_FILE_COPY_DESCRIPTION
- plugin.explorer:PLUGINS_EXPLORER_FILE_COPY_FOOTER
- PLUGINS_WEB_EXPLORER_NO_SELECTED_FILE_DESCRIPTION
- PLUGINS_WEB_EXPLORER_NO_RIGHT_DESCRIPTION
+ img/resources/file_rename_16.png
+ img/resources/file_rename_32.png
+ img/resources/file_rename_50.png
+
+
+ js/Ametys/explorer/controllers/ExplorerNodeController.js
+ js/Ametys/plugins/explorer/applications/resources/ResourcesControllerActions.js
+
+ Web_Rights_Page_AttachmentHandle
+
+
+
+
+ Ametys.plugins.explorer.applications.resources.ResourcesControllerActions.File.remove
+ ^page$
+ ^resource$
+
+ 12
- img/resources/clipboard/copy_16.png
- img/resources/clipboard/copy_32.png
- img/resources/clipboard/copy_50.png
-
-
- js/org/ametys/web/explorer/applications/resources/Actions.js
-
- Web_Rights_Page_AttachmentHandle// the right is checked on page
-
-
-
-
- org.ametys.web.explorer.applications.resources.File.cut
- ^page$
- ^resources-explorer-node$
- ^resource$
+
+ plugin.explorer:PLUGINS_EXPLORER_FILE_DELETE_DESCRIPTION
+
+ PLUGINS_WEB_EXPLORER_NO_SELECTED_FILE_DESCRIPTION
+ PLUGINS_WEB_EXPLORER_NO_RIGHT_DESCRIPTION
+
+ true
+ plugin.explorer:PLUGINS_EXPLORER_NO_MODIFIABLE_DESCRIPTION
- plugin.explorer:PLUGINS_EXPLORER_FILE_CUT_LABEL
- plugin.explorer:PLUGINS_EXPLORER_FILE_CUT_DESCRIPTION
- plugin.explorer:PLUGINS_EXPLORER_FILE_CUT_FOOTER
- PLUGINS_WEB_EXPLORER_NO_SELECTED_FILE_DESCRIPTION
- PLUGINS_WEB_EXPLORER_NO_RIGHT_DESCRIPTION
+ img/resources/file_delete_16.png
+ img/resources/file_delete_32.png
+ img/resources/file_delete_50.png
+
+
+ js/Ametys/explorer/controllers/ExplorerNodeController.js
+ js/Ametys/plugins/explorer/applications/resources/ResourcesControllerActions.js
+
+ Web_Rights_Page_AttachmentHandle
+
+
+
+
+ Ametys.plugins.explorer.applications.resources.ResourcesControllerActions.File.download
+ ^page$
+ ^resource$
- img/resources/clipboard/cut_16.png
- img/resources/clipboard/cut_32.png
- img/resources/clipboard/cut_50.png
-
-
- js/org/ametys/web/explorer/applications/resources/Actions.js
-
- Web_Rights_Page_AttachmentHandle
-
-
-
-
- org.ametys.web.explorer.applications.resources.File.paste
- org.ametys.plugins.explorer.applications.Resources
- ^page$
- ^resources-explorer-node$
+
+ plugin.explorer:PLUGINS_EXPLORER_FILE_DOWNLOAD_DESCRIPTION
+
+ PLUGINS_WEB_EXPLORER_NO_SELECTED_FILE_DESCRIPTION
+ PLUGINS_WEB_EXPLORER_NO_RIGHT_DESCRIPTION
- plugin.explorer:PLUGINS_EXPLORER_FILE_PASTE_LABEL
- plugin.explorer:PLUGINS_EXPLORER_FILE_PASTE_DESCRIPTION
- plugin.explorer:PLUGINS_EXPLORER_FILE_PASTE_FOOTER
- PLUGINS_WEB_EXPLORER_NO_SELECTED_FOLDER_DESCRIPTION
- PLUGINS_WEB_EXPLORER_NO_RIGHT_DESCRIPTION
+ img/resources/file_download_16.png
+ img/resources/file_download_32.png
+ img/resources/file_download_50.png
+
+
+ js/Ametys/explorer/controllers/ExplorerNodeController.js
+ js/Ametys/plugins/explorer/applications/resources/ResourcesControllerActions.js
+
+
+
+
+
+ Ametys.plugins.explorer.applications.resources.ResourcesControllerActions.File.editDublinCore
+ ^page$
+ ^resource$
- img/resources/clipboard/paste_16.png
- img/resources/clipboard/paste_32.png
- img/resources/clipboard/paste_50.png
-
-
- js/org/ametys/web/explorer/applications/resources/Actions.js
- js/org/ametys/ribbon/control/button/ExplorerNodeButton.js
-
- Web_Rights_Page_AttachmentHandle// the right is checked on page
- -->
-
-
+
+ plugin.explorer:PLUGINS_EXPLORER_FILE_DUBLINCORE_DESCRIPTION
+
+ PLUGINS_WEB_EXPLORER_NO_SELECTED_FILE_DESCRIPTION
+ PLUGINS_WEB_EXPLORER_NO_RIGHT_DESCRIPTION
+
+ true
+ plugin.explorer:PLUGINS_EXPLORER_NO_MODIFIABLE_DESCRIPTION
+
+ img/resources/dublincore_16.png
+ img/resources/dublincore_32.png
+ img/resources/dublincore_16.png
+
+
+ js/Ametys/explorer/controllers/ExplorerNodeController.js
+ js/Ametys/plugins/explorer/applications/resources/ResourcesControllerActions.js
+ js/Ametys/explorer/resources/helper/DublinCore.js
+ js/Ametys/explorer/resources/helper/DublinCore/DCMITypeEntry.js
+ js/Ametys/explorer/resources/helper/DublinCore/MetadataEntry.js
+
+
+
+
+
+ Ametys.plugins.explorer.applications.resources.ResourcesControllerActions.File.copy
+ ^page$
+ ^resource$
+
+
+ plugin.explorer:PLUGINS_EXPLORER_FILE_COPY_DESCRIPTION
+
+ PLUGINS_WEB_EXPLORER_NO_SELECTED_FILE_DESCRIPTION
+ PLUGINS_WEB_EXPLORER_NO_RIGHT_DESCRIPTION
+
+ img/resources/clipboard/copy_16.png
+ img/resources/clipboard/copy_32.png
+ img/resources/clipboard/copy_50.png
+
+
+ js/Ametys/explorer/controllers/ExplorerNodeController.js
+ js/Ametys/plugins/explorer/applications/resources/ResourcesControllerActions.js
+
+ Web_Rights_Page_AttachmentHandle
+
+
+
+
+ Ametys.plugins.explorer.applications.resources.ResourcesControllerActions.File.cut
+ ^page$
+ ^resource$
+
+
+ plugin.explorer:PLUGINS_EXPLORER_FILE_CUT_DESCRIPTION
+
+ PLUGINS_WEB_EXPLORER_NO_SELECTED_FILE_DESCRIPTION
+ PLUGINS_WEB_EXPLORER_NO_RIGHT_DESCRIPTION
+
+ img/resources/clipboard/cut_16.png
+ img/resources/clipboard/cut_32.png
+ img/resources/clipboard/cut_50.png
+
+
+ js/Ametys/explorer/controllers/ExplorerNodeController.js
+ js/Ametys/plugins/explorer/applications/resources/ResourcesControllerActions.js
+
+ Web_Rights_Page_AttachmentHandle
+
+
+
+
+ Ametys.plugins.explorer.applications.resources.ResourcesControllerActions.File.paste
+ Ametys.plugins.explorer.applications.resources.Resources
+ ^page$
+ ^explorer-collection$
+
+
+ plugin.explorer:PLUGINS_EXPLORER_FILE_PASTE_DESCRIPTION
+
+ PLUGINS_WEB_EXPLORER_NO_SELECTED_FOLDER_DESCRIPTION
+ PLUGINS_WEB_EXPLORER_NO_RIGHT_DESCRIPTION
+
+ true
+ plugin.explorer:PLUGINS_EXPLORER_NO_MODIFIABLE_DESCRIPTION
+ true
+ plugin.explorer:PLUGINS_EXPLORER_NO_TRAVERSABLE_DESCRIPTION
+
+ img/resources/clipboard/paste_16.png
+ img/resources/clipboard/paste_32.png
+ img/resources/clipboard/paste_50.png
+
+
+ js/Ametys/explorer/controllers/ExplorerNodeController.js
+ js/Ametys/plugins/explorer/applications/resources/ResourcesControllerActions.js
+
+ Web_Rights_Page_AttachmentHandle
+
+
+
+
+ Ametys.plugins.explorer.applications.resources.ResourcesControllerActions.File.slideShow
+ ^(explorer-collection|resource)$
+
+
+ plugin.explorer:PLUGINS_EXPLORER_IMAGES_SLIDESHOW_DESCRIPTION
+ plugin.explorer:PLUGINS_EXPLORER_NO_SELECTED_FOLDER_DESCRIPTION
+ img/resources/slideshow_16.png
+ img/resources/slideshow_32.png
+ img/resources/slideshow_48.png
+
+
+ js/Ametys/explorer/controllers/ExplorerNodeController.js
+ js/Ametys/explorer/controllers/ImagesContainerController.js
+ js/Ametys/plugins/explorer/applications/resources/ResourcesControllerActions.js
+ js/jquery.min.js
+ js/minified/jquery-ui.min.js
+ pirobox_extended_min.js
+
+
+ css/style_1/style.css
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
Index: main/plugin-web/ribbon/cms-ribbon-page-attachments.xml
===================================================================
--- main/plugin-web/ribbon/cms-ribbon-page-attachments.xml (revision 32590)
+++ main/plugin-web/ribbon/cms-ribbon-page-attachments.xml (working copy)
@@ -18,83 +18,83 @@
xsi:noNamespaceSchemaLocation="http://ametys.org/cms/3.0/ribbon.xsd">
-
+
-
-
-
-
-
+
+
+
+
+
-
+
-
-
-
+
+
+
-
+
-
+
-
-
-
-
+
+
+
+
-
-
-
-
-
+
+
+
+
+
-
+
-
-
-
+
+
+
-
+
-
-
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
+
-
+
Index: main/plugin-web/sitemap-back.xmap
===================================================================
--- main/plugin-web/sitemap-back.xmap (revision 32590)
+++ main/plugin-web/sitemap-back.xmap (working copy)
@@ -158,8 +158,6 @@
-
-
@@ -926,18 +924,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
Index: main/plugin-web/src/org/ametys/web/attachments/AttachmentsRootNodeAction.java
===================================================================
--- main/plugin-web/src/org/ametys/web/attachments/AttachmentsRootNodeAction.java (revision 32590)
+++ main/plugin-web/src/org/ametys/web/attachments/AttachmentsRootNodeAction.java (nonexistent)
@@ -1,95 +0,0 @@
-/*
- * Copyright 2010 Anyware Services
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.ametys.web.attachments;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.avalon.framework.parameters.Parameters;
-import org.apache.avalon.framework.service.ServiceException;
-import org.apache.avalon.framework.service.ServiceManager;
-import org.apache.cocoon.acting.ServiceableAction;
-import org.apache.cocoon.environment.ObjectModelHelper;
-import org.apache.cocoon.environment.Redirector;
-import org.apache.cocoon.environment.Request;
-import org.apache.cocoon.environment.SourceResolver;
-
-import org.ametys.plugins.explorer.resources.ModifiableResourceCollection;
-import org.ametys.plugins.repository.AmetysObjectResolver;
-import org.ametys.plugins.repository.ModifiableAmetysObject;
-import org.ametys.plugins.repository.RepositoryConstants;
-import org.ametys.plugins.repository.TraversableAmetysObject;
-import org.ametys.web.repository.content.WebContent;
-import org.ametys.web.repository.page.jcr.DefaultPage;
-
-/**
- * This action retrieves the id of the attachments root node of a {@link TraversableAmetysObject}.
If the attachments node does not exist, it will be created.
- *
- */
-public class AttachmentsRootNodeAction extends ServiceableAction
-{
- /** Constant for the attachment node name. */
- public static final String ATTACHMENTS_NODE_NAME = RepositoryConstants.NAMESPACE_PREFIX_INTERNAL + ":attachments";
-
- private AmetysObjectResolver _resolver;
-
- @Override
- public void service(ServiceManager smanager) throws ServiceException
- {
- super.service(smanager);
-
- _resolver = (AmetysObjectResolver) smanager.lookup(AmetysObjectResolver.ROLE);
- }
-
- @Override
- public Map act(Redirector redirector, SourceResolver resolver, Map objectModel, String source, Parameters parameters) throws Exception
- {
- Map result = new HashMap<>();
-
- Request request = ObjectModelHelper.getRequest(objectModel);
- String id = request.getParameter("id");
-
- TraversableAmetysObject object = _resolver.resolveById(id);
-
- TraversableAmetysObject attachments = null;
-
- if (object instanceof DefaultPage)
- {
- attachments = ((DefaultPage) object).getRootAttachments();
- }
- else if (object instanceof WebContent)
- {
- attachments = ((WebContent) object).getRootAttachments();
- }
-
- if (attachments != null)
- {
- result.put("rootID", attachments.getId());
- if (attachments instanceof ModifiableAmetysObject)
- {
- result.put("isModifiable", "true");
- }
- if (attachments instanceof ModifiableResourceCollection)
- {
- result.put("canCreateChild", "true");
- }
-
- return result;
- }
-
- throw new IllegalArgumentException("Element with id '" + id + "' is of type '" + object.getClass().getName() + "' that does not support attachments.");
- }
-}
Index: main/plugin-web/src/org/ametys/web/repository/page/PageDAO.java
===================================================================
--- main/plugin-web/src/org/ametys/web/repository/page/PageDAO.java (revision 32590)
+++ main/plugin-web/src/org/ametys/web/repository/page/PageDAO.java (working copy)
@@ -38,14 +38,22 @@
import org.ametys.core.observation.ObservationManager;
import org.ametys.core.ui.Callable;
import org.ametys.core.user.CurrentUserProvider;
+import org.ametys.plugins.explorer.ExplorerNode;
+import org.ametys.plugins.explorer.resources.ModifiableResourceCollection;
+import org.ametys.plugins.explorer.resources.Resource;
+import org.ametys.plugins.repository.AmetysObject;
import org.ametys.plugins.repository.AmetysObjectResolver;
+import org.ametys.plugins.repository.ModifiableAmetysObject;
+import org.ametys.plugins.repository.TraversableAmetysObject;
import org.ametys.plugins.repository.UnknownAmetysObjectException;
import org.ametys.plugins.repository.metadata.ModifiableCompositeMetadata;
import org.ametys.runtime.parameter.ParameterHelper;
import org.ametys.web.ObservationConstants;
+import org.ametys.web.repository.content.WebContent;
import org.ametys.web.repository.page.Page.LinkType;
import org.ametys.web.repository.page.Page.PageType;
import org.ametys.web.repository.page.ZoneItem.ZoneType;
+import org.ametys.web.repository.page.jcr.DefaultPage;
import org.ametys.web.service.Service;
import org.ametys.web.service.ServiceExtensionPoint;
import org.ametys.web.service.ServiceParameter;
@@ -566,5 +574,70 @@
}
}
}
+
+ /**
+ * Retrieves the id of the attachments root node of a {@link TraversableAmetysObject}.
+ * If the attachments node does not exist, it will be created.
+ * @param id the id of the ametys object
+ * @return a map of data used by the javascript callback
+ */
+ @Callable
+ public Map getAttachmentsRootNode (String id)
+ {
+ Map result = new HashMap<>();
+
+ TraversableAmetysObject object = _resolver.resolveById(id);
+ TraversableAmetysObject attachments = null;
+
+ if (object instanceof DefaultPage)
+ {
+ attachments = ((DefaultPage) object).getRootAttachments();
+ }
+ else if (object instanceof WebContent)
+ {
+ attachments = ((WebContent) object).getRootAttachments();
+ }
+
+ if (attachments != null)
+ {
+ result.put("rootID", attachments.getId());
+ if (attachments instanceof ModifiableAmetysObject)
+ {
+ result.put("isModifiable", true);
+ }
+ if (attachments instanceof ModifiableResourceCollection)
+ {
+ result.put("canCreateChild", true);
+ }
+
+ boolean hasChildNodes = false;
+ boolean hasResources = false;
+ for (AmetysObject child : attachments.getChildren())
+ {
+ if (child instanceof Resource)
+ {
+ hasResources = true;
+ }
+ else if (child instanceof ExplorerNode)
+ {
+ hasChildNodes = true;
+ }
+ }
+
+ if (hasChildNodes)
+ {
+ result.put("hasChildNodes", true);
+ }
+
+ if (hasResources)
+ {
+ result.put("hasResources", true);
+ }
+
+ return result;
+ }
+
+ throw new IllegalArgumentException("Object with id '" + id + "' is of type '" + object.getClass().getName() + "' that does not support attachments.");
+ }
}