mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
. Staging area 'snapshot' action implemented in the UI
. List of Recent Snapshots component added to Staging area information table - TODO: finish implementing Revert to Snapshot action in the UI . Date filter UI implemented for recent snapshots (as there will be lots!) . Fixed issue with name/title confusion in FormsService.getForm(name) method . Added Default Webapp field to Create Web Project wizard and added to WCM model for a web project - TODO: implement this as default root path when browsing a sandbox git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@4413 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -187,6 +187,7 @@ raise_issue=Raise an Issue
|
|||||||
click_to_set_date=Click to set a date
|
click_to_set_date=Click to set a date
|
||||||
today=Today
|
today=Today
|
||||||
reset=Reset
|
reset=Reset
|
||||||
|
label=Label
|
||||||
|
|
||||||
# Properties
|
# Properties
|
||||||
username=User Name
|
username=User Name
|
||||||
@@ -813,6 +814,7 @@ create_website_step1_title=Step One - Web Project Details
|
|||||||
create_website_step1_desc=Enter the information about the web project.
|
create_website_step1_desc=Enter the information about the web project.
|
||||||
website_dnsname=DNS name
|
website_dnsname=DNS name
|
||||||
validation_invalid_dns_name=Invalid website DNS name, a minimum of 2 alpha-numeric characters are accepted.
|
validation_invalid_dns_name=Invalid website DNS name, a minimum of 2 alpha-numeric characters are accepted.
|
||||||
|
website_webapp=Default Webapp
|
||||||
website_selected_forms=Selected Web Content Forms
|
website_selected_forms=Selected Web Content Forms
|
||||||
website_save_location=Save Location
|
website_save_location=Save Location
|
||||||
website_save_location_info=Use the following pattern when saving content
|
website_save_location_info=Use the following pattern when saving content
|
||||||
@@ -895,6 +897,9 @@ folder_preview=Preview Folder
|
|||||||
file_preview=Preview File
|
file_preview=Preview File
|
||||||
selected=Selected
|
selected=Selected
|
||||||
create_form_content=Create Content
|
create_form_content=Create Content
|
||||||
|
recent_snapshots=Recent Snapshots
|
||||||
|
snapshot_revert=Revert
|
||||||
|
snapshot_preview=Preview
|
||||||
|
|
||||||
# Website actions and dialog messages
|
# Website actions and dialog messages
|
||||||
title_import_content=Import Content into Website
|
title_import_content=Import Content into Website
|
||||||
@@ -920,6 +925,10 @@ edit_file_description=Edit the properties of the file then click OK.
|
|||||||
edit_folder_properties=Edit Folder Properties
|
edit_folder_properties=Edit Folder Properties
|
||||||
edit_folder_description=Edit the properties of the folder then click OK.
|
edit_folder_description=Edit the properties of the folder then click OK.
|
||||||
folder_props=Folder Properties
|
folder_props=Folder Properties
|
||||||
|
snapshot_properties=Snapshot Properties
|
||||||
|
snapshot_label=Label
|
||||||
|
snapshot_success=Snapshot ''{0}'' created for sandbox: {1}
|
||||||
|
snapshot_failure=Snapshot not created - the sandbox has not been modified since the last snapshot.
|
||||||
|
|
||||||
# New User Wizard messages
|
# New User Wizard messages
|
||||||
new_user_title=New User Wizard
|
new_user_title=New User Wizard
|
||||||
|
@@ -33,6 +33,7 @@ import javax.transaction.UserTransaction;
|
|||||||
|
|
||||||
import org.alfresco.model.ContentModel;
|
import org.alfresco.model.ContentModel;
|
||||||
import org.alfresco.repo.avm.AVMNodeConverter;
|
import org.alfresco.repo.avm.AVMNodeConverter;
|
||||||
|
import org.alfresco.repo.avm.actions.AVMRevertStoreAction;
|
||||||
import org.alfresco.repo.avm.actions.AVMUndoSandboxListAction;
|
import org.alfresco.repo.avm.actions.AVMUndoSandboxListAction;
|
||||||
import org.alfresco.repo.avm.actions.SimpleAVMSubmitAction;
|
import org.alfresco.repo.avm.actions.SimpleAVMSubmitAction;
|
||||||
import org.alfresco.service.cmr.action.Action;
|
import org.alfresco.service.cmr.action.Action;
|
||||||
@@ -67,8 +68,10 @@ import org.alfresco.web.ui.common.Utils;
|
|||||||
import org.alfresco.web.ui.common.component.IBreadcrumbHandler;
|
import org.alfresco.web.ui.common.component.IBreadcrumbHandler;
|
||||||
import org.alfresco.web.ui.common.component.UIActionLink;
|
import org.alfresco.web.ui.common.component.UIActionLink;
|
||||||
import org.alfresco.web.ui.common.component.UIBreadcrumb;
|
import org.alfresco.web.ui.common.component.UIBreadcrumb;
|
||||||
|
import org.alfresco.web.ui.common.component.UIModeList;
|
||||||
import org.alfresco.web.ui.common.component.data.UIRichList;
|
import org.alfresco.web.ui.common.component.data.UIRichList;
|
||||||
import org.alfresco.web.ui.wcm.WebResources;
|
import org.alfresco.web.ui.wcm.WebResources;
|
||||||
|
import org.alfresco.web.ui.wcm.component.UISandboxSnapshots;
|
||||||
import org.alfresco.web.ui.wcm.component.UIUserSandboxes;
|
import org.alfresco.web.ui.wcm.component.UIUserSandboxes;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
@@ -97,9 +100,15 @@ public class AVMBrowseBean implements IContextListener
|
|||||||
/** Component id the status messages are tied too */
|
/** Component id the status messages are tied too */
|
||||||
private static final String COMPONENT_SANDBOXESPANEL = "sandboxes-panel";
|
private static final String COMPONENT_SANDBOXESPANEL = "sandboxes-panel";
|
||||||
|
|
||||||
|
/** Top-level JSF form ID */
|
||||||
|
private static final String FORM_ID = "browse-website";
|
||||||
|
|
||||||
/** Content Manager role name */
|
/** Content Manager role name */
|
||||||
private static final String ROLE_CONTENT_MANAGER = "ContentManager";
|
private static final String ROLE_CONTENT_MANAGER = "ContentManager";
|
||||||
|
|
||||||
|
/** Snapshot date filter selection */
|
||||||
|
private String snapshotDateFilter = UISandboxSnapshots.FILTER_DATE_TODAY;
|
||||||
|
|
||||||
private String sandbox;
|
private String sandbox;
|
||||||
private String username;
|
private String username;
|
||||||
private String sandboxTitle = null;
|
private String sandboxTitle = null;
|
||||||
@@ -436,6 +445,22 @@ public class AVMBrowseBean implements IContextListener
|
|||||||
this.sandboxTitle = sandboxTitle;
|
this.sandboxTitle = sandboxTitle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Returns the Snapshot Date Filter.
|
||||||
|
*/
|
||||||
|
public String getSnapshotDateFilter()
|
||||||
|
{
|
||||||
|
return this.snapshotDateFilter;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param snapshotDateFilter The Snapshot Date Filter to set.
|
||||||
|
*/
|
||||||
|
public void setSnapshotDateFilter(String snapshotDateFilter)
|
||||||
|
{
|
||||||
|
this.snapshotDateFilter = snapshotDateFilter;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return icon image for the appropriate sandbox type
|
* @return icon image for the appropriate sandbox type
|
||||||
*/
|
*/
|
||||||
@@ -665,6 +690,15 @@ public class AVMBrowseBean implements IContextListener
|
|||||||
updateUILocation(path);
|
updateUILocation(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Action handler called when the Snapshot Date filter is changed by the user
|
||||||
|
*/
|
||||||
|
public void snapshotDateFilterChanged(ActionEvent event)
|
||||||
|
{
|
||||||
|
UIModeList filterComponent = (UIModeList)event.getComponent();
|
||||||
|
setSnapshotDateFilter(filterComponent.getValue().toString());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Setup the context for a sandbox browse action
|
* Setup the context for a sandbox browse action
|
||||||
*/
|
*/
|
||||||
@@ -758,12 +792,9 @@ public class AVMBrowseBean implements IContextListener
|
|||||||
tx.commit();
|
tx.commit();
|
||||||
|
|
||||||
// if we get here, all was well - output friendly status message to the user
|
// if we get here, all was well - output friendly status message to the user
|
||||||
|
|
||||||
String msg = MessageFormat.format(Application.getMessage(
|
String msg = MessageFormat.format(Application.getMessage(
|
||||||
context, MSG_SUBMIT_SUCCESS), node.getName());
|
context, MSG_SUBMIT_SUCCESS), node.getName());
|
||||||
FacesMessage facesMsg = new FacesMessage(FacesMessage.SEVERITY_INFO, msg, msg);
|
displayStatusMessage(context, msg);
|
||||||
String formId = Utils.getParentForm(context, event.getComponent()).getClientId(context);
|
|
||||||
context.addMessage(formId + ':' + COMPONENT_SANDBOXESPANEL, facesMsg);
|
|
||||||
}
|
}
|
||||||
catch (Throwable err)
|
catch (Throwable err)
|
||||||
{
|
{
|
||||||
@@ -803,9 +834,7 @@ public class AVMBrowseBean implements IContextListener
|
|||||||
// if we get here, all was well - output friendly status message to the user
|
// if we get here, all was well - output friendly status message to the user
|
||||||
String msg = MessageFormat.format(Application.getMessage(
|
String msg = MessageFormat.format(Application.getMessage(
|
||||||
context, MSG_SUBMITALL_SUCCESS), username);
|
context, MSG_SUBMITALL_SUCCESS), username);
|
||||||
FacesMessage facesMsg = new FacesMessage(FacesMessage.SEVERITY_INFO, msg, msg);
|
displayStatusMessage(context, msg);
|
||||||
String formId = Utils.getParentForm(context, event.getComponent()).getClientId(context);
|
|
||||||
context.addMessage(formId + ':' + COMPONENT_SANDBOXESPANEL, facesMsg);
|
|
||||||
}
|
}
|
||||||
catch (Throwable err)
|
catch (Throwable err)
|
||||||
{
|
{
|
||||||
@@ -848,9 +877,7 @@ public class AVMBrowseBean implements IContextListener
|
|||||||
// TODO: different message once the submit screen is available
|
// TODO: different message once the submit screen is available
|
||||||
String msg = MessageFormat.format(Application.getMessage(
|
String msg = MessageFormat.format(Application.getMessage(
|
||||||
context, MSG_SUBMITSELECTED_SUCCESS), username);
|
context, MSG_SUBMITSELECTED_SUCCESS), username);
|
||||||
FacesMessage facesMsg = new FacesMessage(FacesMessage.SEVERITY_INFO, msg, msg);
|
displayStatusMessage(context, msg);
|
||||||
String formId = Utils.getParentForm(context, event.getComponent()).getClientId(context);
|
|
||||||
context.addMessage(formId + ':' + COMPONENT_SANDBOXESPANEL, facesMsg);
|
|
||||||
}
|
}
|
||||||
catch (Throwable err)
|
catch (Throwable err)
|
||||||
{
|
{
|
||||||
@@ -893,9 +920,7 @@ public class AVMBrowseBean implements IContextListener
|
|||||||
// if we get here, all was well - output friendly status message to the user
|
// if we get here, all was well - output friendly status message to the user
|
||||||
String msg = MessageFormat.format(Application.getMessage(
|
String msg = MessageFormat.format(Application.getMessage(
|
||||||
context, MSG_REVERT_SUCCESS), node.getName());
|
context, MSG_REVERT_SUCCESS), node.getName());
|
||||||
FacesMessage facesMsg = new FacesMessage(FacesMessage.SEVERITY_INFO, msg, msg);
|
displayStatusMessage(context, msg);
|
||||||
String formId = Utils.getParentForm(context, event.getComponent()).getClientId(context);
|
|
||||||
context.addMessage(formId + ':' + COMPONENT_SANDBOXESPANEL, facesMsg);
|
|
||||||
}
|
}
|
||||||
catch (Throwable err)
|
catch (Throwable err)
|
||||||
{
|
{
|
||||||
@@ -941,9 +966,7 @@ public class AVMBrowseBean implements IContextListener
|
|||||||
// if we get here, all was well - output friendly status message to the user
|
// if we get here, all was well - output friendly status message to the user
|
||||||
String msg = MessageFormat.format(Application.getMessage(
|
String msg = MessageFormat.format(Application.getMessage(
|
||||||
context, MSG_REVERTALL_SUCCESS), username);
|
context, MSG_REVERTALL_SUCCESS), username);
|
||||||
FacesMessage facesMsg = new FacesMessage(FacesMessage.SEVERITY_INFO, msg, msg);
|
displayStatusMessage(context, msg);
|
||||||
String formId = Utils.getParentForm(context, event.getComponent()).getClientId(context);
|
|
||||||
context.addMessage(formId + ':' + COMPONENT_SANDBOXESPANEL, facesMsg);
|
|
||||||
}
|
}
|
||||||
catch (Throwable err)
|
catch (Throwable err)
|
||||||
{
|
{
|
||||||
@@ -952,7 +975,7 @@ public class AVMBrowseBean implements IContextListener
|
|||||||
try { if (tx != null) {tx.rollback();} } catch (Exception tex) {}
|
try { if (tx != null) {tx.rollback();} } catch (Exception tex) {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Undo changes to items selected using multi-select
|
* Undo changes to items selected using multi-select
|
||||||
*/
|
*/
|
||||||
@@ -992,9 +1015,7 @@ public class AVMBrowseBean implements IContextListener
|
|||||||
// TODO: different message once the submit screen is available
|
// TODO: different message once the submit screen is available
|
||||||
String msg = MessageFormat.format(Application.getMessage(
|
String msg = MessageFormat.format(Application.getMessage(
|
||||||
context, MSG_REVERTSELECTED_SUCCESS), username);
|
context, MSG_REVERTSELECTED_SUCCESS), username);
|
||||||
FacesMessage facesMsg = new FacesMessage(FacesMessage.SEVERITY_INFO, msg, msg);
|
displayStatusMessage(context, msg);
|
||||||
String formId = Utils.getParentForm(context, event.getComponent()).getClientId(context);
|
|
||||||
context.addMessage(formId + ':' + COMPONENT_SANDBOXESPANEL, facesMsg);
|
|
||||||
}
|
}
|
||||||
catch (Throwable err)
|
catch (Throwable err)
|
||||||
{
|
{
|
||||||
@@ -1006,6 +1027,44 @@ public class AVMBrowseBean implements IContextListener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void revertSnapshot(ActionEvent event)
|
||||||
|
{
|
||||||
|
UIActionLink link = (UIActionLink)event.getComponent();
|
||||||
|
Map<String, String> params = link.getParameterMap();
|
||||||
|
String sandbox = params.get("sandbox");
|
||||||
|
String strVersion = params.get("version");
|
||||||
|
int version = Integer.valueOf(strVersion);
|
||||||
|
|
||||||
|
UserTransaction tx = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
FacesContext context = FacesContext.getCurrentInstance();
|
||||||
|
tx = Repository.getUserTransaction(context, false);
|
||||||
|
tx.begin();
|
||||||
|
|
||||||
|
Map<String, Serializable> args = new HashMap<String, Serializable>(1, 1.0f);
|
||||||
|
args.put(AVMRevertStoreAction.PARAM_VERSION, version);
|
||||||
|
Action action = this.actionService.createAction(AVMRevertStoreAction.NAME, args);
|
||||||
|
this.actionService.executeAction(action, AVMNodeConverter.ToNodeRef(-1, sandbox + ":/"));
|
||||||
|
|
||||||
|
// commit the transaction
|
||||||
|
tx.commit();
|
||||||
|
|
||||||
|
// if we get here, all was well - output friendly status message to the user
|
||||||
|
//String msg = MessageFormat.format(Application.getMessage(
|
||||||
|
// context, MSG_REVERT_SUCCESS), node.getName());
|
||||||
|
//displayStatusMessage(context, msg);
|
||||||
|
displayStatusMessage(context, "Reverted to version: " + version);
|
||||||
|
}
|
||||||
|
catch (Throwable err)
|
||||||
|
{
|
||||||
|
err.printStackTrace(System.err);
|
||||||
|
Utils.addErrorMessage(MessageFormat.format(Application.getMessage(
|
||||||
|
FacesContext.getCurrentInstance(), Repository.ERROR_GENERIC), err.getMessage()), err);
|
||||||
|
try { if (tx != null) {tx.rollback();} } catch (Exception tex) {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create web content from a specific Form via the User Sandbox 'Available Forms' panel
|
* Create web content from a specific Form via the User Sandbox 'Available Forms' panel
|
||||||
*/
|
*/
|
||||||
@@ -1026,6 +1085,18 @@ public class AVMBrowseBean implements IContextListener
|
|||||||
// ------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------
|
||||||
// Private helpers
|
// Private helpers
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display a status message to the user
|
||||||
|
*
|
||||||
|
* @param context
|
||||||
|
* @param msg Text message to display
|
||||||
|
*/
|
||||||
|
/*package*/ void displayStatusMessage(FacesContext context, String msg)
|
||||||
|
{
|
||||||
|
FacesMessage facesMsg = new FacesMessage(FacesMessage.SEVERITY_INFO, msg, msg);
|
||||||
|
context.addMessage(FORM_ID + ':' + COMPONENT_SANDBOXESPANEL, facesMsg);
|
||||||
|
}
|
||||||
|
|
||||||
/*package*/ boolean isCurrentPathNull()
|
/*package*/ boolean isCurrentPathNull()
|
||||||
{
|
{
|
||||||
return (this.currentPath == null);
|
return (this.currentPath == null);
|
||||||
|
@@ -190,7 +190,7 @@ public class CreateFormWizard
|
|||||||
props.put(ContentModel.PROP_TITLE, this.getFormTitle());
|
props.put(ContentModel.PROP_TITLE, this.getFormTitle());
|
||||||
props.put(ContentModel.PROP_DESCRIPTION, this.getFormDescription());
|
props.put(ContentModel.PROP_DESCRIPTION, this.getFormDescription());
|
||||||
this.nodeService.addAspect(folderInfo.getNodeRef(), ContentModel.ASPECT_TITLED, props);
|
this.nodeService.addAspect(folderInfo.getNodeRef(), ContentModel.ASPECT_TITLED, props);
|
||||||
|
|
||||||
props = new HashMap<QName, Serializable>(3, 1.0f);
|
props = new HashMap<QName, Serializable>(3, 1.0f);
|
||||||
props.put(WCMModel.PROP_XML_SCHEMA, fileInfo.getNodeRef());
|
props.put(WCMModel.PROP_XML_SCHEMA, fileInfo.getNodeRef());
|
||||||
props.put(WCMModel.PROP_XML_SCHEMA_ROOT_ELEMENT_NAME,
|
props.put(WCMModel.PROP_XML_SCHEMA_ROOT_ELEMENT_NAME,
|
||||||
|
@@ -293,7 +293,7 @@ public class CreateWebContentWizard extends BaseContentWizard
|
|||||||
Form form = FormsService.getInstance().getForm(formName);
|
Form form = FormsService.getInstance().getForm(formName);
|
||||||
if (form != null)
|
if (form != null)
|
||||||
{
|
{
|
||||||
items.add(new SelectItem(formName, formName));
|
items.add(new SelectItem(formName, form.getTitle()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -81,6 +81,8 @@ public class CreateWebsiteWizard extends BaseWizardBean
|
|||||||
private static final String MSG_NONE = "value_not_set";
|
private static final String MSG_NONE = "value_not_set";
|
||||||
|
|
||||||
private static final String ROLE_CONTENT_MANAGER = "ContentManager";
|
private static final String ROLE_CONTENT_MANAGER = "ContentManager";
|
||||||
|
|
||||||
|
private static final String WEBAPP_DEFAULT = "ROOT";
|
||||||
|
|
||||||
private static Log logger = LogFactory.getLog(CreateWebsiteWizard.class);
|
private static Log logger = LogFactory.getLog(CreateWebsiteWizard.class);
|
||||||
|
|
||||||
@@ -88,6 +90,7 @@ public class CreateWebsiteWizard extends BaseWizardBean
|
|||||||
protected String title;
|
protected String title;
|
||||||
protected String name;
|
protected String name;
|
||||||
protected String description;
|
protected String description;
|
||||||
|
protected String webapp = WEBAPP_DEFAULT;
|
||||||
|
|
||||||
private String websitesFolderId = null;
|
private String websitesFolderId = null;
|
||||||
|
|
||||||
@@ -170,6 +173,11 @@ public class CreateWebsiteWizard extends BaseWizardBean
|
|||||||
uiFacetsProps.put(ContentModel.PROP_DESCRIPTION, this.description);
|
uiFacetsProps.put(ContentModel.PROP_DESCRIPTION, this.description);
|
||||||
this.nodeService.addAspect(nodeRef, ContentModel.ASPECT_UIFACETS, uiFacetsProps);
|
this.nodeService.addAspect(nodeRef, ContentModel.ASPECT_UIFACETS, uiFacetsProps);
|
||||||
|
|
||||||
|
// set the default webapp name for the project
|
||||||
|
String webapp = (this.webapp != null && this.webapp.length() != 0) ? this.webapp : WEBAPP_DEFAULT;
|
||||||
|
this.nodeService.setProperty(nodeRef, ContentModel.PROP_DEFAULTWEBAPP, webapp);
|
||||||
|
|
||||||
|
// call the delegate wizard bean to provide invite user functionality
|
||||||
InviteWebsiteUsersWizard wiz = getInviteUsersWizard();
|
InviteWebsiteUsersWizard wiz = getInviteUsersWizard();
|
||||||
wiz.setNode(new Node(nodeRef));
|
wiz.setNode(new Node(nodeRef));
|
||||||
outcome = wiz.finish();
|
outcome = wiz.finish();
|
||||||
@@ -459,6 +467,22 @@ public class CreateWebsiteWizard extends BaseWizardBean
|
|||||||
this.description = description;
|
this.description = description;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the default webapp name for the project
|
||||||
|
*/
|
||||||
|
public String getWebapp()
|
||||||
|
{
|
||||||
|
return this.webapp;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param webapp The default webapp name for the project
|
||||||
|
*/
|
||||||
|
public void setWebapp(String webapp)
|
||||||
|
{
|
||||||
|
this.webapp = webapp;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return summary text for the wizard
|
* @return summary text for the wizard
|
||||||
*/
|
*/
|
||||||
|
@@ -213,8 +213,7 @@ public class ImportWebsiteDialog
|
|||||||
processZipImport(this.file, importRef);
|
processZipImport(this.file, importRef);
|
||||||
|
|
||||||
// After an import it's a good idea to snapshot the staging store
|
// After an import it's a good idea to snapshot the staging store
|
||||||
// TODO: Maybe a nice auto generated comment.
|
this.avmService.createSnapshot(store, "Import of file: " + this.fileName, null);
|
||||||
this.avmService.createSnapshot(store, null, null);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@@ -16,23 +16,35 @@
|
|||||||
*/
|
*/
|
||||||
package org.alfresco.web.bean.wcm;
|
package org.alfresco.web.bean.wcm;
|
||||||
|
|
||||||
|
import java.text.MessageFormat;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.faces.context.FacesContext;
|
import javax.faces.context.FacesContext;
|
||||||
|
|
||||||
import org.alfresco.service.cmr.avm.AVMService;
|
import org.alfresco.service.cmr.avm.AVMService;
|
||||||
|
import org.alfresco.web.app.Application;
|
||||||
import org.alfresco.web.bean.dialog.BaseDialogBean;
|
import org.alfresco.web.bean.dialog.BaseDialogBean;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Backing bean for the Snaphost Sandbox dialog.
|
||||||
|
*
|
||||||
* @author Kevin Roast
|
* @author Kevin Roast
|
||||||
*/
|
*/
|
||||||
public class SnapshotSandboxDialog extends BaseDialogBean
|
public class SnapshotSandboxDialog extends BaseDialogBean
|
||||||
{
|
{
|
||||||
private static final Log logger = LogFactory.getLog(SnapshotSandboxDialog.class);
|
private static final Log logger = LogFactory.getLog(SnapshotSandboxDialog.class);
|
||||||
|
|
||||||
|
private static final String MSG_SNAPSHOT_FAILURE = "snapshot_failure";
|
||||||
|
private static final String MSG_SNAPSHOT_SUCCESS = "snapshot_success";
|
||||||
|
|
||||||
protected AVMService avmService;
|
protected AVMService avmService;
|
||||||
protected AVMBrowseBean avmBrowseBean;
|
protected AVMBrowseBean avmBrowseBean;
|
||||||
|
|
||||||
|
private String label;
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param avmBrowseBean The avmBrowseBean to set.
|
* @param avmBrowseBean The avmBrowseBean to set.
|
||||||
@@ -50,13 +62,74 @@ public class SnapshotSandboxDialog extends BaseDialogBean
|
|||||||
this.avmService = avmService;
|
this.avmService = avmService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Returns the snapshot description.
|
||||||
|
*/
|
||||||
|
public String getDescription()
|
||||||
|
{
|
||||||
|
return this.description;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param description The snapshot description to set.
|
||||||
|
*/
|
||||||
|
public void setDescription(String description)
|
||||||
|
{
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Returns the snaphost label.
|
||||||
|
*/
|
||||||
|
public String getLabel()
|
||||||
|
{
|
||||||
|
return this.label;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param label The snapshot label to set.
|
||||||
|
*/
|
||||||
|
public void setLabel(String label)
|
||||||
|
{
|
||||||
|
this.label = label;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.alfresco.web.bean.dialog.BaseDialogBean#init(java.util.Map)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void init(Map<String, String> parameters)
|
||||||
|
{
|
||||||
|
super.init(parameters);
|
||||||
|
this.label = null;
|
||||||
|
this.description = null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.alfresco.web.bean.dialog.BaseDialogBean#finishImpl(javax.faces.context.FacesContext, java.lang.String)
|
* @see org.alfresco.web.bean.dialog.BaseDialogBean#finishImpl(javax.faces.context.FacesContext, java.lang.String)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected String finishImpl(FacesContext context, String outcome) throws Exception
|
protected String finishImpl(FacesContext context, String outcome) throws Exception
|
||||||
{
|
{
|
||||||
return null;
|
// find the previous version - to see if a snapshot was acutally performed
|
||||||
|
int oldVersion = this.avmService.getLatestSnapshotID(this.avmBrowseBean.getSandbox());
|
||||||
|
int version = this.avmService.createSnapshot(
|
||||||
|
this.avmBrowseBean.getSandbox(), this.label, this.description);
|
||||||
|
if (version > oldVersion)
|
||||||
|
{
|
||||||
|
// a new snapshot was created
|
||||||
|
String msg = MessageFormat.format(Application.getMessage(
|
||||||
|
context, MSG_SNAPSHOT_SUCCESS), this.label, this.avmBrowseBean.getSandbox());
|
||||||
|
this.avmBrowseBean.displayStatusMessage(context, msg);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// no changes had occured - no snapshot was required
|
||||||
|
String msg = Application.getMessage(context, MSG_SNAPSHOT_FAILURE);
|
||||||
|
this.avmBrowseBean.displayStatusMessage(context, msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
return outcome;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -233,7 +233,7 @@ public final class FormsService
|
|||||||
sp.addStore(Repository.getStoreRef());
|
sp.addStore(Repository.getStoreRef());
|
||||||
sp.setLanguage(SearchService.LANGUAGE_LUCENE);
|
sp.setLanguage(SearchService.LANGUAGE_LUCENE);
|
||||||
sp.setQuery("ASPECT:\"" + WCMModel.ASPECT_FORM +
|
sp.setQuery("ASPECT:\"" + WCMModel.ASPECT_FORM +
|
||||||
"\" AND @" + Repository.escapeQName(ContentModel.PROP_TITLE) +
|
"\" AND @" + Repository.escapeQName(ContentModel.PROP_NAME) +
|
||||||
":\"" + name + "\"");
|
":\"" + name + "\"");
|
||||||
if (LOGGER.isDebugEnabled())
|
if (LOGGER.isDebugEnabled())
|
||||||
LOGGER.debug("running query [" + sp.getQuery() + "]");
|
LOGGER.debug("running query [" + sp.getQuery() + "]");
|
||||||
@@ -242,14 +242,14 @@ public final class FormsService
|
|||||||
for (ResultSetRow row : rs)
|
for (ResultSetRow row : rs)
|
||||||
{
|
{
|
||||||
final NodeRef nr = row.getNodeRef();
|
final NodeRef nr = row.getNodeRef();
|
||||||
if (this.nodeService.getProperty(nr, ContentModel.PROP_TITLE).equals(name))
|
if (this.nodeService.getProperty(nr, ContentModel.PROP_NAME).equals(name))
|
||||||
{
|
{
|
||||||
result = nr;
|
result = nr;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (result == null && LOGGER.isDebugEnabled())
|
if (result == null && LOGGER.isDebugEnabled())
|
||||||
LOGGER.debug("unable to find tempalte type " + name);
|
LOGGER.debug("unable to find template type " + name);
|
||||||
return result != null ? this.getForm(result) : null;
|
return result != null ? this.getForm(result) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -0,0 +1,447 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005 Alfresco, Inc.
|
||||||
|
*
|
||||||
|
* Licensed under the Mozilla Public License version 1.1
|
||||||
|
* with a permitted attribution clause. You may obtain a
|
||||||
|
* copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.alfresco.org/legal/license.txt
|
||||||
|
*
|
||||||
|
* 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.alfresco.web.ui.wcm.component;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.text.DateFormat;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.ResourceBundle;
|
||||||
|
|
||||||
|
import javax.faces.component.UIComponent;
|
||||||
|
import javax.faces.component.UIParameter;
|
||||||
|
import javax.faces.context.FacesContext;
|
||||||
|
import javax.faces.context.ResponseWriter;
|
||||||
|
import javax.faces.el.ValueBinding;
|
||||||
|
import javax.transaction.UserTransaction;
|
||||||
|
|
||||||
|
import org.alfresco.service.cmr.avm.AVMService;
|
||||||
|
import org.alfresco.service.cmr.avm.VersionDescriptor;
|
||||||
|
import org.alfresco.web.app.Application;
|
||||||
|
import org.alfresco.web.bean.repository.Repository;
|
||||||
|
import org.alfresco.web.ui.common.ComponentConstants;
|
||||||
|
import org.alfresco.web.ui.common.ConstantMethodBinding;
|
||||||
|
import org.alfresco.web.ui.common.Utils;
|
||||||
|
import org.alfresco.web.ui.common.component.SelfRenderingComponent;
|
||||||
|
import org.alfresco.web.ui.common.component.UIActionLink;
|
||||||
|
import org.alfresco.web.ui.repo.component.UIActions;
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
import org.springframework.web.jsf.FacesContextUtils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Kevin Roast
|
||||||
|
*/
|
||||||
|
public class UISandboxSnapshots extends SelfRenderingComponent
|
||||||
|
{
|
||||||
|
private static Log logger = LogFactory.getLog(UISandboxSnapshots.class);
|
||||||
|
|
||||||
|
// snapshot date filters
|
||||||
|
public static final String FILTER_DATE_ALL = "all";
|
||||||
|
public static final String FILTER_DATE_TODAY = "today";
|
||||||
|
public static final String FILTER_DATE_WEEK = "week";
|
||||||
|
public static final String FILTER_DATE_MONTH = "month";
|
||||||
|
|
||||||
|
private static final String COMPONENT_ACTIONS = "org.alfresco.faces.Actions";
|
||||||
|
|
||||||
|
private static final String MSG_LABEL = "label";
|
||||||
|
private static final String MSG_DESCRIPTION = "description";
|
||||||
|
private static final String MSG_DATE = "date";
|
||||||
|
private static final String MSG_USERNAME = "username";
|
||||||
|
private static final String MSG_VERSION = "version";
|
||||||
|
private static final String MSG_ACTIONS = "actions";
|
||||||
|
|
||||||
|
/** sandbox to show snapshots for */
|
||||||
|
private String value;
|
||||||
|
|
||||||
|
/** date filter to use when listing snapshots */
|
||||||
|
private String dateFilter;
|
||||||
|
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------
|
||||||
|
// Component implementation
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see javax.faces.component.UIComponent#getFamily()
|
||||||
|
*/
|
||||||
|
public String getFamily()
|
||||||
|
{
|
||||||
|
return "org.alfresco.faces.SandboxSnapshots";
|
||||||
|
}
|
||||||
|
|
||||||
|
public void restoreState(FacesContext context, Object state)
|
||||||
|
{
|
||||||
|
Object values[] = (Object[])state;
|
||||||
|
// standard component attributes are restored by the super class
|
||||||
|
super.restoreState(context, values[0]);
|
||||||
|
this.value = (String)values[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object saveState(FacesContext context)
|
||||||
|
{
|
||||||
|
Object values[] = new Object[2];
|
||||||
|
// standard component attributes are saved by the super class
|
||||||
|
values[0] = super.saveState(context);
|
||||||
|
values[1] = this.value;
|
||||||
|
return values;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see javax.faces.component.UIComponentBase#getRendersChildren()
|
||||||
|
*/
|
||||||
|
public boolean getRendersChildren()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see javax.faces.component.UIComponentBase#encodeChildren(javax.faces.context.FacesContext)
|
||||||
|
*/
|
||||||
|
public void encodeChildren(FacesContext context) throws IOException
|
||||||
|
{
|
||||||
|
// the child components are rendered explicitly during the encodeBegin()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see javax.faces.component.UIComponentBase#encodeBegin(javax.faces.context.FacesContext)
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public void encodeBegin(FacesContext context) throws IOException
|
||||||
|
{
|
||||||
|
if (isRendered() == false)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ResponseWriter out = context.getResponseWriter();
|
||||||
|
|
||||||
|
ResourceBundle bundle = Application.getBundle(context);
|
||||||
|
DateFormat df = Utils.getDateTimeFormat(context);
|
||||||
|
AVMService avmService = getAVMService(context);
|
||||||
|
UserTransaction tx = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
tx = Repository.getUserTransaction(FacesContext.getCurrentInstance(), true);
|
||||||
|
tx.begin();
|
||||||
|
|
||||||
|
String sandbox = getValue();
|
||||||
|
if (sandbox == null)
|
||||||
|
{
|
||||||
|
throw new IllegalArgumentException("Sandbox must be specified.");
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: apply tag style - removed hardcoded
|
||||||
|
out.write("<table class='snapshotItemsList' cellspacing=2 cellpadding=1 border=0 width=100%>");
|
||||||
|
// header row
|
||||||
|
out.write("<tr align=left><th>");
|
||||||
|
out.write(bundle.getString(MSG_LABEL));
|
||||||
|
out.write("</th><th>");
|
||||||
|
out.write(bundle.getString(MSG_DESCRIPTION));
|
||||||
|
out.write("</th><th>");
|
||||||
|
out.write(bundle.getString(MSG_DATE));
|
||||||
|
out.write("</th><th>");
|
||||||
|
out.write(bundle.getString(MSG_USERNAME));
|
||||||
|
out.write("</th><th>");
|
||||||
|
out.write(bundle.getString(MSG_VERSION));
|
||||||
|
out.write("</th><th>");
|
||||||
|
out.write(bundle.getString(MSG_ACTIONS));
|
||||||
|
out.write("</th></tr>");
|
||||||
|
|
||||||
|
// get the list of snapshots we can potentially display
|
||||||
|
List<VersionDescriptor> versions;
|
||||||
|
String dateFilter = getDateFilter();
|
||||||
|
if (dateFilter == null || dateFilter.equals(FILTER_DATE_ALL))
|
||||||
|
{
|
||||||
|
versions = avmService.getAVMStoreVersions(sandbox);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Date toDate = new Date();
|
||||||
|
Date fromDate;
|
||||||
|
if (FILTER_DATE_TODAY.equals(dateFilter))
|
||||||
|
{
|
||||||
|
fromDate = new Date(toDate.getYear(), toDate.getMonth(), toDate.getDate(), 0, 0, 0);
|
||||||
|
}
|
||||||
|
else if (FILTER_DATE_WEEK.equals(dateFilter))
|
||||||
|
{
|
||||||
|
fromDate = new Date(toDate.getTime() - (1000L*60L*60L*24L*7L));
|
||||||
|
}
|
||||||
|
else if (FILTER_DATE_MONTH.equals(dateFilter))
|
||||||
|
{
|
||||||
|
fromDate = new Date(toDate.getTime() - (1000L*60L*60L*24L*30L));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new IllegalArgumentException("Unknown date filter mode: " + dateFilter);
|
||||||
|
}
|
||||||
|
versions = avmService.getAVMStoreVersions(sandbox, fromDate, toDate);
|
||||||
|
}
|
||||||
|
for (VersionDescriptor item : versions)
|
||||||
|
{
|
||||||
|
// only display snapshots with a valid tag - others are system generated snapshots
|
||||||
|
if (item.getTag() != null)
|
||||||
|
{
|
||||||
|
out.write("<tr><td>");
|
||||||
|
out.write(item.getTag());
|
||||||
|
out.write("</td><td>");
|
||||||
|
out.write(item.getDescription() != null ? item.getDescription() : "");
|
||||||
|
out.write("</td><td>");
|
||||||
|
out.write(df.format(new Date(item.getCreateDate())));
|
||||||
|
out.write("</td><td>");
|
||||||
|
out.write(item.getCreator());
|
||||||
|
out.write("</td><td>");
|
||||||
|
out.write(Integer.toString(item.getVersionID()));
|
||||||
|
out.write("</td><td><nobr>");
|
||||||
|
// actions for the item
|
||||||
|
Map<String, String> params = new HashMap<String, String>(2, 1.0f);
|
||||||
|
params.put("sandbox", sandbox);
|
||||||
|
params.put("version", Integer.toString(item.getVersionID()));
|
||||||
|
Utils.encodeRecursive(context, aquireAction(
|
||||||
|
context, sandbox, "snapshot_revert", null,
|
||||||
|
"#{AVMBrowseBean.revertSnapshot}", null, null, params));
|
||||||
|
out.write(" ");
|
||||||
|
Utils.encodeRecursive(context, aquireAction(
|
||||||
|
context, sandbox, "snapshot_preview", null,
|
||||||
|
null, null));
|
||||||
|
out.write(" ");
|
||||||
|
|
||||||
|
out.write("</nobr></td></tr>");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// end table
|
||||||
|
out.write("</table>");
|
||||||
|
|
||||||
|
tx.commit();
|
||||||
|
}
|
||||||
|
catch (Throwable err)
|
||||||
|
{
|
||||||
|
try { if (tx != null) {tx.rollback();} } catch (Exception tex) {}
|
||||||
|
throw new RuntimeException(err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Aquire a UIActionLink component for the specified action
|
||||||
|
*
|
||||||
|
* @param fc FacesContext
|
||||||
|
* @param sandbox Root sandbox name
|
||||||
|
* @param name Action name - will be used for I18N message lookup
|
||||||
|
* @param icon Icon to display for the action
|
||||||
|
* @param actionListener Actionlistener for the action
|
||||||
|
* @param outcome Navigation outcome for the action
|
||||||
|
*
|
||||||
|
* @return UIActionLink component
|
||||||
|
*/
|
||||||
|
private UIActionLink aquireAction(FacesContext fc, String sandbox, String name, String icon,
|
||||||
|
String actionListener, String outcome)
|
||||||
|
{
|
||||||
|
return aquireAction(fc, sandbox, name, icon, actionListener, outcome, null, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Aquire a UIActionLink component for the specified action
|
||||||
|
*
|
||||||
|
* @param fc FacesContext
|
||||||
|
* @param sandbox Root sandbox name
|
||||||
|
* @param name Action name - will be used for I18N message lookup
|
||||||
|
* @param icon Icon to display for the action
|
||||||
|
* @param actionListener Actionlistener for the action
|
||||||
|
* @param outcome Navigation outcome for the action
|
||||||
|
* @param url HREF URL for the action
|
||||||
|
* @param params Parameters name/values for the action listener args
|
||||||
|
*
|
||||||
|
* @return UIActionLink component
|
||||||
|
*/
|
||||||
|
private UIActionLink aquireAction(FacesContext fc, String sandbox, String name, String icon,
|
||||||
|
String actionListener, String outcome, String url, Map<String, String> params)
|
||||||
|
{
|
||||||
|
UIActionLink action = findAction(name, sandbox);
|
||||||
|
if (action == null)
|
||||||
|
{
|
||||||
|
action = createAction(fc, sandbox, name, icon, actionListener, outcome, url, params);
|
||||||
|
}
|
||||||
|
return action;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Locate a child UIActionLink component by name.
|
||||||
|
*
|
||||||
|
* @param name Of the action component to find
|
||||||
|
* @param sandbox Sandbox the action component is tied to
|
||||||
|
*
|
||||||
|
* @return UIActionLink component if found, else null if not created yet
|
||||||
|
*/
|
||||||
|
private UIActionLink findAction(String name, String sandbox)
|
||||||
|
{
|
||||||
|
UIActionLink action = null;
|
||||||
|
String actionId = name + '_' + sandbox;
|
||||||
|
if (logger.isDebugEnabled())
|
||||||
|
logger.debug("Finding action Id: " + actionId);
|
||||||
|
for (UIComponent component : (List<UIComponent>)getChildren())
|
||||||
|
{
|
||||||
|
if (actionId.equals(component.getId()))
|
||||||
|
{
|
||||||
|
action = (UIActionLink)component;
|
||||||
|
if (logger.isDebugEnabled())
|
||||||
|
logger.debug("...found action Id: " + actionId);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return action;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a UIActionLink child component.
|
||||||
|
*
|
||||||
|
* @param fc FacesContext
|
||||||
|
* @param sandbox Root sandbox name
|
||||||
|
* @param name Action name - will be used for I18N message lookup
|
||||||
|
* @param icon Icon to display for the actio n
|
||||||
|
* @param actionListener Actionlistener for the action
|
||||||
|
* @param outcome Navigation outcome for the action
|
||||||
|
* @param url HREF URL for the action
|
||||||
|
* @param params Parameters name/values for the action listener args
|
||||||
|
*
|
||||||
|
* @return UIActionLink child component
|
||||||
|
*/
|
||||||
|
private UIActionLink createAction(FacesContext fc, String sandbox, String name, String icon,
|
||||||
|
String actionListener, String outcome, String url, Map<String, String> params)
|
||||||
|
{
|
||||||
|
javax.faces.application.Application facesApp = fc.getApplication();
|
||||||
|
UIActionLink control = (UIActionLink)facesApp.createComponent(UIActions.COMPONENT_ACTIONLINK);
|
||||||
|
|
||||||
|
String id = name + '_' + sandbox;
|
||||||
|
if (logger.isDebugEnabled())
|
||||||
|
logger.debug("...creating action Id: " + id);
|
||||||
|
control.setRendererType(UIActions.RENDERER_ACTIONLINK);
|
||||||
|
control.setId(id);
|
||||||
|
control.setValue(Application.getMessage(fc, name));
|
||||||
|
control.setShowLink(icon != null ? false : true);
|
||||||
|
control.setImage(icon);
|
||||||
|
|
||||||
|
if (actionListener != null)
|
||||||
|
{
|
||||||
|
control.setActionListener(facesApp.createMethodBinding(
|
||||||
|
actionListener, UIActions.ACTION_CLASS_ARGS));
|
||||||
|
|
||||||
|
// add sandbox as the default action listener parameter
|
||||||
|
if (params == null)
|
||||||
|
{
|
||||||
|
UIParameter param = (UIParameter)facesApp.createComponent(ComponentConstants.JAVAX_FACES_PARAMETER);
|
||||||
|
param.setId(id + "_1");
|
||||||
|
param.setName("sandbox");
|
||||||
|
param.setValue(sandbox);
|
||||||
|
control.getChildren().add(param);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// if a specific set of parameters are supplied, then add them instead
|
||||||
|
int idIndex = 1;
|
||||||
|
for (String key : params.keySet())
|
||||||
|
{
|
||||||
|
UIParameter param = (UIParameter)facesApp.createComponent(ComponentConstants.JAVAX_FACES_PARAMETER);
|
||||||
|
param.setId(id + '_' + Integer.toString(idIndex++));
|
||||||
|
param.setName(key);
|
||||||
|
String value = params.get(key);
|
||||||
|
if (value.startsWith("#{") == true)
|
||||||
|
{
|
||||||
|
ValueBinding vb = facesApp.createValueBinding(value);
|
||||||
|
param.setValueBinding("value", vb);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
param.setValue(params.get(key));
|
||||||
|
}
|
||||||
|
control.getChildren().add(param);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (outcome != null)
|
||||||
|
{
|
||||||
|
control.setAction(new ConstantMethodBinding(outcome));
|
||||||
|
}
|
||||||
|
if (url != null)
|
||||||
|
{
|
||||||
|
control.setHref(url);
|
||||||
|
control.setTarget("new");
|
||||||
|
}
|
||||||
|
|
||||||
|
this.getChildren().add(control);
|
||||||
|
|
||||||
|
return control;
|
||||||
|
}
|
||||||
|
|
||||||
|
private AVMService getAVMService(FacesContext fc)
|
||||||
|
{
|
||||||
|
return (AVMService)FacesContextUtils.getRequiredWebApplicationContext(fc).getBean("AVMService");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------
|
||||||
|
// Strongly typed component property accessors
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the Sandbox to show the snapshots for
|
||||||
|
*
|
||||||
|
* @return The Sandbox name
|
||||||
|
*/
|
||||||
|
public String getValue()
|
||||||
|
{
|
||||||
|
ValueBinding vb = getValueBinding("value");
|
||||||
|
if (vb != null)
|
||||||
|
{
|
||||||
|
this.value = (String)vb.getValue(getFacesContext());
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the Sandbox to show the snapshots for
|
||||||
|
*
|
||||||
|
* @param value The Sandbox name
|
||||||
|
*/
|
||||||
|
public void setValue(String value)
|
||||||
|
{
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Returns the date filter.
|
||||||
|
*/
|
||||||
|
public String getDateFilter()
|
||||||
|
{
|
||||||
|
ValueBinding vb = getValueBinding("dateFilter");
|
||||||
|
if (vb != null)
|
||||||
|
{
|
||||||
|
this.dateFilter = (String)vb.getValue(getFacesContext());
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.dateFilter;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param dateFilter The date filter to set.
|
||||||
|
*/
|
||||||
|
public void setDateFilter(String dateFilter)
|
||||||
|
{
|
||||||
|
this.dateFilter = dateFilter;
|
||||||
|
}
|
||||||
|
}
|
@@ -452,6 +452,7 @@ public class UIUserSandboxes extends SelfRenderingComponent
|
|||||||
this.userNodes.put(username, nodes);
|
this.userNodes.put(username, nodes);
|
||||||
|
|
||||||
// output the table of modified items
|
// output the table of modified items
|
||||||
|
// TODO: apply tag style - removed hardcoded
|
||||||
out.write("<table class='modifiedItemsList' cellspacing=2 cellpadding=1 border=0 width=100%>");
|
out.write("<table class='modifiedItemsList' cellspacing=2 cellpadding=1 border=0 width=100%>");
|
||||||
|
|
||||||
// header row
|
// header row
|
||||||
@@ -665,6 +666,7 @@ public class UIUserSandboxes extends SelfRenderingComponent
|
|||||||
ResourceBundle bundle = Application.getBundle(fc);
|
ResourceBundle bundle = Application.getBundle(fc);
|
||||||
|
|
||||||
// output the table of available forms
|
// output the table of available forms
|
||||||
|
// TODO: apply tag style - removed hardcoded
|
||||||
out.write("<table class='modifiedItemsList' cellspacing=2 cellpadding=1 border=0 width=100%>");
|
out.write("<table class='modifiedItemsList' cellspacing=2 cellpadding=1 border=0 width=100%>");
|
||||||
|
|
||||||
// header row
|
// header row
|
||||||
@@ -800,7 +802,7 @@ public class UIUserSandboxes extends SelfRenderingComponent
|
|||||||
UIActionLink action = findAction(name, store);
|
UIActionLink action = findAction(name, store);
|
||||||
if (action == null)
|
if (action == null)
|
||||||
{
|
{
|
||||||
action = createAction(fc, store, username, name, icon, actionListener, outcome, null, null);
|
action = createAction(fc, store, username, name, icon, actionListener, outcome, url, params);
|
||||||
}
|
}
|
||||||
return action;
|
return action;
|
||||||
}
|
}
|
||||||
@@ -860,7 +862,7 @@ public class UIUserSandboxes extends SelfRenderingComponent
|
|||||||
control.setRendererType(UIActions.RENDERER_ACTIONLINK);
|
control.setRendererType(UIActions.RENDERER_ACTIONLINK);
|
||||||
control.setId(id);
|
control.setId(id);
|
||||||
control.setValue(Application.getMessage(fc, name));
|
control.setValue(Application.getMessage(fc, name));
|
||||||
control.setShowLink(false);
|
control.setShowLink(icon != null ? false : true);
|
||||||
control.setImage(icon);
|
control.setImage(icon);
|
||||||
|
|
||||||
if (actionListener != null)
|
if (actionListener != null)
|
||||||
|
@@ -0,0 +1,91 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005 Alfresco, Inc.
|
||||||
|
*
|
||||||
|
* Licensed under the Mozilla Public License version 1.1
|
||||||
|
* with a permitted attribution clause. You may obtain a
|
||||||
|
* copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.alfresco.org/legal/license.txt
|
||||||
|
*
|
||||||
|
* 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.alfresco.web.ui.wcm.tag;
|
||||||
|
|
||||||
|
import javax.faces.component.UIComponent;
|
||||||
|
|
||||||
|
import org.alfresco.web.ui.common.tag.BaseComponentTag;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Kevin Roast
|
||||||
|
*/
|
||||||
|
public class SandboxSnapshotsTag extends BaseComponentTag
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @see javax.faces.webapp.UIComponentTag#getComponentType()
|
||||||
|
*/
|
||||||
|
public String getComponentType()
|
||||||
|
{
|
||||||
|
return "org.alfresco.faces.SandboxSnapshots";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see javax.faces.webapp.UIComponentTag#getRendererType()
|
||||||
|
*/
|
||||||
|
public String getRendererType()
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see javax.faces.webapp.UIComponentTag#setProperties(javax.faces.component.UIComponent)
|
||||||
|
*/
|
||||||
|
protected void setProperties(UIComponent component)
|
||||||
|
{
|
||||||
|
super.setProperties(component);
|
||||||
|
|
||||||
|
setStringProperty(component, "value", this.value);
|
||||||
|
setStringProperty(component, "dateFilter", this.dateFilter);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.alfresco.web.ui.common.tag.HtmlComponentTag#release()
|
||||||
|
*/
|
||||||
|
public void release()
|
||||||
|
{
|
||||||
|
super.release();
|
||||||
|
this.value = null;
|
||||||
|
this.dateFilter = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the value (sandbox to display snapshots for)
|
||||||
|
*
|
||||||
|
* @param value the value
|
||||||
|
*/
|
||||||
|
public void setValue(String value)
|
||||||
|
{
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the dateFilter
|
||||||
|
*
|
||||||
|
* @param dateFilter the dateFilter
|
||||||
|
*/
|
||||||
|
public void setDateFilter(String dateFilter)
|
||||||
|
{
|
||||||
|
this.dateFilter = dateFilter;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** the dateFilter */
|
||||||
|
private String dateFilter;
|
||||||
|
|
||||||
|
/** the value (sandbox to display snapshots for) */
|
||||||
|
private String value;
|
||||||
|
}
|
@@ -8,10 +8,15 @@
|
|||||||
<component-type>org.alfresco.faces.UserSandboxes</component-type>
|
<component-type>org.alfresco.faces.UserSandboxes</component-type>
|
||||||
<component-class>org.alfresco.web.ui.wcm.component.UIUserSandboxes</component-class>
|
<component-class>org.alfresco.web.ui.wcm.component.UIUserSandboxes</component-class>
|
||||||
</component>
|
</component>
|
||||||
|
|
||||||
|
<component>
|
||||||
|
<component-type>org.alfresco.faces.UserSandboxes</component-type>
|
||||||
|
<component-class>org.alfresco.web.ui.wcm.component.UIUserSandboxes</component-class>
|
||||||
|
</component>
|
||||||
|
|
||||||
<component>
|
<component>
|
||||||
<component-type>org.alfresco.faces.FormProcessor</component-type>
|
<component-type>org.alfresco.faces.SandboxSnapshots</component-type>
|
||||||
<component-class>org.alfresco.web.ui.wcm.component.UIFormProcessor</component-class>
|
<component-class>org.alfresco.web.ui.wcm.component.UISandboxSnapshots</component-class>
|
||||||
</component>
|
</component>
|
||||||
|
|
||||||
|
|
||||||
|
@@ -43,6 +43,47 @@
|
|||||||
<rtexprvalue>true</rtexprvalue>
|
<rtexprvalue>true</rtexprvalue>
|
||||||
</attribute>
|
</attribute>
|
||||||
</tag>
|
</tag>
|
||||||
|
|
||||||
|
<tag>
|
||||||
|
<name>sandboxSnapshots</name>
|
||||||
|
<tag-class>org.alfresco.web.ui.wcm.tag.SandboxSnapshotsTag</tag-class>
|
||||||
|
<body-content>JSP</body-content>
|
||||||
|
<display-name>Sandbox Snapshots List</display-name>
|
||||||
|
<description>Displays the list of snapshots for a sandbox</description>
|
||||||
|
|
||||||
|
<attribute>
|
||||||
|
<name>id</name>
|
||||||
|
<required>false</required>
|
||||||
|
<rtexprvalue>true</rtexprvalue>
|
||||||
|
<description>The component identifier for this component</description>
|
||||||
|
</attribute>
|
||||||
|
|
||||||
|
<attribute>
|
||||||
|
<name>value</name>
|
||||||
|
<required>true</required>
|
||||||
|
<rtexprvalue>true</rtexprvalue>
|
||||||
|
<description>The sandbox to show the list of snapshots for</description>
|
||||||
|
</attribute>
|
||||||
|
|
||||||
|
<attribute>
|
||||||
|
<name>binding</name>
|
||||||
|
<required>false</required>
|
||||||
|
<rtexprvalue>true</rtexprvalue>
|
||||||
|
<description>The value binding expression linking this component to a property in a backing bean</description>
|
||||||
|
</attribute>
|
||||||
|
|
||||||
|
<attribute>
|
||||||
|
<name>rendered</name>
|
||||||
|
<required>false</required>
|
||||||
|
<rtexprvalue>true</rtexprvalue>
|
||||||
|
</attribute>
|
||||||
|
|
||||||
|
<attribute>
|
||||||
|
<name>dateFilter</name>
|
||||||
|
<required>false</required>
|
||||||
|
<rtexprvalue>true</rtexprvalue>
|
||||||
|
</attribute>
|
||||||
|
</tag>
|
||||||
|
|
||||||
<tag>
|
<tag>
|
||||||
<name>formProcessor</name>
|
<name>formProcessor</name>
|
||||||
|
@@ -581,3 +581,11 @@ a.topToolbarLinkHighlight, a.topToolbarLinkHighlight:link, a.topToolbarLinkHighl
|
|||||||
border-style: solid;
|
border-style: solid;
|
||||||
border-color: #DDDDDD;
|
border-color: #DDDDDD;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.snapshotItemsList
|
||||||
|
{
|
||||||
|
background-color: #c6d8eb;
|
||||||
|
border-width: 1px;
|
||||||
|
border-style: solid;
|
||||||
|
border-color: #999999;
|
||||||
|
}
|
||||||
|
@@ -112,8 +112,38 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td></td>
|
<td></td>
|
||||||
<td colspan=2 style='line-height:6px'>
|
<td colspan=2>
|
||||||
<h:outputText value="#{AVMBrowseBean.stagingSummary}" escape="false" />
|
<div style='line-height:6px'>
|
||||||
|
<h:outputText value="#{AVMBrowseBean.stagingSummary}" escape="false" />
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td></td>
|
||||||
|
<td colspan=2>
|
||||||
|
<a:panel id="snapshots-panel" rendered="#{AVMBrowseBean.isManagerRole}" label="#{msg.recent_snapshots}"
|
||||||
|
progressive="true" expanded="false" styleClass="mainSubTitle">
|
||||||
|
<div style='padding-left:16px;padding-top:8px;padding-bottom:4px'>
|
||||||
|
<%-- Sandbox snapshots list --%>
|
||||||
|
<table cellspacing=2 cellpadding=0 width=100% class="snapshotItemsList">
|
||||||
|
<tr>
|
||||||
|
<td><img src="<%=request.getContextPath()%>/images/icons/filter.gif" width=16 height=16></td>
|
||||||
|
<td style="padding-left:8px;width:120px"><nobr><h:outputText id="msg-date" value="#{msg.date_filter_when}" />:</nobr></td>
|
||||||
|
<td width=100%>
|
||||||
|
<a:modeList id="snap-filter" itemSpacing="2" iconColumnWidth="0" horizontal="true" selectedLinkStyle="font-weight:bold"
|
||||||
|
value="#{AVMBrowseBean.snapshotDateFilter}" actionListener="#{AVMBrowseBean.snapshotDateFilterChanged}">
|
||||||
|
<a:listItem id="f1" value="all" label="#{msg.date_filter_all}" />
|
||||||
|
<a:listItem id="f2" value="today" label="#{msg.date_filter_today}" />
|
||||||
|
<a:listItem id="f3" value="week" label="#{msg.date_filter_week}" />
|
||||||
|
<a:listItem id="f4" value="month" label="#{msg.date_filter_month}" />
|
||||||
|
</a:modeList>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<div style='padding:2px'></div>
|
||||||
|
<w:sandboxSnapshots id="snapshots" value="#{AVMBrowseBean.stagingStore}" dateFilter="#{AVMBrowseBean.snapshotDateFilter}" />
|
||||||
|
</div>
|
||||||
|
</a:panel>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
@@ -120,6 +120,19 @@
|
|||||||
<f:verbatim>
|
<f:verbatim>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td></td>
|
||||||
|
<td>
|
||||||
|
</f:verbatim>
|
||||||
|
<h:outputText value="#{msg.website_webapp}:"/>
|
||||||
|
<f:verbatim>
|
||||||
|
</td>
|
||||||
|
<td width="85%">
|
||||||
|
</f:verbatim>
|
||||||
|
<h:inputText id="webapp" value="#{WizardManager.bean.webapp}" size="35" maxlength="256" />
|
||||||
|
<f:verbatim>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td></td>
|
<td></td>
|
||||||
<td>
|
<td>
|
||||||
|
@@ -18,3 +18,47 @@
|
|||||||
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
|
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
|
||||||
<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %>
|
<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %>
|
||||||
<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %>
|
<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %>
|
||||||
|
|
||||||
|
<f:verbatim>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
window.onload = pageLoaded;
|
||||||
|
|
||||||
|
function pageLoaded()
|
||||||
|
{
|
||||||
|
document.getElementById("dialog:dialog-body:label").focus();
|
||||||
|
checkButtonState();
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkButtonState()
|
||||||
|
{
|
||||||
|
if (document.getElementById("dialog:dialog-body:label").value.length == 0)
|
||||||
|
{
|
||||||
|
document.getElementById("dialog:finish-button").disabled = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
document.getElementById("dialog:finish-button").disabled = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</f:verbatim>
|
||||||
|
|
||||||
|
<h:panelGrid columns="1" cellpadding="2" style="padding-top: 4px; padding-bottom: 4px;"
|
||||||
|
width="100%" rowClasses="wizardSectionHeading">
|
||||||
|
<h:outputText value=" #{msg.snapshot_properties}" escape="false" />
|
||||||
|
</h:panelGrid>
|
||||||
|
|
||||||
|
<h:panelGrid columns="3" cellpadding="3" cellspacing="3" border="0">
|
||||||
|
<h:graphicImage value="/images/icons/required_field.gif" alt="Required Field" />
|
||||||
|
<h:outputText value="#{msg.snapshot_label}:"/>
|
||||||
|
<h:inputText id="label" value="#{DialogManager.bean.label}"
|
||||||
|
maxlength="256" size="35"
|
||||||
|
onkeyup="checkButtonState();"
|
||||||
|
onchange="checkButtonState();" />
|
||||||
|
|
||||||
|
<f:verbatim />
|
||||||
|
<h:outputText value="#{msg.description}:"/>
|
||||||
|
<h:inputText id="desc" value="#{DialogManager.bean.description}"
|
||||||
|
maxlength="1024" size="35" />
|
||||||
|
</h:panelGrid>
|
||||||
|
Reference in New Issue
Block a user