implement move message between topics in a conference
This commit is contained in:
parent
25c5817a67
commit
a404987a42
|
@ -172,6 +172,7 @@
|
|||
<button id="join_now" caption="Join Now" fixup="true">classic/join_now.jpg</button>
|
||||
<button id="login" caption="Log In" fixup="true">classic/login.jpg</button>
|
||||
<button id="manage" caption="Manage" fixup="true">classic/manage.jpg</button>
|
||||
<button id="move" caption="Move" fixup="true">classic/move.jpg</button>
|
||||
<button id="next" caption="Next" fixup="true">classic/arrow_next.jpg</button>
|
||||
<button id="next_topic" caption="Next Topic" fixup="true">classic/next_topic.jpg</button>
|
||||
<button id="next_topic_keep" caption="Next & Keep New"
|
||||
|
@ -229,6 +230,7 @@
|
|||
<button id="join_now" caption="Join Now" fixup="true">gelcap/join_now.jpg</button>
|
||||
<button id="login" caption="Log In" fixup="true">gelcap/login.jpg</button>
|
||||
<button id="manage" caption="Manage" fixup="true">gelcap/manage.jpg</button>
|
||||
<button id="move" caption="Move" fixup="true">gelcap/move.jpg</button>
|
||||
<button id="next" caption="Next" fixup="true">gelcap/arrow_next.jpg</button>
|
||||
<button id="next_topic" caption="Next Topic" fixup="true">gelcap/next_topic.jpg</button>
|
||||
<button id="next_topic_keep" caption="Next & Keep New" fixup="true">gelcap/next_keep_new.jpg</button>
|
||||
|
|
134
scripts/conf/move_message.js
Normal file
134
scripts/conf/move_message.js
Normal file
|
@ -0,0 +1,134 @@
|
|||
// The contents of this file are subject to the Mozilla Public License Version 1.1
|
||||
// (the "License"); you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at <http://www.mozilla.org/MPL/>.
|
||||
//
|
||||
// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
|
||||
// WARRANTY OF ANY KIND, either express or implied. See the License for the specific
|
||||
// language governing rights and limitations under the License.
|
||||
//
|
||||
// The Original Code is the Venice Web Communities System.
|
||||
//
|
||||
// The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
|
||||
// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
|
||||
// Copyright (C) 2002 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
||||
//
|
||||
// Contributor(s):
|
||||
|
||||
importPackage(java.util);
|
||||
importPackage(Packages.com.silverwrist.venice.core);
|
||||
importPackage(Packages.com.silverwrist.venice.except);
|
||||
importPackage(Packages.com.silverwrist.venice.ui);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.conf);
|
||||
importPackage(Packages.com.silverwrist.venice.ui.helpers);
|
||||
|
||||
// get the request object and the community
|
||||
rinput = bsf.lookupBean("request");
|
||||
comm = rinput.getCommunity(true,"top.js.vs");
|
||||
|
||||
// get the current conference
|
||||
currc = new CurrentConference(rinput);
|
||||
conf = currc.getConference(true,"conf/conferences.js.vs?cc=" + comm.communityID);
|
||||
|
||||
// get the current topic
|
||||
topic = currc.getTopic(true,"conf/topics.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID);
|
||||
|
||||
// get the message under consideration
|
||||
msg = currc.getTopicMessageParam("msg",true,"conf/posts.js.vs?cc=" + comm.communityID + "&conf="
|
||||
+ conf.confID + "&top=" + topic.topicNumber);
|
||||
on_error = "conf/posts.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID + "&top=" + topic.topicNumber
|
||||
+ "&p1=" + msg.getPostNumber() + "&shac=1";
|
||||
|
||||
if ("GET"==rinput.verb)
|
||||
{ // set up the prompt for which topic to move the post to
|
||||
rinput.setRequestAttribute("message.move.message",msg);
|
||||
poster = "";
|
||||
try
|
||||
{ // get the poster name
|
||||
poster = msg.creatorName;
|
||||
|
||||
} // end try
|
||||
catch (foo)
|
||||
{ // we hit a DataException here
|
||||
poster = "(unknown)";
|
||||
|
||||
} // end catch
|
||||
|
||||
rinput.setRequestAttribute("message.move.postername",poster);
|
||||
|
||||
rc = null;
|
||||
try
|
||||
{ // get the list of topics in the conference
|
||||
in_list = vlib.castList(conf.getTopicList(ConferenceContext.GET_ALL,ConferenceContext.SORT_NAME));
|
||||
out_list = vlib.createList();
|
||||
it = in_list.iterator();
|
||||
while (it.hasNext())
|
||||
{ // add all topic names to the list EXCEPT the current one
|
||||
xtopic = vlib.castTopicContext(it.next());
|
||||
if (xtopic.topicID!=topic.topicID)
|
||||
out_list.add(xtopic);
|
||||
|
||||
} // end while
|
||||
|
||||
rinput.setRequestAttribute("message.move.topics",out_list);
|
||||
|
||||
// create the actual view and output it
|
||||
rc = new JSPView("Move Message","conf/move_message.jsp");
|
||||
rc.menuSelector = Content.MENU_SELECTOR_COMMUNITY;
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // handle the exception here
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Database error listing messages: " + e.message,on_error);
|
||||
else if (etype.match("AccessError"))
|
||||
rc = new ErrorBox("Access Error",e.message,on_error);
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
vlib.output(rc);
|
||||
vlib.done();
|
||||
|
||||
} // end if ("GET" request)
|
||||
|
||||
if (rinput.isImageButtonClicked("cancel"))
|
||||
{ // Cancel button pressed - bounce back to the message
|
||||
vlib.output(new Redirect(on_error,LinkTypes.SERVLET));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
if (!(rinput.isImageButtonClicked("move")))
|
||||
{ // invalid command button pressed
|
||||
logger.error("no known button click on POST to conf/move_message.js");
|
||||
vlib.output(new ErrorBox("Internal Error","Invalid command button pressed.",on_error));
|
||||
vlib.done();
|
||||
|
||||
} // end if
|
||||
|
||||
rc = null;
|
||||
try
|
||||
{ // move the message!
|
||||
topic_id = rinput.getParameterInt("target",-1);
|
||||
msg.moveToTopic(topic_id);
|
||||
|
||||
// bounce to the topic we moved from
|
||||
rc = new Redirect("conf/posts.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID + "&top="
|
||||
+ topic.topicNumber,LinkTypes.SERVLET);
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // handle the exception
|
||||
etype = vlib.exceptionType(e) + "";
|
||||
if (etype.match("DataException"))
|
||||
rc = new ErrorBox("Database Error","Database error moving message: " + e.message,on_error);
|
||||
else if (etype.match("AccessError"))
|
||||
rc = new ErrorBox("Access Error",e.message,on_error);
|
||||
else
|
||||
rc = e;
|
||||
|
||||
} // end catch
|
||||
|
||||
vlib.output(rc); // all done...
|
|
@ -492,6 +492,7 @@ INSERT INTO refaudit (type, descr) VALUES
|
|||
(313, 'Nuke Message'),
|
||||
(314, 'Upload Message Attachment'),
|
||||
(315, 'Delete Conference'),
|
||||
(316, 'Move Message'),
|
||||
(9999999, 'DUMMY');
|
||||
|
||||
# Populate the Category table.
|
||||
|
|
|
@ -85,4 +85,8 @@ public interface TopicMessageContext
|
|||
|
||||
public abstract String getPostLink() throws DataException;
|
||||
|
||||
public abstract void moveToTopic(int newtopicid) throws DataException, AccessError;
|
||||
|
||||
public abstract boolean canMove();
|
||||
|
||||
} // end interface TopicMessageContext
|
||||
|
|
|
@ -1087,6 +1087,194 @@ class TopicMessageUserContextImpl implements TopicMessageContext
|
|||
|
||||
} // end getPostLink
|
||||
|
||||
public void moveToTopic(int newtopicid) throws DataException, AccessError
|
||||
{
|
||||
if (!(env.getConference().userCanNuke()) || !(env.getConference().userCanPost()))
|
||||
{ // we must have both Nuke and Post privileges in this conference to be able to move
|
||||
logger.error("trying to move post w/o permission!");
|
||||
throw new AccessError("You are not permitted to move this message to another topic.");
|
||||
|
||||
} // end if
|
||||
|
||||
if (newtopicid==topicid)
|
||||
return; // attempting to move to the same topic is a no-op
|
||||
|
||||
if (nuked)
|
||||
{ // we can't move a nuked message!
|
||||
logger.error("unable to move message because message nuked");
|
||||
throw new DataException("Cannot move a message that has been nuked.");
|
||||
|
||||
} // end if
|
||||
|
||||
if (scribble_date!=null)
|
||||
{ // we can't move a scribbled message!
|
||||
logger.error("unable to move because message scribbled");
|
||||
throw new DataException("Cannot move a message that has been scribbled.");
|
||||
|
||||
} // end if
|
||||
|
||||
Connection conn = null;
|
||||
AuditRecord ar = null;
|
||||
ArrayList mailto_addrs = null;
|
||||
int new_topic_num = -1;
|
||||
String new_topic_name = null, my_text = null;
|
||||
ResultSet rs;
|
||||
StringBuffer sql = new StringBuffer();
|
||||
|
||||
try
|
||||
{ // get a database connection
|
||||
conn = env.getConnection();
|
||||
Statement stmt = conn.createStatement();
|
||||
|
||||
// lock the tables we reference
|
||||
stmt.executeUpdate("LOCK TABLES confs WRITE, topics WRITE, posts WRITE, topicsettings READ;");
|
||||
|
||||
ArrayList mailto_uids = null;
|
||||
int old_topicid;
|
||||
|
||||
try
|
||||
{ // verify that we're not trying to move post 0 when that's the only one that exists
|
||||
if (num==0)
|
||||
{ // if we're moving post 0, check the number of posts in the topic
|
||||
rs = stmt.executeQuery("SELECT top_message FROM topics WHERE topicid = " + topicid + ";");
|
||||
if (!(rs.next()))
|
||||
throw new InternalStateError("unable to get current message's topic?!?!?");
|
||||
if (rs.getInt(1)==0)
|
||||
throw new DataException("You cannot move the only message out of a topic.");
|
||||
|
||||
} // end if
|
||||
|
||||
// verify that the target topic exists
|
||||
rs = stmt.executeQuery("SELECT confid, num, top_message, name FROM topics WHERE topicid = "
|
||||
+ newtopicid + ";");
|
||||
if (!(rs.next()))
|
||||
throw new DataException("The specified topic to move the message to does not exist.");
|
||||
if (env.getConfID()!=rs.getInt(1))
|
||||
throw new AccessError("The topic to move the message to must be within the same conference.");
|
||||
int newconfid = rs.getInt(1);
|
||||
new_topic_num = rs.getInt(2);
|
||||
int new_post_num = rs.getInt(3) + 1;
|
||||
new_topic_name = rs.getString(4);
|
||||
|
||||
// save off the old parent, topic ID, and old post number
|
||||
long old_parent = parent;
|
||||
old_topicid = topicid;
|
||||
int old_post_num = num;
|
||||
|
||||
// adjust the post record in the database so it's part of the new topic
|
||||
sql.append("UPDATE posts SET parent = 0, topicid = ").append(newtopicid).append(", num = ");
|
||||
sql.append(new_post_num).append(" WHERE postid = ").append(postid).append(';');
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("SQL: " + sql.toString());
|
||||
stmt.executeUpdate(sql.toString());
|
||||
parent = 0;
|
||||
topicid = newtopicid;
|
||||
num = new_post_num;
|
||||
|
||||
// Touch the topic values to reflect the added post.
|
||||
sql.setLength(0);
|
||||
java.util.Date now = new java.util.Date();
|
||||
sql.append("UPDATE topics SET top_message = ").append(new_post_num).append(", lastupdate = '");
|
||||
sql.append(SQLUtil.encodeDate(now)).append("' WHERE topicid = ").append(newtopicid).append(';');
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("SQL: " + sql.toString());
|
||||
stmt.executeUpdate(sql.toString());
|
||||
|
||||
// Now we have to renumber the remaining posts in the "old" topic, just as if the post had been
|
||||
// nuked rather than moved.
|
||||
// -----
|
||||
// Phase 1 of renumber - Renumber all posts IN THIS TOPIC that had a number higher than the one
|
||||
// we just shifted over.
|
||||
stmt.executeUpdate("UPDATE posts SET num = (num - 1) WHERE topicid = " + old_topicid + " AND num > "
|
||||
+ old_post_num + ";");
|
||||
|
||||
// Phase 2 of renumber - The topic now has one less post in it. Reflect that.
|
||||
stmt.executeUpdate("UPDATE topics SET top_message = (top_message - 1) WHERE topicid = "
|
||||
+ old_topicid + ";");
|
||||
|
||||
// Also reparent any posts that had this one as a parent.
|
||||
stmt.executeUpdate("UPDATE posts SET parent = " + old_parent + " WHERE parent = " + postid + ";");
|
||||
|
||||
// Touch the "conference updated" indicator.
|
||||
env.getConference().touchUpdate(conn,now);
|
||||
|
||||
// Who's subscribed to the new topic? Whoever it is, they need to get this post via E-mail.
|
||||
sql.setLength(0);
|
||||
sql.append("SELECT uid FROM topicsettings WHERE topicid = ").append(newtopicid);
|
||||
sql.append(" AND subscribe = 1;");
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("SQL: " + sql.toString());
|
||||
rs = stmt.executeQuery(sql.toString());
|
||||
while (rs.next())
|
||||
{ // load the UIDs here
|
||||
if (mailto_uids==null)
|
||||
mailto_uids = new ArrayList();
|
||||
mailto_uids.add(new Integer(rs.getInt(1)));
|
||||
|
||||
} // end while
|
||||
|
||||
} // end try
|
||||
finally
|
||||
{ // unlock the tables before we go
|
||||
Statement ulk_stmt = conn.createStatement();
|
||||
ulk_stmt.executeUpdate("UNLOCK TABLES;");
|
||||
|
||||
} // end finally
|
||||
|
||||
// record what we did in an audit record
|
||||
ar = env.newAudit(AuditRecord.MOVE_MESSAGE,"conf=" + env.getConfID() + ",post=" + postid,
|
||||
"fromtopic=" + old_topicid,"totopic=" + newtopicid);
|
||||
|
||||
if (mailto_uids!=null)
|
||||
{ // We need to translate the "mailto" UIDs to E-mail addresses while we still have the database open!
|
||||
mailto_addrs = new ArrayList(mailto_uids.size());
|
||||
sql.setLength(0);
|
||||
sql.append("SELECT c.email FROM users u, contacts c WHERE u.contactid = c.contactid AND u.uid ");
|
||||
if (mailto_uids.size()==1)
|
||||
sql.append("= ").append(mailto_uids.get(0)).append(';');
|
||||
else
|
||||
sql.append("IN (").append(StringUtil.join(mailto_uids,", ")).append(");");
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("SQL: " + sql.toString());
|
||||
rs = stmt.executeQuery(sql.toString());
|
||||
while (rs.next())
|
||||
mailto_addrs.add(rs.getString(1));
|
||||
|
||||
// also load the message's text for E-mailing
|
||||
my_text = this.getBodyText();
|
||||
|
||||
} // end if
|
||||
|
||||
} // end try
|
||||
catch (SQLException e)
|
||||
{ // just trap SQL exceptions and log them
|
||||
logger.error("unable to move message: " + e.getMessage(),e);
|
||||
throw new DataException("unable to move message: " + e.getMessage(),e);
|
||||
|
||||
} // end catch
|
||||
finally
|
||||
{ // make sure we release the connection before we go
|
||||
AuditRecord.store(conn,ar);
|
||||
env.releaseConnection(conn);
|
||||
|
||||
} // end finally
|
||||
|
||||
if (mailto_addrs!=null)
|
||||
{ // spin off a background thread to generate the E-mails
|
||||
PostDeliveryAgent agent = new PostDeliveryAgent(env,my_text,pseud,new_topic_name,new_topic_num,
|
||||
mailto_addrs);
|
||||
agent.start();
|
||||
|
||||
} // end if
|
||||
|
||||
} // end moveToTopic
|
||||
|
||||
public boolean canMove()
|
||||
{
|
||||
return (env.getConference().userCanNuke() && env.getConference().userCanPost());
|
||||
|
||||
} // end canMove
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* External static operations
|
||||
*--------------------------------------------------------------------------------
|
||||
|
|
|
@ -67,5 +67,6 @@ public interface Audit
|
|||
public static final int NUKE_MESSAGE = 313;
|
||||
public static final int UPLOAD_ATTACHMENT = 314;
|
||||
public static final int DELETE_CONF = 315;
|
||||
public static final int MOVE_MESSAGE = 316;
|
||||
|
||||
} // end interface Audit
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
*
|
||||
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
|
||||
* for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
|
||||
* Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
||||
* Copyright (C) 2001-02 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
@ -27,7 +27,7 @@ import com.silverwrist.venice.ui.*;
|
|||
public class FrameContentHereTag extends VeniceTagSupport
|
||||
{
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Overrides from class TagSupport
|
||||
* Static data members
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
|
86
src/com/silverwrist/venice/ui/jsp/UtilCallJSPTag.java
Normal file
86
src/com/silverwrist/venice/ui/jsp/UtilCallJSPTag.java
Normal file
|
@ -0,0 +1,86 @@
|
|||
/*
|
||||
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
||||
* (the "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at <http://www.mozilla.org/MPL/>.
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
|
||||
* WARRANTY OF ANY KIND, either express or implied. See the License for the specific
|
||||
* language governing rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is the Venice Web Communities System.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
|
||||
* for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
|
||||
* Copyright (C) 2002 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
package com.silverwrist.venice.ui.jsp;
|
||||
|
||||
import java.io.IOException;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.jsp.*;
|
||||
import javax.servlet.jsp.tagext.*;
|
||||
import com.silverwrist.venice.ui.*;
|
||||
import com.silverwrist.venice.ui.view.NestedJSPView;
|
||||
|
||||
public class UtilCallJSPTag extends VeniceTagSupport
|
||||
{
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Attributes
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
private String name = null;
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Overrides from class TagSupport
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
public int doStartTag() throws JspException
|
||||
{
|
||||
if (name==null)
|
||||
throw new JspTagException("<call_jsp/> tag specified without a JSP name");
|
||||
|
||||
try
|
||||
{ // do what we came here to accomplish
|
||||
JspWriter out = pageContext.getOut();
|
||||
out.flush();
|
||||
getRequestOutput().output(out,new NestedJSPView(getContent(),name));
|
||||
|
||||
} // end try
|
||||
catch (IOException e)
|
||||
{ // convert the I/O error into something the servlet engine can deal with
|
||||
throw new JspTagException("error writing comment start - " + e.getMessage());
|
||||
|
||||
} // end catch
|
||||
catch (ServletException se)
|
||||
{ // convert the servlet exception into something we can deal with, too
|
||||
throw new JspTagException("Servlet error writing frame content - " + se.getMessage());
|
||||
|
||||
} // end catch
|
||||
|
||||
return SKIP_BODY;
|
||||
|
||||
} // end doStartTag
|
||||
|
||||
public void release()
|
||||
{
|
||||
super.release();
|
||||
name = null;
|
||||
|
||||
} // end release
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Attribute set functions
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
public void setName(String s)
|
||||
{
|
||||
name = s;
|
||||
|
||||
} // end setName
|
||||
|
||||
} // end class UtilCallJSPTag
|
|
@ -93,6 +93,14 @@ public class ScriptLibrary
|
|||
|
||||
} // end castSideBoxDescriptor
|
||||
|
||||
public final TopicContext castTopicContext(Object o)
|
||||
{
|
||||
if (o instanceof TopicContext)
|
||||
return (TopicContext)o;
|
||||
throw new ClassCastException("ScriptLibrary.castTopicContext: invalid cast");
|
||||
|
||||
} // end castTopicContext
|
||||
|
||||
public final TopicMessageContext castTopicMessageContext(Object o)
|
||||
{
|
||||
if (o instanceof TopicMessageContext)
|
||||
|
|
163
src/com/silverwrist/venice/ui/view/NestedJSPView.java
Normal file
163
src/com/silverwrist/venice/ui/view/NestedJSPView.java
Normal file
|
@ -0,0 +1,163 @@
|
|||
/*
|
||||
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
||||
* (the "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at <http://www.mozilla.org/MPL/>.
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
|
||||
* WARRANTY OF ANY KIND, either express or implied. See the License for the specific
|
||||
* language governing rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is the Venice Web Communities System.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
|
||||
* for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
|
||||
* Copyright (C) 2002 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
package com.silverwrist.venice.ui.view;
|
||||
|
||||
import java.util.Date;
|
||||
import javax.servlet.*;
|
||||
import com.silverwrist.venice.core.CommunityContext;
|
||||
import com.silverwrist.venice.ui.*;
|
||||
import com.silverwrist.venice.ui.servlet.RequestImpl;
|
||||
|
||||
public class NestedJSPView implements ContentJSP
|
||||
{
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Attributes
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
private Content outer;
|
||||
private String jspname;
|
||||
private RequestInput rinput = null;
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Constructor
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
public NestedJSPView(Content outer, String jspname)
|
||||
{
|
||||
this.outer = outer;
|
||||
this.jspname = jspname;
|
||||
|
||||
} // end constructor
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Implementations from interface Content
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
public boolean needFrame()
|
||||
{
|
||||
return outer.needFrame();
|
||||
|
||||
} // end needFrame
|
||||
|
||||
public int getMenuSelector()
|
||||
{
|
||||
return outer.getMenuSelector();
|
||||
|
||||
} // end getMenuSelector
|
||||
|
||||
public String getPageTitle(RequestOutput ro)
|
||||
{
|
||||
return outer.getPageTitle(ro);
|
||||
|
||||
} // end getPageTitle
|
||||
|
||||
public String getPageQID()
|
||||
{
|
||||
return outer.getPageQID();
|
||||
|
||||
} // end getPageQID
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Implementations from interface ContentJSP
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
public String getJSPName()
|
||||
{
|
||||
return jspname;
|
||||
|
||||
} // end getJSPName
|
||||
|
||||
public void initialize(RequestInput req)
|
||||
{
|
||||
rinput = req;
|
||||
|
||||
} // end initialize
|
||||
|
||||
public void terminate(RequestInput req)
|
||||
{
|
||||
rinput = null;
|
||||
|
||||
} // end terminate
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* External operations
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
public final Content getOuterView()
|
||||
{
|
||||
return outer;
|
||||
|
||||
} // end getOuterView
|
||||
|
||||
public final Object getRequestAttribute(String s)
|
||||
{
|
||||
return ((rinput==null) ? null : rinput.getRequestAttribute(s));
|
||||
|
||||
} // end getRequestAttribute
|
||||
|
||||
public final String formatDate(Date date)
|
||||
{
|
||||
return ((rinput==null) ? null : rinput.formatDate(date));
|
||||
|
||||
} // end formatDate
|
||||
|
||||
public final CommunityContext getCommunity()
|
||||
{
|
||||
return ((rinput==null) ? null : rinput.getCommunity());
|
||||
|
||||
} // end getCommunity
|
||||
|
||||
public final String getActivityString(Date date)
|
||||
{
|
||||
return ((rinput==null) ? null : rinput.getActivityString(date));
|
||||
|
||||
} // end getActivityString
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* External static operations
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
public static final NestedJSPView get(ServletRequest sreq) throws ServletException
|
||||
{
|
||||
Object obj = sreq.getAttribute(RequestImpl.REQUEST_CONTENT);
|
||||
if (obj==null)
|
||||
throw new ServletException("NestedJSPView.get: unable to get request content");
|
||||
if (obj instanceof NestedJSPView)
|
||||
return (NestedJSPView)obj;
|
||||
throw new ServletException("NestedJSPView.get: request content is not a NestedJSPView object");
|
||||
|
||||
} // end get
|
||||
|
||||
public static final RequestOutput getRequestOutput(ServletRequest sreq) throws ServletException
|
||||
{
|
||||
Object obj = sreq.getAttribute(RequestImpl.REQUEST_OUTPUT);
|
||||
if (obj==null)
|
||||
throw new ServletException("NestedJSPView.getRequestOutput: unable to get request object");
|
||||
if (obj instanceof RequestOutput)
|
||||
return (RequestOutput)obj;
|
||||
throw new ServletException("NestedJSPView.getRequestOutput: request object is not a RequestOutput object");
|
||||
|
||||
} // end getRequestOutput
|
||||
|
||||
} // end class NestedJSPView
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
|
||||
for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
|
||||
Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
||||
Copyright (C) 2001-02 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
-->
|
||||
|
@ -365,4 +365,16 @@
|
|||
<bodycontent>JSP</bodycontent>
|
||||
</tag>
|
||||
|
||||
<tag>
|
||||
<name>call_jsp</name>
|
||||
<tagclass>com.silverwrist.venice.ui.jsp.UtilCallJSPTag</tagclass>
|
||||
<info>Calls another JSP page from within this one.</info>
|
||||
<bodycontent>EMPTY</bodycontent>
|
||||
<attribute>
|
||||
<name>name</name>
|
||||
<required>true</required>
|
||||
<rtexprvalue>false</rtexprvalue>
|
||||
</attribute>
|
||||
</tag>
|
||||
|
||||
</taglib>
|
||||
|
|
65
web/format/conf/move_message.jsp
Normal file
65
web/format/conf/move_message.jsp
Normal file
|
@ -0,0 +1,65 @@
|
|||
<%--
|
||||
The contents of this file are subject to the Mozilla Public License Version 1.1
|
||||
(the "License"); you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at <http://www.mozilla.org/MPL/>.
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
|
||||
WARRANTY OF ANY KIND, either express or implied. See the License for the specific
|
||||
language governing rights and limitations under the License.
|
||||
|
||||
The Original Code is the Venice Web Communities System.
|
||||
|
||||
The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
|
||||
for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
|
||||
Copyright (C) 2002 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
--%>
|
||||
<%@ page import = "java.util.*" %>
|
||||
<%@ page import = "com.silverwrist.venice.core.*" %>
|
||||
<%@ page import = "com.silverwrist.venice.ui.conf.CurrentConference" %>
|
||||
<%@ page import = "com.silverwrist.venice.ui.view.JSPView" %>
|
||||
<%@ taglib uri="/tlds/util" prefix="util" %>
|
||||
<%@ taglib uri="/tlds/community" prefix="comm" %>
|
||||
<%@ taglib uri="/tlds/conference" prefix="conf" %>
|
||||
<%@ taglib uri="/tlds/topic" prefix="topic" %>
|
||||
<%
|
||||
JSPView view = JSPView.get(request);
|
||||
CurrentConference currc = CurrentConference.get(request);
|
||||
TopicMessageContext msg = (TopicMessageContext)(view.getRequestAttribute("message.move.message"));
|
||||
final String poster = view.getRequestAttribute("message.move.postername").toString();
|
||||
final List targets = (List)(view.getRequestAttribute("message.move.topics"));
|
||||
%>
|
||||
<util:comment>Moving message #<%= msg.getPostID() %> to another topic</util:comment>
|
||||
<util:header title="Move Message"/>
|
||||
<util:font color="content.fg" size="content">
|
||||
Message <%= msg.getPostNumber() %> of <topic:last_message/>:
|
||||
<% if (msg.isHidden()) { %>
|
||||
<B><EM>(Hidden)</EM></B>
|
||||
<% } // end if %>
|
||||
<BR>
|
||||
<B><%= msg.getPseud() %></B>
|
||||
(<EM>
|
||||
<util:xlink target="_blank">
|
||||
<util:href type="servlet">user/<%= poster %></util:href>
|
||||
<util:text><%= poster %></util:text>
|
||||
</util:xlink>,
|
||||
<%= view.formatDate(msg.getPostDate()) %>
|
||||
</EM>)
|
||||
<P>
|
||||
<util:form action="conf/move_message.js.vs" type="servlet">
|
||||
<INPUT TYPE="HIDDEN" NAME="cc" VALUE="<comm:ID/>">
|
||||
<INPUT TYPE="HIDDEN" NAME="conf" VALUE="<conf:ID/>">
|
||||
<INPUT TYPE="HIDDEN" NAME="top" VALUE="<topic:number/>">
|
||||
<INPUT TYPE="HIDDEN" NAME="msg" VALUE="<%= msg.getPostNumber() %>">
|
||||
<B>Move to topic:</B>
|
||||
<SELECT NAME="target" SIZE="1">
|
||||
<% Iterator it = targets.iterator(); %>
|
||||
<% while (it.hasNext()) { %>
|
||||
<% TopicContext xtopic = (TopicContext)(it.next()); %>
|
||||
<OPTION VALUE="<%= xtopic.getTopicID() %>"><%= xtopic.getName() %></OPTION>
|
||||
<% } // end while %>
|
||||
</SELECT><P>
|
||||
<util:button id="move" type="input"/> <util:button id="cancel" type="input"/>
|
||||
</util:form><P>
|
||||
</util:font>
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
|
||||
for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
|
||||
Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
||||
Copyright (C) 2001-02 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
--%>
|
||||
|
@ -58,49 +58,7 @@
|
|||
<TABLE BORDER=0 WIDTH="100%" CELLPADDING=0 CELLSPACING=0>
|
||||
<TR VALIGN=BOTTOM>
|
||||
<TD NOWRAP ALIGN=LEFT COLSPAN=2 CLASS="content">
|
||||
<util:comment>Topic user controls section</util:comment>
|
||||
<util:xlink>
|
||||
<util:href type="servlet">conf/topics.js.vs?<%= base_locator %></util:href>
|
||||
<util:text><util:button id="topic_list"/></util:text>
|
||||
</util:xlink>
|
||||
|
||||
<% if (my_topic.isHidden()) { %>
|
||||
<util:xlink>
|
||||
<util:href type="servlet">conf/hide_topic.js.vs?<%= topic_locator %>&flag=0</util:href>
|
||||
<util:text><util:button id="show_topic"/></util:text>
|
||||
</util:xlink>
|
||||
<% } else { %>
|
||||
<util:xlink>
|
||||
<util:href type="servlet">conf/hide_topic.js.vs?<%= topic_locator %>&flag=1</util:href>
|
||||
<util:text><util:button id="hide_topic"/></util:text>
|
||||
</util:xlink>
|
||||
<% } // end if %>
|
||||
|
||||
<% if (view.canDoNextTopic()) { %>
|
||||
<util:xlink>
|
||||
<util:href type="servlet">conf/posts.js.vs?<%= next_locator %>&rnm=1</util:href>
|
||||
<util:text><util:button id="next_topic"/></util:text>
|
||||
</util:xlink>
|
||||
|
||||
<% if (my_unread>0) { %>
|
||||
<util:xlink>
|
||||
<util:href type="servlet">conf/posts.js.vs?<%= next_locator %>&rnm=1&<%= restorer %></util:href>
|
||||
<util:text><util:button id="next_topic_keep"/></util:text>
|
||||
</util:xlink>
|
||||
|
||||
<%
|
||||
} // end if
|
||||
} // end if
|
||||
%>
|
||||
<util:xlink>
|
||||
<util:href type="servlet">conf/find.js.vs?<%= topic_locator %></util:href>
|
||||
<util:text><util:button id="find"/></util:text>
|
||||
</util:xlink>
|
||||
|
||||
<util:xlink>
|
||||
<util:href type="servlet">conf/manage_topic.js.vs?<%= topic_locator %></util:href>
|
||||
<util:text><util:button id="manage"/></util:text>
|
||||
</util:xlink>
|
||||
<util:call_jsp name="conf/posts_usercontrols.jsp"/>
|
||||
</TD>
|
||||
</TR>
|
||||
<% out.flush(); response.flushBuffer(); %>
|
||||
|
@ -388,6 +346,16 @@ conf/posts.js.vs?<%= topic_locator %>&p1=<%= my_last + 1 %>&p2=<%= Math.min(my_l
|
|||
</util:xlink><P>
|
||||
<%
|
||||
} // end if (can nuke)
|
||||
if (msg.canMove() && (my_topic.getTotalMessages()>1)) {
|
||||
%>
|
||||
<util:xlink>
|
||||
<util:href type="servlet">
|
||||
conf/move_message.js.vs?<%= topic_locator %>&msg=<%= msg.getPostNumber() %>
|
||||
</util:href>
|
||||
<util:text><util:button id="move"/></util:text>
|
||||
</util:xlink><P>
|
||||
<%
|
||||
} // end if (can move)
|
||||
if (msg.canPublish()) {
|
||||
%>
|
||||
<util:xlink>
|
||||
|
@ -451,49 +419,7 @@ conf/posts.js.vs?<%= topic_locator %>&p1=<%= my_last + 1 %>&p2=<%= Math.min(my_l
|
|||
|
||||
<TR VALIGN=BOTTOM>
|
||||
<TD NOWRAP ALIGN=LEFT COLSPAN=2 CLASS="content">
|
||||
<util:comment>Topic user controls section</util:comment>
|
||||
<util:xlink>
|
||||
<util:href type="servlet">conf/topics.js.vs?<%= base_locator %></util:href>
|
||||
<util:text><util:button id="topic_list"/></util:text>
|
||||
</util:xlink>
|
||||
|
||||
<% if (my_topic.isHidden()) { %>
|
||||
<util:xlink>
|
||||
<util:href type="servlet">conf/hide_topic.js.vs?<%= topic_locator %>&flag=0</util:href>
|
||||
<util:text><util:button id="show_topic"/></util:text>
|
||||
</util:xlink>
|
||||
<% } else { %>
|
||||
<util:xlink>
|
||||
<util:href type="servlet">conf/hide_topic.js.vs?<%= topic_locator %>&flag=1</util:href>
|
||||
<util:text><util:button id="hide_topic"/></util:text>
|
||||
</util:xlink>
|
||||
<% } // end if %>
|
||||
|
||||
<% if (view.canDoNextTopic()) { %>
|
||||
<util:xlink>
|
||||
<util:href type="servlet">conf/posts.js.vs?<%= next_locator %>&rnm=1</util:href>
|
||||
<util:text><util:button id="next_topic"/></util:text>
|
||||
</util:xlink>
|
||||
|
||||
<% if (my_unread>0) { %>
|
||||
<util:xlink>
|
||||
<util:href type="servlet">conf/posts.js.vs?<%= next_locator %>&rnm=1&<%= restorer %></util:href>
|
||||
<util:text><util:button id="next_topic_keep"/></util:text>
|
||||
</util:xlink>
|
||||
|
||||
<%
|
||||
} // end if
|
||||
} // end if
|
||||
%>
|
||||
<util:xlink>
|
||||
<util:href type="servlet">conf/find.js.vs?<%= topic_locator %></util:href>
|
||||
<util:text><util:button id="find"/></util:text>
|
||||
</util:xlink>
|
||||
|
||||
<util:xlink>
|
||||
<util:href type="servlet">conf/manage_topic.js.vs?<%= topic_locator %></util:href>
|
||||
<util:text><util:button id="manage"/></util:text>
|
||||
</util:xlink>
|
||||
<util:call_jsp name="conf/posts_usercontrols.jsp"/>
|
||||
</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
|
|
88
web/format/conf/posts_usercontrols.jsp
Normal file
88
web/format/conf/posts_usercontrols.jsp
Normal file
|
@ -0,0 +1,88 @@
|
|||
<%--
|
||||
The contents of this file are subject to the Mozilla Public License Version 1.1
|
||||
(the "License"); you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at <http://www.mozilla.org/MPL/>.
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
|
||||
WARRANTY OF ANY KIND, either express or implied. See the License for the specific
|
||||
language governing rights and limitations under the License.
|
||||
|
||||
The Original Code is the Venice Web Communities System.
|
||||
|
||||
The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
|
||||
for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
|
||||
Copyright (C) 2002 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
--%>
|
||||
<%@ page import = "java.util.*" %>
|
||||
<%@ page import = "com.silverwrist.venice.core.*" %>
|
||||
<%@ page import = "com.silverwrist.venice.ui.conf.CurrentConference" %>
|
||||
<%@ page import = "com.silverwrist.venice.ui.conf.view.PostsView" %>
|
||||
<%@ page import = "com.silverwrist.venice.ui.view.NestedJSPView" %>
|
||||
<%@ taglib uri="/tlds/util" prefix="util" %>
|
||||
<%@ taglib uri="/tlds/community" prefix="comm" %>
|
||||
<%@ taglib uri="/tlds/conference" prefix="conf" %>
|
||||
<%@ taglib uri="/tlds/topic" prefix="topic" %>
|
||||
<%
|
||||
NestedJSPView view = NestedJSPView.get(request);
|
||||
PostsView outer_view = (PostsView)(view.getOuterView());
|
||||
final int my_unread = outer_view.getUnread();
|
||||
final short my_next = outer_view.getNextTopic();
|
||||
final String restorer = "rtop=" + outer_view.getTopic().getTopicNumber() + "&rct=" + my_unread;
|
||||
%>
|
||||
<%-- Broken out from posts.jsp, which was getting too large and complex --%>
|
||||
<util:comment>Topic user controls section</util:comment>
|
||||
<util:xlink>
|
||||
<util:href type="servlet">conf/topics.js.vs?cc=<comm:ID/>&conf=<conf:ID/></util:href>
|
||||
<util:text><util:button id="topic_list"/></util:text>
|
||||
</util:xlink>
|
||||
|
||||
<topic:is_hidden>
|
||||
<util:xlink>
|
||||
<util:href type="servlet">
|
||||
conf/hide_topic.js.vs?cc=<comm:ID/>&conf=<conf:ID/>&top=<topic:number/>&flag=0
|
||||
</util:href>
|
||||
<util:text><util:button id="show_topic"/></util:text>
|
||||
</util:xlink>
|
||||
</topic:is_hidden>
|
||||
<topic:is_not_hidden>
|
||||
<util:xlink>
|
||||
<util:href type="servlet">
|
||||
conf/hide_topic.js.vs?cc=<comm:ID/>&conf=<conf:ID/>&top=<topic:number/>&flag=1
|
||||
</util:href>
|
||||
<util:text><util:button id="hide_topic"/></util:text>
|
||||
</util:xlink>
|
||||
</topic:is_not_hidden>
|
||||
|
||||
<% if (outer_view.canDoNextTopic()) { %>
|
||||
<util:xlink>
|
||||
<util:href type="servlet">
|
||||
conf/posts.js.vs?cc=<comm:ID/>&conf=<conf:ID/>&top=<%= my_next %>&rnm=1
|
||||
</util:href>
|
||||
<util:text><util:button id="next_topic"/></util:text>
|
||||
</util:xlink>
|
||||
|
||||
<% if (my_unread>0) { %>
|
||||
<util:xlink>
|
||||
<util:href type="servlet">
|
||||
conf/posts.js.vs?cc=<comm:ID/>&conf=<conf:ID/>&top=<%= my_next %>&rnm=1&<%= restorer %>
|
||||
</util:href>
|
||||
<util:text><util:button id="next_topic_keep"/></util:text>
|
||||
</util:xlink>
|
||||
|
||||
<%
|
||||
} // end if
|
||||
} // end if
|
||||
%>
|
||||
<util:xlink>
|
||||
<util:href type="servlet">conf/find.js.vs?cc=<comm:ID/>&conf=<conf:ID/>&top=<topic:number/></util:href>
|
||||
<util:text><util:button id="find"/></util:text>
|
||||
</util:xlink>
|
||||
|
||||
<util:xlink>
|
||||
<util:href type="servlet">
|
||||
conf/manage_topic.js.vs?cc=<comm:ID/>&conf=<conf:ID/>&top=<topic:number/>
|
||||
</util:href>
|
||||
<util:text><util:button id="manage"/></util:text>
|
||||
</util:xlink>
|
1
web/images/classic/.gitignore
vendored
Normal file
1
web/images/classic/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
.xvpics
|
BIN
web/images/classic/move.jpg
Normal file
BIN
web/images/classic/move.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.4 KiB |
1
web/images/gelcap/.gitignore
vendored
Normal file
1
web/images/gelcap/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
.xvpics
|
BIN
web/images/gelcap/move.jpg
Normal file
BIN
web/images/gelcap/move.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.8 KiB |
Loading…
Reference in New Issue
Block a user