2002-01-06 19:05:37 -07:00
|
|
|
// 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.
|
|
|
|
//
|
2006-01-25 21:40:34 -07:00
|
|
|
// The Initial Developer of the Original Code is Eric J. Bowersox <erbo@users.sf.net>,
|
2002-01-06 19:05:37 -07:00
|
|
|
// 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):
|
|
|
|
|
|
|
|
importPackage(java.util);
|
|
|
|
importPackage(Packages.com.silverwrist.util);
|
|
|
|
importPackage(Packages.com.silverwrist.venice.core);
|
|
|
|
importPackage(Packages.com.silverwrist.venice.except);
|
|
|
|
importPackage(Packages.com.silverwrist.venice.ui);
|
|
|
|
importPackage(Packages.com.silverwrist.venice.ui.conf);
|
|
|
|
importPackage(Packages.com.silverwrist.venice.ui.helpers);
|
|
|
|
|
|
|
|
// get the request object
|
|
|
|
rinput = bsf.lookupBean("request");
|
|
|
|
|
|
|
|
if (rinput.isFileParam("target"))
|
|
|
|
{ // the target should be a normal parameter
|
|
|
|
logger.error("Internal Error: 'target' should be a normal param");
|
|
|
|
vlib.output(new ErrorBox(null,"Internal Error: 'target' should be a normal param","top.js.vs"));
|
|
|
|
vlib.done();
|
|
|
|
|
|
|
|
} // end if
|
|
|
|
|
|
|
|
// Get the operations target.
|
|
|
|
target = rinput.getParameter("target");
|
|
|
|
logger.debug("Target URL: " + target);
|
|
|
|
rinput.location = target;
|
|
|
|
|
|
|
|
// also check on file parameter status
|
|
|
|
if (!(rinput.isFileParam("thefile")))
|
|
|
|
{ // bogus file parameter
|
|
|
|
logger.error("Internal Error: 'thefile' should be a file param");
|
|
|
|
vlib.output(new ErrorBox(null,"Internal Error: 'thefile' should be a file param",target));
|
|
|
|
vlib.done();
|
|
|
|
|
|
|
|
} // end if
|
|
|
|
|
|
|
|
// get the community
|
|
|
|
comm = rinput.getCommunity(true,target);
|
|
|
|
|
|
|
|
// get the current conference
|
|
|
|
currc = new CurrentConference(rinput);
|
|
|
|
conf = currc.getConference(true,target);
|
|
|
|
|
|
|
|
// get the message we're attaching to
|
|
|
|
msg = currc.getMessageParam("msg",true,target);
|
|
|
|
|
|
|
|
rc = null;
|
|
|
|
try
|
|
|
|
{ // do the attachment!
|
|
|
|
msg.attachData(rinput.getParameterType("thefile"),rinput.getParameter("thefile"),
|
|
|
|
rinput.getParameterSize("thefile"),rinput.getParameterDataStream("thefile"));
|
|
|
|
|
|
|
|
// now bounce us where we wanted to go in the first place
|
|
|
|
rc = new Redirect(target,LinkTypes.SERVLET);
|
|
|
|
|
|
|
|
} // end try
|
|
|
|
catch (e)
|
|
|
|
{ // failure in setting attachment
|
|
|
|
etype = vlib.exceptionType(e) + "";
|
|
|
|
if (etype.match("DataException"))
|
|
|
|
rc = new ErrorBox("Database Error","Database error saving attachment: " + e.message,target);
|
|
|
|
else if (etype.match("AccessError"))
|
|
|
|
rc = new ErrorBox("Access Error",e.message,target);
|
|
|
|
else if (etype.match("ServletMultipartException"))
|
|
|
|
rc = new ErrorBox("Internal Error",e.message,target);
|
|
|
|
else
|
|
|
|
rc = e;
|
|
|
|
|
|
|
|
} // end catch
|
|
|
|
|
|
|
|
vlib.output(rc); // all done!
|