mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
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:
@@ -149,6 +149,17 @@ public class TemplateMailHelperBean implements Serializable
|
||||
// object to allow client urls to be generated in emails
|
||||
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);
|
||||
}
|
||||
this.finalBody = body;
|
||||
|
@@ -26,6 +26,9 @@ package org.alfresco.web.bean.content;
|
||||
|
||||
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.wizard.BaseInviteUsersWizard;
|
||||
|
||||
@@ -57,4 +60,15 @@ public class InviteContentUsersWizard extends BaseInviteUsersWizard
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@@ -26,6 +26,9 @@ package org.alfresco.web.bean.spaces;
|
||||
|
||||
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.wizard.BaseInviteUsersWizard;
|
||||
|
||||
@@ -57,4 +60,15 @@ public class InviteSpaceUsersWizard extends BaseInviteUsersWizard
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@@ -215,4 +215,15 @@ public class InviteWebsiteUsersWizard extends BaseInviteUsersWizard
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@@ -45,6 +45,8 @@ import javax.transaction.UserTransaction;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
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.search.LimitBy;
|
||||
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.Repository;
|
||||
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.Utils;
|
||||
import org.alfresco.web.ui.common.component.UIGenericPicker;
|
||||
@@ -138,6 +142,58 @@ public abstract class BaseInviteUsersWizard extends BaseWizardBean
|
||||
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.
|
||||
*/
|
||||
public void setNamespaceService(NamespaceService namespaceService)
|
||||
|
Reference in New Issue
Block a user