Commit 4a924a7f authored by Ian Green's avatar Ian Green Committed by Guus der Kinderen

OF-35: Tidy up of pubsub pages after PEP refactor

* Tidied up imports
* Removed URL encode on URL params as this is done automatically.
* Removed URL decode of owner parameter as it is no longer double encoded.
* made extra param encoding consistent.
* added owner param to redirect URLS.
* added hidden owner field to delete form so redirect works.
parent 6b91addb
<%@ page import="org.jivesoftware.openfire.pubsub.Node,
<%@ page import="org.jivesoftware.openfire.pep.PEPServiceInfo,
org.jivesoftware.openfire.pubsub.Node,
org.jivesoftware.openfire.pubsub.PubSubServiceInfo,
org.jivesoftware.openfire.XMPPServer,
org.jivesoftware.util.CookieUtils,
org.jivesoftware.util.ParamUtils"
org.jivesoftware.util.ParamUtils,
org.jivesoftware.util.StringUtils,
org.xmpp.packet.JID,
java.net.URLEncoder"
errorPage="error.jsp"
%>
<%@ page import="org.jivesoftware.util.StringUtils" %>
<%@ page import="java.net.URLDecoder" %>
<%@ page import="org.xmpp.packet.JID" %>
<%@ page import="org.jivesoftware.openfire.pep.PEPServiceInfo" %>
<%@ page import="org.jivesoftware.openfire.pubsub.PubSubServiceInfo" %>
<%@ page import="java.net.URLEncoder" %>
<%@ page import="org.jivesoftware.openfire.XMPPServer" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="admin" prefix="admin" %>
<jsp:useBean id="webManager" class="org.jivesoftware.util.WebManager" />
<% webManager.init(request, response, session, application, out ); %>
......@@ -29,14 +29,13 @@
JID owner = null;
if (ownerString != null)
{
final String ownerValue = URLDecoder.decode( ownerString, "UTF-8" );
if ( ownerValue.contains( "@" ) )
if ( ownerString.contains( "@" ) )
{
owner = new JID( ownerValue ).asBareJID();
owner = new JID( ownerString ).asBareJID();
}
else
{
owner = XMPPServer.getInstance().createJID( ownerValue, null );
owner = XMPPServer.getInstance().createJID( ownerString, null );
}
}
......@@ -57,7 +56,7 @@
// Handle a cancel
if (cancel) {
response.sendRedirect("pubsub-node-summary.jsp");
response.sendRedirect("pubsub-node-summary.jsp"+ (owner != null ? "?owner=" + URLEncoder.encode(owner.toBareJID(), "UTF-8") : ""));
return;
}
......@@ -83,11 +82,13 @@
webManager.logEvent("destroyed PubSub Node " + nodeID, "reason = " + reason );
}
// Done, so redirect
response.sendRedirect("pubsub-node-summary.jsp?deletesuccess=true&owner=" + (owner != null ? URLEncoder.encode( owner.toBareJID(), "UTF-8") : "") );
response.sendRedirect("pubsub-node-summary.jsp?deletesuccess=true"
+ (owner != null ? "&owner=" + URLEncoder.encode( owner.toBareJID(), "UTF-8") : "") );
return;
}
pageContext.setAttribute("node", node);
pageContext.setAttribute("owner", owner);
%>
......@@ -97,11 +98,11 @@
<c:choose>
<c:when test="${not empty owner and owner.domain eq webManager.serverInfo.XMPPDomain}">
<meta name="subPageID" content="user-pep-node-summary"/>
<meta name="extraParams" content="username=${admin:urlEncode(owner.node)}&nodeID=${node.nodeID}" />
<meta name="extraParams" content="username=${admin:urlEncode(owner.node)}&nodeID=${admin:urlEncode(node.nodeID)}" />
</c:when>
<c:otherwise>
<meta name="subPageID" content="pubsub-node-delete"/>
<meta name="extraParams" content="nodeID=${node.nodeID}"/>
<meta name="extraParams" content="nodeID=${admin:urlEncode(node.nodeID)}"/>
</c:otherwise>
</c:choose>
</head>
......@@ -118,6 +119,7 @@
<form action="pubsub-node-delete.jsp">
<input type="hidden" name="csrf" value="${csrf}">
<input type="hidden" name="nodeID" value="${node.nodeID}">
<input type="hidden" name="owner" value="${owner}">
<fieldset>
<legend><fmt:message key="pubsub.node.delete.details_title" /></legend>
......
<%@ page import="org.jivesoftware.openfire.pubsub.LeafNode,
<%@ page import="org.jivesoftware.openfire.pep.PEPServiceInfo,
org.jivesoftware.openfire.pubsub.LeafNode,
org.jivesoftware.openfire.pubsub.Node,
org.jivesoftware.openfire.pubsub.PublishedItem,
org.jivesoftware.openfire.pubsub.PubSubServiceInfo,
org.jivesoftware.openfire.XMPPServer,
org.jivesoftware.util.CookieUtils,
org.jivesoftware.util.ParamUtils,
org.jivesoftware.util.StringUtils,
org.xmpp.packet.JID,
java.net.URLEncoder,
java.util.Arrays"
errorPage="error.jsp"
%>
<%@ page import="java.net.URLDecoder" %>
<%@ page import="org.xmpp.packet.JID" %>
<%@ page import="org.jivesoftware.openfire.pep.PEPServiceInfo" %>
<%@ page import="org.jivesoftware.openfire.pubsub.PubSubServiceInfo" %>
<%@ page import="org.jivesoftware.openfire.XMPPServer" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="admin" prefix="admin" %>
<jsp:useBean id="webManager" class="org.jivesoftware.util.WebManager" />
<% webManager.init(request, response, session, application, out); %>
......@@ -32,14 +32,13 @@
JID owner = null;
if (ownerString != null)
{
final String ownerValue = URLDecoder.decode( ownerString, "UTF-8" );
if ( ownerValue.contains( "@" ) )
if ( ownerString.contains( "@" ) )
{
owner = new JID( ownerValue ).asBareJID();
owner = new JID( ownerString ).asBareJID();
}
else
{
owner = XMPPServer.getInstance().createJID( ownerValue, null );
owner = XMPPServer.getInstance().createJID( ownerString, null );
}
}
......@@ -65,7 +64,7 @@
Node node = pubSubServiceInfo.getNode( nodeID );
if (node == null) {
// The requested node does not exist so return to the list of the existing node
response.sendRedirect("pubsub-node-summary.jsp");
response.sendRedirect("pubsub-node-summary.jsp"+ (owner != null ? "?owner=" + URLEncoder.encode(owner.toBareJID(), "UTF-8") : ""));
return;
}
......@@ -80,7 +79,10 @@
// Log the event
webManager.logEvent("Delete item ID: " + deleteID + ", from node ID: " + nodeID, "Publisher: " + pi.getPublisher().toBareJID());
// Done, so redirect
response.sendRedirect("pubsub-node-items.jsp?nodeID=" + URLEncoder.encode(nodeID, "UTF-8") + "&deleteSuccess=true&owner=" + (owner != null ? URLEncoder.encode(owner.toBareJID(), "UTF-8") : "") + "&ownerOfDeleted=" + URLEncoder.encode(pi.getPublisher().toBareJID(), "UTF-8"));
response.sendRedirect("pubsub-node-items.jsp?nodeID=" + URLEncoder.encode(nodeID, "UTF-8")
+ "&deleteSuccess=true"
+ (owner != null ? "&owner=" + URLEncoder.encode(owner.toBareJID(), "UTF-8") : "")
+ "&ownerOfDeleted=" + URLEncoder.encode(pi.getPublisher().toBareJID(), "UTF-8"));
return;
}
}
......@@ -100,11 +102,11 @@
<c:choose>
<c:when test="${not empty owner and owner.domain eq webManager.serverInfo.XMPPDomain}">
<meta name="subPageID" content="user-pep-node-summary"/>
<meta name="extraParams" content="username=${admin:urlEncode(owner.node)}&nodeID=${node.nodeID}&create=false" />
<meta name="extraParams" content="username=${admin:urlEncode(owner.node)}&nodeID=${admin:urlEncode(node.nodeID)}" />
</c:when>
<c:otherwise>
<meta name="subPageID" content="pubsub-node-items"/>
<meta name="extraParams" content="nodeID=${node.nodeID}&create=false"/>
<meta name="extraParams" content="nodeID=${admin:urlEncode(node.nodeID)}"/>
</c:otherwise>
</c:choose>
</head>
......@@ -194,7 +196,7 @@
<c:param name="nodeID" value="${node.getNodeID()}" />
<c:param name="deleteID" value="${item.getID()}" />
<c:param name="csrf" value="${csrf}" />
<c:param name="owner" value="${not empty owner ? admin:urlEncode(owner) : ''}"/>
<c:param name="owner" value="${owner}"/>
</c:url>
<a href="${url}" title="<fmt:message key="global.click_delete" />">
<img src="images/delete-16x16.gif" width="16" height="16" border="0" alt="">
......
<%@ page import="org.jivesoftware.openfire.pubsub.Node,
<%@ page import="org.jivesoftware.openfire.pep.PEPServiceInfo,
org.jivesoftware.openfire.pubsub.Node,
org.jivesoftware.openfire.pubsub.NodeSubscription,
org.jivesoftware.openfire.pubsub.PubSubServiceInfo,
org.jivesoftware.openfire.XMPPServer,
org.jivesoftware.util.CookieUtils,
org.jivesoftware.util.ParamUtils,
org.jivesoftware.util.StringUtils,
org.xmpp.packet.JID,
java.net.URLEncoder"
errorPage="error.jsp"
%>
<%@ page import="java.net.URLDecoder" %>
<%@ page import="org.xmpp.packet.JID" %>
<%@ page import="org.jivesoftware.openfire.pep.PEPServiceInfo" %>
<%@ page import="org.jivesoftware.openfire.pubsub.PubSubServiceInfo" %>
<%@ page import="org.jivesoftware.openfire.XMPPServer" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="admin" prefix="admin" %>
<jsp:useBean id="webManager" class="org.jivesoftware.util.WebManager" />
<% webManager.init(request, response, session, application, out); %>
......@@ -30,14 +30,13 @@
JID owner = null;
if (ownerString != null)
{
final String ownerValue = URLDecoder.decode( ownerString, "UTF-8" );
if ( ownerValue.contains( "@" ) )
if ( ownerString.contains( "@" ) )
{
owner = new JID( ownerValue ).asBareJID();
owner = new JID( ownerString ).asBareJID();
}
else
{
owner = XMPPServer.getInstance().createJID( ownerValue, null );
owner = XMPPServer.getInstance().createJID( ownerString, null );
}
}
......@@ -64,7 +63,7 @@
Node node = pubSubServiceInfo.getNode( nodeID );
if (node == null) {
// The requested node does not exist so return to the list of the existing node
response.sendRedirect("pubsub-node-summary.jsp");
response.sendRedirect("pubsub-node-summary.jsp" + (owner != null ? "?owner=" + URLEncoder.encode(owner.toBareJID(), "UTF-8") : ""));
return;
}
......@@ -77,7 +76,10 @@
// Log the event
webManager.logEvent("Cancelled subscription ID: " + deleteID + ", from node ID: " + nodeID, "Owner: " + subscription.getOwner().toBareJID());
// Done, so redirect
response.sendRedirect("pubsub-node-subscribers.jsp?nodeID=" + URLEncoder.encode(nodeID, "UTF-8") + "&deleteSuccess=true&owner=" + (owner != null ? URLEncoder.encode(owner.toBareJID(), "UTF-8") : "") + "&ownerOfDeleted=" + URLEncoder.encode(subscription.getOwner().toBareJID(), "UTF-8"));
response.sendRedirect("pubsub-node-subscribers.jsp?nodeID=" + URLEncoder.encode(nodeID, "UTF-8")
+ "&deleteSuccess=true"
+ (owner != null ? "&owner=" + URLEncoder.encode(owner.toBareJID(), "UTF-8") : "")
+ "&ownerOfDeleted=" + URLEncoder.encode(subscription.getOwner().toBareJID(), "UTF-8"));
return;
}
}
......@@ -96,11 +98,11 @@
<c:choose>
<c:when test="${not empty owner and owner.domain eq webManager.serverInfo.XMPPDomain}">
<meta name="subPageID" content="user-pep-node-summary"/>
<meta name="extraParams" content="username=${admin:urlEncode(owner.node)}&nodeID=${node.nodeID}&create=false" />
<meta name="extraParams" content="username=${admin:urlEncode(owner.node)}&nodeID=${admin:urlEncode(node.nodeID)}" />
</c:when>
<c:otherwise>
<meta name="subPageID" content="pubsub-node-subscribers"/>
<meta name="extraParams" content="nodeID=${node.nodeID}&create=false"/>
<meta name="extraParams" content="nodeID=${admin:urlEncode(node.nodeID)}"/>
</c:otherwise>
</c:choose>
</head>
......@@ -190,7 +192,7 @@
<c:param name="nodeID" value="${node.getNodeID()}" />
<c:param name="deleteID" value="${subscription.getID()}" />
<c:param name="csrf" value="${csrf}" />
<c:param name="owner" value="${not empty owner ? admin:urlEncode(owner) : ''}"/>
<c:param name="owner" value="${owner}"/>
</c:url>
<a href="${url}" title="<fmt:message key="global.click_delete" />">
<img src="images/delete-16x16.gif" width="16" height="16" border="0" alt="">
......
<%@ page import="org.jivesoftware.openfire.pubsub.Node,
<%@ page import="org.jivesoftware.openfire.pep.PEPService,
org.jivesoftware.openfire.pep.PEPServiceInfo,
org.jivesoftware.openfire.pep.PEPServiceManager,
org.jivesoftware.openfire.pubsub.Node,
org.jivesoftware.openfire.pubsub.PubSubServiceInfo,
org.jivesoftware.openfire.XMPPServer,
org.jivesoftware.util.ParamUtils,
java.util.Collections"
org.xmpp.packet.JID,
java.util.Collections,
java.util.Comparator,
java.util.List"
errorPage="error.jsp"
%>
<%@ page import="java.util.Comparator" %>
<%@ page import="java.util.List" %>
<%@ page import="org.xmpp.packet.JID" %>
<%@ page import="org.jivesoftware.openfire.pep.PEPServiceInfo" %>
<%@ page import="java.net.URLDecoder" %>
<%@ page import="org.jivesoftware.openfire.XMPPServer" %>
<%@ page import="org.jivesoftware.openfire.pep.PEPService" %>
<%@ page import="org.jivesoftware.openfire.pep.PEPServiceManager" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="admin" prefix="admin" %>
<jsp:useBean id="webManager" class="org.jivesoftware.util.WebManager" />
<% webManager.init(request, response, session, application, out ); %>
......@@ -30,14 +30,13 @@
JID owner = null;
if (ownerString != null)
{
final String ownerValue = URLDecoder.decode( ownerString, "UTF-8" );
if ( ownerValue.contains( "@" ) )
if ( ownerString.contains( "@" ) )
{
owner = new JID( ownerValue ).asBareJID();
owner = new JID( ownerString ).asBareJID();
}
else
{
owner = XMPPServer.getInstance().createJID( ownerValue, null );
owner = XMPPServer.getInstance().createJID( ownerString, null );
}
}
......@@ -103,7 +102,7 @@
<c:choose>
<c:when test="${not empty owner and owner.domain eq webManager.serverInfo.XMPPDomain}">
<meta name="subPageID" content="user-pep-node-summary"/>
<meta name="extraParams" content="username=${admin:urlEncode( owner.node)}" />
<meta name="extraParams" content="username=${admin:urlEncode(owner.node)}" />
</c:when>
<c:otherwise>
<meta name="pageID" content="pubsub-node-summary"/>
......@@ -148,7 +147,7 @@
<c:forEach begin="1" end="${numPages}" varStatus="loop">
<c:url value="pubsub-node-summary.jsp" var="url">
<c:param name="start" value="${(loop.index-1)*range}" />
<c:param name="owner" value="${not empty owner ? admin:urlEncode(owner) : ''}"/>
<c:param name="owner" value="${owner}"/>
</c:url>
<a href="${url}" class="${ loop.index == curPage ? 'jive-current' : ''}">
<c:out value="${loop.index}"/>
......@@ -202,7 +201,7 @@
<td width="1%" align="center">
<c:url value="pubsub-node-items.jsp" var="url">
<c:param name="nodeID" value="${node.getNodeID()}" />
<c:param name="owner" value="${not empty owner ? admin:urlEncode(owner) : ''}" />
<c:param name="owner" value="${owner}" />
</c:url>
<a href="${url}">
<c:out value="${node.getPublishedItems().size()}" />
......@@ -211,7 +210,7 @@
<td width="1%" align="center">
<c:url value="pubsub-node-subscribers.jsp" var="url">
<c:param name="nodeID" value="${node.getNodeID()}" />
<c:param name="owner" value="${not empty owner ? admin:urlEncode(owner) : ''}" />
<c:param name="owner" value="${owner}" />
</c:url>
<a href="${url}">
<c:out value="${node.getAllSubscriptions().size()}" />
......@@ -220,7 +219,7 @@
<td width="1%" align="center" style="border-right:1px #ccc solid;">
<c:url value="pubsub-node-delete.jsp" var="url">
<c:param name="nodeID" value="${node.getNodeID()}" />
<c:param name="owner" value="${not empty owner ? admin:urlEncode(owner) : ''}" />
<c:param name="owner" value="${owner}" />
</c:url>
<a href="${url}" title="<fmt:message key="global.click_delete" />">
<img src="images/delete-16x16.gif" width="16" height="16" border="0" alt="">
......@@ -241,7 +240,7 @@
<c:forEach begin="1" end="${numPages}" varStatus="loop">
<c:url value="pubsub-node-summary.jsp" var="url">
<c:param name="start" value="${(loop.index-1)*range}" />
<c:param name="owner" value="${not empty owner ? admin:urlEncode(owner) : ''}" />
<c:param name="owner" value="${owner}" />
</c:url>
<a href="${url}" class="${ loop.index == curPage ? 'jive-current' : ''}">
<c:out value="${loop.index}"/>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment