Merged V3.2 to HEAD

15642: Merged V3.1 to V3.2
      15376: ETHREEOH-255: missing email template dependencies that were stopping a cold bootstrap from working


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@15801 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Dave Ward
2009-08-18 18:02:23 +00:00
parent cb4ce6b652
commit f73c72d424
10 changed files with 183 additions and 7 deletions

View File

@@ -6,8 +6,8 @@ You can view the space through the Alfresco client:
<#assign ref=space.nodeRef> <#assign ref=space.nodeRef>
<#assign workspace=ref[0..ref?index_of("://")-1]> <#assign workspace=ref[0..ref?index_of("://")-1]>
<#assign storenode=ref[ref?index_of("://")+3..]> <#assign storenode=ref[ref?index_of("://")+3..]>
http://${url.context}/alfresco/navigate/browse/${workspace}/${storenode} ${url.serverPath}/alfresco/navigate/browse/${workspace}/${storenode}
Regards Regards
Alfresco Alfresco

View File

@@ -1,14 +1,14 @@
A new document '${document.name}', is available in the '${space.name}' space, it was added by ${person.properties.firstName}<#if person.properties.lastName?exists> ${person.properties.lastName}</#if>. A new document '${document.name}', is available in the '${space.name}' space, it was added by ${person.properties.firstName}<#if person.properties.lastName?exists> ${person.properties.lastName}</#if>.
You can view it through this link: You can view it through this link:
http://${url.context}/alfresco${document.url} ${url.serverPath}/alfresco${document.url}
Or through the Alfresco client: Or through the Alfresco client:
<#assign ref=space.nodeRef> <#assign ref=space.nodeRef>
<#assign workspace=ref[0..ref?index_of("://")-1]> <#assign workspace=ref[0..ref?index_of("://")-1]>
<#assign storenode=ref[ref?index_of("://")+3..]> <#assign storenode=ref[ref?index_of("://")+3..]>
http://${url.context}/alfresco/navigate/browse/${workspace}/${storenode} ${url.serverPath}/alfresco/navigate/browse/${workspace}/${storenode}
Regards Regards
Alfresco Alfresco

View File

@@ -86,6 +86,8 @@ public class Application
private static String spaceTemplatesFolderName; private static String spaceTemplatesFolderName;
private static String contentTemplatesFolderName; private static String contentTemplatesFolderName;
private static String emailTemplatesFolderName; private static String emailTemplatesFolderName;
private static String inviteEmailTemplatesFolderName;
private static String notifyEmailTemplatesFolderName;
private static String rssTemplatesFolderName; private static String rssTemplatesFolderName;
private static String savedSearchesFolderName; private static String savedSearchesFolderName;
private static String scriptsFolderName; private static String scriptsFolderName;
@@ -432,6 +434,38 @@ public class Application
} }
/** /**
* @return Returns the Invite Email Templates folder name
*/
public static String getInviteEmailTemplatesFolderName(ServletContext context)
{
return getInviteEmailTemplatesFolderName(WebApplicationContextUtils.getRequiredWebApplicationContext(context));
}
/**
* @return Returns the Invite Email Templates folder name
*/
public static String getInviteEmailTemplatesFolderName(FacesContext context)
{
return getInviteEmailTemplatesFolderName(FacesContextUtils.getRequiredWebApplicationContext(context));
}
/**
* @return Returns the Notify Email Templates folder name
*/
public static String getNotifyEmailTemplatesFolderName(ServletContext context)
{
return getNotifyEmailTemplatesFolderName(WebApplicationContextUtils.getRequiredWebApplicationContext(context));
}
/**
* @return Returns the Notify Email Templates folder name
*/
public static String getNotifyEmailTemplatesFolderName(FacesContext context)
{
return getNotifyEmailTemplatesFolderName(FacesContextUtils.getRequiredWebApplicationContext(context));
}
/**
* @return Returns the Email templates folder name * @return Returns the Email templates folder name
*/ */
public static String getEmailTemplatesFolderName(ServletContext context) public static String getEmailTemplatesFolderName(ServletContext context)
@@ -995,6 +1029,42 @@ public class Application
} }
/** /**
* Returns the Invite Email Templates folder name
*
* @param context The spring context
* @return The invite email folder name
*/
private static String getInviteEmailTemplatesFolderName(WebApplicationContext context)
{
if (inviteEmailTemplatesFolderName == null)
{
ImporterBootstrap bootstrap = (ImporterBootstrap) context.getBean(BEAN_IMPORTER_BOOTSTRAP);
Properties configuration = bootstrap.getConfiguration();
inviteEmailTemplatesFolderName = configuration.getProperty("spaces.templates.email.invite1.childname");
}
return inviteEmailTemplatesFolderName;
}
/**
* Returns the Notify Email Templates folder name
*
* @param context The spring context
* @return The notify email folder name
*/
private static String getNotifyEmailTemplatesFolderName(WebApplicationContext context)
{
if (notifyEmailTemplatesFolderName == null)
{
ImporterBootstrap bootstrap = (ImporterBootstrap) context.getBean(BEAN_IMPORTER_BOOTSTRAP);
Properties configuration = bootstrap.getConfiguration();
notifyEmailTemplatesFolderName = configuration.getProperty("spaces.templates.email.notify.childname");
}
return notifyEmailTemplatesFolderName;
}
/**
* Returns the RSS Templates folder name * Returns the RSS Templates folder name
* *
* @param context The spring context * @param context The spring context

View File

@@ -149,6 +149,17 @@ public class TemplateMailHelperBean implements Serializable
// object to allow client urls to be generated in emails // object to allow client urls to be generated in emails
model.put("url", new BaseTemplateContentServlet.URLHelper(fc)); model.put("url", new BaseTemplateContentServlet.URLHelper(fc));
model.put("document", node);
if (nodeService.getType(node).equals(ContentModel.TYPE_CONTENT))
{
NodeRef parentNodeRef = nodeService.getParentAssocs(node).get(0).getParentRef();
if (parentNodeRef == null)
{
throw new IllegalArgumentException("Parent folder doesn't exists for node: " + node);
}
model.put("space", parentNodeRef);
}
body = services.getTemplateService().processTemplate("freemarker", templateRef.toString(), model); body = services.getTemplateService().processTemplate("freemarker", templateRef.toString(), model);
} }
this.finalBody = body; this.finalBody = body;

View File

@@ -26,6 +26,9 @@ package org.alfresco.web.bean.content;
import java.util.Set; import java.util.Set;
import javax.faces.context.FacesContext;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.repository.Node; import org.alfresco.web.bean.repository.Node;
import org.alfresco.web.bean.wizard.BaseInviteUsersWizard; import org.alfresco.web.bean.wizard.BaseInviteUsersWizard;
@@ -57,4 +60,15 @@ public class InviteContentUsersWizard extends BaseInviteUsersWizard
{ {
return this.browseBean.getDocument(); return this.browseBean.getDocument();
} }
@Override
protected String getEmailTemplateXPath()
{
FacesContext fc = FacesContext.getCurrentInstance();
String xpath = Application.getRootPath(fc) + "/" +
Application.getGlossaryFolderName(fc) + "/" +
Application.getEmailTemplatesFolderName(fc) + "/" +
Application.getNotifyEmailTemplatesFolderName(fc) + "//*";
return xpath;
}
} }

View File

@@ -26,6 +26,9 @@ package org.alfresco.web.bean.spaces;
import java.util.Set; import java.util.Set;
import javax.faces.context.FacesContext;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.repository.Node; import org.alfresco.web.bean.repository.Node;
import org.alfresco.web.bean.wizard.BaseInviteUsersWizard; import org.alfresco.web.bean.wizard.BaseInviteUsersWizard;
@@ -57,4 +60,15 @@ public class InviteSpaceUsersWizard extends BaseInviteUsersWizard
{ {
return this.browseBean.getActionSpace(); return this.browseBean.getActionSpace();
} }
@Override
protected String getEmailTemplateXPath()
{
FacesContext fc = FacesContext.getCurrentInstance();
String xpath = Application.getRootPath(fc) + "/" +
Application.getGlossaryFolderName(fc) + "/" +
Application.getEmailTemplatesFolderName(fc) + "/" +
Application.getInviteEmailTemplatesFolderName(fc) + "//*";
return xpath;
}
} }

View File

@@ -215,4 +215,15 @@ public class InviteWebsiteUsersWizard extends BaseInviteUsersWizard
{ {
this.standalone = editMode; this.standalone = editMode;
} }
@Override
protected String getEmailTemplateXPath()
{
FacesContext fc = FacesContext.getCurrentInstance();
String xpath = Application.getRootPath(fc) + "/" +
Application.getGlossaryFolderName(fc) + "/" +
Application.getEmailTemplatesFolderName(fc) + "/" +
Application.getInviteEmailTemplatesFolderName(fc) + "//*";
return xpath;
}
} }

View File

@@ -45,6 +45,8 @@ import javax.transaction.UserTransaction;
import org.alfresco.model.ContentModel; import org.alfresco.model.ContentModel;
import org.alfresco.repo.search.impl.lucene.LuceneQueryParser; import org.alfresco.repo.search.impl.lucene.LuceneQueryParser;
import org.alfresco.repo.security.permissions.AccessDeniedException;
import org.alfresco.service.cmr.dictionary.DictionaryService;
import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.search.LimitBy; import org.alfresco.service.cmr.search.LimitBy;
import org.alfresco.service.cmr.search.ResultSet; import org.alfresco.service.cmr.search.ResultSet;
@@ -60,6 +62,8 @@ import org.alfresco.web.bean.TemplateMailHelperBean;
import org.alfresco.web.bean.repository.Node; import org.alfresco.web.bean.repository.Node;
import org.alfresco.web.bean.repository.Repository; import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.bean.repository.User; import org.alfresco.web.bean.repository.User;
import org.alfresco.web.data.IDataContainer;
import org.alfresco.web.data.QuickSort;
import org.alfresco.web.ui.common.SortableSelectItem; import org.alfresco.web.ui.common.SortableSelectItem;
import org.alfresco.web.ui.common.Utils; import org.alfresco.web.ui.common.Utils;
import org.alfresco.web.ui.common.component.UIGenericPicker; import org.alfresco.web.ui.common.component.UIGenericPicker;
@@ -138,6 +142,58 @@ public abstract class BaseInviteUsersWizard extends BaseWizardBean
protected abstract Node getNode(); protected abstract Node getNode();
/** /**
* @return Returns the list of email templates for user notification
*/
public List<SelectItem> getEmailTemplates()
{
List<SelectItem> wrappers = null;
try
{
FacesContext fc = FacesContext.getCurrentInstance();
NodeRef rootNodeRef = this.getNodeService().getRootNode(Repository.getStoreRef());
NamespaceService resolver = Repository.getServiceRegistry(fc).getNamespaceService();
List<NodeRef> results = this.getSearchService().selectNodes(rootNodeRef, getEmailTemplateXPath(), null, resolver, false);
wrappers = new ArrayList<SelectItem>(results.size() + 1);
if (results.size() != 0)
{
DictionaryService dd = Repository.getServiceRegistry(fc).getDictionaryService();
for (NodeRef ref : results)
{
if (this.getNodeService().exists(ref) == true)
{
Node childNode = new Node(ref);
if (dd.isSubClass(childNode.getType(), ContentModel.TYPE_CONTENT))
{
wrappers.add(new SelectItem(childNode.getId(), childNode.getName()));
}
}
}
// make sure the list is sorted by the label
QuickSort sorter = new QuickSort(wrappers, "label", true, IDataContainer.SORT_CASEINSENSITIVE);
sorter.sort();
}
}
catch (AccessDeniedException accessErr)
{
// ignore the result if we cannot access the root
}
// add an entry (at the start) to instruct the user to select an item
if (wrappers == null)
{
wrappers = new ArrayList<SelectItem>(1);
}
wrappers.add(0, new SelectItem("none", Application.getMessage(FacesContext.getCurrentInstance(), "select_a_template")));
return wrappers;
}
protected abstract String getEmailTemplateXPath();
/**
* @param namespaceService The NamespaceService to set. * @param namespaceService The NamespaceService to set.
*/ */
public void setNamespaceService(NamespaceService namespaceService) public void setNamespaceService(NamespaceService namespaceService)

View File

@@ -80,7 +80,7 @@
<h:panelGrid columns="4" cellspacing="1" cellpadding="1" border="0"> <h:panelGrid columns="4" cellspacing="1" cellpadding="1" border="0">
<h:outputText value="#{msg.action_mail_template}:" /> <h:outputText value="#{msg.action_mail_template}:" />
<h:selectOneMenu value="#{WizardManager.bean.mailHelper.template}"> <h:selectOneMenu value="#{WizardManager.bean.mailHelper.template}">
<f:selectItems value="#{TemplateSupportBean.emailTemplates}" /> <f:selectItems value="#{WizardManager.bean.emailTemplates}" />
</h:selectOneMenu> </h:selectOneMenu>
<h:commandButton value="#{msg.insert_template}" actionListener="#{WizardManager.bean.mailHelper.insertTemplate}" styleClass="wizardButton" /> <h:commandButton value="#{msg.insert_template}" actionListener="#{WizardManager.bean.mailHelper.insertTemplate}" styleClass="wizardButton" />
<h:commandButton value="#{msg.discard_template}" actionListener="#{WizardManager.bean.mailHelper.discardTemplate}" styleClass="wizardButton" disabled="#{WizardManager.bean.mailHelper.usingTemplate == null}" /> <h:commandButton value="#{msg.discard_template}" actionListener="#{WizardManager.bean.mailHelper.discardTemplate}" styleClass="wizardButton" disabled="#{WizardManager.bean.mailHelper.usingTemplate == null}" />

View File

@@ -80,7 +80,7 @@
<h:panelGrid columns="4" cellspacing="1" cellpadding="1" border="0"> <h:panelGrid columns="4" cellspacing="1" cellpadding="1" border="0">
<h:outputText value="#{msg.action_mail_template}:" /> <h:outputText value="#{msg.action_mail_template}:" />
<h:selectOneMenu value="#{InviteWebsiteUsersWizard.mailHelper.template}"> <h:selectOneMenu value="#{InviteWebsiteUsersWizard.mailHelper.template}">
<f:selectItems value="#{TemplateSupportBean.emailTemplates}" /> <f:selectItems value="#{InviteWebsiteUsersWizard.emailTemplates}" />
</h:selectOneMenu> </h:selectOneMenu>
<h:commandButton value="#{msg.insert_template}" actionListener="#{InviteWebsiteUsersWizard.mailHelper.insertTemplate}" styleClass="wizardButton" /> <h:commandButton value="#{msg.insert_template}" actionListener="#{InviteWebsiteUsersWizard.mailHelper.insertTemplate}" styleClass="wizardButton" />
<h:commandButton value="#{msg.discard_template}" actionListener="#{InviteWebsiteUsersWizard.mailHelper.discardTemplate}" styleClass="wizardButton" disabled="#{InviteWebsiteUsersWizard.mailHelper.usingTemplate == null}" /> <h:commandButton value="#{msg.discard_template}" actionListener="#{InviteWebsiteUsersWizard.mailHelper.discardTemplate}" styleClass="wizardButton" disabled="#{InviteWebsiteUsersWizard.mailHelper.usingTemplate == null}" />