partial implementation of conference management; rewrote the whole servlets

layer to eliminate duplicate code and make error checking more efficient
(we now use a system that relies on Throwables to do interesting things)
This commit is contained in:
Eric J. Bowersox 2001-02-10 07:20:27 +00:00
parent a51fa644b7
commit f706cdaf5f
65 changed files with 2914 additions and 3040 deletions

3
TODO
View File

@ -6,7 +6,8 @@ Lots!
- Should we provide the sysadmin the ability to disable SIG creation for - Should we provide the sysadmin the ability to disable SIG creation for
non-admin users? Maybe there needs to be a "global" set of levels that non-admin users? Maybe there needs to be a "global" set of levels that
aren't hardcoded. Where do they get stored? The database? aren't hardcoded. Where do they get stored? The database? (Maybe the
nice shiny new "globals" table?)
- There's no system admin functionality AT ALL. We need to have this stuff - There's no system admin functionality AT ALL. We need to have this stuff
before we go live. (It plugs into the Administrative SIG features.) before we go live. (It plugs into the Administrative SIG features.)

View File

@ -117,4 +117,6 @@ public interface ConferenceContext
public abstract HTMLChecker getNewTopicPreviewChecker(); public abstract HTMLChecker getNewTopicPreviewChecker();
public abstract void fixSeen() throws DataException;
} // end interface ConferenceContext } // end interface ConferenceContext

View File

@ -74,6 +74,48 @@ class ConferenceUserContextImpl implements ConferenceContext, ConferenceBackend
} // end class ConfCache } // end class ConfCache
/*--------------------------------------------------------------------------------
* Internal class used in the implementation of fixSeen()
*--------------------------------------------------------------------------------
*/
static class FixSeenHelper
{
private int topicid;
private int top_message;
private boolean do_insert;
public FixSeenHelper(int topicid, int top_message, boolean do_insert)
{
this.topicid = topicid;
this.top_message = top_message;
this.do_insert = do_insert;
} // end constructor
public void doFix(Statement stmt, int uid) throws SQLException
{
StringBuffer sql = new StringBuffer();
if (do_insert)
{ // construct an SQL INSERT statement
sql.append("INSERT INTO topicsettings (topicid, uid, last_message) VALUES (").append(topicid);
sql.append(", ").append(uid).append(", ").append(top_message).append(");");
} // end if
else
{ // construct an SQL UPDATE statement
sql.append("UPDATE topicsettings SET last_message = ").append(top_message).append(" WHERE topicid = ");
sql.append(topicid).append(" AND uid = ").append(uid).append(';');
} // end else
// now execute the update
stmt.executeUpdate(sql.toString());
} // end doFix
} // end class FixSeenHelper
/*-------------------------------------------------------------------------------- /*--------------------------------------------------------------------------------
* Static data members * Static data members
*-------------------------------------------------------------------------------- *--------------------------------------------------------------------------------
@ -908,6 +950,68 @@ class ConferenceUserContextImpl implements ConferenceContext, ConferenceBackend
} // end getNewTopicPreviewChecker } // end getNewTopicPreviewChecker
public void fixSeen() throws DataException
{
Connection conn = null;
try
{ // retrieve a connection from the datapool
conn = datapool.getConnection();
Statement stmt = conn.createStatement();
// lock the tables that we need
stmt.executeUpdate("LOCK TABLES confsettings WRITE, topicsettings WRITE, topics READ;");
try
{ // get the existing topic list and its top messages list
StringBuffer sql =
new StringBuffer("SELECT topics.topicid, topics.top_message, ISNULL(topicsettings.last_message) "
+ "FROM topics LEFT JOIN topicsettings ON topics.topicid = topicsettings.topicid "
+ "AND topicsettings.uid = ");
sql.append(sig.realUID()).append(" WHERE topics.confid = ").append(confid).append(';');
ResultSet rs = stmt.executeQuery(sql.toString());
// use the results to build up a list of FixSeenHelpers
Vector tmp = new Vector();
while (rs.next())
tmp.add(new FixSeenHelper(rs.getInt(1),rs.getInt(2),rs.getBoolean(3)));
// now iterate over the list and call doFix on each one
Iterator it = tmp.iterator();
while (it.hasNext())
{ // just hit each one in turn
FixSeenHelper fsh = (FixSeenHelper)(it.next());
fsh.doFix(stmt,sig.realUID());
} // end while
// update our last-read indicator, too
touchRead(conn);
} // end try
finally
{ // make sure we unlock everything before we go
Statement ulk_stmt = conn.createStatement();
ulk_stmt.executeUpdate("UNLOCK TABLES;");
} // end finally
} // end try
catch (SQLException e)
{ // this becomes a DataException
logger.error("DB error updating user information: " + e.getMessage(),e);
throw new DataException("unable to update user information: " + e.getMessage(),e);
} // end catch
finally
{ // make sure we release the connection before we go
if (conn!=null)
datapool.releaseConnection(conn);
} // end finally
} // end fixSeen
/*-------------------------------------------------------------------------------- /*--------------------------------------------------------------------------------
* Implementations from interface UserBackend * Implementations from interface UserBackend
*-------------------------------------------------------------------------------- *--------------------------------------------------------------------------------

View File

@ -34,6 +34,8 @@ public class Account extends VeniceServlet
*-------------------------------------------------------------------------------- *--------------------------------------------------------------------------------
*/ */
private static final String DISPLAY_LOGIN_ATTR = "com.silverwrist.venice.servlets.internal.DisplayLogin";
private static Category logger = Category.getInstance(Account.class.getName()); private static Category logger = Category.getInstance(Account.class.getName());
/*-------------------------------------------------------------------------------- /*--------------------------------------------------------------------------------
@ -41,6 +43,12 @@ public class Account extends VeniceServlet
*-------------------------------------------------------------------------------- *--------------------------------------------------------------------------------
*/ */
private void setDisplayLogins(ServletRequest request)
{
request.setAttribute(DISPLAY_LOGIN_ATTR,new Integer(0));
} // end setDisplayLogins
private NewAccountDialog makeNewAccountDialog() throws ServletException private NewAccountDialog makeNewAccountDialog() throws ServletException
{ {
final String desired_name = "NewAccountDialog"; final String desired_name = "NewAccountDialog";
@ -122,186 +130,154 @@ public class Account extends VeniceServlet
} // end getServletInfo } // end getServletInfo
public void doGet(HttpServletRequest request, HttpServletResponse response) /*--------------------------------------------------------------------------------
throws ServletException, IOException * Overrides from class VeniceServlet
{ *--------------------------------------------------------------------------------
RenderData rdat = createRenderData(request,response); */
UserContext user = getUserContext(request);
String page_title = null;
ContentRender content = null;
boolean display_login = false;
protected String getMyLocation(HttpServletRequest request, VeniceEngine engine, UserContext user,
RenderData rdat)
{
if (request.getAttribute(DISPLAY_LOGIN_ATTR)!=null)
return "account?cmd=" + getStandardCommandParam(request);
else
return null;
} // end getMyLocation
protected VeniceContent doVeniceGet(HttpServletRequest request, VeniceEngine engine,
UserContext user, RenderData rdat)
throws ServletException, IOException, VeniceServletResult
{
String tgt = request.getParameter("tgt"); // target location String tgt = request.getParameter("tgt"); // target location
if (tgt==null) if (tgt==null)
tgt = "top"; // go back to the Top screen if nothing else tgt = "top"; // go back to the Top screen if nothing else
String cmd = request.getParameter("cmd"); // command parameter String cmd = getStandardCommandParam(request);
if (cmd.equals("L")) if (cmd.equals("L"))
{ // "L" = Log in/out { // "L" = Log In/Out
if (user.isLoggedIn()) if (user.isLoggedIn())
{ // log the user out and send 'em back to the "top" page { // this is a Logout command
clearUserContext(request); clearUserContext(request);
// TODO: here is where the persistent cookie gets nuked, if it does... throw new RedirectResult("top"); // take 'em back to the "top" page
rdat.redirectTo("top");
return;
} // end if (logging out) } // end if
else
{ // display the Login page
LoginDialog dlg = makeLoginDialog();
dlg.setupNew(tgt);
page_title = dlg.getTitle();
content = dlg;
} // end else // this is a Login command - display the Login page
LoginDialog dlg = makeLoginDialog();
dlg.setupNew(tgt);
return dlg;
} // end if ("L" command) } // end if ("L" command)
else if (cmd.equals("C"))
if (cmd.equals("C"))
{ // "C" = create new account { // "C" = create new account
if (user.isLoggedIn()) if (user.isLoggedIn()) // you can't create a new account while logged in on an existing one!
{ // you can't create a new account while logged in on an existing one! return new ErrorBox("Error","You cannot create a new account while logged in on an existing "
page_title = "Error"; + "one. You must log out first.",tgt);
content = new ErrorBox(page_title,"You cannot create a new account while logged in on "
+ "an existing one. You must log out first.",tgt);
} // end if // display the "Create Account" dialog
else NewAccountDialog dlg = makeNewAccountDialog();
{ // display the "Create Account" page dlg.setEngine(engine);
NewAccountDialog dlg = makeNewAccountDialog(); dlg.setTarget(tgt);
dlg.setEngine(getVeniceEngine()); dlg.setFieldValue("country","US");
page_title = dlg.getTitle(); return dlg;
dlg.setTarget(tgt);
dlg.setFieldValue("country","US");
content = dlg;
} // end else
} // end if ("C" command) } // end if ("C" command)
else if (cmd.equals("P"))
if (cmd.equals("P"))
{ // "P" = user profile { // "P" = user profile
if (user.isLoggedIn()) if (!(user.isLoggedIn())) // you have to be logged in for this one!
{ // display the User Profile page return new ErrorBox("Error","You must log in before you can modify the profile "
EditProfileDialog dlg = makeEditProfileDialog(); + "on your account.",tgt);
try
{ // load the profile information
dlg.setupDialog(user,tgt);
// prepare for display // set up the Edit Profile dialog
page_title = dlg.getTitle(); EditProfileDialog dlg = makeEditProfileDialog();
content = dlg; try
{ /// set up the profile information for the dialog
dlg.setupDialog(user,tgt);
} // end try } // end try
catch (DataException e) catch (DataException e)
{ // we couldn't load the contact info for the profile { // unable to load the contact info for the profile
page_title = "Database Error"; return new ErrorBox("Database Error","Database error retrieving profile: " + e.getMessage(),tgt);
content = new ErrorBox(page_title,"Database error retrieving profile: " + e.getMessage(),tgt);
} // end catch } // end catch
} // end if return dlg; // display dialog
else
{ // you have to be logged in for this one!
page_title = "Error";
content = new ErrorBox(page_title,"You must log in before you can modify the profile "
+ "on your account.",tgt);
} // end else
} // end if ("P" command) } // end if ("P" command)
else if (cmd.equals("V"))
if (cmd.equals("V"))
{ // "V" = verify email address { // "V" = verify email address
display_login = true; setDisplayLogins(request);
if (!(user.isLoggedIn())) // you have to be logged in for this one!
if (user.isLoggedIn()) return new ErrorBox("Error","You must log in before you can verify your account's "
{ // display the Verify E-mail Address page
VerifyEmailDialog dlg = makeVerifyEmailDialog();
page_title = dlg.getTitle();
dlg.setTarget(tgt);
content = dlg;
} // end if
else
{ // you have to be logged in for this one!
page_title = "Error";
content = new ErrorBox(page_title,"You must log in before you can verify your account's "
+ "email address.",tgt); + "email address.",tgt);
} // end else // display the "verify email" dialog
VerifyEmailDialog dlg = makeVerifyEmailDialog();
dlg.setTarget(tgt);
return dlg;
} // end else if ("V" command) } // end if ("V" command)
else
{ // unknown command
page_title = "Internal Error";
logger.error("invalid command to Account.doGet: " + cmd);
content = new ErrorBox(page_title,"Invalid command to Account.doGet",tgt);
} // end else // command not found!
logger.error("invalid command to Account.doGet: " + cmd);
return new ErrorBox("Internal Error","Invalid command to Account.doGet",tgt);
BaseJSPData basedat = new BaseJSPData(page_title,"account?cmd=" + cmd,content); } // end doVeniceGet
basedat.displayLoginLinks(display_login);
basedat.transfer(getServletContext(),rdat);
} // end doGet protected VeniceContent doVenicePost(HttpServletRequest request, VeniceEngine engine,
UserContext user, RenderData rdat)
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, VeniceServletResult
throws ServletException, IOException
{ {
RenderData rdat = createRenderData(request,response); changeMenuTop(request); // this is "top" menus
UserContext user = getUserContext(request);
String page_title = null;
ContentRender content = null;
boolean display_login = false;
String tgt = request.getParameter("tgt"); // target location String tgt = request.getParameter("tgt"); // target location
if (tgt==null) if (tgt==null)
tgt = "top"; // go back to Top screen if nothing else tgt = "top"; // go back to the Top screen if nothing else
String cmd = request.getParameter("cmd"); // command parameter String cmd = getStandardCommandParam(request);
if (cmd.equals("L")) if (cmd.equals("L"))
{ // log the user in { // "L" = login the user
LoginDialog dlg = makeLoginDialog(); LoginDialog dlg = makeLoginDialog();
if (dlg.isButtonClicked(request,"cancel")) if (dlg.isButtonClicked(request,"cancel"))
{ // go back where we came from - we decided not to log in anyhoo throw new RedirectResult(tgt); // we decided not to log in - go back where we came from
rdat.redirectTo(tgt);
return;
} // end if (canceled)
if (dlg.isButtonClicked(request,"remind")) if (dlg.isButtonClicked(request,"remind"))
{ // this will email a password reminder to the owner's account { // this will email a password reminder to the owner's account
dlg.loadValues(request); // load the dialog values dlg.loadValues(request); // load the dialog values
try try
{ // send the password reminder { // send the password reminder
getVeniceEngine().sendPasswordReminder(dlg.getFieldValue("user")); engine.sendPasswordReminder(dlg.getFieldValue("user"));
// recycle and redisplay the dialog box // recycle and redisplay the dialog box
dlg.resetOnError("Password reminder has been sent to your e-mail address."); dlg.resetOnError("Password reminder has been sent to your e-mail address.");
page_title = dlg.getTitle();
content = dlg;
} // end try } // end try
catch (DataException e1) catch (DataException de)
{ // this indicates a database error - display an ErrorBox { // there was a database error finding your email address
page_title = "Database Error"; return new ErrorBox("Database Error","Database error finding user: " + de.getMessage(),tgt);
content = new ErrorBox(page_title,"Database error finding user: " + e1.getMessage(),tgt);
} // end catch } // end catch
catch (AccessError e2) catch (AccessError ae)
{ // this indicates a problem with the user account or password { // this indicates a problem with the user account or password
page_title = "User E-mail Address Not Found"; return new ErrorBox("User E-mail Address Not Found",ae.getMessage(),tgt);
content = new ErrorBox(page_title,e2.getMessage(),tgt);
} // end catch } // end catch
catch (EmailException ee) catch (EmailException ee)
{ // error sending the confirmation email { // error sending the confirmation email
page_title = "E-mail Error"; return new ErrorBox("E-mail Error","E-mail error sending reminder: " + ee.getMessage(),tgt);
content = new ErrorBox(page_title,"E-mail error sending reminder: " + ee.getMessage(),tgt);
} // end catch } // end catch
} // end if ("reminder" button clicked) return dlg; // redisplay the dialog
else if (dlg.isButtonClicked(request,"login"))
} // end if ("remind" button clicked)
if (dlg.isButtonClicked(request,"login"))
{ // we actually want to try and log in! imagine that! { // we actually want to try and log in! imagine that!
dlg.loadValues(request); // load the values dlg.loadValues(request); // load the values
@ -313,53 +289,41 @@ public class Account extends VeniceServlet
// assuming it worked OK, redirect them back where they came from // assuming it worked OK, redirect them back where they came from
// (or to the verification page if they need to go there) // (or to the verification page if they need to go there)
String url;
if (user.isEmailVerified())
url = tgt;
else // they haven't verified yet - remind them to do so
url = "account?cmd=V&tgt=" + URLEncoder.encode(tgt);
clearMenu(request); clearMenu(request);
rdat.redirectTo(url); if (user.isEmailVerified())
return; throw new RedirectResult(tgt);
else // they haven't verified yet - remind them to do so
throw new RedirectResult("account?cmd=V&tgt=" + URLEncoder.encode(tgt));
} // end try } // end try
catch (DataException e1) catch (DataException de)
{ // this indicates a database error - display an ErrorBox { // this indicates a database error - display an ErrorBox
page_title = "Database Error"; return new ErrorBox("Database Error","Database error logging in: " + de.getMessage(),tgt);
content = new ErrorBox(page_title,"Database error logging in: " + e1.getMessage(),tgt);
} // end catch } // end catch
catch (AccessError e2) catch (AccessError ae)
{ // this indicates a problem with the user account or password { // this indicates a problem with the user account or password
dlg.resetOnError(e2.getMessage()); dlg.resetOnError(ae.getMessage());
page_title = dlg.getTitle();
content = dlg;
} // end catch } // end catch
} // end else if ("login" button clicked) return dlg; // go back and redisplay the dialog
else
{ // the button must be wrong!
page_title = "Internal Error";
logger.error("no known button click on Account.doPost, cmd=L");
content = new ErrorBox(page_title,"Unknown command button pressed",tgt);
} // end else } // end if ("login" button clicked)
// the button must be wrong!
logger.error("no known button click on Account.doPost, cmd=L");
return new ErrorBox("Internal Error","Unknown command button pressed",tgt);
} // end if ("L" command) } // end if ("L" command)
else if (cmd.equals("C"))
{ // C = Create New Account if (cmd.equals("C"))
{ // "C" = Create New Account
NewAccountDialog dlg = makeNewAccountDialog(); NewAccountDialog dlg = makeNewAccountDialog();
dlg.setEngine(getVeniceEngine()); dlg.setEngine(engine);
if (dlg.isButtonClicked(request,"cancel")) if (dlg.isButtonClicked(request,"cancel"))
{ // go back where we came from - we decided not to create the account anyhoo throw new RedirectResult(tgt); // we decided not to create account - go back where we came from
String url = response.encodeRedirectURL(rdat.getFullServletPath(tgt));
response.sendRedirect(url);
return;
} // end if ("cancel" button clicked)
if (dlg.isButtonClicked(request,"create")) if (dlg.isButtonClicked(request,"create"))
{ // OK, actually want to create the account! { // OK, actually want to create the account!
@ -369,67 +333,52 @@ public class Account extends VeniceServlet
{ // attempt to create the account { // attempt to create the account
UserContext uc = dlg.doDialog(request); UserContext uc = dlg.doDialog(request);
putUserContext(request,uc); // effectively logging in the new user putUserContext(request,uc); // effectively logging in the new user
user = uc;
// now jump to the Verify page // now jump to the Verify page
String partial = "account?cmd=V&tgt=" + URLEncoder.encode(tgt); throw new RedirectResult("account?cmd=V&tgt=" + URLEncoder.encode(tgt));
String url = response.encodeRedirectURL(rdat.getFullServletPath(partial));
response.sendRedirect(url);
return;
} // end try } // end try
catch (ValidationException ve) catch (ValidationException ve)
{ // unable to validate some of the data in the form { // unable to validate some of the data in the form
dlg.resetOnError(ve.getMessage() + " Please try again."); dlg.resetOnError(ve.getMessage() + " Please try again.");
page_title = dlg.getTitle();
content = dlg;
} // end catch } // end catch
catch (DataException de) catch (DataException de)
{ // data error in setting up account { // data error in setting up account
page_title = "Database Error"; return new ErrorBox("Database Error","Database error creating account: " + de.getMessage(),tgt);
content = new ErrorBox(page_title,"Database error creating account: " + de.getMessage(),tgt);
} // end catch } // end catch
catch (AccessError ae) catch (AccessError ae)
{ // access error in setting up the account { // access error in setting up the account
dlg.resetOnError(ae.getMessage()); dlg.resetOnError(ae.getMessage());
page_title = dlg.getTitle();
content = dlg;
} // end catch } // end catch
catch (EmailException ee) catch (EmailException ee)
{ // error sending the confirmation email { // error sending the confirmation email
page_title = "E-mail Error"; return new ErrorBox("E-mail Error","E-mail error creating account: " + ee.getMessage(),tgt);
content = new ErrorBox(page_title,"E-mail error creating account: " + ee.getMessage(),tgt);
} // end catch } // end catch
} // end if ("create" button clicked) return dlg; // redisplay me
else
{ // the button must be wrong!
page_title = "Internal Error";
logger.error("no known button click on Account.doPost, cmd=C");
content = new ErrorBox(page_title,"Unknown command button pressed",tgt);
} // end else } // end if ("create" button pressed)
} // end else if ("C" command) // the button must be wrong!
else if (cmd.equals("V")) logger.error("no known button click on Account.doPost, cmd=C");
{ // V = Verify E-mail Address return new ErrorBox("Internal Error","Unknown command button pressed",tgt);
display_login = true;
} // end if ("C" command)
if (cmd.equals("V"))
{ // "V" = Verify E-mail Address
setDisplayLogins(request);
VerifyEmailDialog dlg = makeVerifyEmailDialog(); VerifyEmailDialog dlg = makeVerifyEmailDialog();
if (dlg.isButtonClicked(request,"cancel")) if (dlg.isButtonClicked(request,"cancel"))
{ // go back to our desired location throw new RedirectResult(tgt); // we decided not to bother - go back where we came from
String url = response.encodeRedirectURL(rdat.getFullServletPath(tgt));
response.sendRedirect(url);
return;
} // end if ("cancel" button clicked)
if (dlg.isButtonClicked(request,"again")) if (dlg.isButtonClicked(request,"again"))
{ // do a "send again" { // send the confirmation message again
try try
{ // resend the email confirmation { // resend the email confirmation
user.resendEmailConfirmation(); user.resendEmailConfirmation();
@ -437,25 +386,24 @@ public class Account extends VeniceServlet
// now force the form to be redisplayed // now force the form to be redisplayed
dlg.clearAllFields(); dlg.clearAllFields();
dlg.setTarget(tgt); dlg.setTarget(tgt);
page_title = dlg.getTitle();
content = dlg;
} // end try } // end try
catch (DataException de) catch (DataException de)
{ // data error in setting up account { // database error resending confirmation
page_title = "Database Error"; return new ErrorBox("Database Error","Database error sending confirmation: " + de.getMessage(),tgt);
content = new ErrorBox(page_title,"Database error sending confirmation: " + de.getMessage(),tgt);
} // end catch } // end catch
catch (EmailException ee) catch (EmailException ee)
{ // error sending the confirmation email { // error sending the confirmation email
page_title = "E-mail Error"; return new ErrorBox("E-mail Error","E-mail error sending confirmation: " + ee.getMessage(),tgt);
content = new ErrorBox(page_title,"E-mail error sending confirmation: " + ee.getMessage(),tgt);
} // end catch } // end catch
} // end if ("again" clicked) return dlg; // redisplay the dialog
else if (dlg.isButtonClicked(request,"ok"))
} // end if ("again" button clicked)
if (dlg.isButtonClicked(request,"ok"))
{ // try to verify the confirmation number { // try to verify the confirmation number
dlg.loadValues(request); // load field values dlg.loadValues(request); // load field values
@ -465,119 +413,85 @@ public class Account extends VeniceServlet
user.confirmEmail(dlg.getConfirmationNumber()); user.confirmEmail(dlg.getConfirmationNumber());
// go back to our desired location // go back to our desired location
String url = response.encodeRedirectURL(rdat.getFullServletPath(tgt)); throw new RedirectResult(tgt);
response.sendRedirect(url);
return;
} // end try } // end try
catch (ValidationException ve) catch (ValidationException ve)
{ // there was a validation error... { // there was a validation error...
dlg.resetOnError(ve.getMessage() + " Please try again."); dlg.resetOnError(ve.getMessage() + " Please try again.");
page_title = dlg.getTitle();
content = dlg;
} // end catch } // end catch
catch (DataException de) catch (DataException de)
{ // data error in setting up account { // data error in confirming account
page_title = "Database Error"; return new ErrorBox("Database Error","Database error verifying email: " + de.getMessage(),tgt);
content = new ErrorBox(page_title,"Database error verifying email: " + de.getMessage(),tgt);
} // end catch } // end catch
catch (AccessError ae) catch (AccessError ae)
{ // access error in setting up the account { // invalid confirmation number, perhaps?
dlg.resetOnError(ae.getMessage()); dlg.resetOnError(ae.getMessage());
page_title = dlg.getTitle();
content = dlg;
} // end catch } // end catch
} // end else if ("OK" clicked) return dlg; // redisplay the dialog
else
{ // the button must be wrong!
page_title = "Internal Error";
logger.error("no known button click on Account.doPost, cmd=V");
content = new ErrorBox(page_title,"Unknown command button pressed",tgt);
} // end else } // end if ("ok" button clicked)
} // end else if ("V" command) // the button must be wrong!
else if (cmd.equals("P")) logger.error("no known button click on Account.doPost, cmd=V");
{ // P = Edit User Profile return new ErrorBox("Internal Error","Unknown command button pressed",tgt);
display_login = true;
} // end if ("V" command)
if (cmd.equals("P"))
{ // "P" = Edit User Profile
setDisplayLogins(request);
EditProfileDialog dlg = makeEditProfileDialog(); EditProfileDialog dlg = makeEditProfileDialog();
if (dlg.isButtonClicked(request,"cancel")) if (dlg.isButtonClicked(request,"cancel"))
{ // go back to our desired location throw new RedirectResult(tgt); // we decided not to bother - go back where we came from
String url = response.encodeRedirectURL(rdat.getFullServletPath(tgt));
response.sendRedirect(url);
return;
} // end if ("cancel" button clicked)
if (dlg.isButtonClicked(request,"update")) if (dlg.isButtonClicked(request,"update"))
{ // we're ready to update the user profile { // we're ready to update the user profile
dlg.loadValues(request); // load field values dlg.loadValues(request); // load field values
try try
{ // validate the dialog and start setting info { // validate the dialog and reset profile info
String url; if (dlg.doDialog(user)) // need to reconfirm email address
if (dlg.doDialog(user)) throw new RedirectResult("account?cmd=V&tgt=" + URLEncoder.encode(tgt));
{ // the email address was changed - need to jump to the "Verify" page else
String partial = "account?cmd=V&tgt=" + URLEncoder.encode(tgt); throw new RedirectResult(tgt); // just go straight on back
url = response.encodeRedirectURL(rdat.getFullServletPath(partial));
} // end if
else // just go back where we came from
url = response.encodeRedirectURL(rdat.getFullServletPath(tgt));
response.sendRedirect(url);
return;
} // end try } // end try
catch (ValidationException ve) catch (ValidationException ve)
{ // there was a validation error... { // there was a validation error...
dlg.resetOnError(ve.getMessage() + " Please try again."); dlg.resetOnError(ve.getMessage() + " Please try again.");
page_title = dlg.getTitle();
content = dlg;
} // end catch } // end catch
catch (DataException de) catch (DataException de)
{ // data error in setting up account { // data error in changing profile
page_title = "Database Error"; return new ErrorBox("Database Error","Database error updating profile: " + de.getMessage(),tgt);
content = new ErrorBox(page_title,"Database error updating profile: " + de.getMessage(),tgt);
} // end catch } // end catch
catch (EmailException ee) catch (EmailException ee)
{ // error sending the confirmation email { // error sending the confirmation email
page_title = "E-mail Error"; return new ErrorBox("E-mail Error","E-mail error sending confirmation: " + ee.getMessage(),tgt);
content = new ErrorBox(page_title,"E-mail error sending confirmation: " + ee.getMessage(),tgt);
} // end catch } // end catch
} // end if ("update" button pressed) return dlg; // redisplay dialog
else
{ // the button must be wrong!
page_title = "Internal Error";
logger.error("no known button click on Account.doPost, cmd=P");
content = new ErrorBox(page_title,"Unknown command button pressed",tgt);
} // end else } // end if ("update" button clicked)
} // end else if ("P" command) // the button must be wrong!
else logger.error("no known button click on Account.doPost, cmd=P");
{ // unknown command return new ErrorBox("Internal Error","Unknown command button pressed",tgt);
page_title = "Internal Error";
logger.error("invalid command to Account.doPost: " + cmd);
content = new ErrorBox(page_title,"Invalid command to Account.doPost",tgt);
} // end else } // end if
changeMenuTop(request); // unknown command
logger.error("invalid command to Account.doPost: " + cmd);
return new ErrorBox("Internal Error","Invalid command to Account.doPost",tgt);
BaseJSPData basedat = new BaseJSPData(page_title,"account?cmd=" + cmd,content); } // end doVenicePost
basedat.displayLoginLinks(display_login);
basedat.transfer(getServletContext(),rdat);
} // end doPost
} // end class Account } // end class Account

View File

@ -22,10 +22,8 @@ import java.util.*;
import javax.servlet.*; import javax.servlet.*;
import javax.servlet.http.*; import javax.servlet.http.*;
import org.apache.log4j.*; import org.apache.log4j.*;
import com.silverwrist.util.StringUtil;
import com.silverwrist.util.ServletMultipartHandler; import com.silverwrist.util.ServletMultipartHandler;
import com.silverwrist.util.ServletMultipartException; import com.silverwrist.util.ServletMultipartException;
import com.silverwrist.venice.ValidationException;
import com.silverwrist.venice.core.*; import com.silverwrist.venice.core.*;
import com.silverwrist.venice.servlets.format.*; import com.silverwrist.venice.servlets.format.*;
@ -38,135 +36,6 @@ public class Attachment extends VeniceServlet
private static Category logger = Category.getInstance(Attachment.class.getName()); private static Category logger = Category.getInstance(Attachment.class.getName());
/*--------------------------------------------------------------------------------
* Internal functions
*--------------------------------------------------------------------------------
*/
private static SIGContext getSIGParameter(String str, UserContext user)
throws ValidationException, DataException
{
if (str==null)
{ // no SIG parameter - bail out now!
logger.error("SIG parameter not specified!");
throw new ValidationException("No SIG specified.");
} // end if
try
{ // turn the string into a SIGID, and thence to a SIGContext
int sigid = Integer.parseInt(str);
return user.getSIGContext(sigid);
} // end try
catch (NumberFormatException nfe)
{ // error in Integer.parseInt
logger.error("Cannot convert SIG parameter '" + str + "'!");
throw new ValidationException("Invalid SIG parameter.");
} // end catch
} // end getSIGParameter
private static SIGContext getSIGParameter(ServletRequest request, UserContext user)
throws ValidationException, DataException
{
return getSIGParameter(request.getParameter("sig"),user);
} // end getSIGParameter
private static SIGContext getSIGParameter(ServletMultipartHandler mphandler, UserContext user)
throws ValidationException, DataException
{
if (mphandler.isFileParam("sig"))
throw new ValidationException("Internal Error: SIG should be a normal param");
return getSIGParameter(mphandler.getValue("sig"),user);
} // end getSIGParameter
private static ConferenceContext getConferenceParameter(String str, SIGContext sig)
throws ValidationException, DataException, AccessError
{
if (str==null)
{ // no conference parameter - bail out now!
logger.error("Conference parameter not specified!");
throw new ValidationException("No conference specified.");
} // end if
try
{ // turn the string into a ConfID, and thence to a ConferenceContext
int confid = Integer.parseInt(str);
return sig.getConferenceContext(confid);
} // end try
catch (NumberFormatException nfe)
{ // error in Integer.parseInt
logger.error("Cannot convert conference parameter '" + str + "'!");
throw new ValidationException("Invalid conference parameter.");
} // end catch
} // end getConferenceParameter
private static ConferenceContext getConferenceParameter(ServletRequest request, SIGContext sig)
throws ValidationException, DataException, AccessError
{
return getConferenceParameter(request.getParameter("conf"),sig);
} // end getConferenceParameter
private static ConferenceContext getConferenceParameter(ServletMultipartHandler mphandler, SIGContext sig)
throws ValidationException, DataException, AccessError
{
if (mphandler.isFileParam("conf"))
throw new ValidationException("Internal Error: conference should be a normal param");
return getConferenceParameter(mphandler.getValue("conf"),sig);
} // end getConferenceParameter
private static TopicMessageContext getMessageParameter(String str, ConferenceContext conf)
throws ValidationException, DataException, AccessError
{
if (str==null)
{ // no conference parameter - bail out now!
logger.error("Message parameter not specified!");
throw new ValidationException("No message specified.");
} // end if
try
{ // turn the string into a postid, and thence to a TopicMessageContext
long postid = Long.parseLong(str);
return conf.getMessageByPostID(postid);
} // end try
catch (NumberFormatException nfe)
{ // error in Integer.parseInt
logger.error("Cannot convert message parameter '" + str + "'!");
throw new ValidationException("Invalid message parameter.");
} // end catch
} // end getMessageParameter
private static TopicMessageContext getMessageParameter(ServletRequest request, ConferenceContext conf)
throws ValidationException, DataException, AccessError
{
return getMessageParameter(request.getParameter("msg"),conf);
} // end getMessageParameter
private static TopicMessageContext getMessageParameter(ServletMultipartHandler mphandler,
ConferenceContext conf)
throws ValidationException, DataException, AccessError
{
if (mphandler.isFileParam("msg"))
throw new ValidationException("Internal Error: message should be a normal param");
return getMessageParameter(mphandler.getValue("msg"),conf);
} // end getMessageParameter
/*-------------------------------------------------------------------------------- /*--------------------------------------------------------------------------------
* Overrides from class HttpServlet * Overrides from class HttpServlet
*-------------------------------------------------------------------------------- *--------------------------------------------------------------------------------
@ -180,248 +49,101 @@ public class Attachment extends VeniceServlet
} // end getServletInfo } // end getServletInfo
public void doGet(HttpServletRequest request, HttpServletResponse response) /*--------------------------------------------------------------------------------
throws ServletException, IOException * Overrides from class VeniceServlet
*--------------------------------------------------------------------------------
*/
protected VeniceContent doVeniceGet(HttpServletRequest request, VeniceEngine engine,
UserContext user, RenderData rdat)
throws ServletException, IOException, VeniceServletResult
{ {
UserContext user = getUserContext(request); // get the SIG
RenderData rdat = createRenderData(request,response); SIGContext sig = getSIGParameter(request,user,true,"top");
String page_title = null; changeMenuSIG(request,sig);
Object content = null;
SIGContext sig = null; // SIG context // get the conference
ConferenceContext conf = null; // conference context ConferenceContext conf = getConferenceParameter(request,sig,true,"top");
TopicMessageContext msg = null; // message context
// get the message we want to use
TopicMessageContext msg = getMessageParameter(request,conf,true,"top");
String type, filename;
int length;
InputStream data;
try try
{ // this outer try is to catch ValidationException { // retrieve the information about the attachment
try type = msg.getAttachmentType();
{ // all commands require a SIG parameter filename = msg.getAttachmentFilename();
sig = getSIGParameter(request,user); length = msg.getAttachmentLength();
changeMenuSIG(request,sig); data = msg.getAttachmentData();
if (logger.isDebugEnabled())
logger.debug("found SIG #" + String.valueOf(sig.getSIGID()));
} // end try
catch (DataException de)
{ // error looking up the SIG
page_title = "Database Error";
content = new ErrorBox(page_title,"Database error finding SIG: " + de.getMessage(),"top");
} // end catch
if (content==null)
{ // we got the SIG parameter OK
try
{ // all commands require a conference parameter
conf = getConferenceParameter(request,sig);
if (logger.isDebugEnabled())
logger.debug("found conf #" + String.valueOf(conf.getConfID()));
} // end try
catch (DataException de)
{ // error looking up the conference
page_title = "Database Error";
content = new ErrorBox(page_title,"Database error finding conference: " + de.getMessage(),"top");
} // end catch
} // end if
if (content==null)
{ // we got the conference parameter OK
try
{ // now we need a message parameter
msg = getMessageParameter(request,conf);
if (logger.isDebugEnabled())
logger.debug("found post #" + String.valueOf(msg.getPostID()));
} // end try
catch (DataException de)
{ // error looking up the conference
page_title = "Database Error";
content = new ErrorBox(page_title,"Database error finding message: " + de.getMessage(),"top");
} // end catch
} // end if
} // end try } // end try
catch (ValidationException ve)
{ // these all get handled in pretty much the same way
page_title = "Error";
content = new ErrorBox(null,ve.getMessage(),"top");
} // end catch
catch (AccessError ae) catch (AccessError ae)
{ // these all get handled in pretty much the same way { // unable to access the data stream
page_title = "Access Error"; return new ErrorBox("Access Error",ae.getMessage(),"top");
content = new ErrorBox(page_title,ae.getMessage(),"top");
} // end catch
catch (DataException de)
{ // error getting at the data stream from the attachment
return new ErrorBox("Database Error","Database error retrieving attachment: " + de.getMessage(),"top");
} // end catch } // end catch
if (content==null) // now we want to send that data back to the user!
{ // extract the attachment data from the message and send it out throw new SendFileResult(type,filename,length,data);
try
{ // extract the attachment data and send it out!
rdat.sendBinaryData(msg.getAttachmentType(),msg.getAttachmentFilename(),
msg.getAttachmentLength(),msg.getAttachmentData());
return; // now we're all done!
} // end try } // end doVeniceGet
catch (AccessError ae)
{ // these all get handled in pretty much the same way
page_title = "Access Error";
content = new ErrorBox(page_title,ae.getMessage(),"top");
} // end catch protected VeniceContent doVenicePost(HttpServletRequest request, ServletMultipartHandler mphandler,
catch (DataException de) VeniceEngine engine, UserContext user, RenderData rdat)
{ // error looking up the conference throws ServletException, IOException, VeniceServletResult
page_title = "Database Error";
content = new ErrorBox(page_title,"Database error retrieving attachment: " + de.getMessage(),"top");
} // end catch
} // end if
// we only get here if there were an error
BaseJSPData basedat = new BaseJSPData(page_title,"top",content);
basedat.transfer(getServletContext(),rdat);
} // end doGet
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{ {
UserContext user = getUserContext(request); // Get target URL for the operation
RenderData rdat = createRenderData(request,response); if (mphandler.isFileParam("target"))
ServletMultipartHandler mphandler = null; return new ErrorBox(null,"Internal Error: 'target' should be a normal param","top");
String target = "top"; String target = mphandler.getValue("target");
String page_title = null; setMyLocation(request,target);
Object content = null;
SIGContext sig = null; // SIG context // also check on file parameter status
ConferenceContext conf = null; // conference context if (!(mphandler.isFileParam("thefile")))
TopicMessageContext msg = null; // message context return new ErrorBox(null,"Internal Error: 'thefile' should be a file param",target);
// get the SIG
SIGContext sig = getSIGParameter(request,user,true,"top");
changeMenuSIG(request,sig);
// get the conference
ConferenceContext conf = getConferenceParameter(request,sig,true,"top");
// get the message we want to use
TopicMessageContext msg = getMessageParameter(request,conf,true,"top");
try try
{ // this outer try is to catch ValidationException { // attach the data to the message!
mphandler = new ServletMultipartHandler(request); msg.attachData(mphandler.getContentType("thefile"),mphandler.getValue("thefile"),
mphandler.getContentSize("thefile"),mphandler.getFileContentStream("thefile"));
if (mphandler.isFileParam("target"))
throw new ValidationException("Internal Error: 'target' should be a normal param");
target = mphandler.getValue("target");
try
{ // all commands require a SIG parameter
sig = getSIGParameter(mphandler,user);
changeMenuSIG(request,sig);
if (logger.isDebugEnabled())
logger.debug("found SIG #" + String.valueOf(sig.getSIGID()));
} // end try
catch (DataException de)
{ // error looking up the SIG
page_title = "Database Error";
content = new ErrorBox(page_title,"Database error finding SIG: " + de.getMessage(),target);
} // end catch
if (content==null)
{ // we got the SIG parameter OK
try
{ // all commands require a conference parameter
conf = getConferenceParameter(mphandler,sig);
if (logger.isDebugEnabled())
logger.debug("found conf #" + String.valueOf(conf.getConfID()));
} // end try
catch (DataException de)
{ // error looking up the conference
page_title = "Database Error";
content = new ErrorBox(page_title,"Database error finding conference: " + de.getMessage(),target);
} // end catch
} // end if
if (content==null)
{ // we got the conference parameter OK
try
{ // now we need a message parameter
msg = getMessageParameter(mphandler,conf);
if (logger.isDebugEnabled())
logger.debug("found post #" + String.valueOf(msg.getPostID()));
} // end try
catch (DataException de)
{ // error looking up the conference
page_title = "Database Error";
content = new ErrorBox(page_title,"Database error finding message: " + de.getMessage(),target);
} // end catch
} // end if
// also check on file and target parameter status
if (!(mphandler.isFileParam("thefile")))
throw new ValidationException("Internal error: 'thefile' should be a file param");
} // end try } // end try
catch (ValidationException ve)
{ // these all get handled in pretty much the same way
page_title = "Error";
content = new ErrorBox(null,ve.getMessage(),target);
} // end catch
catch (AccessError ae)
{ // these all get handled in pretty much the same way
page_title = "Access Error";
content = new ErrorBox(page_title,ae.getMessage(),target);
} // end catch
catch (ServletMultipartException smpe) catch (ServletMultipartException smpe)
{ // this is kind of a special case { // error processing the file parameter data
page_title = "Error"; return new ErrorBox(null,"Internal Error: " + smpe.getMessage(),target);
content = new ErrorBox(page_title,"Internal Error: " + smpe.getMessage(),target);
} // end catch
catch (AccessError ae)
{ // access error posting the attachment data
return new ErrorBox("Access Error",ae.getMessage(),target);
} // end catch
catch (DataException de)
{ // error storing the attachment in the database
return new ErrorBox("Database Error","Database error storing attachment: " + de.getMessage(),target);
} // end catch } // end catch
if (content==null) throw new RedirectResult(target); // get back, get back, get back to where you once belonged
{ // we're ready to get the data and attach it
try
{ // attach the data to the message!
msg.attachData(mphandler.getContentType("thefile"),mphandler.getValue("thefile"),
mphandler.getContentSize("thefile"),mphandler.getFileContentStream("thefile"));
// go back to where we should have gone before we uploaded the message } // end doVenicePost
rdat.redirectTo(target);
return;
} // end try
catch (ServletMultipartException smpe)
{ // this is kind of a special case
page_title = "Error";
content = new ErrorBox(page_title,"Internal Error: " + smpe.getMessage(),target);
} // end catch
catch (AccessError ae)
{ // these all get handled in pretty much the same way
page_title = "Access Error";
content = new ErrorBox(page_title,ae.getMessage(),target);
} // end catch
catch (DataException de)
{ // error looking up the conference
page_title = "Database Error";
content = new ErrorBox(page_title,"Database error storing attachment: " + de.getMessage(),target);
} // end catch
} // end if (we got all the parameters OK)
// we only get here if there were an error
BaseJSPData basedat = new BaseJSPData(page_title,target,content);
basedat.transfer(getServletContext(),rdat);
} // end doPost
} // end class Attachment } // end class Attachment

View File

@ -82,82 +82,8 @@ public class ConfDisplay extends VeniceServlet
*-------------------------------------------------------------------------------- *--------------------------------------------------------------------------------
*/ */
private static SIGContext getSIGParameter(ServletRequest request, UserContext user) private static void getViewSortDefaults(ServletRequest request, int confid, TopicSortHolder tsc,
throws ValidationException, DataException String on_error) throws ErrorBox
{
String str = request.getParameter("sig");
if (str==null)
{ // no SIG parameter - bail out now!
logger.error("SIG parameter not specified!");
throw new ValidationException("No SIG specified.");
} // end if
try
{ // turn the string into a SIGID, and thence to a SIGContext
int sigid = Integer.parseInt(str);
return user.getSIGContext(sigid);
} // end try
catch (NumberFormatException nfe)
{ // error in Integer.parseInt
logger.error("Cannot convert SIG parameter '" + str + "'!");
throw new ValidationException("Invalid SIG parameter.");
} // end catch
} // end getSIGParameter
private static ConferenceContext getConferenceParameter(ServletRequest request, SIGContext sig)
throws ValidationException, DataException, AccessError
{
String str = request.getParameter("conf");
if (str==null)
{ // no conference parameter - bail out now!
logger.error("Conference parameter not specified!");
throw new ValidationException("No conference specified.");
} // end if
try
{ // turn the string into a ConfID, and thence to a ConferenceContext
int confid = Integer.parseInt(str);
return sig.getConferenceContext(confid);
} // end try
catch (NumberFormatException nfe)
{ // error in Integer.parseInt
logger.error("Cannot convert conference parameter '" + str + "'!");
throw new ValidationException("Invalid conference parameter.");
} // end catch
} // end getConferenceParameter
private static TopicContext getTopicParameter(ServletRequest request, ConferenceContext conf)
throws ValidationException, DataException, AccessError
{
String str = request.getParameter("top");
if (StringUtil.isStringEmpty(str))
return null; // no topic specified
try
{ // turn the string into a TopicID, and thence to a TopicContext
short topicid = Short.parseShort(str);
return conf.getTopic(topicid);
} // end try
catch (NumberFormatException nfe)
{ // error in Integer.parseInt
logger.error("Cannot convert topic parameter '" + str + "'!");
throw new ValidationException("Invalid topic parameter.");
} // end catch
} // end getTopicParameter
private static void getViewSortDefaults(ServletRequest request, int confid, TopicSortHolder tsc)
throws ValidationException
{ {
String str = request.getParameter("view"); String str = request.getParameter("view");
if (!(StringUtil.isStringEmpty(str))) if (!(StringUtil.isStringEmpty(str)))
@ -176,7 +102,7 @@ public class ConfDisplay extends VeniceServlet
break; break;
default: default:
throw new ValidationException("Invalid view parameter."); throw new ErrorBox(null,"Invalid view parameter.",on_error);
} // end switch } // end switch
@ -184,7 +110,7 @@ public class ConfDisplay extends VeniceServlet
catch (NumberFormatException nfe) catch (NumberFormatException nfe)
{ // failure in parseInt { // failure in parseInt
logger.error("Cannot convert view parameter '" + str + "'!"); logger.error("Cannot convert view parameter '" + str + "'!");
throw new ValidationException("Invalid view parameter."); throw new ErrorBox(null,"Invalid view parameter.",on_error);
} // end catch } // end catch
@ -208,7 +134,7 @@ public class ConfDisplay extends VeniceServlet
break; break;
default: default:
throw new ValidationException("Invalid sort parameter."); throw new ErrorBox(null,"Invalid sort parameter.",on_error);
} // end switch } // end switch
@ -216,7 +142,7 @@ public class ConfDisplay extends VeniceServlet
catch (NumberFormatException nfe) catch (NumberFormatException nfe)
{ // failure in parseInt { // failure in parseInt
logger.error("Cannot convert sort parameter '" + str + "'!"); logger.error("Cannot convert sort parameter '" + str + "'!");
throw new ValidationException("Invalid sort parameter."); throw new ErrorBox(null,"Invalid sort parameter.",on_error);
} // end catch } // end catch
@ -224,8 +150,8 @@ public class ConfDisplay extends VeniceServlet
} // end getViewSortDefaults } // end getViewSortDefaults
private static PostInterval getInterval(VeniceEngine engine, ServletRequest request, TopicContext topic) private static PostInterval getInterval(VeniceEngine engine, ServletRequest request, TopicContext topic,
throws ValidationException String on_error) throws ErrorBox
{ {
int first, last; int first, last;
@ -294,7 +220,7 @@ public class ConfDisplay extends VeniceServlet
} // end try } // end try
catch (NumberFormatException nfe) catch (NumberFormatException nfe)
{ // we could not translate the parameter to a number { // we could not translate the parameter to a number
throw new ValidationException("Message parameter is invalid."); throw new ErrorBox(null,"Message parameter is invalid.",on_error);
} // end catch } // end catch
@ -312,7 +238,7 @@ public class ConfDisplay extends VeniceServlet
} // end try } // end try
catch (NumberFormatException nfe) catch (NumberFormatException nfe)
{ // we could not translate the parameter to a number { // we could not translate the parameter to a number
throw new ValidationException("Message parameter is invalid."); throw new ErrorBox(null,"Message parameter is invalid.",on_error);
} // end catch } // end catch
@ -403,178 +329,94 @@ public class ConfDisplay extends VeniceServlet
} // end getServletInfo } // end getServletInfo
public void doGet(HttpServletRequest request, HttpServletResponse response) /*--------------------------------------------------------------------------------
throws ServletException, IOException * Overrides from class VeniceServlet
{ *--------------------------------------------------------------------------------
UserContext user = getUserContext(request); */
RenderData rdat = createRenderData(request,response);
String page_title = null;
Object content = null;
SIGContext sig = null; // SIG context
ConferenceContext conf = null; // conference context
TopicContext topic = null; // topic context
try protected VeniceContent doVeniceGet(HttpServletRequest request, VeniceEngine engine,
{ // this outer try is to catch ValidationException UserContext user, RenderData rdat)
throws ServletException, IOException, VeniceServletResult
{
// get the SIG
SIGContext sig = getSIGParameter(request,user,true,"top");
changeMenuSIG(request,sig);
// get the conference
ConferenceContext conf = getConferenceParameter(request,sig,true,"top");
// get the topic, if we have it
TopicContext topic = getTopicParameter(request,conf,false,"top");
if (topic!=null)
{ // we're handling messages within a single topic
if (logger.isDebugEnabled())
logger.debug("MODE: display messages in topic");
String on_error = "confdisp?sig=" + sig.getSIGID() + "&conf=" + conf.getConfID();
setMyLocation(request,on_error + "&topic=" + topic.getTopicNumber());
// if this request is restoring the number of unread posts in another topic, try to do so
restorePosts(request,conf);
// determine what the post interval is we want to display
PostInterval piv = getInterval(engine,request,topic,on_error);
boolean read_new = !(StringUtil.isStringEmpty(request.getParameter("rnm")));
boolean show_adv = !(StringUtil.isStringEmpty(request.getParameter("shac")));
// Create the post display.
TopicPosts tpos = null;
try try
{ // all commands require a SIG parameter { // create the display
sig = getSIGParameter(request,user); tpos = new TopicPosts(request,engine,sig,conf,topic,piv.getFirst(),piv.getLast(),read_new,show_adv);
changeMenuSIG(request,sig);
if (logger.isDebugEnabled())
logger.debug("found SIG #" + String.valueOf(sig.getSIGID()));
} // end try } // end try
catch (DataException de) catch (DataException de)
{ // error looking up the SIG { // there was a database error retrieving messages
page_title = "Database Error"; return new ErrorBox("Database Error","Database error listing messages: " + de.getMessage(),on_error);
content = new ErrorBox(page_title,"Database error finding SIG: " + de.getMessage(),"top");
} // end catch
catch (AccessError ae)
{ // we were unable to retrieve the message list
return new ErrorBox("Access Error",ae.getMessage(),on_error);
} // end catch } // end catch
if (content==null) return tpos;
{ // we got the SIG parameter OK
try
{ // all commands require a conference parameter
conf = getConferenceParameter(request,sig);
if (logger.isDebugEnabled())
logger.debug("found conf #" + String.valueOf(conf.getConfID()));
} // end try } // end if (messages in a topic)
catch (DataException de) else
{ // error looking up the conference { // we're displaying the conference's topic list
page_title = "Database Error"; if (logger.isDebugEnabled())
content = new ErrorBox(page_title,"Database error finding conference: " + de.getMessage(),"top"); logger.debug("MODE: display topics in conference");
setMyLocation(request,"confdisp?sig=" + sig.getSIGID() + "&conf=" + conf.getConfID());
String on_error = "confops?sig=" + sig.getSIGID();
} // end catch // get any changes to view or sort options
TopicSortHolder opts = TopicSortHolder.retrieve(request.getSession(true));
getViewSortDefaults(request,conf.getConfID(),opts,on_error);
} // end if TopicListing tl = null;
try
{ // create the topic lict
tl = new TopicListing(request,sig,conf,opts.getViewOption(conf.getConfID()),
opts.getSortOption(conf.getConfID()));
if (content==null) } // end try
{ // we got the conference parameter OK catch (DataException de)
try { // there was a database error retrieving topics
{ // there's an optional topic parameter return new ErrorBox("Database Error","Database error listing topics: " + de.getMessage(),on_error);
topic = getTopicParameter(request,conf);
if (logger.isDebugEnabled())
{ // do a little debugging output
if (topic!=null)
logger.debug("found topic #" + String.valueOf(topic.getTopicID()));
else
logger.debug("no topic specified");
} // end if } // end catch
catch (AccessError ae)
{ // we were unable to retrieve the topic list
return new ErrorBox("Access Error",ae.getMessage(),on_error);
} // end try } // end catch
catch (DataException de)
{ // error looking up the conference
page_title = "Database Error";
content = new ErrorBox(page_title,"Database error finding topic: " + de.getMessage(),"top");
} // end catch return tl;
} // end if } // end else (topics in a conference)
} // end try } // end doVeniceGet
catch (ValidationException ve)
{ // these all get handled in pretty much the same way
page_title = "Error";
content = new ErrorBox(null,ve.getMessage(),"top");
} // end catch
catch (AccessError ae)
{ // these all get handled in pretty much the same way
page_title = "Access Error";
content = new ErrorBox(page_title,ae.getMessage(),"top");
} // end catch
if (content==null)
{ // OK, let's handle the display now
if (topic!=null)
{ // we're handling messages within a single topic
if (logger.isDebugEnabled())
logger.debug("MODE: display messages in topic");
// if this request is restoring the number of unread posts in another topic, try to do so
restorePosts(request,conf);
try
{ // determine what the post interval is we want to display
VeniceEngine engine = getVeniceEngine();
PostInterval piv = getInterval(engine,request,topic);
boolean read_new = !(StringUtil.isStringEmpty(request.getParameter("rnm")));
boolean show_adv = !(StringUtil.isStringEmpty(request.getParameter("shac")));
// create the post display
TopicPosts tpos = new TopicPosts(request,engine,sig,conf,topic,piv.getFirst(),piv.getLast(),
read_new,show_adv);
content = tpos;
page_title = topic.getName() + ": " + String.valueOf(topic.getTotalMessages()) + " Total; "
+ String.valueOf(tpos.getNewMessages()) + " New; Last: "
+ rdat.formatDateForDisplay(topic.getLastUpdateDate());
} // end try
catch (ValidationException ve)
{ // there's an error in the parameters somewhere
page_title = "Error";
content = new ErrorBox(null,ve.getMessage(),"top");
} // end catch
catch (DataException de)
{ // there was a database error retrieving topics
page_title = "Database Error";
content = new ErrorBox(page_title,"Database error listing messages: " + de.getMessage(),"top");
} // end catch
catch (AccessError ae)
{ // we were unable to retrieve the topic list
page_title = "Access Error";
content = new ErrorBox(page_title,ae.getMessage(),"top");
} // end catch
} // end if
else
{ // we're displaying the conference's topic list
if (logger.isDebugEnabled())
logger.debug("MODE: display topics in conference");
TopicSortHolder opts = TopicSortHolder.retrieve(request.getSession(true));
try
{ // get any changes to view or sort options
getViewSortDefaults(request,conf.getConfID(),opts);
// create the topic list
content = new TopicListing(request,sig,conf,opts.getViewOption(conf.getConfID()),
opts.getSortOption(conf.getConfID()));
page_title = "Topics in " + conf.getName();
} // end try
catch (ValidationException ve)
{ // there was some sort of a parameter error in the display
page_title = "Error";
content = new ErrorBox(null,ve.getMessage(),"top");
} // end catch
catch (DataException de)
{ // there was a database error retrieving topics
page_title = "Database Error";
content = new ErrorBox(page_title,"Database error listing topics: " + de.getMessage(),"top");
} // end catch
catch (AccessError ae)
{ // we were unable to retrieve the topic list
page_title = "Access Error";
content = new ErrorBox(page_title,ae.getMessage(),"top");
} // end catch
} // end else
} // end if
BaseJSPData basedat = new BaseJSPData(page_title,"confdisp?" + request.getQueryString(),content);
basedat.transfer(getServletContext(),rdat);
} // end doGet
} // end class ConfDisplay } // end class ConfDisplay

View File

@ -39,58 +39,6 @@ public class ConfOperations extends VeniceServlet
*-------------------------------------------------------------------------------- *--------------------------------------------------------------------------------
*/ */
private static SIGContext getSIGParameter(ServletRequest request, UserContext user)
throws ValidationException, DataException
{
String str = request.getParameter("sig");
if (str==null)
{ // no SIG parameter - bail out now!
logger.error("SIG parameter not specified!");
throw new ValidationException("No SIG specified.");
} // end if
try
{ // turn the string into a SIGID, and thence to a SIGContext
int sigid = Integer.parseInt(str);
return user.getSIGContext(sigid);
} // end try
catch (NumberFormatException nfe)
{ // error in Integer.parseInt
logger.error("Cannot convert SIG parameter '" + str + "'!");
throw new ValidationException("Invalid SIG parameter.");
} // end catch
} // end getSIGParameter
private static ConferenceContext getConferenceParameter(ServletRequest request, SIGContext sig)
throws ValidationException, DataException, AccessError
{
String str = request.getParameter("conf");
if (str==null)
{ // no conference parameter - bail out now!
logger.error("Conference parameter not specified!");
throw new ValidationException("No conference specified.");
} // end if
try
{ // turn the string into a ConfID, and thence to a ConferenceContext
int confid = Integer.parseInt(str);
return sig.getConferenceContext(confid);
} // end try
catch (NumberFormatException nfe)
{ // error in Integer.parseInt
logger.error("Cannot convert conference parameter '" + str + "'!");
throw new ValidationException("Invalid conference parameter.");
} // end catch
} // end getConferenceParameter
private CreateConferenceDialog makeCreateConferenceDialog() throws ServletException private CreateConferenceDialog makeCreateConferenceDialog() throws ServletException
{ {
final String desired_name = "CreateConferenceDialog"; final String desired_name = "CreateConferenceDialog";
@ -108,22 +56,22 @@ public class ConfOperations extends VeniceServlet
} // end makeCreateConferenceDialog } // end makeCreateConferenceDialog
private static boolean validateNewTopic(ServletRequest request) throws ValidationException private static boolean validateNewTopic(ServletRequest request, String on_error) throws ErrorBox
{ {
boolean is_title_null, is_zp_null; boolean is_title_null, is_zp_null;
String foo = request.getParameter("title"); String foo = request.getParameter("title");
if (foo==null) if (foo==null)
throw new ValidationException("Title parameter was not specified."); throw new ErrorBox(null,"Title parameter was not specified.",on_error);
is_title_null = (foo.length()==0); is_title_null = (foo.length()==0);
foo = request.getParameter("pseud"); foo = request.getParameter("pseud");
if (foo==null) if (foo==null)
throw new ValidationException("Pseud parameter was not specified."); throw new ErrorBox(null,"Pseud parameter was not specified.",on_error);
foo = request.getParameter("pb"); foo = request.getParameter("pb");
if (foo==null) if (foo==null)
throw new ValidationException("Body text was not specified."); throw new ErrorBox(null,"Body text was not specified.",on_error);
is_zp_null = (foo.length()==0); is_zp_null = (foo.length()==0);
return is_title_null || is_zp_null; return is_title_null || is_zp_null;
@ -143,375 +91,256 @@ public class ConfOperations extends VeniceServlet
} // end getServletInfo } // end getServletInfo
public void doGet(HttpServletRequest request, HttpServletResponse response) /*--------------------------------------------------------------------------------
throws ServletException, IOException * Overrides from class VeniceServlet
{ *--------------------------------------------------------------------------------
UserContext user = getUserContext(request); */
RenderData rdat = createRenderData(request,response);
String page_title = null;
Object content = null;
SIGContext sig = null;
protected VeniceContent doVeniceGet(HttpServletRequest request, VeniceEngine engine,
UserContext user, RenderData rdat)
throws ServletException, IOException, VeniceServletResult
{
// get the SIG
SIGContext sig = getSIGParameter(request,user,true,"top");
changeMenuSIG(request,sig);
String on_error = "confops?sig=" + sig.getSIGID();
// get the command we want to use
String cmd = getStandardCommandParam(request);
if (cmd.equals("C"))
{ // "C" = "Create conference"
if (!(sig.canCreateConference()))
return new ErrorBox("Access Error","You are not permitted to create conferences in this SIG.",
on_error);
// make the "create" dialog
CreateConferenceDialog dlg = makeCreateConferenceDialog();
dlg.setupDialog(engine,sig);
setMyLocation(request,on_error + "&cmd=C");
return dlg;
} // end if ("C" command)
if (cmd.equals("T"))
{ // "T" = "Create topic" (requires conference parameter)
ConferenceContext conf = getConferenceParameter(request,sig,true,on_error);
on_error = "confdisp?sig=" + sig.getSIGID() + "&conf=" + conf.getConfID();
// Create the new topic form.
NewTopicForm ntf = new NewTopicForm(sig,conf);
ntf.setupNewRequest();
setMyLocation(request,"confops?sig=" + sig.getSIGID() + "&conf=" + conf.getConfID() + "&cmd=T");
return ntf;
} // end if ("T" command)
if (cmd.equals("Q"))
{ // "Q" = display Manage menu (requires conference parameter)
ConferenceContext conf = getConferenceParameter(request,sig,true,on_error);
on_error = "confdisp?sig=" + sig.getSIGID() + "&conf=" + conf.getConfID();
// display the "Manage Conference" display
setMyLocation(request,"confops?sig=" + sig.getSIGID() + "&conf=" + conf.getConfID() + "&cmd=Q");
return new ManageConference(sig,conf);
} // end if ("Q" command)
if (cmd.equals("FX"))
{ // "FX" = the dreaded fixseen :-) - catches up the entire conference
ConferenceContext conf = getConferenceParameter(request,sig,true,on_error);
on_error = "confdisp?sig=" + sig.getSIGID() + "&conf=" + conf.getConfID();
try
{ // do the fixseen operation
conf.fixSeen();
} // end try
catch (DataException de)
{ // some sort of error in the database
return new ErrorBox("Database Error","Database error catching up conference: " + de.getMessage(),
on_error);
} // end catch
return null; // null response here
} // end if ("FX" command)
// Any unrecognized command shows us the conference list.
on_error = "sigprofile?sig=" + sig.getSIGID();
try try
{ // all conference commands require a SIG parameter as well { // make a conference listing
sig = getSIGParameter(request,user); setMyLocation(request,"confops?sig=" + sig.getSIGID());
changeMenuSIG(request,sig); return new ConferenceListing(sig);
} // end try } // end try
catch (ValidationException ve)
{ // no SIG specified
page_title = "Error";
content = new ErrorBox(null,ve.getMessage(),"top");
} // end catch
catch (DataException de) catch (DataException de)
{ // error looking up the SIG { // something wrong in the database
page_title = "Database Error"; return new ErrorBox("Database Error","Database error finding conferences: " + de.getMessage(),on_error);
content = new ErrorBox(page_title,"Database error finding SIG: " + de.getMessage(),"top");
} // end catch
catch (AccessError ae)
{ // some lack of access is causing problems
return new ErrorBox("Access Error",ae.getMessage(),on_error);
} // end catch } // end catch
if (content==null) } // end doVeniceGet
{ // get the command we want to use
String cmd = request.getParameter("cmd");
if (cmd==null)
cmd = "???";
if (cmd.equals("C")) protected VeniceContent doVenicePost(HttpServletRequest request, VeniceEngine engine,
{ // "C" = "Create conference" UserContext user, RenderData rdat)
if (sig.canCreateConference()) throws ServletException, IOException, VeniceServletResult
{ // make the create conference dialog! {
CreateConferenceDialog dlg = makeCreateConferenceDialog(); // get the SIG
dlg.setupDialog(getVeniceEngine(),sig); SIGContext sig = getSIGParameter(request,user,true,"top");
content = dlg; changeMenuSIG(request,sig);
page_title = dlg.getTitle(); String on_error = "confops?sig=" + sig.getSIGID();
} // end if // get the command we want to use
else String cmd = getStandardCommandParam(request);
{ // we can't create conferences
page_title = "Error";
content = new ErrorBox("SIG Error","You are not permitted to create conferences in this SIG.","top");
} // end else if (cmd.equals("C"))
{ // "C" = "Create Conference"
if (!(sig.canCreateConference()))
return new ErrorBox("Access Error","You are not permitted to create conferences in this SIG.",
on_error);
// load up the create conference dialog!
CreateConferenceDialog dlg = makeCreateConferenceDialog();
dlg.setupDialog(engine,sig);
if (dlg.isButtonClicked(request,"cancel"))
throw new RedirectResult(on_error); // they chickened out - go back to the conference list
if (dlg.isButtonClicked(request,"create"))
{ // OK, they actually want to create the new conference...
dlg.loadValues(request); // load the form data
} // end if
else if (cmd.equals("T"))
{ // "T" = "Create topic" (requires conference parameter)
try try
{ // start by getting the conference parameter { // attempt to create the conference!
ConferenceContext conf = getConferenceParameter(request,sig); ConferenceContext conf = dlg.doDialog(sig);
// create the New Topic form // success! redirect to the conference's topic list
NewTopicForm ntf = new NewTopicForm(sig,conf); throw new RedirectResult("confdisp?sig=" + sig.getSIGID() + "&conf=" + conf.getConfID());
ntf.setupNewRequest();
content = ntf;
page_title = "Create New Topic";
} // end try } // end try
catch (ValidationException ve) catch (ValidationException ve)
{ // we can't get the conference parameter { // validation error - throw it back to the user
page_title = "Error"; dlg.resetOnError(ve.getMessage() + " Please try again.");
content = new ErrorBox(null,ve.getMessage(),
"sigprofile?sig=" + String.valueOf(sig.getSIGID()));
} // end catch } // end catch
catch (AccessError ae) catch (AccessError ae)
{ // we have some sort of access problem { // some sort of access error - display an error dialog
page_title = "Access Error"; return new ErrorBox("Access Error",ae.getMessage(),on_error);
content = new ErrorBox(page_title,ae.getMessage(),
"sigprofile?sig=" + String.valueOf(sig.getSIGID()));
} // end catch } // end catch
catch (DataException de) catch (DataException de)
{ // some sort of error in the database { // database error creating the conference
page_title = "Database Error"; return new ErrorBox("Database Error","Database error creating conference: " + de.getMessage(),
content = new ErrorBox(page_title,"Database error finding conference: " + de.getMessage(), on_error);
"sigprofile?sig=" + String.valueOf(sig.getSIGID()));
} // end catch } // end catch
} // end else setMyLocation(request,on_error + "&cmd=C");
else return dlg; // redisplay the dialog
{ // any unrecognized command jumps us to "conference list"
try
{ // show the conference listing
content = new ConferenceListing(sig);
page_title = "Conference Listing: " + sig.getName();
} // end try } // end if ("create" button clicked)
catch (DataException de)
{ // something wrong in the database
page_title = "Database Error";
content = new ErrorBox(page_title,"Database error finding conferences: " + de.getMessage(),
"sigprofile?sig=" + String.valueOf(sig.getSIGID()));
} // end catch // error - don't know what button was clicked
catch (AccessError ae) logger.error("no known button click on ConfOperations.doPost, cmd=C");
{ // some lack of access is causing problems return new ErrorBox("Internal Error","Unknown command button pressed",on_error);
page_title = "Access Error";
content = new ErrorBox(page_title,ae.getMessage(),
"sigprofile?sig=" + String.valueOf(sig.getSIGID()));
} // end catch } // end if ("C" command)
} // end else if (cmd.equals("T"))
{ // "T" command = Create New Topic (requires conference parameter)
ConferenceContext conf = getConferenceParameter(request,sig,true,on_error);
on_error = "confdisp?sig=" + sig.getSIGID() + "&conf=" + conf.getConfID();
} // end if (SIG parameter retrieved OK) // determine what to do based on the button pressed
if (isImageButtonClicked(request,"cancel"))
throw new RedirectResult(on_error); // the user chickened out - go back to the conference display
BaseJSPData basedat = new BaseJSPData(page_title,"confops?" + request.getQueryString(),content); if (isImageButtonClicked(request,"preview"))
basedat.transfer(getServletContext(),rdat); { // generate a preview and redisplay the form
NewTopicForm ntf = new NewTopicForm(sig,conf);
} // end doGet
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
UserContext user = getUserContext(request);
RenderData rdat = createRenderData(request,response);
String page_title = null;
Object content = null;
SIGContext sig = null;
String location;
try
{ // all conference commands require a SIG parameter as well
sig = getSIGParameter(request,user);
changeMenuSIG(request,sig);
location = "confops?sig=" + String.valueOf(sig.getSIGID());
} // end try
catch (ValidationException ve)
{ // no SIG specified
page_title = "Error";
content = new ErrorBox(null,ve.getMessage(),"top");
location = "top";
} // end catch
catch (DataException de)
{ // error looking up the SIG
page_title = "Database Error";
content = new ErrorBox(page_title,"Database error finding SIG: " + de.getMessage(),"top");
location = "top";
} // end catch
if (content==null)
{ // get the command we want to use
String cmd = request.getParameter("cmd");
if (cmd==null)
cmd = "???";
if (cmd.equals("C"))
{ // "C" = "Create Conference"
if (sig.canCreateConference())
{ // load up the create conference dialog!
CreateConferenceDialog dlg = makeCreateConferenceDialog();
dlg.setupDialog(getVeniceEngine(),sig);
if (dlg.isButtonClicked(request,"cancel"))
{ // they chickened out - go back to the conference list
rdat.redirectTo(location);
return;
} // end if
if (dlg.isButtonClicked(request,"create"))
{ // OK, they actually want to create the new conference...
dlg.loadValues(request); // load the form data
try
{ // attempt to create the conference!
ConferenceContext conf = dlg.doDialog(sig);
// success! go to the conference's topic list
rdat.redirectTo("confdisp?sig=" + String.valueOf(sig.getSIGID()) + "&conf="
+ String.valueOf(conf.getConfID()));
return;
} // end try
catch (ValidationException ve)
{ // validation error - throw it back to the user
dlg.resetOnError(ve.getMessage() + " Please try again.");
content = dlg;
page_title = dlg.getTitle();
} // end catch
catch (AccessError ae)
{ // some sort of access error - display an error dialog
page_title = "Access Error";
content = new ErrorBox(page_title,ae.getMessage(),location);
} // end catch
catch (DataException de)
{ // database error creating the conference
page_title = "Database Error";
content = new ErrorBox(page_title,"Database error creating conference: " + de.getMessage(),
location);
} // end catch
} // end if
else
{ // error - don't know what button was clicked
page_title = "Internal Error";
logger.error("no known button click on ConfOperations.doPost, cmd=C");
content = new ErrorBox(page_title,"Unknown command button pressed",location);
} // end else
} // end if
else
{ // we can't create conferences
page_title = "Error";
content = new ErrorBox("SIG Error","You are not permitted to create conferences in this SIG.",
location);
} // end else
} // end if ("C" command)
else if (cmd.equals("T"))
{ // "T" command = Create New Topic (requires conference parameter)
ConferenceContext conf = null;
try try
{ // start by getting the conference parameter { // generate a preview display
conf = getConferenceParameter(request,sig); ntf.generatePreview(engine,conf,request);
} // end try } // end try
catch (ValidationException ve) catch (ValidationException ve)
{ // we can't get the conference parameter { // something messed up in the preview generation
page_title = "Error"; return new ErrorBox(null,ve.getMessage(),on_error);
content = new ErrorBox(null,ve.getMessage(),location);
} // end catch
catch (AccessError ae)
{ // we have some sort of access problem
page_title = "Access Error";
content = new ErrorBox(page_title,ae.getMessage(),location);
} // end catch
catch (DataException de)
{ // some sort of error in the database
page_title = "Database Error";
content = new ErrorBox(page_title,"Database error finding conference: " + de.getMessage(),location);
} // end catch } // end catch
if (content==null) if (ntf.isNullRequest())
{ // determine what to do based on the button pressed return null; // no title or text specified - "204 No Content"
String on_error = "confdisp?sig=" + String.valueOf(sig.getSIGID()) + "&conf="
+ String.valueOf(conf.getConfID()); setMyLocation(request,"confops?sig=" + sig.getSIGID() + "&conf=" + conf.getConfID() + "&cmd=T");
if (isImageButtonClicked(request,"cancel")) return ntf;
{ // the user chickened out - go back to the conference display
rdat.redirectTo(on_error); } // end if ("preview" clicked)
return;
if (isImageButtonClicked(request,"post"))
{ // first validate that we've got all the parameters
if (validateNewTopic(request,on_error))
return null; // this is a null request - send a null response
try
{ // add the new topic!
TopicContext topic = conf.addTopic(request.getParameter("title"),request.getParameter("pseud"),
request.getParameter("pb"));
final String yes = "Y";
if (yes.equals(request.getParameter("attach")))
{ // we need to upload an attachment for this post
setMyLocation(request,on_error);
return new AttachmentForm(sig,conf,topic.getMessage(0),on_error);
} // end if } // end if
if (isImageButtonClicked(request,"preview")) } // end try
{ // generate a preview and redisplay the form catch (DataException de)
NewTopicForm ntf = new NewTopicForm(sig,conf); { // display a database error
return new ErrorBox("Database Error","Database error adding topic: " + de.getMessage(),on_error);
try } // end catch
{ // do a preview generation catch (AccessError ae)
ntf.generatePreview(getVeniceEngine(),conf,request); { // some sort of access problem
return new ErrorBox("Access Error",ae.getMessage(),on_error);
if (ntf.isNullRequest()) } // end catch
{ // no title or text specified - this is a "204 No Content" return
rdat.nullResponse();
return;
} // end if // jump back to the form under normal circumstances
throw new RedirectResult(on_error);
content = ntf; } // end if ("post" clicked)
page_title = "Preview New Topic";
} // end try // we don't know what button was pressed
catch (ValidationException ve) logger.error("no known button click on ConfOperations.doPost, cmd=T");
{ // something messed up in the preview generation return new ErrorBox("Internal Error","Unknown command button pressed",on_error);
page_title = "Error";
content = new ErrorBox(null,ve.getMessage(),on_error);
} // end catch } // end if ("T" command)
} // end if ("preview" button clicked) if (cmd.equals("P"))
else if (isImageButtonClicked(request,"post")) { // "P" = Set default pseud (requires conference parameter)
{ // OK, let's do a post request! ConferenceContext conf = getConferenceParameter(request,sig,true,on_error);
try on_error = "confdisp?sig=" + sig.getSIGID() + "&conf=" + conf.getConfID();
{ // first validate that we've got all the parameters
if (validateNewTopic(request))
{ // this is a null request - send a null response
rdat.nullResponse();
return;
} // end if // TODO: finish this later
// add the new topic! return null;
TopicContext topic = conf.addTopic(request.getParameter("title"),request.getParameter("pseud"),
request.getParameter("pb"));
final String yes = "Y"; } // end if ("P" command)
if (yes.equals(request.getParameter("attach")))
{ // we need to upload an attachment for this post
TopicMessageContext msg = topic.getMessage(0); // load the "zero post"
content = new AttachmentForm(sig,conf,msg,on_error); // unrecognized command!
page_title = "Upload Attachment"; logger.error("invalid command to ConfOperations.doPost: " + cmd);
return new ErrorBox("Internal Error","Invalid command to ConfOperations.doPost",on_error);
} // end if } // end doVenicePost
else
{ // the post is complete, we need only jump to the topic
// TODO: jump straight to the new topic
rdat.redirectTo(on_error);
return;
} // end else
} // end try
catch (ValidationException ve)
{ // the validation of parameters failed
page_title = "Error";
content = new ErrorBox(null,ve.getMessage(),on_error);
} // end catch
catch (DataException de)
{ // display a database error
page_title = "Database Error";
content = new ErrorBox(page_title,"Database error adding topic: " + de.getMessage(),on_error);
} // end catch
catch (AccessError ae)
{ // some sort of access problem
page_title = "Access Error";
content = new ErrorBox(page_title,ae.getMessage(),on_error);
} // end catch
} // end else if
else
{ // we don't know what button was pressed
page_title = "Internal Error";
logger.error("no known button click on ConfOperations.doPost, cmd=T");
content = new ErrorBox(page_title,"Unknown command button pressed",on_error);
} // end else
} // end if (we got the conference parameter OK)
} // end else if ("T" command)
else
{ // unrecognized command!
page_title = "Internal Error";
logger.error("invalid command to ConfOperations.doPost: " + cmd);
content = new ErrorBox(page_title,"Invalid command to ConfOperations.doPost",location);
} // end else
} // end if (SIG parameter retrieved OK)
BaseJSPData basedat = new BaseJSPData(page_title,location,content);
basedat.transfer(getServletContext(),rdat);
} // end doPost
} // end class ConfOperations } // end class ConfOperations

View File

@ -0,0 +1,54 @@
/*
* 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) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
package com.silverwrist.venice.servlets;
import com.silverwrist.venice.servlets.format.VeniceContent;
public class ContentResult extends VeniceServletResult
{
/*--------------------------------------------------------------------------------
* Attributes
*--------------------------------------------------------------------------------
*/
private VeniceContent content;
/*--------------------------------------------------------------------------------
* Constructor
*--------------------------------------------------------------------------------
*/
public ContentResult(VeniceContent content)
{
super();
this.content = content;
} // end constructor
/*--------------------------------------------------------------------------------
* External operations
*--------------------------------------------------------------------------------
*/
public VeniceContent getContent()
{
return content;
} // end getContent
} // end class ContentResult

View File

@ -0,0 +1,66 @@
/*
* 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) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
package com.silverwrist.venice.servlets;
import java.io.IOException;
import com.silverwrist.venice.servlets.format.RenderData;
public class ErrorResult extends ExecuteResult
{
/*--------------------------------------------------------------------------------
* Attributes
*--------------------------------------------------------------------------------
*/
private int code;
private String msg;
/*--------------------------------------------------------------------------------
* Constructors
*--------------------------------------------------------------------------------
*/
public ErrorResult(int code)
{
this.code = code;
this.msg = null;
} // end constructor
public ErrorResult(int code, String msg)
{
this.code = code;
this.msg = msg;
} // end constructor
/*--------------------------------------------------------------------------------
* Overrides from class ExecuteResult
*--------------------------------------------------------------------------------
*/
public void execute(RenderData rdat) throws IOException
{
if (msg!=null)
rdat.errorResponse(code,msg);
else
rdat.errorResponse(code);
} // end execute
} // end class ErrorResult

View File

@ -0,0 +1,44 @@
/*
* 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) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
package com.silverwrist.venice.servlets;
import java.io.IOException;
import javax.servlet.ServletException;
import com.silverwrist.venice.servlets.format.RenderData;
public abstract class ExecuteResult extends VeniceServletResult
{
/*--------------------------------------------------------------------------------
* Constructor
*--------------------------------------------------------------------------------
*/
protected ExecuteResult()
{
super();
} // end constructor
/*--------------------------------------------------------------------------------
* Abstract operations which must be overridden
*--------------------------------------------------------------------------------
*/
public abstract void execute(RenderData rdat) throws IOException, ServletException;
} // end class ExecuteResult

View File

@ -7,7 +7,7 @@
* WARRANTY OF ANY KIND, either express or implied. See the License for the specific * WARRANTY OF ANY KIND, either express or implied. See the License for the specific
* language governing rights and limitations under the License. * language governing rights and limitations under the License.
* *
* The Original Code is the Venice Web Community System. * The Original Code is the Venice Web Communities System.
* *
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, * 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 * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
@ -75,7 +75,7 @@ public class Find extends VeniceServlet
} // end getDisplayParam } // end getDisplayParam
private int getCategoryParam(ServletRequest request) throws ServletException private int getCategoryParam(VeniceEngine engine, ServletRequest request)
{ {
String cat_str = request.getParameter("cat"); String cat_str = request.getParameter("cat");
if (cat_str==null) if (cat_str==null)
@ -84,7 +84,7 @@ public class Find extends VeniceServlet
try try
{ // get the category ID and check it for validity { // get the category ID and check it for validity
int cat = Integer.parseInt(cat_str); int cat = Integer.parseInt(cat_str);
if (getVeniceEngine().isValidCategoryID(cat)) if (engine.isValidCategoryID(cat))
return cat; return cat;
} // end try } // end try
@ -109,86 +109,71 @@ public class Find extends VeniceServlet
} // end getServletInfo } // end getServletInfo
public void doGet(HttpServletRequest request, HttpServletResponse response) /*--------------------------------------------------------------------------------
throws ServletException, IOException * Overrides from class VeniceServlet
{ *--------------------------------------------------------------------------------
UserContext user = getUserContext(request); */
RenderData rdat = createRenderData(request,response);
String page_title = null;
Object content = null;
protected VeniceContent doVeniceGet(HttpServletRequest request, VeniceEngine engine,
UserContext user, RenderData rdat)
throws ServletException, IOException, VeniceServletResult
{
changeMenuTop(request); // we go to the "top" menus for this changeMenuTop(request); // we go to the "top" menus for this
// figure out which page to display // figure out which page to display
int disp = getDisplayParam(request,FindData.getNumChoices()); int disp = getDisplayParam(request,FindData.getNumChoices());
FindData finddata = new FindData(getVeniceEngine(),user,disp); FindData finddata = new FindData(engine,user,disp);
// figure out the category ID parameter // figure out the category ID parameter
int cat = -1; int cat = -1;
if (disp==FindData.FD_SIGS) if (disp==FindData.FD_SIGS)
cat = getCategoryParam(request); cat = getCategoryParam(engine,request);
try try
{ // attempt to configure the display { // attempt to configure the display
finddata.loadGet(cat); finddata.loadGet(cat);
// display the standard output
page_title = "Find";
content = finddata;
} // end try } // end try
catch (DataException de) catch (DataException de)
{ // database error, man { // database error, man
page_title = "Database Error"; return new ErrorBox("Database Error","Database error accessing category data: " + de.getMessage(),"top");
content = new ErrorBox(page_title,"Database error accessing category data: " + de.getMessage(),"top");
} // end catch } // end catch
BaseJSPData basedat = new BaseJSPData(page_title,"find?" + request.getQueryString(),content); setMyLocation(request,"find?" + request.getQueryString());
basedat.transfer(getServletContext(),rdat); return finddata;
} // end doGet } // end doVeniceGet
public void doPost(HttpServletRequest request, HttpServletResponse response) protected VeniceContent doVenicePost(HttpServletRequest request, VeniceEngine engine,
throws ServletException, IOException UserContext user, RenderData rdat)
throws ServletException, IOException, VeniceServletResult
{ {
UserContext user = getUserContext(request);
RenderData rdat = createRenderData(request,response);
String page_title = null;
Object content = null;
changeMenuTop(request); // we go to the "top" menus for this changeMenuTop(request); // we go to the "top" menus for this
// figure out which page to display // figure out which page to display
int disp = getDisplayParam(request,FindData.getNumChoices()); int disp = getDisplayParam(request,FindData.getNumChoices());
FindData finddata = new FindData(getVeniceEngine(),user,disp); FindData finddata = new FindData(engine,user,disp);
try try
{ // attempt to configure the display { // attempt to configure the display
finddata.loadPost(request); finddata.loadPost(request);
// display the standard output
page_title = "Find";
content = finddata;
} // end try } // end try
catch (ValidationException ve) catch (ValidationException ve)
{ // error in find parameters { // error in find parameters
page_title = "Find Error"; return new ErrorBox("Find Error",ve.getMessage(),"top");
content = new ErrorBox(null,ve.getMessage(),"top");
} // end catch } // end catch
catch (DataException de) catch (DataException de)
{ // database error, man { // database error, man
page_title = "Database Error"; return new ErrorBox("Database Error","Database error on find: " + de.getMessage(),"top");
content = new ErrorBox(page_title,"Database error on find: " + de.getMessage(),"top");
} // end catch } // end catch
BaseJSPData basedat = new BaseJSPData(page_title, setMyLocation(request,"find?disp=" + finddata.getDisplayOption());
"find?disp=" + String.valueOf(finddata.getDisplayOption()),content); return finddata;
basedat.transfer(getServletContext(),rdat);
} // end doPost } // end doVenicePost
} // end class Find } // end class Find

View File

@ -41,89 +41,11 @@ public class PostMessage extends VeniceServlet
*-------------------------------------------------------------------------------- *--------------------------------------------------------------------------------
*/ */
private static SIGContext getSIGParameter(ServletRequest request, UserContext user) private static int getPostNumber(ServletRequest request, String on_error) throws ErrorBox
throws ValidationException, DataException
{
String str = request.getParameter("sig");
if (str==null)
{ // no SIG parameter - bail out now!
logger.error("SIG parameter not specified!");
throw new ValidationException("No SIG specified.");
} // end if
try
{ // turn the string into a SIGID, and thence to a SIGContext
int sigid = Integer.parseInt(str);
return user.getSIGContext(sigid);
} // end try
catch (NumberFormatException nfe)
{ // error in Integer.parseInt
logger.error("Cannot convert SIG parameter '" + str + "'!");
throw new ValidationException("Invalid SIG parameter.");
} // end catch
} // end getSIGParameter
private static ConferenceContext getConferenceParameter(ServletRequest request, SIGContext sig)
throws ValidationException, DataException, AccessError
{
String str = request.getParameter("conf");
if (str==null)
{ // no conference parameter - bail out now!
logger.error("Conference parameter not specified!");
throw new ValidationException("No conference specified.");
} // end if
try
{ // turn the string into a ConfID, and thence to a ConferenceContext
int confid = Integer.parseInt(str);
return sig.getConferenceContext(confid);
} // end try
catch (NumberFormatException nfe)
{ // error in Integer.parseInt
logger.error("Cannot convert conference parameter '" + str + "'!");
throw new ValidationException("Invalid conference parameter.");
} // end catch
} // end getConferenceParameter
private static TopicContext getTopicParameter(ServletRequest request, ConferenceContext conf)
throws ValidationException, DataException, AccessError
{
String str = request.getParameter("top");
if (StringUtil.isStringEmpty(str))
{ // no topic parameter - bail out now!
logger.error("Topic parameter not specified!");
throw new ValidationException("No topic specified.");
} // end if
try
{ // turn the string into a TopicID, and thence to a TopicContext
short topicid = Short.parseShort(str);
return conf.getTopic(topicid);
} // end try
catch (NumberFormatException nfe)
{ // error in Integer.parseInt
logger.error("Cannot convert topic parameter '" + str + "'!");
throw new ValidationException("Invalid topic parameter.");
} // end catch
} // end getTopicParameter
private static int getPostNumber(ServletRequest request) throws ValidationException
{ {
String str = request.getParameter("sd"); String str = request.getParameter("sd");
if (StringUtil.isStringEmpty(str)) if (StringUtil.isStringEmpty(str))
throw new ValidationException("Invalid parameter."); throw new ErrorBox(null,"Invalid parameter.",on_error);
try try
{ // get the number of posts we think he topic has { // get the number of posts we think he topic has
return Integer.parseInt(str); return Integer.parseInt(str);
@ -131,7 +53,7 @@ public class PostMessage extends VeniceServlet
} // end try } // end try
catch (NumberFormatException nfe) catch (NumberFormatException nfe)
{ // not a good integer... { // not a good integer...
throw new ValidationException("Invalid parameter."); throw new ErrorBox(null,"Invalid parameter.",on_error);
} // end catch } // end catch
@ -150,265 +72,108 @@ public class PostMessage extends VeniceServlet
} // end getServletInfo } // end getServletInfo
public void doPost(HttpServletRequest request, HttpServletResponse response) /*--------------------------------------------------------------------------------
throws ServletException, IOException * Overrides from class VeniceServlet
{ *--------------------------------------------------------------------------------
UserContext user = getUserContext(request); */
RenderData rdat = createRenderData(request,response);
String page_title = null; protected VeniceContent doVenicePost(HttpServletRequest request, VeniceEngine engine,
Object content = null; UserContext user, RenderData rdat)
SIGContext sig = null; // SIG context throws ServletException, IOException, VeniceServletResult
ConferenceContext conf = null; // conference context {
TopicContext topic = null; // topic context // get the SIG
SIGContext sig = getSIGParameter(request,user,true,"top");
changeMenuSIG(request,sig);
// get the conference
ConferenceContext conf = getConferenceParameter(request,sig,true,"top");
// get the topic
TopicContext topic = getTopicParameter(request,conf,true,"top");
String on_error = "confdisp?sig=" + sig.getSIGID() + "&conf=" + conf.getConfID() + "&top="
+ topic.getTopicNumber();
// make sure we've got some post data
String raw_postdata = request.getParameter("pb");
if (StringUtil.isStringEmpty(raw_postdata))
return null; // don't allow zero-size posts
final String yes = "Y";
if (isImageButtonClicked(request,"cancel"))
throw new RedirectResult(on_error); // canceled posting - take us back
if (isImageButtonClicked(request,"preview")) // generate a preview
return new PostPreview(engine,sig,conf,topic,request.getParameter("pseud"),raw_postdata,
request.getParameter("next"),getPostNumber(request,on_error),
yes.equals(request.getParameter("attach")));
if (isImageButtonClicked(request,"post") || isImageButtonClicked(request,"postnext"))
{ // post the message, and then either go back to the same topic or on to the next one
boolean go_next = isImageButtonClicked(request,"postnext");
int pn = getPostNumber(request,on_error);
try
{ // this outer try is to catch ValidationException
try try
{ // all commands require a SIG parameter { // first check for slippage
sig = getSIGParameter(request,user); if (pn!=topic.getTotalMessages()) // slippage detected! display the slippage screen
changeMenuSIG(request,sig); return new PostSlippage(engine,sig,conf,topic,pn,request.getParameter("next"),
if (logger.isDebugEnabled()) request.getParameter("pseud"),raw_postdata,
logger.debug("found SIG #" + String.valueOf(sig.getSIGID())); yes.equals(request.getParameter("attach")));
// post the darn thing!
TopicMessageContext msg = topic.postNewMessage(0,request.getParameter("pseud"),raw_postdata);
short next;
try
{ // attempt to get the value of the "next topic" parameter
if (go_next)
{ // get the "next topic" parameter
String foo = request.getParameter("next");
if (StringUtil.isStringEmpty(foo))
next = topic.getTopicNumber();
else
next = Short.parseShort(foo);
} // end if
else
next = topic.getTopicNumber();
} // end try
catch (NumberFormatException nfe)
{ // just default me
next = topic.getTopicNumber();
} // end catch
// where do we want to go now?
String target = "confdisp?sig=" + sig.getSIGID() + "&conf=" + conf.getConfID() + "&top="
+ next + "&rnm=1";
if (yes.equals(request.getParameter("attach")))
return new AttachmentForm(sig,conf,msg,target); // go to upload an attachment
// no attachment - redirect where we need to go
throw new RedirectResult(target);
} // end try } // end try
catch (DataException de) catch (DataException de)
{ // error looking up the SIG { // there was a database error posting the message
page_title = "Database Error"; return new ErrorBox("Database Error","Database error posting message: " + de.getMessage(),"top");
content = new ErrorBox(page_title,"Database error finding SIG: " + de.getMessage(),"top");
} // end catch
catch (AccessError ae)
{ // we were unable to post the message
return new ErrorBox("Access Error",ae.getMessage(),"top");
} // end catch } // end catch
if (content==null) } // end if
{ // we got the SIG parameter OK
try
{ // all commands require a conference parameter
conf = getConferenceParameter(request,sig);
if (logger.isDebugEnabled())
logger.debug("found conf #" + String.valueOf(conf.getConfID()));
} // end try // unknown button clicked
catch (DataException de) logger.error("no known button click on PostMessage.doPost");
{ // error looking up the conference return new ErrorBox("Internal Error","Unknown command button pressed","top");
page_title = "Database Error";
content = new ErrorBox(page_title,"Database error finding conference: " + de.getMessage(),"top");
} // end catch } // end doVenicePost
} // end if
if (content==null)
{ // we got the conference parameter OK
try
{ // now we need a topic parameter
topic = getTopicParameter(request,conf);
if (logger.isDebugEnabled())
logger.debug("found topic #" + String.valueOf(topic.getTopicID()));
} // end try
catch (DataException de)
{ // error looking up the conference
page_title = "Database Error";
content = new ErrorBox(page_title,"Database error finding topic: " + de.getMessage(),"top");
} // end catch
} // end if
} // end try
catch (ValidationException ve)
{ // these all get handled in pretty much the same way
page_title = "Error";
content = new ErrorBox(null,ve.getMessage(),"top");
} // end catch
catch (AccessError ae)
{ // these all get handled in pretty much the same way
page_title = "Access Error";
content = new ErrorBox(page_title,ae.getMessage(),"top");
} // end catch
if (content==null)
{ // make sure we've got some post data
String raw_postdata = request.getParameter("pb");
if (StringUtil.isStringEmpty(raw_postdata))
{ // don't allow zero-size posts
rdat.nullResponse();
return;
} // end if
final String yes = "Y";
// now decide what to do based on which button got clicked
if (isImageButtonClicked(request,"cancel"))
{ // canceled posting - take us back to familiar ground
rdat.redirectTo("confdisp?sig=" + String.valueOf(sig.getSIGID()) + "&conf="
+ String.valueOf(conf.getConfID()) + "&top="
+ String.valueOf(topic.getTopicNumber()));
return;
} // end if ("Cancel")
else if (isImageButtonClicked(request,"preview"))
{ // previewing the post!
try
{ // generate a preview view
content = new PostPreview(getVeniceEngine(),sig,conf,topic,request.getParameter("pseud"),
raw_postdata,request.getParameter("next"),getPostNumber(request),
yes.equals(request.getParameter("attach")));
page_title = "Previewing Post";
} // end try
catch (ValidationException ve)
{ // there was some sort of a parameter error in the display (getPostNumber can throw this)
page_title = "Error";
content = new ErrorBox(null,ve.getMessage(),"top");
} // end catch
} // end else if ("Preview & Spellcheck")
else if (isImageButtonClicked(request,"post"))
{ // post the message, and then reload the same topic
try
{ // first, check against slippage
int pn = getPostNumber(request);
if (pn==topic.getTotalMessages())
{ // no slippage - post the message!!!
TopicMessageContext msg = topic.postNewMessage(0,request.getParameter("pseud"),raw_postdata);
if (yes.equals(request.getParameter("attach")))
{ // we have an attachment to upload...display the "Upload Attachment" form
String target = "confdisp?sig=" + String.valueOf(sig.getSIGID()) + "&conf="
+ String.valueOf(conf.getConfID()) + "&top="
+ String.valueOf(topic.getTopicNumber()) + "&rnm=1";
content = new AttachmentForm(sig,conf,msg,target);
page_title = "Upload Attachment";
} // end if
else
{ // no attachment - jump back to the topic
rdat.redirectTo("confdisp?sig=" + String.valueOf(sig.getSIGID()) + "&conf="
+ String.valueOf(conf.getConfID()) + "&top="
+ String.valueOf(topic.getTopicNumber()) + "&rnm=1");
return;
} // end else
} // end if
else
{ // slippage detected - show the slippage display
content = new PostSlippage(getVeniceEngine(),sig,conf,topic,pn,request.getParameter("next"),
request.getParameter("pseud"),raw_postdata,
yes.equals(request.getParameter("attach")));
page_title = "Slippage or Double-Click Detected";
} // end else
} // end try
catch (ValidationException ve)
{ // there was some sort of a parameter error in the display
page_title = "Error";
content = new ErrorBox(null,ve.getMessage(),"top");
} // end catch
catch (DataException de)
{ // there was a database error posting the message
page_title = "Database Error";
content = new ErrorBox(page_title,"Database error posting message: " + de.getMessage(),"top");
} // end catch
catch (AccessError ae)
{ // we were unable to retrieve the topic list
page_title = "Access Error";
content = new ErrorBox(page_title,ae.getMessage(),"top");
} // end catch
} // end else if ("Post & Reload")
else if (isImageButtonClicked(request,"postnext"))
{ // post the message, and then go to the "next" topic
try
{ // first, check against slippage
int pn = getPostNumber(request);
if (pn==topic.getTotalMessages())
{ // no slippage - post the message!
TopicMessageContext msg = topic.postNewMessage(0,request.getParameter("pseud"),raw_postdata);
short next;
try
{ // attempt to get the value of the "next topic" parameter
String foo = request.getParameter("next");
if (StringUtil.isStringEmpty(foo))
next = topic.getTopicNumber();
else
next = Short.parseShort(foo);
} // end try
catch (NumberFormatException nfe)
{ // just default me
next = topic.getTopicNumber();
} // end catch
if (yes.equals(request.getParameter("attach")))
{ // we have an attachment to upload...
// TODO: jump somewhere we can upload the attachment!
rdat.redirectTo("confdisp?sig=" + String.valueOf(sig.getSIGID()) + "&conf="
+ String.valueOf(conf.getConfID()) + "&top=" + String.valueOf(next) + "&rnm=1");
return;
} // end if
else
{ // no attachment - jump to the next topic
rdat.redirectTo("confdisp?sig=" + String.valueOf(sig.getSIGID()) + "&conf="
+ String.valueOf(conf.getConfID()) + "&top=" + String.valueOf(next) + "&rnm=1");
return;
} // end else
} // end if
else
{ // slippage detected - show the slippage display
content = new PostSlippage(getVeniceEngine(),sig,conf,topic,pn,request.getParameter("next"),
request.getParameter("pseud"),raw_postdata,
yes.equals(request.getParameter("attach")));
page_title = "Slippage or Double-Click Detected";
} // end else
} // end try
catch (ValidationException ve)
{ // there was some sort of a parameter error in the display
page_title = "Error";
content = new ErrorBox(null,ve.getMessage(),"top");
} // end catch
catch (DataException de)
{ // there was a database error posting the message
page_title = "Database Error";
content = new ErrorBox(page_title,"Database error posting message: " + de.getMessage(),"top");
} // end catch
catch (AccessError ae)
{ // we were unable to retrieve the topic list
page_title = "Access Error";
content = new ErrorBox(page_title,ae.getMessage(),"top");
} // end catch
} // end else if ("Post & Go Next")
else
{ // unknown button clicked
page_title = "Internal Error";
logger.error("no known button click on PostMessage.doPost");
content = new ErrorBox(page_title,"Unknown command button pressed","top");
} // end else
} // end if (got all parameters oK)
BaseJSPData basedat = new BaseJSPData(page_title,"post",content);
basedat.transfer(getServletContext(),rdat);
} // end doPost
} // end class PostMessage } // end class PostMessage

View File

@ -39,115 +39,6 @@ public class PostOperations extends VeniceServlet
private static Category logger = Category.getInstance(TopicOperations.class.getName()); private static Category logger = Category.getInstance(TopicOperations.class.getName());
/*--------------------------------------------------------------------------------
* Internal functions
*--------------------------------------------------------------------------------
*/
private static SIGContext getSIGParameter(ServletRequest request, UserContext user)
throws ValidationException, DataException
{
String str = request.getParameter("sig");
if (str==null)
{ // no SIG parameter - bail out now!
logger.error("SIG parameter not specified!");
throw new ValidationException("No SIG specified.");
} // end if
try
{ // turn the string into a SIGID, and thence to a SIGContext
int sigid = Integer.parseInt(str);
return user.getSIGContext(sigid);
} // end try
catch (NumberFormatException nfe)
{ // error in Integer.parseInt
logger.error("Cannot convert SIG parameter '" + str + "'!");
throw new ValidationException("Invalid SIG parameter.");
} // end catch
} // end getSIGParameter
private static ConferenceContext getConferenceParameter(ServletRequest request, SIGContext sig)
throws ValidationException, DataException, AccessError
{
String str = request.getParameter("conf");
if (str==null)
{ // no conference parameter - bail out now!
logger.error("Conference parameter not specified!");
throw new ValidationException("No conference specified.");
} // end if
try
{ // turn the string into a ConfID, and thence to a ConferenceContext
int confid = Integer.parseInt(str);
return sig.getConferenceContext(confid);
} // end try
catch (NumberFormatException nfe)
{ // error in Integer.parseInt
logger.error("Cannot convert conference parameter '" + str + "'!");
throw new ValidationException("Invalid conference parameter.");
} // end catch
} // end getConferenceParameter
private static TopicContext getTopicParameter(ServletRequest request, ConferenceContext conf)
throws ValidationException, DataException, AccessError
{
String str = request.getParameter("top");
if (StringUtil.isStringEmpty(str))
{ // no topic parameter - bail out now!
logger.error("Topic parameter not specified!");
throw new ValidationException("No topic specified.");
} // end if
try
{ // turn the string into a TopicID, and thence to a TopicContext
short topicid = Short.parseShort(str);
return conf.getTopic(topicid);
} // end try
catch (NumberFormatException nfe)
{ // error in Integer.parseInt
logger.error("Cannot convert topic parameter '" + str + "'!");
throw new ValidationException("Invalid topic parameter.");
} // end catch
} // end getTopicParameter
private static TopicMessageContext getMessageParameter(ServletRequest request, TopicContext topic)
throws ValidationException, DataException, AccessError
{
String str = request.getParameter("msg");
if (StringUtil.isStringEmpty(str))
{ // no topic parameter - bail out now!
logger.error("Message parameter not specified!");
throw new ValidationException("No message specified.");
} // end if
try
{ // turn the string into a TopicID, and thence to a TopicContext
int message_num = Integer.parseInt(str);
return topic.getMessage(message_num);
} // end try
catch (NumberFormatException nfe)
{ // error in Integer.parseInt
logger.error("Cannot convert message parameter '" + str + "'!");
throw new ValidationException("Invalid message parameter.");
} // end catch
} // end getMessageParameter
/*-------------------------------------------------------------------------------- /*--------------------------------------------------------------------------------
* Overrides from class HttpServlet * Overrides from class HttpServlet
*-------------------------------------------------------------------------------- *--------------------------------------------------------------------------------
@ -161,233 +52,130 @@ public class PostOperations extends VeniceServlet
} // end getServletInfo } // end getServletInfo
public void doGet(HttpServletRequest request, HttpServletResponse response) /*--------------------------------------------------------------------------------
throws ServletException, IOException * Overrides from class VeniceServlet
*--------------------------------------------------------------------------------
*/
protected VeniceContent doVeniceGet(HttpServletRequest request, VeniceEngine engine,
UserContext user, RenderData rdat)
throws ServletException, IOException, VeniceServletResult
{ {
UserContext user = getUserContext(request); // get the SIG
RenderData rdat = createRenderData(request,response); SIGContext sig = getSIGParameter(request,user,true,"top");
String location = "top"; changeMenuSIG(request,sig);
String locator = null; String locator = "sig=" + sig.getSIGID();
String page_title = null; String location = "sigprofile?" + locator;
Object content = null;
SIGContext sig = null; // SIG context
ConferenceContext conf = null; // conference context
TopicContext topic = null; // topic context
TopicMessageContext msg = null; // message context
try // get the conference
{ // this outer try is to catch ValidationException ConferenceContext conf = getConferenceParameter(request,sig,true,location);
locator += "&conf=" + conf.getConfID();
location = "confdisp?" + locator;
// get the topic
TopicContext topic = getTopicParameter(request,conf,true,location);
locator += "&top=" + topic.getTopicID();
location = "confdisp?" + locator;
// get the message
TopicMessageContext msg = getMessageParameter(request,topic,true,location);
location = "confdisp?" + locator + "&p1=" + msg.getPostNumber() + "&shac=1";
setMyLocation(request,location);
// figure out what command we want to perform
String cmd = getStandardCommandParam(request);
if (cmd.equals("HY") || cmd.equals("HN"))
{ // we want to hide or show the message
try try
{ // all commands require a SIG parameter { // attempt to hide or show the message
sig = getSIGParameter(request,user); msg.setHidden(cmd.equals("HY"));
changeMenuSIG(request,sig);
if (logger.isDebugEnabled())
logger.debug("found SIG #" + String.valueOf(sig.getSIGID()));
locator = "sig=" + String.valueOf(sig.getSIGID());
location = "sigprofile?" + locator;
} // end try // go back and display stuff
throw new RedirectResult(location);
} // end if
catch (DataException de) catch (DataException de)
{ // error looking up the SIG { // there was a database error
page_title = "Database Error"; return new ErrorBox("Database Error","Database error setting hidden status: " + de.getMessage(),
content = new ErrorBox(page_title,"Database error finding SIG: " + de.getMessage(),location); location);
} // end catch
catch (AccessError ae)
{ // naughty naughty = you can't do this!
return new ErrorBox("Access Error",ae.getMessage(),location);
} // end catch } // end catch
if (content==null) } // end if ("hide" or "show")
{ // we got the SIG parameter OK
try
{ // all commands require a conference parameter
conf = getConferenceParameter(request,sig);
if (logger.isDebugEnabled())
logger.debug("found conf #" + String.valueOf(conf.getConfID()));
locator += "&conf=" + String.valueOf(conf.getConfID());
location = "confdisp?" + locator;
} // end try if (cmd.equals("SCR"))
catch (DataException de) { // we want to scribble the message
{ // error looking up the conference try
page_title = "Database Error"; { // attempt to scribble the message
content = new ErrorBox(page_title,"Database error finding conference: " + de.getMessage(),location); msg.scribble();
} // end catch // go back and display stuff
throw new RedirectResult(location);
} // end if } // end try
catch (DataException de)
{ // there was a database error
return new ErrorBox("Database Error","Database error scribbling message: " + de.getMessage(),
location);
if (content==null) } // end catch
{ // we got the conference parameter OK catch (AccessError ae)
try { // naughty naughty = you can't do this!
{ // now we need a topic parameter return new ErrorBox("Access Error",ae.getMessage(),location);
topic = getTopicParameter(request,conf);
if (logger.isDebugEnabled())
logger.debug("found topic #" + String.valueOf(topic.getTopicID()));
locator += "&top=" + String.valueOf(topic.getTopicID());
location = "confdisp?" + locator;
} // end try } // end catch
catch (DataException de)
{ // error looking up the conference
page_title = "Database Error";
content = new ErrorBox(page_title,"Database error finding topic: " + de.getMessage(),location);
} // end catch } // end if ("scribble")
} // end if if (cmd.equals("NUKE"))
{ // nuking requires confirmation
try
{ // we need confirmation on this operation
if (ConfirmBox.isConfirmed(request,NUKE_CONFIRM_ATTR,NUKE_CONFIRM_PARAM))
{ // OK, go ahead, nuke the message!
msg.nuke();
if (content==null) // after which, redirect to topic view
{ // we got the topic parameter OK throw new RedirectResult("confdisp?" + locator);
try
{ // now we need a message parameter
msg = getMessageParameter(request,topic);
if (logger.isDebugEnabled())
logger.debug("found message #" + String.valueOf(msg.getPostID()));
location = "confdisp?" + locator + "&p1=" + msg.getPostNumber() + "&shac=1";
} // end try } // end if (confirmed)
catch (DataException de) else
{ // error looking up the conference { // not a proper confirmation - better display one
page_title = "Database Error"; List aliases = conf.getAliases();
content = new ErrorBox(page_title,"Database error finding message: " + de.getMessage(),location); String message = "You are about to nuke message <" + (String)(aliases.get(0)) + "."
+ topic.getTopicNumber() + "." + msg.getPostNumber() + ">, originally composed by <"
+ msg.getCreatorName() + ">! Are you sure you want to do this?";
String confirm_url = "postops?" + locator + "&msg=" + msg.getPostNumber() + "&cmd=NUKE";
return new ConfirmBox(request,NUKE_CONFIRM_ATTR,NUKE_CONFIRM_PARAM,"Nuke Message",
message,confirm_url,location);
} // end catch } // end else (not yet confirmed)
} // end if } // end try
catch (DataException de)
{ // there was a database error
return new ErrorBox("Database Error","Database error nuking message: " + de.getMessage(),
location);
} // end try } // end catch
catch (ValidationException ve) catch (AccessError ae)
{ // these all get handled in pretty much the same way { // naughty naughty = you can't do this!
page_title = "Error"; return new ErrorBox("Access Error",ae.getMessage(),location);
content = new ErrorBox(null,ve.getMessage(),location);
} // end catch } // end catch
catch (AccessError ae)
{ // these all get handled in pretty much the same way
page_title = "Access Error";
content = new ErrorBox(page_title,ae.getMessage(),location);
} // end catch } // end if ("nuke")
if (content==null) // unrecognized command!
{ // figure out what command we want to perform logger.error("invalid command to PostOperations.doGet: " + cmd);
String cmd = request.getParameter("cmd"); return new ErrorBox("Internal Error","Invalid command to PostOperations.doGet",location);
if (cmd==null)
cmd = "???";
if (cmd.equals("HY") || cmd.equals("HN")) } // end doVeniceGet
{ // we want to hide or show the message
try
{ // attempt to hide or show the message
msg.setHidden(cmd.equals("HY"));
// go back and display stuff
rdat.redirectTo(location);
return;
} // end try
catch (DataException de)
{ // there was a database error
page_title = "Database Error";
content = new ErrorBox(page_title,"Database error setting hidden status: " + de.getMessage(),
location);
} // end catch
catch (AccessError ae)
{ // naughty naughty = you can't do this!
page_title = "Access Error";
content = new ErrorBox(page_title,ae.getMessage(),location);
} // end catch
} // end if ("hide" or "show")
else if (cmd.equals("SCR"))
{ // we want to scribble the message
try
{ // attempt to scribble the message
msg.scribble();
// go back and display stuff
rdat.redirectTo(location);
return;
} // end try
catch (DataException de)
{ // there was a database error
page_title = "Database Error";
content = new ErrorBox(page_title,"Database error scribbling message: " + de.getMessage(),
location);
} // end catch
catch (AccessError ae)
{ // naughty naughty = you can't do this!
page_title = "Access Error";
content = new ErrorBox(page_title,ae.getMessage(),location);
} // end catch
} // end else if ("scribble")
else if (cmd.equals("NUKE"))
{ // nuking requires confirmation
try
{ // we need confirmation on this operation!
if (ConfirmBox.isConfirmed(request,NUKE_CONFIRM_ATTR,NUKE_CONFIRM_PARAM))
{ // OK, go ahead, nuke the message!
msg.nuke();
// after which, redirect to topic view
rdat.redirectTo("confdisp?" + locator);
return;
} // end if
else
{ // not a proper confirmation - better display one
List aliases = conf.getAliases();
String message = "You are about to nuke message <" + (String)(aliases.get(0)) + "."
+ String.valueOf(topic.getTopicNumber()) + "." + String.valueOf(msg.getPostNumber())
+ ">, originally composed by <" + msg.getCreatorName()
+ ">! Are you sure you want to do this?";
String confirm_url = "postops?" + locator + "&msg=" + msg.getPostNumber() + "&cmd=NUKE";
page_title = "Nuke Message";
content = new ConfirmBox(request,NUKE_CONFIRM_ATTR,NUKE_CONFIRM_PARAM,page_title,
message,confirm_url,location);
} // end else
} // end try
catch (DataException de)
{ // there was a database error
page_title = "Database Error";
content = new ErrorBox(page_title,"Database error nuking message: " + de.getMessage(),
location);
} // end catch
catch (AccessError ae)
{ // naughty naughty = you can't do this!
page_title = "Access Error";
content = new ErrorBox(page_title,ae.getMessage(),location);
} // end catch
} // end else if ("nuke")
else
{ // unrecognized command!
page_title = "Internal Error";
logger.error("invalid command to PostOperations.doGet: " + cmd);
content = new ErrorBox(page_title,"Invalid command to PostOperations.doGet",location);
} // end else
} // end if (got parameters OK)
BaseJSPData basedat = new BaseJSPData(page_title,location,content);
basedat.transfer(getServletContext(),rdat);
} // end doGet
} // end class PostOperations } // end class PostOperations

View File

@ -40,31 +40,34 @@ public class PostShortcut extends VeniceServlet
} // end getServletInfo } // end getServletInfo
public void doGet(HttpServletRequest request, HttpServletResponse response) /*--------------------------------------------------------------------------------
throws ServletException, IOException * Overrides from class VeniceServlet
*--------------------------------------------------------------------------------
*/
protected VeniceContent doVeniceGet(HttpServletRequest request, VeniceEngine engine,
UserContext user, RenderData rdat)
throws ServletException, IOException, VeniceServletResult
{ {
UserContext user = getUserContext(request);
RenderData rdat = createRenderData(request,response);
String raw_link = request.getPathInfo().substring(1); String raw_link = request.getPathInfo().substring(1);
PostLinkDecoder decoder; PostLinkDecoder decoder;
try try
{ // attempt to decode the path link information { // attempt to decode the path link information
decoder = new PostLinkDecoder(raw_link); decoder = new PostLinkDecoder(raw_link);
if (decoder.getSIG()==null) // it must include the SIG
throw new ValidationException("ambiguous post link (no SIG)");
} // end try } // end try
catch (ValidationException e) catch (ValidationException e)
{ // display an error message for validation { // the post link decoder failed
String page_title = "Invalid Post Link"; return new ErrorBox("Invalid Post Link","Invalid post link \"" + raw_link + "\": " + e.getMessage(),
ContentRender content = new ErrorBox(page_title,"Invalid post link \"" + raw_link + "\": " null);
+ e.getMessage(),null);
new BaseJSPData(page_title,"top",content).transfer(getServletContext(),rdat);
return;
} // end catch } // end catch
if (decoder.getSIG()==null) // it must include the SIG
return new ErrorBox("Invalid Post Link","Invalid post link \"" + raw_link
+ "\": ambiguous post link (no SIG)",null);
SIGContext sig; SIGContext sig;
try try
{ // get the SIG represented by that alias { // get the SIG represented by that alias
@ -73,20 +76,13 @@ public class PostShortcut extends VeniceServlet
} // end try } // end try
catch (DataException e) catch (DataException e)
{ // can't find the SIG - we're screwed { // can't find the SIG - we're screwed
String page_title = "Invalid Post Link"; return new ErrorBox("Invalid Post Link","Invalid post link \"" + raw_link + "\": cannot find SIG: "
ContentRender content = new ErrorBox(page_title,"Invalid post link \"" + raw_link + e.getMessage(),null);
+ "\": cannot find SIG: " + e.getMessage(),null);
new BaseJSPData(page_title,"top",content).transfer(getServletContext(),rdat);
return;
} // end catch } // end catch
if (decoder.getConference()==null) if (decoder.getConference()==null) // it's a SIG link only - redirect to the SIG's default page
{ // it's a SIG link only - redirect to the SIG's default page throw new RedirectResult("sig/" + decoder.getSIG());
rdat.redirectTo("sig/" + decoder.getSIG());
return;
} // end if
ConferenceContext conf; ConferenceContext conf;
try try
@ -96,31 +92,21 @@ public class PostShortcut extends VeniceServlet
} // end try } // end try
catch (DataException e) catch (DataException e)
{ // can't find the conference - we're screwed { // can't find the conference - we're screwed
String page_title = "Invalid Post Link"; return new ErrorBox("Invalid Post Link","Invalid post link \"" + raw_link
ContentRender content = new ErrorBox(page_title,"Invalid post link \"" + raw_link + "\": cannot find conference: " + e.getMessage(),null);
+ "\": cannot find conference: " + e.getMessage(),null);
new BaseJSPData(page_title,"top",content).transfer(getServletContext(),rdat);
return;
} // end catch } // end catch
catch (AccessError ae) catch (AccessError ae)
{ // we can't get to the conference... { // we can't get to the conference...
String page_title = "Access Error"; return new ErrorBox("Access Error",ae.getMessage(),null);
ContentRender content = new ErrorBox(page_title,ae.getMessage(),null);
new BaseJSPData(page_title,"top",content).transfer(getServletContext(),rdat);
return;
} // end catch } // end catch
// compute an elementary "locator" // compute an elementary "locator"
String locator = "sig=" + String.valueOf(sig.getSIGID()) + "&conf=" + String.valueOf(conf.getConfID()); String locator = "sig=" + sig.getSIGID() + "&conf=" + conf.getConfID();
if (decoder.getTopic()==-1) if (decoder.getTopic()==-1) // just a conference link - go to the top-level display
{ // just a conference link - go to the top-level display throw new RedirectResult("confdisp?" + locator);
rdat.redirectTo("confdisp?" + locator);
return;
} // end if
TopicContext topic; TopicContext topic;
try try
@ -130,32 +116,26 @@ public class PostShortcut extends VeniceServlet
} // end try } // end try
catch (DataException e) catch (DataException e)
{ // we can't find the topic - we're screwed { // we can't find the topic - we're screwed
String page_title = "Invalid Post Link"; return new ErrorBox("Invalid Post Link","Invalid post link \"" + raw_link + "\": cannot find topic: "
ContentRender content = new ErrorBox(page_title,"Invalid post link \"" + raw_link + e.getMessage(),null);
+ "\": cannot find topic: " + e.getMessage(),null);
new BaseJSPData(page_title,"top",content).transfer(getServletContext(),rdat);
return;
} // end catch } // end catch
catch (AccessError ae) catch (AccessError ae)
{ // we can't get to the topic... { // we can't get to the topic...
String page_title = "Access Error"; return new ErrorBox("Access Error",ae.getMessage(),null);
ContentRender content = new ErrorBox(page_title,ae.getMessage(),null);
new BaseJSPData(page_title,"top",content).transfer(getServletContext(),rdat);
return;
} // end catch } // end catch
// add the topic to our locator // add the topic to our locator
locator += "&top=" + String.valueOf(decoder.getTopic()); locator += "&top=" + decoder.getTopic();
if (decoder.getFirstPost()==-1) // we're just referencing the topic if (decoder.getFirstPost()==-1) // we're just referencing the topic
rdat.redirectTo("confdisp?" + locator + "&rnm=1"); throw new RedirectResult("confdisp?" + locator + "&rnm=1");
else // we're referencing a post range within the topic
rdat.redirectTo("confdisp?" + locator + "&p1=" + String.valueOf(decoder.getFirstPost()) + "&p2="
+ String.valueOf(decoder.getLastPost()));
} // end doGet // we're referencing a post range within the topic
throw new RedirectResult("confdisp?" + locator + "&p1=" + decoder.getFirstPost() + "&p2="
+ decoder.getLastPost());
} // end doVeniceGet
} // end class PostShortcut } // end class PostShortcut

View File

@ -0,0 +1,55 @@
/*
* 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) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
package com.silverwrist.venice.servlets;
import java.io.IOException;
import com.silverwrist.venice.servlets.format.RenderData;
public class RedirectResult extends ExecuteResult
{
/*--------------------------------------------------------------------------------
* Attributes
*--------------------------------------------------------------------------------
*/
private String target;
/*--------------------------------------------------------------------------------
* Constructor
*--------------------------------------------------------------------------------
*/
public RedirectResult(String target)
{
super();
this.target = target;
} // end constructor
/*--------------------------------------------------------------------------------
* Overrides from class ExecuteResult
*--------------------------------------------------------------------------------
*/
public void execute(RenderData rdat) throws IOException
{
rdat.redirectTo(target);
} // end doRedirect
} // end class RedirectResult

View File

@ -7,7 +7,7 @@
* WARRANTY OF ANY KIND, either express or implied. See the License for the specific * WARRANTY OF ANY KIND, either express or implied. See the License for the specific
* language governing rights and limitations under the License. * language governing rights and limitations under the License.
* *
* The Original Code is the Venice Web Community System. * The Original Code is the Venice Web Communities System.
* *
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, * 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 * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
@ -87,355 +87,238 @@ public class SIGAdmin extends VeniceServlet
} // end getServletInfo } // end getServletInfo
public void doGet(HttpServletRequest request, HttpServletResponse response) /*--------------------------------------------------------------------------------
throws ServletException, IOException * Overrides from class VeniceServlet
*--------------------------------------------------------------------------------
*/
protected VeniceContent doVeniceGet(HttpServletRequest request, VeniceEngine engine,
UserContext user, RenderData rdat)
throws ServletException, IOException, VeniceServletResult
{ {
UserContext user = getUserContext(request); // get the SIG context
RenderData rdat = createRenderData(request,response); SIGContext sig = getSIGParameter(request,user,true,"top");
String page_title = null; changeMenuSIG(request,sig);
Object content = null; setMyLocation(request,"sigadmin?" + request.getQueryString());
String on_error = "sigadmin?sig=" + sig.getSIGID();
SIGContext sig = null; if (logger.isDebugEnabled())
try logger.debug("SIGAdmin/doGet operating on SIG \"" + sig.getName() + "\" (" + sig.getSIGID() + ")");
{ // first get the SIG context we're working with
int sigid = Integer.parseInt(request.getParameter("sig"));
sig = user.getSIGContext(sigid);
changeMenuSIG(request,sig);
} // end try // now decide what to do based on the "cmd" parameter
catch (NumberFormatException nfe) String cmd = getStandardCommandParam(request);
{ // an improperly formatted SIGID brought us down! if (logger.isDebugEnabled())
page_title = "Input Error"; logger.debug("SIGAdmin/doGet command value = " + cmd);
logger.error("Somebody fed 'sig=" + request.getParameter("sig") + "' to this page, that's bogus");
content = new ErrorBox(page_title,"SIG ID not valid: " + request.getParameter("sig"),"top");
} // end catch if (cmd.equals("P"))
catch (DataException de) { // "P" = "Edit Profile"
{ // unable to pull SIG data out of the database if (!(sig.canModifyProfile()))
page_title = "Database Error"; { // no access - sorry, dude
logger.error("database error looking up SIGID " + request.getParameter("sig")); logger.error("tried to call up SIG profile screen without access...naughty naughty!");
content = new ErrorBox(page_title,"Database error accessing SIG: " + de.getMessage(),"top"); return new ErrorBox("Unauthorized","You do not have access to modify this SIG's profile.",on_error);
} // end catch } // end if
if (logger.isDebugEnabled() && (sig!=null)) // construct the edit profile dialog and load it up for use
logger.debug("SIGAdmin/doGet operating on SIG \"" + sig.getName() + "\" (" EditSIGProfileDialog dlg = makeEditSIGProfileDialog();
+ String.valueOf(sig.getSIGID()) + ")");
if (content==null) try
{ // now decide what to do based on the "cmd" parameter { // load the values for this dialog
String cmd = request.getParameter("cmd"); dlg.setupDialog(engine,sig);
if (cmd==null)
cmd = "???"; // something pretty much guaranteed not to be used
if (logger.isDebugEnabled()) } // end try
logger.debug("SIGAdmin/doGet command value = " + cmd); catch (DataException de)
{ // we could not load the values because of a data exception
logger.error("DB error loading SIG profile: " + de.getMessage(),de);
return new ErrorBox("Database Error","Database error retrieving profile: " + de.getMessage(),on_error);
if (cmd.equals("P")) } // end catch
{ // this is the profile editing screen catch (AccessError ae)
if (sig.canModifyProfile()) { // we don't have enough privilege
{ // construct the edit profile dialog and load it up for use logger.error("Access error loading SIG profile: " + ae.getMessage(),ae);
EditSIGProfileDialog dlg = makeEditSIGProfileDialog(); return new ErrorBox("Unauthorized","You do not have access to modify this SIG's profile.",on_error);
try } // end catch
{ // load the values for this dialog
dlg.setupDialog(getVeniceEngine(),sig);
// prepare for display return dlg; // display me!
page_title = dlg.getTitle();
content = dlg;
} // end try } // end if ("P" command)
catch (DataException de)
{ // we could not load the values because of a data exception
page_title = "Database Error";
logger.error("DB error loading SIG profile: " + de.getMessage(),de);
content = new ErrorBox(page_title,"Database error retrieving profile: " + de.getMessage(),
"sigadmin?sig=" + String.valueOf(sig.getSIGID()));
} // end catch if (cmd.equals("T"))
catch (AccessError ae) { // "T" = "Set Category"
{ // we don't have enough privilege if (!(sig.canModifyProfile()))
page_title = "Unauthorized"; { // no access - sorry man
logger.error("Access error loading SIG profile: " + ae.getMessage(),ae); logger.error("tried to call up SIG category set screen without access...naughty naughty!");
content = new ErrorBox(page_title,"You do not have access to modify this SIG's profile.", return new ErrorBox("Unauthorized","You do not have access to modify this SIG's profile.",on_error);
"sigadmin?sig=" + String.valueOf(sig.getSIGID()));
} // end catch } // end else
} // end if // did they actually send a "set" parameter?
else String p = request.getParameter("set");
{ // no access - sorry, dude if (!(StringUtil.isStringEmpty(p)))
page_title = "Unauthorized"; { // OK, we're setting the category ID...
logger.error("tried to call up SIG profile screen without access...naughty naughty!"); try
content = new ErrorBox(page_title,"You do not have access to modify this SIG's profile.", { // get the new category ID and set it
"sigadmin?sig=" + String.valueOf(sig.getSIGID())); int catid = Integer.parseInt(p);
if (!(engine.isValidCategoryID(catid)))
throw new NumberFormatException(); // dump the category if it's not valid
} // end else // change the category ID
sig.setCategoryID(catid);
} // end if (profile editing) } // end try
else if (cmd.equals("T")) catch (NumberFormatException nfe)
{ // this is the category set code! { // we got an invalid category value...
if (sig.canModifyProfile()) return new ErrorBox("Invalid Input","Invalid category ID passed to category browser.",on_error);
{ // did they actually send a "set" parameter?
String p = request.getParameter("set");
if (!(StringUtil.isStringEmpty(p)))
{ // OK, we're setting the category ID...
try
{ // get the new category ID and set it
int catid = Integer.parseInt(p);
if (!(getVeniceEngine().isValidCategoryID(catid)))
throw new NumberFormatException(); // dump the category if it's not valid
sig.setCategoryID(catid); } // end catch
catch (DataException de)
{ // unable to update the SIG properly
logger.error("DB error updating SIG: " + de.getMessage(),de);
return new ErrorBox("Database Error","Database error updating SIG: " + de.getMessage(),on_error);
// now that the category ID is set, go back to the admin menu } // end catch
String target = "sigadmin?sig=" + String.valueOf(sig.getSIGID()); catch (AccessError ae)
String url = response.encodeRedirectURL(rdat.getFullServletPath(target)); { // database access error - display an error box
response.sendRedirect(url); logger.error("Access error updating SIG: " + ae.getMessage(),ae);
return; return new ErrorBox("Access Error",ae.getMessage(),on_error);
} // end try } // end catch
catch (NumberFormatException nfe)
{ // we got an invalid category value...
page_title = "Invalid Input";
content = new ErrorBox(page_title,"Invalid category ID passed to category browser.",
"sigadmin?sig=" + String.valueOf(sig.getSIGID()));
} // end catch // now that it's set, go back to the admin menu
catch (DataException de) throw new RedirectResult(on_error);
{ // unable to update the SIG properly
page_title = "Database Error";
logger.error("DB error updating SIG: " + de.getMessage(),de);
content = new ErrorBox(page_title,"Database error updating SIG: " + de.getMessage(),
"sigadmin?sig=" + String.valueOf(sig.getSIGID()));
} // end catch } // end if (setting category ID)
catch (AccessError ae) else
{ // database access error - display an error box { // we're browsing - try and figure out what to display
page_title = "Access Error"; try
logger.error("Access error updating SIG: " + ae.getMessage(),ae); { // get the "go" parameter to see what the current category ID is
content = new ErrorBox(page_title,ae.getMessage(), p = request.getParameter("go");
"sigadmin?sig=" + String.valueOf(sig.getSIGID())); int curr_catid;
if (StringUtil.isStringEmpty(p))
} // end catch curr_catid = sig.getCategoryID();
} // end if (actually setting the category
else else
{ // we're browsing - try and figure out what to display curr_catid = Integer.parseInt(p);
try
{ // get the "go" parameter to see what the current category ID is
p = request.getParameter("go");
int curr_catid;
if (StringUtil.isStringEmpty(p))
curr_catid = sig.getCategoryID();
else
curr_catid = Integer.parseInt(p);
if (!(getVeniceEngine().isValidCategoryID(curr_catid))) if (!(engine.isValidCategoryID(curr_catid)))
throw new NumberFormatException(); // dump the category if it's not valid throw new NumberFormatException(); // dump the category if it's not valid
// create the browser panel and let it rip // create the browser panel and let it rip
content = new SIGCategoryBrowseData(user,sig,curr_catid); return new SIGCategoryBrowseData(user,sig,curr_catid);
page_title = "Set SIG Category";
} // end try } // end try
catch (NumberFormatException nfe) catch (NumberFormatException nfe)
{ // we got an invalid category value... { // we got an invalid category value...
page_title = "Invalid Input"; return new ErrorBox("Invalid Input","Invalid category ID passed to category browser.",on_error);
content = new ErrorBox(page_title,"Invalid category ID passed to category browser.",
"sigadmin?sig=" + String.valueOf(sig.getSIGID()));
} // end catch } // end catch
catch (DataException de) catch (DataException de)
{ // unable to get the categories properly { // unable to get the categories properly
page_title = "Database Error"; logger.error("DB error browsing categories: " + de.getMessage(),de);
logger.error("DB error browsing categories: " + de.getMessage(),de); return new ErrorBox("Database Error","Database error browsing categories: " + de.getMessage(),
content = new ErrorBox(page_title,"Database error browsing categories: " + de.getMessage(), on_error);
"sigadmin?sig=" + String.valueOf(sig.getSIGID()));
} // end catch } // end catch
} // end else (browsing through categories) } // end else
} // end if } // end if ("T" command)
else
{ // no access - sorry man
page_title = "Unauthorized";
logger.error("tried to call up SIG category set screen without access...naughty naughty!");
content = new ErrorBox(page_title,"You do not have access to modify this SIG's profile.",
"sigadmin?sig=" + String.valueOf(sig.getSIGID()));
} // end else // all unknown requests get turned into menu display requests
if (!(sig.canAdministerSIG()))
} // end else if (category selector) { // no access - sorry buddy
else // other request logger.error("tried to call up SIG admin menu without access...naughty naughty!");
{ // all unknown requests get turned into menu display requests return new ErrorBox("Access Error","You do not have access to administer this SIG.",on_error);
if (sig.canAdministerSIG())
{ // create a SIG administration menu
SIGAdminTop menu = makeSIGAdminTop();
menu.setSIG(sig);
content = menu;
page_title = "SIG Administration";
} // end if
else
{ // no access - sorry buddy
page_title = "Access Error";
logger.error("tried to call up SIG admin menu without access...naughty naughty!");
content = new ErrorBox(page_title,"You do not have access to administer this SIG.",
"sigprofile?sig=" + String.valueOf(sig.getSIGID()));
} // end else
} // end else (other request i.e. menu request)
} // end if } // end if
// else getting the SIG already caused problems
BaseJSPData basedat = new BaseJSPData(page_title,"sigadmin?" + request.getQueryString(),content); // create a SIG administration menu
basedat.transfer(getServletContext(),rdat); SIGAdminTop menu = makeSIGAdminTop();
menu.setSIG(sig);
return menu;
} // end doGet } // end doVeniceGet
public void doPost(HttpServletRequest request, HttpServletResponse response) protected VeniceContent doVenicePost(HttpServletRequest request, VeniceEngine engine,
throws ServletException, IOException UserContext user, RenderData rdat)
throws ServletException, IOException, VeniceServletResult
{ {
UserContext user = getUserContext(request); // get the SIG context
RenderData rdat = createRenderData(request,response); SIGContext sig = getSIGParameter(request,user,true,"top");
String page_title = null; changeMenuSIG(request,sig);
ContentRender content = null; String on_error = "sigadmin?sig=" + sig.getSIGID();
setMyLocation(request,on_error);
SIGContext sig = null; if (logger.isDebugEnabled())
try logger.debug("SIGAdmin/doPost operating on SIG \"" + sig.getName() + "\" (" + sig.getSIGID() + ")");
{ // first get the SIG context we're working with
int sigid = Integer.parseInt(request.getParameter("sig"));
sig = user.getSIGContext(sigid);
changeMenuSIG(request,sig);
} // end try // now decide what to do based on the "cmd" parameter
catch (NumberFormatException nfe) String cmd = getStandardCommandParam(request);
{ // an improperly formatted SIGID brought us down! if (logger.isDebugEnabled())
page_title = "Input Error"; logger.debug("SIGAdmin/doPost command value = " + cmd);
logger.error("Somebody fed 'sig=" + request.getParameter("sig") + "' to this page, that's bogus");
content = new ErrorBox(page_title,"SIG ID not valid: " + request.getParameter("sig"),"top");
} // end catch if (cmd.equals("P"))
catch (DataException de) { // "P" = "Edit Profile"
{ // unable to pull SIG data out of the database if (!(sig.canModifyProfile()))
page_title = "Database Error"; { // no access - sorry, dude
logger.error("database error looking up SIGID " + request.getParameter("sig")); logger.error("tried to call up SIG profile screen without access...naughty naughty!");
content = new ErrorBox(page_title,"Database error accessing SIG: " + de.getMessage(),"top"); return new ErrorBox("Unauthorized","You do not have access to modify this SIG's profile.",on_error);
} // end catch } // end if
if (logger.isDebugEnabled() && (sig!=null)) // construct the edit profile dialog and load it up for use
logger.debug("SIGAdmin/doPost operating on SIG \"" + sig.getName() + "\" (" EditSIGProfileDialog dlg = makeEditSIGProfileDialog();
+ String.valueOf(sig.getSIGID()) + ")"); dlg.setupDialogBasic(engine,sig);
if (content==null) if (dlg.isButtonClicked(request,"cancel"))
{ // now decide what to do based on the "cmd" parameter throw new RedirectResult(on_error); // go back - they canceled out
String cmd = request.getParameter("cmd");
if (cmd==null)
cmd = "???"; // something pretty much guaranteed not to be used
if (logger.isDebugEnabled()) if (dlg.isButtonClicked(request,"update"))
logger.debug("SIGAdmin/doPost command value = " + cmd); { // begin updating the SIG's contents
dlg.loadValues(request); // do value loading now
if (cmd.equals("P")) try
{ // we just finished editing the profile... { // attempt to change the SIG profile now...
if (sig.canModifyProfile()) dlg.doDialog(sig);
{ // construct the edit profile dialog and load it up for use
EditSIGProfileDialog dlg = makeEditSIGProfileDialog();
dlg.setupDialogBasic(getVeniceEngine(),sig);
if (dlg.isButtonClicked(request,"cancel")) // now jump back to the main menu
{ // go back to our desired location clearMenu(request);
String target = "sigadmin?sig=" + String.valueOf(sig.getSIGID()); throw new RedirectResult(on_error);
String url = response.encodeRedirectURL(rdat.getFullServletPath(target));
response.sendRedirect(url);
return;
} // end if ("cancel" button clicked) } // end try
catch (ValidationException ve)
{ // simple validation exception
if (logger.isDebugEnabled())
logger.debug("validation failure: " + ve.getMessage());
dlg.resetOnError(sig,ve.getMessage() + " Please try again.");
if (dlg.isButtonClicked(request,"update")) } // end catch
{ // begin updating the SIG's contents catch (DataException de)
dlg.loadValues(request); // do value loading now { // database error updating the SIG values
logger.error("DB error updating SIG: " + de.getMessage(),de);
return new ErrorBox("Database Error","Database error updating SIG: " + de.getMessage(),on_error);
try } // end catch
{ // attempt to change the SIG profile now... catch (AccessError ae)
dlg.doDialog(sig); { // access error changing the SIG values
logger.error("Access error updating SIG: " + ae.getMessage(),ae);
return new ErrorBox("Access Error",ae.getMessage(),on_error);
// go back to the Admin menu on success } // end catch
clearMenu(request); // menu title may have been invalidated
String target = "sigadmin?sig=" + String.valueOf(sig.getSIGID());
String url = response.encodeRedirectURL(rdat.getFullServletPath(target));
response.sendRedirect(url);
return;
} // end try return dlg;
catch (ValidationException ve)
{ // simple validation exception
if (logger.isDebugEnabled())
logger.debug("validation failure: " + ve.getMessage());
dlg.resetOnError(sig,ve.getMessage() + " Please try again.");
page_title = dlg.getTitle();
content = dlg;
} // end catch } // end if ("update" pressed)
catch (DataException de)
{ // database error updating the SIG values
page_title = "Database Error";
logger.error("DB error updating SIG: " + de.getMessage(),de);
content = new ErrorBox(page_title,"Database error updating SIG: " + de.getMessage(),
"sigadmin?sig=" + String.valueOf(sig.getSIGID()));
} // end catch // what the hell was that button?
catch (AccessError ae) logger.error("no known button click on SIGAdmin.doPost, cmd=P");
{ // access error changing the SIG values return new ErrorBox("Internal Error","Unknown command button pressed",on_error);
page_title = "Access Error";
logger.error("Access error updating SIG: " + ae.getMessage(),ae);
content = new ErrorBox(page_title,ae.getMessage(),
"sigadmin?sig=" + String.valueOf(sig.getSIGID()));
} // end catch } // end if ("P" command)
} // end if ("update" button pressed); // on unknown command, redirect to the GET function
else return doVeniceGet(request,engine,user,rdat);
{ // what the hell was that button?
page_title = "Internal Error";
logger.error("no known button click on SIGAdmin.doPost, cmd=P");
content = new ErrorBox(page_title,"Unknown command button pressed",
"sigadmin?sig=" + String.valueOf(sig.getSIGID()));
} // end else } // end doVenicePost
} // end if
else
{ // no access - sorry, dude
page_title = "Unauthorized";
logger.error("tried to edit SIG profile without access...naughty naughty!");
content = new ErrorBox(page_title,"You do not have access to modify this SIG's profile.",
"sigadmin?sig=" + String.valueOf(sig.getSIGID()));
} // end else
} // end if (editing profile)
else // unknown command
{ // just use that to redirect to the GET url
String target = "sigadmin?sig=" + String.valueOf(sig.getSIGID()) + "&cmd=" + cmd;
String url = response.encodeRedirectURL(rdat.getFullServletPath(target));
response.sendRedirect(url);
return;
} // end else (unknown command)
} // end if
// else getting the SIG already caused problems
BaseJSPData basedat = new BaseJSPData(page_title,"sigadmin?sig=" + String.valueOf(sig.getSIGID()),content);
basedat.transfer(getServletContext(),rdat);
} // end doPost
} // end class SIGAdmin } // end class SIGAdmin

View File

@ -38,45 +38,42 @@ public class SIGFrontEnd extends VeniceServlet
} // end getServletInfo } // end getServletInfo
public void doGet(HttpServletRequest request, HttpServletResponse response) /*--------------------------------------------------------------------------------
throws ServletException, IOException * Overrides from class VeniceServlet
*--------------------------------------------------------------------------------
*/
protected VeniceContent doVeniceGet(HttpServletRequest request, VeniceEngine engine,
UserContext user, RenderData rdat)
throws ServletException, IOException, VeniceServletResult
{ {
UserContext user = getUserContext(request); // get the SIG alias name from the request path info
RenderData rdat = createRenderData(request,response); String sigalias = request.getPathInfo().substring(1);
String page_title = null;
ContentRender content = null;
try try
{ // get the SIG alias name from the request path info { // get the SIG's context from the alias name
String sigalias = request.getPathInfo().substring(1);
// get the SIG's context from the alias name
SIGContext sig = user.getSIGContext(sigalias); SIGContext sig = user.getSIGContext(sigalias);
// get the default servlet from the SIG context // get the default servlet from the SIG context
String def_applet = sig.getDefaultApplet(); String def_servlet = sig.getDefaultApplet();
if (def_applet==null) if (def_servlet==null)
throw new DataException("unable to get SIG default servlet"); { // return the default servlet
changeMenuTop(request);
return new ErrorBox("Internal Error","unable to get SIG default servlet","top");
// redirect to the appropriate top-level page! } // end if
String url = response.encodeRedirectURL(rdat.getFullServletPath(def_applet));
response.sendRedirect(url); // and go there
return; throw new RedirectResult(def_servlet);
} // end try } // end try
catch (DataException de) catch (DataException de)
{ // set up to display an ErrorBox { // set up to display an ErrorBox
page_title = "Database Error"; changeMenuTop(request);
content = new ErrorBox(page_title,"Database error finding SIG: " + de.getMessage(),"top"); return new ErrorBox("Database Error","Database error finding SIG: " + de.getMessage(),"top");
} // end catch } // end catch
changeMenuTop(request); } // end doVeniceGet
// this code is only used if we have to display an ErrorBox
BaseJSPData basedat = new BaseJSPData(page_title,"sig" + request.getPathInfo(),content);
basedat.transfer(getServletContext(),rdat);
} // end doGet
} // end class SIGFrontEnd } // end class SIGFrontEnd

View File

@ -7,7 +7,7 @@
* WARRANTY OF ANY KIND, either express or implied. See the License for the specific * WARRANTY OF ANY KIND, either express or implied. See the License for the specific
* language governing rights and limitations under the License. * language governing rights and limitations under the License.
* *
* The Original Code is the Venice Web Community System. * The Original Code is the Venice Web Communities System.
* *
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, * 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 * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
@ -42,32 +42,6 @@ public class SIGOperations extends VeniceServlet
*-------------------------------------------------------------------------------- *--------------------------------------------------------------------------------
*/ */
private static SIGContext getSIGParameter(ServletRequest request, UserContext user)
throws ValidationException, DataException
{
String str = request.getParameter("sig");
if (str==null)
{ // no SIG parameter - bail out now!
logger.error("SIG parameter not specified!");
throw new ValidationException("No SIG specified.");
} // end if
try
{ // turn the string into a SIGID, and thence to a SIGContext
int sigid = Integer.parseInt(str);
return user.getSIGContext(sigid);
} // end try
catch (NumberFormatException nfe)
{ // error in Integer.parseInt
logger.error("Cannot convert SIG parameter '" + str + "'!");
throw new ValidationException("Invalid SIG parameter.");
} // end catch
} // end getSIGParameter
private JoinKeyDialog makeJoinKeyDialog() private JoinKeyDialog makeJoinKeyDialog()
{ {
final String desired_name = "JoinKeyDialog"; final String desired_name = "JoinKeyDialog";
@ -115,342 +89,239 @@ public class SIGOperations extends VeniceServlet
} // end getServletInfo } // end getServletInfo
public void doGet(HttpServletRequest request, HttpServletResponse response) /*--------------------------------------------------------------------------------
throws ServletException, IOException * Overrides from class VeniceServlet
{ *--------------------------------------------------------------------------------
UserContext user = getUserContext(request); */
RenderData rdat = createRenderData(request,response);
String page_title = null;
Object content = null;
protected VeniceContent doVeniceGet(HttpServletRequest request, VeniceEngine engine,
UserContext user, RenderData rdat)
throws ServletException, IOException, VeniceServletResult
{
// get the command we want to use // get the command we want to use
String cmd = request.getParameter("cmd"); String cmd = getStandardCommandParam(request);
if (cmd==null) setMyLocation(request,"sigops?" + request.getQueryString());
cmd = "???";
if (cmd.equals("J")) if (cmd.equals("J"))
{ // "J" = "Join" (requires SIG parameter) { // "J" = "Join" (requires SIG parameter)
try SIGContext sig = getSIGParameter(request,user,true,"top");
{ // get the SIG parameter first!
SIGContext sig = getSIGParameter(request,user);
if (sig.canJoin()) if (!(sig.canJoin())) // not permitted to join!
{ // OK, we can join the SIG, now, is it public or private? return new ErrorBox("SIG Error","You are not permitted to join this SIG.","top");
if (sig.isPublicSIG())
{ // attempt to join right now! (no join key required)
sig.join(null);
// success! display the "welcome" page if (sig.isPublicSIG())
content = new SIGWelcome(sig); { // attempt to join right now! (no join key required)
page_title = "Welcome to " + sig.getName(); try
clearMenu(request); // force the clear to regen the menus { // call down to join the SIG
changeMenuSIG(request,sig); sig.join(null);
} // end if (public SIG) // success! display the "welcome" page
else clearMenu(request); // force the clear to regen the menus
{ // we need to prompt them for the join key... changeMenuSIG(request,sig);
JoinKeyDialog dlg = makeJoinKeyDialog(); return new SIGWelcome(sig);
dlg.setupDialog(sig);
content = dlg;
page_title = "Join SIG";
changeMenuSIG(request,sig);
} // end else (private SIG) } // end try
catch (AccessError ae)
{ // access error
return new ErrorBox("Access Error","Unable to join SIG: " + ae.getMessage(),"top");
} // end if (allowed to join the SIG) } // end catch
else catch (DataException de)
{ // throw an error { // data exception doing something
page_title = "Error"; return new ErrorBox("Database Error","Database error joining SIG: " + de.getMessage(),"top");
content = new ErrorBox("SIG Error","You are not permitted to join this SIG.","top");
} // end else } // end catch
} // end try } // end if (public SIG)
catch (AccessError ae) else
{ // access error { // we need to prompt them for the join key....
page_title = "Access Error"; JoinKeyDialog dlg = makeJoinKeyDialog();
content = new ErrorBox(page_title,"Unable to join SIG: " + ae.getMessage(),"top"); dlg.setupDialog(sig);
changeMenuSIG(request,sig);
return dlg;
} // end catch } // end else (private SIG)
catch (DataException de)
{ // data exception doing something
page_title = "Database Error";
content = new ErrorBox(page_title,"Database error joining SIG: " + de.getMessage(),"top");
} // end catch
catch (ValidationException ve)
{ // validation error - wrong parameters, likely
page_title = "Error";
content = new ErrorBox(null,ve.getMessage(),"top");
} // end catch
} // end if ("J" command) } // end if ("J" command)
else if (cmd.equals("U"))
if (cmd.equals("U"))
{ // "U" = "Unjoin (requires SIG parameter) { // "U" = "Unjoin (requires SIG parameter)
try SIGContext sig = getSIGParameter(request,user,true,"top");
{ // get the SIG parameter first!
SIGContext sig = getSIGParameter(request,user);
if (sig.canUnjoin()) if (!(sig.canUnjoin()))
{ // OK, let's test for a confirmation... return new ErrorBox("SIG Error","You cannot unjoin this SIG.","top");
if (ConfirmBox.isConfirmed(request,UNJOIN_CONFIRM_ATTR,UNJOIN_CONFIRM_PARAM))
{ // OK, if you say so, let's unjoin!
sig.unjoin();
// after which, let's just go back to top // OK, let's test for a confirmation...
clearMenu(request); // force the clear to regen the menus if (ConfirmBox.isConfirmed(request,UNJOIN_CONFIRM_ATTR,UNJOIN_CONFIRM_PARAM))
rdat.redirectTo("top"); { // OK, if you say so, let's unjoin!
return; try
{ // do the unjoin now...
sig.unjoin();
} // end if } // end try
else catch (AccessError ae)
{ // not a proper confirmation - better display one { // access error
String message = "Are you sure you want to unjoin the '" + sig.getName() + "' SIG?"; return new ErrorBox("Access Error","Unable to unjoin SIG: " + ae.getMessage(),"top");
String confirm_url = "sigops?cmd=U&sig=" + String.valueOf(sig.getSIGID());
String deny_url = "sig/" + sig.getAlias();
page_title = "Unjoining SIG";
content = new ConfirmBox(request,UNJOIN_CONFIRM_ATTR,UNJOIN_CONFIRM_PARAM,page_title,
message,confirm_url,deny_url);
} // end else } // end catch
catch (DataException de)
{ // data exception doing something
return new ErrorBox("Database Error","Database error unjoining SIG: " + de.getMessage(),"top");
} // end if } // end catch
else
{ // throw an error
page_title = "Error";
content = new ErrorBox("SIG Error","You cannot unjoin this SIG.","top");
} // end else // after which, redirect back to the top
clearMenu(request);
} // end try throw new RedirectResult("top");
catch (AccessError ae)
{ // access error
page_title = "Access Error";
content = new ErrorBox(page_title,"Unable to unjoin SIG: " + ae.getMessage(),"top");
} // end catch
catch (DataException de)
{ // data exception doing something
page_title = "Database Error";
content = new ErrorBox(page_title,"Database error unjoining SIG: " + de.getMessage(),"top");
} // end catch
catch (ValidationException ve)
{ // validation error - wrong parameters, likely
page_title = "Error";
content = new ErrorBox(null,ve.getMessage(),"top");
} // end catch
} // end else if ("U" command)
else if (cmd.equals("C"))
{ // "C" - Create SIG (no parameters)
if (user.canCreateSIG())
{ // present the "Create New SIG" dialog
CreateSIGDialog dlg = makeCreateSIGDialog();
dlg.setupDialog(getVeniceEngine());
// prepare for display
page_title = dlg.getTitle();
content = dlg;
changeMenuTop(request);
} // end if } // end if
else else
{ // the user isn't permitted to make new SIGs... { // not a proper confirmation - display the confirm box
page_title = "Error"; String message = "Are you sure you want to unjoin the '" + sig.getName() + "' SIG?";
content = new ErrorBox("SIG Error","You are not permitted to create SIGs.","top"); return new ConfirmBox(request,UNJOIN_CONFIRM_ATTR,UNJOIN_CONFIRM_PARAM,"Unjoining SIG",
message,"sigops?cmd=U&sig=" + sig.getSIGID(),"sig/" + sig.getAlias());
} // end else } // end else
} // end else if ("C" command) } // end if ("U" command)
else
{ // this is an error!
page_title = "Internal Error";
logger.error("invalid command to SIGOperations.doGet: " + cmd);
content = new ErrorBox(page_title,"Invalid command to SIGOperations.doGet","top");
} // end else if (cmd.equals("C"))
{ // "C" - Create SIG (no parameters)
if (!(user.canCreateSIG()))
return new ErrorBox("SIG Error","You are not permitted to create SIGs.","top");
BaseJSPData basedat = new BaseJSPData(page_title,"sigops?" + request.getQueryString(),content); // present the "Create New SIG" dialog
basedat.transfer(getServletContext(),rdat); CreateSIGDialog dlg = makeCreateSIGDialog();
dlg.setupDialog(engine);
changeMenuTop(request);
return dlg;
} // end doGet } // end if ("C" command)
public void doPost(HttpServletRequest request, HttpServletResponse response) // this is an error!
throws ServletException, IOException logger.error("invalid command to SIGOperations.doGet: " + cmd);
return new ErrorBox("Internal Error","Invalid command to SIGOperations.doGet","top");
} // end doVeniceGet
protected VeniceContent doVenicePost(HttpServletRequest request, VeniceEngine engine,
UserContext user, RenderData rdat)
throws ServletException, IOException, VeniceServletResult
{ {
UserContext user = getUserContext(request);
RenderData rdat = createRenderData(request,response);
String page_title = null;
Object content = null;
// get the command we want to use // get the command we want to use
String cmd = request.getParameter("cmd"); String cmd = getStandardCommandParam(request);
if (cmd==null) setMyLocation(request,"sigops?cmd=" + cmd);
cmd = "???";
if (cmd.equals("J")) if (cmd.equals("J"))
{ // "J" = Join SIG (requires SIG parameter) { // "J" = Join SIG (requires SIG parameter)
try SIGContext sig = getSIGParameter(request,user,true,"top");
{ // get the SIG we're talking about JoinKeyDialog dlg = makeJoinKeyDialog();
SIGContext sig = getSIGParameter(request,user);
JoinKeyDialog dlg = makeJoinKeyDialog();
if (dlg.isButtonClicked(request,"cancel")) if (dlg.isButtonClicked(request,"cancel")) // cancel - go back to SIG opening page
{ // canceled join - return to SIG opening page throw new RedirectResult("sig/" + sig.getAlias());
rdat.redirectTo("sig/" + sig.getAlias());
return;
} // end if if (!(sig.canJoin())) // not permitted to join!
return new ErrorBox("SIG Error","You are not permitted to join this SIG.","top");
if (dlg.isButtonClicked(request,"join")) if (dlg.isButtonClicked(request,"join"))
{ // they clicked the "join" button { // OK, go join the SIG
if (sig.canJoin()) dlg.loadValues(request); // load the dialog
{ // we are permitted to join this SIG...
dlg.loadValues(request); // load the dialog
try try
{ // attempt to join the SIG! { // attempt to join the SIG!
dlg.doDialog(sig); dlg.doDialog(sig);
// success! display the "welcome" page // success! display the "welcome" page
content = new SIGWelcome(sig); clearMenu(request); // force the clear to regen the menus
page_title = "Welcome to " + sig.getName(); changeMenuSIG(request,sig);
clearMenu(request); // force the clear to regen the menus return new SIGWelcome(sig);
changeMenuSIG(request,sig);
} // end try } // end try
catch (ValidationException ve2) catch (ValidationException ve)
{ // here, a validation exception causes us to recycle and retry { // here, a validation exception causes us to recycle and retry
dlg.resetOnError(ve2.getMessage() + " Please try again."); dlg.resetOnError(ve.getMessage() + " Please try again.");
content = dlg; changeMenuSIG(request,sig);
page_title = "Join SIG";
changeMenuSIG(request,sig);
} // end catch } // end catch
catch (AccessError ae) catch (AccessError ae)
{ // this is probably a bogus key - let them retry { // this is probably a bogus key - let them retry
dlg.resetOnError(ae.getMessage() + " Please try again."); dlg.resetOnError(ae.getMessage() + " Please try again.");
content = dlg; changeMenuSIG(request,sig);
page_title = "Join SIG";
changeMenuSIG(request,sig);
} // end catch } // end catch
catch (DataException de)
{ // database error joining something
return new ErrorBox("Database Error","Database error joining SIG: " + de.getMessage(),"top");
} // end if } // end catch
else
{ // throw an error
page_title = "Error";
content = new ErrorBox("SIG Error","You are not permitted to join this SIG.","top");
} // end else return dlg; // recycle and try aagin
} // end if ("join" button clicked) } // end if ("join" clicked)
else
{ // error - don't know what button was clicked
page_title = "Internal Error";
logger.error("no known button click on SIGOperations.doPost, cmd=J");
content = new ErrorBox(page_title,"Unknown command button pressed","top");
} // end else // error - don't know what button was clicked
logger.error("no known button click on SIGOperations.doPost, cmd=J");
} // end try return new ErrorBox("Internal Error","Unknown command button pressed","top");
catch (DataException de)
{ // database error joining something
page_title = "Database Error";
content = new ErrorBox(page_title,"Database error joining SIG: " + de.getMessage(),"top");
} // end catch
catch (ValidationException ve)
{ // validation error - bogus parameter, I think
page_title = "Error";
content = new ErrorBox(null,ve.getMessage(),"top");
} // end catch
} // end if ("J" command) } // end if ("J" command)
else if (cmd.equals("C"))
if (cmd.equals("C"))
{ // "C" = Create New SIG { // "C" = Create New SIG
if (user.canCreateSIG()) if (!(user.canCreateSIG()))
{ // load the "Create SIG" dialog return new ErrorBox("SIG Error","You are not permitted to create SIGs.","top");
CreateSIGDialog dlg = makeCreateSIGDialog();
dlg.setupDialog(getVeniceEngine());
if (dlg.isButtonClicked(request,"cancel")) // load the "Create SIG" dialog
{ // canceled create - return to top page CreateSIGDialog dlg = makeCreateSIGDialog();
rdat.redirectTo("top"); dlg.setupDialog(engine);
return;
} // end if if (dlg.isButtonClicked(request,"cancel")) // cancel - go back to top
throw new RedirectResult("top");
if (dlg.isButtonClicked(request,"create")) if (dlg.isButtonClicked(request,"create"))
{ // OK, they actually want to create the new SIG... { // OK, they actually want to create the new SIG...
dlg.loadValues(request); // load the form data dlg.loadValues(request); // load the form data
try try
{ // attempt to create the SIG! { // attempt to create the SIG!
SIGContext sig = dlg.doDialog(user); SIGContext sig = dlg.doDialog(user);
// created successfully - display a "new SIG welcome" page // created successfully - display a "new SIG welcome" page
content = new NewSIGWelcome(sig); changeMenuSIG(request,sig); // display menus for the first time!
page_title = "SIG Created"; return new NewSIGWelcome(sig);
changeMenuSIG(request,sig); // display menus for the first time!
} // end try } // end try
catch (ValidationException ve2) catch (ValidationException ve)
{ // here, a validation exception causes us to recycle and retry { // here, a validation exception causes us to recycle and retry
dlg.resetOnError(ve2.getMessage() + " Please try again."); dlg.resetOnError(ve.getMessage() + " Please try again.");
content = dlg; changeMenuTop(request);
page_title = dlg.getTitle();
changeMenuTop(request);
} // end catch } // end catch
catch (AccessError ae) catch (AccessError ae)
{ // this is probably a bogus key - let them retry { // this is probably a bogus key - let them retry
dlg.resetOnError(ae.getMessage() + " Please try again."); dlg.resetOnError(ae.getMessage() + " Please try again.");
content = dlg; changeMenuTop(request);
page_title = dlg.getTitle();
changeMenuTop(request);
} // end catch } // end catch
catch (DataException de) catch (DataException de)
{ // database error doing something { // database error doing something
page_title = "Database Error"; return new ErrorBox("Database Error","Database error creating SIG: " + de.getMessage(),"top");
content = new ErrorBox(page_title,"Database error creating SIG: " + de.getMessage(),"top");
} // end catch } // end catch
} // end if return dlg; // put the dialog back up
else
{ // error - don't know what button was clicked
page_title = "Internal Error";
logger.error("no known button click on SIGOperations.doPost, cmd=C");
content = new ErrorBox(page_title,"Unknown command button pressed","top");
} // end else } // end if ("create" pressed)
} // end if // error - don't know what button was clicked
else logger.error("no known button click on SIGOperations.doPost, cmd=C");
{ // the user isn't permitted to make new SIGs... return new ErrorBox("Internal Error","Unknown command button pressed","top");
page_title = "Error";
content = new ErrorBox("SIG Error","You are not permitted to create SIGs.","top");
} // end else } // end if ("C" command)
} // end else if ("C" command) // this is an error!
else logger.error("invalid command to SIGOperations.doPost: " + cmd);
{ // this is an error! return new ErrorBox("Internal Error","Invalid command to SIGOperations.doPost","top");
page_title = "Internal Error";
logger.error("invalid command to SIGOperations.doPost: " + cmd);
content = new ErrorBox(page_title,"Invalid command to SIGOperations.doPost","top");
} // end else } // end doVenicePost
BaseJSPData basedat = new BaseJSPData(page_title,"top",content);
basedat.transfer(getServletContext(),rdat);
} // end doPost
} // end class SIGOperations } // end class SIGOperations

View File

@ -7,7 +7,7 @@
* WARRANTY OF ANY KIND, either express or implied. See the License for the specific * WARRANTY OF ANY KIND, either express or implied. See the License for the specific
* language governing rights and limitations under the License. * language governing rights and limitations under the License.
* *
* The Original Code is the Venice Web Community System. * The Original Code is the Venice Web Communities System.
* *
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, * 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 * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
@ -25,6 +25,11 @@ import com.silverwrist.venice.servlets.format.*;
public class SIGProfile extends VeniceServlet public class SIGProfile extends VeniceServlet
{ {
/*--------------------------------------------------------------------------------
* Overrides from class HttpServlet
*--------------------------------------------------------------------------------
*/
public String getServletInfo() public String getServletInfo()
{ {
String rc = "SIGProfile servlet - Displays the profile of a SIG\n" String rc = "SIGProfile servlet - Displays the profile of a SIG\n"
@ -33,43 +38,31 @@ public class SIGProfile extends VeniceServlet
} // end getServletInfo } // end getServletInfo
public void doGet(HttpServletRequest request, HttpServletResponse response) /*--------------------------------------------------------------------------------
throws ServletException, IOException * Overrides from class VeniceServlet
*--------------------------------------------------------------------------------
*/
protected VeniceContent doVeniceGet(HttpServletRequest request, VeniceEngine engine,
UserContext user, RenderData rdat)
throws ServletException, IOException, VeniceServletResult
{ {
UserContext user = getUserContext(request); // get the SIG
RenderData rdat = createRenderData(request,response); SIGContext sig = getSIGParameter(request,user,true,"top");
String page_title = null; setMyLocation(request,"sigprofile?sig=" + sig.getSIGID());
Object content = null;
try try
{ // get the ID of the SIG we want to see the profile of { // create the profile display
int sigid = Integer.parseInt(request.getParameter("sig"));
// get the SIG context for the user
SIGContext sig = user.getSIGContext(sigid);
// create the profile display
content = new SIGProfileData(getVeniceEngine(),user,sig);
page_title = "SIG Profile: " + sig.getName();
changeMenuSIG(request,sig); changeMenuSIG(request,sig);
return new SIGProfileData(engine,user,sig);
} // end try } // end try
catch (NumberFormatException nfe)
{ // something as simple as an improper SIGID brought us down?!?!?
page_title = "Input Error";
content = new ErrorBox(page_title,"SIG ID not valid: " + request.getParameter("sig"),"top");
} // end catch
catch (DataException de) catch (DataException de)
{ // in this case, we had database trouble { // in this case, we had database trouble
page_title = "Database Error"; return new ErrorBox("Database Error","Database error accessing SIG: " + de.getMessage(),"top");
content = new ErrorBox(page_title,"Database error accessing SIG: " + de.getMessage(),"top");
} // end catch } // end catch
BaseJSPData basedat = new BaseJSPData(page_title,"sigprofile?" + request.getQueryString(),content); } // end doVeniceGet
basedat.transfer(getServletContext(),rdat);
} // end doGet
} // end class SIGProfile } // end class SIGProfile

View File

@ -0,0 +1,61 @@
/*
* 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) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
package com.silverwrist.venice.servlets;
import java.io.IOException;
import java.io.InputStream;
import com.silverwrist.venice.servlets.format.RenderData;
public class SendFileResult extends ExecuteResult
{
/*--------------------------------------------------------------------------------
* Attributes
*--------------------------------------------------------------------------------
*/
private String type;
private String filename;
private int length;
private InputStream data;
/*--------------------------------------------------------------------------------
* Constructor
*--------------------------------------------------------------------------------
*/
public SendFileResult(String type, String filename, int length, InputStream data)
{
this.type = type;
this.filename = filename;
this.length = length;
this.data = data;
} // end constructor
/*--------------------------------------------------------------------------------
* Overrides from class ExecuteResult
*--------------------------------------------------------------------------------
*/
public void execute(RenderData rdat) throws IOException
{
rdat.sendBinaryData(type,filename,length,data);
} // end execute
} // end class SendFileResult

View File

@ -7,7 +7,7 @@
* WARRANTY OF ANY KIND, either express or implied. See the License for the specific * WARRANTY OF ANY KIND, either express or implied. See the License for the specific
* language governing rights and limitations under the License. * language governing rights and limitations under the License.
* *
* The Original Code is the Venice Web Community System. * The Original Code is the Venice Web Communities System.
* *
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, * 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 * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
@ -27,6 +27,11 @@ import com.silverwrist.venice.servlets.format.*;
public class Top extends VeniceServlet public class Top extends VeniceServlet
{ {
/*--------------------------------------------------------------------------------
* Overrides from class HttpServlet
*--------------------------------------------------------------------------------
*/
public void init(ServletConfig config) throws ServletException public void init(ServletConfig config) throws ServletException
{ {
super.init(config); // required before we do anything else super.init(config); // required before we do anything else
@ -36,7 +41,7 @@ public class Top extends VeniceServlet
DOMConfigurator.configure(ctxt.getInitParameter("logging.config")); DOMConfigurator.configure(ctxt.getInitParameter("logging.config"));
// Initialize the Venice engine. // Initialize the Venice engine.
VeniceEngine engine = getVeniceEngine(ctxt); VeniceEngine engine = Variables.getVeniceEngine(ctxt);
// Initialize the Venice rendering system. // Initialize the Venice rendering system.
RenderConfig.getRenderConfig(ctxt); RenderConfig.getRenderConfig(ctxt);
@ -52,36 +57,34 @@ public class Top extends VeniceServlet
public String getServletInfo() public String getServletInfo()
{ {
String rc = "Top applet - Displays the Venice front page\n" String rc = "Top applet - Displays the Venice front page\n"
+ "Part of the Venice Web conferencing system\n"; + "Part of the Venice Web Communities System\n";
return rc; return rc;
} // end getServletInfo } // end getServletInfo
public void doGet(HttpServletRequest request, HttpServletResponse response) /*--------------------------------------------------------------------------------
throws ServletException, IOException * Overrides from class VeniceServlet
*--------------------------------------------------------------------------------
*/
protected VeniceContent doVeniceGet(HttpServletRequest request, VeniceEngine engine,
UserContext user, RenderData rdat)
throws ServletException, IOException, VeniceServletResult
{ {
UserContext user = getUserContext(request); changeMenuTop(request);
RenderData rdat = createRenderData(request,response); setMyLocation(request,"top");
ContentRender content = null;
String page_title = "My Front Page";
try try
{ // attempt to get the user content { // attempt to get the user content
content = new TopContent(user); return new TopContent(user);
} // end try } // end try
catch (DataException e) catch (DataException de)
{ // there was a database error, whoops! { // there was a database error, whoops!
page_title = "Database Error"; return new ErrorBox("Database Error","Error loading front page: " + de.getMessage(),null);
content = new ErrorBox(page_title,"Error loading front page: " + e.getMessage(),null);
} // end catch } // end catch
changeMenuTop(request); } // end doVeniceGet
BaseJSPData basedat = new BaseJSPData(page_title,"top",content);
basedat.transfer(getServletContext(),rdat);
} // end doGet
} // end class Top } // end class Top

View File

@ -38,89 +38,6 @@ public class TopicOperations extends VeniceServlet
private static Category logger = Category.getInstance(TopicOperations.class.getName()); private static Category logger = Category.getInstance(TopicOperations.class.getName());
/*--------------------------------------------------------------------------------
* Internal functions
*--------------------------------------------------------------------------------
*/
private static SIGContext getSIGParameter(ServletRequest request, UserContext user)
throws ValidationException, DataException
{
String str = request.getParameter("sig");
if (str==null)
{ // no SIG parameter - bail out now!
logger.error("SIG parameter not specified!");
throw new ValidationException("No SIG specified.");
} // end if
try
{ // turn the string into a SIGID, and thence to a SIGContext
int sigid = Integer.parseInt(str);
return user.getSIGContext(sigid);
} // end try
catch (NumberFormatException nfe)
{ // error in Integer.parseInt
logger.error("Cannot convert SIG parameter '" + str + "'!");
throw new ValidationException("Invalid SIG parameter.");
} // end catch
} // end getSIGParameter
private static ConferenceContext getConferenceParameter(ServletRequest request, SIGContext sig)
throws ValidationException, DataException, AccessError
{
String str = request.getParameter("conf");
if (str==null)
{ // no conference parameter - bail out now!
logger.error("Conference parameter not specified!");
throw new ValidationException("No conference specified.");
} // end if
try
{ // turn the string into a ConfID, and thence to a ConferenceContext
int confid = Integer.parseInt(str);
return sig.getConferenceContext(confid);
} // end try
catch (NumberFormatException nfe)
{ // error in Integer.parseInt
logger.error("Cannot convert conference parameter '" + str + "'!");
throw new ValidationException("Invalid conference parameter.");
} // end catch
} // end getConferenceParameter
private static TopicContext getTopicParameter(ServletRequest request, ConferenceContext conf)
throws ValidationException, DataException, AccessError
{
String str = request.getParameter("top");
if (StringUtil.isStringEmpty(str))
{ // no topic parameter - bail out now!
logger.error("Topic parameter not specified!");
throw new ValidationException("No topic specified.");
} // end if
try
{ // turn the string into a TopicID, and thence to a TopicContext
short topicid = Short.parseShort(str);
return conf.getTopic(topicid);
} // end try
catch (NumberFormatException nfe)
{ // error in Integer.parseInt
logger.error("Cannot convert topic parameter '" + str + "'!");
throw new ValidationException("Invalid topic parameter.");
} // end catch
} // end getTopicParameter
/*-------------------------------------------------------------------------------- /*--------------------------------------------------------------------------------
* Overrides from class HttpServlet * Overrides from class HttpServlet
*-------------------------------------------------------------------------------- *--------------------------------------------------------------------------------
@ -134,224 +51,142 @@ public class TopicOperations extends VeniceServlet
} // end getServletInfo } // end getServletInfo
public void doGet(HttpServletRequest request, HttpServletResponse response) /*--------------------------------------------------------------------------------
throws ServletException, IOException * Overrides from class VeniceServlet
{ *--------------------------------------------------------------------------------
UserContext user = getUserContext(request); */
RenderData rdat = createRenderData(request,response);
String location = "top";
String locator = null;
String page_title = null;
Object content = null;
SIGContext sig = null; // SIG context
ConferenceContext conf = null; // conference context
TopicContext topic = null; // topic context
try protected VeniceContent doVeniceGet(HttpServletRequest request, VeniceEngine engine,
{ // this outer try is to catch ValidationException UserContext user, RenderData rdat)
throws ServletException, IOException, VeniceServletResult
{
// get the SIG
SIGContext sig = getSIGParameter(request,user,true,"top");
changeMenuSIG(request,sig);
String locator = "sig=" + sig.getSIGID();
String location = "sigprofile?" + locator;
// get the conference
ConferenceContext conf = getConferenceParameter(request,sig,true,location);
locator += "&conf=" + conf.getConfID();
location = "confdisp?" + locator;
// get the topic
TopicContext topic = getTopicParameter(request,conf,true,location);
locator += "&top=" + topic.getTopicNumber();
location = "confdisp?" + locator;
// figure out what command we want to perform...
String cmd = getStandardCommandParam(request);
if (cmd.equals("HY") || cmd.equals("HN"))
{ // we want to set the hide status of the topic
try try
{ // all commands require a SIG parameter { // call down to set the topic!
sig = getSIGParameter(request,user); topic.setHidden(cmd.equals("HY"));
changeMenuSIG(request,sig);
if (logger.isDebugEnabled())
logger.debug("found SIG #" + String.valueOf(sig.getSIGID()));
locator = "sig=" + String.valueOf(sig.getSIGID());
location = "sigprofile?" + locator;
} // end try } // end try
catch (DataException de) catch (DataException de)
{ // error looking up the SIG { // there was a database error
page_title = "Database Error"; return new ErrorBox("Database Error","Database error setting hide status: " + de.getMessage(),
content = new ErrorBox(page_title,"Database error finding SIG: " + de.getMessage(),location); location);
} // end catch } // end catch
if (content==null) // go back to the topic view
{ // we got the SIG parameter OK throw new RedirectResult(location);
} // end if ("hide" or "show")
if (cmd.equals("FY") || cmd.equals("FN"))
{ // we want to set the frozen status of the topic
try
{ // call down to set the topic!
topic.setFrozen(cmd.equals("FY"));
} // end try
catch (DataException de)
{ // there was a database error
return new ErrorBox("Database Error","Database error setting freeze status: " + de.getMessage(),
location);
} // end catch
catch (AccessError ae)
{ // naughty naughty = you can't do this!
return new ErrorBox("Access Error",ae.getMessage(),location);
} // end catch
// go back to the topic view
throw new RedirectResult(location);
} // end if ("freeze" or "unfreeze")
if (cmd.equals("AY") || cmd.equals("AN"))
{ // we want to change the archived status of the topic
try
{ // call down to set the topic!
topic.setArchived(cmd.equals("AY"));
} // end try
catch (DataException de)
{ // there was a database error
return new ErrorBox("Database Error","Database error setting archive status: " + de.getMessage(),
location);
} // end catch
catch (AccessError ae)
{ // naughty naughty = you can't do this!
return new ErrorBox("Access Error",ae.getMessage(),location);
} // end catch
// go back to the topic view
throw new RedirectResult(location);
} // end if ("archive" or "unarchive")
if (cmd.equals("DEL"))
{ // Delete Topic requires a confirmation!
if (ConfirmBox.isConfirmed(request,DELETE_CONFIRM_ATTR,DELETE_CONFIRM_PARAM))
{ // OK, go ahead, delete the topic!
location = "confdisp?sig=" + sig.getSIGID() + "&conf=" + conf.getConfID();
try try
{ // all commands require a conference parameter { // delete the bloody topic!
conf = getConferenceParameter(request,sig); topic.delete();
if (logger.isDebugEnabled())
logger.debug("found conf #" + String.valueOf(conf.getConfID()));
locator += "&conf=" + String.valueOf(conf.getConfID());
location = "confdisp?" + locator;
} // end try
catch (DataException de)
{ // error looking up the conference
page_title = "Database Error";
content = new ErrorBox(page_title,"Database error finding conference: " + de.getMessage(),location);
} // end catch
} // end if
if (content==null)
{ // we got the conference parameter OK
try
{ // now we need a topic parameter
topic = getTopicParameter(request,conf);
if (logger.isDebugEnabled())
logger.debug("found topic #" + String.valueOf(topic.getTopicID()));
locator += "&top=" + String.valueOf(topic.getTopicNumber());
location = "confdisp?" + locator;
} // end try
catch (DataException de)
{ // error looking up the conference
page_title = "Database Error";
content = new ErrorBox(page_title,"Database error finding topic: " + de.getMessage(),location);
} // end catch
} // end if
} // end try
catch (ValidationException ve)
{ // these all get handled in pretty much the same way
page_title = "Error";
content = new ErrorBox(null,ve.getMessage(),location);
} // end catch
catch (AccessError ae)
{ // these all get handled in pretty much the same way
page_title = "Access Error";
content = new ErrorBox(page_title,ae.getMessage(),location);
} // end catch
if (content==null)
{ // figure out what command we want to perform...
String cmd = request.getParameter("cmd");
if (cmd==null)
cmd = "???";
if (cmd.equals("HY") || cmd.equals("HN"))
{ // we want to set the hide status of the topic
try
{ // call down to set the topic!
topic.setHidden(cmd.equals("HY"));
// go back to the topic view
rdat.redirectTo(location);
return;
} // end try } // end try
catch (DataException de) catch (DataException de)
{ // there was a database error { // there was a database error
page_title = "Database Error"; return new ErrorBox("Database Error","Database error deleting topic: " + de.getMessage(),location);
content = new ErrorBox(page_title,"Database error setting hide status: " + de.getMessage(),location);
} // end catch
} // end if ("hide" or "show")
else if (cmd.equals("FY") || cmd.equals("FN"))
{ // we want to set the frozen status of the topic
try
{ // call down to set the topic!
topic.setFrozen(cmd.equals("FY"));
// go back to the topic view
rdat.redirectTo(location);
return;
} // end try
catch (DataException de)
{ // there was a database error
page_title = "Database Error";
content = new ErrorBox(page_title,"Database error setting freeze status: " + de.getMessage(),
location);
} // end catch } // end catch
catch (AccessError ae) catch (AccessError ae)
{ // naughty naughty = you can't do this! { // naughty naughty = you can't do this!
page_title = "Access Error"; return new ErrorBox("Access Error",ae.getMessage(),location);
content = new ErrorBox(page_title,ae.getMessage(),location);
} // end catch } // end catch
} // end else if ("freeze" or "unfreeze") // go back to the conference view
else if (cmd.equals("AY") || cmd.equals("AN")) throw new RedirectResult(location);
{ // we want to change the archived status of the topic
try
{ // call down to set the topic!
topic.setArchived(cmd.equals("AY"));
// go back to the topic view } // end if (confirmed)
rdat.redirectTo(location);
return;
} // end try
catch (DataException de)
{ // there was a database error
page_title = "Database Error";
content = new ErrorBox(page_title,"Database error setting archive status: " + de.getMessage(),
location);
} // end catch
catch (AccessError ae)
{ // naughty naughty = you can't do this!
page_title = "Access Error";
content = new ErrorBox(page_title,ae.getMessage(),location);
} // end catch
} // end else if ("archive" or "unarchive")
else if (cmd.equals("DEL"))
{ // we need confirmation on this operation!
if (ConfirmBox.isConfirmed(request,DELETE_CONFIRM_ATTR,DELETE_CONFIRM_PARAM))
{ // OK, go ahead, delete the topic!
location = "confdisp?sig=" + String.valueOf(sig.getSIGID()) + "&conf="
+ String.valueOf(conf.getConfID());
try
{ // delete the bloody topic!
topic.delete();
// after which, redirect to conference view
rdat.redirectTo(location);
return;
} // end try
catch (DataException de)
{ // there was a database error
page_title = "Database Error";
content = new ErrorBox(page_title,"Database error deleting topic: " + de.getMessage(),location);
} // end catch
catch (AccessError ae)
{ // naughty naughty = you can't do this!
page_title = "Access Error";
content = new ErrorBox(page_title,ae.getMessage(),location);
} // end catch
} // end if
else
{ // not a proper confirmation - better display one
String message = "You are about to delete topic " + String.valueOf(topic.getTopicNumber())
+ " from the \"" + conf.getName() + "\" conference! Are you sure you want to do this?";
String confirm_url = "topicops?" + locator + "&cmd=DEL";
page_title = "Delete Topic";
content = new ConfirmBox(request,DELETE_CONFIRM_ATTR,DELETE_CONFIRM_PARAM,page_title,
message,confirm_url,location);
} // end else
} // end else if ("delete")
else else
{ // unrecognized command { // not a proper confirmation - better display one
page_title = "Internal Error"; String message = "You are about to delete topic " + String.valueOf(topic.getTopicNumber())
logger.error("invalid command to TopicOperations.doGet: " + cmd); + " from the \"" + conf.getName() + "\" conference! Are you sure you want to do this?";
content = new ErrorBox(page_title,"Invalid command to TopicOperations.doGet",location); return new ConfirmBox(request,DELETE_CONFIRM_ATTR,DELETE_CONFIRM_PARAM,"Delete Topic",message,
"topicops?" + locator + "&cmd=DEL",location);
} // end else } // end else
} // end if } // end if (delete)
BaseJSPData basedat = new BaseJSPData(page_title,location,content); // unrecognized command
basedat.transfer(getServletContext(),rdat); logger.error("invalid command to TopicOperations.doGet: " + cmd);
return new ErrorBox("Internal Error","Invalid command to TopicOperations.doGet",location);
} // end doGet } // end doVeniceGet
} // end class TopicOperations } // end class TopicOperations

View File

@ -7,7 +7,7 @@
* WARRANTY OF ANY KIND, either express or implied. See the License for the specific * WARRANTY OF ANY KIND, either express or implied. See the License for the specific
* language governing rights and limitations under the License. * language governing rights and limitations under the License.
* *
* The Original Code is the Venice Web Community System. * The Original Code is the Venice Web Communities System.
* *
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, * 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 * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
@ -25,43 +25,43 @@ import com.silverwrist.venice.servlets.format.*;
public class UserDisplay extends VeniceServlet public class UserDisplay extends VeniceServlet
{ {
/*--------------------------------------------------------------------------------
* Overrides from class HttpServlet
*--------------------------------------------------------------------------------
*/
public String getServletInfo() public String getServletInfo()
{ {
String rc = "UserDisplay servlet - Displays Venice user profiles\n" String rc = "UserDisplay servlet - Displays Venice user profiles\n"
+ "Part of the Venice Web conferencing system\n"; + "Part of the Venice Web Communities System\n";
return rc; return rc;
} // end getServletInfo } // end getServletInfo
public void doGet(HttpServletRequest request, HttpServletResponse response) /*--------------------------------------------------------------------------------
throws ServletException, IOException * Overrides from class VeniceServlet
*--------------------------------------------------------------------------------
*/
protected VeniceContent doVeniceGet(HttpServletRequest request, VeniceEngine engine,
UserContext user, RenderData rdat)
throws ServletException, IOException, VeniceServletResult
{ {
UserContext user = getUserContext(request); String uname = request.getPathInfo().substring(1); // the username we're looking at
RenderData rdat = createRenderData(request,response);
String page_title = null;
Object content = null;
try try
{ // use the request path info to get the username to load the profile from { // load the profile corresponding to that username and display it
String uname = request.getPathInfo().substring(1);
UserProfile prof = user.getProfile(uname); UserProfile prof = user.getProfile(uname);
content = new UserProfileData(prof); changeMenuTop(request);
page_title = "User Profile - " + prof.getUserName(); return new UserProfileData(prof);
} // end try } // end try
catch (DataException de) catch (DataException de)
{ // unable to get the user name { // unable to get the user name
page_title = "Database Error"; return new ErrorBox("Database Error","Database error finding user: " + de.getMessage(),"top");
content = new ErrorBox(page_title,"Database error finding user: " + de.getMessage(),"top");
} // end catch } // end catch
changeMenuTop(request); } // end doVeniceGet
// format and display the user
BaseJSPData basedat = new BaseJSPData(page_title,"user" + request.getPathInfo(),content);
basedat.transfer(getServletContext(),rdat);
} // end doGet
} // end class UserDisplay } // end class UserDisplay

View File

@ -176,9 +176,9 @@ public class Variables
} // end getLanguageList } // end getLanguageList
public static ContentRender getMenu(HttpSession session) public static ComponentRender getMenu(HttpSession session)
{ {
return (ContentRender)(session.getAttribute(MENU_ATTRIBUTE)); return (ComponentRender)(session.getAttribute(MENU_ATTRIBUTE));
} // end getMenu } // end getMenu

View File

@ -7,7 +7,7 @@
* WARRANTY OF ANY KIND, either express or implied. See the License for the specific * WARRANTY OF ANY KIND, either express or implied. See the License for the specific
* language governing rights and limitations under the License. * language governing rights and limitations under the License.
* *
* The Original Code is the Venice Web Community System. * The Original Code is the Venice Web Communities System.
* *
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, * 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 * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
@ -17,10 +17,14 @@
*/ */
package com.silverwrist.venice.servlets; package com.silverwrist.venice.servlets;
import java.io.*;
import java.util.*; import java.util.*;
import javax.servlet.*; import javax.servlet.*;
import javax.servlet.http.*; import javax.servlet.http.*;
import org.apache.log4j.*; import org.apache.log4j.*;
import com.silverwrist.util.StringUtil;
import com.silverwrist.util.ServletMultipartHandler;
import com.silverwrist.util.ServletMultipartException;
import com.silverwrist.venice.core.*; import com.silverwrist.venice.core.*;
import com.silverwrist.venice.servlets.format.*; import com.silverwrist.venice.servlets.format.*;
@ -31,97 +35,628 @@ public abstract class VeniceServlet extends HttpServlet
*-------------------------------------------------------------------------------- *--------------------------------------------------------------------------------
*/ */
private static final String LOCATION_ATTR = "com.silverwrist.venice.servlets.internal.Location";
private static Category logger = Category.getInstance(VeniceServlet.class.getName()); private static Category logger = Category.getInstance(VeniceServlet.class.getName());
/*--------------------------------------------------------------------------------
* Internal functions
*--------------------------------------------------------------------------------
*/
private static final void notSupported(HttpServletRequest request, String message) throws ErrorResult
{
String protocol = request.getProtocol();
if (protocol.endsWith("1.1"))
throw new ErrorResult(HttpServletResponse.SC_METHOD_NOT_ALLOWED,message);
else
throw new ErrorResult(HttpServletResponse.SC_BAD_REQUEST,message);
} // end notSupported
private static final SIGContext getSIGParameter(String str, UserContext user, boolean required,
String on_error) throws ErrorBox
{
if (StringUtil.isStringEmpty(str))
{ // there's no SIG parameter
if (required)
{ // no SIG parameter - bail out now!
logger.error("SIG parameter not specified!");
throw new ErrorBox(null,"No SIG specified.",on_error);
} // end if
else
{ // a null SIGContext is permitted
if (logger.isDebugEnabled())
logger.debug("no SIG specified");
return null;
} // end else
} // end if
SIGContext rc = null;
try
{ // turn the string into a SIGID, and thence to a SIGContext
rc = user.getSIGContext(Integer.parseInt(str));
if (logger.isDebugEnabled())
logger.debug("found SIG #" + rc.getSIGID());
} // end try
catch (NumberFormatException nfe)
{ // error in Integer.parseInt
logger.error("Cannot convert SIG parameter '" + str + "'!");
throw new ErrorBox(null,"Invalid SIG parameter.",on_error);
} // end catch
catch (DataException de)
{ // error looking up the SIG
throw new ErrorBox("Database Error","Database error finding SIG: " + de.getMessage(),on_error);
} // end catch
return rc;
} // end getSIGParameter
private static ConferenceContext getConferenceParameter(String str, SIGContext sig, boolean required,
String on_error) throws ErrorBox
{
if (StringUtil.isStringEmpty(str))
{ // there's no conference parameter
if (required)
{ // no conference parameter - bail out now!
logger.error("Conference parameter not specified!");
throw new ErrorBox(null,"No conference specified.",on_error);
} // end if
else
{ // a null ConferenceContext is permitted
if (logger.isDebugEnabled())
logger.debug("no conference specified");
return null;
} // end else
} // end if
ConferenceContext rc = null;
try
{ // turn the string into a ConfID, and thence to a ConferenceContext
rc = sig.getConferenceContext(Integer.parseInt(str));
if (logger.isDebugEnabled())
logger.debug("found conf #" + rc.getConfID());
} // end try
catch (NumberFormatException nfe)
{ // error in Integer.parseInt
logger.error("Cannot convert conference parameter '" + str + "'!");
throw new ErrorBox(null,"Invalid conference parameter.",on_error);
} // end catch
catch (AccessError ae)
{ // these all get handled in pretty much the same way
throw new ErrorBox("Access Error",ae.getMessage(),on_error);
} // end catch
catch (DataException de)
{ // error looking up the conference
throw new ErrorBox("Database Error","Database error finding conference: " + de.getMessage(),on_error);
} // end catch
return rc;
} // end getConferenceParameter
private static TopicContext getTopicParameter(String str, ConferenceContext conf, boolean required,
String on_error) throws ErrorBox
{
if (StringUtil.isStringEmpty(str))
{ // there's no topic parameter
if (required)
{ // no topic parameter - bail out now!
logger.error("Topic parameter not specified!");
throw new ErrorBox(null,"No topic specified.",on_error);
} // end if
else
{ // a null TopicContext is permitted
if (logger.isDebugEnabled())
logger.debug("no topic specified");
return null;
} // end else
} // end if
TopicContext rc = null;
try
{ // turn the string into a TopicID, and thence to a TopicContext
rc = conf.getTopic(Short.parseShort(str));
if (logger.isDebugEnabled())
logger.debug("found topic #" + rc.getTopicID());
} // end try
catch (NumberFormatException nfe)
{ // error in Integer.parseInt
logger.error("Cannot convert topic parameter '" + str + "'!");
throw new ErrorBox(null,"Invalid topic parameter.",on_error);
} // end catch
catch (AccessError ae)
{ // these all get handled in pretty much the same way
throw new ErrorBox("Access Error",ae.getMessage(),on_error);
} // end catch
catch (DataException de)
{ // error looking up the topic
throw new ErrorBox("Database Error","Database error finding topic: " + de.getMessage(),"top");
} // end catch
return rc;
} // end getTopicParameter
private static TopicMessageContext getMessageParameter(String str, ConferenceContext conf, boolean required,
String on_error) throws ErrorBox
{
if (StringUtil.isStringEmpty(str))
{ // there's no message parameter
if (required)
{ // no message parameter - bail out now!
logger.error("Message parameter not specified!");
throw new ErrorBox(null,"No message specified.",on_error);
} // end if
else
{ // a null TopicMessageContext is permitted
if (logger.isDebugEnabled())
logger.debug("no message specified");
return null;
} // end else
} // end if
TopicMessageContext rc = null;
try
{ // turn the string into a postid, and thence to a TopicMessageContext
rc = conf.getMessageByPostID(Long.parseLong(str));
if (logger.isDebugEnabled())
logger.debug("found post #" + rc.getPostID());
} // end try
catch (NumberFormatException nfe)
{ // error in Integer.parseInt
logger.error("Cannot convert message parameter '" + str + "'!");
throw new ErrorBox(null,"Invalid message parameter.",on_error);
} // end catch
catch (AccessError ae)
{ // these all get handled in pretty much the same way
throw new ErrorBox("Access Error",ae.getMessage(),on_error);
} // end catch
catch (DataException de)
{ // error looking up the conference
throw new ErrorBox("Database Error","Database error finding message: " + de.getMessage(),on_error);
} // end catch
return rc;
} // end getMessageParameter
private static TopicMessageContext getMessageParameter(String str, TopicContext topic, boolean required,
String on_error) throws ErrorBox
{
if (StringUtil.isStringEmpty(str))
{ // there's no message parameter
if (required)
{ // no message parameter - bail out now!
logger.error("Message parameter not specified!");
throw new ErrorBox(null,"No message specified.",on_error);
} // end if
else
{ // a null TopicMessageContext is permitted
if (logger.isDebugEnabled())
logger.debug("no message specified");
return null;
} // end else
} // end if
TopicMessageContext rc = null;
try
{ // turn the string into a post number, and thence to a TopicMessageContext
rc = topic.getMessage(Integer.parseInt(str));
if (logger.isDebugEnabled())
logger.debug("found post #" + rc.getPostID());
} // end try
catch (NumberFormatException nfe)
{ // error in Integer.parseInt
logger.error("Cannot convert message parameter '" + str + "'!");
throw new ErrorBox(null,"Invalid message parameter.",on_error);
} // end catch
catch (AccessError ae)
{ // these all get handled in pretty much the same way
throw new ErrorBox("Access Error",ae.getMessage(),on_error);
} // end catch
catch (DataException de)
{ // error looking up the conference
throw new ErrorBox("Database Error","Database error finding message: " + de.getMessage(),on_error);
} // end catch
return rc;
} // end getMessageParameter
/*-------------------------------------------------------------------------------- /*--------------------------------------------------------------------------------
* Internal operations intended for use by derived classes * Internal operations intended for use by derived classes
*-------------------------------------------------------------------------------- *--------------------------------------------------------------------------------
*/ */
protected static boolean isImageButtonClicked(ServletRequest request, String name) protected static final boolean isImageButtonClicked(ServletRequest request, String name)
{ {
String val = request.getParameter(name + ".x"); String val = request.getParameter(name + ".x");
return (val!=null); return (val!=null);
} // end isImageButtonClicked } // end isImageButtonClicked
protected static VeniceEngine getVeniceEngine(ServletContext ctxt) throws ServletException /*
protected static final VeniceEngine getVeniceEngine(ServletContext ctxt) throws ServletException
{ {
return Variables.getVeniceEngine(ctxt); return Variables.getVeniceEngine(ctxt);
} // end getVeniceEngine } // end getVeniceEngine
protected VeniceEngine getVeniceEngine() throws ServletException protected final VeniceEngine getVeniceEngine() throws ServletException
{ {
return Variables.getVeniceEngine(getServletContext()); return Variables.getVeniceEngine(getServletContext());
} // end getVeniceEngine } // end getVeniceEngine
*/
protected UserContext getUserContext(HttpServletRequest request) throws ServletException /*
protected final UserContext getUserContext(HttpServletRequest request) throws ServletException
{ {
return Variables.getUserContext(getServletContext(),request,request.getSession(true)); return Variables.getUserContext(getServletContext(),request,request.getSession(true));
} // end getUserContext } // end getUserContext
*/
protected void putUserContext(HttpServletRequest request, UserContext ctxt) protected final void putUserContext(HttpServletRequest request, UserContext ctxt)
{ {
Variables.putUserContext(request.getSession(true),ctxt); Variables.putUserContext(request.getSession(true),ctxt);
} // end putUserContext } // end putUserContext
protected void clearUserContext(HttpServletRequest request) protected final void clearUserContext(HttpServletRequest request)
{ {
Variables.clearUserContext(request.getSession(true)); Variables.clearUserContext(request.getSession(true));
} // end clearUserContext } // end clearUserContext
protected static List getCountryList(ServletContext ctxt) throws ServletException protected static final List getCountryList(ServletContext ctxt) throws ServletException
{ {
return Variables.getCountryList(ctxt); return Variables.getCountryList(ctxt);
} // end getCountryList } // end getCountryList
protected List getCountryList() throws ServletException protected final List getCountryList() throws ServletException
{ {
return Variables.getCountryList(getServletContext()); return Variables.getCountryList(getServletContext());
} // end getCountryList } // end getCountryList
protected List getLanguageList(ServletContext ctxt) throws ServletException protected final List getLanguageList(ServletContext ctxt) throws ServletException
{ {
return Variables.getLanguageList(ctxt); return Variables.getLanguageList(ctxt);
} // end getLanguageList } // end getLanguageList
protected List getLanguageList() throws ServletException protected final List getLanguageList() throws ServletException
{ {
return Variables.getLanguageList(getServletContext()); return Variables.getLanguageList(getServletContext());
} // end getLanguageList } // end getLanguageList
protected void changeMenuTop(HttpServletRequest request) protected final void changeMenuTop(HttpServletRequest request)
{ {
Variables.setMenuTop(getServletContext(),request.getSession(true)); Variables.setMenuTop(getServletContext(),request.getSession(true));
} // end changeMenuTop } // end changeMenuTop
protected void changeMenuSIG(HttpServletRequest request, SIGContext sig) protected final void changeMenuSIG(HttpServletRequest request, SIGContext sig)
{ {
Variables.setMenuSIG(request.getSession(true),sig); Variables.setMenuSIG(request.getSession(true),sig);
} // end changeMenuSIG } // end changeMenuSIG
protected void clearMenu(HttpServletRequest request) protected final void clearMenu(HttpServletRequest request)
{ {
Variables.clearMenu(request.getSession(true)); Variables.clearMenu(request.getSession(true));
} // end clearMenu } // end clearMenu
protected RenderData createRenderData(HttpServletRequest request, HttpServletResponse response) /*
protected final RenderData createRenderData(HttpServletRequest request, HttpServletResponse response)
throws ServletException throws ServletException
{ {
return RenderConfig.createRenderData(getServletContext(),request,response); return RenderConfig.createRenderData(getServletContext(),request,response);
} // end createRenderData } // end createRenderData
*/
protected final String getStandardCommandParam(ServletRequest request)
{
String foo = request.getParameter("cmd");
if (foo==null)
return "???";
else
return foo;
} // end getStandardCommandParam
protected final void setMyLocation(ServletRequest request, String loc)
{
request.setAttribute(LOCATION_ATTR,loc);
} // end setMyLocation
protected final static SIGContext getSIGParameter(ServletRequest request, UserContext user, boolean required,
String on_error) throws ErrorBox
{
return getSIGParameter(request.getParameter("sig"),user,required,on_error);
} // end getSIGParameter
protected final static SIGContext getSIGParameter(ServletMultipartHandler mphandler, UserContext user,
boolean required, String on_error) throws ErrorBox
{
if (mphandler.isFileParam("sig"))
throw new ErrorBox(null,"Internal Error: SIG should be a normal param",on_error);
return getSIGParameter(mphandler.getValue("sig"),user,required,on_error);
} // end getSIGParameter
protected final static ConferenceContext getConferenceParameter(ServletRequest request, SIGContext sig,
boolean required, String on_error)
throws ErrorBox
{
return getConferenceParameter(request.getParameter("conf"),sig,required,on_error);
} // end getConferenceParameter
protected final static ConferenceContext getConferenceParameter(ServletMultipartHandler mphandler,
SIGContext sig, boolean required,
String on_error) throws ErrorBox
{
if (mphandler.isFileParam("conf"))
throw new ErrorBox(null,"Internal Error: conference should be a normal param",on_error);
return getConferenceParameter(mphandler.getValue("conf"),sig,required,on_error);
} // end getConferenceParameter
protected final static TopicContext getTopicParameter(ServletRequest request, ConferenceContext conf,
boolean required, String on_error) throws ErrorBox
{
return getTopicParameter(request.getParameter("top"),conf,required,on_error);
} // end getTopicParameter
protected final static TopicContext getTopicParameter(ServletMultipartHandler mphandler,
ConferenceContext conf, boolean required,
String on_error) throws ErrorBox
{
if (mphandler.isFileParam("top"))
throw new ErrorBox(null,"Internal Error: topic should be a normal param",on_error);
return getTopicParameter(mphandler.getValue("top"),conf,required,on_error);
} // end getTopicParameter
protected final static TopicMessageContext getMessageParameter(ServletRequest request,
ConferenceContext conf, boolean required,
String on_error) throws ErrorBox
{
return getMessageParameter(request.getParameter("msg"),conf,required,on_error);
} // end getMessageParameter
protected final static TopicMessageContext getMessageParameter(ServletMultipartHandler mphandler,
ConferenceContext conf, boolean required,
String on_error) throws ErrorBox
{
if (mphandler.isFileParam("msg"))
throw new ErrorBox(null,"Internal Error: message should be a normal param",on_error);
return getMessageParameter(mphandler.getValue("msg"),conf,required,on_error);
} // end getMessageParameter
protected final static TopicMessageContext getMessageParameter(ServletRequest request, TopicContext topic,
boolean required, String on_error)
throws ErrorBox
{
return getMessageParameter(request.getParameter("msg"),topic,required,on_error);
} // end getMessageParameter
protected final static TopicMessageContext getMessageParameter(ServletMultipartHandler mphandler,
TopicContext topic, boolean required,
String on_error) throws ErrorBox
{
if (mphandler.isFileParam("msg"))
throw new ErrorBox(null,"Internal Error: message should be a normal param",on_error);
return getMessageParameter(mphandler.getValue("msg"),topic,required,on_error);
} // end getMessageParameter
/*--------------------------------------------------------------------------------
* Overrideable operations
*--------------------------------------------------------------------------------
*/
protected String getMyLocation(HttpServletRequest request, VeniceEngine engine, UserContext user,
RenderData rdat)
{
return (String)(request.getAttribute(LOCATION_ATTR));
} // end getMyLocation
protected VeniceContent doVeniceGet(HttpServletRequest request, VeniceEngine engine,
UserContext user, RenderData rdat)
throws ServletException, IOException, VeniceServletResult
{
notSupported(request,"GET method not supported");
return null;
} // end doVeniceGet
protected VeniceContent doVenicePost(HttpServletRequest request, VeniceEngine engine,
UserContext user, RenderData rdat)
throws ServletException, IOException, VeniceServletResult
{
notSupported(request,"POST method not supported for normal form posts");
return null;
} // end doVenicePost
protected VeniceContent doVenicePost(HttpServletRequest request, ServletMultipartHandler mphandler,
VeniceEngine engine, UserContext user, RenderData rdat)
throws ServletException, IOException, VeniceServletResult
{
notSupported(request,"POST method not supported for multipart/form-data posts");
return null;
} // end doVenicePost
/*--------------------------------------------------------------------------------
* Overrides from class HttpServlet
*--------------------------------------------------------------------------------
*/
public final void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
ServletContext ctxt = getServletContext();
VeniceEngine engine = Variables.getVeniceEngine(ctxt);
UserContext user = Variables.getUserContext(ctxt,request,request.getSession(true));
RenderData rdat = RenderConfig.createRenderData(ctxt,request,response);
VeniceContent content = null;
try
{ // run the actual "get" in the servlet
content = doVeniceGet(request,engine,user,rdat);
} // end try
catch (VeniceServletResult res)
{ // special VeniceServletResult catch here - figure out what result it is
if (res instanceof VeniceContent)
content = (VeniceContent)res; // this is content
else if (res instanceof ContentResult)
{ // this contains content
ContentResult cres = (ContentResult)res;
content = cres.getContent();
} // end else if
else if (res instanceof ExecuteResult)
{ // direct-execution result
ExecuteResult xres = (ExecuteResult)res;
xres.execute(rdat);
return;
} // end else if
else // unrecognized VeniceServletResult
content = null;
} // end catch
if (content!=null)
{ // display the content!
BaseJSPData base = new BaseJSPData(getMyLocation(request,engine,user,rdat),content);
base.transfer(ctxt,rdat);
} // end if
else // there is no content - display the null response
rdat.nullResponse();
} // end doGet
public final void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
ServletContext ctxt = getServletContext();
VeniceEngine engine = Variables.getVeniceEngine(ctxt);
UserContext user = Variables.getUserContext(ctxt,request,request.getSession(true));
RenderData rdat = RenderConfig.createRenderData(ctxt,request,response);
ServletMultipartHandler mphandler = null;
VeniceContent content = null;
if (ServletMultipartHandler.canHandle(request))
{ // if this is a multipart/form-data request, invoke our special handler code
try
{ // create the multipart handler
mphandler = new ServletMultipartHandler(request);
} // end try
catch (ServletMultipartException e)
{ // this is an error message we need to generate and just bail out on
BaseJSPData base = new BaseJSPData(getMyLocation(request,engine,user,rdat),
new ErrorBox(null,"Internal Error: " + e.getMessage(),null));
base.transfer(ctxt,rdat);
return;
} // end if
} // end if
try
{ // call the appropriate doVenicePost method
if (mphandler!=null)
content = doVenicePost(request,mphandler,engine,user,rdat);
else
content = doVenicePost(request,engine,user,rdat);
} // end try
catch (VeniceServletResult res)
{ // special VeniceServletResult catch here - figure out what result it is
if (res instanceof VeniceContent)
content = (VeniceContent)res; // this is content
else if (res instanceof ContentResult)
{ // this contains content
ContentResult cres = (ContentResult)res;
content = cres.getContent();
} // end else if
else if (res instanceof ExecuteResult)
{ // direct-execution result
ExecuteResult xres = (ExecuteResult)res;
xres.execute(rdat);
return;
} // end else if
else // unrecognized VeniceServletResult
content = null;
} // end catch
if (content!=null)
{ // display the content!
BaseJSPData base = new BaseJSPData(getMyLocation(request,engine,user,rdat),content);
base.transfer(ctxt,rdat);
} // end if
else // there is no content - display the null response
rdat.nullResponse();
} // end doPost
} // end class VeniceServlet } // end class VeniceServlet

View File

@ -0,0 +1,59 @@
/*
* 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) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
package com.silverwrist.venice.servlets;
import java.io.PrintWriter;
import java.io.PrintStream;
public class VeniceServletResult extends Throwable
{
/*--------------------------------------------------------------------------------
* Constructor
*--------------------------------------------------------------------------------
*/
public VeniceServletResult()
{
super();
} // end constructor
/*--------------------------------------------------------------------------------
* Overrides from class Throwable
*--------------------------------------------------------------------------------
*/
public final void printStackTrace()
{ // do nothing - this isn't really an error
} // end printStackTrace
public final void printStackTrace(PrintStream s)
{ // do nothing - this isn't really an error
} // end printStackTrace
public final void printStackTrace(PrintWriter s)
{ // do nothing - this isn't really an error
} // end printStackTrace
public final Throwable fillInStackTrace()
{ // do nothing - this isn't really an error
return this;
} // end fillInStackTrace
} // end class VeniceServletResult

View File

@ -69,6 +69,17 @@ public class AttachmentForm implements JSPRender
} // end retrieve } // end retrieve
/*--------------------------------------------------------------------------------
* Implementations from interface VeniceContent
*--------------------------------------------------------------------------------
*/
public String getPageTitle(RenderData rdat)
{
return "Upload Attachment";
} // end getPageTitle
/*-------------------------------------------------------------------------------- /*--------------------------------------------------------------------------------
* Implementations from interface JSPRender * Implementations from interface JSPRender
*-------------------------------------------------------------------------------- *--------------------------------------------------------------------------------

View File

@ -7,7 +7,7 @@
* WARRANTY OF ANY KIND, either express or implied. See the License for the specific * WARRANTY OF ANY KIND, either express or implied. See the License for the specific
* language governing rights and limitations under the License. * language governing rights and limitations under the License.
* *
* The Original Code is the Venice Web Community System. * The Original Code is the Venice Web Communities System.
* *
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, * 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 * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
@ -38,9 +38,8 @@ public class BaseJSPData
*-------------------------------------------------------------------------------- *--------------------------------------------------------------------------------
*/ */
private String title; // title string to use for this page
private String location; // location string to use for this page private String location; // location string to use for this page
private Object content; // the actual content private VeniceContent content; // the actual content
private boolean login_links = true; // show login links up top? private boolean login_links = true; // show login links up top?
/*-------------------------------------------------------------------------------- /*--------------------------------------------------------------------------------
@ -48,9 +47,8 @@ public class BaseJSPData
*-------------------------------------------------------------------------------- *--------------------------------------------------------------------------------
*/ */
public BaseJSPData(String title, String location, Object content) public BaseJSPData(String location, VeniceContent content)
{ {
this.title = title;
this.location = location; this.location = location;
this.content = content; this.content = content;
@ -78,12 +76,18 @@ public class BaseJSPData
} // end store } // end store
public String getTitle() public String getTitle(RenderData rdat)
{ {
return title; return content.getPageTitle(rdat);
} // end getTitle } // end getTitle
public boolean locationSpecified()
{
return (location!=null);
} // end if
public String getLocation() public String getLocation()
{ {
return location; return location;
@ -92,7 +96,7 @@ public class BaseJSPData
public boolean displayLoginLinks() public boolean displayLoginLinks()
{ {
return login_links; return login_links && (location!=null);
} // end displayLoginLinks } // end displayLoginLinks
@ -115,8 +119,7 @@ public class BaseJSPData
{ {
if (content==null) if (content==null)
{ // there is no content! { // there is no content!
ErrorBox box = new ErrorBox(null,"Internal Error: There is no content available",null); new ErrorBox(null,"Internal Error: There is no content available",null).renderHere(out,rdat);
box.renderHere(out,rdat);
return; return;
} // end if } // end if
@ -128,8 +131,7 @@ public class BaseJSPData
return; return;
} // end if } // end if
else if (content instanceof JSPRender)
if (content instanceof JSPRender)
{ // we have a JSP-rendered page - include it { // we have a JSP-rendered page - include it
JSPRender jr = (JSPRender)content; JSPRender jr = (JSPRender)content;
rdat.storeJSPRender(jr); rdat.storeJSPRender(jr);
@ -141,10 +143,8 @@ public class BaseJSPData
return; return;
} // end if } // end if
else // this is the fallback if we don't recognize the content
// this is the fallback if we don't recognize the content new ErrorBox(null,"Internal Error: Content of invalid type",null).renderHere(out,rdat);
ErrorBox box2 = new ErrorBox(null,"Internal Error: Content of invalid type",null);
box2.renderHere(out,rdat);
} // end renderContent } // end renderContent

View File

@ -7,7 +7,7 @@
* WARRANTY OF ANY KIND, either express or implied. See the License for the specific * WARRANTY OF ANY KIND, either express or implied. See the License for the specific
* language governing rights and limitations under the License. * language governing rights and limitations under the License.
* *
* The Original Code is the Venice Web Community System. * The Original Code is the Venice Web Communities System.
* *
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, * 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 * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are

View File

@ -19,7 +19,7 @@ package com.silverwrist.venice.servlets.format;
import javax.servlet.ServletRequest; import javax.servlet.ServletRequest;
public interface CDCommandButton extends ContentRender public interface CDCommandButton extends ComponentRender
{ {
public abstract String getName(); public abstract String getName();

View File

@ -19,7 +19,7 @@ package com.silverwrist.venice.servlets.format;
import com.silverwrist.venice.ValidationException; import com.silverwrist.venice.ValidationException;
public interface CDFormField extends ContentRender public interface CDFormField extends ComponentRender
{ {
public abstract String getName(); public abstract String getName();

View File

@ -0,0 +1,27 @@
/*
* 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) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
package com.silverwrist.venice.servlets.format;
import java.io.Writer;
import java.io.IOException;
public interface ComponentRender
{
public abstract void renderHere(Writer out, RenderData rdat) throws IOException;
} // end interface ComponentRender

View File

@ -66,6 +66,17 @@ public class ConferenceListing implements JSPRender
} // end retrieve } // end retrieve
/*--------------------------------------------------------------------------------
* Implementations from interface VeniceContent
*--------------------------------------------------------------------------------
*/
public String getPageTitle(RenderData rdat)
{
return "Conference Listing: " + sig.getName();
} // end getPageTitle
/*-------------------------------------------------------------------------------- /*--------------------------------------------------------------------------------
* Implementations from interface JSPRender * Implementations from interface JSPRender
*-------------------------------------------------------------------------------- *--------------------------------------------------------------------------------

View File

@ -7,7 +7,7 @@
* WARRANTY OF ANY KIND, either express or implied. See the License for the specific * WARRANTY OF ANY KIND, either express or implied. See the License for the specific
* language governing rights and limitations under the License. * language governing rights and limitations under the License.
* *
* The Original Code is the Venice Web Community System. * The Original Code is the Venice Web Communities System.
* *
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, * 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 * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
@ -93,7 +93,18 @@ public class ConfirmBox implements ContentRender
} // end doConfirm } // end doConfirm
/*-------------------------------------------------------------------------------- /*--------------------------------------------------------------------------------
* Implementations from class ContentRender * Implementations from interface VeniceContent
*--------------------------------------------------------------------------------
*/
public String getPageTitle(RenderData rdat)
{
return title;
} // end getPageTitle
/*--------------------------------------------------------------------------------
* Implementations from interface ContentRender
*-------------------------------------------------------------------------------- *--------------------------------------------------------------------------------
*/ */

View File

@ -122,6 +122,17 @@ public class ContentDialog implements Cloneable, ContentRender
{ // do nothing at this level { // do nothing at this level
} // end validateWholeForm } // end validateWholeForm
/*--------------------------------------------------------------------------------
* Implementations from interface VeniceContent
*--------------------------------------------------------------------------------
*/
public String getPageTitle(RenderData rdat)
{
return title;
} // end getPageTitle
/*-------------------------------------------------------------------------------- /*--------------------------------------------------------------------------------
* Implementations from interface ContentRender * Implementations from interface ContentRender
*-------------------------------------------------------------------------------- *--------------------------------------------------------------------------------
@ -214,12 +225,6 @@ public class ContentDialog implements Cloneable, ContentRender
*-------------------------------------------------------------------------------- *--------------------------------------------------------------------------------
*/ */
public String getTitle()
{
return title;
} // end getTitle
public void setErrorMessage(String message) public void setErrorMessage(String message)
{ {
this.error_message = message; this.error_message = message;

View File

@ -99,6 +99,17 @@ public class ContentMenuPanel implements Cloneable, ContentRender
} // end constructor } // end constructor
/*--------------------------------------------------------------------------------
* Implementations from interface VeniceContent
*--------------------------------------------------------------------------------
*/
public String getPageTitle(RenderData rdat)
{
return title;
} // end getPageTitle
/*-------------------------------------------------------------------------------- /*--------------------------------------------------------------------------------
* Implementations from interface ContentRender * Implementations from interface ContentRender
*-------------------------------------------------------------------------------- *--------------------------------------------------------------------------------

View File

@ -7,7 +7,7 @@
* WARRANTY OF ANY KIND, either express or implied. See the License for the specific * WARRANTY OF ANY KIND, either express or implied. See the License for the specific
* language governing rights and limitations under the License. * language governing rights and limitations under the License.
* *
* The Original Code is the Venice Web Community System. * The Original Code is the Venice Web Communities System.
* *
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, * 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 * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
@ -20,7 +20,7 @@ package com.silverwrist.venice.servlets.format;
import java.io.Writer; import java.io.Writer;
import java.io.IOException; import java.io.IOException;
public interface ContentRender public interface ContentRender extends VeniceContent
{ {
public abstract void renderHere(Writer out, RenderData rdat) throws IOException; public abstract void renderHere(Writer out, RenderData rdat) throws IOException;

View File

@ -7,7 +7,7 @@
* WARRANTY OF ANY KIND, either express or implied. See the License for the specific * WARRANTY OF ANY KIND, either express or implied. See the License for the specific
* language governing rights and limitations under the License. * language governing rights and limitations under the License.
* *
* The Original Code is the Venice Web Community System. * The Original Code is the Venice Web Communities System.
* *
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, * 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 * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
@ -20,15 +20,27 @@ package com.silverwrist.venice.servlets.format;
import java.io.Writer; import java.io.Writer;
import java.io.IOException; import java.io.IOException;
import com.silverwrist.util.StringUtil; import com.silverwrist.util.StringUtil;
import com.silverwrist.venice.servlets.VeniceServletResult;
public class ErrorBox implements ContentRender public class ErrorBox extends VeniceServletResult implements ContentRender
{ {
/*--------------------------------------------------------------------------------
* Attributes
*--------------------------------------------------------------------------------
*/
private String title; private String title;
private String message; private String message;
private String back; private String back;
/*--------------------------------------------------------------------------------
* Constructor
*--------------------------------------------------------------------------------
*/
public ErrorBox(String title, String message, String back) public ErrorBox(String title, String message, String back)
{ {
super();
this.title = title; this.title = title;
this.message = message; this.message = message;
this.back = back; this.back = back;
@ -38,6 +50,22 @@ public class ErrorBox implements ContentRender
} // end constructor } // end constructor
/*--------------------------------------------------------------------------------
* Implementations from interface VeniceContent
*--------------------------------------------------------------------------------
*/
public String getPageTitle(RenderData rdat)
{
return title;
} // end getPageTitle
/*--------------------------------------------------------------------------------
* Implementations from interface ContentRender
*--------------------------------------------------------------------------------
*/
public void renderHere(Writer out, RenderData rdat) throws IOException public void renderHere(Writer out, RenderData rdat) throws IOException
{ {
out.write("<P><TABLE ALIGN=CENTER WIDTH=\"70%\" BORDER=1 CELLPADDING=2 CELLSPACING=1>"); out.write("<P><TABLE ALIGN=CENTER WIDTH=\"70%\" BORDER=1 CELLPADDING=2 CELLSPACING=1>");

View File

@ -138,6 +138,17 @@ public class FindData implements JSPRender, SearchMode
} // end retrieve } // end retrieve
/*--------------------------------------------------------------------------------
* Implementations from interface VeniceContent
*--------------------------------------------------------------------------------
*/
public String getPageTitle(RenderData rdat)
{
return "Find";
} // end getPageTitle
/*-------------------------------------------------------------------------------- /*--------------------------------------------------------------------------------
* Implementations from interface JSPRender * Implementations from interface JSPRender
*-------------------------------------------------------------------------------- *--------------------------------------------------------------------------------

View File

@ -7,7 +7,7 @@
* WARRANTY OF ANY KIND, either express or implied. See the License for the specific * WARRANTY OF ANY KIND, either express or implied. See the License for the specific
* language governing rights and limitations under the License. * language governing rights and limitations under the License.
* *
* The Original Code is the Venice Web Community System. * The Original Code is the Venice Web Communities System.
* *
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, * 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 * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
@ -19,7 +19,7 @@ package com.silverwrist.venice.servlets.format;
import javax.servlet.ServletRequest; import javax.servlet.ServletRequest;
public interface JSPRender public interface JSPRender extends VeniceContent
{ {
public abstract void store(ServletRequest request); public abstract void store(ServletRequest request);

View File

@ -0,0 +1,130 @@
/*
* 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) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
package com.silverwrist.venice.servlets.format;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
import com.silverwrist.venice.core.*;
public class ManageConference implements JSPRender
{
/*--------------------------------------------------------------------------------
* Static data members
*--------------------------------------------------------------------------------
*/
// Attribute name for request attribute
protected static final String ATTR_NAME = "com.silverwrist.venice.content.ManageConference";
/*--------------------------------------------------------------------------------
* Attributes
*--------------------------------------------------------------------------------
*/
private SIGContext sig; // the SIG we're in
private ConferenceContext conf; // the conference being listed
/*--------------------------------------------------------------------------------
* Constructor
*--------------------------------------------------------------------------------
*/
public ManageConference(SIGContext sig, ConferenceContext conf)
{
this.sig = sig;
this.conf = conf;
} // end constructor
/*--------------------------------------------------------------------------------
* External static functions
*--------------------------------------------------------------------------------
*/
public static ManageConference retrieve(ServletRequest request)
{
return (ManageConference)(request.getAttribute(ATTR_NAME));
} // end retrieve
/*--------------------------------------------------------------------------------
* Implementations from interface VeniceContent
*--------------------------------------------------------------------------------
*/
public String getPageTitle(RenderData rdat)
{
return "Manage Conference: " + conf.getName();
} // end getPageTitle
/*--------------------------------------------------------------------------------
* Implementations from interface JSPRender
*--------------------------------------------------------------------------------
*/
public void store(ServletRequest request)
{
request.setAttribute(ATTR_NAME,this);
} // end store
public String getTargetJSPName()
{
return "manage_conf.jsp";
} // end getTargetJSPName
/*--------------------------------------------------------------------------------
* External operations
*--------------------------------------------------------------------------------
*/
public int getSIGID()
{
return sig.getSIGID();
} // end getSIGID
public int getConfID()
{
return conf.getConfID();
} // end getConfID
public String getConfName()
{
return conf.getName();
} // end getConfName
public String getLocator()
{
return "sig=" + sig.getSIGID() + "&conf=" + conf.getConfID();
} // end getLocator
public boolean displayAdminSection()
{
return conf.canChangeConference();
// TODO: needs to have "delete" permission OR'ed in
} // end displayAdminSection
} // end class ManageConference

View File

@ -23,7 +23,7 @@ import java.util.*;
import com.silverwrist.util.StringUtil; import com.silverwrist.util.StringUtil;
import com.silverwrist.venice.core.*; import com.silverwrist.venice.core.*;
public class MenuSIG implements ContentRender public class MenuSIG implements ComponentRender
{ {
private String image_url; private String image_url;
private boolean image_url_needs_fixup = false; private boolean image_url_needs_fixup = false;

View File

@ -7,7 +7,7 @@
* WARRANTY OF ANY KIND, either express or implied. See the License for the specific * WARRANTY OF ANY KIND, either express or implied. See the License for the specific
* language governing rights and limitations under the License. * language governing rights and limitations under the License.
* *
* The Original Code is the Venice Web Community System. * The Original Code is the Venice Web Communities System.
* *
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, * 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 * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
@ -20,7 +20,7 @@ package com.silverwrist.venice.servlets.format;
import java.io.Writer; import java.io.Writer;
import java.io.IOException; import java.io.IOException;
public class MenuTop implements ContentRender public class MenuTop implements ComponentRender
{ {
public MenuTop() public MenuTop()
{ // constructor does nothing { // constructor does nothing

View File

@ -61,6 +61,17 @@ public class NewSIGWelcome implements JSPRender
} // end retrieve } // end retrieve
/*--------------------------------------------------------------------------------
* Implementations from interface VeniceContent
*--------------------------------------------------------------------------------
*/
public String getPageTitle(RenderData rdat)
{
return "New SIG Created";
} // end getPageTitle
/*-------------------------------------------------------------------------------- /*--------------------------------------------------------------------------------
* Implementations from interface JSPRender * Implementations from interface JSPRender
*-------------------------------------------------------------------------------- *--------------------------------------------------------------------------------

View File

@ -70,6 +70,17 @@ public class NewTopicForm implements JSPRender
} // end retrieve } // end retrieve
/*--------------------------------------------------------------------------------
* Implementations from interface VeniceContent
*--------------------------------------------------------------------------------
*/
public String getPageTitle(RenderData rdat)
{
return "Create New Topic";
} // end getPageTitle
/*-------------------------------------------------------------------------------- /*--------------------------------------------------------------------------------
* Implementations from interface JSPRender * Implementations from interface JSPRender
*-------------------------------------------------------------------------------- *--------------------------------------------------------------------------------

View File

@ -105,6 +105,17 @@ public class PostPreview implements JSPRender
} // end retrieve } // end retrieve
/*--------------------------------------------------------------------------------
* Implementations from interface VeniceContent
*--------------------------------------------------------------------------------
*/
public String getPageTitle(RenderData rdat)
{
return "Previewing Message";
} // end getPageTitle
/*-------------------------------------------------------------------------------- /*--------------------------------------------------------------------------------
* Implementations from interface JSPRender * Implementations from interface JSPRender
*-------------------------------------------------------------------------------- *--------------------------------------------------------------------------------

View File

@ -98,6 +98,17 @@ public class PostSlippage implements JSPRender
} // end retrieve } // end retrieve
/*--------------------------------------------------------------------------------
* Implementations from interface VeniceContent
*--------------------------------------------------------------------------------
*/
public String getPageTitle(RenderData rdat)
{
return "Slippage or Double-Click Detected";
} // end getPageTitle
/*-------------------------------------------------------------------------------- /*--------------------------------------------------------------------------------
* Implementations from interface JSPRender * Implementations from interface JSPRender
*-------------------------------------------------------------------------------- *--------------------------------------------------------------------------------

View File

@ -308,6 +308,18 @@ public class RenderData
} // end nullResponse } // end nullResponse
public void errorResponse(int code) throws IOException
{
response.sendError(code);
} // end errorResponse
public void errorResponse(int code, String msg) throws IOException
{
response.sendError(code,msg);
} // end errorResponse
public void sendBinaryData(String type, String filename, int length, InputStream data) throws IOException public void sendBinaryData(String type, String filename, int length, InputStream data) throws IOException
{ {
response.setContentType(type); response.setContentType(type);

View File

@ -71,6 +71,17 @@ public class SIGCategoryBrowseData implements JSPRender
} // end retrieve } // end retrieve
/*--------------------------------------------------------------------------------
* Implementations from interface VeniceContent
*--------------------------------------------------------------------------------
*/
public String getPageTitle(RenderData rdat)
{
return "Set SIG Category";
} // end getPageTitle
/*-------------------------------------------------------------------------------- /*--------------------------------------------------------------------------------
* Implementations from interface JSPRender * Implementations from interface JSPRender
*-------------------------------------------------------------------------------- *--------------------------------------------------------------------------------

View File

@ -70,6 +70,17 @@ public class SIGProfileData implements JSPRender
} // end retrieve } // end retrieve
/*--------------------------------------------------------------------------------
* Implementations from interface VeniceContent
*--------------------------------------------------------------------------------
*/
public String getPageTitle(RenderData rdat)
{
return "SIG Profile: " + sig.getName();
} // end getPageTitle
/*-------------------------------------------------------------------------------- /*--------------------------------------------------------------------------------
* Implementations from interface JSPRender * Implementations from interface JSPRender
*-------------------------------------------------------------------------------- *--------------------------------------------------------------------------------

View File

@ -61,6 +61,17 @@ public class SIGWelcome implements JSPRender
} // end retrieve } // end retrieve
/*--------------------------------------------------------------------------------
* Implementations from interface VeniceContent
*--------------------------------------------------------------------------------
*/
public String getPageTitle(RenderData rdat)
{
return "Welcome to " + name;
} // end getPageTitle
/*-------------------------------------------------------------------------------- /*--------------------------------------------------------------------------------
* Implementations from interface JSPRender * Implementations from interface JSPRender
*-------------------------------------------------------------------------------- *--------------------------------------------------------------------------------

View File

@ -26,7 +26,7 @@ import com.silverwrist.venice.core.DataException;
public abstract class TCStandardPanel extends TopContentPanel public abstract class TCStandardPanel extends TopContentPanel
{ {
class TCButton implements ContentRender class TCButton implements ComponentRender
{ {
private String image; private String image;
private String alt_text; private String alt_text;

View File

@ -7,7 +7,7 @@
* WARRANTY OF ANY KIND, either express or implied. See the License for the specific * WARRANTY OF ANY KIND, either express or implied. See the License for the specific
* language governing rights and limitations under the License. * language governing rights and limitations under the License.
* *
* The Original Code is the Venice Web Community System. * The Original Code is the Venice Web Communities System.
* *
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, * 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 * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
@ -24,15 +24,28 @@ import com.silverwrist.venice.core.*;
public class TopContent implements ContentRender public class TopContent implements ContentRender
{ {
// Static constants /*--------------------------------------------------------------------------------
* Static data members
*--------------------------------------------------------------------------------
*/
public static final int MAX_COLS = 2; public static final int MAX_COLS = 2;
// Attributes /*--------------------------------------------------------------------------------
* Attributes
*--------------------------------------------------------------------------------
*/
private int actual_cols = MAX_COLS; private int actual_cols = MAX_COLS;
private int[] col_sizes; private int[] col_sizes;
private Vector panels = new Vector(); private Vector panels = new Vector();
private boolean display_configure; private boolean display_configure;
/*--------------------------------------------------------------------------------
* Constructor
*--------------------------------------------------------------------------------
*/
public TopContent(UserContext uc) throws DataException public TopContent(UserContext uc) throws DataException
{ {
int i; // loop counter int i; // loop counter
@ -74,6 +87,22 @@ public class TopContent implements ContentRender
} // end constructor } // end constructor
/*--------------------------------------------------------------------------------
* Implementations from interface VeniceContent
*--------------------------------------------------------------------------------
*/
public String getPageTitle(RenderData rdat)
{
return "My Front Page";
} // end getPageTitle
/*--------------------------------------------------------------------------------
* Implementations from interface ContentRender
*--------------------------------------------------------------------------------
*/
public void renderHere(Writer out, RenderData rdat) throws IOException public void renderHere(Writer out, RenderData rdat) throws IOException
{ {
out.write("<TABLE BORDER=0 ALIGN=CENTER WIDTH=\"100%\" CELLPADDING=4 CELLSPACING=0>\n"); out.write("<TABLE BORDER=0 ALIGN=CENTER WIDTH=\"100%\" CELLPADDING=4 CELLSPACING=0>\n");
@ -108,6 +137,6 @@ public class TopContent implements ContentRender
rdat.writeFooter(out); rdat.writeFooter(out);
} /* end renderHere */ } // end renderHere
} // end class TopContent } // end class TopContent

View File

@ -22,7 +22,7 @@ import java.io.IOException;
import com.silverwrist.venice.core.UserContext; import com.silverwrist.venice.core.UserContext;
import com.silverwrist.venice.core.DataException; import com.silverwrist.venice.core.DataException;
public abstract class TopContentPanel implements ContentRender, Cloneable public abstract class TopContentPanel implements ComponentRender, Cloneable
{ {
protected TopContentPanel() protected TopContentPanel()
{ // do nothing { // do nothing

View File

@ -72,6 +72,17 @@ public class TopicListing implements JSPRender
} // end retrieve } // end retrieve
/*--------------------------------------------------------------------------------
* Implementations from interface VeniceContent
*--------------------------------------------------------------------------------
*/
public String getPageTitle(RenderData rdat)
{
return "Topics in " + conf.getName();
} // end getPageTitle
/*-------------------------------------------------------------------------------- /*--------------------------------------------------------------------------------
* Implementations from interface JSPRender * Implementations from interface JSPRender
*-------------------------------------------------------------------------------- *--------------------------------------------------------------------------------

View File

@ -89,6 +89,18 @@ public class TopicPosts implements JSPRender
} // end retrieve } // end retrieve
/*--------------------------------------------------------------------------------
* Implementations from interface VeniceContent
*--------------------------------------------------------------------------------
*/
public String getPageTitle(RenderData rdat)
{
return topic.getName() + ": " + topic.getTotalMessages() + " Total; " + unread + " New; Last: "
+ rdat.formatDateForDisplay(topic.getLastUpdateDate());
} // end getPageTitle
/*-------------------------------------------------------------------------------- /*--------------------------------------------------------------------------------
* Implementations from interface JSPRender * Implementations from interface JSPRender
*-------------------------------------------------------------------------------- *--------------------------------------------------------------------------------

View File

@ -60,6 +60,17 @@ public class UserProfileData implements JSPRender
} // end retrieve } // end retrieve
/*--------------------------------------------------------------------------------
* Implementations from interface VeniceContent
*--------------------------------------------------------------------------------
*/
public String getPageTitle(RenderData rdat)
{
return "User Profile - " + prof.getUserName();
} // end getPageTitle
/*-------------------------------------------------------------------------------- /*--------------------------------------------------------------------------------
* Implementations from interface JSPRender * Implementations from interface JSPRender
*-------------------------------------------------------------------------------- *--------------------------------------------------------------------------------

View File

@ -0,0 +1,24 @@
/*
* 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) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
package com.silverwrist.venice.servlets.format;
public interface VeniceContent
{
public abstract String getPageTitle(RenderData rdat);
} // end interface VeniceContent

View File

@ -7,7 +7,7 @@
WARRANTY OF ANY KIND, either express or implied. See the License for the specific WARRANTY OF ANY KIND, either express or implied. See the License for the specific
language governing rights and limitations under the License. language governing rights and limitations under the License.
The Original Code is the Venice Web Community System. The Original Code is the Venice Web Communities System.
The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, 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 for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
@ -22,9 +22,10 @@
<%@ page import = "com.silverwrist.venice.servlets.format.*" %> <%@ page import = "com.silverwrist.venice.servlets.format.*" %>
<%! <%!
private static void renderMenu(HttpSession session, java.io.Writer out, RenderData rdat) throws java.io.IOException private static void renderMenu(HttpSession session, java.io.Writer out, RenderData rdat)
throws java.io.IOException
{ {
ContentRender menu = Variables.getMenu(session); ComponentRender menu = Variables.getMenu(session);
if (menu==null) if (menu==null)
menu = new MenuTop(); menu = new MenuTop();
menu.renderHere(out,rdat); menu.renderHere(out,rdat);
@ -33,14 +34,15 @@ private static void renderMenu(HttpSession session, java.io.Writer out, RenderDa
%> %>
<% <%
BaseJSPData basedat = BaseJSPData.retrieve(request);
Variables.failIfNull(basedat);
UserContext user = Variables.getUserContext(application,request,session); UserContext user = Variables.getUserContext(application,request,session);
RenderData rdat = RenderConfig.createRenderData(application,request,response); RenderData rdat = RenderConfig.createRenderData(application,request,response);
BaseJSPData basedat = BaseJSPData.retrieve(request);
%> %>
<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\"> <!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">
<HTML> <HTML>
<HEAD> <HEAD>
<%= rdat.getTitleTag(basedat.getTitle()) %> <%= rdat.getTitleTag(basedat.getTitle(rdat)) %>
</HEAD> </HEAD>
<BODY BGCOLOR="#9999FF"> <BODY BGCOLOR="#9999FF">

View File

@ -35,8 +35,7 @@
<IMG SRC="<%= rdat.getFullImagePath("purple-ball.gif") %>" ALT="*" WIDTH=14 HEIGHT=14 BORDER=0> <IMG SRC="<%= rdat.getFullImagePath("purple-ball.gif") %>" ALT="*" WIDTH=14 HEIGHT=14 BORDER=0>
</TD> </TD>
<TD ALIGN=LEFT><%= rdat.getStdFontTag(null,2) %> <TD ALIGN=LEFT><%= rdat.getStdFontTag(null,2) %>
<% String path = "confdisp?sig=" + String.valueOf(data.getSIGID()) + "&conf=" <% String path = "confdisp?sig=" + data.getSIGID() + "&conf=" + data.getConferenceID(i); %>
+ String.valueOf(data.getConferenceID(i)); %>
<A HREF="<%= rdat.getEncodedServletPath(path) %>"><%= StringUtil.encodeHTML(data.getConferenceName(i)) %></A> - <A HREF="<%= rdat.getEncodedServletPath(path) %>"><%= StringUtil.encodeHTML(data.getConferenceName(i)) %></A> -
Latest activity: <%= rdat.getActivityString(data.getLastUpdateDate(i)) %><BR> Latest activity: <%= rdat.getActivityString(data.getLastUpdateDate(i)) %><BR>
<% int count = data.getNumHosts(i); %> <% int count = data.getNumHosts(i); %>
@ -59,7 +58,7 @@
<% if (data.canCreateConference()) { %> <% if (data.canCreateConference()) { %>
<P> <P>
<DIV ALIGN="LEFT"> <DIV ALIGN="LEFT">
<A HREF="<%= rdat.getEncodedServletPath("confops?cmd=C&sig=" + String.valueOf(data.getSIGID())) %>"><IMG <A HREF="<%= rdat.getEncodedServletPath("confops?cmd=C&sig=" + data.getSIGID()) %>"><IMG
SRC="<%= rdat.getFullImagePath("bn_create_new.gif") %>" ALT="Create New" WIDTH=80 HEIGHT=24 BORDER=0></A> SRC="<%= rdat.getFullImagePath("bn_create_new.gif") %>" ALT="Create New" WIDTH=80 HEIGHT=24 BORDER=0></A>
</DIV> </DIV>
<% } // end if %> <% } // end if %>

View File

@ -7,7 +7,7 @@
WARRANTY OF ANY KIND, either express or implied. See the License for the specific WARRANTY OF ANY KIND, either express or implied. See the License for the specific
language governing rights and limitations under the License. language governing rights and limitations under the License.
The Original Code is the Venice Web Community System. The Original Code is the Venice Web Communities System.
The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, 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 for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
@ -105,8 +105,7 @@ private static String getActivityString(SIGContext sig, RenderData rdat)
<%= rdat.getStdFontTag(null,2) %> <%= rdat.getStdFontTag(null,2) %>
Display all categories whose name&nbsp;&nbsp; Display all categories whose name&nbsp;&nbsp;
<% } else throw new InternalStateError("display parameter " + String.valueOf(data.getDisplayOption()) <% } else throw new InternalStateError("display parameter " + data.getDisplayOption() + " invalid"); %>
+ " invalid"); %>
<SELECT NAME="mode" SIZE=1> <SELECT NAME="mode" SIZE=1>
<OPTION VALUE="<%= SearchMode.SEARCH_PREFIX %>" <OPTION VALUE="<%= SearchMode.SEARCH_PREFIX %>"

View File

@ -0,0 +1,59 @@
<%--
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) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
Contributor(s):
--%>
<%@ page import = "java.util.*" %>
<%@ page import = "com.silverwrist.util.StringUtil" %>
<%@ page import = "com.silverwrist.venice.core.*" %>
<%@ page import = "com.silverwrist.venice.servlets.Variables" %>
<%@ page import = "com.silverwrist.venice.servlets.format.*" %>
<%
ManageConference data = ManageConference.retrieve(request);
Variables.failIfNull(data);
RenderData rdat = RenderConfig.createRenderData(application,request,response);
%>
<% if (rdat.useHTMLComments()) { %><!-- Managing conference #<%= data.getConfID() %> --><% } %>
<% rdat.writeContentHeader(out,"Manage Conference:",data.getConfName()); %>
<%= rdat.getStdFontTag(null,2) %>
<A HREF="<%= rdat.getEncodedServletPath("confdisp?" + data.getLocator()) %>">Return to Topic List</A>
</FONT><P>
<% if (rdat.useHTMLComments()) { %><!-- Set Default Pseud Form --><% } %>
<FORM METHOD="POST" ACTION="<%= rdat.getEncodedServletPath("confops") %>">
<INPUT TYPE="HIDDEN" NAME="sig" VALUE="<%= data.getSIGID() %>">
<INPUT TYPE="HIDDEN" NAME="conf" VALUE="<%= data.getConfID() %>">
<INPUT TYPE="HIDDEN" NAME="cmd" VALUE="P">
<%= rdat.getStdFontTag(null,2) %>
Set default pseud for conference:
<INPUT TYPE="TEXT" NAME="pseud" VALUE="" SIZE=37 MAXLENGTH=255>&nbsp;
<INPUT TYPE="IMAGE" SRC="<%= rdat.getFullImagePath("bn_set.gif") %>" NAME="set" ALT="Set"
WIDTH=80 HEIGHT=24 BORDER=0>
</FONT>
</FORM><P>
<% if (rdat.useHTMLComments()) { %><!-- Fixseen Link --><% } %>
<%= rdat.getStdFontTag(null,2) %><B>
<A HREF="<%= rdat.getEncodedServletPath("confops?" + data.getLocator() + "&cmd=FX") %>">Mark
entire conference as read (fixseen)</A>
</B></FONT><P>
<% if (data.displayAdminSection()) { %>
<% if (rdat.useHTMLComments()) { %><!-- Host Tools Section --><% } %>
<%-- TODO: fill this in --%>
<% } // end if (displaying admin section) %>
<% rdat.writeFooter(out); %>

View File

@ -34,8 +34,8 @@
tmp = "(Frozen) "; tmp = "(Frozen) ";
else else
tmp = ""; tmp = "";
rdat.writeContentHeader(out,data.getTopicName(),tmp + String.valueOf(data.getTotalMessages()) rdat.writeContentHeader(out,data.getTopicName(),tmp + data.getTotalMessages() + " Total; "
+ " Total; " + String.valueOf(data.getNewMessages()) + " New; Last: " + data.getNewMessages() + " New; Last: "
+ rdat.formatDateForDisplay(data.getLastUpdate())); + rdat.formatDateForDisplay(data.getLastUpdate()));
%> %>
<TABLE BORDER=0 WIDTH="100%" CELLPADDING=0 CELLSPACING=0> <TABLE BORDER=0 WIDTH="100%" CELLPADDING=0 CELLSPACING=0>
@ -162,7 +162,7 @@
<% } // end if %> <% } // end if %>
<%= rdat.getStdFontTag(null,2) %> <%= rdat.getStdFontTag(null,2) %>
<A HREF="<%= rdat.getEncodedServletPath("confdisp?" + data.getLocator() + "&shac=1&p1=" <A HREF="<%= rdat.getEncodedServletPath("confdisp?" + data.getLocator() + "&shac=1&p1="
+ String.valueOf(msg.getPostNumber())) %>"><%= msg.getPostNumber() %></A> of + msg.getPostNumber()) %>"><%= msg.getPostNumber() %></A> of
<A HREF="<%= last_post %>"><%= data.getTotalMessages() - 1 %></A> <A HREF="<%= last_post %>"><%= data.getTotalMessages() - 1 %></A>
<%= rdat.getStdFontTag(null,1) %>&lt;<%= data.getMessageReference(msg) %>&gt;</FONT> <%= rdat.getStdFontTag(null,1) %>&lt;<%= data.getMessageReference(msg) %>&gt;</FONT>
<% if (data.showAdvanced() && msg.isHidden()) { %> <% if (data.showAdvanced() && msg.isHidden()) { %>
@ -176,7 +176,7 @@
</EM>) </EM>)
<% if (msg.hasAttachment()) { %> <% if (msg.hasAttachment()) { %>
<A HREF="<%= rdat.getEncodedServletPath("attachment?" + data.getConfLocator() + "&msg=" <A HREF="<%= rdat.getEncodedServletPath("attachment?" + data.getConfLocator() + "&msg="
+ String.valueOf(msg.getPostID())) %>"><IMG + msg.getPostID()) %>"><IMG
SRC="<%= rdat.getFullImagePath("attachment.gif") %>" SRC="<%= rdat.getFullImagePath("attachment.gif") %>"
ALT="(Attachment <%= msg.getAttachmentFilename() %> - <%= msg.getAttachmentLength() %> bytes)" ALT="(Attachment <%= msg.getAttachmentFilename() %> - <%= msg.getAttachmentLength() %> bytes)"
WIDTH=16 HEIGHT=16 BORDER=0></A> WIDTH=16 HEIGHT=16 BORDER=0></A>
@ -190,14 +190,14 @@
<% } else if (msg.isHidden() && !(data.showAdvanced())) { %> <% } else if (msg.isHidden() && !(data.showAdvanced())) { %>
<TT><EM><B> <TT><EM><B>
<A HREF="<%= rdat.getEncodedServletPath("confdisp?" + data.getLocator() + "&shac=1&p1=" <A HREF="<%= rdat.getEncodedServletPath("confdisp?" + data.getLocator() + "&shac=1&p1="
+ String.valueOf(msg.getPostNumber())) %>">(Hidden + msg.getPostNumber()) %>">(Hidden
Message: <%= msg.getNumLines() %> <% if (msg.getNumLines()==1) { %>Line<% } else { %>Lines<% } %>)</A> Message: <%= msg.getNumLines() %> <% if (msg.getNumLines()==1) { %>Line<% } else { %>Lines<% } %>)</A>
</B></EM></TT><P> </B></EM></TT><P>
<% } else { %> <% } else { %>
<PRE><%= rdat.rewritePostData(data.getMessageBodyText(msg)) %></PRE> <PRE><%= rdat.rewritePostData(data.getMessageBodyText(msg)) %></PRE>
<% } // end if %> <% } // end if %>
<% if (data.showAdvanced()) { %> <% if (data.showAdvanced()) { %>
<% String po_loc = data.getLocator() + "&msg=" + String.valueOf(msg.getPostNumber()); %> <% String po_loc = data.getLocator() + "&msg=" + msg.getPostNumber(); %>
</TD><TD NOWRAP ALIGN=RIGHT> </TD><TD NOWRAP ALIGN=RIGHT>
<% if (!(msg.isScribbled())) { %> <% if (!(msg.isScribbled())) { %>
<% if (msg.canHide()) { %> <% if (msg.canHide()) { %>

View File

@ -7,7 +7,7 @@
WARRANTY OF ANY KIND, either express or implied. See the License for the specific WARRANTY OF ANY KIND, either express or implied. See the License for the specific
language governing rights and limitations under the License. language governing rights and limitations under the License.
The Original Code is the Venice Web Community System. The Original Code is the Venice Web Communities System.
The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, 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 for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
@ -51,9 +51,12 @@
<% if (data.isUserLoggedIn()) { %> <% if (data.isUserLoggedIn()) { %>
<DIV ALIGN="CENTER"> <DIV ALIGN="CENTER">
<% if (sig.isMember()) { %> <% if (sig.isMember()) { %>
<A HREF="/TODO"><IMG SRC="<%= rdat.getFullImagePath("bn_invite.gif") %>" ALT="Invite" WIDTH=80 HEIGHT=24 BORDER=0></A> <A HREF="/TODO"><IMG SRC="<%= rdat.getFullImagePath("bn_invite.gif") %>" ALT="Invite"
WIDTH=80 HEIGHT=24 BORDER=0></A>
<% } else if (sig.canJoin()) { %> <% } else if (sig.canJoin()) { %>
<A HREF="<%= rdat.getEncodedServletPath("sigops?cmd=J&sig=" + String.valueOf(sig.getSIGID())) %>"><IMG SRC="<%= rdat.getFullImagePath("bn_join_now.gif") %>" ALT="Join Now" WIDTH=80 HEIGHT=24 BORDER=0></A> <A HREF="<%= rdat.getEncodedServletPath("sigops?cmd=J&sig=" + sig.getSIGID()) %>"><IMG
SRC="<%= rdat.getFullImagePath("bn_join_now.gif") %>" ALT="Join Now"
WIDTH=80 HEIGHT=24 BORDER=0></A>
<% } // end if %> <% } // end if %>
</DIV> </DIV>
<% } // end if (user is logged in) %> <% } // end if (user is logged in) %>

View File

@ -31,7 +31,7 @@
<% rdat.writeContentHeader(out,"Topics in " + data.getConfName(),null); %> <% rdat.writeContentHeader(out,"Topics in " + data.getConfName(),null); %>
<%= rdat.getStdFontTag(null,2) %> <%= rdat.getStdFontTag(null,2) %>
<DIV ALIGN="LEFT"> <DIV ALIGN="LEFT">
<A HREF="<%= rdat.getEncodedServletPath("confops?sig=" + String.valueOf(data.getSIGID())) %>"><IMG <A HREF="<%= rdat.getEncodedServletPath("confops?sig=" + data.getSIGID()) %>"><IMG
SRC="<%= rdat.getFullImagePath("bn_conference_list.gif") %>" ALT="Conference List" WIDTH=80 HEIGHT=24 SRC="<%= rdat.getFullImagePath("bn_conference_list.gif") %>" ALT="Conference List" WIDTH=80 HEIGHT=24
BORDER=0></A>&nbsp;&nbsp; BORDER=0></A>&nbsp;&nbsp;
<% if (data.canCreateTopic()) { %> <% if (data.canCreateTopic()) { %>
@ -56,32 +56,32 @@
<TR VALIGN=TOP> <TR VALIGN=TOP>
<TD ALIGN=LEFT WIDTH="1%"><%= rdat.getStdFontTag(null,2) %> <TD ALIGN=LEFT WIDTH="1%"><%= rdat.getStdFontTag(null,2) %>
<% tmp = self + "&sort=" <% tmp = self + "&sort="
+ String.valueOf(data.isSort(ConferenceContext.SORT_NUMBER) ? -ConferenceContext.SORT_NUMBER + (data.isSort(ConferenceContext.SORT_NUMBER) ? -ConferenceContext.SORT_NUMBER
: ConferenceContext.SORT_NUMBER); %> : ConferenceContext.SORT_NUMBER); %>
<B><A HREF="<%= rdat.getEncodedServletPath(tmp) %>">#</A></B> <B><A HREF="<%= rdat.getEncodedServletPath(tmp) %>">#</A></B>
</FONT></TD> </FONT></TD>
<TD ALIGN=LEFT><%= rdat.getStdFontTag(null,2) %> <TD ALIGN=LEFT><%= rdat.getStdFontTag(null,2) %>
<% tmp = self + "&sort=" <% tmp = self + "&sort="
+ String.valueOf(data.isSort(ConferenceContext.SORT_NAME) ? -ConferenceContext.SORT_NAME + (data.isSort(ConferenceContext.SORT_NAME) ? -ConferenceContext.SORT_NAME
: ConferenceContext.SORT_NAME); %> : ConferenceContext.SORT_NAME); %>
<B><A HREF="<%= rdat.getEncodedServletPath(tmp) %>">Topic Name</A></B> <B><A HREF="<%= rdat.getEncodedServletPath(tmp) %>">Topic Name</A></B>
</FONT></TD> </FONT></TD>
<TD ALIGN=RIGHT><%= rdat.getStdFontTag(null,2) %> <TD ALIGN=RIGHT><%= rdat.getStdFontTag(null,2) %>
<% tmp = self + "&sort=" <% tmp = self + "&sort="
+ String.valueOf(data.isSort(ConferenceContext.SORT_UNREAD) ? -ConferenceContext.SORT_UNREAD + (data.isSort(ConferenceContext.SORT_UNREAD) ? -ConferenceContext.SORT_UNREAD
: ConferenceContext.SORT_UNREAD); %> : ConferenceContext.SORT_UNREAD); %>
<B><A HREF="<%= rdat.getEncodedServletPath(tmp) %>">New</A></B> <B><A HREF="<%= rdat.getEncodedServletPath(tmp) %>">New</A></B>
</FONT></TD> </FONT></TD>
<TD ALIGN=RIGHT><%= rdat.getStdFontTag(null,2) %> <TD ALIGN=RIGHT><%= rdat.getStdFontTag(null,2) %>
<% tmp = self + "&sort=" <% tmp = self + "&sort="
+ String.valueOf(data.isSort(ConferenceContext.SORT_TOTAL) ? -ConferenceContext.SORT_TOTAL + (data.isSort(ConferenceContext.SORT_TOTAL) ? -ConferenceContext.SORT_TOTAL
: ConferenceContext.SORT_TOTAL); %> : ConferenceContext.SORT_TOTAL); %>
<B><A HREF="<%= rdat.getEncodedServletPath(tmp) %>">Total</A></B> <B><A HREF="<%= rdat.getEncodedServletPath(tmp) %>">Total</A></B>
</FONT></TD> </FONT></TD>
<TD ALIGN=LEFT><%= rdat.getStdFontTag(null,2) %> <TD ALIGN=LEFT><%= rdat.getStdFontTag(null,2) %>
<% tmp = self + "&sort=" <% tmp = self + "&sort="
+ String.valueOf(data.isSort(ConferenceContext.SORT_DATE) ? -ConferenceContext.SORT_DATE + (data.isSort(ConferenceContext.SORT_DATE) ? -ConferenceContext.SORT_DATE
: ConferenceContext.SORT_DATE); %> : ConferenceContext.SORT_DATE); %>
<B><A HREF="<%= rdat.getEncodedServletPath(tmp) %>">Last Response</A></B> <B><A HREF="<%= rdat.getEncodedServletPath(tmp) %>">Last Response</A></B>
</FONT></TD> </FONT></TD>
</TR> </TR>
@ -90,7 +90,7 @@
<% while (it.hasNext()) { %> <% while (it.hasNext()) { %>
<% <%
TopicContext topic = (TopicContext)(it.next()); TopicContext topic = (TopicContext)(it.next());
tmp = self + "&top=" + String.valueOf(topic.getTopicNumber()) + "&rnm=1"; tmp = self + "&top=" + topic.getTopicNumber() + "&rnm=1";
%> %>
<TR VALIGN=TOP> <TR VALIGN=TOP>
<TD ALIGN=LEFT WIDTH="1%"><%= rdat.getStdFontTag(null,2) %> <TD ALIGN=LEFT WIDTH="1%"><%= rdat.getStdFontTag(null,2) %>
@ -108,7 +108,7 @@
<A HREF="<%= rdat.getEncodedServletPath(tmp) %>"><%= topic.getUnreadMessages() %></A> <A HREF="<%= rdat.getEncodedServletPath(tmp) %>"><%= topic.getUnreadMessages() %></A>
</FONT></TD> </FONT></TD>
<TD ALIGN=RIGHT><%= rdat.getStdFontTag(null,2) %> <TD ALIGN=RIGHT><%= rdat.getStdFontTag(null,2) %>
<A HREF="<%= rdat.getEncodedServletPath(self + "&top=" + String.valueOf(topic.getTopicNumber()) <A HREF="<%= rdat.getEncodedServletPath(self + "&top=" + topic.getTopicNumber()
+ "&p1=0&p2=-1") %>"><%= topic.getTotalMessages() %></A> + "&p1=0&p2=-1") %>"><%= topic.getTotalMessages() %></A>
</FONT></TD> </FONT></TD>
<TD ALIGN=LEFT><%= rdat.getStdFontTag(null,2) %> <TD ALIGN=LEFT><%= rdat.getStdFontTag(null,2) %>
@ -156,31 +156,34 @@
<% if (data.isView(ConferenceContext.DISPLAY_NEW)) { %> <% if (data.isView(ConferenceContext.DISPLAY_NEW)) { %>
<B>New</B> <B>New</B>
<% } else { %> <% } else { %>
<A HREF="<%= rdat.getEncodedServletPath(self + "&view=" + String.valueOf(ConferenceContext.DISPLAY_NEW)) %>">New</A> <A HREF="<%= rdat.getEncodedServletPath(self + "&view=" + ConferenceContext.DISPLAY_NEW) %>">New</A>
<% } // end if %> <% } // end if %>
<B>|</B> <B>|</B>
<% if (data.isView(ConferenceContext.DISPLAY_ACTIVE)) { %> <% if (data.isView(ConferenceContext.DISPLAY_ACTIVE)) { %>
<B>Active</B> <B>Active</B>
<% } else { %> <% } else { %>
<A HREF="<%= rdat.getEncodedServletPath(self + "&view=" + String.valueOf(ConferenceContext.DISPLAY_ACTIVE)) %>">Active</A> <A HREF="<%= rdat.getEncodedServletPath(self + "&view="
+ ConferenceContext.DISPLAY_ACTIVE) %>">Active</A>
<% } // end if %> <% } // end if %>
<B>|</B> <B>|</B>
<% if (data.isView(ConferenceContext.DISPLAY_ALL)) { %> <% if (data.isView(ConferenceContext.DISPLAY_ALL)) { %>
<B>All</B> <B>All</B>
<% } else { %> <% } else { %>
<A HREF="<%= rdat.getEncodedServletPath(self + "&view=" + String.valueOf(ConferenceContext.DISPLAY_ALL)) %>">All</A> <A HREF="<%= rdat.getEncodedServletPath(self + "&view=" + ConferenceContext.DISPLAY_ALL) %>">All</A>
<% } // end if %> <% } // end if %>
<B>|</B> <B>|</B>
<% if (data.isView(ConferenceContext.DISPLAY_HIDDEN)) { %> <% if (data.isView(ConferenceContext.DISPLAY_HIDDEN)) { %>
<B>Hidden</B> <B>Hidden</B>
<% } else { %> <% } else { %>
<A HREF="<%= rdat.getEncodedServletPath(self + "&view=" + String.valueOf(ConferenceContext.DISPLAY_HIDDEN)) %>">Hidden</A> <A HREF="<%= rdat.getEncodedServletPath(self + "&view="
+ ConferenceContext.DISPLAY_HIDDEN) %>">Hidden</A>
<% } // end if %> <% } // end if %>
<B>|</B> <B>|</B>
<% if (data.isView(ConferenceContext.DISPLAY_ARCHIVED)) { %> <% if (data.isView(ConferenceContext.DISPLAY_ARCHIVED)) { %>
<B>Archived</B> <B>Archived</B>
<% } else { %> <% } else { %>
<A HREF="<%= rdat.getEncodedServletPath(self + "&view=" + String.valueOf(ConferenceContext.DISPLAY_ARCHIVED)) %>">Archived</A> <A HREF="<%= rdat.getEncodedServletPath(self + "&view="
+ ConferenceContext.DISPLAY_ARCHIVED) %>">Archived</A>
<% } // end if %> <% } // end if %>
<B>]</B> <B>]</B>
</DIV> </DIV>