Author: christian.bauer(a)jboss.com
Date: 2008-04-09 05:44:49 -0400 (Wed, 09 Apr 2008)
New Revision: 7884
Added:
trunk/examples/wiki/view/includes/confirmationAction.xhtml
Modified:
trunk/examples/wiki/src/etc/META-INF/wiki.taglib.xml
trunk/examples/wiki/src/etc/i18n/messages_en.properties
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/CommentHome.java
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/DirectoryBrowser.java
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/NodeHome.java
trunk/examples/wiki/src/main/org/jboss/seam/wiki/plugin/faqBrowser/FaqQuestionHome.java
trunk/examples/wiki/src/main/org/jboss/seam/wiki/plugin/forum/ForumHome.java
trunk/examples/wiki/src/main/org/jboss/seam/wiki/plugin/forum/ReplyHome.java
trunk/examples/wiki/src/main/org/jboss/seam/wiki/plugin/forum/TopicHome.java
trunk/examples/wiki/src/main/org/jboss/seam/wiki/util/WikiUtil.java
trunk/examples/wiki/view/dirDisplay_d.xhtml
trunk/examples/wiki/view/dirEdit_d.xhtml
trunk/examples/wiki/view/docDisplay_d.xhtml
trunk/examples/wiki/view/docEdit_d.xhtml
trunk/examples/wiki/view/includes/userControl.xhtml
trunk/examples/wiki/view/plugins/forumList/forumForm.xhtml
trunk/examples/wiki/view/plugins/forumReplies/plugin.xhtml
trunk/examples/wiki/view/themes/default/js/lacewiki.js
trunk/examples/wiki/view/themes/default/template.xhtml
trunk/examples/wiki/view/themes/inrelationto/js/lacewiki.js
trunk/examples/wiki/view/themes/inrelationto/template.xhtml
trunk/examples/wiki/view/themes/sfwkorg/js/lacewiki.js
trunk/examples/wiki/view/themes/sfwkorg/template.xhtml
trunk/examples/wiki/view/uploadEdit_d.xhtml
trunk/examples/wiki/view/userHome_d.xhtml
Log:
Fixed delete confirmation popup javascript code injection hole
Modified: trunk/examples/wiki/src/etc/META-INF/wiki.taglib.xml
===================================================================
--- trunk/examples/wiki/src/etc/META-INF/wiki.taglib.xml 2008-04-09 09:16:02 UTC (rev
7883)
+++ trunk/examples/wiki/src/etc/META-INF/wiki.taglib.xml 2008-04-09 09:44:49 UTC (rev
7884)
@@ -91,6 +91,12 @@
</function>
<function>
+ <function-name>escapeJSMessage</function-name>
+ <function-class>org.jboss.seam.wiki.util.WikiUtil</function-class>
+ <function-signature>java.lang.String
escapeJSMessage(java.lang.String)</function-signature>
+ </function>
+
+ <function>
<function-name>encodeURL</function-name>
<function-class>org.jboss.seam.wiki.util.WikiUtil</function-class>
<function-signature>java.lang.String
encodeURL(java.lang.String)</function-signature>
Modified: trunk/examples/wiki/src/etc/i18n/messages_en.properties
===================================================================
--- trunk/examples/wiki/src/etc/i18n/messages_en.properties 2008-04-09 09:16:02 UTC (rev
7883)
+++ trunk/examples/wiki/src/etc/i18n/messages_en.properties 2008-04-09 09:44:49 UTC (rev
7884)
@@ -163,9 +163,7 @@
lacewiki.label.WritableBy=Writable by
lacewiki.label.WriteProtected=Restrict edit access to admins
lacewiki.label.User=User
-lacewiki.label.DeleteConfirmation=Delete Confirmation
lacewiki.label.AreYouSureYouWantToDelete=Are you sure you want to delete
-lacewiki.label.DeleteAllChildren=?
lacewiki.label.Confirmation=Confirmation
lacewiki.label.AreYouSureYouWantToExecute=Are you sure you want to execute this
operation?
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/CommentHome.java
===================================================================
---
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/CommentHome.java 2008-04-09
09:16:02 UTC (rev 7883)
+++
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/CommentHome.java 2008-04-09
09:44:49 UTC (rev 7884)
@@ -135,7 +135,7 @@
public String remove(Long commentId) {
setNodeId(commentId);
- initEditor();
+ initEditor(false);
if (isManaged()) {
// Additional permission required besides NodeHome.remove()
@@ -274,7 +274,7 @@
@Begin(flushMode = FlushModeType.MANUAL, join = true)
public String newComment() {
- initEditor();
+ initEditor(false);
showForm = true;
return "redirectToDocument";
}
Modified:
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/DirectoryBrowser.java
===================================================================
---
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/DirectoryBrowser.java 2008-04-09
09:16:02 UTC (rev 7883)
+++
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/DirectoryBrowser.java 2008-04-09
09:44:49 UTC (rev 7884)
@@ -432,8 +432,10 @@
return false;
// Check permissions TODO: This duplicates the check
- if (!Identity.instance().hasPermission("Node", "edit",
node))
+ if (!Identity.instance().hasPermission("Node", "edit", node))
{
+ log.debug("user doesn't have edit permissions for this node: "
+ node);
return false;
+ }
NodeRemover remover;
if (node.isInstance(WikiDocument.class)) {
@@ -441,9 +443,11 @@
} else if (node.isInstance(WikiUpload.class)) {
remover = (NodeRemover) Component.getInstance(UploadNodeRemover.class);
} else {
+ log.warn("no remover found for node type: " + node);
return false;
}
boolean removable = remover.isRemovable(node);
+ log.debug("remover said it's removable: " + removable);
childNodesRemovability.put(node.getId(), removable);
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/NodeHome.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/NodeHome.java 2008-04-09
09:16:02 UTC (rev 7883)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/NodeHome.java 2008-04-09
09:44:49 UTC (rev 7884)
@@ -85,19 +85,25 @@
public boolean isEditor() { return editor; }
- public void initEditor() {
+ public void initEditor(boolean visibleWorkspace) {
getLog().debug("initializing editor workspace");
this.editor = true;
- // Set workspace description of the current conversation
- String desc = getEditorWorkspaceDescription(getNodeId() == null);
- WikiPreferences prefs = Preferences.getInstance(WikiPreferences.class);
- if (desc != null && desc.length() >
prefs.getWorkspaceSwitcherDescriptionLength()) {
- desc = desc.substring(0,
prefs.getWorkspaceSwitcherDescriptionLength().intValue()) + "...";
+ if (visibleWorkspace) {
+ // Set workspace description of the current conversation
+ String desc = getEditorWorkspaceDescription(getNodeId() == null);
+ WikiPreferences prefs = Preferences.getInstance(WikiPreferences.class);
+ if (desc != null && desc.length() >
prefs.getWorkspaceSwitcherDescriptionLength()) {
+ desc = desc.substring(0,
prefs.getWorkspaceSwitcherDescriptionLength().intValue()) + "...";
+ }
+ Conversation.instance().setDescription(desc);
}
- Conversation.instance().setDescription(desc);
}
+ public void initEditor() {
+ initEditor(true);
+ }
+
/* -------------------------- Basic Overrides ------------------------------ */
@Override
@@ -285,7 +291,7 @@
public String remove(Long nodeId) {
getLog().debug("requested node remove with id: " + nodeId);
setNodeId(nodeId);
- initEditor();
+ initEditor(false);
String outcome = remove();
if (outcome != null) {
Events.instance().raiseEvent("Node.refreshList");
Modified:
trunk/examples/wiki/src/main/org/jboss/seam/wiki/plugin/faqBrowser/FaqQuestionHome.java
===================================================================
---
trunk/examples/wiki/src/main/org/jboss/seam/wiki/plugin/faqBrowser/FaqQuestionHome.java 2008-04-09
09:16:02 UTC (rev 7883)
+++
trunk/examples/wiki/src/main/org/jboss/seam/wiki/plugin/faqBrowser/FaqQuestionHome.java 2008-04-09
09:44:49 UTC (rev 7884)
@@ -141,7 +141,7 @@
@Begin(flushMode = FlushModeType.MANUAL, join = true)
public void newQuestion() {
- initEditor();
+ initEditor(false);
showForm = true;
}
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/plugin/forum/ForumHome.java
===================================================================
---
trunk/examples/wiki/src/main/org/jboss/seam/wiki/plugin/forum/ForumHome.java 2008-04-09
09:16:02 UTC (rev 7883)
+++
trunk/examples/wiki/src/main/org/jboss/seam/wiki/plugin/forum/ForumHome.java 2008-04-09
09:44:49 UTC (rev 7884)
@@ -201,14 +201,14 @@
@Begin(flushMode = FlushModeType.MANUAL, join = true)
public void newForum() {
- initEditor();
+ initEditor(false);
showForm = true;
}
@Begin(flushMode = FlushModeType.MANUAL, join = true)
public void edit(Long forumId) {
setId(forumId);
- initEditor();
+ initEditor(false);
showForm = true;
}
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/plugin/forum/ReplyHome.java
===================================================================
---
trunk/examples/wiki/src/main/org/jboss/seam/wiki/plugin/forum/ReplyHome.java 2008-04-09
09:16:02 UTC (rev 7883)
+++
trunk/examples/wiki/src/main/org/jboss/seam/wiki/plugin/forum/ReplyHome.java 2008-04-09
09:44:49 UTC (rev 7884)
@@ -57,7 +57,7 @@
getLog().debug("reply to document id: " + getParentNodeId());
newComment();
- initEditor();
+ initEditor(false);
getInstance().setSubject(REPLY_PREFIX + getParentNode().getName());
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/plugin/forum/TopicHome.java
===================================================================
---
trunk/examples/wiki/src/main/org/jboss/seam/wiki/plugin/forum/TopicHome.java 2008-04-09
09:16:02 UTC (rev 7883)
+++
trunk/examples/wiki/src/main/org/jboss/seam/wiki/plugin/forum/TopicHome.java 2008-04-09
09:44:49 UTC (rev 7884)
@@ -237,7 +237,7 @@
@Begin(flushMode = FlushModeType.MANUAL, join = true)
public void newTopic() {
- initEditor();
+ initEditor(false);
showForm = true;
}
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/util/WikiUtil.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/util/WikiUtil.java 2008-04-09
09:16:02 UTC (rev 7883)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/util/WikiUtil.java 2008-04-09
09:44:49 UTC (rev 7884)
@@ -161,6 +161,10 @@
}
}
+ public static String escapeJSMessage(String message) {
+ return message.replaceAll("'",
"\\\\'").replaceAll("\"", "\\\\\\\"");
+ }
+
public static String escapeEmailURL(String string) {
return string.length() >= 7 && string.substring(0,
7).equals("mailto:")
? string.replaceAll("@",
Preferences.getInstance(WikiPreferences.class).getAtSymbolReplacement())
Modified: trunk/examples/wiki/view/dirDisplay_d.xhtml
===================================================================
--- trunk/examples/wiki/view/dirDisplay_d.xhtml 2008-04-09 09:16:02 UTC (rev 7883)
+++ trunk/examples/wiki/view/dirDisplay_d.xhtml 2008-04-09 09:44:49 UTC (rev 7884)
@@ -217,16 +217,27 @@
<h:outputText
value="#{messages['lacewiki.button.dirDisplay.ViewNewWindow']}"/>
</h:outputLink>
</li>
+
<s:fragment
rendered="#{directoryBrowser.isRemovable(node)}">
- <a:jsFunction
name="deleteDocumentId#{node.id}"
- status="globalStatus"
-
action="#{documentHome.remove(node.id)}"/>
<li>
- <h:outputLink
value="javascript:deleteConfirmation('\\'#{node.name}\\'','deleteDocumentId#{node.id}')">
- <h:outputText
value="#{messages['lacewiki.button.dirDisplay.Delete']}"/>
- </h:outputLink>
+ <ui:decorate
template="includes/confirmationAction.xhtml">
+ <ui:param name="linkClass"
value="menuItemActionLink"/>
+ <ui:param name="labelClass"
value="menuItemActionLabel"/>
+ <ui:param name="label"
value="#{messages['lacewiki.button.dirDisplay.Delete']}"/>
+ <ui:param
name="jsFunctionName" value="deleteDocumentId#{node.id}"/>
+ <ui:param name="message"
value="#{messages['lacewiki.label.AreYouSureYouWantToDelete']
+
.concat(': \'').concat(node.name).concat('\'?')}"/>
+ <ui:define
name="jsFunction">
+ <a:jsFunction
name="#{jsFunctionName}"
+
reRender="directoryBrowser, messageBoxContainer"
+
action="#{documentHome.remove(node.id)}"
+
oncomplete="onAjaxRequestComplete()"
+
status="globalStatus"/>
+ </ui:define>
+ </ui:decorate>
</li>
</s:fragment>
+
<s:fragment
rendered="#{s:hasPermission('Node', 'edit', node)}">
<li>
<s:link
view="/docEdit_#{skin}.xhtml" propagation="none">
@@ -255,16 +266,27 @@
<h:outputText
value="#{messages['lacewiki.button.dirDisplay.ViewNewWindow']}"/>
</h:outputLink>
</li>
+
<s:fragment
rendered="#{directoryBrowser.isRemovable(node)}">
- <a:jsFunction
name="deleteUploadId#{node.id}"
- status="globalStatus"
-
action="#{uploadHome.remove(node.id)}"/>
<li>
- <h:outputLink
value="javascript:deleteConfirmation('\\'#{node.name}\\'','deleteUploadId#{node.id}')">
- <h:outputText
value="#{messages['lacewiki.button.dirDisplay.Delete']}"/>
- </h:outputLink>
+ <ui:decorate
template="includes/confirmationAction.xhtml">
+ <ui:param name="linkClass"
value="menuItemActionLink"/>
+ <ui:param name="labelClass"
value="menuItemActionLabel"/>
+ <ui:param name="label"
value="#{messages['lacewiki.button.dirDisplay.Delete']}"/>
+ <ui:param
name="jsFunctionName" value="deleteUploadId#{node.id}"/>
+ <ui:param name="message"
value="#{messages['lacewiki.label.AreYouSureYouWantToDelete']
+
.concat(': \'').concat(node.name).concat('\'?')}"/>
+ <ui:define
name="jsFunction">
+ <a:jsFunction
name="#{jsFunctionName}"
+
reRender="directoryBrowser, messageBoxContainer"
+
action="#{uploadHome.remove(node.id)}"
+
oncomplete="onAjaxRequestComplete()"
+
status="globalStatus"/>
+ </ui:define>
+ </ui:decorate>
</li>
</s:fragment>
+
<s:fragment
rendered="#{s:hasPermission('Node', 'edit', node)}">
<li>
<s:link
view="/uploadEdit_#{skin}.xhtml" propagation="none">
Modified: trunk/examples/wiki/view/dirEdit_d.xhtml
===================================================================
--- trunk/examples/wiki/view/dirEdit_d.xhtml 2008-04-09 09:16:02 UTC (rev 7883)
+++ trunk/examples/wiki/view/dirEdit_d.xhtml 2008-04-09 09:44:49 UTC (rev 7884)
@@ -241,15 +241,23 @@
</h:commandLink>
<s:fragment rendered="#{directoryHome.removable}">
- <a:jsFunction name="deleteDirectory"
- status="globalStatus"
- action="#{directoryHome.remove}"/>
- <h:outputLink tabindex="1"
-
accesskey="#{messages['lacewiki.button.dirEdit.Delete.accesskey']}"
-
value="javascript:deleteConfirmation('\\'#{directoryHome.instance.name}\\'','deleteDirectory')"
- styleClass="button sessionEventTrigger">
- <h:outputText escape="false"
styleClass="buttonLabel"
value="#{messages['lacewiki.button.dirEdit.Delete']}"/>
- </h:outputLink>
+
+ <ui:decorate
template="includes/confirmationAction.xhtml">
+ <ui:param name="label"
value="#{messages['lacewiki.button.dirEdit.Delete']}"/>
+ <ui:param name="accesskey"
value="#{messages['lacewiki.button.dirEdit.Delete.accesskey']}"/>
+ <ui:param name="tabindex" value="1"/>
+ <ui:param name="linkClass" value="button
sessionEventTrigger"/>
+ <ui:param name="escapeLabel"
value="false"/>
+ <ui:param name="jsFunctionName"
value="deleteDirectory"/>
+ <ui:param name="message"
value="#{messages['lacewiki.label.AreYouSureYouWantToDelete']
+ .concat(':
\'').concat(directoryHome.instance.name).concat('\'?')}"/>
+ <ui:define name="jsFunction">
+ <a:jsFunction name="#{jsFunctionName}"
+ action="#{directoryHome.remove}"
+ status="globalStatus"/>
+ </ui:define>
+ </ui:decorate>
+
</s:fragment>
</div>
Modified: trunk/examples/wiki/view/docDisplay_d.xhtml
===================================================================
--- trunk/examples/wiki/view/docDisplay_d.xhtml 2008-04-09 09:16:02 UTC (rev 7883)
+++ trunk/examples/wiki/view/docDisplay_d.xhtml 2008-04-09 09:44:49 UTC (rev 7884)
@@ -221,15 +221,24 @@
</s:fragment>
- <s:fragment
rendered="#{s:hasPermission('Comment', 'delete', currentDocument) and
not commentHome.showForm}">
- <a:jsFunction name="deleteCommentId#{c.id}"
- reRender="commentDisplayForm"
- status="globalStatus"
-
action="#{commentHome.remove(c.id)}"/>
- <h:outputLink
value="javascript:deleteConfirmation('#{messages['lacewiki.label.commentsDisplay.CommentThread']}
\\'#{c.subject}\\'','deleteCommentId#{c.id}')"
- styleClass="button">
- <h:outputText styleClass="buttonLabel"
value="#{messages['lacewiki.button.commentsDisplay.RemoveComment']}"/>
- </h:outputLink>
+ <s:fragment
rendered="#{s:hasPermission('Comment', 'delete', currentDocument) and
not commentHome.showForm}">
+ <ui:decorate
template="includes/confirmationAction.xhtml">
+ <ui:param name="label"
value="#{messages['lacewiki.button.commentsDisplay.RemoveComment']}"/>
+ <ui:param name="jsFunctionName"
value="deleteCommentId#{c.id}"/>
+ <ui:param name="message"
value="#{messages['lacewiki.label.AreYouSureYouWantToDelete']
+ .concat(' ')
+
.concat(messages['lacewiki.label.commentsDisplay.CommentThread'])
+ .concat(':
\'')
+ .concat(c.subject)
+
.concat('\'?')}"/>
+ <ui:define name="jsFunction">
+ <a:jsFunction name="#{jsFunctionName}"
+ reRender="commentDisplayForm,
messageBoxContainer"
+
action="#{commentHome.remove(c.id)}"
+
oncomplete="onAjaxRequestComplete()"
+ status="globalStatus"/>
+ </ui:define>
+ </ui:decorate>
</s:fragment>
</h:panelGroup>
Modified: trunk/examples/wiki/view/docEdit_d.xhtml
===================================================================
--- trunk/examples/wiki/view/docEdit_d.xhtml 2008-04-09 09:16:02 UTC (rev 7883)
+++ trunk/examples/wiki/view/docEdit_d.xhtml 2008-04-09 09:44:49 UTC (rev 7884)
@@ -332,15 +332,21 @@
</h:commandLink>
<s:fragment
rendered="#{documentHome.removable}">
- <a:jsFunction name="deleteDocument"
- status="globalStatus"
- action="#{documentHome.remove}"/>
- <h:outputLink tabindex="1"
-
accesskey="#{messages['lacewiki.button.docEdit.Delete.accesskey']}"
-
value="javascript:deleteConfirmation('\\'#{documentHome.instance.name}\\'','deleteDocument')"
- styleClass="button
sessionEventTrigger">
- <h:outputText escape="false"
styleClass="buttonLabel"
value="#{messages['lacewiki.button.docEdit.Delete']}"/>
- </h:outputLink>
+ <ui:decorate
template="includes/confirmationAction.xhtml">
+ <ui:param name="label"
value="#{messages['lacewiki.button.docEdit.Delete']}"/>
+ <ui:param name="accesskey"
value="#{messages['lacewiki.button.docEdit.Delete.accesskey']}"/>
+ <ui:param name="tabindex"
value="1"/>
+ <ui:param name="linkClass"
value="button sessionEventTrigger"/>
+ <ui:param name="escapeLabel"
value="false"/>
+ <ui:param name="jsFunctionName"
value="deleteDocument"/>
+ <ui:param name="message"
value="#{messages['lacewiki.label.AreYouSureYouWantToDelete']
+ .concat(':
\'').concat(documentHome.instance.name).concat('\'?')}"/>
+ <ui:define name="jsFunction">
+ <a:jsFunction name="#{jsFunctionName}"
+
action="#{documentHome.remove}"
+ status="globalStatus"/>
+ </ui:define>
+ </ui:decorate>
</s:fragment>
</div>
Added: trunk/examples/wiki/view/includes/confirmationAction.xhtml
===================================================================
--- trunk/examples/wiki/view/includes/confirmationAction.xhtml
(rev 0)
+++ trunk/examples/wiki/view/includes/confirmationAction.xhtml 2008-04-09 09:44:49 UTC
(rev 7884)
@@ -0,0 +1,19 @@
+<ui:composition
+
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:wiki="http://jboss.com/products/seam/wiki"
+
xmlns:a="https://ajax4jsf.dev.java.net/ajax"
+
xmlns:s="http://jboss.com/products/seam/taglib">
+
+<ui:insert name="jsFunction"/>
+
+<h:outputLink value="javascript://no-op"
+ onclick="actionConfirmation(
'#{wiki:escapeJSMessage(message)}' , '#{jsFunctionName}' )"
+ accesskey="#{accesskey}"
+ tabindex="#{tabindex}"
+ styleClass="#{not empty linkClass ? linkClass :
'button'}">
+ <h:outputText escape="#{not empty escapeLabel ? escapeLabel :
'true'}" styleClass="#{not empty labelClass ? labelClass :
'buttonLabel'}" value="#{label}"/>
+</h:outputLink>
+
+</ui:composition>
Modified: trunk/examples/wiki/view/includes/userControl.xhtml
===================================================================
--- trunk/examples/wiki/view/includes/userControl.xhtml 2008-04-09 09:16:02 UTC (rev
7883)
+++ trunk/examples/wiki/view/includes/userControl.xhtml 2008-04-09 09:44:49 UTC (rev
7884)
@@ -97,7 +97,7 @@
<s:span styleClass="label">
<h:outputText
value="#{messages['lacewiki.label.userControl.Password']} "/>
- <h:outputLink value="#"
id="openPasswordResetPopup" tabindex="50">
+ <h:outputLink value="#"
id="openPasswordResetPopup" tabindex="51">
<h:outputText styleClass="linkText"
escape="false"
value="(#{messages['lacewiki.button.userControl.ResetPassword']})"/>
</h:outputLink>
<h:outputText value=":"/>
Modified: trunk/examples/wiki/view/plugins/forumList/forumForm.xhtml
===================================================================
--- trunk/examples/wiki/view/plugins/forumList/forumForm.xhtml 2008-04-09 09:16:02 UTC
(rev 7883)
+++ trunk/examples/wiki/view/plugins/forumList/forumForm.xhtml 2008-04-09 09:44:49 UTC
(rev 7884)
@@ -72,16 +72,22 @@
<s:fragment rendered="#{forumHome.removable}">
- <a:jsFunction name="deleteForum"
- reRender="forumListPluginContainer,
messageBoxContainer"
- status="globalStatus"
- action="#{forumHome.remove}"/>
- <h:outputLink tabindex="1"
-
accesskey="#{messages['forum.button.Remove.accesskey']}"
-
value="javascript:deleteConfirmation('\\'#{forumHome.instance.name}\\'','deleteForum')"
- styleClass="button saveButton
sessionEventTrigger">
- <h:outputText escape="false"
styleClass="buttonLabel"
value="#{messages['forum.button.Remove']}"/>
- </h:outputLink>
+ <ui:decorate
template="../../includes/confirmationAction.xhtml">
+ <ui:param name="label"
value="#{messages['forum.button.Remove']}"/>
+ <ui:param name="accesskey"
value="#{messages['forum.button.Remove.accesskey']}"/>
+ <ui:param name="tabindex"
value="1"/>
+ <ui:param name="linkClass" value="button
sessionEventTrigger saveButton"/>
+ <ui:param name="escapeLabel"
value="false"/>
+ <ui:param name="jsFunctionName"
value="deleteForum"/>
+ <ui:param name="message"
value="#{messages['lacewiki.label.AreYouSureYouWantToDelete']
+ .concat(':
\'').concat(forumHome.instance.name).concat('\'?')}"/>
+ <ui:define name="jsFunction">
+ <a:jsFunction name="#{jsFunctionName}"
+ reRender="forumListPluginContainer,
messageBoxContainer"
+ action="#{forumHome.remove}"
+ status="globalStatus"/>
+ </ui:define>
+ </ui:decorate>
</s:fragment>
<a:commandLink action="#{forumHome.persist}"
rendered="#{!forumHome.managed}"
Modified: trunk/examples/wiki/view/plugins/forumReplies/plugin.xhtml
===================================================================
--- trunk/examples/wiki/view/plugins/forumReplies/plugin.xhtml 2008-04-09 09:16:02 UTC
(rev 7883)
+++ trunk/examples/wiki/view/plugins/forumReplies/plugin.xhtml 2008-04-09 09:44:49 UTC
(rev 7884)
@@ -139,14 +139,23 @@
</s:fragment>
<s:fragment
rendered="#{s:hasPermission('Comment', 'delete', currentDocument) and
not replyHome.showForm}">
- <a:jsFunction name="deleteReplyId#{c.id}"
- reRender="forumRepliesContainer"
- status="globalStatus"
-
action="#{replyHome.remove(c.id)}"/>
- <h:outputLink
value="javascript:deleteConfirmation('#{messages['lacewiki.label.commentsDisplay.CommentThread']}
\\'#{c.subject}\\'','deleteReplyId#{c.id}')"
- styleClass="button
sessionEventTrigger">
- <h:outputText
styleClass="buttonLabel"
value="#{messages['lacewiki.button.commentsDisplay.RemoveComment']}"/>
- </h:outputLink>
+ <ui:decorate
template="../../includes/confirmationAction.xhtml">
+ <ui:param name="label"
value="#{messages['lacewiki.button.commentsDisplay.RemoveComment']}"/>
+ <ui:param name="jsFunctionName"
value="deleteReplyId#{c.id}"/>
+ <ui:param name="message"
value="#{messages['lacewiki.label.AreYouSureYouWantToDelete']
+ .concat('
')
+
.concat(messages['lacewiki.label.commentsDisplay.CommentThread'])
+ .concat(':
\'')
+
.concat(c.subject)
+
.concat('\'?')}"/>
+ <ui:define name="jsFunction">
+ <a:jsFunction
name="#{jsFunctionName}"
+
reRender="forumRepliesContainer, messageBoxContainer"
+
action="#{replyHome.remove(c.id)}"
+
oncomplete="onAjaxRequestComplete()"
+
status="globalStatus"/>
+ </ui:define>
+ </ui:decorate>
</s:fragment>
</s:fragment>
Modified: trunk/examples/wiki/view/themes/default/js/lacewiki.js
===================================================================
--- trunk/examples/wiki/view/themes/default/js/lacewiki.js 2008-04-09 09:16:02 UTC (rev
7883)
+++ trunk/examples/wiki/view/themes/default/js/lacewiki.js 2008-04-09 09:44:49 UTC (rev
7884)
@@ -39,6 +39,12 @@
// ###################### Form helpers #################################
+function actionConfirmation(message, actionFunctionName) {
+ if (confirm(message)) {
+ eval(actionFunctionName+"()");
+ }
+}
+
function onAjaxRequestComplete() {
resetSessionTimeoutCheck();
wrapBoxes();
Modified: trunk/examples/wiki/view/themes/default/template.xhtml
===================================================================
--- trunk/examples/wiki/view/themes/default/template.xhtml 2008-04-09 09:16:02 UTC (rev
7883)
+++ trunk/examples/wiki/view/themes/default/template.xhtml 2008-04-09 09:44:49 UTC (rev
7884)
@@ -71,15 +71,6 @@
// ###################### Popups #################################
- function deleteConfirmation(message, deleteFunction) {
- var answer =
confirm("#{messages['lacewiki.label.AreYouSureYouWantToDelete']} "
- + message
- + "
#{messages['lacewiki.label.DeleteAllChildren']}");
- if (answer){
- eval(deleteFunction+"()");
- }
- }
-
var fadeInPopupDialog = function(hash) {
hash.w.fadeIn('fast',function(){ hash.o.show(); });
jQuery(".closeDialog", hash.w).attr("accesskey",
"#{messages['lacewiki.button.Cancel.accesskey']}"); // Dynamically
assign accesskey to .closeDialog buttons
Modified: trunk/examples/wiki/view/themes/inrelationto/js/lacewiki.js
===================================================================
--- trunk/examples/wiki/view/themes/inrelationto/js/lacewiki.js 2008-04-09 09:16:02 UTC
(rev 7883)
+++ trunk/examples/wiki/view/themes/inrelationto/js/lacewiki.js 2008-04-09 09:44:49 UTC
(rev 7884)
@@ -39,6 +39,12 @@
// ###################### Form helpers #################################
+function actionConfirmation(message, actionFunctionName) {
+ if (confirm(message)) {
+ eval(actionFunctionName+"()");
+ }
+}
+
function onAjaxRequestComplete() {
resetSessionTimeoutCheck();
wrapBoxes();
Modified: trunk/examples/wiki/view/themes/inrelationto/template.xhtml
===================================================================
--- trunk/examples/wiki/view/themes/inrelationto/template.xhtml 2008-04-09 09:16:02 UTC
(rev 7883)
+++ trunk/examples/wiki/view/themes/inrelationto/template.xhtml 2008-04-09 09:44:49 UTC
(rev 7884)
@@ -61,15 +61,6 @@
// ###################### Popups #################################
- function deleteConfirmation(message, deleteFunction) {
- var answer =
confirm("#{messages['lacewiki.label.AreYouSureYouWantToDelete']} "
- + message
- + "
#{messages['lacewiki.label.DeleteAllChildren']}");
- if (answer){
- eval(deleteFunction+"()");
- }
- }
-
var fadeInPopupDialog = function(hash) {
hash.w.fadeIn('fast',function(){ hash.o.show(); });
jQuery(".closeDialog", hash.w).attr("accesskey",
"#{messages['lacewiki.button.Cancel.accesskey']}"); // Dynamically
assign accesskey to .closeDialog buttons
Modified: trunk/examples/wiki/view/themes/sfwkorg/js/lacewiki.js
===================================================================
--- trunk/examples/wiki/view/themes/sfwkorg/js/lacewiki.js 2008-04-09 09:16:02 UTC (rev
7883)
+++ trunk/examples/wiki/view/themes/sfwkorg/js/lacewiki.js 2008-04-09 09:44:49 UTC (rev
7884)
@@ -39,6 +39,12 @@
// ###################### Form helpers #################################
+function actionConfirmation(message, actionFunctionName) {
+ if (confirm(message)) {
+ eval(actionFunctionName+"()");
+ }
+}
+
function onAjaxRequestComplete() {
resetSessionTimeoutCheck();
wrapBoxes();
Modified: trunk/examples/wiki/view/themes/sfwkorg/template.xhtml
===================================================================
--- trunk/examples/wiki/view/themes/sfwkorg/template.xhtml 2008-04-09 09:16:02 UTC (rev
7883)
+++ trunk/examples/wiki/view/themes/sfwkorg/template.xhtml 2008-04-09 09:44:49 UTC (rev
7884)
@@ -62,15 +62,6 @@
// ###################### Popups #################################
- function deleteConfirmation(message, deleteFunction) {
- var answer =
confirm("#{messages['lacewiki.label.AreYouSureYouWantToDelete']} "
- + message
- + "
#{messages['lacewiki.label.DeleteAllChildren']}");
- if (answer){
- eval(deleteFunction+"()");
- }
- }
-
var fadeInPopupDialog = function(hash) {
hash.w.fadeIn('fast',function(){ hash.o.show(); });
jQuery(".closeDialog", hash.w).attr("accesskey",
"#{messages['lacewiki.button.Cancel.accesskey']}"); // Dynamically
assign accesskey to .closeDialog buttons
Modified: trunk/examples/wiki/view/uploadEdit_d.xhtml
===================================================================
--- trunk/examples/wiki/view/uploadEdit_d.xhtml 2008-04-09 09:16:02 UTC (rev 7883)
+++ trunk/examples/wiki/view/uploadEdit_d.xhtml 2008-04-09 09:44:49 UTC (rev 7884)
@@ -141,15 +141,21 @@
</h:commandLink>
<s:fragment rendered="#{uploadHome.removable}">
- <a:jsFunction name="deleteUpload"
- status="globalStatus"
- action="#{uploadHome.remove}"/>
- <h:outputLink tabindex="1"
-
accesskey="#{messages['lacewiki.button.uploadEdit.Delete.accesskey']}"
-
value="javascript:deleteConfirmation('\\'#{uploadHome.instance.name}\\'','deleteUpload')"
- styleClass="button
sessionEventTrigger">
- <h:outputText escape="false"
styleClass="buttonLabel"
value="#{messages['lacewiki.button.uploadEdit.Delete']}"/>
- </h:outputLink>
+ <ui:decorate
template="includes/confirmationAction.xhtml">
+ <ui:param name="label"
value="#{messages['lacewiki.button.uploadEdit.Delete']}"/>
+ <ui:param name="accesskey"
value="#{messages['lacewiki.button.uploadEdit.Delete.accesskey']}"/>
+ <ui:param name="tabindex"
value="1"/>
+ <ui:param name="linkClass"
value="button sessionEventTrigger"/>
+ <ui:param name="escapeLabel"
value="false"/>
+ <ui:param name="jsFunctionName"
value="deleteUpload"/>
+ <ui:param name="message"
value="#{messages['lacewiki.label.AreYouSureYouWantToDelete']
+ .concat(':
\'').concat(uploadHome.instance.name).concat('\'?')}"/>
+ <ui:define name="jsFunction">
+ <a:jsFunction name="#{jsFunctionName}"
+
action="#{uploadHome.remove}"
+ status="globalStatus"/>
+ </ui:define>
+ </ui:decorate>
</s:fragment>
</div>
Modified: trunk/examples/wiki/view/userHome_d.xhtml
===================================================================
--- trunk/examples/wiki/view/userHome_d.xhtml 2008-04-09 09:16:02 UTC (rev 7883)
+++ trunk/examples/wiki/view/userHome_d.xhtml 2008-04-09 09:44:49 UTC (rev 7884)
@@ -317,15 +317,21 @@
</h:commandLink>
<s:fragment rendered="#{s:hasPermission('User',
'delete', userHome.instance)}">
- <a:jsFunction name="deleteUser"
- status="globalStatus"
- action="#{userHome.remove}"/>
- <h:outputLink tabindex="1"
-
accesskey="#{messages['lacewiki.button.userHome.Delete.accesskey']}"
-
value="javascript:deleteConfirmation('\\'#{userHome.instance.username}\\'','deleteUser')"
- styleClass="button sessionEventTrigger">
- <h:outputText escape="false"
styleClass="buttonLabel"
value="#{messages['lacewiki.button.userHome.Delete']}"/>
- </h:outputLink>
+ <ui:decorate
template="includes/confirmationAction.xhtml">
+ <ui:param name="label"
value="#{messages['lacewiki.button.userHome.Delete']}"/>
+ <ui:param name="accesskey"
value="#{messages['lacewiki.button.userHome.Delete.accesskey']}"/>
+ <ui:param name="tabindex" value="1"/>
+ <ui:param name="linkClass" value="button
sessionEventTrigger"/>
+ <ui:param name="escapeLabel"
value="false"/>
+ <ui:param name="jsFunctionName"
value="deleteUser"/>
+ <ui:param name="message"
value="#{messages['lacewiki.label.AreYouSureYouWantToDelete']
+ .concat(':
\'').concat(userHome.instance.username).concat('\'?')}"/>
+ <ui:define name="jsFunction">
+ <a:jsFunction name="#{jsFunctionName}"
+ action="#{userHome.remove}"
+ status="globalStatus"/>
+ </ui:define>
+ </ui:decorate>
</s:fragment>
</div>