diff --git a/config/alfresco/messages/webclient.properties b/config/alfresco/messages/webclient.properties index 70faf8ecc0..ce59959182 100644 --- a/config/alfresco/messages/webclient.properties +++ b/config/alfresco/messages/webclient.properties @@ -911,7 +911,7 @@ sandbox_icon=Browse Website sandbox_snapshot=Create Snapshot sandbox_snapshot_info=Create a snaphost of this sandbox. sandbox_remove=Delete Sandbox -import_website_content=Import Website Content +import_website_content=Bulk Import title_browse_sandbox=Browse Sandbox sandbox_info=Use this view to browse the files and folders within the sandbox for a web project. sandbox_title=Website ''{0}'' sandbox ''{1}'' @@ -944,9 +944,9 @@ snapshot_preview=Preview webapp_current=Current Webapp Folder # Website actions and dialog messages -title_import_content=Import Content into Website -import_website_content_title=Import Content into Website -import_website_content_desc=Use this dialog to import an archive of content into the default webapp for the website. +title_import_content=Web Project Bulk Import +import_website_content_title=Bulk Import +import_website_content_desc=Use this dialog to import an archive of content into the web project. delete_avm_file_info=To remove this file from the sandbox, click OK. delete_avm_file_confirm=Are you sure you want to remove \"{0}\" from the sandbox? delete_folder=Delete Folder diff --git a/config/alfresco/web-client-config-wcm-actions.xml b/config/alfresco/web-client-config-wcm-actions.xml index d3cad81c51..d44551462b 100644 --- a/config/alfresco/web-client-config-wcm-actions.xml +++ b/config/alfresco/web-client-config-wcm-actions.xml @@ -163,6 +163,17 @@ #{AddAvmContentDialog.start} + + + + CreateChildren + + import_website_content + /images/icons/import_website.gif + dialog:importContent + #{ImportWebsiteDialog.start} + + @@ -289,6 +300,7 @@ + diff --git a/source/java/org/alfresco/web/bean/wcm/ImportWebsiteDialog.java b/source/java/org/alfresco/web/bean/wcm/ImportWebsiteDialog.java index 8b4744a72e..d58ee2ae40 100644 --- a/source/java/org/alfresco/web/bean/wcm/ImportWebsiteDialog.java +++ b/source/java/org/alfresco/web/bean/wcm/ImportWebsiteDialog.java @@ -25,7 +25,6 @@ import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; -import java.text.DateFormat; import java.text.MessageFormat; import java.util.Enumeration; import java.util.zip.ZipException; @@ -37,7 +36,6 @@ import javax.transaction.UserTransaction; import org.alfresco.error.AlfrescoRuntimeException; import org.alfresco.model.ApplicationModel; import org.alfresco.model.ContentModel; -import org.alfresco.model.WCMAppModel; import org.alfresco.repo.avm.AVMNodeConverter; import org.alfresco.repo.domain.PropertyValue; import org.alfresco.service.ServiceRegistry; @@ -52,9 +50,8 @@ import org.alfresco.service.cmr.repository.NodeService; import org.alfresco.util.TempFileProvider; import org.alfresco.web.app.AlfrescoNavigationHandler; import org.alfresco.web.app.Application; +import org.alfresco.web.app.context.UIContextService; import org.alfresco.web.bean.FileUploadBean; -import org.alfresco.web.bean.NavigationBean; -import org.alfresco.web.bean.repository.Node; import org.alfresco.web.bean.repository.Repository; import org.alfresco.web.ui.common.Utils; import org.apache.tools.zip.ZipEntry; @@ -78,7 +75,6 @@ public class ImportWebsiteDialog protected FileFolderService fileFolderService; protected ContentService contentService; - protected NavigationBean navigationBean; protected AVMBrowseBean avmBrowseBean; protected AVMService avmService; protected NodeService nodeService; @@ -100,14 +96,6 @@ public class ImportWebsiteDialog this.fileFolderService = fileFolderService; } - /** - * @param navigationBean The NavigationBean to set. - */ - public void setNavigationBean(NavigationBean navigationBean) - { - this.navigationBean = navigationBean; - } - /** * @param avmBrowseBean The AVMBrowseBean to set. */ @@ -207,38 +195,25 @@ public class ImportWebsiteDialog tx = Repository.getUserTransaction(context); tx.begin(); - // TODO: explicit permission check for WRITE on website node for this user + // get the AVM path that will contain the imported content + String rootPath = this.avmBrowseBean.getCurrentPath(); - // import the content into the appropriate store for the website - Node website = this.navigationBean.getCurrentNode(); - String storeRoot = (String)website.getProperties().get(WCMAppModel.PROP_AVMSTORE); - String webapp = this.avmBrowseBean.getWebapp(); - if (storeRoot != null && webapp != null) - { - String store = AVMConstants.buildStagingStoreName(storeRoot); - if (this.avmService.getStore(store) != null) - { - // get the path to the root webapp import area of the store - String rootPath = AVMConstants.buildStoreWebappPath(store, webapp); - - // convert the AVM path to a NodeRef so we can use the NodeService to perform import - NodeRef importRef = AVMNodeConverter.ToNodeRef(-1, rootPath); - processZipImport(this.file, importRef); - - // After an import it's a good idea to snapshot the staging store - this.avmService.createSnapshot(store, "Import of file: " + this.fileName, null); - - // Reload virtualisation server as required - AVMConstants.updateVServerWebapp(rootPath, true); - } - } - else - { - throw new IllegalStateException("Unable to find root store/webapp property for website!"); - } + // convert the AVM path to a NodeRef so we can use the NodeService to perform import + NodeRef importRef = AVMNodeConverter.ToNodeRef(-1, rootPath); + processZipImport(this.file, importRef); + + // After a bulk import it's a good idea to snapshot the store + this.avmService.createSnapshot( + AVMConstants.getStoreName(rootPath), + "Import of file: " + this.fileName, null); + + // Reload virtualisation server as required + AVMConstants.updateVServerWebapp(rootPath, true); tx.commit(); + UIContextService.getInstance(context).notifyBeans(); + outcome = AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME; } catch (Throwable e) diff --git a/source/web/WEB-INF/faces-config-beans.xml b/source/web/WEB-INF/faces-config-beans.xml index 24cab98cbf..718e7e6f14 100644 --- a/source/web/WEB-INF/faces-config-beans.xml +++ b/source/web/WEB-INF/faces-config-beans.xml @@ -2288,10 +2288,6 @@ contentService #{ContentService} - - navigationBean - #{NavigationBean} - avmService #{AVMService} diff --git a/source/web/jsp/wcm/browse-sandbox.jsp b/source/web/jsp/wcm/browse-sandbox.jsp index 5ea7034afa..4fc5d61f64 100644 --- a/source/web/jsp/wcm/browse-sandbox.jsp +++ b/source/web/jsp/wcm/browse-sandbox.jsp @@ -78,7 +78,7 @@ - + <%-- Create actions menu --%> diff --git a/source/web/jsp/wcm/browse-website.jsp b/source/web/jsp/wcm/browse-website.jsp index 5464fba559..1d8fbf5cdf 100644 --- a/source/web/jsp/wcm/browse-website.jsp +++ b/source/web/jsp/wcm/browse-website.jsp @@ -74,7 +74,7 @@
- + <%-- More actions menu --%> @@ -82,14 +82,6 @@ - - - - <%-- Import website content action --%> - - - -