[seam-commits] Seam SVN: r13523 - in branches/community/Seam_2_2/examples/wiki: src/main/org/jboss/seam/wiki/core/action and 2 other directories.
seam-commits at lists.jboss.org
seam-commits at lists.jboss.org
Wed Jul 28 05:59:17 EDT 2010
Author: shane.bryzak at jboss.com
Date: 2010-07-28 05:59:16 -0400 (Wed, 28 Jul 2010)
New Revision: 13523
Modified:
branches/community/Seam_2_2/examples/wiki/src/etc/i18n/messages_en.properties
branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/action/CommentHome.java
branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/action/DocumentHome.java
branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/action/UserHome.java
branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/dao/SpamReportDAO.java
branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/dao/WikiNodeDAO.java
branches/community/Seam_2_2/examples/wiki/view/adminHome_d.xhtml
Log:
implemented nuke feature, excluding blacklist
Modified: branches/community/Seam_2_2/examples/wiki/src/etc/i18n/messages_en.properties
===================================================================
--- branches/community/Seam_2_2/examples/wiki/src/etc/i18n/messages_en.properties 2010-07-28 09:21:42 UTC (rev 13522)
+++ branches/community/Seam_2_2/examples/wiki/src/etc/i18n/messages_en.properties 2010-07-28 09:59:16 UTC (rev 13523)
@@ -390,7 +390,6 @@
lacewiki.label.adminHome.spamReport.Reporter=Reporter
lacewiki.label.adminHome.spamReport.Comment=Comment
lacewiki.label.adminHome.spamReport.Poster=Comment Poster
-lacewiki.label.adminHome.spamReport.ViewOriginal=View the original post
lacewiki.label.adminHome.TargetWithPlaceHolder=Target with [[link]] placeholder
lacewiki.label.adminHome.NotAvailableForSkin=Administration is not available with this skin.
Modified: branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/action/CommentHome.java
===================================================================
--- branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/action/CommentHome.java 2010-07-28 09:21:42 UTC (rev 13522)
+++ branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/action/CommentHome.java 2010-07-28 09:59:16 UTC (rev 13523)
@@ -6,30 +6,37 @@
*/
package org.jboss.seam.wiki.core.action;
+import static org.jboss.seam.international.StatusMessage.Severity.INFO;
+
+import java.util.Date;
+
+import org.jboss.seam.Component;
import org.jboss.seam.ScopeType;
-import org.jboss.seam.Component;
-import org.jboss.seam.security.AuthorizationException;
-import org.jboss.seam.security.Identity;
+import org.jboss.seam.annotations.Begin;
+import org.jboss.seam.annotations.FlushModeType;
+import org.jboss.seam.annotations.In;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+import org.jboss.seam.annotations.web.RequestParameter;
+import org.jboss.seam.core.Conversation;
import org.jboss.seam.core.Events;
-import org.jboss.seam.core.Conversation;
import org.jboss.seam.international.Messages;
import org.jboss.seam.international.StatusMessages;
-import org.jboss.seam.annotations.*;
-import org.jboss.seam.annotations.web.RequestParameter;
-import org.jboss.seam.wiki.core.feeds.FeedDAO;
-import org.jboss.seam.wiki.core.feeds.FeedEntryManager;
-import org.jboss.seam.wiki.core.model.*;
+import org.jboss.seam.security.AuthorizationException;
+import org.jboss.seam.security.Identity;
import org.jboss.seam.wiki.core.action.prefs.CommentsPreferences;
import org.jboss.seam.wiki.core.dao.SpamReportDAO;
import org.jboss.seam.wiki.core.exception.InvalidWikiRequestException;
+import org.jboss.seam.wiki.core.feeds.FeedDAO;
+import org.jboss.seam.wiki.core.feeds.FeedEntryManager;
+import org.jboss.seam.wiki.core.model.FeedEntry;
+import org.jboss.seam.wiki.core.model.WikiComment;
+import org.jboss.seam.wiki.core.model.WikiNode;
+import org.jboss.seam.wiki.core.model.WikiSpamReport;
import org.jboss.seam.wiki.core.ui.WikiRedirect;
import org.jboss.seam.wiki.core.wikitext.editor.WikiTextEditor;
import org.jboss.seam.wiki.util.WikiUtil;
-import static org.jboss.seam.international.StatusMessage.Severity.INFO;
-
-import java.util.Date;
-
@Name("commentHome")
@Scope(ScopeType.CONVERSATION)
public class CommentHome extends NodeHome<WikiComment, WikiNode>{
@@ -38,7 +45,7 @@
/* -------------------------- Context Wiring ------------------------------ */
- @In
+ @In(required = false)
protected DocumentHome documentHome;
@In
@@ -77,7 +84,10 @@
@Override
public void create() {
super.create();
- setParentNodeId(documentHome.getInstance().getId());
+ if (documentHome != null)
+ {
+ setParentNodeId(documentHome.getInstance().getId());
+ }
}
@Override
Modified: branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/action/DocumentHome.java
===================================================================
--- branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/action/DocumentHome.java 2010-07-28 09:21:42 UTC (rev 13522)
+++ branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/action/DocumentHome.java 2010-07-28 09:59:16 UTC (rev 13523)
@@ -6,31 +6,41 @@
*/
package org.jboss.seam.wiki.core.action;
+import static org.jboss.seam.international.StatusMessage.Severity.INFO;
+
+import java.util.Calendar;
+import java.util.GregorianCalendar;
+import java.util.List;
+
import org.jboss.seam.Component;
import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.In;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+import org.jboss.seam.contexts.Contexts;
+import org.jboss.seam.core.Events;
import org.jboss.seam.international.Messages;
import org.jboss.seam.international.StatusMessages;
-import org.jboss.seam.annotations.*;
-import org.jboss.seam.contexts.Contexts;
import org.jboss.seam.wiki.core.action.prefs.CommentsPreferences;
import org.jboss.seam.wiki.core.action.prefs.DocumentEditorPreferences;
import org.jboss.seam.wiki.core.action.prefs.WikiPreferences;
+import org.jboss.seam.wiki.core.exception.InvalidWikiRequestException;
import org.jboss.seam.wiki.core.feeds.FeedDAO;
import org.jboss.seam.wiki.core.feeds.FeedEntryManager;
-import org.jboss.seam.wiki.core.wikitext.renderer.MacroWikiTextRenderer;
-import org.jboss.seam.wiki.core.model.*;
-import org.jboss.seam.wiki.core.exception.InvalidWikiRequestException;
+import org.jboss.seam.wiki.core.model.FeedEntry;
+import org.jboss.seam.wiki.core.model.WikiDirectory;
+import org.jboss.seam.wiki.core.model.WikiDocument;
+import org.jboss.seam.wiki.core.model.WikiDocumentDefaults;
+import org.jboss.seam.wiki.core.model.WikiFile;
+import org.jboss.seam.wiki.core.model.WikiTextMacro;
import org.jboss.seam.wiki.core.template.TemplateRegistry;
+import org.jboss.seam.wiki.core.template.WikiDocumentEditorDefaults;
import org.jboss.seam.wiki.core.template.WikiDocumentTemplate;
-import org.jboss.seam.wiki.core.template.WikiDocumentEditorDefaults;
import org.jboss.seam.wiki.core.wikitext.editor.WikiTextEditor;
+import org.jboss.seam.wiki.core.wikitext.renderer.MacroWikiTextRenderer;
import org.jboss.seam.wiki.preferences.Preferences;
import org.jboss.seam.wiki.util.WikiUtil;
-import static org.jboss.seam.international.StatusMessage.Severity.INFO;
-
-import java.util.*;
-
@Name("documentHome")
@Scope(ScopeType.CONVERSATION)
public class DocumentHome extends NodeHome<WikiDocument, WikiDirectory> {
@@ -262,7 +272,20 @@
public String remove() {
return trash();
}
+
+ public String reallyRemove()
+ {
+ checkRemovePermissions();
+
+ getLog().debug("removing node : " + getInstance());
+ getNodeRemover().removeDependencies(getInstance());
+ getEntityManager().remove(getInstance());
+ getEntityManager().flush();
+ Events.instance().raiseEvent("Node.removed", getInstance());
+ return "removed";
+ }
+
@Override
protected NodeRemover getNodeRemover() {
return (DocumentNodeRemover)Component.getInstance(DocumentNodeRemover.class);
Modified: branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/action/UserHome.java
===================================================================
--- branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/action/UserHome.java 2010-07-28 09:21:42 UTC (rev 13522)
+++ branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/action/UserHome.java 2010-07-28 09:59:16 UTC (rev 13523)
@@ -10,6 +10,7 @@
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.Factory;
import org.jboss.seam.annotations.In;
+import org.jboss.seam.annotations.Logger;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.annotations.datamodel.DataModel;
@@ -18,13 +19,18 @@
import org.jboss.seam.faces.Renderer;
import org.jboss.seam.framework.EntityHome;
import org.jboss.seam.international.StatusMessages;
+import org.jboss.seam.log.Log;
import org.jboss.seam.security.AuthorizationException;
import org.jboss.seam.security.Identity;
import org.jboss.seam.wiki.core.action.prefs.UserManagementPreferences;
import org.jboss.seam.wiki.core.action.prefs.WikiPreferences;
import org.jboss.seam.wiki.core.dao.UserDAO;
+import org.jboss.seam.wiki.core.dao.WikiNodeDAO;
import org.jboss.seam.wiki.core.model.Role;
import org.jboss.seam.wiki.core.model.User;
+import org.jboss.seam.wiki.core.model.WikiComment;
+import org.jboss.seam.wiki.core.model.WikiDocument;
+import org.jboss.seam.wiki.core.model.WikiNode;
import org.jboss.seam.wiki.core.model.WikiUploadImage;
import org.jboss.seam.wiki.core.upload.Uploader;
import org.jboss.seam.wiki.core.exception.InvalidWikiRequestException;
@@ -40,7 +46,9 @@
import static org.jboss.seam.international.StatusMessage.Severity.INFO;
import java.util.ArrayList;
+import java.util.HashSet;
import java.util.List;
+import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -48,6 +56,9 @@
@Scope(ScopeType.CONVERSATION)
public class UserHome extends EntityHome<User> {
+ @Logger
+ static Log log;
+
// TODO: This is a performance optimization, our EM is always already joined (SMPC)
//protected void joinTransaction() {}
@@ -56,7 +67,7 @@
@In
private UserDAO userDAO;
-
+
@In
private Hash hashUtil;
@@ -356,11 +367,73 @@
@Restrict("#{s:hasPermission('User', 'delete', userHome.instance)}")
public String nuke() {
+
+ // First delete their comments
+
+ DocumentHome documentHome = (DocumentHome) Component.getInstance("documentHome");
+ WikiNodeDAO wikiNodeDAO = (WikiNodeDAO) Component.getInstance("wikiNodeDAO");
+
+ // Find all the content that this user has created
+ List<WikiNode> userNodes = wikiNodeDAO.findWikiNodes(getInstance());
+
+ Set<WikiNode> nodesToDelete = new HashSet<WikiNode>();
+
+ // Build a list of all the child nodes of the user's nodes
+ for (WikiNode node : userNodes)
+ {
+ recursiveAddChildren(wikiNodeDAO, node, nodesToDelete);
+ }
+
+ while (!nodesToDelete.isEmpty())
+ {
+ WikiNode nodeToDelete = null;
+
+ main: for (WikiNode node : nodesToDelete)
+ {
+ // We need to find a node without children contained in the same set (which should contain any children if they exist)
+ for (WikiNode n : nodesToDelete)
+ {
+ if (n.getParent().equals(node)) continue main;
+ }
+
+ nodeToDelete = node;
+ break;
+ }
+
+ if (nodeToDelete == null)
+ {
+ throw new IllegalStateException("Error while deleting child nodes - no childless node found in set.");
+ }
+ else
+ {
+ if (nodeToDelete instanceof WikiComment)
+ {
+ WikiComment comment = (WikiComment) nodeToDelete;
+
+ documentHome.setId(getCommentDocument(comment).getId());
+ CommentHome commentHome = (CommentHome) Component.getInstance("commentHome");
+
+ commentHome.setId(comment.getId());
+ commentHome.remove(comment.getId());
+ }
+ else if (nodeToDelete instanceof WikiDocument)
+ {
+ documentHome.setId(nodeToDelete.getId());
+ documentHome.reallyRemove();
+ }
+ else
+ {
+ log.info("Unhandled node found, could not delete: " + nodeToDelete);
+ }
- // TODO need to do almost the same as remove(), however we want to delete
- // all the user's nodes instead of re-parenting them, plus add their
- // e-mail and ip address to the blacklist
+ }
+
+ nodesToDelete.remove(nodeToDelete);
+ }
+ // TODO blacklist the user
+
+
// Remove preferences for this user
PreferenceProvider prefProvider = (PreferenceProvider)Component.getInstance("preferenceProvider");
prefProvider.deleteUserPreferenceValues(getInstance());
@@ -372,6 +445,29 @@
}
return outcome;
}
+
+ private void recursiveAddChildren(WikiNodeDAO wikiNodeDAO, WikiNode parent, Set<WikiNode> nodeSet)
+ {
+ if (nodeSet.contains(parent)) return;
+
+ List<WikiNode> children = wikiNodeDAO.findChildren(parent, WikiNode.SortableProperty.createdOn, true, 0, 0);
+ for (WikiNode child : children)
+ {
+ recursiveAddChildren(wikiNodeDAO, child, nodeSet);
+ }
+
+ nodeSet.add(parent);
+ }
+
+ private WikiDocument getCommentDocument(WikiComment comment)
+ {
+ WikiNode parent = comment.getParent();
+ while (!(parent instanceof WikiDocument))
+ {
+ parent = parent.getParent();
+ }
+ return (WikiDocument) parent;
+ }
@Restrict("#{s:hasPermission('User', 'edit', userHome.instance)}")
public void removePortrait() {
Modified: branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/dao/SpamReportDAO.java
===================================================================
--- branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/dao/SpamReportDAO.java 2010-07-28 09:21:42 UTC (rev 13522)
+++ branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/dao/SpamReportDAO.java 2010-07-28 09:59:16 UTC (rev 13523)
@@ -10,7 +10,6 @@
import org.jboss.seam.annotations.Name;
import org.jboss.seam.log.Log;
import org.jboss.seam.wiki.core.model.WikiComment;
-import org.jboss.seam.wiki.core.model.WikiFeed;
import org.jboss.seam.wiki.core.model.WikiSpamReport;
@Name("spamReportDAO")
Modified: branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/dao/WikiNodeDAO.java
===================================================================
--- branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/dao/WikiNodeDAO.java 2010-07-28 09:21:42 UTC (rev 13522)
+++ branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/dao/WikiNodeDAO.java 2010-07-28 09:59:16 UTC (rev 13523)
@@ -1,20 +1,30 @@
package org.jboss.seam.wiki.core.dao;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.persistence.EntityManager;
+import javax.persistence.EntityNotFoundException;
+import javax.persistence.NoResultException;
+import javax.persistence.Query;
+
import org.hibernate.Session;
-import org.hibernate.transform.ResultTransformer;
import org.jboss.seam.Component;
import org.jboss.seam.annotations.AutoCreate;
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Logger;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.log.Log;
-import org.jboss.seam.wiki.core.model.*;
+import org.jboss.seam.wiki.core.model.User;
+import org.jboss.seam.wiki.core.model.WikiComment;
+import org.jboss.seam.wiki.core.model.WikiDirectory;
+import org.jboss.seam.wiki.core.model.WikiDocument;
+import org.jboss.seam.wiki.core.model.WikiFile;
+import org.jboss.seam.wiki.core.model.WikiMenuItem;
+import org.jboss.seam.wiki.core.model.WikiNode;
+import org.jboss.seam.wiki.core.model.WikiTreeNode;
+import org.jboss.seam.wiki.core.model.WikiUpload;
-import javax.persistence.EntityManager;
-import javax.persistence.EntityNotFoundException;
-import javax.persistence.NoResultException;
-import java.util.*;
-
/**
* DAO for nodes, transparently respects security access levels.
* <p>
@@ -22,6 +32,7 @@
* about access levels because it relies on a restricted (filtered) Entitymanager.
*
* @author Christian Bauer
+ * @author Shane Bryzak
*
*/
@Name("wikiNodeDAO")
@@ -58,6 +69,7 @@
}
+ @SuppressWarnings("unchecked")
public List<WikiNode> findWikiNodes(List<Long> ids) {
return restrictedEntityManager
.createQuery("select n from WikiNode n where n.id in (:idList)")
@@ -100,23 +112,38 @@
return null;
}
- public List<WikiNode> findChildren(WikiNode node, WikiNode.SortableProperty orderBy, boolean orderAscending, int firstResult, int maxResults) {
+ @SuppressWarnings("unchecked")
+ public List<WikiNode> findChildren(WikiNode node, WikiNode.SortableProperty orderBy,
+ boolean orderAscending, int firstResult, int maxResults) {
StringBuilder queryString = new StringBuilder();
queryString.append("select n from WikiNode n where n.parent = :parent").append(" ");
queryString.append("order by n.").append(orderBy.name()).append(" ").append(orderAscending ? "asc" : "desc");
- return restrictedEntityManager
- .createQuery(queryString.toString())
- .setHint("org.hibernate.comment", "Find wikinode children order by "+orderBy.name())
- .setParameter("parent", node)
- .setHint("org.hibernate.cacheable", false)
- .setFirstResult(firstResult)
- .setMaxResults(maxResults)
- .getResultList();
+ Query query = restrictedEntityManager
+ .createQuery(queryString.toString())
+ .setHint("org.hibernate.comment", "Find wikinode children order by "+orderBy.name())
+ .setParameter("parent", node)
+ .setHint("org.hibernate.cacheable", false)
+ .setFirstResult(firstResult);
+
+ if (maxResults > 0)
+ {
+ query.setMaxResults(maxResults);
+ }
+
+ return query.getResultList();
}
+
+ public List<WikiNode> findWikiNodes(User user)
+ {
+ return restrictedEntityManager.createQuery("select n from WikiNode n where n.createdBy = :createdBy")
+ .setParameter("createdBy", user)
+ .getResultList();
+ }
- public List<WikiDirectory> findChildWikiDirectories(WikiDirectory dir) {
+ @SuppressWarnings("unchecked")
+ public List<WikiDirectory> findChildWikiDirectories(WikiDirectory dir) {
return restrictedEntityManager
.createQuery("select d from WikiDirectory d left join fetch d.feed where d.parent = :parent")
.setHint("org.hibernate.comment", "Find wikinode children directories")
@@ -139,7 +166,8 @@
return null;
}
- public List<WikiComment> findWikiComments(WikiDocument document, boolean orderbyDateAscending) {
+ @SuppressWarnings("unchecked")
+ public List<WikiComment> findWikiComments(WikiDocument document, boolean orderbyDateAscending) {
String query =
"select c from WikiComment c where c.parent = :parentDoc order by c.createdOn " +
(orderbyDateAscending ? "asc" : "desc");
@@ -149,7 +177,65 @@
.setHint("org.hibernate.comment", "Finding all comments of document")
.getResultList();
}
-
+
+ /**
+ * Returns a list of all the WikiComments created by a particular user
+ * @param createdBy
+ * @return
+ */
+ @SuppressWarnings("unchecked")
+ public List<WikiComment> findWikiComments(User createdBy)
+ {
+ return (List<WikiComment>) restrictedEntityManager.createQuery(
+ "select c from WikiComment c where c.createdBy = :createdBy")
+ .setParameter("createdBy", createdBy)
+ .getResultList();
+ }
+
+ /**
+ * Returns a list of all the WikiComments matching the specified parameters
+ *
+ * @param fromUserName
+ * @param fromUserEmail
+ * @param fromUserHomepage
+ * @return
+ */
+ @SuppressWarnings("unchecked")
+ public List<WikiComment> findWikiComments(String fromUserName, String fromUserEmail,
+ String fromUserHomepage)
+ {
+ if (fromUserName == null && fromUserEmail == null && fromUserHomepage == null)
+ {
+ throw new IllegalArgumentException("At least one parameter must be not null.");
+ }
+
+ StringBuilder criteria = new StringBuilder();
+ if (fromUserName != null)
+ {
+ criteria.append("where c.fromUserName = :fromUserName");
+ }
+
+ if (fromUserEmail != null)
+ {
+ if (criteria.length() > 0) criteria.append(" and ");
+ criteria.append("c.fromUserEmail = :fromUserEmail");
+ }
+
+ if (fromUserHomepage != null)
+ {
+ if (criteria.length() > 0) criteria.append(" and ");
+ criteria.append("c.fromUserHomepage = :fromUserHomepage");
+ }
+
+ Query query = restrictedEntityManager.createQuery("select c from WikiComment c " + criteria.toString());
+
+ if (fromUserName != null) query.setParameter("fromUserName", fromUserName);
+ if (fromUserEmail != null) query.setParameter("fromUserEmail", fromUserEmail);
+ if (fromUserHomepage != null) query.setParameter("fromUserHomepage", fromUserHomepage);
+
+ return (List<WikiComment>) query.getResultList();
+ }
+
public WikiFile findWikiFile(Long fileId) {
try {
return (WikiFile) restrictedEntityManager
@@ -228,6 +314,7 @@
return null;
}
+ @SuppressWarnings("unchecked")
public List<WikiDocument> findWikiDocuments(WikiDirectory directory, WikiNode.SortableProperty orderBy, boolean orderAscending) {
StringBuilder query = new StringBuilder();
@@ -259,6 +346,7 @@
return null;
}
+ @SuppressWarnings("unchecked")
public List<WikiDocument> findWikiDocuments(int maxResults, WikiNode.SortableProperty orderBy, boolean orderAscending) {
StringBuilder query = new StringBuilder();
@@ -305,6 +393,7 @@
return null;
}
+ @SuppressWarnings("unchecked")
public List<WikiUpload> findWikiUploads(WikiDirectory directory, WikiNode.SortableProperty orderBy, boolean orderAscending) {
StringBuilder query = new StringBuilder();
query.append("select u from WikiUpload u where u.parent = :dir");
@@ -405,6 +494,7 @@
}
// Recursive! Don't use for large trees...
+ @SuppressWarnings("unchecked")
private void appendWikiNodeChildren(String query, List tree, long parentNodeId, long currentLevel, Long maxDepth, Long flattenToLevel) {
List<WikiNode> nodes = restrictedEntityManager.createQuery(query)
.setHint("org.hibernate.comment", "Querying children of wiki node: " + parentNodeId)
Modified: branches/community/Seam_2_2/examples/wiki/view/adminHome_d.xhtml
===================================================================
--- branches/community/Seam_2_2/examples/wiki/view/adminHome_d.xhtml 2010-07-28 09:21:42 UTC (rev 13522)
+++ branches/community/Seam_2_2/examples/wiki/view/adminHome_d.xhtml 2010-07-28 09:59:16 UTC (rev 13523)
@@ -275,29 +275,53 @@
<h:column>
<f:facet name="header">
#{messages['lacewiki.label.adminHome.spamReport.Comment']}
- </f:facet>
+ </f:facet>
- <s:div styleClass="commentText" rendered="#{report.comment.useWikiText and not empty report.comment.parent.areaNumber}">
- <s:formattedText value="#{report.comment.content}"
- linkStyleClass="regularLink"
- brokenLinkStyleClass="brokenLink"
- attachmentLinkStyleClass="regularLink"
- thumbnailLinkStyleClass="regularLink"
- enableMacroRendering="false"/>
- </s:div>
- <s:div styleClass="commentText plaintext" rendered="#{not report.comment.useWikiText and report.comment.parent.name != report.comment.subject}" style="margin-top:15px;">
- <h:outputText value="#{wiki:escapeHTML(report.comment.content, true, true)}" escape="false"/>
- </s:div>
- <s:div styleClass="commentText plaintext" rendered="#{not report.comment.useWikiText and report.comment.parent.name == report.comment.subject}">
- <h:outputText value="#{wiki:escapeHTML(report.comment.content, true, true)}" escape="false"/>
- </s:div>
+ <div style="padding: 4px">
+ <h:outputLink value="#{wikiURLRenderer.renderURL(report.comment)}">
+ <h:outputText value="#{report.comment.subject}"/>
+ </h:outputLink>
+
+ <s:div styleClass="commentText" rendered="#{report.comment.useWikiText and not empty report.comment.parent.areaNumber}">
+ <s:formattedText value="#{report.comment.content}"
+ linkStyleClass="regularLink"
+ brokenLinkStyleClass="brokenLink"
+ attachmentLinkStyleClass="regularLink"
+ thumbnailLinkStyleClass="regularLink"
+ enableMacroRendering="false"/>
+ </s:div>
+ <s:div styleClass="commentText plaintext" rendered="#{not report.comment.useWikiText and report.comment.parent.name != report.comment.subject}" style="margin-top:15px;">
+ <h:outputText value="#{wiki:escapeHTML(report.comment.content, true, true)}" escape="false"/>
+ </s:div>
+ <s:div styleClass="commentText plaintext" rendered="#{not report.comment.useWikiText and report.comment.parent.name == report.comment.subject}">
+ <h:outputText value="#{wiki:escapeHTML(report.comment.content, true, true)}" escape="false"/>
+ </s:div>
+
+ <div>
+
+ <s:fragment rendered="#{s:hasPermission('Comment', 'delete', report.comment)}">
+ <ui:decorate template="includes/confirmationAction.xhtml">
+ <ui:param name="label" value="#{messages['lacewiki.button.commentsDisplay.RemoveComment']}"/>
+ <ui:param name="jsFunctionName" value="deleteCommentId#{report.comment.id}"/>
+ <ui:param name="message" value="#{messages['lacewiki.label.AreYouSureYouWantToDelete']
+ .concat(' ')
+ .concat(messages['lacewiki.label.commentsDisplay.CommentThread'])
+ .concat(': \'')
+ .concat(report.comment.subject)
+ .concat('\'?')}"/>
+ <ui:define name="jsFunction">
+ <a:jsFunction name="#{jsFunctionName}"
+ reRender="commentDisplayForm, messageBoxContainer"
+ action="#{commentHome.remove(report.comment.id)}"
+ oncomplete="onAjaxRequestComplete()"
+ status="globalStatus"/>
+ </ui:define>
+ </ui:decorate>
+ </s:fragment>
+
+ </div>
+ </div>
- <div>
- <h:outputLink value="#{wikiURLRenderer.renderURL(report.comment)}">
- <h:outputText value="#{messages['lacewiki.label.adminHome.spamReport.ViewOriginal']}"/>
- </h:outputLink>
- </div>
-
</h:column>
<h:column>
<f:facet name="header">
More information about the seam-commits
mailing list